|
|
(85 intermediate revisions by one other user not shown) |
Line 1: |
Line 1: |
| + | ==Pre-Tutorial== |
| | | |
− | ==Set up CMT==
| + | *This pre-Tutorial is copy of the one given by Ketevi A. Assamagan, adapted to work in 12.0.2 |
| | | |
− | * Login to lxplus at CERN and create a working directory called "Tutorial". We will use the release 12.0.2 this tutorial: | + | *here is a link to other Tutorials by Ketevi, and other usful PAT links: |
− | <pre>
| + | [https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT] |
− | ssh lxplus.cern.ch
| + | |
− | cd scratch0
| + | *Please follow the following pre-Tutorial before the date of the Workshop. It is a very straight forward, tutorial and will help to set up the athena enviroment for the workshop, so we can focus our time in more interested things |
− | mkdir Tutorial
| |
− | cd Tutorial
| |
− | mkdir 12.0.2
| |
− | </pre>
| |
| | | |
− | * Create a file called "requirements" and setup CMT. My requirements file looks like this where my working area for 12.0.2 is ${HOME}/scratch0/Workshop/12.0.2:
| + | [http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link] |
− | <pre>
| |
− | set CMTSITE CERN
| |
− | set SITEROOT /afs/cern.ch
| |
− | macro ATLAS_DIST_AREA ${SITEROOT}/atlas/software/dist
| |
− |
| |
− | macro ATLAS_GROUP_AREA "/afs/cern.ch/atlas/groups/PAT/Tutorial"
| |
− |
| |
− | macro ATLAS_TEST_AREA "" \
| |
− | 12.0.2 "${HOME}/scratch0/Workshop/12.0.2"
| |
− |
| |
− |
| |
− | apply_tag oneTest
| |
− |
| |
− | use AtlasLogin AtlasLogin-* $(ATLAS_DIST_AREA)
| |
− | </pre>
| |
| | | |
− | *Then do the following:
| + | During the workshop we'll browse over the code that we've used in the pre-Tutorial to try and uderstand it. Later we'll focused on the TAG and AAN selection. |
− | <pre>
| |
− | source /afs/cern.ch/sw/contrib/CMT/v1r18p20060606/mgr/setup.sh
| |
− | cmt config
| |
− | </pre>
| |
| | | |
− | ==Setup for the release 12.0.2== | + | ==Event Selection== |
− | *Do the following:
| + | First we're going to generate a new AAN that we'll use later for selection. |
| <pre> | | <pre> |
| + | cd ~scratch0/Workshop/ |
| source setup.sh -tag=12.0.2,opt | | source setup.sh -tag=12.0.2,opt |
| + | cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis |
| + | cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/. |
| + | cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/. |
| + | cd cmt |
| + | gmake |
| + | cd .. |
| + | mkdir run2 |
| + | cd run2 |
| + | cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py . |
| + | cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml . |
| + | cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py . |
| + | athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log |
| </pre> | | </pre> |
| | | |
− | *Check that the CMT path is correct by doing this
| + | This will generate the file AnalysisSkeleton.aan.root. |
− | <pre>
| |
− | echo $CMTPATH
| |
− | </pre>
| |
| | | |
− | *Stuff like this should be printed to your screen: | + | ==Event Selection using TAG== |
− | <pre>
| + | *First we generate our own TAG. |
− | /afs/cern.ch/user/o/ordonez/scratch0/Workshop/12.0.2:
| |
− | /afs/cern.ch/atlas/software/builds/AtlasOffline/12.0.2
| |
− | </pre>
| |
| | | |
− | *You see that the path to your working directory, the path to the release directory and the external are set correctly - do not proceed unless this is done correctly. | + | *Still in the new run2 directory: |
| | | |
− | ==Run Time Setup==
| |
− | *Go to your working area and check out the follow package:
| |
| <pre> | | <pre> |
− | cd 12.0.2
| + | cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py . |
− | cmt co -r UserAnalysis-00-08-05 PhysicsAnalysis/AnalysisCommon/UserAnalysis
| |
| </pre> | | </pre> |
| | | |
− | *Now compile everything as follows: | + | *Edit Main_topOptions.py and uncomment the line |
| <pre> | | <pre> |
− | cd PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt
| + | ### Create TAG file |
− | cmt config; source setup.sh; cmt br gmake
| + | doWriteTAG=True |
− | cd ../run
| |
| </pre> | | </pre> |
− | | + | |
− | *To test that everything has been done correctly, do:
| |
| <pre> | | <pre> |
− | get_files HelloWorldOptions.py
| + | athena Main_topOptions.py | tee athenaOut.log |
− | athena.py HelloWorldOptions.py | tee athenaOut.log | |
| </pre> | | </pre> |
| | | |
− | *Stuff like this should be printed to the screen: | + | *This will generate the file called ZmumuOnAOD_TAG.root |
− | <pre>
| |
− | 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
| |
− | </pre>
| |
| | | |
− | ==The Next Time You Login==
| + | *Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out: |
− | *The next time you login, just do the following: | |
| <pre> | | <pre> |
− | cd ${HOME}/scratch0/Workshop
| + | #doWriteTAG=True |
− | source setup.sh -tag=12.0.2
| |
− | cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt
| |
− | source setup.sh
| |
− | cd ../run
| |
| </pre> | | </pre> |
| | | |
− | ==Get The Necessary Files==
| + | *and uncomment |
− | *We will use inclusive Z to mumu events (sample 4202), digitized in 11.0.41 but the ESD and AOD produced in the release 12.0.1. Copy the PoolFileCatalog.xml for the AOD, ESD and Raw Data (RDO) into your UserAnalysis "run" directory: | |
| <pre> | | <pre> |
− | cp ~ordonez/scratch0/Workshop/12.0.2/data/PoolFileCatalog.xml .
| + | doRunAODwithSelection=True |
− | cp ~ordonez/scratch0/Workshop/12.0.2/data/*.py .
| |
− | </pre>
| |
| | | |
− | ==Run the AnalysisSkeleton for 500 Events==
| + | and |
− | *get the necessary job options file from the release:
| |
− | <pre>
| |
− | get_files AnalysisSkeleton_jobOptions.py
| |
− | </pre>
| |
| | | |
− | *Edit AnalysisSkeleton_jobOptions.py and specify the input data to be the AOD files that you just copied in the previous step: to do this, replace these lines
| + | useTag=True |
− | <pre>
| |
− | EventSelector.InputCollections = [ "AOD.pool.root"]
| |
− | </pre>
| |
− | *with this line
| |
− | <pre>
| |
− | include( "mc11.004201.ZeeJimmy.recon.AOD.v11000401.py" )
| |
− | </pre>
| |
− | *Check that in AnalysisSkeleton_jobOptions.py, the number of events to run is set to 500:
| |
− | <pre>
| |
− | # Number of Events to process
| |
− | theApp.EvtMax = 500
| |
− | </pre>
| |
− | *Now run the AnalysisSkeleton_jobOptions.py. It should produce a file called AnalysisSkeleton.aan.root which contains some ROOT histograms and an AthenaAwareNTuple:
| |
− | <pre>
| |
− | athena.py AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log
| |
| </pre> | | </pre> |
− | *You've just produced the AthenaAwareNTuple in a standalone way, directly on the AOD, or the ESD or even on the RDO. For Further details on how to produce the AthenaAwareNTuple in this way, follow this link: [https://twiki.cern.ch/twiki/bin/view/Atlas/AthenaAwareNTuple AthenaAwareNTuple].
| |
− |
| |
− | *Now, you may look at the the AnalysisSkeleton.h, the AnalysisSkeleton.cxx and AnalysisSkeleton_jobOptions.py to see how the ROOT histograms and the AthenaAwareNTuple of the output file AnalysisSkeleton.aan.root are defined, filled and saved: Follow this link to the AnalysisSkeleton. For further details on how to produces ROOT histograms and Tuples in ATHENA, look at the THistSvc.
| |
| | | |
− | *You should open the output file AnalysisSkeleton.aan.root in ROOT and browse the histograms and the AthenaAwareNTuple: | + | *Copy: |
| <pre> | | <pre> |
− | root -l AnalysisSkeleton.aan.root
| + | cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py . |
− | new TBrowser
| |
| </pre> | | </pre> |
− | *You will notice that beside the user-defined NTuple, the AthenaAwareNTuple tools add references to the AOD, ESD and Raw Data, in addition the RunNumber and the EventNumber. | + | *And run again. Note that only will run the events that satisfy the query: |
| + | EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt1>10000 && LooseMuonPt2>10000" |
| | | |
− | ==More Information==
| |
− | *For further details on the analysis tools, look at the PhysicsAnalysisTools. Details on the content of the ESD, the AOD and the TAG are on [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForESD StoregateKeysForESD], [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForAOD StoregateKeysForAOD] and [https://twiki.cern.ch/twiki/bin/view/Atlas/TagForEventSelection TagForEventSelection].
| |
| | | |
− | ==Z to mumu on AOD==
| |
− | *In this exercise, we will do Z to mumu reconstruction on AOD: we will use the association objects Analysis::Muon and its associated TrackParticle. Proceed as follows: copy the code from my area, compiling and running it, then we go through it:
| |
| <pre> | | <pre> |
− | cd ../src
| + | athena Main_topOptions.py | tee athenaOut.log |
− | cp ~ordonez/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/src/ZmumuOnAOD.cxx .
| |
− | cd ../UserAnalysis
| |
− | cp ~ordonez/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/UserAnalysis/ZmumuOnAOD.h .
| |
− | cd ../run
| |
− | cp ~ordonez/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZmumuOnAOD_jobOptions.py .
| |
| </pre> | | </pre> |
| | | |
− | *Now, you want to go the src/components directory and declare this new algorithm ZmumuOnAOD. | + | *As an output you have ZmumuOnAOD_withTAGSelection.aan.root. You can have a look at it in root to make sure that the query has been satisfied |
− | <pre>
| |
− | cd ../src/components
| |
− | </pre>
| |
| | | |
− | *Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton: | + | *Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time |
− | <pre>
| |
− | #include "UserAnalysis/ZmumuOnAOD.h"
| |
| | | |
− | DECLARE_ALGORITHM_FACTORY( ZmumuOnAOD )
| + | *Edit again Main_topOptions.py and change: |
| | | |
− | DECLARE_ALGORITHM( ZmumuOnAOD )
| |
− | </pre>
| |
− |
| |
− | *Save UserAnalysis_entries.cxx and go back the cmt directory and compile:
| |
− | <pre>
| |
− | cd ../../cmt
| |
− | cp ~ordonez/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt/requirements .
| |
− | cmt config
| |
− | cmt broadcast gmake
| |
− | cd ../run
| |
− | </pre>
| |
− | *Now you may run the ZmumuOnAOD algorithm as follows:
| |
| <pre> | | <pre> |
− | athena.py ZmumuOnAOD_jobOptions.py | tee AthenaOut_ZmumuOnAOD.log
| + | TheApp.EvtMax = 500 |
− | </pre>
| |
| | | |
− | *This should produce an AthenaAwareNTuple file, ZmumuOnAOD.aan.root. While Athena is running, let's go through the code by following this link: ZmumuOnAOD for the details of the algorithm and the selection cuts.
| + | to |
| | | |
− | *Now, open this file in ROOT and browse the AthenaAwareNTuple:
| + | TheApp.EvtMax = 50 |
− | <pre>
| |
− | root -l
| |
− | TFile *f = TFile::Open("ZmumuOnAOD.aan.root")
| |
− | new TBrowser
| |
− | TTree * zmumuOnAOD=(TTree*) gDirectory->Get("CollectionTree");
| |
− | zmumuOnAOD->SetMarkerStyle(20)
| |
− | zmumuOnAOD->SetMarkerSize(0.5)
| |
− | zmumuOnAOD->SetMarkerColor(2)
| |
− | zmumuOnAOD->SetLineColor(4)
| |
− | zmumuOnAOD->SetLineWidth(2)
| |
− | zmumuOnAOD->Draw("ZmmMass")
| |
| </pre> | | </pre> |
− | *By default, we used the Muonboy/STACO/MuTag association objects in the AOD and the associated TrackParticles. But you may change it in the job options ZmumuOnAOD_jobOptions.py: the StoreGate keys for the various objects in the AOD are listed here: [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForAOD StoregateKeysForAOD].
| |
− |
| |
− | *'''Exercise: add a piece code to access the number of hits in the various stations of the Inner Detector and the Muon Spectrometer. Recompile, and run. Then in ROOT look at the NTuple in ROOT and check that the distributions look OK.'''
| |
| | | |
− | ==Z to ee on AOD==
| + | *Comment out |
− | *In this exercise, we will do Z to ee reconstruction on AOD: we will use the association objects Electron/Photon and its associated Electron TrackParticle. Proceed as follows: copy the code from my area, compiling and running it, then we go through it: | |
| <pre> | | <pre> |
− | cd ../src
| + | #doRunAODwithSelection=True |
− | cp ~ordonez/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/src/ZeeOnAOD.cxx .
| |
− | cd ../UserAnalysis
| |
− | cp ~ordonez/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/UserAnalysis/ZeeOnAOD.h .
| |
− | cd ../run
| |
− | cp ~ordonez/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZeeOnAOD_jobOptions.py .
| |
| </pre> | | </pre> |
| | | |
− | *Now, you want to go the src/components directory and declare this new algorithm ZeeOnAOD. | + | *uncomment: |
| <pre> | | <pre> |
− | cd ../src/components
| + | doRewriteAOD=True |
| </pre> | | </pre> |
| | | |
− | *Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:
| + | and run once more |
− | <pre>
| |
− | #include "UserAnalysis/ZeeOnAOD.h"
| |
− | | |
− | DECLARE_ALGORITHM_FACTORY( ZeeOnAOD )
| |
− | | |
− | DECLARE_ALGORITHM( ZeeOnAOD )
| |
− | </pre>
| |
| | | |
− | *Save UserAnalysis_entries.cxx and go back the cmt directory and compile:
| |
| <pre> | | <pre> |
− | cd ../../cmt
| + | athena Main_topOptions.py | tee athenaOut.log |
− | cmt config
| |
− | cmt broadcast gmake
| |
− | cd ../run
| |
| </pre> | | </pre> |
| | | |
− | *Now you may run the ZeeOnAOD algorithm as follows:
| + | You'll see a new Zmumu_new_AOD_withTAGSelection.root file has been created |
− | <pre>
| |
− | athena.py ZeeOnAOD_jobOptions.py| tee AthenaOut_ZeeOnAOD.log
| |
− | </pre>
| |
| | | |
− | *This should produce an AthenaAwareNTuple file, ZeeOnAOD.aan.root. While Athena is running, let's go through the code by following this link: ZeeOnAOD for the details of the algorithm and the selection cuts. | + | ==Event Selection using AAN== |
| + | *Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files: |
| + | ZmumuOnAOD_withAANSelection.aan.root |
| + | Zmumu_new_AOD_withAANSelection.root |
| | | |
− | *Now, open this file in ROOT and browse the AthenaAwareNTuple: | + | ==Interactive Analysis in ATHENA== |
| + | *In this exercise, we will see how to do interactive analysis in ATHENA, how to browse the Raw Data in the AOD. Proceed as follows: |
| <pre> | | <pre> |
− | root -l
| + | get_files Interactive_topO.py |
− | TFile *_file0 = TFile::Open("ZeeOnAOD.aan.root")
| |
− | new TBrowser
| |
− | TTree * zmumuOnAOD=(TTree*) gDirectory->Get("CollectionTree");
| |
− | zeeOnAOD->SetMarkerStyle(20)
| |
− | zeeOnAOD->SetMarkerSize(0.5)
| |
− | zeeOnAOD->SetMarkerColor(2)
| |
− | zeeOnAOD->SetLineColor(4)
| |
− | zeeOnAOD->SetLineWidth(2)
| |
− | zeeOnAOD->Draw("ZeeMass")
| |
− | ZeeOnAOD->Draw("ElectronIsEM")
| |
| </pre> | | </pre> |
| | | |
− | *The StoreGate keys for the various objects in the AOD are listed here: StoregateKeysForAOD. | + | *Edit Interactive_topO.py and replace this line |
− | | |
− | *'''Exercise: add 2 branches to you ZeeOnAOD NTuple to save the Electron cluster energy and TrackParticle momentum. Recompile and run. Then in ROOT check your NTuple that these variables are filled correctly.
| |
− | '''
| |
− | | |
− | ==The TrackParticle==
| |
− | *In this exercise, we will access the a collection of TrackParticles directly from the AOD. Note that from the association objects, Analysis::Muon or Electron, you can access the access the various associated TrackParticles, e.g., look in AnalysisMuon.cxx. But in this exercise, we will use one collection of TrackParticles in the AOD. You may proceed as follows, then we go through the code:
| |
| <pre> | | <pre> |
− | cd ../src
| + | EventSelector.InputCollections = [ "AOD.pool.root" ] |
− | cp ~/PhysicsAnalysis/AnalysisCommon/UserAnalysis/src/TrackExample.cxx .
| |
− | cd ../UserAnalysis
| |
− | cp ~/PhysicsAnalysis/AnalysisCommon/UserAnalysis/UserAnalysis/TrackExample.h .
| |
− | cd ../run
| |
− | cp ~/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/TrackExample_jobOptions.py .
| |
| </pre> | | </pre> |
− | | + | *with this line: |
− | *Now, you want to go the src/components directory and declare this new algorithm TrackExample. | |
| <pre> | | <pre> |
− | cd ../src/components
| + | include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" ) |
| </pre> | | </pre> |
− | *edit UserAnalysis_entries.cxx and add these lines
| |
− | (follow the example that is already in there for the AnalysisSkeleton and AnalysisMuon):
| |
− | <pre>
| |
− | #include "UserAnalysis/TrackExample.h"
| |
− |
| |
− | DECLARE_ALGORITHM_FACTORY( TrackExample )
| |
| | | |
− | DECLARE_ALGORITHM( TrackExample )
| + | *run |
− | </pre>
| |
− | *Save UserAnalysis_entries.cxx and go back the cmt directory and compile: | |
| <pre> | | <pre> |
− | cd ../../cmt
| + | athena -i Interactive_topO.py |
− | cmt config
| |
− | cmt broadcast gmake
| |
− | cd ../run
| |
| </pre> | | </pre> |
− | *Now you may run the TrackExample algorithm as follows: | + | *Initialize application manager |
| <pre> | | <pre> |
− | athena.py TrackExample_jobOptions.py | tee AthenaOut_TrackExample.log | + | athena>theApp.initialize() |
| </pre> | | </pre> |
− | *You should have an AthenaAwareNTuple file, TrackExample.aan.root. While Athena is running, let's go through the code by following this link: KeteviAnalysis. Note the log output to the screen: you will see that the perigee information and the track summary information are being printed to the screen. Look at TrackExample.cxx in details to see how to access this information and more from the TrackParticle. | + | *Run 1 event |
− | | |
− | *Now, open this file in ROOT and browse the AthenaAwareNTuple:
| |
| <pre> | | <pre> |
− | root -l
| + | athena>theApp.nextEvent() |
− | TFile *_file0 = TFile::Open("TrackExample.aan.root")
| |
− | new TBrowser
| |
− | TTree * trackExample=(TTree*) gDirectory->Get("CollectionTree");
| |
− | trackExample->SetMarkerStyle(20)
| |
− | trackExample->SetMarkerSize(0.5)
| |
− | trackExample->SetMarkerColor(2)
| |
− | trackExample->SetLineColor(4)
| |
− | trackExample->SetLineWidth(2)
| |
− | trackExample->Draw("TrackPEta")
| |
− | trackExample->Draw("TrackPD0")
| |
− | trackExample->Draw("TrackPZ0:TrackPD0")
| |
| </pre> | | </pre> |
− | *In this example, we used the Inner Detector collection of TrackParticle in AOD, with StoreGate key "TrackParticleCandidate": follow this link for the AOD content and the keys for various objects/containers int the AOD - StoregateKeysForAOD.
| |
| | | |
− | ==Event Selection with TAG or AAN==
| + | *Retrieve Muons from AOD |
− | *In this exercises, we will use the TAG and the AthenaAwareNTuple to select the final states of interest. For details on the TAG based event selection, follow this link: TagForEventSelection. | |
− | | |
− | ==Event Selection with the TAG==
| |
− | *In this exercise, we will use the TAG to select the final states of interest. The data that we are contains Z to mumu so there is not must selection final state we can do with the TAG on this data but this exercise will give a flavor of what you can to with the TAG and how to it. Consider the following job options.
| |
− | <pre>
| |
− | ####################################################
| |
− | #Author - Ketevi A. Assamagan
| |
− | AllAlgs = False
| |
− | doHist = False
| |
− | doCBNT = False
| |
− | doWriteTAG = False
| |
− | doWriteESD = False
| |
− | readAOD = True
| |
− | doAOD = False
| |
− | doWriteAOD = True
| |
− | # read the TAG as input to the job
| |
− | readColl = True
| |
− | | |
− | # Number of Events
| |
− | EvtMax = 20
| |
− | | |
− | # Use the TAG that you just produce to select the events
| |
− | # define also the selection criteria
| |
− | include ( "mc11.004202.ZmumuJimmy.recon.TAG.v11000401.py" )
| |
− | CollInputQuery="NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"
| |
− | | |
− | #Create a new RDO, ESD and AOD that contain only selected events
| |
− | PoolAODOutput = "mc11.004202.ZmumuJimmy.recon.AOD.TagSel.v11000401.root"
| |
− | | |
− | # main reconstruction job jobOptions
| |
− | include ("RecExCommon/RecExCommon_topOptions.py")
| |
− | #######################################################
| |
− | </pre>
| |
− | *Create a file called TagBasedEventSelection_topOptions.py and copy the above options into it and save it. We are using the TAG file as input and selecting the events at the AOD level. Our selection criteria are defined in the CollInputQuery. We are querying for the events having:
| |
| <pre> | | <pre> |
− | Two one or 2 loose muons
| + | athena>mcon = PyParticleTools.getMuons("MuidMuonCollection") |
− | Eta of each loose muons within 2.5
| |
− | Pt of 2 loose muons above 10 GeV - unit in MeV
| |
| </pre> | | </pre> |
| | | |
− | *For the all the events that pass the selection, we create an AOD file that contains ONLY the selected events: for details on how to use the TAG and which TAG content or attributes you can make selection on, follow this link: TagForEventSelection. The new AOD file name should be mc11.004202.ZmumuJimmy.recon.AOD.TagSel.v11000401.root as specified in the above job options. To select events at the ESD level, one would simply add this lines: | + | *Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools] |
| | | |
| + | *Get the first muon |
| <pre> | | <pre> |
− | readESD = True
| + | athena>m = mcon[0] |
− | readAOD = False
| |
| </pre> | | </pre> |
| | | |
− | *Now run this job options and see that you have a new AOD file that contains only the selected events. An easy and a quick way to see the TAG attributes is to just open the TAG file in ROOT and browse. Copy a sample TAG file from my area and open it in ROOT: | + | *Get a list of methods |
| <pre> | | <pre> |
− | cp ~ordonez/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/TAG.fromAOD.pool.root .
| + | athena>dir(m) |
− | root TAG.fromAOD.pool.root
| |
− | new TBrowser
| |
| </pre> | | </pre> |
− | *Now you can do analysis on the new AOD that contains ONLY the selected events.
| |
| | | |
− | ==Event Selection with the AthenaAwareNTuple==
| + | *See pT |
− | *In this exercise, we will use the AthenaAwareNTuple that you produced in the introdcution: you should have an NTuple called AnalysisSkeleton.aan.root. Proceed as follows: | |
− | <pre>
| |
− | cp AnalysisSkeleton_jobOptions.py AanSelectionAnalysis_topOptions.py
| |
− | </pre>
| |
− | *Edit AanSelectionAnalysis_topOptions.py and replace this line
| |
| <pre> | | <pre> |
− | include( "mc11.004201.ZeeJimmy.recon.AOD.v11000401.py" )
| + | athena>m.pt() |
| </pre> | | </pre> |
| | | |
− | *with these lines | + | *Get TrackParticle via ElementLink |
| <pre> | | <pre> |
− | EventSelector.InputCollections = [ "AnalysisSkeleton.aan" ]
| + | athena>tp = m.track() |
− | EventSelector.Query="NElectrons>0 && NElectrons<3 && abs(ElectronEta[0])<2.5 && abs(ElectronEta[1])<2.5 && ElectronPt[0]>10000 && ElectronPt[1]>10000"
| + | athena>dir(tp) |
− | EventSelector.CollectionType = "ExplicitROOT"
| + | athena>tp.pt() |
| </pre> | | </pre> |
| | | |
− | *Here, we are using the AthenaAwareNTuple called AnalysisSkeleton.aan.root to selected the event at the AOD. Then, we are run the Analysis code, AnalysisSkeleton.cxx on the selected events. Note that when you use the TAG or the AthenaAwareNTuple to event selection, the file extension .root must not be specified: it is assumed and will be appended. In these exercises, we are using the ROOT version of the TAG --- also, our AthenaAwareNTuple is a ROOT file. This is why we specify the CollectionType to be ExplicitROOT. There is also a database version of the TAG: for details see TagForEventSelection. In AanSelectionAnalysis_topOptions.py, replace these lines | + | *Retrieve the MC Truth |
| <pre> | | <pre> |
− | THistSvc.Output = ["AANT DATAFILE='AnalysisSkeleton.aan.root' OPT='RECREATE'"]
| + | athena>mcc = PyTruthTools.getMcEvents("TruthEvent") |
− | AANTupleStream.OutputName = 'AnalysisSkeleton.aan.root'
| + | athena>mc = mcc[0] |
| + | athena>mc.alphaQCD() |
| </pre> | | </pre> |
| | | |
− | *with these lines: | + | *Dump Data Store |
− | <pre>
| |
− | THistSvc.Output = ["AANT DATAFILE='AnalysisSkeleton.sel.aan.root' OPT='RECREATE'"]
| |
− | AANTupleStream.OutputName = 'AnalysisSkeleton.sel.aan.root'
| |
− | </pre>
| |
− | *Now run:
| |
| <pre> | | <pre> |
− | athena.py AanSelectionAnalysis_topOptions.py | + | athena>dumpSG() |
| </pre> | | </pre> |
− | *You should have a new AthenaAwareNTuple file called AnalysisSkeleton.sel.aan.root. That we've just done is the following: we use a previously available AthenaAwareNTuple or TAG to select events and we did analysis on the selected events creating a new AthenaAwareNTuple. We also saw that it is possible to create a new AOD that contains ONLY the selected events. Now check that the selection criteria that we specified above were indeed apply: open AnalysisSkeleton.sel.aan.root and plot the EventNumber and the NElectrons (this should be one or two) according to our selection criteria.
| |
| | | |
− | ==Z to mumu on the ESD==
| + | *Run next event |
− | *In this exercise, we will use the ESD muon association objects, CombinedMuon and its associated TrackParticle and Trk::Track to repeat the Z to mumu reconstruction entirely on ESD and compare to the results of the AOD above. Proceed as you've done above by copying the code from my area, compiling and running it, then we go through it: | |
| <pre> | | <pre> |
− | cd ../src
| + | athena>theApp.nextEvent() |
− | cp ~ordonez/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/src/ZmumuOnESD.cxx .
| |
− | cd ../UserAnalysis
| |
− | cp ~ordonez/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/UserAnalysis/ZmumuOnESD.h .
| |
− | cd ../run
| |
− | cp ~ordonez/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZmumuOnESD_jobOptions.py .
| |
| </pre> | | </pre> |
| | | |
− | *Now, you want to go the src/components directory and declare this new algorithm ZmumuOnESD.
| + | Rewind event counter |
| <pre> | | <pre> |
− | cd ../src/components
| + | athena>theApp.seek(0) |
| </pre> | | </pre> |
| | | |
− | *edit UserAnalysis_entries.cxx and add these lines | + | *See pT distribution of muons |
− | (follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):
| |
| <pre> | | <pre> |
− | #include "UserAnalysis/ZmumuOnESD.h" | + | athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5) |
− | | |
− | DECLARE_ALGORITHM_FACTORY( ZmumuOnESD )
| |
− | | |
− | DECLARE_ALGORITHM( ZmumuOnESD )
| |
− | </pre>
| |
− | Save UserAnalysis_entries.cxx and go back the cmt directory and compile:
| |
− | <pre>
| |
− | cd ../../cmt
| |
− | cmt config
| |
− | cmt broadcast gmake
| |
− | cd ../run
| |
| </pre> | | </pre> |
| | | |
− | *Now you may run the ZmumuOnESD algorithm as follows:
| |
− | <pre>
| |
− | athena.py ZmumuOnESD_jobOptions.py | tee athenaOut_ZmumuOnESD.log
| |
− | </pre>
| |
| | | |
− | *This should produce an AthenaAwareNTuple file, ZmumuOnESD.aan.root. While Athena is running, let's go through the code by following this link: ZmumuOnESD.cxx for the details of the algorithm and the selection cuts.
| |
| | | |
− | *Now, open this file in ROOT and browse the AthenaAwareNTuple: | + | ==Analysis with the EventView== |
| + | *Due to the time I won't cover this section during the Workshop. But now you should have the basic knowledge requiered to understand it. You can learn about the [https://twiki.cern.ch/twiki/bin/view/Atlas/EventView Event View] here |
| | | |
− | <pre>
| + | == Analysis on the GRID == |
− | root -l
| + | * In the following examples we'll run on Zmumu datasets. |
− | TFile *_file0 = TFile::Open("ZmumuOnESD.aan.root")
| + | *This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate. |
− | new TBrowser
| |
− | TTree * zmumuOnESD=(TTree*) gDirectory->Get("CollectionTree");
| |
− | zmumuOnESD->SetMarkerStyle(20)
| |
− | zmumuOnESD->SetMarkerSize(0.5)
| |
− | zmumuOnESD->SetMarkerColor(2)
| |
− | zmumuOnESD->SetLineColor(4)
| |
− | zmumuOnESD->SetLineWidth(2)
| |
− | zmumuOnESD->Draw("ESDZmmMass")
| |
− | zmumuOnESD->Draw("ESDZmmDeltaR")
| |
− | </pre>
| |
| | | |
− | *By default, we used the Muonboy/STACO/MuTag association objects in the ESD and the associated TrackParticles and Trk::Track. But you may change it in the job options ZmumuOnESD_jobOptions.py: the StoreGate keys for the various objects in the ESD are listed here: StoregateKeysForESD. You will notice that in ZmumuOnESD_jobOptions.py, the input data is the ESD, and we are using the CombinedMuonContainer with StoreGate key "StacoCombinedMuonContainer" and from each CombinedMuon object, you can access the associated TrackParticles and Trk::Track. | + | *First we should set up DQ2 tools: |
| | | |
− | *Plot the mumu invariant mass obtained on the ESD and compare it to the one obtained on the AOD above - there may be some differences that I will leave up to you to figure out.
| |
− |
| |
− | ==Z to ee on the ESD==
| |
− | *In this exercise, we will use the ESD Electron/Photon association objects, egamma and its associated TrackParticle and CaloCluster to repeat the Z to ee reconstruction entirely on ESD and compare to the results of the AOD above. Proceed as you've done above by copying the code from my area, compiling and running it, then we go through it:
| |
| <pre> | | <pre> |
− | cd ../src
| + | source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN |
− | cp ~ordonez/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/src/ZeeOnESD.cxx .
| |
− | cd ../UserAnalysis
| |
− | cp ~ordonez/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/UserAnalysis/ZeeOnESD.h .
| |
− | cd ../run
| |
− | cp ~ordonez/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZeeOnESD_jobOptions.py .
| |
| </pre> | | </pre> |
| | | |
− | *Now, you want to go the src/components directory and declare this new algorithm ZeeOnESD. | + | ==PANDA/PATHENA== |
| + | *For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki] |
| + | *Setup PATHENA : |
| <pre> | | <pre> |
− | cd ../src/components | + | cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis |
− | </pre>
| + | cvs update -r UserAnalysis-00-08-13 -A python |
− | | + | cvs update -r UserAnalysis-00-08-13 -A share/pathena |
− | *edit UserAnalysis_entries.cxx and add these lines
| + | cvs update -r UserAnalysis-00-08-13 -A share/pathena_util |
− | (follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):
| + | cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py |
− | <pre>
| + | cd cmt |
− | #include "UserAnalysis/ZeeOnESD.h"
| + | source setup.sh |
− | | + | gmake |
− | DECLARE_ALGORITHM_FACTORY( ZeeOnESD )
| |
− | | |
− | DECLARE_ALGORITHM( ZeeOnESD )
| |
− | </pre>
| |
− | | |
− | *Save UserAnalysis_entries.cxx and go back the cmt directory and compile:
| |
− | <pre>
| |
− | cd ../../cmt | |
− | cmt config
| |
− | cmt broadcast gmake
| |
| cd ../run | | cd ../run |
| </pre> | | </pre> |
| | | |
− | *Now you may run the ZeeOnESD algorithm as follows: | + | *run pathena |
| + | Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!''' |
| <pre> | | <pre> |
− | athena.py ZeeOnESD_jobOptions.py | tee athenaOut_ZeeOnESD.log
| + | pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \ |
| + | 'user.GustavoOrdonezSanz.00008.AAN.root' |
| </pre> | | </pre> |
− | *This should produce an AthenaAwareNTuple file, ZeeOnESD.aan.root. While Athena is running, let's go through the code by following this link: ZeeOnESD.cxx for the details of the algorithm and the selection cuts.
| |
| | | |
− | *Now, open this file in ROOT and browse the AthenaAwareNTuple: | + | *For job status monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring] |
− | <pre>
| |
− | root -l
| |
− | TFile *_file0 = TFile::Open("ZeeOnESD.aan.root")
| |
− | new TBrowser
| |
− | TTree * zeeOnESD=(TTree*) gDirectory->Get("CollectionTree");
| |
− | zeeOnESD->SetMarkerStyle(20)
| |
− | zeeOnESD->SetMarkerSize(0.5)
| |
− | zeeOnESD->SetMarkerColor(2)
| |
− | zeeOnESD->SetLineColor(4)
| |
− | zeeOnESD->SetLineWidth(2)
| |
− | zeeOnESD->Draw("EgammaPt")
| |
− | zeeOnESD->Draw("EgammaEta")
| |
− | zeeOnESD->Draw("EgammaEoverP")
| |
− | zeeOnESD->Draw("EgammaIsEM")
| |
− | zeeOnESD->Draw("EgammaZeeMass")
| |
− | zeeOnESD->Draw("EgammaTrackP")
| |
− | zeeOnESD->Draw("EgammaClusterE")
| |
− | </pre>
| |
| | | |
− | *The StoreGate keys for the various objects in the ESD are listed here: StoregateKeysForESD. You will notice that in ZeeOnESD_jobOptions.py, the input data is the ESD, and we are using the egammaContainer with StoreGate key "egammaCollection" and from each egamma object, you can access the associated TrackParticles and CaloCluster.
| |
| | | |
− | *Plot the ee invariant mass obtained on the ESD and compare it to the one obtained on the AOD above - there may be some differences that I will leave up to you to figure out.
| |
| | | |
− | *For further details of the Electron/Photon reconstruction, see egammaRec. | + | ==DQ2 Tools== |
− | | + | *For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki] |
− | ==Interactive Analysis in ATHENA==
| + | *This tools make your life easier when working on the GRID |
− | *In this exercise, we will see how to do interactive analysis in ATHENA, how to browse the Raw Data in the AOD. Proceed as follows: | |
| <pre> | | <pre> |
− | get_files Interactive_topO.py
| + | dq2_ls *Zmumu*AOD* |
| </pre> | | </pre> |
| | | |
− | *Edit Interactive_topO.py and replace this line | + | *Have a look at the files contained in one of the sets |
− | <pre>
| |
− | EventSelector.InputCollections = [ "AOD.pool.root" ]
| |
− | </pre>
| |
− | *with this line:
| |
| <pre> | | <pre> |
− | include( "mc11.004100.T1_McAtNLO_top.recon.AOD.v11000401.py" )
| + | dq2_ls -f <datasetname> |
| </pre> | | </pre> |
− | *Then start the interactive analysis session from this link.
| |
− |
| |
− |
| |
| | | |
− | ==Monte Carlo Truth Tools on AOD==
| + | *change user.GustavoOrdonezSanz.00008.AAN.root for your own |
− | *In this exercise, we will look MC Truth Tools on AOD. Follow the link below, but skip the configuration part since it pertains to the release 11.0.5 while we are using the release 12.0.1 here and we have already done the configuration for 12.0.1 in the Introduction above. You will also need to make the following changes for 12.0.1: everywhere where application, replace the following | |
− | <pre>
| |
− | #include "TruthParticleAlgs/McVtxFilterTool.h"
| |
− | #include "TruthParticleAlgs/TruthParticleCnvTool.h"
| |
− | #include "AnalysisUtils/McVtxFilter.h"
| |
− | #include "ParticleEvent/TruthParticle.h"
| |
− | #include "ParticleEvent/TruthParticleContainer.h"
| |
− | </pre>
| |
− | *with the following:
| |
| <pre> | | <pre> |
− | #include "McParticleTools/McVtxFilterTool.h"
| + | dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root |
− | #include "McParticleTools/TruthParticleCnvTool.h"
| |
− | #include "McParticleUtils/McVtxFilter.h"
| |
− | #include "McParticleEvent/TruthParticle.h"
| |
− | #include "McParticleEvent/TruthParticleContainer.h"
| |
− | </pre>
| |
− | *Also in your requirements file, you may need to add the following lines and redo cmt config and gmake:
| |
− | <pre>
| |
− | cmt co -r McParticleTools McParticleTools-00-* PhysicsAnalysis/TruthParticleID
| |
− | cmt co -r McParticleUtils McParticleUtils-00-* PhysicsAnalysis/TruthParticleID
| |
− | cmt co -r McParticleEvent McParticleEvent-00-* PhysicsAnalysis/TruthParticleID
| |
| </pre> | | </pre> |
| | | |
− | *Now follow this link, McTrtuh on AOD, make sure that you make the above modifications before running.
| + | ==Ganga== |
| + | We're not going to cover Ganga in this tutorial. But for reference look at:[https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga Ganga link] |
| | | |
− | ==Analysis with the EventView== | + | ==Final Exercice== |
− | *Follow this link: EventView. However, I would suggest that you do the specific exercises above on ESD/AOD/TAG first: that provides the background for understanding the ESD/AOD/TAG before proceeding to the EventView.
| + | To conclude the workshop we're going to try to make our own Higgs to four muon analysis. Taking as an example the ZmumuOnAOD algorithm, make a H4mu one. The purpose of this, is to dig into the Phisics Analysis Tools used in ZmumuOnAOD, and try to have a realistic approach of how is like to make Analyis in Athena. |
| | | |
− | ==Trigger-Aware Analysis==
| + | Good luck! |
− | *A tutorial on Trigger-Aware Analysis can be found here: it was given in 11.0.5 and it is being updated for the release 12.
| |