It is assumed that the user is familiar with how to use ATHENA. If that is not the case, he or she should consult The ATLAS WorkBook and glance at these tutorials before coming. The user may also want to take this tutorial before proceeding further.
Keep the Physics Analysis Tools page and the how-to for users as a reference.
If you are not familiar with the ATLAS software, refer to the documentation mentioned above before coming to the tutorial. We will use the ATLAS software release 11.0.3 for this tutorial.
In the following tutorial, the tcsh is assumed, the default on the US ATLAS linux farm. If you work in the bash
shell, for example on the CERN lxplus, simply use setup.sh everywhere instead of setup.csh. If you are working at
CERN, the input RDO file used in the Exercises 1-5 can be founded in castor: /castor/cern.ch/atlas/csc/valiprod/sampleA/mc11/004100.T1_McAtNLO_top/digit/v11000301/
Exercise 0: Make sure that CMT is setup correctly
Exercise 1: ESD/AOD/TAG Production Exercise 2: User Analysis Algorithm Exercise 3: Tag Based Event Selection and Athena-Aware NTuple Exercise 4: User Analysis in Distributed Analysis Environment Exercise 5: Interactive analysis and Event Display Exercise 6: An example on AOD Exercise 7: TrackParticle and Navigation Exercise 8: Monte Carlo Truth Exercise 9: An example on ESD - Adding another Algorithm Exercise 10: Overlap checking, Redundancy Removal, Event View Some AOD Analysis Tools
0.1 Login to a US ATLAS Linux Machine at BNL or to lxplus at CERN
ssh atlasgw00.bnl.gov
xterm -i
At CERN, you would login to lxplus as follows:
ssh lxplus.cern.chIf you are working on the US ATLAS machines, make sure that this line is in your .login file in your home directory. If not, you should add it, log out and login in again (do not do this if you are working at CERN):
source /afs/usatlas.bnl.gov/i386_redhat72/opt/dcache/dcache_root_client_config.csh
0.2 Create a directory called tutorial
cd
mkdir tutorial
cd tutorial
0.3 Check that my requirements file is set for 11.0.3
Here is Jane Doe's requirements file. If you do not have a file called "requirements",
create one add the lines below to it.
If you are working on the US ATLAS machines, your requirements file should look like this:
###################################################################
set CMTSITE BNL
set SITEROOT /afs/usatlas.bnl.gov
macro ATLAS_DIST_AREA ${SITEROOT}/software/dist
macro ATLAS_TEST_AREA "" \
11.0.3 "${HOME}/tutorial"
use AtlasLogin AtlasLogin-* $(ATLAS_DIST_AREA)
###################################################################
Then do this:
source /afs/usatlas.bnl.gov/cernsw/contrib/CMT/v1r18p20050501/mgr/setup.csh cmt configIf you are working at CERN, your requirements file should look like this:
###################################################################
set CMTSITE CERN
set SITEROOT /afs/cern.ch
macro ATLAS_DIST_AREA ${SITEROOT}/atlas/software/dist
macro ATLAS_TEST_AREA "" \
11.0.3 "${HOME}/tutorial"
use AtlasLogin AtlasLogin-* $(ATLAS_DIST_AREA)
###################################################################
then do this - if you are working at CERN:
/afs/cern.ch/sw/contrib/CMT/v1r18p20050501/mgr/setup.sh cmt config
0.4 Create the working directory
mkdir 11.0.3
0.5 Setup CMT
Jane Doe's working directory for this tutorial is "${HOME}/tutorial/11.0.3" where
${HOME}=/usatlas/u/janedoe. So, Jane Doe will setup CMT by doing this
source setup.csh -tag=11.0.3,opt
Then, Jane Doe checks that the CMT path is correctly defined by doing this:
echo $CMTPATH
Something like this is printed to the screen
/usatlas/u/ketevi/tutorial/11.0.3: /afs/usatlas.bnl.gov/software/dist/11.0.3: /afs/usatlas.bnl.gov/offline/external/Gaudi/0.14.6.14-pool201: /afs/usatlas.bnl.gov/offline/external/LCGCMT/LCGCMT_33The path to Jane Doe's working directory, to the ATLAS software distribution, to external libraries are all defined.
0.6 Change Directory to your working area for this tutorial
Jane Doe does the following:
cd 11.0.3
0.7 Reconstruction/RecExample/RecExCommon
So Jane Doe checks out this package by doing this.
cmt co -r RecExCommon-00-04-38 Reconstruction/RecExample/RecExCommon
0.8 Compile, and build this package
cd Reconstruction/RecExample/RecExCommon/RecExCommon-00-04-38/cmt
cmt config
source setup.csh
cmt broadcast gmake
0.9 Test it
Get the following files for the release and run ATHENA:
cd ../run
get_files PDGTABLE.MeV
get_files HelloWorldOptions.py
athena.py -b HelloWorldOptions.py
Stuff like this should be printed to the screen
HelloWorld INFO execute() HelloWorld INFO An INFO message HelloWorld WARNING A WARNING message HelloWorld ERROR An ERROR message HelloWorld FATAL A FATAL error message AthenaEventLoopMgr INFO ===>>> end of event 9 <<<=== HistorySvc INFO Service finalised successfully ChronoStatSvc.f... INFO Service finalized succesfully ToolSvc INFO Removing all tools created by ToolSvc ApplicationMgr INFO Application Manager Finalized successfully ApplicationMgr INFO Application Manager Terminated successfully
If you successfuly reach this point, you are ready for the tutorial, otherwise, please seek help before continuing.
0.10 The next time you login
The next you login to the USATLAS Linux machines, you set up CMT by just doing the following
In ${HOME}/tutorial directory or where you have your "requirements" file
source setup.csh -tag=11.0.3,opt
Then
cd 11.0.3/Reconstruction/RecExample/RecExCommon/.../cmt
source setup.csh
cd ../run
Take a look at
Information for New Users for further details on how to get started with the ATLAS
software.
1.1 Set up for the ESD/AOD/TAG Production
You should already be in the "run" directory of RecExCommon, if not, change directory to the "run" directory of
RecExCommon. Get the reconstruction top options file from the
release:
get_files myTopOptions.py
Add the following lines to your myTopOptions.py
file just above this line:
# DetFlags modifications are best set here (uncomment RecExCommon_flags first)
to produce the ESD/AOD/TAG.
############################################################################ #The Detector Description DetDescrVersion="ATLAS-DC3-02" #Number of Events to process EvtMax=5 #Input Raw Data PoolRDOInput=["/usatlas/magdacache001/ketevi/ttbar/digit/4100/mc11.004100.T1_McAtNLO_top.digit.RDO.v11000301._00001.pool.root"] #Suppress the production of NTuple Histograms doCBNT = False doHist = False # AOD Flags are set here - comment out and set appropriately from ParticleEventAthenaPool.AODFlags import AODFlags AODFlags.Streaming = False # switch off streaming #############################################################################Note that if you are working at CERN, your input Raw Data (RDO) is on castor. This means that in the above and wherever relevant in the Exercises 1-5, PoolRDOInput should be set to:
PoolRDOInput=[ "castor:/castor/cern.ch/atlas/csc/valiprod/sampleA/mc11/004100.T1_McAtNLO_top/digit/v11000301/mc11.004100.T1_McAtNLO_top.digit.RDO.v11000301._00001.pool.root" ]Now produce the ESD, AOD and TAG:
athena.py -b myTopOptions.pyYou can can change the name and set the location of the ESD/AOD/TAG files by adding these lines to your myTopOptions.py file:
PoolESDOutput = "ESD output file path and name" PoolAODOutput = "AOD output file path and name" CollOutput = "TAG output file path and name - no extension: .root will be appended"
1.2 Configuring your ESD/AOD production jobs
(a) Create a new file called optRecExToESD.AOD.TAG.py for the options to produce the ESD/AOD/TAG and add
these lines to the file and save it.
############################################################################ #The Detector Description DetDescrVersion="ATLAS-DC3-02" #Number of Events to process EvtMax=5 #Input Raw Data PoolRDOInput=["/usatlas/magdacache001/ketevi/ttbar/digit/4100/mc11.004100.T1_McAtNLO_top.digit.RDO.v11000301._00001.pool.root"] #Suppress the production of NTuple Histograms doCBNT = False doHist = False # AOD Flags are set here - comment out and set appropriately from ParticleEventAthenaPool.AODFlags import AODFlags AODFlags.Streaming = False # switch off streaming #############################################################################(b) Get the reconstruction top options file: RecExCommon_topOptions.py:
get_files RecExCommon_topOptions.py(c) Rename the file myTopOption.py to ESD.AOD.TAG_topOptions.py and get a new copy of myTopOptions.py from the release:
mv myTopOptions.py ESD.AOD.TAG_topOptions.py get_files myTopOptions.py(c) You can also produce the ESD/AOD/TAG in the following way - but do not do it in this tutorial. This is just show the many different ways to produce the ESD/AOD/TAG.
athena.py -b optRecExToESD.AOD.TAG.py RecExCommon_topOptions.pyor
athena.py -b optRecExToESD.AOD.TAG.py myTopOptions.py(d) It is also possible to specify the options at the command line:
athena.py -b -c 'EvtMax=100; PoolESDInput=["ESD.pool.root"]; PoolAODOutput="AOD.pool.root"; ...' RecExCommon_topOptions.pyWhere do I find the list of the reconstruction flags?. Look also here for further details
1.3 Produce your own AOD from a given ESD
Create a new file called optESDtoAOD.py for the options to produce the AOD from the ESD and add the following lines to the file and save it. (Since we are producing the AOD from the ESD, we need to have the ESD file available. Use the ESD that you produced in Exercise 1.1 as the input for the AOD production. The default output name for the AOD is AOD.pool.root).
############################################################################# AllAlgs = False EvtMax=5 DetDescrVersion="ATLAS-DC3-02" PoolESDInput = ["ESD.pool.root"] # change file name and path appropriately PoolAODOutput = "AOD.FromESD.pool.root" # change file name an dpath doWriteESD = False doWriteTAG = False readESD = True doCBNT = False doHist = False # AOD Flags are set here - comment out and set appropriately from ParticleEventAthenaPool.AODFlags import AODFlags AODFlags.Streaming = False # switch off streaming #############################################################################Produce the AOD:
athena.py -b optESDtoAOD.py myTopOptions.pyTo specify a different file name for your AOD, add this line:
-rw-r--r-- 1 ketevi usatlas 1194711 Dec 26 12:13 AOD.FromESD.pool.root -rw-r--r-- 1 ketevi usatlas 1201618 Dec 26 12:00 AOD.pool.root -rw-r--r-- 1 ketevi usatlas 5693334 Dec 26 12:00 ESD.pool.root -rw-r--r-- 1 ketevi usatlas 74516 Dec 26 11:57 MyColl.root <--- TAG -rw-r--r-- 1 ketevi usatlas 657 Dec 26 12:13 PoolFileCatalog.xml
# AOD Flags from ParticleEventAthenaPool.AODFlags import AODFlags AODFlags.SpclMC = False
1.4 Running on many input files
For the ESD/AOD/TAG production in Exercise 1.1, we only used one raw data file which has only
100 events. For more statistics on the same dataset, you can specify more input files. Suppose you want 200
events in the ESD: since each of these ttbar files have 100 events, the PoolRDOInput (see Exercise 1.1 above) could
be changed to the
following:
PoolRDOInput = [
"/usatlas/magdacache001/ketevi/ttbar/digit/4100/mc11.004100.T1_McAtNLO_top.digit.RDO.v11000301._00001.pool.root",
"/usatlas/magdacache001/ketevi/ttbar/digit/4100/mc11.004100.T1_McAtNLO_top.digit.RDO.v11000301._00002.pool.root"
]
The same is true for the production of the AOD, if you run over many different input ESD files.
1.5 Fast Simulation AOD
Fast simulation AOD can be obtained from generated events. Suppose you use Pythia to generate
ttbar events and you save the output of the generator as POOL file:
get_files produceGenEvents_jobOptions.py
Edit this file to see what is in it: the generation of inclusive ttbar events in Pythia. In 11.0.3, comments out
the following lines:
Pythia.PythiaCommand += ["pypars mstp 51 7"] Pythia.PythiaCommand += ["pypars mstp 128 1"] Pythia.PythiaCommand += ["pyinit output EventListing.out","pyinit dumpr 1 3"]; Pythia.PythiaCommand += ["pystat 3"] Pythia.PythiaCommand += ["pyinit pylistf 1"] Pythia.PythiaCommand += ["pyinit pylisti 12"]Run this job options:
athena.py -b produceGenEvents_jobOptions.pyIt will create an output file, McEvent.root. The file contains the output of generator. Note that the simulation steps are as follow:
get_files FastSimToAOD_topOptions.pyEdit this file and replace this line
INPUT = [ "rfio:/castor/cern.ch/atlas/project/dc2/preprod/evgen804/dc2.002896.pyt_h130_llll.evgen804/data/dc2.002896.pyt_h130_llll.evgen804._0001.pool.root" ]
with this one
INPUT = [ "McEvent.root" ]
Also, after the following line:
AODFlags.MissingEtTruth = Trueadd this line so that the output of the generation in the McEvent.root is used as input to the fast simulation:
AODFlags.McEventKey="GEN_EVENT"Now produce your fast simulation AOD
athena.py -b FastSimToAOD_topOptions.pyNote that you can change number of events, the input file name and the AOD output file name, directly at the command line: look in FastSimToAOD_topOptions.py for further details. But try this:
athena.py -b -c 'INPUT=["McEvent.root"]; OUTPUT="fastAOD.root"; EVTMAX=100' FastSimToAOD_topOptions.pyYou can also use the output of the Geant 4 simulation - i.e., the generator output plus the Geant interactions - as the input to your fast simulation: this is called "TruthEvent" as opposed to "GEN_EVENT". "TruthEvent" is saved by default in the simulated files, the digitized (or Raw Data files) and in the ESD, any of which can therefore be used as the input to the fast simulation. Before you try this, edit FastSimToAOD_topOptions.py and comment out this line:
AODFlags.McEventKey="GEN_EVENT"so that "TruthEvent" from the ESD will be taken by default. Now run the fast simulation on the ESD:
athena.py -b -c 'INPUT=["ESD.pool.root"]; OUTPUT="fastAOD.root"; EVTMAX=100' FastSimToAOD_topOptions.pyNote however that ONLY the generator part of "TruthEvent" is used for Atlfast. Furthermore, since the relase 11.1.0, the fast and full simulated AOD are saved together in the same output file.
1.6 Large Scale Production of ESD/AOD
For large scale production, one should consider creating shell scripts to submit several jobs on the LSF batch system, on Condor, or on the grid - or customize job transformations used in the central ATLAS production. Some example scripts are available in the AnalysisExample. A job transformation for ESD, combined NTuple and AOD production can be in rome.reco.trf
1.7 Comments of ESD/AOD Production
Since the release 10.4.1, the default reconstruction produces the ESD, AOD and Tags by default: this means that you do not need to explicitly switch ON these production flags (doWriteAOD=True for example). Rather, you explicitly switch them OFF when you do not want ESD/AOD/Tags produced. To see how to configure your ESD, AOD and Tag production in the release 10.4.1 or higher and how to customize contents of your ESD/AOD, see this page.
1.8 Merging AOD files
It is sometimes necessary to merge small AOD files into bigger, more manageable chunks. The Utilities exist to do this. Look in MergingAOD and follow the instructions there.
2.1 Create your own Analysis Algorithm
We provide a package, UserAnalysis, to help you get started with the development of your analysis codes. This package consists of a simple Gaudi Algorithm, the AnalysisSkeleton. The user may check out this package and start implementing his/her analysis code: look here for further details. This package has a "run" directory where you can also run the reconstruction, the ESD and AOD and tag production as you've just done above in the RecExCommon package.
cd $HOME/tutorial/11.0.3
cmt co -r UserAnalysis-00-05-11 PhysicsAnalysis/AnalysisCommon/UserAnalysis
Just for the purpose of the tutorial, we will also check out 3 additional packages as follows (you will not
need to do this in the release 11.0.4 or higher):
cmt co Reconstruction/CBNT_Utils
cmt co Reconstruction/CBNT_Athena
cmt co PhysicsAnalysis/AnalysisCommon/AnalysisTools
Now change directory to the "cmt" directory of the UserAnalysis package:
cd PhysicsAnalysis/AnalysisCommon/UserAnalysis/UserAnalysis-00-05-11/cmt
then compile and build everything:
cmt config
source setup.csh
cmt broadcast gmake
After a successful build, change directory to the "run" directory of the UserAnalysis package, get the
files AnalysisSkeleton_jobOptions.py and PDGTABLE.MeV:
cd ../run
get_files AnalysisSkeleton_jobOptions.py
get_files PDGTABLE.MeV
Edit the AnalysisSkeleton_jobOptions.py to specify the input AOD file: use the AOD that you produced in
Exercise 1 in the RecExCommon package: you will replace these lines (substitute the appropriate user name for
"ketevi" or supply the correct path to the AOD that you produced in Exercise 1).:
EventSelector.InputCollections = [
"AOD.pool.root"
]
with these lines, to point to the location of the AOD that you produced in Exercise 1; for example:
EventSelector.InputCollections = [
"/direct/usatlas+u/ketevi/tutorial/11.0.3/Reconstruction/RecExample/RecExCommon/RecExCommon-00-04-38/run/AOD.pool.root"
]
Now run the AnalysisSkeleton_jobOptions.py:
athena.py -b AnalysisSkeleton_jobOptions.pyIt should successfully, producing a ROOT output file called AnalysisSkeleton.aan.root. This contains an Athena-Aware NTuple (AAN) and some histograms. Let's browse in the content of the file in ROOT:
root AnalysisSkeleton.aan.root At the ROOT prompt type this: b=TBrowser() The ROOT Browser will appear. Double click on "ROOT Files", then double click on AnalysisSkeleton.aan.rootThe histograms are under the directory Electron and the NTuple is under the directory CollectionTree (the histograms and NTuple contains the same information).
2.2 Histograms and NTuples in your Analysis Algorithm
Now, let's look at the
AnalysisSkeleton
algorithm to understand the following:
(1) How to produce your own customized, small AAN from the ESD or the AOD
(2) How to produce histograms
(3) How to save histograms and NTuples
It is recommended that you produce a small AAN as an output and finish your analysis in
ROOT: with histograms, everytime you need to change, for example, the number of bins, you will have to
recompile and re-run your analysis codes. For further details on histograms and NTuple in Athena, look
here. We will come back the
AAN after the exercises on the Event Tags and on the Event View.
-rw-r--r-- 1 ketevi usatlas 5693374 Dec 26 15:02 ESD.pool.root -rw-r--r-- 1 ketevi usatlas 252779 Dec 26 15:02 fastAOD.root -rw-r--r-- 1 ketevi usatlas 653218 Dec 26 15:02 McEvent.root -rw-r--r-- 1 ketevi usatlas 74516 Dec 26 15:02 MyColl.root <---- Event Tags -rw-r--r-- 1 ketevi usatlas 353574 Dec 26 15:02 AOD_FastSim.pool.root -rw-r--r-- 1 ketevi usatlas 1194711 Dec 26 15:02 AOD.FromESD.pool.root -rw-r--r-- 1 ketevi usatlas 1201147 Dec 26 15:02 AOD.pool.root -rw-r--r-- 1 ketevi usatlas 19858 Dec 26 14:08 AnalysisSkeleton.aan.rootFor further details and feedback on the Event Tag, look here. The definition of the tag content for initial running and steady state operation is still evolving: Look the activities of the Event Tag working group. We will use the tags that you produced in Exercise 1. We will select events where the loose leading electron Pt > 20 GeV and the number of loose electrons < 3.
3.1 The PoolFileCatalog.xml
Generate the PoolFileCatalog.xml as follows:
At BNL do this (replace the path to your ESD and AOD as appropriate): cp ~ketevi/tutorial/11.0.3/data/PoolFileCatalog.xml . pool_insertFileToCatalog /usatlas/magdacache001/ketevi/ttbar/digit/4100/mc11.004100.T1_McAtNLO_top.digit.RDO.v11000301._00001.pool.root pool_insertFileToCatalog /direct/usatlas+u/ketevi/tutorial/11.0.3/Reconstruction/RecExample/RecExCommon/RecExCommon-00-04-38/run/ESD.pool.root pool_insertFileToCatalog /direct/usatlas+u/ketevi/tutorial/11.0.3/Reconstruction/RecExample/RecExCommon/RecExCommon-00-04-38/run/AOD.pool.root At CERN do this (replace the path your ESD and AOD as appropriate): cp ~ketevi/scratch0/Tutorial/11.0.3/data/PoolFileCatalog.xml . pool_insertFileToCatalog castor:/castor/cern.ch/atlas/csc/valiprod/sampleA/mc11/004100.T1_McAtNLO_top/digit/v11000301/mc11.004100.T1_McAtNLO_top.digit.RDO.v11000301._00030.pool.root pool_insertFileToCatalog /direct/usatlas+u/ketevi/tutorial/11.0.3/Reconstruction/RecExample/RecExCommon/RecExCommon-00-04-38/run/AOD.pool.root pool_insertFileToCatalog /direct/usatlas+u/ketevi/tutorial/11.0.3/Reconstruction/RecExample/RecExCommon/RecExCommon-00-04-38/run/AOD.pool.rootYou may look in your PoolFileCatalog.xml to check that the raw data, the ESD and AOD are defined.
3.2 Analysis on Tag Selected Events
Edit AnalysisSkeleton_jobOptions.py and replace these lines (substitute the appropriate user name for "ketevi" or supply the correct path to the tags that you produced in Exercise 1).
EventSelector.InputCollections = [
"/direct/usatlas+u/ketevi/tutorial/11.0.3/Reconstruction/RecExample/RecExCommon/RecExCommon-00-04-38/run/AOD.pool.root"
]
THistSvc.Output = ["AANT DATAFILE='AnalysisSkeleton.aan.root' OPT='UPDATE'"]
with these lines
EventSelector.InputCollections = [
"/direct/usatlas+u/ketevi/tutorial/11.0.3/Reconstruction/RecExample/RecExCommon/RecExCommon-00-04-38/run/MyColl"
]
EventSelector.CollectionType="ExplicitROOT"
EventSelector.Query="(NElectron < 3) && (abs(ElectronPt1) > 20000)"
THistSvc.Output = ["AANT DATAFILE='AnalysisSkeleton.tag.root' OPT='UPDATE'"]
Run the AnalysisSkeleton_jobOptions.py. Now open both AnalysisSkeleton.aan.root and AnalysisSkeleton.tag.root
in ROOT and check that the above selection has been applied.
3.3 Collection of Events of Interest
In this exercise, we will collect the events of interest --- by doing queries on the tags --- into our own ESD and AOD,
and then do the analysis only of those events. For further information on how to collect events of
interst, follow this link.
Let's copy the relevant job options for the RecExCommon package:
cp $HOME/tutorial/11.0.3/Reconstruction/RecExample/RecExCommon/RecExCommon-00-04-38/run/myTopOptions.py .
Edit myTopOptions.py, switch off the TAG production flag (we've already produced the tags in Exercise 1.
We just want to use the tags for selection and event collections), comment out the input RDO file and add the tag
based options that we used above in Exercise 3.2. Further, switch off all the algorithms, switch of the MC
Truth, switch off all the AOD builders and switch off all the detectors. Your myTopOptions.py should look like
this (substitute the appropriate user name for "ketevi" or supply the correct path to the tags that you
produced in Exercise 1):
#switch off all Algorithms and also the MC Truth
AllAlgs = False
doTruth = False
# new AOD to contain ONLY the selected events of interest
PoolAODOutput = "selAOD.pool.root"
doWriteTAG = False
# Read in the tags and make selections
readColl = True
CollInput = [
"/direct/usatlas+u/ketevi/tutorial/11.0.3/Reconstruction/RecExample/RecExCommon/RecExCommon-00-04-38/run/MyColl"
]
CollInputQuery = "(NElectron < 3) && (abs(ElectronPt1) > 20000)"
# Switch off histograms and NTuples
doCBNT = False
doHist = False
#Switch off all the detectors
include ("RecExCommon/RecExCommon_flags.py")
DetFlags.ID_setOff()
DetFlags.Calo_setOff()
DetFlags.Muon_setOff()
# Switch off all the AOD buildeers
from ParticleEventAthenaPool.AODFlags import AODFlags
AODFlags.allSetOff()
# needed for the AOD Truth - will not be needed in 11.0.4
theApp.Dlls += ["TruthParticleAlgs"]
# The main Recontruction options
include ("RecExCommon/RecExCommon_topOptions.py")
#To collect Event at the ESD level - integrated into RecExCommon as a flag from 11.2.0
#EventSelector = Service( "EventSelector" )
#EventSelector.RefName="StreamESD"
Run this job options as follows:
athena.py -b myTopOptions.py
It should produce an AOD file called selAOD.pool.root: this contains only the events that pass the selection on the
tags. Now you can just analysize these events. Compare the sizes of the original, un-cut AOD and this new one:
-rw-r--r-- 1 ketevi usatlas 1201147 Dec 26 12:33 AOD.pool.root
-rw-r--r-- 1 ketevi usatlas 806894 Dec 27 10:05 selAOD.pool.root
In RecExCommon, It will possible to collect interesting events at the ESD, or even at the Raw Data level
as well from 11.2.0. For more information on how to build tag based queries, or about the tag
infrastructure in general, look here.
3.4 The Athena-Aware NTuple (AAN)
The Athena-Aware NTuple can be used as input to other Athena jobs, for example to pre-select events or to navigate back to the full event at AOD, ESD, RDO level, in the same way as the tags; in addition, the AAN is your analysis data in ROOT. Edit AnalysisSkeleton_jobOptions.py and replace these lines (substitute the appropriate user name for "ketevi" or supply the correct path to the tags that you produced in Exercise 1).
EventSelector.InputCollections = [
"/direct/usatlas+u/ketevi/tutorial/11.0.3/Reconstruction/RecExample/RecExCommon/RecExCommon-00-04-38/run/MyColl"
]
EventSelector.Query="(NElectron < 3) && (abs(ElectronPt1) > 20000)"
THistSvc.Output = ["AANT DATAFILE='AnalysisSkeleton.tag.root' OPT='UPDATE'"]
AANTupleStream.OutputName = 'AnalysisSkeleton.aan.root'
with thes ones:
EventSelector.InputCollections = [
"AnalysisSkeleton.aan"
]
EventSelector.Query="EventNumber != 2 && ElecRMatch < 0.05"
THistSvc.Output = ["AANT DATAFILE='AnalysisSkeleton.sel.root' OPT='UPDATE'"]
AANTupleStream.OutputName = 'AnalysisSkeleton.sel.root'
and run it as follows:
athena.py -b AnalysisSkeleton_jobOptions.pyIt should produce a new AAN file which contains the results of the analysis on the selected events. And We've used the user's own AAN for this selection:
EventSelector.Query="EventNumber != 2 && ElecRMatch < 0.05"Note that we are now making the selection using any variable (attribute) that the user has put into his/her own AAN, for example ElecRMatch - the central, common tag database does not contain any attribute called ElecRMatch. Thus, the AAN serves two purposes: not only is it the user's analysis data object in ROOT but it is also the user's own customized tags in addition to the central, common tags. What you've just done with the AAN is NOT possible with the ordinary CBNT.
EventSelector.InputCollections = [
#"/direct/usatlas+u/ketevi/tutorial/11.0.3/Reconstruction/RecExample/RecExCommon/RecExCommon-00-04-38/run/MyColl"
#"/direct/usatlas+u/ketevi/tutorial/11.0.3/Reconstruction/RecExample/RecExCommon/RecExCommon-00-04-38/run/AOD.pool"
#"AnalysisSkeleton.aan"
]
#EventSelector.CollectionType="ExplicitROOT"
#EventSelector.Query="(NElectron < 3) && (abs(ElectronPt1) > 20000)"
#EventSelector.Query="EventNumber != 2 && ElecRMatch < 0.05"
THistSvc.Output = ["AANT DATAFILE='AnalysisSkeleton.aan.root' OPT='UPDATE'"]
Submit the analysis job on Panda (PLease do NOT do this in THIS tutorial: I have already done
it for you. But try this at your leisure on datasets on interest to you with large statistics and give us
feedback):
pathena AnalysisSkeleton_jobOptions.py --inDS mc11.004201.ZeeJimmy.recon.AOD.v11000202_8179 --outDS tutorial.001103.reco.cbntAAN.pool.v1
Exercise
Define analysis job that makes selection on the tags and collects the events of interest into a new AOD. Submit this job in distributed environment on Panda on a large statistics. Take the output dataset as input to your AOD analysis and produce AAN, also in the distributed environment if the statistics is still large after the tag pre-selection. The final output is your AAN dataset containing the AAN files, to be merged with final plots in ROOT. (note that the tags need to be produced first for all the events before trying this exercise. If the tags are not already available you can produce them in the distributed environment by using the AOD dataset as input: - this is fast). If you attempt this exercise, please let me know.
5.1 Interactive Athena
How access data, create, plot and fit histograms interactively without writing any piece of code or run snippets of
analysis code interactively. Let's get this job options: Interactive_topO.py:
get_files Interactive_topO.py
Edit Interactive_topO.py and replace this line
EventSelector.InputCollections = [ "AOD.pool.root" ]with this one (make sure the path to the AOD that you produced in Exercise 1 set correctly). The AOD needs to have at least 20 events to proceed with this exercise.
EventSelector.InputCollections = [ "/direct/usatlas+u/ketevi/tutorial/11.0.3/Reconstruction/RecExample/RecExCommon/RecExCommon-00-04-38/run/AOD.pool.root" ]In the release 11.0.X, you will need to check out and build these tags: PyKernel-00-00-22 and PyAnalysisCore-00-00-12 - to do so, you would proceed as follows:
cd $HOME/tutorial/11.0.3 cmt co -r PyKernel-00-00-22 Control/PyKernel cmt co -r PyAnalysisCore-00-00-12 PhysicsAnalysis/PyAnalysis/PyAnalysisCore cd - cd ../cmt edit the requirements file add these lines:After this, proceed with item 4) on this page: Interactive Analysis and AOD Browsing. Noe the interactive AOD browser does not work in 11.0.X: it will be fixed in 11.X.0. To seek to some event, use this:use PyKernel PyKernel-00-* Control use PyAnalysisCore PyAnalysisCore-00-* PhysicsAnalysis/PyAnalysisjust after this line: use StoreGate StoreGate-02-* Control save the requirements file, then: cmt config source setup.csh cmt broadcast gmake cd ../run
theApp.seekEvent(n)where "n" is the event number, counting from zero. To terminate the interactive Athena session, press "Ctrl d".
include ("PyAnalysisCore/InitPyAnalysisCore.py")
See this page for further
details.
Another aspect of the intereactive analysis is how to pass selected events to the display and
visualization tools: we will look at this in Exercises 5.2-5.4.5.2 Event Display and Visualization - JiveXML
In this exercise, we will use the Event Display and visualization tools of Atlantis. Dedicated Athena Algorithms convert event data to a
special XML format, JiveXML, readable by
Atlantis. There exists a reconstruction flag, "doJiveXML" --- which is false by default --- to produce the JiveXML
files (one for each event) if set to true in your RecExCommon job options: for example, take the ESD/AOD/TAG
production options of Exercise 1, i.e., ESD.AOD.TAG_topOptions.py and add this line to it:
doJiveXML = True
For Details, look at the JiveXML page. Now if you run this job options,
it should reproduce the ESD, AOD, TAG and 5 JiveXML files (one for each event) - but do not run it in this
live tutorial (try it later at your own leisure).
For this exercise, create a job options file, called it
RDO.ESD.AODtoJiveXML_topOptions.py and add the following
lines to it. Use the AOD that you produced in Exercise 1 as input. We will back navigate to the ESD and RDO to
collect all the event data needed for the display. At the time of this tutorial, the display of AOD objects is
at the development and testing stage. Eventually, going to back to the RDO will not be necessary:
######################################################################
#Detector Description
DetDescrVersion="ATLAS-DC3-02"
include ( "RecExCommon/AllDet_detDescr.py" )
theApp.EvtMax=5
doTruth = True
include ( "RecExCommon/RecExCommon_flags.py" )
#Event selector tools
include ( "AthenaPoolCnvSvc/ReadAthenaPool_jobOptions.py" )
EventSelector = Service( "EventSelector" )
EventSelector.InputCollections = [
"/direct/usatlas+u/ketevi/tutorial/11.0.3/Reconstruction/RecExample/RecExCommon/RecExCommon-00-04-38/run/AOD.pool.root"
]
EventSelector.BackNavigation = True
#Data converters
include ("RecExCommon/RecoOutputPoolCnv_jobOptions.py")
include("TrigT1EventAthenaPool/TrigT1EventAthenaPool_joboptions.py")
include( "ParticleEventAthenaPool/AOD_PoolCnv_jobOptions.py")
include( "PartPropSvc/PartPropSvc.py" )
#Inner Detector - will not necessary when the RIO on Tracks are in the ESD
include( "InDetRecExample/InDetRec_jobOptions.py" )
#Calo DLLs
theApp.Dlls += [ "CaloTools" ]
theApp.DLLs += ["TileRecAlgs"]
theApp.DLLs += ["LArClusterRec"]
theApp.DLLs += ["CaloRec"]
theApp.DLLs += ["TileRec"]
#Muons - will not be necessary when the RIO on Tracks are in the ESD
include( "MuonByteStreamCnvTest/MuonRdoDigit_jobOptions.py" )
include( "MuonByteStreamCnvTest/jobOptions_MuonRDOToDigit.py" )
include( "CscClusterization/G4CscClusterOptions.py" )
include( "MuonRdoToPrepData/MuonRdoToMuonPrepData_jobOptions.py" )
include( "MooAlgs/Moore_RecEx_jobOptions_G4.py" )
include( "MuonboyAth/MuonboyG4dry_jobOptions.py" )
include( "MuidAlgs/MuidAlgsSA_jobOptions.py" )
include( "MuidAlgs/MuidAlgsCB_jobOptions.py" )
include( "STACO/Staco_jobOptions.py" )
include( "MuTag/MuTag_jobOptions.py" )
#Jive XML tools to produce the XML files for Atlantis
include ( "RecExCommon/JiveXML_config.py")
ToolSvc = Service( "ToolSvc" )
ToolSvc.EventData2XML.FileNamePrefix = "mc11.004100.T1_McAtNLO_top.digit.RDO.v11000301._00001"
MessageSvc = Service( "MessageSvc" )
MessageSvc.OutputLevel = FATAL
######################################################################
If you run this job options file, it should produce 5 JiveXML files, one for each of the 5 events. But please do
not run the job options during this live tutorial: I have already done this and produced the XML files, just
copy them from my area:
cp /direct/usatlas+u/ketevi/tutorial/11.0.3/JiveXML/*.xml .
In the above job options, you notice that we go back to the RDO, and re-run some Inner Detector and Muons
reconstruction algorithms since some of the objects needed are not in the ESD (yet) and must be re-created from
the RDO. In some cases, the requested objects are not found and the back navigation attempts to go beyond the
RDO: you can see this by setting the Message Output Level to INFO - but we will not worry about that here.
Eventually, the user should be able to use the event tags or the AAN, as described in Exercise 3 above,
to select/identify some events of interest and produce the JIveXML files for only those events and
visualize in greater details.
5.3 Event Display and Visualization - Atlantis
To start the Atlantis event display, simply type the command
atlantis
Then follow in the instructions described on this page: scroll down to the section on Using Atlantis
and select the JiveXML file produced in Exercise 5.2 (for the first event).
It is recommended that you install Atlantis on your
computer and move the events (JiveXML files) there (your computer) for faster graphical operations.
After playing with this for a while, exit the Atlantis session before starting the next exercise: go
to "file", then "exit".
5.4 Interactive Athena and Atlantis Display
get_files InteractiveServer.py
############################################################################
#The Detector Description
DetDescrVersion="ATLAS-DC3-02"
#Number of Events to process
EvtMax=5
#Input Raw Data
#Set the path and the file name as appropriate
PoolRDOInput = [
"/usatlas/magdacache001/ketevi/ttbar/digit/4100/mc11.004100.T1_McAtNLO_top.digit.RDO.v11000301._00001.pool.root"
]
#Suppress the production of NTuple Histograms
doCBNT = False
doHist = False
#We do not want to reproduce the ESD/AOD/TAG in this exercise - otherwise comment these lines out
doWriteESD = False
doWriteAOD = False
doWriteTAG = False
#Message Output Level
OutputLevel = FATAL
#Produce the JiveXML out for the Atlantis display
doJiveXML = True
#Main job Options
include ("RecExCommon/RecExCommon_topOptions.py")
###################### For interactive analysis - comment it out otherwise
include ("PyAnalysisCore/InitPyAnalysisCore.py")
#############################################################################
athena -i InteractiveAthenaToAtlantis_topOptions.py -l FATALAt the interactive Athena prompt, execute these commands:
theApp.initialize()
execfile ("InteractiveServer.py")
After this, 3 pieces of information will be output to the screen, for example
server name: 'acas0002.usatlas.bnl.gov'
port number: '13260'
key: 'EELK#/^Qk`)N5/m'
You will need to copy this information to the Atlantis dialog box - note that the key is case
sensitive. Open a new working session, set up CMT as in Exercise 0.10, and launch Atlantis, for
example:
ssh acas00XY (or rterm -i) cd tutorial source setup.csh -tag=11.0.3,opt cd 11.0.3/PhysicsAnalysis/AnalysisCommon/UserAnalysis/../cmt source setup.csh cd ../run atlantisNow, we want to read the event from the Interactive Athena, NOT from some JiveXML files that must have been produced in a prior step as in Exercise 5.3. Once the Atlantis GUI appears:
Go to "File" and select Interactive Athena.A dialog box will appear: fill in the Remote Server Name, the Port and the Key as printed to you on the interactive athena window. In my case (which will be different from you case), the information is this:
server name: 'acas0002.usatlas.bnl.gov'
port number: '13260'
key: 'EELK#/^Qk`)N5/m'
Now remember that the interactive Athena has not produced any event yet: so far we only run
"theApp.initialize()". Let's execute Athena for one event: in the Interactive Athena dialog box of
Atlantis, you will see a small box at the bottom saying "athena command". In that box, type the
following athena command and click OK:
theApp.nextEvent()to execute Athena for one event, the next event, which in this particular case would be the first event: now watch the interactive Athena window and see that Athena is reconstructing the event. Wait for this operation to complete successfully. Then, in the Interactive Athena dialog box of Atlantis,
click on "Get Event"to read the event into Atlantis: check the Atlantis display and see the event summary is updated accordingly. You may examine this event, then execute Athena for next event, etc. To terminate the the communication between the Interactive Athena session and Atlantis, press "Cancel" in the dialog box, then press "Ctrl c" in the Interactive Athena session. This will terminate the communication and take you back to the Interactive Athena prompt. Then, to exit Interactive Athena, press "Ctrl d". Also, exit the Atlantis display before proceeding to the next Exercise.
5.5 v-Atlas
The 3-D visualization program, HepVis/v-atlas,
designed mainly to debug the ATLAS detector geometry can also display hit and energy deposition
information. Unlike Atlantis, v-atlas is highly coupled to Athena, can access directly StoreGate
objects, change the geometry and re-run algorithms. Atlantis and v-atlas thus complement eah other
quite well. To get going with v-atlas, do this (later at your own leisure):
v-atlas DetectorDescription fileName
You may use the RDO file of Exercise 1 for which the detector description is ATLAS-DC3-02. Thus, the
command line would look like this:
v-atlas /usatlas/magdacache001/ketevi/ttbar/digit/4100/mc11.004100.T1_McAtNLO_top.digit.RDO.v11000301._00001.pool.root
Play in the graphics window and exit v-atlas before proceeding to the next exercise. Note that in
11.0.3, you may observe a crash in v-atlas - the authors have been looking into this for a
fix for 11.2.0.
5.6 Persint
There is also the Persectively Interacting package, known as Persint. It has been developed for ATLAS, for 3-dimensional representation of objects, with access to a variety of applications, in an interactive environment. Consult the Persint page for further information.
At the end of this exercise, you should have a plot of the Z -> ee invariant mass. The data file data you are using is Z -> ee, simulated with the ATLAS-DC3-01 initial layout. You will retrieve a container AOD electrons from the persistency storage. You will loop over the electrons in the container, and for each electron, you will plot the isEM flag. You will calculate the ee pair invariant mass and put it in a histogram. So, you are adding 2 items to the AAN of Exercise 2.
const ElectronContainer* elecTES = 0;
sc=m_storeGate->retrieve( elecTES, m_electronContainerName);
if( sc.isFailure() || !elecTES ) {
mLog << MSG::WARNING
<< "No AOD electron container found in TDS"
<< endreq;
return StatusCode::SUCCESS;
}
mLog << MSG::DEBUG << "ElectronContainer successfully retrieved" << endreq;
iii. Container Names: you need to know the "name" or the "key" of the
container/object that you
want to access. What we mean by name or key here is the std::string code that was used to create, store
and identify thw that AOD container. You need to know that so you can ask for that container if you need
it. In the above snippet of code, the data member m_electronContainerName defines
the name of the ElectronContainer that you want to retrieve. If you look in the constructor of
AnalysisSkeleton.cxx, you will see that m_electronContainerName is initialized
to "ElectronCollection". That is the name used when the AOD electron container was
produced for you. For the list of containers/objects in the ESD and AOD, see the following pages:
ESD Content and Keys AOD Content and Keysiv. Access to the Kinematics: Some of the AOD objects are 4-Momentum objects, meaning that they should be able to answer all your questions about their kinematics. For example, to ask the Electron object for its transverse momentum and pseudo rapidity:
for (; elecItr != elecItrE; ++elecItr) {
if( (*elecItr)->hasTrack() &&
(*elecItr)->pt()> m_etElecCut ) {
double electronPt = (*elecItr)->pt();
double electronEta = (*elecItr)->eta();
...
The complete list is the following:double px() double py() double pz() double m() double p() double eta() double phi() double e() double et() double pt() double iPt() double cosTh() double sinTh() double cotTh() HepLorentzVector hlv()For further details, look at the 4Momentum implementation
const ElectronContainer* elecTES=0;
sc=m_storeGate->retrieve( elecTES, m_electronContainerName);
if( sc.isFailure() || !elecTES ) {
mLog << MSG::WARNING
<< "No AOD electron container found in TDS"
<< endreq;
return StatusCode::SUCCESS;
}
mLog << MSG::DEBUG << "ElectronContainer successfully retrieved" << endreq;
/// iterators over the container
ElectronContainer::const_iterator elecItr = elecTES->begin();
ElectronContainer::const_iterator elecItrE = elecTES->end();
for (; elecItr != elecItrE; ++elecItr) {
if( (*elecItr)->hasTrack() &&
(*elecItr)->pt()> m_etElecCut ) {
m_h_elecpt->Fill( (*elecItr)->pt(), 1.);
m_h_eleceta->Fill( (*elecItr)->eta(), 1.);
...
vii. CompositeParticle: Its design is still evolving. The composite object,
for example, the Z boson as the composite of electron-positron, is itself a ParticleBase or an IParticle.
But it is also a 4Momentum object. Further it needs to provide navigation to its constituents somehow. The
current implementation of the CompositeParticle Class is most likely to evolve while maintaining
somehow the main ingredients of IParticle, 4Momentum and constituent navigation.#include "ParticleEvent/ElectronContainer.h"2. Add a method called zee_on_aod() where you will implement this exercise:
StatusCode zee_on_aod();2.1 Define the 2 AAN items mentioned above: put the key word "aod".
1. Change directory to your run directory 2. cp ~ketevi/tutorial/11.0.3/data/dc3.004201.zee.tag.py . 3. cp ~ketevi/tutorial/11.0.3/data/dc3.004201.zee.aod.py . 4. cp ~ketevi/tutorial/11.0.3/data/dc3.004201.zee.esd.py . 5. Look inside dc3.004201.zee.aod.py to see the list of the input AOD files 6. Edit AnalysisSkeleton_jobOptions.py and replace these lines EventSelector.InputCollections = [ "AOD.pool.root" ]by these ones
include ("dc3.004201.zee.aod.py")
Also, switch ON the back navigation to the ESD in AnalysisSkeleton_jobOptions.py:
EventSelector.BackNavigation = True5. Now, run your analysis code by doing this
athena.py -b AnalysisSkeleton_jobOptions.py6. Open AnalysisSkeleton.aan.root in ROOT, examine the ee invariant mass distribution and make sure that it is OK: a narrow peak at the Z-mass.
std::vectorYou may take a look at my version of AnalysisSkeleton.h/.cxx. It is in* m_aan_isEM; std::vector * m_aan_mee; ... addBranch("ElecIsEM", m_aan_isEM); addBranch("ElecMee", m_aan_mee); ... m_aan_isEM->clear(); m_aan_mee->clear(); ... ElectronContainer::const_iterator elecItr = elecTES->begin(); ElectronContainer::const_iterator elecItrE = elecTES->end(); for (; elecItr != elecItrE; ++elecItr) { if ( (*elecItr)->author() != ElectronParameters::egamma || (*elecItr)->pt() < m_etElecCut ) continue; int bitPosition = 1; int isEM = (*elecItr)->isEM(); if ( isEM == 0 ) m_aan_isEM->push_back( (isEM-1.0) ); /// put isEM=0 at -1 /// fill the isEM histogram as a bit pattern of the isEM flag if (isEM > 0) { for (int i=0; i<16; ++i) { if (isEM & bitPosition) m_aan_isEM->push_back(i); bitPosition *= 2; } } } AnalysisUtils::Combination < const ElectronContainer > comb(elecTES,2); ElectronVect ePair; while (comb.goodOnes(this, ePair, selectElectron)) { /// Create the Z -> ee as a composite object CompositeParticle zee; zee.add(ePair[0],ePair[1]); /// fill the Z -> ee invariant mass m_aan_mee->push_back(zee.m()); } ... /// electron selection bool selectElectron(AnalysisSkeleton * self, const ElectronVect &ll) { bool test1 = ll[0]->charge() == -(ll[1]->charge()); bool test2 = (ll[0]->pt() > self->m_etElecCut) && (ll[1]->pt() > self->m_etElecCut); bool test3 = (fabs(ll[0]->eta()) < self->m_etaElecCut ) && (fabs(ll[1]->eta()) < self->m_etaElecCut ); bool test4 = ( (ll[0]->isEM()%16)==0 && (ll[1]->isEM()%16) == 0); bool test5 = ( ll[0]->author() == ElectronParameters::egamma && ll[1]->author() == ElectronParameters::egamma); return (test1 && test2 && test3 && test4 && test5); }
~ketevi/tutorial/11.0.3/PhysicsAnalysis/AnalysisCommon/UserAnalsyis/UserAnalysis-00-05-03 at BNL ~ketevi/scratch0/Tutorial/11.0.3/PhysicsAnalysis/AnalysisCommon/UserAnalsyis/UserAnalysis-00-05-03 at CERN
# enable Back Navigation in your job options EventSelector.BackNavigation = Trueiv. SymLink: Suppose you want to retrieve the AOD ElectronContainer, as a ParticleBaseContainer, for some reason. After all, the Electon class derives from the ParticleBase which is the common implementation AOD particles: maybe you want to do something with electrons and muons, perhaps, just 4Momentum manipulation, you not care whether the particle is an Electron or Muon, just a particle of type ParticleBase or IParticle. You want then want to retrieve the MuonContainer as ParticlebaseContainer. The ability to record a container of type Electron for example, and later retrieve it as a container of type ParticleBase for example is known as SymLink.
Retrieve the ElectronContainer elecTDS
ElectronContainer::const_iterator elecItr = elecTDS->begin();
ElectronContainer::const_iterator elecItrE = elecTDS->end();
for (; elecItr != elecItrE; ++elecItr) {
if ( (*elecItr)->author() != ElectronParameters::egamma || (*elecItr)->pt() < m_etElecCut ) continue;
/// access to the Electron's TrackParticle
const Rec::TrackParticle *trackParticle = (*elecItr)->track();
if (trackParticle != 0) {
double trackP = trackParticle->p();
fill the AAN item
}
}
7.1.6 If you are just working with TrackParticles, not electron nor muon, etc, in particular, you
can just retrieve the collection of the TrackParticles of interest:
Retrieve the Inner Detector TrackParticleContainer trackTDS
Rec::TrackParticleContainer::const_iterator trackItr = trackTDS->begin();
Rec::TrackParticleContainer::const_iterator trackItrE = trackTDS->end();
for (; trackItr != trackItrE; ++trackItr) {
/// access to the Inner detector TrackParticle
const Rec::TrackParticle *trackParticle = (*trackItr);
double trackP = trackParticle->p();
double charge = trackParticle->charge();
...
}
Retrieve the ElectronContainer elecTDS
ElectronContainer::const_iterator elecItr = elecTDS->begin();
ElectronContainer::const_iterator elecItrE = elecTDS->end();
for (; elecItr != elecItrE; ++elecItr) {
if ( (*elecItr)->author() != ElectronParameters::egamma || (*elecItr)->pt() < m_etElecCut ) continue;
/// access to the Electron's TrackParticle
const Rec::TrackParticle *trackParticle = (*itE)->track();
if (trackParticle != 0) {
double trackP = trackParticle->p();
fill the histogram
}
/// back navigation to ESD to access Electron's egamma object
const egamma *eg = (*elecItr)->eg();
if (eg) {
const EMShower *shower = eg->get_EMShower();
if(shower) {
double et_had = (shower)->ethad();
fill the relevant AAN item
}
}
}
7.2.5 This line should be included your AnalysisSkeleton.h:
#include "egammaEvent/EMShower.h"> #include "egammaEvent/egamma.h">7.2.6 Compile the code and resolve any compilation problem: proceed as follow
use egammaEvent egammaEvent-01-* Reconstructionjust below this line
use ParticleEvent ParticleEvent-00-* PhysicsAnalysis/AnalysisCommon
7.2.6.4 gmakeWe need the above line for the egamma object. Make sure that the back navigation is ON in your job options:
EventSelector.BackNavigation = True7.2.7 Run your code and examine the AAN.
#include "Navigation/Navigable.h"
...
const Calocluster * cluster = (*electIr)->cluster();
if (cluster) {
NavigationToken cellToken;
(cluster)->fillToken(cellToken,double(1.));
NavigationToken::const_iterator c = cellToken.begin();
NavigationToken::const_iterator cend = cellToken.end();
mLog << MSG::DEBUG << "# cells found " << cellToken.size() << endreq;
double etSum = 0;
for(; c != cend; ++c) {
const CaloCell* thisCell = *c;
double weight = cellToken.getParameter(thisCell);
double et = weight * thisCell->et();
etSum += et;
}
m_aan_sumEtCell->push_back(etSum);
...
And your requirements file should include this line:
use Navigation Navigation-00-* Control
const ParticleBaseContainer* particleBaseTES=0;
sc=m_storeGate->retrieve( particleBaseTES, m_electronContainerName);
if( sc.isFailure() || !particleBaseTES ) {
mLog << MSG::WARNING
<< "No AOD electron container found in TDS as symLink"
<< endreq;
return StatusCode::SUCCESS;
}
mLog << MSG::DEBUG << "ParticleBaseContainer successfully retrieved as symLink" << endreq;
/// iterators over the ParticleBase container
ParticleBaseContainer::const_iterator partItr = particleBaseTES->begin();
ParticleBaseContainer::const_iterator partItrE = particleBaseTES->end();
for (; partItr != partItrE; ++partItr) {
m_aan_pt_symLink->push_back( (*particleItr)->pt() );
}
...
The symLink feature should not be abused. It is recommended to use symLink only if you absolutely have to.
Do not do none sensical stuff, for example trying to retrieve an ElectronContainer as symLink to a
ParticleJetContainer.
ESD Content and Keys AOD Content and KeysIn this exercise, you will retrieve the Electron Collection and the Truth Particle Collection and you will calculate and plot the efficiency of the reconstructed Electrons as a funtion of eta: for a given reconstructed electron, find the closest, in deltaR, truth electron. Plot the deltaR of the match, the pt ratio of reconstructed to truth and the efficiency:
/// get the MC truth particle AOD container from StoreGate
const TruthParticleContainer* mcpartTES = 0;
sc=m_storeGate->retrieve( mcpartTES, m_truthParticleContainerName);
if( sc.isFailure() || !mcpartTES ) {
mLog << MSG::WARNING
<< "No AOD MC truth particle container found in TDS"
<< endreq;
return StatusCode::SUCCESS;
}
mLog << MSG::DEBUG << "MC Truth Container Successfully Retrieved" << endreq;
You already know how to retrieve the Electron Collection. Take a look at this solution which is already in the method
electron() of your AnalysisSkeleton.cxx - please look there for details:
/// iterators over the container
ElectronContainer::const_iterator elecItr = elecTES->begin();
ElectronContainer::const_iterator elecItrE = elecTES->end();
for (; elecItr != elecItrE; ++elecItr) {
if( (*elecItr)->author() == (*elecItr)->parameter(ElectronParameters::egamma) && (*elecItr)->pt() > m_etElecCut ) {
m_aan_eta->push_back((*elecItr)->eta());
m_aan_pt->push_back((*elecItr)->pt());
int index = -1;
double deltaRMatch;
/// find a match to this electron in the MC truth container
/// the index and deltaR are returned
const TruthParticleContainer * truthContainer = mcpartTES;
bool findAMatch = m_analysisTools->matchR((*elecItr), truthContainer,
index, deltaRMatch, (*elecItr)->pdgId());
if (findAMatch) {
deltaRMatch = (deltaRMatch > m_maxDeltaR) ? m_maxDeltaR : deltaRMatch;
m_aan_elecrmatch->push_back( deltaRMatch );
if ( deltaRMatch < m_deltaRMatchCut) {
const TruthParticle* electronMCMatch = (*mcpartTES)[index];
double res = (*elecItr)->pt() / electronMCMatch->pt();
m_ann_elecetres->push_back(res);
}
m_aan_mcelecpt->push_back( (*mcpartTES)[index]->pt() );
m_aan_mceleceta->push_back( (*mcpartTES)[index]->eta() );
}
}
}
Compile and run your code.
AnalysisSkeleton - which we've been using so far ZeeOnESD - the new one that you are addingFor this new algorithm, you should have ZeeOnESD.h, ZeeOnESD.cxx, ZeeOnESD_jobOptions.py, and you should add the appropriate lines to the file UserAnalysis_entries.cxx in ../src/components/ directory. Do the following in your new algorithm:
use egammaEvent egammaEvent-01-* Reconstruction9.5 In your ZeeOnESD_jobOptions.py, declare the ZeeOnESD algorithm and set its properties: follow the example of the AnalysisSkeleton_jobOptions.py.
~ketevi/tutorial/11.0.3/PhysicsAnalysis/AnalysisCommon/UserAnalsyis/UserAnalysis-00-05-03 at BNL ~ketevi/scratch0/Tutorial/11.0.3/PhysicsAnalysis/AnalysisCommon/UserAnalsyis/UserAnalysis-00-05-03 at CERN