https://wiki.nikhef.nl/atlas/api.php?action=feedcontributions&user=Gusord&feedformat=atomAtlas Wiki - User contributions [en]2024-03-28T22:30:17ZUser contributionsMediaWiki 1.35.3https://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1254NIKHEF PAT workshop Oct20062006-10-25T08:10:03Z<p>Gusord: /* Final Exercice */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one given by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
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.<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new run2 directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt1>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD_withTAGSelection.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
ZmumuOnAOD_withAANSelection.aan.root<br />
Zmumu_new_AOD_withAANSelection.root<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
*See pT distribution of muons<br />
<pre><br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
</pre><br />
<br />
<br />
<br />
==Analysis with the EventView==<br />
*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<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job status monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
<br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*Have a look at the files contained in one of the sets<br />
<pre><br />
dq2_ls -f <datasetname><br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre><br />
<br />
==Ganga==<br />
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]<br />
<br />
==Final Exercice==<br />
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.<br />
<br />
Good luck!</div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1250NIKHEF PAT workshop Oct20062006-10-25T08:09:04Z<p>Gusord: /* Ganga */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one given by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
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.<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new run2 directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt1>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD_withTAGSelection.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
ZmumuOnAOD_withAANSelection.aan.root<br />
Zmumu_new_AOD_withAANSelection.root<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
*See pT distribution of muons<br />
<pre><br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
</pre><br />
<br />
<br />
<br />
==Analysis with the EventView==<br />
*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<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job status monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
<br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*Have a look at the files contained in one of the sets<br />
<pre><br />
dq2_ls -f <datasetname><br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre><br />
<br />
==Ganga==<br />
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]<br />
<br />
==Final Exercice==<br />
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 porpouse 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.<br />
<br />
Good luck!</div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1249NIKHEF PAT workshop Oct20062006-10-24T13:44:23Z<p>Gusord: /* Event Selection using TAG */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one given by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
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.<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new run2 directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt1>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD_withTAGSelection.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
ZmumuOnAOD_withAANSelection.aan.root<br />
Zmumu_new_AOD_withAANSelection.root<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
*See pT distribution of muons<br />
<pre><br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
</pre><br />
<br />
<br />
<br />
==Analysis with the EventView==<br />
*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<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job status monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
<br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*Have a look at the files contained in one of the sets<br />
<pre><br />
dq2_ls -f <datasetname><br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre><br />
<br />
==Ganga==<br />
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]</div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1248NIKHEF PAT workshop Oct20062006-10-23T11:28:23Z<p>Gusord: /* Ganga */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one given by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
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.<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new run2 directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD_withTAGSelection.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
ZmumuOnAOD_withAANSelection.aan.root<br />
Zmumu_new_AOD_withAANSelection.root<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
*See pT distribution of muons<br />
<pre><br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
</pre><br />
<br />
<br />
<br />
==Analysis with the EventView==<br />
*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<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job status monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
<br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*Have a look at the files contained in one of the sets<br />
<pre><br />
dq2_ls -f <datasetname><br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre><br />
<br />
==Ganga==<br />
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]</div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1214NIKHEF PAT workshop Oct20062006-10-23T11:24:04Z<p>Gusord: /* Event Selection using AAN */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one given by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
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.<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new run2 directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD_withTAGSelection.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
ZmumuOnAOD_withAANSelection.aan.root<br />
Zmumu_new_AOD_withAANSelection.root<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
*See pT distribution of muons<br />
<pre><br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
</pre><br />
<br />
<br />
<br />
==Analysis with the EventView==<br />
*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<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job status monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
<br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*Have a look at the files contained in one of the sets<br />
<pre><br />
dq2_ls -f <datasetname><br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre><br />
<br />
==Ganga==<br />
We're not going to cover Ganga in this tutorial. But for reverence look at:[https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga Ganga link]</div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1213NIKHEF PAT workshop Oct20062006-10-23T11:23:36Z<p>Gusord: /* Event Selection using AAN */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one given by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
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.<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new run2 directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD_withTAGSelection.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
ZmumuOnAOD_withAANSelection.aan.root<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
*See pT distribution of muons<br />
<pre><br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
</pre><br />
<br />
<br />
<br />
==Analysis with the EventView==<br />
*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<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job status monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
<br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*Have a look at the files contained in one of the sets<br />
<pre><br />
dq2_ls -f <datasetname><br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre><br />
<br />
==Ganga==<br />
We're not going to cover Ganga in this tutorial. But for reverence look at:[https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga Ganga link]</div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1212NIKHEF PAT workshop Oct20062006-10-23T11:20:55Z<p>Gusord: /* Event Selection using TAG */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one given by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
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.<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new run2 directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD_withTAGSelection.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
*See pT distribution of muons<br />
<pre><br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
</pre><br />
<br />
<br />
<br />
==Analysis with the EventView==<br />
*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<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job status monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
<br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*Have a look at the files contained in one of the sets<br />
<pre><br />
dq2_ls -f <datasetname><br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre><br />
<br />
==Ganga==<br />
We're not going to cover Ganga in this tutorial. But for reverence look at:[https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga Ganga link]</div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1211NIKHEF PAT workshop Oct20062006-10-23T11:17:55Z<p>Gusord: /* Event Selection using AAN */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one given by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
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.<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new run2 directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
*See pT distribution of muons<br />
<pre><br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
</pre><br />
<br />
<br />
<br />
==Analysis with the EventView==<br />
*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<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job status monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
<br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*Have a look at the files contained in one of the sets<br />
<pre><br />
dq2_ls -f <datasetname><br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre><br />
<br />
==Ganga==<br />
We're not going to cover Ganga in this tutorial. But for reverence look at:[https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga Ganga link]</div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1210NIKHEF PAT workshop Oct20062006-10-23T09:14:31Z<p>Gusord: /* Event Selection using TAG */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one given by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
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.<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new run2 directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
*See pT distribution of muons<br />
<pre><br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
</pre><br />
<br />
<br />
<br />
==Analysis with the EventView==<br />
*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<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job status monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
<br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*Have a look at the files contained in one of the sets<br />
<pre><br />
dq2_ls -f <datasetname><br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre><br />
<br />
==Ganga==<br />
We're not going to cover Ganga in this tutorial. But for reverence look at:[https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga Ganga link]</div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006_pre-Tutorial&diff=4772NIKHEF PAT workshop Oct2006 pre-Tutorial2006-10-23T09:10:43Z<p>Gusord: /* Set up CMT */</p>
<hr />
<div>==Note==<br />
<br />
We'll work using lxplus machines at cern. So make sure you have an ATLAS AFS computer account and scratch0 space.<br />
<br />
==What will you learn==<br />
<br />
*Set up the Athena enviroment<br />
<br />
*Run the UserAnalys package creating AANT (AthenaAware NTuples)<br />
<br />
*Add new algorithms to the package<br />
<br />
*How to access AOD/ESD different containers (Muon, Electron, TrackParticles, GenEvent...) via StoreGate. And the use of the AlgTool AnalysisTools to manipulate their objects.<br />
<br />
==Set up CMT==<br />
<br />
* Login to lxplus at CERN and create a working directory called "Workshop". We will use the release 12.0.2 this tutorial: <br />
<pre><br />
ssh lxplus.cern.ch<br />
cd scratch0<br />
mkdir Workshop<br />
cd Workshop<br />
mkdir 12.0.2<br />
</pre><br />
<br />
* 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:<br />
<pre><br />
set CMTSITE CERN<br />
set SITEROOT /afs/cern.ch<br />
macro ATLAS_DIST_AREA ${SITEROOT}/atlas/software/dist<br />
<br />
macro ATLAS_TEST_AREA "" \<br />
12.0.2 "${HOME}/scratch0/Workshop/12.0.2"<br />
<br />
<br />
apply_tag oneTest<br />
<br />
use AtlasLogin AtlasLogin-* $(ATLAS_DIST_AREA)<br />
</pre><br />
<br />
*Then do the following:<br />
<pre><br />
source /afs/cern.ch/sw/contrib/CMT/v1r18p20060606/mgr/setup.sh<br />
cmt config<br />
</pre><br />
<br />
==Setup for the release 12.0.2==<br />
*Do the following:<br />
<pre><br />
source setup.sh -tag=12.0.2,opt<br />
</pre><br />
<br />
*Check that the CMT path is correct by doing this<br />
<pre><br />
echo $CMTPATH<br />
</pre><br />
<br />
*Stuff like this should be printed to your screen:<br />
<pre><br />
/afs/cern.ch/user/o/ordonez/scratch0/Workshop/12.0.2:<br />
/afs/cern.ch/atlas/software/builds/AtlasOffline/12.0.2<br />
</pre><br />
<br />
*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.<br />
<br />
==Run Time Setup==<br />
*Go to your working area and check out the follow package:<br />
<pre><br />
cd 12.0.2<br />
cmt co -r UserAnalysis-00-08-05 PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
</pre><br />
<br />
*Now compile everything as follows:<br />
<pre><br />
cd PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
cmt config; source setup.sh; cmt br gmake<br />
cd ../run<br />
</pre><br />
<br />
*To test that everything has been done correctly, do:<br />
<pre><br />
get_files HelloWorldOptions.py<br />
athena.py HelloWorldOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*Stuff like this should be printed to the screen:<br />
<pre><br />
HelloWorld INFO execute()<br />
HelloWorld INFO An INFO message<br />
HelloWorld WARNING A WARNING message<br />
HelloWorld ERROR An ERROR message<br />
HelloWorld FATAL A FATAL error message<br />
AthenaEventLoopMgr INFO ===>>> end of event 9 <<<===<br />
HistorySvc INFO Service finalised successfully<br />
ChronoStatSvc.f... INFO Service finalized succesfully<br />
ToolSvc INFO Removing all tools created by ToolSvc<br />
ApplicationMgr INFO Application Manager Finalized successfully<br />
ApplicationMgr INFO Application Manager Terminated successfully<br />
</pre><br />
<br />
==The Next Time You Login==<br />
*The next time you login, just do the following:<br />
<pre><br />
cd ${HOME}/scratch0/Workshop<br />
source setup.sh -tag=12.0.2<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
source setup.sh<br />
cd ../run<br />
</pre><br />
<br />
==Get The Necessary Files==<br />
*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:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/data/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data/*.py .<br />
</pre><br />
<br />
==Run the AnalysisSkeleton for 500 Events==<br />
*get the necessary job options file from the release:<br />
<pre><br />
get_files AnalysisSkeleton_jobOptions.py<br />
</pre><br />
<br />
*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<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root"]<br />
</pre><br />
*with this line<br />
<pre><br />
include( "mc11.004201.ZeeJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
*Check that in AnalysisSkeleton_jobOptions.py, the number of events to run is set to 500:<br />
<pre><br />
# Number of Events to process<br />
theApp.EvtMax = 500<br />
</pre><br />
*Now run the AnalysisSkeleton_jobOptions.py. It should produce a file called AnalysisSkeleton.aan.root which contains some ROOT histograms and an AthenaAwareNTuple:<br />
<pre><br />
athena.py AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
*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].<br />
<br />
*Now, you may look at the the ../UserAnalysis/AnalysisSkeleton.h, the ../src/AnalysisSkeleton.cxx and ../run/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.<br />
<br />
*You should open the output file AnalysisSkeleton.aan.root in ROOT and browse the histograms and the AthenaAwareNTuple:<br />
<pre><br />
root -l AnalysisSkeleton.aan.root<br />
new TBrowser<br />
</pre><br />
*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.<br />
<br />
==More Information==<br />
*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].<br />
<br />
==Z to mumu on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<br />
*'''NOTE: Don't copy directly the lines, but follow the example!'''<br />
<pre><br />
#include "UserAnalysis/ZmumuOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cp ~ordonez/public/Workshop_files/cmt/requirements .<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the ZmumuOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnAOD_jobOptions.py | tee AthenaOut_ZmumuOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnAOD.aan.root. While Athena is running, have a look at the code: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *f = TFile::Open("ZmumuOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnAOD->SetMarkerStyle(20)<br />
zmumuOnAOD->SetMarkerSize(0.5)<br />
zmumuOnAOD->SetMarkerColor(2)<br />
zmumuOnAOD->SetLineColor(4)<br />
zmumuOnAOD->SetLineWidth(2)<br />
zmumuOnAOD->Draw("ZmmMass")<br />
</pre><br />
*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].<br />
<br />
*'''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.'''<br />
<br />
==Z to ee on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/ZeeOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<pre><br />
#include "UserAnalysis/ZeeOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnAOD_jobOptions.py| tee AthenaOut_ZeeOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZeeOnAOD.aan.root. While Athena is running, have a look at the code: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnAOD->SetMarkerStyle(20)<br />
zeeOnAOD->SetMarkerSize(0.5)<br />
zeeOnAOD->SetMarkerColor(2)<br />
zeeOnAOD->SetLineColor(4)<br />
zeeOnAOD->SetLineWidth(2)<br />
zeeOnAOD->Draw("ZeeMass")<br />
zeeOnAOD->Draw("ElectronIsEM")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the AOD are listed here: StoregateKeysForAOD.<br />
<br />
*'''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.<br />
'''<br />
<br />
==The TrackParticle==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/TrackExample.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/TrackExample.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/TrackExample_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm TrackExample.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton and AnalysisMuon):<br />
<pre><br />
#include "UserAnalysis/TrackExample.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( TrackExample )<br />
<br />
DECLARE_ALGORITHM( TrackExample )<br />
</pre><br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the TrackExample algorithm as follows:<br />
<pre><br />
athena.py TrackExample_jobOptions.py | tee AthenaOut_TrackExample.log<br />
</pre><br />
*You should have an AthenaAwareNTuple file, TrackExample.aan.root. While Athena is running, have a look at the code: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/ 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.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("TrackExample.aan.root")<br />
new TBrowser<br />
TTree * trackExample=(TTree*) gDirectory->Get("CollectionTree");<br />
trackExample->SetMarkerStyle(20)<br />
trackExample->SetMarkerSize(0.5)<br />
trackExample->SetMarkerColor(2)<br />
trackExample->SetLineColor(4)<br />
trackExample->SetLineWidth(2)<br />
trackExample->Draw("TrackPEta")<br />
trackExample->Draw("TrackPD0")<br />
trackExample->Draw("TrackPZ0:TrackPD0")<br />
</pre><br />
*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 - [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForAOD StoregateKeysForAOD].<br />
<br />
==Z to mumu on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZmumuOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnESD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnESD )<br />
</pre><br />
Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZmumuOnESD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnESD_jobOptions.py | tee athenaOut_ZmumuOnESD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnESD.aan.root. While Athena is running, have a look at the code here: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZmumuOnESD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnESD->SetMarkerStyle(20)<br />
zmumuOnESD->SetMarkerSize(0.5)<br />
zmumuOnESD->SetMarkerColor(2)<br />
zmumuOnESD->SetLineColor(4)<br />
zmumuOnESD->SetLineWidth(2)<br />
zmumuOnESD->Draw("ESDZmmMass")<br />
zmumuOnESD->Draw("ESDZmmDeltaR")<br />
</pre><br />
<br />
*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.<br />
<br />
*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.<br />
<br />
==Z to ee on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZeeOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZeeOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnESD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnESD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnESD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnESD_jobOptions.py | tee athenaOut_ZeeOnESD.log<br />
</pre><br />
*This should produce an AthenaAwareNTuple file, ZeeOnESD.aan.root. While Athena is running, Hava a look at the code at: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnESD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnESD->SetMarkerStyle(20)<br />
zeeOnESD->SetMarkerSize(0.5)<br />
zeeOnESD->SetMarkerColor(2)<br />
zeeOnESD->SetLineColor(4)<br />
zeeOnESD->SetLineWidth(2)<br />
zeeOnESD->Draw("EgammaPt")<br />
zeeOnESD->Draw("EgammaEta")<br />
zeeOnESD->Draw("EgammaEoverP")<br />
zeeOnESD->Draw("EgammaIsEM")<br />
zeeOnESD->Draw("EgammaZeeMass")<br />
zeeOnESD->Draw("EgammaTrackP")<br />
zeeOnESD->Draw("EgammaClusterE")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the ESD are listed here: [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForESD 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.<br />
<br />
*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.<br />
<br />
*For further details of the Electron/Photon reconstruction, see [https://twiki.cern.ch/twiki/bin/view/Atlas/EgammaATLASRecoPerformance egammaRec].<br />
<br />
==MCTruth==<br />
In this exercise, we will look MC Truth Tools on AOD.<br />
<br />
first copy the files:<br />
<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/MCTruth.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/MCTruth.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/MCTruth_jobOptions.py .<br />
</pre><br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/MCTruth.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( MCTruth )<br />
<br />
DECLARE_ALGORITHM( MCTruth )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the MCTruth algorithm as follows:<br />
<pre><br />
athena.py MCTruth_jobOptions.py | tee athenaOut_MCTruth.log<br />
</pre><br />
*This should produce an AthenaAwareNTuple file, MCTruth.aan.root. <br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("MCTruth.aan.root")<br />
new TBrowser<br />
</pre><br />
<br />
*You can see three different trees: CollectionTree (The AthenaAware one), Electron (with the ElectronCollection histograms), and MCTopWb (with the MC histograms).</div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1209NIKHEF PAT workshop Oct20062006-10-16T14:30:42Z<p>Gusord: /* TriggerAware Analyis */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one given by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
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.<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new Run directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
*See pT distribution of muons<br />
<pre><br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
</pre><br />
<br />
<br />
<br />
==Analysis with the EventView==<br />
*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<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job status monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
<br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*Have a look at the files contained in one of the sets<br />
<pre><br />
dq2_ls -f <datasetname><br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre><br />
<br />
==Ganga==<br />
We're not going to cover Ganga in this tutorial. But for reverence look at:[https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga Ganga link]</div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1150NIKHEF PAT workshop Oct20062006-10-16T14:30:24Z<p>Gusord: /* Pre-Tutorial */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one given by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
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.<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new Run directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
*See pT distribution of muons<br />
<pre><br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
</pre><br />
<br />
==TriggerAware Analyis==<br />
<br />
==Analysis with the EventView==<br />
*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<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job status monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
<br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*Have a look at the files contained in one of the sets<br />
<pre><br />
dq2_ls -f <datasetname><br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre><br />
<br />
==Ganga==<br />
We're not going to cover Ganga in this tutorial. But for reverence look at:[https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga Ganga link]</div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1149NIKHEF PAT workshop Oct20062006-10-16T14:28:55Z<p>Gusord: /* Pre-Tutorial */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one given by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
During the workshop we'll browse over the code that we've used in the pre-Tutorial to try and uderstand it.<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new Run directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
*See pT distribution of muons<br />
<pre><br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
</pre><br />
<br />
==TriggerAware Analyis==<br />
<br />
==Analysis with the EventView==<br />
*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<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job status monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
<br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*Have a look at the files contained in one of the sets<br />
<pre><br />
dq2_ls -f <datasetname><br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre><br />
<br />
==Ganga==<br />
We're not going to cover Ganga in this tutorial. But for reverence look at:[https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga Ganga link]</div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=Athena_workshop&diff=1225Athena workshop2006-10-16T14:27:34Z<p>Gusord: /* Physics Analysis Tools (PAT) */</p>
<hr />
<div>==Introduction==<br />
This is the place where information about the ''ATHENA workshop'' will be made available. ATHENA is the control framework of ATLAS. It is based on Gaudi. Getting started with ATHENA is quite difficult and one can easily get lost. The october workshop held at NIKHEF will provide a first introduction to ATHENA.<br />
<br />
The aim of the workshop is:<br />
* get familiar with CMT (Configuration Management Tool). This is the environment used to run ATHENA and maintain/develop its packages.<br />
* introduce a beginner to ATHENA and its concepts such as Algorithms, Tools, DataStorage and the like<br />
* explain the usage of python scripts (''jobOptions'') in order to steer ATHENA<br />
* excersise on a part of the ATHENA-chain: do reconstruction and analysis<br />
The aim of the workshop is not:<br />
* an introduction to C++ and python programming. Although experience in C++ is absolutely necessary for using and understanding ATHENA we won't go into it. Little knowledge on python won't limit ones capabilities on using ATHENA.<br />
* give a detailed explaination of the technicalities behind CMT and ATHENA. Due to little time we won't go deep into the details. <br />
<br />
In order to maximize efficiency of the latter parts of the tutorial, <font color = red>'''it is recommended to do the [http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial ''Pre-Tutorial''] before starting with the main tutorial!'''</font> Preferably before the first session on monday, so that the topics covered will be more familiar. In case that the pre-tutorial is too difficult, one might prefer to do the pre-tutorial tuesday (morning).<br />
<br />
==Athena generalities==<br />
Monday 23th October.<br />
* introduction to CMT and environment set up.<br />
* explaination directory structure<br />
* requirement files<br />
* handy tools of CMT (co, get_tag, etc)<br />
* navigating through packages (CVS, LXR)<br />
* introducing ATHENA and its most used abstract classes: Algorithms, Tools, TDS <br />
* steering ATHENA with jobOptions python scripts<br />
<br />
==Reconstruction==<br />
Tuesday 24th October.<br />
* the RecExCommon package<br />
* examples of reconstruction<br />
* running over Raw Data Objects<br />
* using different parts of the Detector/ different algorithms <br />
* production of ESD/AOD/TAG objects<br />
* if there's time: how to customize your reconstruction chain<br />
<br />
==Physics Analysis Tools (PAT)==<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006 PAT-Tutorial] Wednesday 25th October.<br />
<br />
*[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial]<br />
*Event Selection<br />
*Event Selection using TAG<br />
*Event Selection using AAN<br />
*Interactive Analysis in ATHENA<br />
*Analysis with the EventView<br />
*Analysis on the GRID<br />
*PANDA/PATHENA<br />
*GANGA<br />
*DQ2 Tools<br />
<br />
==Documentation==<br />
Of course, a lot of links can provide even more information on CMT, ATHENA, Reconstruction and PAT.</div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1148NIKHEF PAT workshop Oct20062006-10-16T14:19:32Z<p>Gusord: /* DQ2 Tools */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one given by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new Run directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
*See pT distribution of muons<br />
<pre><br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
</pre><br />
<br />
==TriggerAware Analyis==<br />
<br />
==Analysis with the EventView==<br />
*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<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job status monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
<br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*Have a look at the files contained in one of the sets<br />
<pre><br />
dq2_ls -f <datasetname><br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre><br />
<br />
==Ganga==<br />
We're not going to cover Ganga in this tutorial. But for reverence look at:[https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga Ganga link]</div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1146NIKHEF PAT workshop Oct20062006-10-16T14:17:55Z<p>Gusord: /* GANGA */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one given by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new Run directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
*See pT distribution of muons<br />
<pre><br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
</pre><br />
<br />
==TriggerAware Analyis==<br />
<br />
==Analysis with the EventView==<br />
*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<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job status monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
<br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*Have a look at the files contained in one of the sets<br />
<pre><br />
dq2_ls -f <datasetname><br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1145NIKHEF PAT workshop Oct20062006-10-16T08:56:07Z<p>Gusord: /* GANGA */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one given by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new Run directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
*See pT distribution of muons<br />
<pre><br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
</pre><br />
<br />
==TriggerAware Analyis==<br />
<br />
==Analysis with the EventView==<br />
*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<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job status monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
==GANGA==<br />
*For further details vistit [https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga ganga wiki]<br />
*A very simple example of how to use GANGA move to your ${HOME} directory and do:<br />
<pre><br />
source /afs/cern.ch/project/gd/LCG-share/sl3/etc/profile.d/grid_env.csh<br />
alias dq2 = /afs/cern.ch/atlas/offline/external/GRID/ddm/pro02/dq2<br />
setenv LFC_HOST 'lfc-atlas-test.cern.ch'<br />
setenv LCG_CATALOG_TYPE lfc<br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
setenv PATH /afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta10/bin/:$PATH<br />
setenv GANGA_CONFIG_PATH GangaAtlas/Atlas.ini<br />
</pre><br />
<br />
*Generate a ${HOME}/.gangarc with<br />
<pre><br />
ganga -g<br />
</pre><br />
<br />
*Edit $HOME/.gangarc as follows: <br />
<br />
1. In the section labelled [Configuration] add the line:<br />
<pre><br />
RUNTIME_PATH = GangaAtlas<br />
</pre><br />
2. In the section labelled [LCG] add the line:<br />
<pre><br />
VirtualOrganisation = atlas<br />
</pre><br />
<br />
*Now move to the run directory again. Note that you can run Ganga in a very similar way as you run pathena:<br />
<pre><br />
ganga athena --inDS csc11.005300.PythiaH130zz4l.recon.AOD.v11004103 \<br />
--outputdata AnalysisSkeleton.aan.root \ <br />
--lsf --maxevt 100 \<br />
AnalysisSkeleton_jobOptions.py<br />
</pre><br />
<br />
*Inside the Python interpreter:<br />
<pre><br />
j = Job()<br />
j.application=Athena()<br />
j.application.prepare()<br />
j.application.option_file='$HOME/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZmumuOnAOD_jobOptions.py'<br />
j.inputdata=DQ2Dataset()<br />
j.inputdata.type='DQ2_LOCAL'<br />
j.inputdata.dataset='csc11.005145.PythiaZmumu.recon.AOD.v11004103'<br />
j.outputdata=DQ2OutputDataset()<br />
j.outputdata.outputdata=['ZmumuOnAOD.aan.root']<br />
j.backend=LCG()<br />
j.submit()<br />
</pre><br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*Have a look at the files contained in one of the sets<br />
<pre><br />
dq2_ls -f <datasetname><br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1144NIKHEF PAT workshop Oct20062006-10-16T08:25:55Z<p>Gusord: /* PANDA/PATHENA */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one given by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new Run directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
*See pT distribution of muons<br />
<pre><br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
</pre><br />
<br />
==TriggerAware Analyis==<br />
<br />
==Analysis with the EventView==<br />
*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<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job status monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
==GANGA==<br />
*For further details vistit [https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga ganga wiki]<br />
*A very simple example of how to use panda move to your ${HOME} directory and do:<br />
<pre><br />
export PATH=$PATH:/afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/<br />
<br />
or <br />
<br />
setenv PATH /afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/:${PATH}<br />
</pre><br />
<br />
*Generate a ${HOME}/.gangarc with<br />
<pre><br />
ganga -g<br />
</pre><br />
<br />
*Edit $HOME/.gangarc as follows: <br />
<br />
1. In the section labelled [Configuration] add the line:<br />
<pre><br />
RUNTIME_PATH = GangaAtlas<br />
</pre><br />
2. In the section labelled [LCG] add the line:<br />
<pre><br />
VirtualOrganisation = atlas<br />
</pre><br />
<br />
*Now move to the run directory again and try this:<br />
<pre><br />
ganga<br />
</pre><br />
<br />
*Inside the Python interpreter:<br />
<pre><br />
j = Job()<br />
j.application=Athena()<br />
j.application.prepare()<br />
j.application.option_file='$HOME/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZmumuOnAOD_jobOptions.py'<br />
j.inputdata=DQ2Dataset()<br />
j.inputdata.type='DQ2_LOCAL'<br />
j.inputdata.dataset='csc11.005145.PythiaZmumu.recon.AOD.v11004103'<br />
j.outputdata=DQ2OutputDataset()<br />
j.outputdata.outputdata=['ZmumuOnAOD.aan.root']<br />
j.backend=LCG()<br />
j.submit()<br />
</pre><br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*Have a look at the files contained in one of the sets<br />
<pre><br />
dq2_ls -f <datasetname><br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=Athena_workshop&diff=1139Athena workshop2006-10-13T14:27:38Z<p>Gusord: /* Physics Analysis Tools (PAT) */</p>
<hr />
<div>==Introduction==<br />
This is the place where information about the ''ATHENA workshop'' will be made available. ATHENA is the control framework of ATLAS. It is based on Gaudi. nice. Getting started with ATHENA is quite difficult and one can easily get lost. not nice. The october workshop held at NIKHEF will provide a first introduction to ATHENA.<br />
<br />
The aim of the workshop is:<br />
* get familiar with CMT (Configuration Management Tool). This is the environment used to run ATHENA and maintain/develop its packages.<br />
* introduce a beginner to ATHENA and its concepts such as Algorithms, Tools, DataStorage and the like<br />
* explain the usage of python scripts (''jobOptions'') in order to steer ATHENA<br />
* Excersise on a part of the ATHENA-chain: do reconstruction and analysis<br />
<br />
==Athena generalities==<br />
Monday 23th October.<br />
* introduction to CMT and environment set up.<br />
* explaination directory structure<br />
* requirement files<br />
* handy tools of CMT (co, get_tag, etc)<br />
* navigating through packages (CVS, LXR)<br />
* introducing ATHENA and its most used abstract classes: Algorithms, Tools, TDS <br />
* steering ATHENA with jobOptions python scripts<br />
<br />
==Reconstruction==<br />
Tuesday 24th October.<br />
* the RecExCommon package<br />
* examples of reconstruction<br />
* running over Raw Data Objects<br />
* using different parts of the Detector/ different algorithms <br />
* production of ESD/AOD/TAG objects<br />
* if there's time: how to customize your reconstruction chain<br />
<br />
==Physics Analysis Tools (PAT)==<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006 PAT-Tutorial] Wednesday 25th October.<br />
<br />
*[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial]<br />
*Event Selection<br />
*Event Selection using TAG<br />
*Event Selection using AAN<br />
*Interactive Analysis in ATHENA<br />
*TriggerAware Analyis<br />
*Analysis with the EventView<br />
*Analysis on the GRID<br />
*PANDA/PATHENA<br />
*GANGA<br />
*DQ2 Tools<br />
<br />
==Documentation==<br />
Of course, a lot of links can provide even more information on CMT, ATHENA, Reconstruction and PAT.</div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=Athena_workshop&diff=1138Athena workshop2006-10-13T14:27:27Z<p>Gusord: /* [http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006 Physics Analysis Tools] (PAT) */</p>
<hr />
<div>==Introduction==<br />
This is the place where information about the ''ATHENA workshop'' will be made available. ATHENA is the control framework of ATLAS. It is based on Gaudi. nice. Getting started with ATHENA is quite difficult and one can easily get lost. not nice. The october workshop held at NIKHEF will provide a first introduction to ATHENA.<br />
<br />
The aim of the workshop is:<br />
* get familiar with CMT (Configuration Management Tool). This is the environment used to run ATHENA and maintain/develop its packages.<br />
* introduce a beginner to ATHENA and its concepts such as Algorithms, Tools, DataStorage and the like<br />
* explain the usage of python scripts (''jobOptions'') in order to steer ATHENA<br />
* Excersise on a part of the ATHENA-chain: do reconstruction and analysis<br />
<br />
==Athena generalities==<br />
Monday 23th October.<br />
* introduction to CMT and environment set up.<br />
* explaination directory structure<br />
* requirement files<br />
* handy tools of CMT (co, get_tag, etc)<br />
* navigating through packages (CVS, LXR)<br />
* introducing ATHENA and its most used abstract classes: Algorithms, Tools, TDS <br />
* steering ATHENA with jobOptions python scripts<br />
<br />
==Reconstruction==<br />
Tuesday 24th October.<br />
* the RecExCommon package<br />
* examples of reconstruction<br />
* running over Raw Data Objects<br />
* using different parts of the Detector/ different algorithms <br />
* production of ESD/AOD/TAG objects<br />
* if there's time: how to customize your reconstruction chain<br />
<br />
==Physics Analysis Tools (PAT)==<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006PAT-Tutorial] Wednesday 25th October.<br />
<br />
*[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial]<br />
*Event Selection<br />
*Event Selection using TAG<br />
*Event Selection using AAN<br />
*Interactive Analysis in ATHENA<br />
*TriggerAware Analyis<br />
*Analysis with the EventView<br />
*Analysis on the GRID<br />
*PANDA/PATHENA<br />
*GANGA<br />
*DQ2 Tools<br />
<br />
==Documentation==<br />
Of course, a lot of links can provide even more information on CMT, ATHENA, Reconstruction and PAT.</div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=Athena_workshop&diff=1137Athena workshop2006-10-13T14:25:59Z<p>Gusord: /* [http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006 Physics Analysis Tools] (PAT) */</p>
<hr />
<div>==Introduction==<br />
This is the place where information about the ''ATHENA workshop'' will be made available. ATHENA is the control framework of ATLAS. It is based on Gaudi. nice. Getting started with ATHENA is quite difficult and one can easily get lost. not nice. The october workshop held at NIKHEF will provide a first introduction to ATHENA.<br />
<br />
The aim of the workshop is:<br />
* get familiar with CMT (Configuration Management Tool). This is the environment used to run ATHENA and maintain/develop its packages.<br />
* introduce a beginner to ATHENA and its concepts such as Algorithms, Tools, DataStorage and the like<br />
* explain the usage of python scripts (''jobOptions'') in order to steer ATHENA<br />
* Excersise on a part of the ATHENA-chain: do reconstruction and analysis<br />
<br />
==Athena generalities==<br />
Monday 23th October.<br />
* introduction to CMT and environment set up.<br />
* explaination directory structure<br />
* requirement files<br />
* handy tools of CMT (co, get_tag, etc)<br />
* navigating through packages (CVS, LXR)<br />
* introducing ATHENA and its most used abstract classes: Algorithms, Tools, TDS <br />
* steering ATHENA with jobOptions python scripts<br />
<br />
==Reconstruction==<br />
Tuesday 24th October.<br />
* the RecExCommon package<br />
* examples of reconstruction<br />
* running over Raw Data Objects<br />
* using different parts of the Detector/ different algorithms <br />
* production of ESD/AOD/TAG objects<br />
* if there's time: how to customize your reconstruction chain<br />
<br />
==[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006 Physics Analysis Tools] (PAT)==<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Link to the pre-tutorial]<br />
<br />
Wednesday 25th October.<br />
<br />
*Pre-Tutorial<br />
*Event Selection<br />
*Event Selection using TAG<br />
*Event Selection using AAN<br />
*Interactive Analysis in ATHENA<br />
*TriggerAware Analyis<br />
*Analysis with the EventView<br />
*Analysis on the GRID<br />
*PANDA/PATHENA<br />
*GANGA<br />
*DQ2 Tools<br />
<br />
==Documentation==<br />
Of course, a lot of links can provide even more information on CMT, ATHENA, Reconstruction and PAT.</div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=Athena_workshop&diff=1136Athena workshop2006-10-13T14:24:07Z<p>Gusord: /* Physics Analysis Tools (PAT) */</p>
<hr />
<div>==Introduction==<br />
This is the place where information about the ''ATHENA workshop'' will be made available. ATHENA is the control framework of ATLAS. It is based on Gaudi. nice. Getting started with ATHENA is quite difficult and one can easily get lost. not nice. The october workshop held at NIKHEF will provide a first introduction to ATHENA.<br />
<br />
The aim of the workshop is:<br />
* get familiar with CMT (Configuration Management Tool). This is the environment used to run ATHENA and maintain/develop its packages.<br />
* introduce a beginner to ATHENA and its concepts such as Algorithms, Tools, DataStorage and the like<br />
* explain the usage of python scripts (''jobOptions'') in order to steer ATHENA<br />
* Excersise on a part of the ATHENA-chain: do reconstruction and analysis<br />
<br />
==Athena generalities==<br />
Monday 23th October.<br />
* introduction to CMT and environment set up.<br />
* explaination directory structure<br />
* requirement files<br />
* handy tools of CMT (co, get_tag, etc)<br />
* navigating through packages (CVS, LXR)<br />
* introducing ATHENA and its most used abstract classes: Algorithms, Tools, TDS <br />
* steering ATHENA with jobOptions python scripts<br />
<br />
==Reconstruction==<br />
Tuesday 24th October.<br />
* the RecExCommon package<br />
* examples of reconstruction<br />
* running over Raw Data Objects<br />
* using different parts of the Detector/ different algorithms <br />
* production of ESD/AOD/TAG objects<br />
* if there's time: how to customize your reconstruction chain<br />
<br />
==[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006 Physics Analysis Tools] (PAT)==<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Link to the pre-tutorial]<br />
<br />
Wednesday 25th October.<br />
* skeleton Analysis-algorithm<br />
* adding of new algorithms<br />
* the use of TAG to redo ESD/AOD<br />
* generation of Athena Aware Ntuples (AAN)<br />
* use of AAN to redo ESD/AOD<br />
* produce ATLFAST ntuples<br />
* usage of GRID tools<br />
* running ATHENA on the GRID<br />
* Trigger aware analysis<br />
<br />
==Documentation==<br />
Of course, a lot of links can provide even more information on CMT, ATHENA, Reconstruction and PAT.</div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1143NIKHEF PAT workshop Oct20062006-10-13T14:22:27Z<p>Gusord: /* Interactive Analysis in ATHENA */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one given by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new Run directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
*See pT distribution of muons<br />
<pre><br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
</pre><br />
<br />
==TriggerAware Analyis==<br />
<br />
==Analysis with the EventView==<br />
*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<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job estatus monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
==GANGA==<br />
*For further details vistit [https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga ganga wiki]<br />
*A very simple example of how to use panda move to your ${HOME} directory and do:<br />
<pre><br />
export PATH=$PATH:/afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/<br />
<br />
or <br />
<br />
setenv PATH /afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/:${PATH}<br />
</pre><br />
<br />
*Generate a ${HOME}/.gangarc with<br />
<pre><br />
ganga -g<br />
</pre><br />
<br />
*Edit $HOME/.gangarc as follows: <br />
<br />
1. In the section labelled [Configuration] add the line:<br />
<pre><br />
RUNTIME_PATH = GangaAtlas<br />
</pre><br />
2. In the section labelled [LCG] add the line:<br />
<pre><br />
VirtualOrganisation = atlas<br />
</pre><br />
<br />
*Now move to the run directory again and try this:<br />
<pre><br />
ganga<br />
</pre><br />
<br />
*Inside the Python interpreter:<br />
<pre><br />
j = Job()<br />
j.application=Athena()<br />
j.application.prepare()<br />
j.application.option_file='$HOME/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZmumuOnAOD_jobOptions.py'<br />
j.inputdata=DQ2Dataset()<br />
j.inputdata.type='DQ2_LOCAL'<br />
j.inputdata.dataset='csc11.005145.PythiaZmumu.recon.AOD.v11004103'<br />
j.outputdata=DQ2OutputDataset()<br />
j.outputdata.outputdata=['ZmumuOnAOD.aan.root']<br />
j.backend=LCG()<br />
j.submit()<br />
</pre><br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*Have a look at the files contained in one of the sets<br />
<pre><br />
dq2_ls -f <datasetname><br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1134NIKHEF PAT workshop Oct20062006-10-13T14:21:45Z<p>Gusord: /* Event Selection using TAG */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one given by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new Run directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
*See pT distribution of muons<br />
<pre><br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
</pre><br />
<br />
<br />
<br />
==Analysis with the EventView==<br />
*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<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job estatus monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
==GANGA==<br />
*For further details vistit [https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga ganga wiki]<br />
*A very simple example of how to use panda move to your ${HOME} directory and do:<br />
<pre><br />
export PATH=$PATH:/afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/<br />
<br />
or <br />
<br />
setenv PATH /afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/:${PATH}<br />
</pre><br />
<br />
*Generate a ${HOME}/.gangarc with<br />
<pre><br />
ganga -g<br />
</pre><br />
<br />
*Edit $HOME/.gangarc as follows: <br />
<br />
1. In the section labelled [Configuration] add the line:<br />
<pre><br />
RUNTIME_PATH = GangaAtlas<br />
</pre><br />
2. In the section labelled [LCG] add the line:<br />
<pre><br />
VirtualOrganisation = atlas<br />
</pre><br />
<br />
*Now move to the run directory again and try this:<br />
<pre><br />
ganga<br />
</pre><br />
<br />
*Inside the Python interpreter:<br />
<pre><br />
j = Job()<br />
j.application=Athena()<br />
j.application.prepare()<br />
j.application.option_file='$HOME/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZmumuOnAOD_jobOptions.py'<br />
j.inputdata=DQ2Dataset()<br />
j.inputdata.type='DQ2_LOCAL'<br />
j.inputdata.dataset='csc11.005145.PythiaZmumu.recon.AOD.v11004103'<br />
j.outputdata=DQ2OutputDataset()<br />
j.outputdata.outputdata=['ZmumuOnAOD.aan.root']<br />
j.backend=LCG()<br />
j.submit()<br />
</pre><br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*Have a look at the files contained in one of the sets<br />
<pre><br />
dq2_ls -f <datasetname><br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006_pre-Tutorial&diff=1208NIKHEF PAT workshop Oct2006 pre-Tutorial2006-10-13T14:16:24Z<p>Gusord: /* MCTruth */</p>
<hr />
<div>==Note==<br />
<br />
We'll work using lxplus machines at cern. So make sure you have an ATLAS AFS computer account and scratch0 space.<br />
<br />
==What will you learn==<br />
<br />
*Set up the Athena enviroment<br />
<br />
*Run the UserAnalys package creating AANT (AthenaAware NTuples)<br />
<br />
*Add new algorithms to the package<br />
<br />
*How to access AOD/ESD different containers (Muon, Electron, TrackParticles, GenEvent...) via StoreGate. And the use of the AlgTool AnalysisTools to manipulate their objects.<br />
<br />
==Set up CMT==<br />
<br />
* Login to lxplus at CERN and create a working directory called "Workshop". We will use the release 12.0.2 this tutorial: <br />
<pre><br />
ssh lxplus.cern.ch<br />
cd scratch0<br />
mkdir Workshop<br />
cd Workshop<br />
mkdir 12.0.2<br />
</pre><br />
<br />
* 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:<br />
<pre><br />
set CMTSITE CERN<br />
set SITEROOT /afs/cern.ch<br />
macro ATLAS_DIST_AREA ${SITEROOT}/atlas/software/dist<br />
<br />
macro ATLAS_GROUP_AREA "/afs/cern.ch/atlas/groups/PAT/Workshop"<br />
<br />
macro ATLAS_TEST_AREA "" \<br />
12.0.2 "${HOME}/scratch0/Workshop/12.0.2"<br />
<br />
<br />
apply_tag oneTest<br />
<br />
use AtlasLogin AtlasLogin-* $(ATLAS_DIST_AREA)<br />
</pre><br />
<br />
*Then do the following:<br />
<pre><br />
source /afs/cern.ch/sw/contrib/CMT/v1r18p20060606/mgr/setup.sh<br />
cmt config<br />
</pre><br />
<br />
==Setup for the release 12.0.2==<br />
*Do the following:<br />
<pre><br />
source setup.sh -tag=12.0.2,opt<br />
</pre><br />
<br />
*Check that the CMT path is correct by doing this<br />
<pre><br />
echo $CMTPATH<br />
</pre><br />
<br />
*Stuff like this should be printed to your screen:<br />
<pre><br />
/afs/cern.ch/user/o/ordonez/scratch0/Workshop/12.0.2:<br />
/afs/cern.ch/atlas/software/builds/AtlasOffline/12.0.2<br />
</pre><br />
<br />
*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.<br />
<br />
==Run Time Setup==<br />
*Go to your working area and check out the follow package:<br />
<pre><br />
cd 12.0.2<br />
cmt co -r UserAnalysis-00-08-05 PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
</pre><br />
<br />
*Now compile everything as follows:<br />
<pre><br />
cd PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
cmt config; source setup.sh; cmt br gmake<br />
cd ../run<br />
</pre><br />
<br />
*To test that everything has been done correctly, do:<br />
<pre><br />
get_files HelloWorldOptions.py<br />
athena.py HelloWorldOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*Stuff like this should be printed to the screen:<br />
<pre><br />
HelloWorld INFO execute()<br />
HelloWorld INFO An INFO message<br />
HelloWorld WARNING A WARNING message<br />
HelloWorld ERROR An ERROR message<br />
HelloWorld FATAL A FATAL error message<br />
AthenaEventLoopMgr INFO ===>>> end of event 9 <<<===<br />
HistorySvc INFO Service finalised successfully<br />
ChronoStatSvc.f... INFO Service finalized succesfully<br />
ToolSvc INFO Removing all tools created by ToolSvc<br />
ApplicationMgr INFO Application Manager Finalized successfully<br />
ApplicationMgr INFO Application Manager Terminated successfully<br />
</pre><br />
<br />
==The Next Time You Login==<br />
*The next time you login, just do the following:<br />
<pre><br />
cd ${HOME}/scratch0/Workshop<br />
source setup.sh -tag=12.0.2<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
source setup.sh<br />
cd ../run<br />
</pre><br />
<br />
==Get The Necessary Files==<br />
*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:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/data/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data/*.py .<br />
</pre><br />
<br />
==Run the AnalysisSkeleton for 500 Events==<br />
*get the necessary job options file from the release:<br />
<pre><br />
get_files AnalysisSkeleton_jobOptions.py<br />
</pre><br />
<br />
*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<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root"]<br />
</pre><br />
*with this line<br />
<pre><br />
include( "mc11.004201.ZeeJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
*Check that in AnalysisSkeleton_jobOptions.py, the number of events to run is set to 500:<br />
<pre><br />
# Number of Events to process<br />
theApp.EvtMax = 500<br />
</pre><br />
*Now run the AnalysisSkeleton_jobOptions.py. It should produce a file called AnalysisSkeleton.aan.root which contains some ROOT histograms and an AthenaAwareNTuple:<br />
<pre><br />
athena.py AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
*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].<br />
<br />
*Now, you may look at the the ../UserAnalysis/AnalysisSkeleton.h, the ../src/AnalysisSkeleton.cxx and ../run/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.<br />
<br />
*You should open the output file AnalysisSkeleton.aan.root in ROOT and browse the histograms and the AthenaAwareNTuple:<br />
<pre><br />
root -l AnalysisSkeleton.aan.root<br />
new TBrowser<br />
</pre><br />
*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.<br />
<br />
==More Information==<br />
*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].<br />
<br />
==Z to mumu on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<br />
*'''NOTE: Don't copy directly the lines, but follow the example!'''<br />
<pre><br />
#include "UserAnalysis/ZmumuOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cp ~ordonez/public/Workshop_files/cmt/requirements .<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the ZmumuOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnAOD_jobOptions.py | tee AthenaOut_ZmumuOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnAOD.aan.root. While Athena is running, have a look at the code: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *f = TFile::Open("ZmumuOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnAOD->SetMarkerStyle(20)<br />
zmumuOnAOD->SetMarkerSize(0.5)<br />
zmumuOnAOD->SetMarkerColor(2)<br />
zmumuOnAOD->SetLineColor(4)<br />
zmumuOnAOD->SetLineWidth(2)<br />
zmumuOnAOD->Draw("ZmmMass")<br />
</pre><br />
*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].<br />
<br />
*'''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.'''<br />
<br />
==Z to ee on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/ZeeOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<pre><br />
#include "UserAnalysis/ZeeOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnAOD_jobOptions.py| tee AthenaOut_ZeeOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZeeOnAOD.aan.root. While Athena is running, have a look at the code: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnAOD->SetMarkerStyle(20)<br />
zeeOnAOD->SetMarkerSize(0.5)<br />
zeeOnAOD->SetMarkerColor(2)<br />
zeeOnAOD->SetLineColor(4)<br />
zeeOnAOD->SetLineWidth(2)<br />
zeeOnAOD->Draw("ZeeMass")<br />
zeeOnAOD->Draw("ElectronIsEM")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the AOD are listed here: StoregateKeysForAOD.<br />
<br />
*'''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.<br />
'''<br />
<br />
==The TrackParticle==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/TrackExample.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/TrackExample.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/TrackExample_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm TrackExample.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton and AnalysisMuon):<br />
<pre><br />
#include "UserAnalysis/TrackExample.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( TrackExample )<br />
<br />
DECLARE_ALGORITHM( TrackExample )<br />
</pre><br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the TrackExample algorithm as follows:<br />
<pre><br />
athena.py TrackExample_jobOptions.py | tee AthenaOut_TrackExample.log<br />
</pre><br />
*You should have an AthenaAwareNTuple file, TrackExample.aan.root. While Athena is running, have a look at the code: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/ 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.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("TrackExample.aan.root")<br />
new TBrowser<br />
TTree * trackExample=(TTree*) gDirectory->Get("CollectionTree");<br />
trackExample->SetMarkerStyle(20)<br />
trackExample->SetMarkerSize(0.5)<br />
trackExample->SetMarkerColor(2)<br />
trackExample->SetLineColor(4)<br />
trackExample->SetLineWidth(2)<br />
trackExample->Draw("TrackPEta")<br />
trackExample->Draw("TrackPD0")<br />
trackExample->Draw("TrackPZ0:TrackPD0")<br />
</pre><br />
*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 - [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForAOD StoregateKeysForAOD].<br />
<br />
==Z to mumu on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZmumuOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnESD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnESD )<br />
</pre><br />
Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZmumuOnESD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnESD_jobOptions.py | tee athenaOut_ZmumuOnESD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnESD.aan.root. While Athena is running, have a look at the code here: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZmumuOnESD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnESD->SetMarkerStyle(20)<br />
zmumuOnESD->SetMarkerSize(0.5)<br />
zmumuOnESD->SetMarkerColor(2)<br />
zmumuOnESD->SetLineColor(4)<br />
zmumuOnESD->SetLineWidth(2)<br />
zmumuOnESD->Draw("ESDZmmMass")<br />
zmumuOnESD->Draw("ESDZmmDeltaR")<br />
</pre><br />
<br />
*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.<br />
<br />
*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.<br />
<br />
==Z to ee on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZeeOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZeeOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnESD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnESD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnESD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnESD_jobOptions.py | tee athenaOut_ZeeOnESD.log<br />
</pre><br />
*This should produce an AthenaAwareNTuple file, ZeeOnESD.aan.root. While Athena is running, Hava a look at the code at: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnESD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnESD->SetMarkerStyle(20)<br />
zeeOnESD->SetMarkerSize(0.5)<br />
zeeOnESD->SetMarkerColor(2)<br />
zeeOnESD->SetLineColor(4)<br />
zeeOnESD->SetLineWidth(2)<br />
zeeOnESD->Draw("EgammaPt")<br />
zeeOnESD->Draw("EgammaEta")<br />
zeeOnESD->Draw("EgammaEoverP")<br />
zeeOnESD->Draw("EgammaIsEM")<br />
zeeOnESD->Draw("EgammaZeeMass")<br />
zeeOnESD->Draw("EgammaTrackP")<br />
zeeOnESD->Draw("EgammaClusterE")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the ESD are listed here: [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForESD 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.<br />
<br />
*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.<br />
<br />
*For further details of the Electron/Photon reconstruction, see [https://twiki.cern.ch/twiki/bin/view/Atlas/EgammaATLASRecoPerformance egammaRec].<br />
<br />
==MCTruth==<br />
In this exercise, we will look MC Truth Tools on AOD.<br />
<br />
first copy the files:<br />
<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/MCTruth.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/MCTruth.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/MCTruth_jobOptions.py .<br />
</pre><br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/MCTruth.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( MCTruth )<br />
<br />
DECLARE_ALGORITHM( MCTruth )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the MCTruth algorithm as follows:<br />
<pre><br />
athena.py MCTruth_jobOptions.py | tee athenaOut_MCTruth.log<br />
</pre><br />
*This should produce an AthenaAwareNTuple file, MCTruth.aan.root. <br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("MCTruth.aan.root")<br />
new TBrowser<br />
</pre><br />
<br />
*You can see three different trees: CollectionTree (The AthenaAware one), Electron (with the ElectronCollection histograms), and MCTopWb (with the MC histograms).</div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1133NIKHEF PAT workshop Oct20062006-10-13T14:13:19Z<p>Gusord: /* Analysis with the EventView */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one given by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new Run directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
</pre><br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
*See pT distribution of muons<br />
<pre><br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
</pre><br />
<br />
<br />
<br />
==Analysis with the EventView==<br />
*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<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job estatus monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
==GANGA==<br />
*For further details vistit [https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga ganga wiki]<br />
*A very simple example of how to use panda move to your ${HOME} directory and do:<br />
<pre><br />
export PATH=$PATH:/afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/<br />
<br />
or <br />
<br />
setenv PATH /afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/:${PATH}<br />
</pre><br />
<br />
*Generate a ${HOME}/.gangarc with<br />
<pre><br />
ganga -g<br />
</pre><br />
<br />
*Edit $HOME/.gangarc as follows: <br />
<br />
1. In the section labelled [Configuration] add the line:<br />
<pre><br />
RUNTIME_PATH = GangaAtlas<br />
</pre><br />
2. In the section labelled [LCG] add the line:<br />
<pre><br />
VirtualOrganisation = atlas<br />
</pre><br />
<br />
*Now move to the run directory again and try this:<br />
<pre><br />
ganga<br />
</pre><br />
<br />
*Inside the Python interpreter:<br />
<pre><br />
j = Job()<br />
j.application=Athena()<br />
j.application.prepare()<br />
j.application.option_file='$HOME/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZmumuOnAOD_jobOptions.py'<br />
j.inputdata=DQ2Dataset()<br />
j.inputdata.type='DQ2_LOCAL'<br />
j.inputdata.dataset='csc11.005145.PythiaZmumu.recon.AOD.v11004103'<br />
j.outputdata=DQ2OutputDataset()<br />
j.outputdata.outputdata=['ZmumuOnAOD.aan.root']<br />
j.backend=LCG()<br />
j.submit()<br />
</pre><br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*Have a look at the files contained in one of the sets<br />
<pre><br />
dq2_ls -f <datasetname><br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1131NIKHEF PAT workshop Oct20062006-10-12T15:18:20Z<p>Gusord: /* Pre-Tutorial */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one given by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new Run directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
</pre><br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
*See pT distribution of muons<br />
<pre><br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
</pre><br />
<br />
<br />
<br />
==Analysis with the EventView==<br />
*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.<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job estatus monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
==GANGA==<br />
*For further details vistit [https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga ganga wiki]<br />
*A very simple example of how to use panda move to your ${HOME} directory and do:<br />
<pre><br />
export PATH=$PATH:/afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/<br />
<br />
or <br />
<br />
setenv PATH /afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/:${PATH}<br />
</pre><br />
<br />
*Generate a ${HOME}/.gangarc with<br />
<pre><br />
ganga -g<br />
</pre><br />
<br />
*Edit $HOME/.gangarc as follows: <br />
<br />
1. In the section labelled [Configuration] add the line:<br />
<pre><br />
RUNTIME_PATH = GangaAtlas<br />
</pre><br />
2. In the section labelled [LCG] add the line:<br />
<pre><br />
VirtualOrganisation = atlas<br />
</pre><br />
<br />
*Now move to the run directory again and try this:<br />
<pre><br />
ganga<br />
</pre><br />
<br />
*Inside the Python interpreter:<br />
<pre><br />
j = Job()<br />
j.application=Athena()<br />
j.application.prepare()<br />
j.application.option_file='$HOME/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZmumuOnAOD_jobOptions.py'<br />
j.inputdata=DQ2Dataset()<br />
j.inputdata.type='DQ2_LOCAL'<br />
j.inputdata.dataset='csc11.005145.PythiaZmumu.recon.AOD.v11004103'<br />
j.outputdata=DQ2OutputDataset()<br />
j.outputdata.outputdata=['ZmumuOnAOD.aan.root']<br />
j.backend=LCG()<br />
j.submit()<br />
</pre><br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*Have a look at the files contained in one of the sets<br />
<pre><br />
dq2_ls -f <datasetname><br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1130NIKHEF PAT workshop Oct20062006-10-12T14:11:51Z<p>Gusord: /* Monte Carlo Truth Tools on AOD */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one gave by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new Run directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
</pre><br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
*See pT distribution of muons<br />
<pre><br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
</pre><br />
<br />
<br />
<br />
==Analysis with the EventView==<br />
*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.<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job estatus monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
==GANGA==<br />
*For further details vistit [https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga ganga wiki]<br />
*A very simple example of how to use panda move to your ${HOME} directory and do:<br />
<pre><br />
export PATH=$PATH:/afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/<br />
<br />
or <br />
<br />
setenv PATH /afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/:${PATH}<br />
</pre><br />
<br />
*Generate a ${HOME}/.gangarc with<br />
<pre><br />
ganga -g<br />
</pre><br />
<br />
*Edit $HOME/.gangarc as follows: <br />
<br />
1. In the section labelled [Configuration] add the line:<br />
<pre><br />
RUNTIME_PATH = GangaAtlas<br />
</pre><br />
2. In the section labelled [LCG] add the line:<br />
<pre><br />
VirtualOrganisation = atlas<br />
</pre><br />
<br />
*Now move to the run directory again and try this:<br />
<pre><br />
ganga<br />
</pre><br />
<br />
*Inside the Python interpreter:<br />
<pre><br />
j = Job()<br />
j.application=Athena()<br />
j.application.prepare()<br />
j.application.option_file='$HOME/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZmumuOnAOD_jobOptions.py'<br />
j.inputdata=DQ2Dataset()<br />
j.inputdata.type='DQ2_LOCAL'<br />
j.inputdata.dataset='csc11.005145.PythiaZmumu.recon.AOD.v11004103'<br />
j.outputdata=DQ2OutputDataset()<br />
j.outputdata.outputdata=['ZmumuOnAOD.aan.root']<br />
j.backend=LCG()<br />
j.submit()<br />
</pre><br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*Have a look at the files contained in one of the sets<br />
<pre><br />
dq2_ls -f <datasetname><br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006_pre-Tutorial&diff=1132NIKHEF PAT workshop Oct2006 pre-Tutorial2006-10-12T13:51:53Z<p>Gusord: /* Z to ee on the ESD */</p>
<hr />
<div>==Note==<br />
<br />
We'll work using lxplus machines at cern. So make sure you have an ATLAS AFS computer account and scratch0 space.<br />
<br />
==What will you learn==<br />
<br />
*Set up the Athena enviroment<br />
<br />
*Run the UserAnalys package creating AANT (AthenaAware NTuples)<br />
<br />
*Add new algorithms to the package<br />
<br />
*How to access AOD/ESD different containers (Muon, Electron, TrackParticles, GenEvent...) via StoreGate. And the use of the AlgTool AnalysisTools to manipulate their objects.<br />
<br />
==Set up CMT==<br />
<br />
* Login to lxplus at CERN and create a working directory called "Workshop". We will use the release 12.0.2 this tutorial: <br />
<pre><br />
ssh lxplus.cern.ch<br />
cd scratch0<br />
mkdir Workshop<br />
cd Workshop<br />
mkdir 12.0.2<br />
</pre><br />
<br />
* 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:<br />
<pre><br />
set CMTSITE CERN<br />
set SITEROOT /afs/cern.ch<br />
macro ATLAS_DIST_AREA ${SITEROOT}/atlas/software/dist<br />
<br />
macro ATLAS_GROUP_AREA "/afs/cern.ch/atlas/groups/PAT/Workshop"<br />
<br />
macro ATLAS_TEST_AREA "" \<br />
12.0.2 "${HOME}/scratch0/Workshop/12.0.2"<br />
<br />
<br />
apply_tag oneTest<br />
<br />
use AtlasLogin AtlasLogin-* $(ATLAS_DIST_AREA)<br />
</pre><br />
<br />
*Then do the following:<br />
<pre><br />
source /afs/cern.ch/sw/contrib/CMT/v1r18p20060606/mgr/setup.sh<br />
cmt config<br />
</pre><br />
<br />
==Setup for the release 12.0.2==<br />
*Do the following:<br />
<pre><br />
source setup.sh -tag=12.0.2,opt<br />
</pre><br />
<br />
*Check that the CMT path is correct by doing this<br />
<pre><br />
echo $CMTPATH<br />
</pre><br />
<br />
*Stuff like this should be printed to your screen:<br />
<pre><br />
/afs/cern.ch/user/o/ordonez/scratch0/Workshop/12.0.2:<br />
/afs/cern.ch/atlas/software/builds/AtlasOffline/12.0.2<br />
</pre><br />
<br />
*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.<br />
<br />
==Run Time Setup==<br />
*Go to your working area and check out the follow package:<br />
<pre><br />
cd 12.0.2<br />
cmt co -r UserAnalysis-00-08-05 PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
</pre><br />
<br />
*Now compile everything as follows:<br />
<pre><br />
cd PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
cmt config; source setup.sh; cmt br gmake<br />
cd ../run<br />
</pre><br />
<br />
*To test that everything has been done correctly, do:<br />
<pre><br />
get_files HelloWorldOptions.py<br />
athena.py HelloWorldOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*Stuff like this should be printed to the screen:<br />
<pre><br />
HelloWorld INFO execute()<br />
HelloWorld INFO An INFO message<br />
HelloWorld WARNING A WARNING message<br />
HelloWorld ERROR An ERROR message<br />
HelloWorld FATAL A FATAL error message<br />
AthenaEventLoopMgr INFO ===>>> end of event 9 <<<===<br />
HistorySvc INFO Service finalised successfully<br />
ChronoStatSvc.f... INFO Service finalized succesfully<br />
ToolSvc INFO Removing all tools created by ToolSvc<br />
ApplicationMgr INFO Application Manager Finalized successfully<br />
ApplicationMgr INFO Application Manager Terminated successfully<br />
</pre><br />
<br />
==The Next Time You Login==<br />
*The next time you login, just do the following:<br />
<pre><br />
cd ${HOME}/scratch0/Workshop<br />
source setup.sh -tag=12.0.2<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
source setup.sh<br />
cd ../run<br />
</pre><br />
<br />
==Get The Necessary Files==<br />
*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:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/data/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data/*.py .<br />
</pre><br />
<br />
==Run the AnalysisSkeleton for 500 Events==<br />
*get the necessary job options file from the release:<br />
<pre><br />
get_files AnalysisSkeleton_jobOptions.py<br />
</pre><br />
<br />
*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<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root"]<br />
</pre><br />
*with this line<br />
<pre><br />
include( "mc11.004201.ZeeJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
*Check that in AnalysisSkeleton_jobOptions.py, the number of events to run is set to 500:<br />
<pre><br />
# Number of Events to process<br />
theApp.EvtMax = 500<br />
</pre><br />
*Now run the AnalysisSkeleton_jobOptions.py. It should produce a file called AnalysisSkeleton.aan.root which contains some ROOT histograms and an AthenaAwareNTuple:<br />
<pre><br />
athena.py AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
*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].<br />
<br />
*Now, you may look at the the ../UserAnalysis/AnalysisSkeleton.h, the ../src/AnalysisSkeleton.cxx and ../run/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.<br />
<br />
*You should open the output file AnalysisSkeleton.aan.root in ROOT and browse the histograms and the AthenaAwareNTuple:<br />
<pre><br />
root -l AnalysisSkeleton.aan.root<br />
new TBrowser<br />
</pre><br />
*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.<br />
<br />
==More Information==<br />
*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].<br />
<br />
==Z to mumu on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<br />
*'''NOTE: Don't copy directly the lines, but follow the example!'''<br />
<pre><br />
#include "UserAnalysis/ZmumuOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cp ~ordonez/public/Workshop_files/cmt/requirements .<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the ZmumuOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnAOD_jobOptions.py | tee AthenaOut_ZmumuOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnAOD.aan.root. While Athena is running, have a look at the code: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *f = TFile::Open("ZmumuOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnAOD->SetMarkerStyle(20)<br />
zmumuOnAOD->SetMarkerSize(0.5)<br />
zmumuOnAOD->SetMarkerColor(2)<br />
zmumuOnAOD->SetLineColor(4)<br />
zmumuOnAOD->SetLineWidth(2)<br />
zmumuOnAOD->Draw("ZmmMass")<br />
</pre><br />
*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].<br />
<br />
*'''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.'''<br />
<br />
==Z to ee on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/ZeeOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<pre><br />
#include "UserAnalysis/ZeeOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnAOD_jobOptions.py| tee AthenaOut_ZeeOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZeeOnAOD.aan.root. While Athena is running, have a look at the code: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnAOD->SetMarkerStyle(20)<br />
zeeOnAOD->SetMarkerSize(0.5)<br />
zeeOnAOD->SetMarkerColor(2)<br />
zeeOnAOD->SetLineColor(4)<br />
zeeOnAOD->SetLineWidth(2)<br />
zeeOnAOD->Draw("ZeeMass")<br />
zeeOnAOD->Draw("ElectronIsEM")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the AOD are listed here: StoregateKeysForAOD.<br />
<br />
*'''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.<br />
'''<br />
<br />
==The TrackParticle==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/TrackExample.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/TrackExample.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/TrackExample_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm TrackExample.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton and AnalysisMuon):<br />
<pre><br />
#include "UserAnalysis/TrackExample.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( TrackExample )<br />
<br />
DECLARE_ALGORITHM( TrackExample )<br />
</pre><br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the TrackExample algorithm as follows:<br />
<pre><br />
athena.py TrackExample_jobOptions.py | tee AthenaOut_TrackExample.log<br />
</pre><br />
*You should have an AthenaAwareNTuple file, TrackExample.aan.root. While Athena is running, have a look at the code: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/ 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.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("TrackExample.aan.root")<br />
new TBrowser<br />
TTree * trackExample=(TTree*) gDirectory->Get("CollectionTree");<br />
trackExample->SetMarkerStyle(20)<br />
trackExample->SetMarkerSize(0.5)<br />
trackExample->SetMarkerColor(2)<br />
trackExample->SetLineColor(4)<br />
trackExample->SetLineWidth(2)<br />
trackExample->Draw("TrackPEta")<br />
trackExample->Draw("TrackPD0")<br />
trackExample->Draw("TrackPZ0:TrackPD0")<br />
</pre><br />
*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 - [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForAOD StoregateKeysForAOD].<br />
<br />
==Z to mumu on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZmumuOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnESD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnESD )<br />
</pre><br />
Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZmumuOnESD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnESD_jobOptions.py | tee athenaOut_ZmumuOnESD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnESD.aan.root. While Athena is running, have a look at the code here: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZmumuOnESD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnESD->SetMarkerStyle(20)<br />
zmumuOnESD->SetMarkerSize(0.5)<br />
zmumuOnESD->SetMarkerColor(2)<br />
zmumuOnESD->SetLineColor(4)<br />
zmumuOnESD->SetLineWidth(2)<br />
zmumuOnESD->Draw("ESDZmmMass")<br />
zmumuOnESD->Draw("ESDZmmDeltaR")<br />
</pre><br />
<br />
*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.<br />
<br />
*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.<br />
<br />
==Z to ee on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZeeOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZeeOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnESD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnESD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnESD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnESD_jobOptions.py | tee athenaOut_ZeeOnESD.log<br />
</pre><br />
*This should produce an AthenaAwareNTuple file, ZeeOnESD.aan.root. While Athena is running, Hava a look at the code at: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnESD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnESD->SetMarkerStyle(20)<br />
zeeOnESD->SetMarkerSize(0.5)<br />
zeeOnESD->SetMarkerColor(2)<br />
zeeOnESD->SetLineColor(4)<br />
zeeOnESD->SetLineWidth(2)<br />
zeeOnESD->Draw("EgammaPt")<br />
zeeOnESD->Draw("EgammaEta")<br />
zeeOnESD->Draw("EgammaEoverP")<br />
zeeOnESD->Draw("EgammaIsEM")<br />
zeeOnESD->Draw("EgammaZeeMass")<br />
zeeOnESD->Draw("EgammaTrackP")<br />
zeeOnESD->Draw("EgammaClusterE")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the ESD are listed here: [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForESD 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.<br />
<br />
*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.<br />
<br />
*For further details of the Electron/Photon reconstruction, see [https://twiki.cern.ch/twiki/bin/view/Atlas/EgammaATLASRecoPerformance egammaRec].<br />
<br />
==MCTruth==<br />
In this exercise, we will look MC Truth Tools on AOD.<br />
<br />
first copy the files:<br />
<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/MCTruth.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/MCTruth.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/MCTruth_jobOptions.py .<br />
</pre><br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/MCTruth.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( MCTruth )<br />
<br />
DECLARE_ALGORITHM( MCTruth )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the MCTruth algorithm as follows:<br />
<pre><br />
athena.py MCTruth_jobOptions.py | tee athenaOut_MCTruth.log<br />
</pre><br />
*This should produce an AthenaAwareNTuple file, MCTruth.aan.root. <br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("MCTruth.aan.root")<br />
new TBrowser<br />
TTree * MCTruth=(TTree*) gDirectory->Get("CollectionTree");<br />
MCTruth->SetMarkerStyle(20)<br />
MCTruth->SetMarkerSize(0.5)<br />
MCTruth->SetMarkerColor(2)<br />
MCTruth->SetLineColor(4)<br />
MCTruth->SetLineWidth(2)<br />
MCTruth->Draw("EgammaPt")<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006_pre-Tutorial&diff=1128NIKHEF PAT workshop Oct2006 pre-Tutorial2006-10-12T13:49:44Z<p>Gusord: /* Z to ee on AOD */</p>
<hr />
<div>==Note==<br />
<br />
We'll work using lxplus machines at cern. So make sure you have an ATLAS AFS computer account and scratch0 space.<br />
<br />
==What will you learn==<br />
<br />
*Set up the Athena enviroment<br />
<br />
*Run the UserAnalys package creating AANT (AthenaAware NTuples)<br />
<br />
*Add new algorithms to the package<br />
<br />
*How to access AOD/ESD different containers (Muon, Electron, TrackParticles, GenEvent...) via StoreGate. And the use of the AlgTool AnalysisTools to manipulate their objects.<br />
<br />
==Set up CMT==<br />
<br />
* Login to lxplus at CERN and create a working directory called "Workshop". We will use the release 12.0.2 this tutorial: <br />
<pre><br />
ssh lxplus.cern.ch<br />
cd scratch0<br />
mkdir Workshop<br />
cd Workshop<br />
mkdir 12.0.2<br />
</pre><br />
<br />
* 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:<br />
<pre><br />
set CMTSITE CERN<br />
set SITEROOT /afs/cern.ch<br />
macro ATLAS_DIST_AREA ${SITEROOT}/atlas/software/dist<br />
<br />
macro ATLAS_GROUP_AREA "/afs/cern.ch/atlas/groups/PAT/Workshop"<br />
<br />
macro ATLAS_TEST_AREA "" \<br />
12.0.2 "${HOME}/scratch0/Workshop/12.0.2"<br />
<br />
<br />
apply_tag oneTest<br />
<br />
use AtlasLogin AtlasLogin-* $(ATLAS_DIST_AREA)<br />
</pre><br />
<br />
*Then do the following:<br />
<pre><br />
source /afs/cern.ch/sw/contrib/CMT/v1r18p20060606/mgr/setup.sh<br />
cmt config<br />
</pre><br />
<br />
==Setup for the release 12.0.2==<br />
*Do the following:<br />
<pre><br />
source setup.sh -tag=12.0.2,opt<br />
</pre><br />
<br />
*Check that the CMT path is correct by doing this<br />
<pre><br />
echo $CMTPATH<br />
</pre><br />
<br />
*Stuff like this should be printed to your screen:<br />
<pre><br />
/afs/cern.ch/user/o/ordonez/scratch0/Workshop/12.0.2:<br />
/afs/cern.ch/atlas/software/builds/AtlasOffline/12.0.2<br />
</pre><br />
<br />
*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.<br />
<br />
==Run Time Setup==<br />
*Go to your working area and check out the follow package:<br />
<pre><br />
cd 12.0.2<br />
cmt co -r UserAnalysis-00-08-05 PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
</pre><br />
<br />
*Now compile everything as follows:<br />
<pre><br />
cd PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
cmt config; source setup.sh; cmt br gmake<br />
cd ../run<br />
</pre><br />
<br />
*To test that everything has been done correctly, do:<br />
<pre><br />
get_files HelloWorldOptions.py<br />
athena.py HelloWorldOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*Stuff like this should be printed to the screen:<br />
<pre><br />
HelloWorld INFO execute()<br />
HelloWorld INFO An INFO message<br />
HelloWorld WARNING A WARNING message<br />
HelloWorld ERROR An ERROR message<br />
HelloWorld FATAL A FATAL error message<br />
AthenaEventLoopMgr INFO ===>>> end of event 9 <<<===<br />
HistorySvc INFO Service finalised successfully<br />
ChronoStatSvc.f... INFO Service finalized succesfully<br />
ToolSvc INFO Removing all tools created by ToolSvc<br />
ApplicationMgr INFO Application Manager Finalized successfully<br />
ApplicationMgr INFO Application Manager Terminated successfully<br />
</pre><br />
<br />
==The Next Time You Login==<br />
*The next time you login, just do the following:<br />
<pre><br />
cd ${HOME}/scratch0/Workshop<br />
source setup.sh -tag=12.0.2<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
source setup.sh<br />
cd ../run<br />
</pre><br />
<br />
==Get The Necessary Files==<br />
*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:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/data/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data/*.py .<br />
</pre><br />
<br />
==Run the AnalysisSkeleton for 500 Events==<br />
*get the necessary job options file from the release:<br />
<pre><br />
get_files AnalysisSkeleton_jobOptions.py<br />
</pre><br />
<br />
*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<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root"]<br />
</pre><br />
*with this line<br />
<pre><br />
include( "mc11.004201.ZeeJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
*Check that in AnalysisSkeleton_jobOptions.py, the number of events to run is set to 500:<br />
<pre><br />
# Number of Events to process<br />
theApp.EvtMax = 500<br />
</pre><br />
*Now run the AnalysisSkeleton_jobOptions.py. It should produce a file called AnalysisSkeleton.aan.root which contains some ROOT histograms and an AthenaAwareNTuple:<br />
<pre><br />
athena.py AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
*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].<br />
<br />
*Now, you may look at the the ../UserAnalysis/AnalysisSkeleton.h, the ../src/AnalysisSkeleton.cxx and ../run/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.<br />
<br />
*You should open the output file AnalysisSkeleton.aan.root in ROOT and browse the histograms and the AthenaAwareNTuple:<br />
<pre><br />
root -l AnalysisSkeleton.aan.root<br />
new TBrowser<br />
</pre><br />
*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.<br />
<br />
==More Information==<br />
*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].<br />
<br />
==Z to mumu on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<br />
*'''NOTE: Don't copy directly the lines, but follow the example!'''<br />
<pre><br />
#include "UserAnalysis/ZmumuOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cp ~ordonez/public/Workshop_files/cmt/requirements .<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the ZmumuOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnAOD_jobOptions.py | tee AthenaOut_ZmumuOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnAOD.aan.root. While Athena is running, have a look at the code: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *f = TFile::Open("ZmumuOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnAOD->SetMarkerStyle(20)<br />
zmumuOnAOD->SetMarkerSize(0.5)<br />
zmumuOnAOD->SetMarkerColor(2)<br />
zmumuOnAOD->SetLineColor(4)<br />
zmumuOnAOD->SetLineWidth(2)<br />
zmumuOnAOD->Draw("ZmmMass")<br />
</pre><br />
*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].<br />
<br />
*'''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.'''<br />
<br />
==Z to ee on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/ZeeOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<pre><br />
#include "UserAnalysis/ZeeOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnAOD_jobOptions.py| tee AthenaOut_ZeeOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZeeOnAOD.aan.root. While Athena is running, have a look at the code: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnAOD->SetMarkerStyle(20)<br />
zeeOnAOD->SetMarkerSize(0.5)<br />
zeeOnAOD->SetMarkerColor(2)<br />
zeeOnAOD->SetLineColor(4)<br />
zeeOnAOD->SetLineWidth(2)<br />
zeeOnAOD->Draw("ZeeMass")<br />
zeeOnAOD->Draw("ElectronIsEM")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the AOD are listed here: StoregateKeysForAOD.<br />
<br />
*'''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.<br />
'''<br />
<br />
==The TrackParticle==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/TrackExample.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/TrackExample.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/TrackExample_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm TrackExample.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton and AnalysisMuon):<br />
<pre><br />
#include "UserAnalysis/TrackExample.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( TrackExample )<br />
<br />
DECLARE_ALGORITHM( TrackExample )<br />
</pre><br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the TrackExample algorithm as follows:<br />
<pre><br />
athena.py TrackExample_jobOptions.py | tee AthenaOut_TrackExample.log<br />
</pre><br />
*You should have an AthenaAwareNTuple file, TrackExample.aan.root. While Athena is running, have a look at the code: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/ 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.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("TrackExample.aan.root")<br />
new TBrowser<br />
TTree * trackExample=(TTree*) gDirectory->Get("CollectionTree");<br />
trackExample->SetMarkerStyle(20)<br />
trackExample->SetMarkerSize(0.5)<br />
trackExample->SetMarkerColor(2)<br />
trackExample->SetLineColor(4)<br />
trackExample->SetLineWidth(2)<br />
trackExample->Draw("TrackPEta")<br />
trackExample->Draw("TrackPD0")<br />
trackExample->Draw("TrackPZ0:TrackPD0")<br />
</pre><br />
*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 - [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForAOD StoregateKeysForAOD].<br />
<br />
==Z to mumu on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZmumuOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnESD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnESD )<br />
</pre><br />
Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZmumuOnESD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnESD_jobOptions.py | tee athenaOut_ZmumuOnESD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnESD.aan.root. While Athena is running, have a look at the code here: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZmumuOnESD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnESD->SetMarkerStyle(20)<br />
zmumuOnESD->SetMarkerSize(0.5)<br />
zmumuOnESD->SetMarkerColor(2)<br />
zmumuOnESD->SetLineColor(4)<br />
zmumuOnESD->SetLineWidth(2)<br />
zmumuOnESD->Draw("ESDZmmMass")<br />
zmumuOnESD->Draw("ESDZmmDeltaR")<br />
</pre><br />
<br />
*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.<br />
<br />
*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.<br />
<br />
==Z to ee on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZeeOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZeeOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnESD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnESD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnESD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnESD_jobOptions.py | tee athenaOut_ZeeOnESD.log<br />
</pre><br />
*This should produce an AthenaAwareNTuple file, ZeeOnESD.aan.root. While Athena is running, Hava a look at the code at: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnESD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnESD->SetMarkerStyle(20)<br />
zeeOnESD->SetMarkerSize(0.5)<br />
zeeOnESD->SetMarkerColor(2)<br />
zeeOnESD->SetLineColor(4)<br />
zeeOnESD->SetLineWidth(2)<br />
zeeOnESD->Draw("EgammaPt")<br />
zeeOnESD->Draw("EgammaEta")<br />
zeeOnESD->Draw("EgammaEoverP")<br />
zeeOnESD->Draw("EgammaIsEM")<br />
zeeOnESD->Draw("EgammaZeeMass")<br />
zeeOnESD->Draw("EgammaTrackP")<br />
zeeOnESD->Draw("EgammaClusterE")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the ESD are listed here: [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForESD 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.<br />
<br />
*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.<br />
<br />
*For further details of the Electron/Photon reconstruction, see egammaRec.<br />
<br />
==MCTruth==<br />
In this exercise, we will look MC Truth Tools on AOD.<br />
<br />
first copy the files:<br />
<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/MCTruth.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/MCTruth.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/MCTruth_jobOptions.py .<br />
</pre><br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/MCTruth.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( MCTruth )<br />
<br />
DECLARE_ALGORITHM( MCTruth )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the MCTruth algorithm as follows:<br />
<pre><br />
athena.py MCTruth_jobOptions.py | tee athenaOut_MCTruth.log<br />
</pre><br />
*This should produce an AthenaAwareNTuple file, MCTruth.aan.root. <br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("MCTruth.aan.root")<br />
new TBrowser<br />
TTree * MCTruth=(TTree*) gDirectory->Get("CollectionTree");<br />
MCTruth->SetMarkerStyle(20)<br />
MCTruth->SetMarkerSize(0.5)<br />
MCTruth->SetMarkerColor(2)<br />
MCTruth->SetLineColor(4)<br />
MCTruth->SetLineWidth(2)<br />
MCTruth->Draw("EgammaPt")<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006_pre-Tutorial&diff=1127NIKHEF PAT workshop Oct2006 pre-Tutorial2006-10-12T13:49:12Z<p>Gusord: /* Z to mumu on AOD */</p>
<hr />
<div>==Note==<br />
<br />
We'll work using lxplus machines at cern. So make sure you have an ATLAS AFS computer account and scratch0 space.<br />
<br />
==What will you learn==<br />
<br />
*Set up the Athena enviroment<br />
<br />
*Run the UserAnalys package creating AANT (AthenaAware NTuples)<br />
<br />
*Add new algorithms to the package<br />
<br />
*How to access AOD/ESD different containers (Muon, Electron, TrackParticles, GenEvent...) via StoreGate. And the use of the AlgTool AnalysisTools to manipulate their objects.<br />
<br />
==Set up CMT==<br />
<br />
* Login to lxplus at CERN and create a working directory called "Workshop". We will use the release 12.0.2 this tutorial: <br />
<pre><br />
ssh lxplus.cern.ch<br />
cd scratch0<br />
mkdir Workshop<br />
cd Workshop<br />
mkdir 12.0.2<br />
</pre><br />
<br />
* 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:<br />
<pre><br />
set CMTSITE CERN<br />
set SITEROOT /afs/cern.ch<br />
macro ATLAS_DIST_AREA ${SITEROOT}/atlas/software/dist<br />
<br />
macro ATLAS_GROUP_AREA "/afs/cern.ch/atlas/groups/PAT/Workshop"<br />
<br />
macro ATLAS_TEST_AREA "" \<br />
12.0.2 "${HOME}/scratch0/Workshop/12.0.2"<br />
<br />
<br />
apply_tag oneTest<br />
<br />
use AtlasLogin AtlasLogin-* $(ATLAS_DIST_AREA)<br />
</pre><br />
<br />
*Then do the following:<br />
<pre><br />
source /afs/cern.ch/sw/contrib/CMT/v1r18p20060606/mgr/setup.sh<br />
cmt config<br />
</pre><br />
<br />
==Setup for the release 12.0.2==<br />
*Do the following:<br />
<pre><br />
source setup.sh -tag=12.0.2,opt<br />
</pre><br />
<br />
*Check that the CMT path is correct by doing this<br />
<pre><br />
echo $CMTPATH<br />
</pre><br />
<br />
*Stuff like this should be printed to your screen:<br />
<pre><br />
/afs/cern.ch/user/o/ordonez/scratch0/Workshop/12.0.2:<br />
/afs/cern.ch/atlas/software/builds/AtlasOffline/12.0.2<br />
</pre><br />
<br />
*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.<br />
<br />
==Run Time Setup==<br />
*Go to your working area and check out the follow package:<br />
<pre><br />
cd 12.0.2<br />
cmt co -r UserAnalysis-00-08-05 PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
</pre><br />
<br />
*Now compile everything as follows:<br />
<pre><br />
cd PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
cmt config; source setup.sh; cmt br gmake<br />
cd ../run<br />
</pre><br />
<br />
*To test that everything has been done correctly, do:<br />
<pre><br />
get_files HelloWorldOptions.py<br />
athena.py HelloWorldOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*Stuff like this should be printed to the screen:<br />
<pre><br />
HelloWorld INFO execute()<br />
HelloWorld INFO An INFO message<br />
HelloWorld WARNING A WARNING message<br />
HelloWorld ERROR An ERROR message<br />
HelloWorld FATAL A FATAL error message<br />
AthenaEventLoopMgr INFO ===>>> end of event 9 <<<===<br />
HistorySvc INFO Service finalised successfully<br />
ChronoStatSvc.f... INFO Service finalized succesfully<br />
ToolSvc INFO Removing all tools created by ToolSvc<br />
ApplicationMgr INFO Application Manager Finalized successfully<br />
ApplicationMgr INFO Application Manager Terminated successfully<br />
</pre><br />
<br />
==The Next Time You Login==<br />
*The next time you login, just do the following:<br />
<pre><br />
cd ${HOME}/scratch0/Workshop<br />
source setup.sh -tag=12.0.2<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
source setup.sh<br />
cd ../run<br />
</pre><br />
<br />
==Get The Necessary Files==<br />
*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:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/data/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data/*.py .<br />
</pre><br />
<br />
==Run the AnalysisSkeleton for 500 Events==<br />
*get the necessary job options file from the release:<br />
<pre><br />
get_files AnalysisSkeleton_jobOptions.py<br />
</pre><br />
<br />
*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<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root"]<br />
</pre><br />
*with this line<br />
<pre><br />
include( "mc11.004201.ZeeJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
*Check that in AnalysisSkeleton_jobOptions.py, the number of events to run is set to 500:<br />
<pre><br />
# Number of Events to process<br />
theApp.EvtMax = 500<br />
</pre><br />
*Now run the AnalysisSkeleton_jobOptions.py. It should produce a file called AnalysisSkeleton.aan.root which contains some ROOT histograms and an AthenaAwareNTuple:<br />
<pre><br />
athena.py AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
*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].<br />
<br />
*Now, you may look at the the ../UserAnalysis/AnalysisSkeleton.h, the ../src/AnalysisSkeleton.cxx and ../run/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.<br />
<br />
*You should open the output file AnalysisSkeleton.aan.root in ROOT and browse the histograms and the AthenaAwareNTuple:<br />
<pre><br />
root -l AnalysisSkeleton.aan.root<br />
new TBrowser<br />
</pre><br />
*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.<br />
<br />
==More Information==<br />
*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].<br />
<br />
==Z to mumu on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<br />
*'''NOTE: Don't copy directly the lines, but follow the example!'''<br />
<pre><br />
#include "UserAnalysis/ZmumuOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cp ~ordonez/public/Workshop_files/cmt/requirements .<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the ZmumuOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnAOD_jobOptions.py | tee AthenaOut_ZmumuOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnAOD.aan.root. While Athena is running, have a look at the code: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *f = TFile::Open("ZmumuOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnAOD->SetMarkerStyle(20)<br />
zmumuOnAOD->SetMarkerSize(0.5)<br />
zmumuOnAOD->SetMarkerColor(2)<br />
zmumuOnAOD->SetLineColor(4)<br />
zmumuOnAOD->SetLineWidth(2)<br />
zmumuOnAOD->Draw("ZmmMass")<br />
</pre><br />
*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].<br />
<br />
*'''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.'''<br />
<br />
==Z to ee on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/ZeeOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<pre><br />
#include "UserAnalysis/ZeeOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnAOD_jobOptions.py| tee AthenaOut_ZeeOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZeeOnAOD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnAOD->SetMarkerStyle(20)<br />
zeeOnAOD->SetMarkerSize(0.5)<br />
zeeOnAOD->SetMarkerColor(2)<br />
zeeOnAOD->SetLineColor(4)<br />
zeeOnAOD->SetLineWidth(2)<br />
zeeOnAOD->Draw("ZeeMass")<br />
zeeOnAOD->Draw("ElectronIsEM")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the AOD are listed here: StoregateKeysForAOD.<br />
<br />
*'''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.<br />
'''<br />
<br />
==The TrackParticle==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/TrackExample.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/TrackExample.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/TrackExample_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm TrackExample.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton and AnalysisMuon):<br />
<pre><br />
#include "UserAnalysis/TrackExample.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( TrackExample )<br />
<br />
DECLARE_ALGORITHM( TrackExample )<br />
</pre><br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the TrackExample algorithm as follows:<br />
<pre><br />
athena.py TrackExample_jobOptions.py | tee AthenaOut_TrackExample.log<br />
</pre><br />
*You should have an AthenaAwareNTuple file, TrackExample.aan.root. While Athena is running, have a look at the code: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/ 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.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("TrackExample.aan.root")<br />
new TBrowser<br />
TTree * trackExample=(TTree*) gDirectory->Get("CollectionTree");<br />
trackExample->SetMarkerStyle(20)<br />
trackExample->SetMarkerSize(0.5)<br />
trackExample->SetMarkerColor(2)<br />
trackExample->SetLineColor(4)<br />
trackExample->SetLineWidth(2)<br />
trackExample->Draw("TrackPEta")<br />
trackExample->Draw("TrackPD0")<br />
trackExample->Draw("TrackPZ0:TrackPD0")<br />
</pre><br />
*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 - [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForAOD StoregateKeysForAOD].<br />
<br />
==Z to mumu on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZmumuOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnESD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnESD )<br />
</pre><br />
Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZmumuOnESD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnESD_jobOptions.py | tee athenaOut_ZmumuOnESD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnESD.aan.root. While Athena is running, have a look at the code here: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZmumuOnESD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnESD->SetMarkerStyle(20)<br />
zmumuOnESD->SetMarkerSize(0.5)<br />
zmumuOnESD->SetMarkerColor(2)<br />
zmumuOnESD->SetLineColor(4)<br />
zmumuOnESD->SetLineWidth(2)<br />
zmumuOnESD->Draw("ESDZmmMass")<br />
zmumuOnESD->Draw("ESDZmmDeltaR")<br />
</pre><br />
<br />
*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.<br />
<br />
*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.<br />
<br />
==Z to ee on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZeeOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZeeOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnESD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnESD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnESD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnESD_jobOptions.py | tee athenaOut_ZeeOnESD.log<br />
</pre><br />
*This should produce an AthenaAwareNTuple file, ZeeOnESD.aan.root. While Athena is running, Hava a look at the code at: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnESD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnESD->SetMarkerStyle(20)<br />
zeeOnESD->SetMarkerSize(0.5)<br />
zeeOnESD->SetMarkerColor(2)<br />
zeeOnESD->SetLineColor(4)<br />
zeeOnESD->SetLineWidth(2)<br />
zeeOnESD->Draw("EgammaPt")<br />
zeeOnESD->Draw("EgammaEta")<br />
zeeOnESD->Draw("EgammaEoverP")<br />
zeeOnESD->Draw("EgammaIsEM")<br />
zeeOnESD->Draw("EgammaZeeMass")<br />
zeeOnESD->Draw("EgammaTrackP")<br />
zeeOnESD->Draw("EgammaClusterE")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the ESD are listed here: [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForESD 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.<br />
<br />
*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.<br />
<br />
*For further details of the Electron/Photon reconstruction, see egammaRec.<br />
<br />
==MCTruth==<br />
In this exercise, we will look MC Truth Tools on AOD.<br />
<br />
first copy the files:<br />
<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/MCTruth.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/MCTruth.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/MCTruth_jobOptions.py .<br />
</pre><br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/MCTruth.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( MCTruth )<br />
<br />
DECLARE_ALGORITHM( MCTruth )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the MCTruth algorithm as follows:<br />
<pre><br />
athena.py MCTruth_jobOptions.py | tee athenaOut_MCTruth.log<br />
</pre><br />
*This should produce an AthenaAwareNTuple file, MCTruth.aan.root. <br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("MCTruth.aan.root")<br />
new TBrowser<br />
TTree * MCTruth=(TTree*) gDirectory->Get("CollectionTree");<br />
MCTruth->SetMarkerStyle(20)<br />
MCTruth->SetMarkerSize(0.5)<br />
MCTruth->SetMarkerColor(2)<br />
MCTruth->SetLineColor(4)<br />
MCTruth->SetLineWidth(2)<br />
MCTruth->Draw("EgammaPt")<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006_pre-Tutorial&diff=1126NIKHEF PAT workshop Oct2006 pre-Tutorial2006-10-12T13:48:51Z<p>Gusord: /* The TrackParticle */</p>
<hr />
<div>==Note==<br />
<br />
We'll work using lxplus machines at cern. So make sure you have an ATLAS AFS computer account and scratch0 space.<br />
<br />
==What will you learn==<br />
<br />
*Set up the Athena enviroment<br />
<br />
*Run the UserAnalys package creating AANT (AthenaAware NTuples)<br />
<br />
*Add new algorithms to the package<br />
<br />
*How to access AOD/ESD different containers (Muon, Electron, TrackParticles, GenEvent...) via StoreGate. And the use of the AlgTool AnalysisTools to manipulate their objects.<br />
<br />
==Set up CMT==<br />
<br />
* Login to lxplus at CERN and create a working directory called "Workshop". We will use the release 12.0.2 this tutorial: <br />
<pre><br />
ssh lxplus.cern.ch<br />
cd scratch0<br />
mkdir Workshop<br />
cd Workshop<br />
mkdir 12.0.2<br />
</pre><br />
<br />
* 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:<br />
<pre><br />
set CMTSITE CERN<br />
set SITEROOT /afs/cern.ch<br />
macro ATLAS_DIST_AREA ${SITEROOT}/atlas/software/dist<br />
<br />
macro ATLAS_GROUP_AREA "/afs/cern.ch/atlas/groups/PAT/Workshop"<br />
<br />
macro ATLAS_TEST_AREA "" \<br />
12.0.2 "${HOME}/scratch0/Workshop/12.0.2"<br />
<br />
<br />
apply_tag oneTest<br />
<br />
use AtlasLogin AtlasLogin-* $(ATLAS_DIST_AREA)<br />
</pre><br />
<br />
*Then do the following:<br />
<pre><br />
source /afs/cern.ch/sw/contrib/CMT/v1r18p20060606/mgr/setup.sh<br />
cmt config<br />
</pre><br />
<br />
==Setup for the release 12.0.2==<br />
*Do the following:<br />
<pre><br />
source setup.sh -tag=12.0.2,opt<br />
</pre><br />
<br />
*Check that the CMT path is correct by doing this<br />
<pre><br />
echo $CMTPATH<br />
</pre><br />
<br />
*Stuff like this should be printed to your screen:<br />
<pre><br />
/afs/cern.ch/user/o/ordonez/scratch0/Workshop/12.0.2:<br />
/afs/cern.ch/atlas/software/builds/AtlasOffline/12.0.2<br />
</pre><br />
<br />
*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.<br />
<br />
==Run Time Setup==<br />
*Go to your working area and check out the follow package:<br />
<pre><br />
cd 12.0.2<br />
cmt co -r UserAnalysis-00-08-05 PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
</pre><br />
<br />
*Now compile everything as follows:<br />
<pre><br />
cd PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
cmt config; source setup.sh; cmt br gmake<br />
cd ../run<br />
</pre><br />
<br />
*To test that everything has been done correctly, do:<br />
<pre><br />
get_files HelloWorldOptions.py<br />
athena.py HelloWorldOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*Stuff like this should be printed to the screen:<br />
<pre><br />
HelloWorld INFO execute()<br />
HelloWorld INFO An INFO message<br />
HelloWorld WARNING A WARNING message<br />
HelloWorld ERROR An ERROR message<br />
HelloWorld FATAL A FATAL error message<br />
AthenaEventLoopMgr INFO ===>>> end of event 9 <<<===<br />
HistorySvc INFO Service finalised successfully<br />
ChronoStatSvc.f... INFO Service finalized succesfully<br />
ToolSvc INFO Removing all tools created by ToolSvc<br />
ApplicationMgr INFO Application Manager Finalized successfully<br />
ApplicationMgr INFO Application Manager Terminated successfully<br />
</pre><br />
<br />
==The Next Time You Login==<br />
*The next time you login, just do the following:<br />
<pre><br />
cd ${HOME}/scratch0/Workshop<br />
source setup.sh -tag=12.0.2<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
source setup.sh<br />
cd ../run<br />
</pre><br />
<br />
==Get The Necessary Files==<br />
*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:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/data/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data/*.py .<br />
</pre><br />
<br />
==Run the AnalysisSkeleton for 500 Events==<br />
*get the necessary job options file from the release:<br />
<pre><br />
get_files AnalysisSkeleton_jobOptions.py<br />
</pre><br />
<br />
*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<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root"]<br />
</pre><br />
*with this line<br />
<pre><br />
include( "mc11.004201.ZeeJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
*Check that in AnalysisSkeleton_jobOptions.py, the number of events to run is set to 500:<br />
<pre><br />
# Number of Events to process<br />
theApp.EvtMax = 500<br />
</pre><br />
*Now run the AnalysisSkeleton_jobOptions.py. It should produce a file called AnalysisSkeleton.aan.root which contains some ROOT histograms and an AthenaAwareNTuple:<br />
<pre><br />
athena.py AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
*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].<br />
<br />
*Now, you may look at the the ../UserAnalysis/AnalysisSkeleton.h, the ../src/AnalysisSkeleton.cxx and ../run/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.<br />
<br />
*You should open the output file AnalysisSkeleton.aan.root in ROOT and browse the histograms and the AthenaAwareNTuple:<br />
<pre><br />
root -l AnalysisSkeleton.aan.root<br />
new TBrowser<br />
</pre><br />
*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.<br />
<br />
==More Information==<br />
*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].<br />
<br />
==Z to mumu on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<br />
*'''NOTE: Don't copy directly the lines, but follow the example!'''<br />
<pre><br />
#include "UserAnalysis/ZmumuOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cp ~ordonez/public/Workshop_files/cmt/requirements .<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the ZmumuOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnAOD_jobOptions.py | tee AthenaOut_ZmumuOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnAOD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *f = TFile::Open("ZmumuOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnAOD->SetMarkerStyle(20)<br />
zmumuOnAOD->SetMarkerSize(0.5)<br />
zmumuOnAOD->SetMarkerColor(2)<br />
zmumuOnAOD->SetLineColor(4)<br />
zmumuOnAOD->SetLineWidth(2)<br />
zmumuOnAOD->Draw("ZmmMass")<br />
</pre><br />
*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].<br />
<br />
*'''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.'''<br />
<br />
==Z to ee on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/ZeeOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<pre><br />
#include "UserAnalysis/ZeeOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnAOD_jobOptions.py| tee AthenaOut_ZeeOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZeeOnAOD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnAOD->SetMarkerStyle(20)<br />
zeeOnAOD->SetMarkerSize(0.5)<br />
zeeOnAOD->SetMarkerColor(2)<br />
zeeOnAOD->SetLineColor(4)<br />
zeeOnAOD->SetLineWidth(2)<br />
zeeOnAOD->Draw("ZeeMass")<br />
zeeOnAOD->Draw("ElectronIsEM")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the AOD are listed here: StoregateKeysForAOD.<br />
<br />
*'''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.<br />
'''<br />
<br />
==The TrackParticle==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/TrackExample.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/TrackExample.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/TrackExample_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm TrackExample.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton and AnalysisMuon):<br />
<pre><br />
#include "UserAnalysis/TrackExample.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( TrackExample )<br />
<br />
DECLARE_ALGORITHM( TrackExample )<br />
</pre><br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the TrackExample algorithm as follows:<br />
<pre><br />
athena.py TrackExample_jobOptions.py | tee AthenaOut_TrackExample.log<br />
</pre><br />
*You should have an AthenaAwareNTuple file, TrackExample.aan.root. While Athena is running, have a look at the code: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/ 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.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("TrackExample.aan.root")<br />
new TBrowser<br />
TTree * trackExample=(TTree*) gDirectory->Get("CollectionTree");<br />
trackExample->SetMarkerStyle(20)<br />
trackExample->SetMarkerSize(0.5)<br />
trackExample->SetMarkerColor(2)<br />
trackExample->SetLineColor(4)<br />
trackExample->SetLineWidth(2)<br />
trackExample->Draw("TrackPEta")<br />
trackExample->Draw("TrackPD0")<br />
trackExample->Draw("TrackPZ0:TrackPD0")<br />
</pre><br />
*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 - [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForAOD StoregateKeysForAOD].<br />
<br />
==Z to mumu on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZmumuOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnESD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnESD )<br />
</pre><br />
Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZmumuOnESD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnESD_jobOptions.py | tee athenaOut_ZmumuOnESD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnESD.aan.root. While Athena is running, have a look at the code here: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZmumuOnESD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnESD->SetMarkerStyle(20)<br />
zmumuOnESD->SetMarkerSize(0.5)<br />
zmumuOnESD->SetMarkerColor(2)<br />
zmumuOnESD->SetLineColor(4)<br />
zmumuOnESD->SetLineWidth(2)<br />
zmumuOnESD->Draw("ESDZmmMass")<br />
zmumuOnESD->Draw("ESDZmmDeltaR")<br />
</pre><br />
<br />
*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.<br />
<br />
*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.<br />
<br />
==Z to ee on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZeeOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZeeOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnESD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnESD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnESD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnESD_jobOptions.py | tee athenaOut_ZeeOnESD.log<br />
</pre><br />
*This should produce an AthenaAwareNTuple file, ZeeOnESD.aan.root. While Athena is running, Hava a look at the code at: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnESD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnESD->SetMarkerStyle(20)<br />
zeeOnESD->SetMarkerSize(0.5)<br />
zeeOnESD->SetMarkerColor(2)<br />
zeeOnESD->SetLineColor(4)<br />
zeeOnESD->SetLineWidth(2)<br />
zeeOnESD->Draw("EgammaPt")<br />
zeeOnESD->Draw("EgammaEta")<br />
zeeOnESD->Draw("EgammaEoverP")<br />
zeeOnESD->Draw("EgammaIsEM")<br />
zeeOnESD->Draw("EgammaZeeMass")<br />
zeeOnESD->Draw("EgammaTrackP")<br />
zeeOnESD->Draw("EgammaClusterE")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the ESD are listed here: [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForESD 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.<br />
<br />
*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.<br />
<br />
*For further details of the Electron/Photon reconstruction, see egammaRec.<br />
<br />
==MCTruth==<br />
In this exercise, we will look MC Truth Tools on AOD.<br />
<br />
first copy the files:<br />
<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/MCTruth.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/MCTruth.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/MCTruth_jobOptions.py .<br />
</pre><br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/MCTruth.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( MCTruth )<br />
<br />
DECLARE_ALGORITHM( MCTruth )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the MCTruth algorithm as follows:<br />
<pre><br />
athena.py MCTruth_jobOptions.py | tee athenaOut_MCTruth.log<br />
</pre><br />
*This should produce an AthenaAwareNTuple file, MCTruth.aan.root. <br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("MCTruth.aan.root")<br />
new TBrowser<br />
TTree * MCTruth=(TTree*) gDirectory->Get("CollectionTree");<br />
MCTruth->SetMarkerStyle(20)<br />
MCTruth->SetMarkerSize(0.5)<br />
MCTruth->SetMarkerColor(2)<br />
MCTruth->SetLineColor(4)<br />
MCTruth->SetLineWidth(2)<br />
MCTruth->Draw("EgammaPt")<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006_pre-Tutorial&diff=1125NIKHEF PAT workshop Oct2006 pre-Tutorial2006-10-12T13:48:23Z<p>Gusord: /* Z to mumu on the ESD */</p>
<hr />
<div>==Note==<br />
<br />
We'll work using lxplus machines at cern. So make sure you have an ATLAS AFS computer account and scratch0 space.<br />
<br />
==What will you learn==<br />
<br />
*Set up the Athena enviroment<br />
<br />
*Run the UserAnalys package creating AANT (AthenaAware NTuples)<br />
<br />
*Add new algorithms to the package<br />
<br />
*How to access AOD/ESD different containers (Muon, Electron, TrackParticles, GenEvent...) via StoreGate. And the use of the AlgTool AnalysisTools to manipulate their objects.<br />
<br />
==Set up CMT==<br />
<br />
* Login to lxplus at CERN and create a working directory called "Workshop". We will use the release 12.0.2 this tutorial: <br />
<pre><br />
ssh lxplus.cern.ch<br />
cd scratch0<br />
mkdir Workshop<br />
cd Workshop<br />
mkdir 12.0.2<br />
</pre><br />
<br />
* 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:<br />
<pre><br />
set CMTSITE CERN<br />
set SITEROOT /afs/cern.ch<br />
macro ATLAS_DIST_AREA ${SITEROOT}/atlas/software/dist<br />
<br />
macro ATLAS_GROUP_AREA "/afs/cern.ch/atlas/groups/PAT/Workshop"<br />
<br />
macro ATLAS_TEST_AREA "" \<br />
12.0.2 "${HOME}/scratch0/Workshop/12.0.2"<br />
<br />
<br />
apply_tag oneTest<br />
<br />
use AtlasLogin AtlasLogin-* $(ATLAS_DIST_AREA)<br />
</pre><br />
<br />
*Then do the following:<br />
<pre><br />
source /afs/cern.ch/sw/contrib/CMT/v1r18p20060606/mgr/setup.sh<br />
cmt config<br />
</pre><br />
<br />
==Setup for the release 12.0.2==<br />
*Do the following:<br />
<pre><br />
source setup.sh -tag=12.0.2,opt<br />
</pre><br />
<br />
*Check that the CMT path is correct by doing this<br />
<pre><br />
echo $CMTPATH<br />
</pre><br />
<br />
*Stuff like this should be printed to your screen:<br />
<pre><br />
/afs/cern.ch/user/o/ordonez/scratch0/Workshop/12.0.2:<br />
/afs/cern.ch/atlas/software/builds/AtlasOffline/12.0.2<br />
</pre><br />
<br />
*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.<br />
<br />
==Run Time Setup==<br />
*Go to your working area and check out the follow package:<br />
<pre><br />
cd 12.0.2<br />
cmt co -r UserAnalysis-00-08-05 PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
</pre><br />
<br />
*Now compile everything as follows:<br />
<pre><br />
cd PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
cmt config; source setup.sh; cmt br gmake<br />
cd ../run<br />
</pre><br />
<br />
*To test that everything has been done correctly, do:<br />
<pre><br />
get_files HelloWorldOptions.py<br />
athena.py HelloWorldOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*Stuff like this should be printed to the screen:<br />
<pre><br />
HelloWorld INFO execute()<br />
HelloWorld INFO An INFO message<br />
HelloWorld WARNING A WARNING message<br />
HelloWorld ERROR An ERROR message<br />
HelloWorld FATAL A FATAL error message<br />
AthenaEventLoopMgr INFO ===>>> end of event 9 <<<===<br />
HistorySvc INFO Service finalised successfully<br />
ChronoStatSvc.f... INFO Service finalized succesfully<br />
ToolSvc INFO Removing all tools created by ToolSvc<br />
ApplicationMgr INFO Application Manager Finalized successfully<br />
ApplicationMgr INFO Application Manager Terminated successfully<br />
</pre><br />
<br />
==The Next Time You Login==<br />
*The next time you login, just do the following:<br />
<pre><br />
cd ${HOME}/scratch0/Workshop<br />
source setup.sh -tag=12.0.2<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
source setup.sh<br />
cd ../run<br />
</pre><br />
<br />
==Get The Necessary Files==<br />
*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:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/data/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data/*.py .<br />
</pre><br />
<br />
==Run the AnalysisSkeleton for 500 Events==<br />
*get the necessary job options file from the release:<br />
<pre><br />
get_files AnalysisSkeleton_jobOptions.py<br />
</pre><br />
<br />
*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<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root"]<br />
</pre><br />
*with this line<br />
<pre><br />
include( "mc11.004201.ZeeJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
*Check that in AnalysisSkeleton_jobOptions.py, the number of events to run is set to 500:<br />
<pre><br />
# Number of Events to process<br />
theApp.EvtMax = 500<br />
</pre><br />
*Now run the AnalysisSkeleton_jobOptions.py. It should produce a file called AnalysisSkeleton.aan.root which contains some ROOT histograms and an AthenaAwareNTuple:<br />
<pre><br />
athena.py AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
*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].<br />
<br />
*Now, you may look at the the ../UserAnalysis/AnalysisSkeleton.h, the ../src/AnalysisSkeleton.cxx and ../run/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.<br />
<br />
*You should open the output file AnalysisSkeleton.aan.root in ROOT and browse the histograms and the AthenaAwareNTuple:<br />
<pre><br />
root -l AnalysisSkeleton.aan.root<br />
new TBrowser<br />
</pre><br />
*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.<br />
<br />
==More Information==<br />
*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].<br />
<br />
==Z to mumu on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<br />
*'''NOTE: Don't copy directly the lines, but follow the example!'''<br />
<pre><br />
#include "UserAnalysis/ZmumuOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cp ~ordonez/public/Workshop_files/cmt/requirements .<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the ZmumuOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnAOD_jobOptions.py | tee AthenaOut_ZmumuOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnAOD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *f = TFile::Open("ZmumuOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnAOD->SetMarkerStyle(20)<br />
zmumuOnAOD->SetMarkerSize(0.5)<br />
zmumuOnAOD->SetMarkerColor(2)<br />
zmumuOnAOD->SetLineColor(4)<br />
zmumuOnAOD->SetLineWidth(2)<br />
zmumuOnAOD->Draw("ZmmMass")<br />
</pre><br />
*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].<br />
<br />
*'''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.'''<br />
<br />
==Z to ee on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/ZeeOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<pre><br />
#include "UserAnalysis/ZeeOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnAOD_jobOptions.py| tee AthenaOut_ZeeOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZeeOnAOD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnAOD->SetMarkerStyle(20)<br />
zeeOnAOD->SetMarkerSize(0.5)<br />
zeeOnAOD->SetMarkerColor(2)<br />
zeeOnAOD->SetLineColor(4)<br />
zeeOnAOD->SetLineWidth(2)<br />
zeeOnAOD->Draw("ZeeMass")<br />
zeeOnAOD->Draw("ElectronIsEM")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the AOD are listed here: StoregateKeysForAOD.<br />
<br />
*'''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.<br />
'''<br />
<br />
==The TrackParticle==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/TrackExample.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/TrackExample.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/TrackExample_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm TrackExample.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton and AnalysisMuon):<br />
<pre><br />
#include "UserAnalysis/TrackExample.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( TrackExample )<br />
<br />
DECLARE_ALGORITHM( TrackExample )<br />
</pre><br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the TrackExample algorithm as follows:<br />
<pre><br />
athena.py TrackExample_jobOptions.py | tee AthenaOut_TrackExample.log<br />
</pre><br />
*You should have an AthenaAwareNTuple file, TrackExample.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/ 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.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("TrackExample.aan.root")<br />
new TBrowser<br />
TTree * trackExample=(TTree*) gDirectory->Get("CollectionTree");<br />
trackExample->SetMarkerStyle(20)<br />
trackExample->SetMarkerSize(0.5)<br />
trackExample->SetMarkerColor(2)<br />
trackExample->SetLineColor(4)<br />
trackExample->SetLineWidth(2)<br />
trackExample->Draw("TrackPEta")<br />
trackExample->Draw("TrackPD0")<br />
trackExample->Draw("TrackPZ0:TrackPD0")<br />
</pre><br />
*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 - [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForAOD StoregateKeysForAOD].<br />
<br />
==Z to mumu on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZmumuOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnESD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnESD )<br />
</pre><br />
Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZmumuOnESD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnESD_jobOptions.py | tee athenaOut_ZmumuOnESD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnESD.aan.root. While Athena is running, have a look at the code here: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZmumuOnESD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnESD->SetMarkerStyle(20)<br />
zmumuOnESD->SetMarkerSize(0.5)<br />
zmumuOnESD->SetMarkerColor(2)<br />
zmumuOnESD->SetLineColor(4)<br />
zmumuOnESD->SetLineWidth(2)<br />
zmumuOnESD->Draw("ESDZmmMass")<br />
zmumuOnESD->Draw("ESDZmmDeltaR")<br />
</pre><br />
<br />
*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.<br />
<br />
*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.<br />
<br />
==Z to ee on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZeeOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZeeOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnESD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnESD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnESD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnESD_jobOptions.py | tee athenaOut_ZeeOnESD.log<br />
</pre><br />
*This should produce an AthenaAwareNTuple file, ZeeOnESD.aan.root. While Athena is running, Hava a look at the code at: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnESD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnESD->SetMarkerStyle(20)<br />
zeeOnESD->SetMarkerSize(0.5)<br />
zeeOnESD->SetMarkerColor(2)<br />
zeeOnESD->SetLineColor(4)<br />
zeeOnESD->SetLineWidth(2)<br />
zeeOnESD->Draw("EgammaPt")<br />
zeeOnESD->Draw("EgammaEta")<br />
zeeOnESD->Draw("EgammaEoverP")<br />
zeeOnESD->Draw("EgammaIsEM")<br />
zeeOnESD->Draw("EgammaZeeMass")<br />
zeeOnESD->Draw("EgammaTrackP")<br />
zeeOnESD->Draw("EgammaClusterE")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the ESD are listed here: [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForESD 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.<br />
<br />
*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.<br />
<br />
*For further details of the Electron/Photon reconstruction, see egammaRec.<br />
<br />
==MCTruth==<br />
In this exercise, we will look MC Truth Tools on AOD.<br />
<br />
first copy the files:<br />
<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/MCTruth.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/MCTruth.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/MCTruth_jobOptions.py .<br />
</pre><br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/MCTruth.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( MCTruth )<br />
<br />
DECLARE_ALGORITHM( MCTruth )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the MCTruth algorithm as follows:<br />
<pre><br />
athena.py MCTruth_jobOptions.py | tee athenaOut_MCTruth.log<br />
</pre><br />
*This should produce an AthenaAwareNTuple file, MCTruth.aan.root. <br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("MCTruth.aan.root")<br />
new TBrowser<br />
TTree * MCTruth=(TTree*) gDirectory->Get("CollectionTree");<br />
MCTruth->SetMarkerStyle(20)<br />
MCTruth->SetMarkerSize(0.5)<br />
MCTruth->SetMarkerColor(2)<br />
MCTruth->SetLineColor(4)<br />
MCTruth->SetLineWidth(2)<br />
MCTruth->Draw("EgammaPt")<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006_pre-Tutorial&diff=1124NIKHEF PAT workshop Oct2006 pre-Tutorial2006-10-12T13:47:57Z<p>Gusord: /* Z to ee on the ESD */</p>
<hr />
<div>==Note==<br />
<br />
We'll work using lxplus machines at cern. So make sure you have an ATLAS AFS computer account and scratch0 space.<br />
<br />
==What will you learn==<br />
<br />
*Set up the Athena enviroment<br />
<br />
*Run the UserAnalys package creating AANT (AthenaAware NTuples)<br />
<br />
*Add new algorithms to the package<br />
<br />
*How to access AOD/ESD different containers (Muon, Electron, TrackParticles, GenEvent...) via StoreGate. And the use of the AlgTool AnalysisTools to manipulate their objects.<br />
<br />
==Set up CMT==<br />
<br />
* Login to lxplus at CERN and create a working directory called "Workshop". We will use the release 12.0.2 this tutorial: <br />
<pre><br />
ssh lxplus.cern.ch<br />
cd scratch0<br />
mkdir Workshop<br />
cd Workshop<br />
mkdir 12.0.2<br />
</pre><br />
<br />
* 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:<br />
<pre><br />
set CMTSITE CERN<br />
set SITEROOT /afs/cern.ch<br />
macro ATLAS_DIST_AREA ${SITEROOT}/atlas/software/dist<br />
<br />
macro ATLAS_GROUP_AREA "/afs/cern.ch/atlas/groups/PAT/Workshop"<br />
<br />
macro ATLAS_TEST_AREA "" \<br />
12.0.2 "${HOME}/scratch0/Workshop/12.0.2"<br />
<br />
<br />
apply_tag oneTest<br />
<br />
use AtlasLogin AtlasLogin-* $(ATLAS_DIST_AREA)<br />
</pre><br />
<br />
*Then do the following:<br />
<pre><br />
source /afs/cern.ch/sw/contrib/CMT/v1r18p20060606/mgr/setup.sh<br />
cmt config<br />
</pre><br />
<br />
==Setup for the release 12.0.2==<br />
*Do the following:<br />
<pre><br />
source setup.sh -tag=12.0.2,opt<br />
</pre><br />
<br />
*Check that the CMT path is correct by doing this<br />
<pre><br />
echo $CMTPATH<br />
</pre><br />
<br />
*Stuff like this should be printed to your screen:<br />
<pre><br />
/afs/cern.ch/user/o/ordonez/scratch0/Workshop/12.0.2:<br />
/afs/cern.ch/atlas/software/builds/AtlasOffline/12.0.2<br />
</pre><br />
<br />
*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.<br />
<br />
==Run Time Setup==<br />
*Go to your working area and check out the follow package:<br />
<pre><br />
cd 12.0.2<br />
cmt co -r UserAnalysis-00-08-05 PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
</pre><br />
<br />
*Now compile everything as follows:<br />
<pre><br />
cd PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
cmt config; source setup.sh; cmt br gmake<br />
cd ../run<br />
</pre><br />
<br />
*To test that everything has been done correctly, do:<br />
<pre><br />
get_files HelloWorldOptions.py<br />
athena.py HelloWorldOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*Stuff like this should be printed to the screen:<br />
<pre><br />
HelloWorld INFO execute()<br />
HelloWorld INFO An INFO message<br />
HelloWorld WARNING A WARNING message<br />
HelloWorld ERROR An ERROR message<br />
HelloWorld FATAL A FATAL error message<br />
AthenaEventLoopMgr INFO ===>>> end of event 9 <<<===<br />
HistorySvc INFO Service finalised successfully<br />
ChronoStatSvc.f... INFO Service finalized succesfully<br />
ToolSvc INFO Removing all tools created by ToolSvc<br />
ApplicationMgr INFO Application Manager Finalized successfully<br />
ApplicationMgr INFO Application Manager Terminated successfully<br />
</pre><br />
<br />
==The Next Time You Login==<br />
*The next time you login, just do the following:<br />
<pre><br />
cd ${HOME}/scratch0/Workshop<br />
source setup.sh -tag=12.0.2<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
source setup.sh<br />
cd ../run<br />
</pre><br />
<br />
==Get The Necessary Files==<br />
*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:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/data/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data/*.py .<br />
</pre><br />
<br />
==Run the AnalysisSkeleton for 500 Events==<br />
*get the necessary job options file from the release:<br />
<pre><br />
get_files AnalysisSkeleton_jobOptions.py<br />
</pre><br />
<br />
*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<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root"]<br />
</pre><br />
*with this line<br />
<pre><br />
include( "mc11.004201.ZeeJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
*Check that in AnalysisSkeleton_jobOptions.py, the number of events to run is set to 500:<br />
<pre><br />
# Number of Events to process<br />
theApp.EvtMax = 500<br />
</pre><br />
*Now run the AnalysisSkeleton_jobOptions.py. It should produce a file called AnalysisSkeleton.aan.root which contains some ROOT histograms and an AthenaAwareNTuple:<br />
<pre><br />
athena.py AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
*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].<br />
<br />
*Now, you may look at the the ../UserAnalysis/AnalysisSkeleton.h, the ../src/AnalysisSkeleton.cxx and ../run/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.<br />
<br />
*You should open the output file AnalysisSkeleton.aan.root in ROOT and browse the histograms and the AthenaAwareNTuple:<br />
<pre><br />
root -l AnalysisSkeleton.aan.root<br />
new TBrowser<br />
</pre><br />
*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.<br />
<br />
==More Information==<br />
*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].<br />
<br />
==Z to mumu on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<br />
*'''NOTE: Don't copy directly the lines, but follow the example!'''<br />
<pre><br />
#include "UserAnalysis/ZmumuOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cp ~ordonez/public/Workshop_files/cmt/requirements .<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the ZmumuOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnAOD_jobOptions.py | tee AthenaOut_ZmumuOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnAOD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *f = TFile::Open("ZmumuOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnAOD->SetMarkerStyle(20)<br />
zmumuOnAOD->SetMarkerSize(0.5)<br />
zmumuOnAOD->SetMarkerColor(2)<br />
zmumuOnAOD->SetLineColor(4)<br />
zmumuOnAOD->SetLineWidth(2)<br />
zmumuOnAOD->Draw("ZmmMass")<br />
</pre><br />
*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].<br />
<br />
*'''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.'''<br />
<br />
==Z to ee on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/ZeeOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<pre><br />
#include "UserAnalysis/ZeeOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnAOD_jobOptions.py| tee AthenaOut_ZeeOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZeeOnAOD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnAOD->SetMarkerStyle(20)<br />
zeeOnAOD->SetMarkerSize(0.5)<br />
zeeOnAOD->SetMarkerColor(2)<br />
zeeOnAOD->SetLineColor(4)<br />
zeeOnAOD->SetLineWidth(2)<br />
zeeOnAOD->Draw("ZeeMass")<br />
zeeOnAOD->Draw("ElectronIsEM")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the AOD are listed here: StoregateKeysForAOD.<br />
<br />
*'''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.<br />
'''<br />
<br />
==The TrackParticle==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/TrackExample.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/TrackExample.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/TrackExample_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm TrackExample.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton and AnalysisMuon):<br />
<pre><br />
#include "UserAnalysis/TrackExample.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( TrackExample )<br />
<br />
DECLARE_ALGORITHM( TrackExample )<br />
</pre><br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the TrackExample algorithm as follows:<br />
<pre><br />
athena.py TrackExample_jobOptions.py | tee AthenaOut_TrackExample.log<br />
</pre><br />
*You should have an AthenaAwareNTuple file, TrackExample.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/ 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.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("TrackExample.aan.root")<br />
new TBrowser<br />
TTree * trackExample=(TTree*) gDirectory->Get("CollectionTree");<br />
trackExample->SetMarkerStyle(20)<br />
trackExample->SetMarkerSize(0.5)<br />
trackExample->SetMarkerColor(2)<br />
trackExample->SetLineColor(4)<br />
trackExample->SetLineWidth(2)<br />
trackExample->Draw("TrackPEta")<br />
trackExample->Draw("TrackPD0")<br />
trackExample->Draw("TrackPZ0:TrackPD0")<br />
</pre><br />
*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 - [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForAOD StoregateKeysForAOD].<br />
<br />
==Z to mumu on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZmumuOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnESD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnESD )<br />
</pre><br />
Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZmumuOnESD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnESD_jobOptions.py | tee athenaOut_ZmumuOnESD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnESD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZmumuOnESD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnESD->SetMarkerStyle(20)<br />
zmumuOnESD->SetMarkerSize(0.5)<br />
zmumuOnESD->SetMarkerColor(2)<br />
zmumuOnESD->SetLineColor(4)<br />
zmumuOnESD->SetLineWidth(2)<br />
zmumuOnESD->Draw("ESDZmmMass")<br />
zmumuOnESD->Draw("ESDZmmDeltaR")<br />
</pre><br />
<br />
*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.<br />
<br />
*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.<br />
<br />
==Z to ee on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZeeOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZeeOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnESD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnESD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnESD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnESD_jobOptions.py | tee athenaOut_ZeeOnESD.log<br />
</pre><br />
*This should produce an AthenaAwareNTuple file, ZeeOnESD.aan.root. While Athena is running, Hava a look at the code at: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnESD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnESD->SetMarkerStyle(20)<br />
zeeOnESD->SetMarkerSize(0.5)<br />
zeeOnESD->SetMarkerColor(2)<br />
zeeOnESD->SetLineColor(4)<br />
zeeOnESD->SetLineWidth(2)<br />
zeeOnESD->Draw("EgammaPt")<br />
zeeOnESD->Draw("EgammaEta")<br />
zeeOnESD->Draw("EgammaEoverP")<br />
zeeOnESD->Draw("EgammaIsEM")<br />
zeeOnESD->Draw("EgammaZeeMass")<br />
zeeOnESD->Draw("EgammaTrackP")<br />
zeeOnESD->Draw("EgammaClusterE")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the ESD are listed here: [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForESD 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.<br />
<br />
*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.<br />
<br />
*For further details of the Electron/Photon reconstruction, see egammaRec.<br />
<br />
==MCTruth==<br />
In this exercise, we will look MC Truth Tools on AOD.<br />
<br />
first copy the files:<br />
<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/MCTruth.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/MCTruth.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/MCTruth_jobOptions.py .<br />
</pre><br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/MCTruth.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( MCTruth )<br />
<br />
DECLARE_ALGORITHM( MCTruth )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the MCTruth algorithm as follows:<br />
<pre><br />
athena.py MCTruth_jobOptions.py | tee athenaOut_MCTruth.log<br />
</pre><br />
*This should produce an AthenaAwareNTuple file, MCTruth.aan.root. <br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("MCTruth.aan.root")<br />
new TBrowser<br />
TTree * MCTruth=(TTree*) gDirectory->Get("CollectionTree");<br />
MCTruth->SetMarkerStyle(20)<br />
MCTruth->SetMarkerSize(0.5)<br />
MCTruth->SetMarkerColor(2)<br />
MCTruth->SetLineColor(4)<br />
MCTruth->SetLineWidth(2)<br />
MCTruth->Draw("EgammaPt")<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006_pre-Tutorial&diff=1123NIKHEF PAT workshop Oct2006 pre-Tutorial2006-10-12T13:47:16Z<p>Gusord: /* MCTruth */</p>
<hr />
<div>==Note==<br />
<br />
We'll work using lxplus machines at cern. So make sure you have an ATLAS AFS computer account and scratch0 space.<br />
<br />
==What will you learn==<br />
<br />
*Set up the Athena enviroment<br />
<br />
*Run the UserAnalys package creating AANT (AthenaAware NTuples)<br />
<br />
*Add new algorithms to the package<br />
<br />
*How to access AOD/ESD different containers (Muon, Electron, TrackParticles, GenEvent...) via StoreGate. And the use of the AlgTool AnalysisTools to manipulate their objects.<br />
<br />
==Set up CMT==<br />
<br />
* Login to lxplus at CERN and create a working directory called "Workshop". We will use the release 12.0.2 this tutorial: <br />
<pre><br />
ssh lxplus.cern.ch<br />
cd scratch0<br />
mkdir Workshop<br />
cd Workshop<br />
mkdir 12.0.2<br />
</pre><br />
<br />
* 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:<br />
<pre><br />
set CMTSITE CERN<br />
set SITEROOT /afs/cern.ch<br />
macro ATLAS_DIST_AREA ${SITEROOT}/atlas/software/dist<br />
<br />
macro ATLAS_GROUP_AREA "/afs/cern.ch/atlas/groups/PAT/Workshop"<br />
<br />
macro ATLAS_TEST_AREA "" \<br />
12.0.2 "${HOME}/scratch0/Workshop/12.0.2"<br />
<br />
<br />
apply_tag oneTest<br />
<br />
use AtlasLogin AtlasLogin-* $(ATLAS_DIST_AREA)<br />
</pre><br />
<br />
*Then do the following:<br />
<pre><br />
source /afs/cern.ch/sw/contrib/CMT/v1r18p20060606/mgr/setup.sh<br />
cmt config<br />
</pre><br />
<br />
==Setup for the release 12.0.2==<br />
*Do the following:<br />
<pre><br />
source setup.sh -tag=12.0.2,opt<br />
</pre><br />
<br />
*Check that the CMT path is correct by doing this<br />
<pre><br />
echo $CMTPATH<br />
</pre><br />
<br />
*Stuff like this should be printed to your screen:<br />
<pre><br />
/afs/cern.ch/user/o/ordonez/scratch0/Workshop/12.0.2:<br />
/afs/cern.ch/atlas/software/builds/AtlasOffline/12.0.2<br />
</pre><br />
<br />
*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.<br />
<br />
==Run Time Setup==<br />
*Go to your working area and check out the follow package:<br />
<pre><br />
cd 12.0.2<br />
cmt co -r UserAnalysis-00-08-05 PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
</pre><br />
<br />
*Now compile everything as follows:<br />
<pre><br />
cd PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
cmt config; source setup.sh; cmt br gmake<br />
cd ../run<br />
</pre><br />
<br />
*To test that everything has been done correctly, do:<br />
<pre><br />
get_files HelloWorldOptions.py<br />
athena.py HelloWorldOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*Stuff like this should be printed to the screen:<br />
<pre><br />
HelloWorld INFO execute()<br />
HelloWorld INFO An INFO message<br />
HelloWorld WARNING A WARNING message<br />
HelloWorld ERROR An ERROR message<br />
HelloWorld FATAL A FATAL error message<br />
AthenaEventLoopMgr INFO ===>>> end of event 9 <<<===<br />
HistorySvc INFO Service finalised successfully<br />
ChronoStatSvc.f... INFO Service finalized succesfully<br />
ToolSvc INFO Removing all tools created by ToolSvc<br />
ApplicationMgr INFO Application Manager Finalized successfully<br />
ApplicationMgr INFO Application Manager Terminated successfully<br />
</pre><br />
<br />
==The Next Time You Login==<br />
*The next time you login, just do the following:<br />
<pre><br />
cd ${HOME}/scratch0/Workshop<br />
source setup.sh -tag=12.0.2<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
source setup.sh<br />
cd ../run<br />
</pre><br />
<br />
==Get The Necessary Files==<br />
*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:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/data/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data/*.py .<br />
</pre><br />
<br />
==Run the AnalysisSkeleton for 500 Events==<br />
*get the necessary job options file from the release:<br />
<pre><br />
get_files AnalysisSkeleton_jobOptions.py<br />
</pre><br />
<br />
*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<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root"]<br />
</pre><br />
*with this line<br />
<pre><br />
include( "mc11.004201.ZeeJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
*Check that in AnalysisSkeleton_jobOptions.py, the number of events to run is set to 500:<br />
<pre><br />
# Number of Events to process<br />
theApp.EvtMax = 500<br />
</pre><br />
*Now run the AnalysisSkeleton_jobOptions.py. It should produce a file called AnalysisSkeleton.aan.root which contains some ROOT histograms and an AthenaAwareNTuple:<br />
<pre><br />
athena.py AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
*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].<br />
<br />
*Now, you may look at the the ../UserAnalysis/AnalysisSkeleton.h, the ../src/AnalysisSkeleton.cxx and ../run/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.<br />
<br />
*You should open the output file AnalysisSkeleton.aan.root in ROOT and browse the histograms and the AthenaAwareNTuple:<br />
<pre><br />
root -l AnalysisSkeleton.aan.root<br />
new TBrowser<br />
</pre><br />
*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.<br />
<br />
==More Information==<br />
*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].<br />
<br />
==Z to mumu on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<br />
*'''NOTE: Don't copy directly the lines, but follow the example!'''<br />
<pre><br />
#include "UserAnalysis/ZmumuOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cp ~ordonez/public/Workshop_files/cmt/requirements .<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the ZmumuOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnAOD_jobOptions.py | tee AthenaOut_ZmumuOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnAOD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *f = TFile::Open("ZmumuOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnAOD->SetMarkerStyle(20)<br />
zmumuOnAOD->SetMarkerSize(0.5)<br />
zmumuOnAOD->SetMarkerColor(2)<br />
zmumuOnAOD->SetLineColor(4)<br />
zmumuOnAOD->SetLineWidth(2)<br />
zmumuOnAOD->Draw("ZmmMass")<br />
</pre><br />
*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].<br />
<br />
*'''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.'''<br />
<br />
==Z to ee on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/ZeeOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<pre><br />
#include "UserAnalysis/ZeeOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnAOD_jobOptions.py| tee AthenaOut_ZeeOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZeeOnAOD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnAOD->SetMarkerStyle(20)<br />
zeeOnAOD->SetMarkerSize(0.5)<br />
zeeOnAOD->SetMarkerColor(2)<br />
zeeOnAOD->SetLineColor(4)<br />
zeeOnAOD->SetLineWidth(2)<br />
zeeOnAOD->Draw("ZeeMass")<br />
zeeOnAOD->Draw("ElectronIsEM")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the AOD are listed here: StoregateKeysForAOD.<br />
<br />
*'''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.<br />
'''<br />
<br />
==The TrackParticle==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/TrackExample.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/TrackExample.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/TrackExample_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm TrackExample.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton and AnalysisMuon):<br />
<pre><br />
#include "UserAnalysis/TrackExample.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( TrackExample )<br />
<br />
DECLARE_ALGORITHM( TrackExample )<br />
</pre><br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the TrackExample algorithm as follows:<br />
<pre><br />
athena.py TrackExample_jobOptions.py | tee AthenaOut_TrackExample.log<br />
</pre><br />
*You should have an AthenaAwareNTuple file, TrackExample.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/ 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.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("TrackExample.aan.root")<br />
new TBrowser<br />
TTree * trackExample=(TTree*) gDirectory->Get("CollectionTree");<br />
trackExample->SetMarkerStyle(20)<br />
trackExample->SetMarkerSize(0.5)<br />
trackExample->SetMarkerColor(2)<br />
trackExample->SetLineColor(4)<br />
trackExample->SetLineWidth(2)<br />
trackExample->Draw("TrackPEta")<br />
trackExample->Draw("TrackPD0")<br />
trackExample->Draw("TrackPZ0:TrackPD0")<br />
</pre><br />
*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 - [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForAOD StoregateKeysForAOD].<br />
<br />
==Z to mumu on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZmumuOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnESD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnESD )<br />
</pre><br />
Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZmumuOnESD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnESD_jobOptions.py | tee athenaOut_ZmumuOnESD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnESD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZmumuOnESD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnESD->SetMarkerStyle(20)<br />
zmumuOnESD->SetMarkerSize(0.5)<br />
zmumuOnESD->SetMarkerColor(2)<br />
zmumuOnESD->SetLineColor(4)<br />
zmumuOnESD->SetLineWidth(2)<br />
zmumuOnESD->Draw("ESDZmmMass")<br />
zmumuOnESD->Draw("ESDZmmDeltaR")<br />
</pre><br />
<br />
*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.<br />
<br />
*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.<br />
<br />
==Z to ee on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZeeOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZeeOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnESD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnESD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnESD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnESD_jobOptions.py | tee athenaOut_ZeeOnESD.log<br />
</pre><br />
*This should produce an AthenaAwareNTuple file, ZeeOnESD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnESD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnESD->SetMarkerStyle(20)<br />
zeeOnESD->SetMarkerSize(0.5)<br />
zeeOnESD->SetMarkerColor(2)<br />
zeeOnESD->SetLineColor(4)<br />
zeeOnESD->SetLineWidth(2)<br />
zeeOnESD->Draw("EgammaPt")<br />
zeeOnESD->Draw("EgammaEta")<br />
zeeOnESD->Draw("EgammaEoverP")<br />
zeeOnESD->Draw("EgammaIsEM")<br />
zeeOnESD->Draw("EgammaZeeMass")<br />
zeeOnESD->Draw("EgammaTrackP")<br />
zeeOnESD->Draw("EgammaClusterE")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the ESD are listed here: [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForESD 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.<br />
<br />
*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.<br />
<br />
*For further details of the Electron/Photon reconstruction, see egammaRec.<br />
<br />
==MCTruth==<br />
In this exercise, we will look MC Truth Tools on AOD.<br />
<br />
first copy the files:<br />
<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/MCTruth.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/MCTruth.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/MCTruth_jobOptions.py .<br />
</pre><br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/MCTruth.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( MCTruth )<br />
<br />
DECLARE_ALGORITHM( MCTruth )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the MCTruth algorithm as follows:<br />
<pre><br />
athena.py MCTruth_jobOptions.py | tee athenaOut_MCTruth.log<br />
</pre><br />
*This should produce an AthenaAwareNTuple file, MCTruth.aan.root. <br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("MCTruth.aan.root")<br />
new TBrowser<br />
TTree * MCTruth=(TTree*) gDirectory->Get("CollectionTree");<br />
MCTruth->SetMarkerStyle(20)<br />
MCTruth->SetMarkerSize(0.5)<br />
MCTruth->SetMarkerColor(2)<br />
MCTruth->SetLineColor(4)<br />
MCTruth->SetLineWidth(2)<br />
MCTruth->Draw("EgammaPt")<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006_pre-Tutorial&diff=1122NIKHEF PAT workshop Oct2006 pre-Tutorial2006-10-12T13:44:13Z<p>Gusord: /* MCTruth */</p>
<hr />
<div>==Note==<br />
<br />
We'll work using lxplus machines at cern. So make sure you have an ATLAS AFS computer account and scratch0 space.<br />
<br />
==What will you learn==<br />
<br />
*Set up the Athena enviroment<br />
<br />
*Run the UserAnalys package creating AANT (AthenaAware NTuples)<br />
<br />
*Add new algorithms to the package<br />
<br />
*How to access AOD/ESD different containers (Muon, Electron, TrackParticles, GenEvent...) via StoreGate. And the use of the AlgTool AnalysisTools to manipulate their objects.<br />
<br />
==Set up CMT==<br />
<br />
* Login to lxplus at CERN and create a working directory called "Workshop". We will use the release 12.0.2 this tutorial: <br />
<pre><br />
ssh lxplus.cern.ch<br />
cd scratch0<br />
mkdir Workshop<br />
cd Workshop<br />
mkdir 12.0.2<br />
</pre><br />
<br />
* 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:<br />
<pre><br />
set CMTSITE CERN<br />
set SITEROOT /afs/cern.ch<br />
macro ATLAS_DIST_AREA ${SITEROOT}/atlas/software/dist<br />
<br />
macro ATLAS_GROUP_AREA "/afs/cern.ch/atlas/groups/PAT/Workshop"<br />
<br />
macro ATLAS_TEST_AREA "" \<br />
12.0.2 "${HOME}/scratch0/Workshop/12.0.2"<br />
<br />
<br />
apply_tag oneTest<br />
<br />
use AtlasLogin AtlasLogin-* $(ATLAS_DIST_AREA)<br />
</pre><br />
<br />
*Then do the following:<br />
<pre><br />
source /afs/cern.ch/sw/contrib/CMT/v1r18p20060606/mgr/setup.sh<br />
cmt config<br />
</pre><br />
<br />
==Setup for the release 12.0.2==<br />
*Do the following:<br />
<pre><br />
source setup.sh -tag=12.0.2,opt<br />
</pre><br />
<br />
*Check that the CMT path is correct by doing this<br />
<pre><br />
echo $CMTPATH<br />
</pre><br />
<br />
*Stuff like this should be printed to your screen:<br />
<pre><br />
/afs/cern.ch/user/o/ordonez/scratch0/Workshop/12.0.2:<br />
/afs/cern.ch/atlas/software/builds/AtlasOffline/12.0.2<br />
</pre><br />
<br />
*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.<br />
<br />
==Run Time Setup==<br />
*Go to your working area and check out the follow package:<br />
<pre><br />
cd 12.0.2<br />
cmt co -r UserAnalysis-00-08-05 PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
</pre><br />
<br />
*Now compile everything as follows:<br />
<pre><br />
cd PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
cmt config; source setup.sh; cmt br gmake<br />
cd ../run<br />
</pre><br />
<br />
*To test that everything has been done correctly, do:<br />
<pre><br />
get_files HelloWorldOptions.py<br />
athena.py HelloWorldOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*Stuff like this should be printed to the screen:<br />
<pre><br />
HelloWorld INFO execute()<br />
HelloWorld INFO An INFO message<br />
HelloWorld WARNING A WARNING message<br />
HelloWorld ERROR An ERROR message<br />
HelloWorld FATAL A FATAL error message<br />
AthenaEventLoopMgr INFO ===>>> end of event 9 <<<===<br />
HistorySvc INFO Service finalised successfully<br />
ChronoStatSvc.f... INFO Service finalized succesfully<br />
ToolSvc INFO Removing all tools created by ToolSvc<br />
ApplicationMgr INFO Application Manager Finalized successfully<br />
ApplicationMgr INFO Application Manager Terminated successfully<br />
</pre><br />
<br />
==The Next Time You Login==<br />
*The next time you login, just do the following:<br />
<pre><br />
cd ${HOME}/scratch0/Workshop<br />
source setup.sh -tag=12.0.2<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
source setup.sh<br />
cd ../run<br />
</pre><br />
<br />
==Get The Necessary Files==<br />
*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:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/data/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data/*.py .<br />
</pre><br />
<br />
==Run the AnalysisSkeleton for 500 Events==<br />
*get the necessary job options file from the release:<br />
<pre><br />
get_files AnalysisSkeleton_jobOptions.py<br />
</pre><br />
<br />
*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<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root"]<br />
</pre><br />
*with this line<br />
<pre><br />
include( "mc11.004201.ZeeJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
*Check that in AnalysisSkeleton_jobOptions.py, the number of events to run is set to 500:<br />
<pre><br />
# Number of Events to process<br />
theApp.EvtMax = 500<br />
</pre><br />
*Now run the AnalysisSkeleton_jobOptions.py. It should produce a file called AnalysisSkeleton.aan.root which contains some ROOT histograms and an AthenaAwareNTuple:<br />
<pre><br />
athena.py AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
*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].<br />
<br />
*Now, you may look at the the ../UserAnalysis/AnalysisSkeleton.h, the ../src/AnalysisSkeleton.cxx and ../run/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.<br />
<br />
*You should open the output file AnalysisSkeleton.aan.root in ROOT and browse the histograms and the AthenaAwareNTuple:<br />
<pre><br />
root -l AnalysisSkeleton.aan.root<br />
new TBrowser<br />
</pre><br />
*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.<br />
<br />
==More Information==<br />
*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].<br />
<br />
==Z to mumu on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<br />
*'''NOTE: Don't copy directly the lines, but follow the example!'''<br />
<pre><br />
#include "UserAnalysis/ZmumuOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cp ~ordonez/public/Workshop_files/cmt/requirements .<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the ZmumuOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnAOD_jobOptions.py | tee AthenaOut_ZmumuOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnAOD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *f = TFile::Open("ZmumuOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnAOD->SetMarkerStyle(20)<br />
zmumuOnAOD->SetMarkerSize(0.5)<br />
zmumuOnAOD->SetMarkerColor(2)<br />
zmumuOnAOD->SetLineColor(4)<br />
zmumuOnAOD->SetLineWidth(2)<br />
zmumuOnAOD->Draw("ZmmMass")<br />
</pre><br />
*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].<br />
<br />
*'''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.'''<br />
<br />
==Z to ee on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/ZeeOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<pre><br />
#include "UserAnalysis/ZeeOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnAOD_jobOptions.py| tee AthenaOut_ZeeOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZeeOnAOD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnAOD->SetMarkerStyle(20)<br />
zeeOnAOD->SetMarkerSize(0.5)<br />
zeeOnAOD->SetMarkerColor(2)<br />
zeeOnAOD->SetLineColor(4)<br />
zeeOnAOD->SetLineWidth(2)<br />
zeeOnAOD->Draw("ZeeMass")<br />
zeeOnAOD->Draw("ElectronIsEM")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the AOD are listed here: StoregateKeysForAOD.<br />
<br />
*'''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.<br />
'''<br />
<br />
==The TrackParticle==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/TrackExample.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/TrackExample.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/TrackExample_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm TrackExample.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton and AnalysisMuon):<br />
<pre><br />
#include "UserAnalysis/TrackExample.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( TrackExample )<br />
<br />
DECLARE_ALGORITHM( TrackExample )<br />
</pre><br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the TrackExample algorithm as follows:<br />
<pre><br />
athena.py TrackExample_jobOptions.py | tee AthenaOut_TrackExample.log<br />
</pre><br />
*You should have an AthenaAwareNTuple file, TrackExample.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/ 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.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("TrackExample.aan.root")<br />
new TBrowser<br />
TTree * trackExample=(TTree*) gDirectory->Get("CollectionTree");<br />
trackExample->SetMarkerStyle(20)<br />
trackExample->SetMarkerSize(0.5)<br />
trackExample->SetMarkerColor(2)<br />
trackExample->SetLineColor(4)<br />
trackExample->SetLineWidth(2)<br />
trackExample->Draw("TrackPEta")<br />
trackExample->Draw("TrackPD0")<br />
trackExample->Draw("TrackPZ0:TrackPD0")<br />
</pre><br />
*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 - [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForAOD StoregateKeysForAOD].<br />
<br />
==Z to mumu on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZmumuOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnESD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnESD )<br />
</pre><br />
Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZmumuOnESD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnESD_jobOptions.py | tee athenaOut_ZmumuOnESD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnESD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZmumuOnESD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnESD->SetMarkerStyle(20)<br />
zmumuOnESD->SetMarkerSize(0.5)<br />
zmumuOnESD->SetMarkerColor(2)<br />
zmumuOnESD->SetLineColor(4)<br />
zmumuOnESD->SetLineWidth(2)<br />
zmumuOnESD->Draw("ESDZmmMass")<br />
zmumuOnESD->Draw("ESDZmmDeltaR")<br />
</pre><br />
<br />
*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.<br />
<br />
*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.<br />
<br />
==Z to ee on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZeeOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZeeOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnESD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnESD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnESD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnESD_jobOptions.py | tee athenaOut_ZeeOnESD.log<br />
</pre><br />
*This should produce an AthenaAwareNTuple file, ZeeOnESD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnESD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnESD->SetMarkerStyle(20)<br />
zeeOnESD->SetMarkerSize(0.5)<br />
zeeOnESD->SetMarkerColor(2)<br />
zeeOnESD->SetLineColor(4)<br />
zeeOnESD->SetLineWidth(2)<br />
zeeOnESD->Draw("EgammaPt")<br />
zeeOnESD->Draw("EgammaEta")<br />
zeeOnESD->Draw("EgammaEoverP")<br />
zeeOnESD->Draw("EgammaIsEM")<br />
zeeOnESD->Draw("EgammaZeeMass")<br />
zeeOnESD->Draw("EgammaTrackP")<br />
zeeOnESD->Draw("EgammaClusterE")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the ESD are listed here: [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForESD 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.<br />
<br />
*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.<br />
<br />
*For further details of the Electron/Photon reconstruction, see egammaRec.<br />
<br />
==MCTruth==<br />
In this exercise, we will look MC Truth Tools on AOD.<br />
<br />
first copy the files:<br />
<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/MCTruth.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/MCTruth.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/MCTruth_jobOptions.py .<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006_pre-Tutorial&diff=1121NIKHEF PAT workshop Oct2006 pre-Tutorial2006-10-12T13:04:49Z<p>Gusord: /* MCTruth */</p>
<hr />
<div>==Note==<br />
<br />
We'll work using lxplus machines at cern. So make sure you have an ATLAS AFS computer account and scratch0 space.<br />
<br />
==What will you learn==<br />
<br />
*Set up the Athena enviroment<br />
<br />
*Run the UserAnalys package creating AANT (AthenaAware NTuples)<br />
<br />
*Add new algorithms to the package<br />
<br />
*How to access AOD/ESD different containers (Muon, Electron, TrackParticles, GenEvent...) via StoreGate. And the use of the AlgTool AnalysisTools to manipulate their objects.<br />
<br />
==Set up CMT==<br />
<br />
* Login to lxplus at CERN and create a working directory called "Workshop". We will use the release 12.0.2 this tutorial: <br />
<pre><br />
ssh lxplus.cern.ch<br />
cd scratch0<br />
mkdir Workshop<br />
cd Workshop<br />
mkdir 12.0.2<br />
</pre><br />
<br />
* 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:<br />
<pre><br />
set CMTSITE CERN<br />
set SITEROOT /afs/cern.ch<br />
macro ATLAS_DIST_AREA ${SITEROOT}/atlas/software/dist<br />
<br />
macro ATLAS_GROUP_AREA "/afs/cern.ch/atlas/groups/PAT/Workshop"<br />
<br />
macro ATLAS_TEST_AREA "" \<br />
12.0.2 "${HOME}/scratch0/Workshop/12.0.2"<br />
<br />
<br />
apply_tag oneTest<br />
<br />
use AtlasLogin AtlasLogin-* $(ATLAS_DIST_AREA)<br />
</pre><br />
<br />
*Then do the following:<br />
<pre><br />
source /afs/cern.ch/sw/contrib/CMT/v1r18p20060606/mgr/setup.sh<br />
cmt config<br />
</pre><br />
<br />
==Setup for the release 12.0.2==<br />
*Do the following:<br />
<pre><br />
source setup.sh -tag=12.0.2,opt<br />
</pre><br />
<br />
*Check that the CMT path is correct by doing this<br />
<pre><br />
echo $CMTPATH<br />
</pre><br />
<br />
*Stuff like this should be printed to your screen:<br />
<pre><br />
/afs/cern.ch/user/o/ordonez/scratch0/Workshop/12.0.2:<br />
/afs/cern.ch/atlas/software/builds/AtlasOffline/12.0.2<br />
</pre><br />
<br />
*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.<br />
<br />
==Run Time Setup==<br />
*Go to your working area and check out the follow package:<br />
<pre><br />
cd 12.0.2<br />
cmt co -r UserAnalysis-00-08-05 PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
</pre><br />
<br />
*Now compile everything as follows:<br />
<pre><br />
cd PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
cmt config; source setup.sh; cmt br gmake<br />
cd ../run<br />
</pre><br />
<br />
*To test that everything has been done correctly, do:<br />
<pre><br />
get_files HelloWorldOptions.py<br />
athena.py HelloWorldOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*Stuff like this should be printed to the screen:<br />
<pre><br />
HelloWorld INFO execute()<br />
HelloWorld INFO An INFO message<br />
HelloWorld WARNING A WARNING message<br />
HelloWorld ERROR An ERROR message<br />
HelloWorld FATAL A FATAL error message<br />
AthenaEventLoopMgr INFO ===>>> end of event 9 <<<===<br />
HistorySvc INFO Service finalised successfully<br />
ChronoStatSvc.f... INFO Service finalized succesfully<br />
ToolSvc INFO Removing all tools created by ToolSvc<br />
ApplicationMgr INFO Application Manager Finalized successfully<br />
ApplicationMgr INFO Application Manager Terminated successfully<br />
</pre><br />
<br />
==The Next Time You Login==<br />
*The next time you login, just do the following:<br />
<pre><br />
cd ${HOME}/scratch0/Workshop<br />
source setup.sh -tag=12.0.2<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
source setup.sh<br />
cd ../run<br />
</pre><br />
<br />
==Get The Necessary Files==<br />
*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:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/data/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data/*.py .<br />
</pre><br />
<br />
==Run the AnalysisSkeleton for 500 Events==<br />
*get the necessary job options file from the release:<br />
<pre><br />
get_files AnalysisSkeleton_jobOptions.py<br />
</pre><br />
<br />
*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<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root"]<br />
</pre><br />
*with this line<br />
<pre><br />
include( "mc11.004201.ZeeJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
*Check that in AnalysisSkeleton_jobOptions.py, the number of events to run is set to 500:<br />
<pre><br />
# Number of Events to process<br />
theApp.EvtMax = 500<br />
</pre><br />
*Now run the AnalysisSkeleton_jobOptions.py. It should produce a file called AnalysisSkeleton.aan.root which contains some ROOT histograms and an AthenaAwareNTuple:<br />
<pre><br />
athena.py AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
*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].<br />
<br />
*Now, you may look at the the ../UserAnalysis/AnalysisSkeleton.h, the ../src/AnalysisSkeleton.cxx and ../run/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.<br />
<br />
*You should open the output file AnalysisSkeleton.aan.root in ROOT and browse the histograms and the AthenaAwareNTuple:<br />
<pre><br />
root -l AnalysisSkeleton.aan.root<br />
new TBrowser<br />
</pre><br />
*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.<br />
<br />
==More Information==<br />
*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].<br />
<br />
==Z to mumu on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<br />
*'''NOTE: Don't copy directly the lines, but follow the example!'''<br />
<pre><br />
#include "UserAnalysis/ZmumuOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cp ~ordonez/public/Workshop_files/cmt/requirements .<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the ZmumuOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnAOD_jobOptions.py | tee AthenaOut_ZmumuOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnAOD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *f = TFile::Open("ZmumuOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnAOD->SetMarkerStyle(20)<br />
zmumuOnAOD->SetMarkerSize(0.5)<br />
zmumuOnAOD->SetMarkerColor(2)<br />
zmumuOnAOD->SetLineColor(4)<br />
zmumuOnAOD->SetLineWidth(2)<br />
zmumuOnAOD->Draw("ZmmMass")<br />
</pre><br />
*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].<br />
<br />
*'''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.'''<br />
<br />
==Z to ee on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/ZeeOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<pre><br />
#include "UserAnalysis/ZeeOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnAOD_jobOptions.py| tee AthenaOut_ZeeOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZeeOnAOD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnAOD->SetMarkerStyle(20)<br />
zeeOnAOD->SetMarkerSize(0.5)<br />
zeeOnAOD->SetMarkerColor(2)<br />
zeeOnAOD->SetLineColor(4)<br />
zeeOnAOD->SetLineWidth(2)<br />
zeeOnAOD->Draw("ZeeMass")<br />
zeeOnAOD->Draw("ElectronIsEM")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the AOD are listed here: StoregateKeysForAOD.<br />
<br />
*'''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.<br />
'''<br />
<br />
==The TrackParticle==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/TrackExample.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/TrackExample.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/TrackExample_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm TrackExample.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton and AnalysisMuon):<br />
<pre><br />
#include "UserAnalysis/TrackExample.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( TrackExample )<br />
<br />
DECLARE_ALGORITHM( TrackExample )<br />
</pre><br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the TrackExample algorithm as follows:<br />
<pre><br />
athena.py TrackExample_jobOptions.py | tee AthenaOut_TrackExample.log<br />
</pre><br />
*You should have an AthenaAwareNTuple file, TrackExample.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/ 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.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("TrackExample.aan.root")<br />
new TBrowser<br />
TTree * trackExample=(TTree*) gDirectory->Get("CollectionTree");<br />
trackExample->SetMarkerStyle(20)<br />
trackExample->SetMarkerSize(0.5)<br />
trackExample->SetMarkerColor(2)<br />
trackExample->SetLineColor(4)<br />
trackExample->SetLineWidth(2)<br />
trackExample->Draw("TrackPEta")<br />
trackExample->Draw("TrackPD0")<br />
trackExample->Draw("TrackPZ0:TrackPD0")<br />
</pre><br />
*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 - [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForAOD StoregateKeysForAOD].<br />
<br />
==Z to mumu on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZmumuOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnESD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnESD )<br />
</pre><br />
Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZmumuOnESD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnESD_jobOptions.py | tee athenaOut_ZmumuOnESD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnESD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZmumuOnESD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnESD->SetMarkerStyle(20)<br />
zmumuOnESD->SetMarkerSize(0.5)<br />
zmumuOnESD->SetMarkerColor(2)<br />
zmumuOnESD->SetLineColor(4)<br />
zmumuOnESD->SetLineWidth(2)<br />
zmumuOnESD->Draw("ESDZmmMass")<br />
zmumuOnESD->Draw("ESDZmmDeltaR")<br />
</pre><br />
<br />
*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.<br />
<br />
*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.<br />
<br />
==Z to ee on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZeeOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZeeOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnESD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnESD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnESD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnESD_jobOptions.py | tee athenaOut_ZeeOnESD.log<br />
</pre><br />
*This should produce an AthenaAwareNTuple file, ZeeOnESD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnESD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnESD->SetMarkerStyle(20)<br />
zeeOnESD->SetMarkerSize(0.5)<br />
zeeOnESD->SetMarkerColor(2)<br />
zeeOnESD->SetLineColor(4)<br />
zeeOnESD->SetLineWidth(2)<br />
zeeOnESD->Draw("EgammaPt")<br />
zeeOnESD->Draw("EgammaEta")<br />
zeeOnESD->Draw("EgammaEoverP")<br />
zeeOnESD->Draw("EgammaIsEM")<br />
zeeOnESD->Draw("EgammaZeeMass")<br />
zeeOnESD->Draw("EgammaTrackP")<br />
zeeOnESD->Draw("EgammaClusterE")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the ESD are listed here: [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForESD 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.<br />
<br />
*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.<br />
<br />
*For further details of the Electron/Photon reconstruction, see egammaRec.<br />
<br />
==MCTruth==<br />
In this exercise, we will look MC Truth Tools on AOD.<br />
<br />
first copy the files:<br />
<br />
pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/MCTruth.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/MCTruth.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/MCTruth_jobOptions.py .<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006_pre-Tutorial&diff=1120NIKHEF PAT workshop Oct2006 pre-Tutorial2006-10-12T11:58:07Z<p>Gusord: /* Z to ee on the ESD */</p>
<hr />
<div>==Note==<br />
<br />
We'll work using lxplus machines at cern. So make sure you have an ATLAS AFS computer account and scratch0 space.<br />
<br />
==What will you learn==<br />
<br />
*Set up the Athena enviroment<br />
<br />
*Run the UserAnalys package creating AANT (AthenaAware NTuples)<br />
<br />
*Add new algorithms to the package<br />
<br />
*How to access AOD/ESD different containers (Muon, Electron, TrackParticles, GenEvent...) via StoreGate. And the use of the AlgTool AnalysisTools to manipulate their objects.<br />
<br />
==Set up CMT==<br />
<br />
* Login to lxplus at CERN and create a working directory called "Workshop". We will use the release 12.0.2 this tutorial: <br />
<pre><br />
ssh lxplus.cern.ch<br />
cd scratch0<br />
mkdir Workshop<br />
cd Workshop<br />
mkdir 12.0.2<br />
</pre><br />
<br />
* 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:<br />
<pre><br />
set CMTSITE CERN<br />
set SITEROOT /afs/cern.ch<br />
macro ATLAS_DIST_AREA ${SITEROOT}/atlas/software/dist<br />
<br />
macro ATLAS_GROUP_AREA "/afs/cern.ch/atlas/groups/PAT/Workshop"<br />
<br />
macro ATLAS_TEST_AREA "" \<br />
12.0.2 "${HOME}/scratch0/Workshop/12.0.2"<br />
<br />
<br />
apply_tag oneTest<br />
<br />
use AtlasLogin AtlasLogin-* $(ATLAS_DIST_AREA)<br />
</pre><br />
<br />
*Then do the following:<br />
<pre><br />
source /afs/cern.ch/sw/contrib/CMT/v1r18p20060606/mgr/setup.sh<br />
cmt config<br />
</pre><br />
<br />
==Setup for the release 12.0.2==<br />
*Do the following:<br />
<pre><br />
source setup.sh -tag=12.0.2,opt<br />
</pre><br />
<br />
*Check that the CMT path is correct by doing this<br />
<pre><br />
echo $CMTPATH<br />
</pre><br />
<br />
*Stuff like this should be printed to your screen:<br />
<pre><br />
/afs/cern.ch/user/o/ordonez/scratch0/Workshop/12.0.2:<br />
/afs/cern.ch/atlas/software/builds/AtlasOffline/12.0.2<br />
</pre><br />
<br />
*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.<br />
<br />
==Run Time Setup==<br />
*Go to your working area and check out the follow package:<br />
<pre><br />
cd 12.0.2<br />
cmt co -r UserAnalysis-00-08-05 PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
</pre><br />
<br />
*Now compile everything as follows:<br />
<pre><br />
cd PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
cmt config; source setup.sh; cmt br gmake<br />
cd ../run<br />
</pre><br />
<br />
*To test that everything has been done correctly, do:<br />
<pre><br />
get_files HelloWorldOptions.py<br />
athena.py HelloWorldOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*Stuff like this should be printed to the screen:<br />
<pre><br />
HelloWorld INFO execute()<br />
HelloWorld INFO An INFO message<br />
HelloWorld WARNING A WARNING message<br />
HelloWorld ERROR An ERROR message<br />
HelloWorld FATAL A FATAL error message<br />
AthenaEventLoopMgr INFO ===>>> end of event 9 <<<===<br />
HistorySvc INFO Service finalised successfully<br />
ChronoStatSvc.f... INFO Service finalized succesfully<br />
ToolSvc INFO Removing all tools created by ToolSvc<br />
ApplicationMgr INFO Application Manager Finalized successfully<br />
ApplicationMgr INFO Application Manager Terminated successfully<br />
</pre><br />
<br />
==The Next Time You Login==<br />
*The next time you login, just do the following:<br />
<pre><br />
cd ${HOME}/scratch0/Workshop<br />
source setup.sh -tag=12.0.2<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
source setup.sh<br />
cd ../run<br />
</pre><br />
<br />
==Get The Necessary Files==<br />
*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:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/data/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data/*.py .<br />
</pre><br />
<br />
==Run the AnalysisSkeleton for 500 Events==<br />
*get the necessary job options file from the release:<br />
<pre><br />
get_files AnalysisSkeleton_jobOptions.py<br />
</pre><br />
<br />
*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<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root"]<br />
</pre><br />
*with this line<br />
<pre><br />
include( "mc11.004201.ZeeJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
*Check that in AnalysisSkeleton_jobOptions.py, the number of events to run is set to 500:<br />
<pre><br />
# Number of Events to process<br />
theApp.EvtMax = 500<br />
</pre><br />
*Now run the AnalysisSkeleton_jobOptions.py. It should produce a file called AnalysisSkeleton.aan.root which contains some ROOT histograms and an AthenaAwareNTuple:<br />
<pre><br />
athena.py AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
*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].<br />
<br />
*Now, you may look at the the ../UserAnalysis/AnalysisSkeleton.h, the ../src/AnalysisSkeleton.cxx and ../run/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.<br />
<br />
*You should open the output file AnalysisSkeleton.aan.root in ROOT and browse the histograms and the AthenaAwareNTuple:<br />
<pre><br />
root -l AnalysisSkeleton.aan.root<br />
new TBrowser<br />
</pre><br />
*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.<br />
<br />
==More Information==<br />
*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].<br />
<br />
==Z to mumu on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<br />
*'''NOTE: Don't copy directly the lines, but follow the example!'''<br />
<pre><br />
#include "UserAnalysis/ZmumuOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cp ~ordonez/public/Workshop_files/cmt/requirements .<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the ZmumuOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnAOD_jobOptions.py | tee AthenaOut_ZmumuOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnAOD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *f = TFile::Open("ZmumuOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnAOD->SetMarkerStyle(20)<br />
zmumuOnAOD->SetMarkerSize(0.5)<br />
zmumuOnAOD->SetMarkerColor(2)<br />
zmumuOnAOD->SetLineColor(4)<br />
zmumuOnAOD->SetLineWidth(2)<br />
zmumuOnAOD->Draw("ZmmMass")<br />
</pre><br />
*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].<br />
<br />
*'''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.'''<br />
<br />
==Z to ee on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/ZeeOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<pre><br />
#include "UserAnalysis/ZeeOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnAOD_jobOptions.py| tee AthenaOut_ZeeOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZeeOnAOD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnAOD->SetMarkerStyle(20)<br />
zeeOnAOD->SetMarkerSize(0.5)<br />
zeeOnAOD->SetMarkerColor(2)<br />
zeeOnAOD->SetLineColor(4)<br />
zeeOnAOD->SetLineWidth(2)<br />
zeeOnAOD->Draw("ZeeMass")<br />
zeeOnAOD->Draw("ElectronIsEM")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the AOD are listed here: StoregateKeysForAOD.<br />
<br />
*'''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.<br />
'''<br />
<br />
==The TrackParticle==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/TrackExample.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/TrackExample.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/TrackExample_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm TrackExample.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton and AnalysisMuon):<br />
<pre><br />
#include "UserAnalysis/TrackExample.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( TrackExample )<br />
<br />
DECLARE_ALGORITHM( TrackExample )<br />
</pre><br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the TrackExample algorithm as follows:<br />
<pre><br />
athena.py TrackExample_jobOptions.py | tee AthenaOut_TrackExample.log<br />
</pre><br />
*You should have an AthenaAwareNTuple file, TrackExample.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/ 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.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("TrackExample.aan.root")<br />
new TBrowser<br />
TTree * trackExample=(TTree*) gDirectory->Get("CollectionTree");<br />
trackExample->SetMarkerStyle(20)<br />
trackExample->SetMarkerSize(0.5)<br />
trackExample->SetMarkerColor(2)<br />
trackExample->SetLineColor(4)<br />
trackExample->SetLineWidth(2)<br />
trackExample->Draw("TrackPEta")<br />
trackExample->Draw("TrackPD0")<br />
trackExample->Draw("TrackPZ0:TrackPD0")<br />
</pre><br />
*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 - [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForAOD StoregateKeysForAOD].<br />
<br />
==Z to mumu on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZmumuOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnESD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnESD )<br />
</pre><br />
Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZmumuOnESD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnESD_jobOptions.py | tee athenaOut_ZmumuOnESD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnESD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZmumuOnESD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnESD->SetMarkerStyle(20)<br />
zmumuOnESD->SetMarkerSize(0.5)<br />
zmumuOnESD->SetMarkerColor(2)<br />
zmumuOnESD->SetLineColor(4)<br />
zmumuOnESD->SetLineWidth(2)<br />
zmumuOnESD->Draw("ESDZmmMass")<br />
zmumuOnESD->Draw("ESDZmmDeltaR")<br />
</pre><br />
<br />
*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.<br />
<br />
*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.<br />
<br />
==Z to ee on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZeeOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZeeOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnESD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnESD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnESD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnESD_jobOptions.py | tee athenaOut_ZeeOnESD.log<br />
</pre><br />
*This should produce an AthenaAwareNTuple file, ZeeOnESD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnESD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnESD->SetMarkerStyle(20)<br />
zeeOnESD->SetMarkerSize(0.5)<br />
zeeOnESD->SetMarkerColor(2)<br />
zeeOnESD->SetLineColor(4)<br />
zeeOnESD->SetLineWidth(2)<br />
zeeOnESD->Draw("EgammaPt")<br />
zeeOnESD->Draw("EgammaEta")<br />
zeeOnESD->Draw("EgammaEoverP")<br />
zeeOnESD->Draw("EgammaIsEM")<br />
zeeOnESD->Draw("EgammaZeeMass")<br />
zeeOnESD->Draw("EgammaTrackP")<br />
zeeOnESD->Draw("EgammaClusterE")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the ESD are listed here: [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForESD 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.<br />
<br />
*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.<br />
<br />
*For further details of the Electron/Photon reconstruction, see egammaRec.<br />
<br />
==MCTruth==</div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006_pre-Tutorial&diff=1119NIKHEF PAT workshop Oct2006 pre-Tutorial2006-10-12T11:57:45Z<p>Gusord: /* What will you learn */</p>
<hr />
<div>==Note==<br />
<br />
We'll work using lxplus machines at cern. So make sure you have an ATLAS AFS computer account and scratch0 space.<br />
<br />
==What will you learn==<br />
<br />
*Set up the Athena enviroment<br />
<br />
*Run the UserAnalys package creating AANT (AthenaAware NTuples)<br />
<br />
*Add new algorithms to the package<br />
<br />
*How to access AOD/ESD different containers (Muon, Electron, TrackParticles, GenEvent...) via StoreGate. And the use of the AlgTool AnalysisTools to manipulate their objects.<br />
<br />
==Set up CMT==<br />
<br />
* Login to lxplus at CERN and create a working directory called "Workshop". We will use the release 12.0.2 this tutorial: <br />
<pre><br />
ssh lxplus.cern.ch<br />
cd scratch0<br />
mkdir Workshop<br />
cd Workshop<br />
mkdir 12.0.2<br />
</pre><br />
<br />
* 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:<br />
<pre><br />
set CMTSITE CERN<br />
set SITEROOT /afs/cern.ch<br />
macro ATLAS_DIST_AREA ${SITEROOT}/atlas/software/dist<br />
<br />
macro ATLAS_GROUP_AREA "/afs/cern.ch/atlas/groups/PAT/Workshop"<br />
<br />
macro ATLAS_TEST_AREA "" \<br />
12.0.2 "${HOME}/scratch0/Workshop/12.0.2"<br />
<br />
<br />
apply_tag oneTest<br />
<br />
use AtlasLogin AtlasLogin-* $(ATLAS_DIST_AREA)<br />
</pre><br />
<br />
*Then do the following:<br />
<pre><br />
source /afs/cern.ch/sw/contrib/CMT/v1r18p20060606/mgr/setup.sh<br />
cmt config<br />
</pre><br />
<br />
==Setup for the release 12.0.2==<br />
*Do the following:<br />
<pre><br />
source setup.sh -tag=12.0.2,opt<br />
</pre><br />
<br />
*Check that the CMT path is correct by doing this<br />
<pre><br />
echo $CMTPATH<br />
</pre><br />
<br />
*Stuff like this should be printed to your screen:<br />
<pre><br />
/afs/cern.ch/user/o/ordonez/scratch0/Workshop/12.0.2:<br />
/afs/cern.ch/atlas/software/builds/AtlasOffline/12.0.2<br />
</pre><br />
<br />
*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.<br />
<br />
==Run Time Setup==<br />
*Go to your working area and check out the follow package:<br />
<pre><br />
cd 12.0.2<br />
cmt co -r UserAnalysis-00-08-05 PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
</pre><br />
<br />
*Now compile everything as follows:<br />
<pre><br />
cd PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
cmt config; source setup.sh; cmt br gmake<br />
cd ../run<br />
</pre><br />
<br />
*To test that everything has been done correctly, do:<br />
<pre><br />
get_files HelloWorldOptions.py<br />
athena.py HelloWorldOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*Stuff like this should be printed to the screen:<br />
<pre><br />
HelloWorld INFO execute()<br />
HelloWorld INFO An INFO message<br />
HelloWorld WARNING A WARNING message<br />
HelloWorld ERROR An ERROR message<br />
HelloWorld FATAL A FATAL error message<br />
AthenaEventLoopMgr INFO ===>>> end of event 9 <<<===<br />
HistorySvc INFO Service finalised successfully<br />
ChronoStatSvc.f... INFO Service finalized succesfully<br />
ToolSvc INFO Removing all tools created by ToolSvc<br />
ApplicationMgr INFO Application Manager Finalized successfully<br />
ApplicationMgr INFO Application Manager Terminated successfully<br />
</pre><br />
<br />
==The Next Time You Login==<br />
*The next time you login, just do the following:<br />
<pre><br />
cd ${HOME}/scratch0/Workshop<br />
source setup.sh -tag=12.0.2<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt<br />
source setup.sh<br />
cd ../run<br />
</pre><br />
<br />
==Get The Necessary Files==<br />
*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:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/data/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data/*.py .<br />
</pre><br />
<br />
==Run the AnalysisSkeleton for 500 Events==<br />
*get the necessary job options file from the release:<br />
<pre><br />
get_files AnalysisSkeleton_jobOptions.py<br />
</pre><br />
<br />
*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<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root"]<br />
</pre><br />
*with this line<br />
<pre><br />
include( "mc11.004201.ZeeJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
*Check that in AnalysisSkeleton_jobOptions.py, the number of events to run is set to 500:<br />
<pre><br />
# Number of Events to process<br />
theApp.EvtMax = 500<br />
</pre><br />
*Now run the AnalysisSkeleton_jobOptions.py. It should produce a file called AnalysisSkeleton.aan.root which contains some ROOT histograms and an AthenaAwareNTuple:<br />
<pre><br />
athena.py AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
*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].<br />
<br />
*Now, you may look at the the ../UserAnalysis/AnalysisSkeleton.h, the ../src/AnalysisSkeleton.cxx and ../run/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.<br />
<br />
*You should open the output file AnalysisSkeleton.aan.root in ROOT and browse the histograms and the AthenaAwareNTuple:<br />
<pre><br />
root -l AnalysisSkeleton.aan.root<br />
new TBrowser<br />
</pre><br />
*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.<br />
<br />
==More Information==<br />
*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].<br />
<br />
==Z to mumu on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<br />
*'''NOTE: Don't copy directly the lines, but follow the example!'''<br />
<pre><br />
#include "UserAnalysis/ZmumuOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cp ~ordonez/public/Workshop_files/cmt/requirements .<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the ZmumuOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnAOD_jobOptions.py | tee AthenaOut_ZmumuOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnAOD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *f = TFile::Open("ZmumuOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnAOD->SetMarkerStyle(20)<br />
zmumuOnAOD->SetMarkerSize(0.5)<br />
zmumuOnAOD->SetMarkerColor(2)<br />
zmumuOnAOD->SetLineColor(4)<br />
zmumuOnAOD->SetLineWidth(2)<br />
zmumuOnAOD->Draw("ZmmMass")<br />
</pre><br />
*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].<br />
<br />
*'''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.'''<br />
<br />
==Z to ee on AOD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/ZeeOnAOD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnAOD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnAOD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnAOD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:<br />
<pre><br />
#include "UserAnalysis/ZeeOnAOD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnAOD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnAOD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnAOD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnAOD_jobOptions.py| tee AthenaOut_ZeeOnAOD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZeeOnAOD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnAOD] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnAOD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnAOD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnAOD->SetMarkerStyle(20)<br />
zeeOnAOD->SetMarkerSize(0.5)<br />
zeeOnAOD->SetMarkerColor(2)<br />
zeeOnAOD->SetLineColor(4)<br />
zeeOnAOD->SetLineWidth(2)<br />
zeeOnAOD->Draw("ZeeMass")<br />
zeeOnAOD->Draw("ElectronIsEM")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the AOD are listed here: StoregateKeysForAOD.<br />
<br />
*'''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.<br />
'''<br />
<br />
==The TrackParticle==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/TrackExample.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/TrackExample.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/TrackExample_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm TrackExample.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton and AnalysisMuon):<br />
<pre><br />
#include "UserAnalysis/TrackExample.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( TrackExample )<br />
<br />
DECLARE_ALGORITHM( TrackExample )<br />
</pre><br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
*Now you may run the TrackExample algorithm as follows:<br />
<pre><br />
athena.py TrackExample_jobOptions.py | tee AthenaOut_TrackExample.log<br />
</pre><br />
*You should have an AthenaAwareNTuple file, TrackExample.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/ 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.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("TrackExample.aan.root")<br />
new TBrowser<br />
TTree * trackExample=(TTree*) gDirectory->Get("CollectionTree");<br />
trackExample->SetMarkerStyle(20)<br />
trackExample->SetMarkerSize(0.5)<br />
trackExample->SetMarkerColor(2)<br />
trackExample->SetLineColor(4)<br />
trackExample->SetLineWidth(2)<br />
trackExample->Draw("TrackPEta")<br />
trackExample->Draw("TrackPD0")<br />
trackExample->Draw("TrackPZ0:TrackPD0")<br />
</pre><br />
*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 - [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForAOD StoregateKeysForAOD].<br />
<br />
==Z to mumu on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZmumuOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZmumuOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZmumuOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZmumuOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZmumuOnESD )<br />
<br />
DECLARE_ALGORITHM( ZmumuOnESD )<br />
</pre><br />
Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZmumuOnESD algorithm as follows:<br />
<pre><br />
athena.py ZmumuOnESD_jobOptions.py | tee athenaOut_ZmumuOnESD.log<br />
</pre><br />
<br />
*This should produce an AthenaAwareNTuple file, ZmumuOnESD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZmumuOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZmumuOnESD.aan.root")<br />
new TBrowser<br />
TTree * zmumuOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zmumuOnESD->SetMarkerStyle(20)<br />
zmumuOnESD->SetMarkerSize(0.5)<br />
zmumuOnESD->SetMarkerColor(2)<br />
zmumuOnESD->SetLineColor(4)<br />
zmumuOnESD->SetLineWidth(2)<br />
zmumuOnESD->Draw("ESDZmmMass")<br />
zmumuOnESD->Draw("ESDZmmDeltaR")<br />
</pre><br />
<br />
*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.<br />
<br />
*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.<br />
<br />
==Z to ee on the ESD==<br />
*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:<br />
<pre><br />
cd ../src<br />
cp ~ordonez/public/Workshop_files/src/ZeeOnESD.cxx .<br />
cd ../UserAnalysis<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/ZeeOnESD.h .<br />
cd ../run<br />
cp ~ordonez/public/Workshop_files/run/ZeeOnESD_jobOptions.py .<br />
</pre><br />
<br />
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnESD.<br />
<pre><br />
cd ../src/components<br />
</pre><br />
<br />
*edit UserAnalysis_entries.cxx and add these lines <br />
(follow the example that is already in there for the AnalysisSkeleton, AnalysisMuon and TrackExample):<br />
<pre><br />
#include "UserAnalysis/ZeeOnESD.h"<br />
<br />
DECLARE_ALGORITHM_FACTORY( ZeeOnESD )<br />
<br />
DECLARE_ALGORITHM( ZeeOnESD )<br />
</pre><br />
<br />
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:<br />
<pre><br />
cd ../../cmt<br />
cmt config<br />
cmt broadcast gmake<br />
cd ../run<br />
</pre><br />
<br />
*Now you may run the ZeeOnESD algorithm as follows:<br />
<pre><br />
athena.py ZeeOnESD_jobOptions.py | tee athenaOut_ZeeOnESD.log<br />
</pre><br />
*This should produce an AthenaAwareNTuple file, ZeeOnESD.aan.root. While Athena is running, let's go through the code by following this link: [http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/users/ketevi/UserAnalysis/src ZeeOnESD.cxx] for the details of the algorithm and the selection cuts.<br />
<br />
*Now, open this file in ROOT and browse the AthenaAwareNTuple:<br />
<pre><br />
root -l<br />
TFile *_file0 = TFile::Open("ZeeOnESD.aan.root")<br />
new TBrowser<br />
TTree * zeeOnESD=(TTree*) gDirectory->Get("CollectionTree");<br />
zeeOnESD->SetMarkerStyle(20)<br />
zeeOnESD->SetMarkerSize(0.5)<br />
zeeOnESD->SetMarkerColor(2)<br />
zeeOnESD->SetLineColor(4)<br />
zeeOnESD->SetLineWidth(2)<br />
zeeOnESD->Draw("EgammaPt")<br />
zeeOnESD->Draw("EgammaEta")<br />
zeeOnESD->Draw("EgammaEoverP")<br />
zeeOnESD->Draw("EgammaIsEM")<br />
zeeOnESD->Draw("EgammaZeeMass")<br />
zeeOnESD->Draw("EgammaTrackP")<br />
zeeOnESD->Draw("EgammaClusterE")<br />
</pre><br />
<br />
*The StoreGate keys for the various objects in the ESD are listed here: [https://twiki.cern.ch/twiki/bin/view/Atlas/StoregateKeysForESD 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.<br />
<br />
*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.<br />
<br />
*For further details of the Electron/Photon reconstruction, see egammaRec.</div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1129NIKHEF PAT workshop Oct20062006-10-12T11:32:11Z<p>Gusord: /* Interactive Analysis in ATHENA */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one gave by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new Run directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
</pre><br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
*See pT distribution of muons<br />
<pre><br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
</pre><br />
<br />
==Monte Carlo Truth Tools on AOD==<br />
*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<br />
<pre><br />
#include "TruthParticleAlgs/McVtxFilterTool.h"<br />
#include "TruthParticleAlgs/TruthParticleCnvTool.h"<br />
#include "AnalysisUtils/McVtxFilter.h"<br />
#include "ParticleEvent/TruthParticle.h"<br />
#include "ParticleEvent/TruthParticleContainer.h"<br />
</pre><br />
*with the following:<br />
<pre><br />
#include "McParticleTools/McVtxFilterTool.h"<br />
#include "McParticleTools/TruthParticleCnvTool.h"<br />
#include "McParticleUtils/McVtxFilter.h"<br />
#include "McParticleEvent/TruthParticle.h"<br />
#include "McParticleEvent/TruthParticleContainer.h"<br />
</pre><br />
*Also in your requirements file, you may need to add the following lines and redo cmt config and gmake:<br />
<pre><br />
cmt co -r McParticleTools McParticleTools-00-* PhysicsAnalysis/TruthParticleID<br />
cmt co -r McParticleUtils McParticleUtils-00-* PhysicsAnalysis/TruthParticleID<br />
cmt co -r McParticleEvent McParticleEvent-00-* PhysicsAnalysis/TruthParticleID<br />
</pre><br />
<br />
*Now follow this link, McTrtuh on AOD, make sure that you make the above modifications before running.<br />
<br />
==Analysis with the EventView==<br />
*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.<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job estatus monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
==GANGA==<br />
*For further details vistit [https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga ganga wiki]<br />
*A very simple example of how to use panda move to your ${HOME} directory and do:<br />
<pre><br />
export PATH=$PATH:/afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/<br />
<br />
or <br />
<br />
setenv PATH /afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/:${PATH}<br />
</pre><br />
<br />
*Generate a ${HOME}/.gangarc with<br />
<pre><br />
ganga -g<br />
</pre><br />
<br />
*Edit $HOME/.gangarc as follows: <br />
<br />
1. In the section labelled [Configuration] add the line:<br />
<pre><br />
RUNTIME_PATH = GangaAtlas<br />
</pre><br />
2. In the section labelled [LCG] add the line:<br />
<pre><br />
VirtualOrganisation = atlas<br />
</pre><br />
<br />
*Now move to the run directory again and try this:<br />
<pre><br />
ganga<br />
</pre><br />
<br />
*Inside the Python interpreter:<br />
<pre><br />
j = Job()<br />
j.application=Athena()<br />
j.application.prepare()<br />
j.application.option_file='$HOME/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZmumuOnAOD_jobOptions.py'<br />
j.inputdata=DQ2Dataset()<br />
j.inputdata.type='DQ2_LOCAL'<br />
j.inputdata.dataset='csc11.005145.PythiaZmumu.recon.AOD.v11004103'<br />
j.outputdata=DQ2OutputDataset()<br />
j.outputdata.outputdata=['ZmumuOnAOD.aan.root']<br />
j.backend=LCG()<br />
j.submit()<br />
</pre><br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*Have a look at the files contained in one of the sets<br />
<pre><br />
dq2_ls -f <datasetname><br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1117NIKHEF PAT workshop Oct20062006-10-12T11:31:35Z<p>Gusord: /* DQ2 Tools */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one gave by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new Run directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
</pre><br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
<br />
*See pT distribution of muons<br />
<pre><br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
</pre><br />
<br />
==Monte Carlo Truth Tools on AOD==<br />
*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<br />
<pre><br />
#include "TruthParticleAlgs/McVtxFilterTool.h"<br />
#include "TruthParticleAlgs/TruthParticleCnvTool.h"<br />
#include "AnalysisUtils/McVtxFilter.h"<br />
#include "ParticleEvent/TruthParticle.h"<br />
#include "ParticleEvent/TruthParticleContainer.h"<br />
</pre><br />
*with the following:<br />
<pre><br />
#include "McParticleTools/McVtxFilterTool.h"<br />
#include "McParticleTools/TruthParticleCnvTool.h"<br />
#include "McParticleUtils/McVtxFilter.h"<br />
#include "McParticleEvent/TruthParticle.h"<br />
#include "McParticleEvent/TruthParticleContainer.h"<br />
</pre><br />
*Also in your requirements file, you may need to add the following lines and redo cmt config and gmake:<br />
<pre><br />
cmt co -r McParticleTools McParticleTools-00-* PhysicsAnalysis/TruthParticleID<br />
cmt co -r McParticleUtils McParticleUtils-00-* PhysicsAnalysis/TruthParticleID<br />
cmt co -r McParticleEvent McParticleEvent-00-* PhysicsAnalysis/TruthParticleID<br />
</pre><br />
<br />
*Now follow this link, McTrtuh on AOD, make sure that you make the above modifications before running.<br />
<br />
==Analysis with the EventView==<br />
*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.<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job estatus monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
==GANGA==<br />
*For further details vistit [https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga ganga wiki]<br />
*A very simple example of how to use panda move to your ${HOME} directory and do:<br />
<pre><br />
export PATH=$PATH:/afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/<br />
<br />
or <br />
<br />
setenv PATH /afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/:${PATH}<br />
</pre><br />
<br />
*Generate a ${HOME}/.gangarc with<br />
<pre><br />
ganga -g<br />
</pre><br />
<br />
*Edit $HOME/.gangarc as follows: <br />
<br />
1. In the section labelled [Configuration] add the line:<br />
<pre><br />
RUNTIME_PATH = GangaAtlas<br />
</pre><br />
2. In the section labelled [LCG] add the line:<br />
<pre><br />
VirtualOrganisation = atlas<br />
</pre><br />
<br />
*Now move to the run directory again and try this:<br />
<pre><br />
ganga<br />
</pre><br />
<br />
*Inside the Python interpreter:<br />
<pre><br />
j = Job()<br />
j.application=Athena()<br />
j.application.prepare()<br />
j.application.option_file='$HOME/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZmumuOnAOD_jobOptions.py'<br />
j.inputdata=DQ2Dataset()<br />
j.inputdata.type='DQ2_LOCAL'<br />
j.inputdata.dataset='csc11.005145.PythiaZmumu.recon.AOD.v11004103'<br />
j.outputdata=DQ2OutputDataset()<br />
j.outputdata.outputdata=['ZmumuOnAOD.aan.root']<br />
j.backend=LCG()<br />
j.submit()<br />
</pre><br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*Have a look at the files contained in one of the sets<br />
<pre><br />
dq2_ls -f <datasetname><br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1116NIKHEF PAT workshop Oct20062006-10-12T11:23:19Z<p>Gusord: /* Interactive Analysis in ATHENA */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one gave by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new Run directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
</pre><br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
<br />
*See pT distribution of muons<br />
<pre><br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
</pre><br />
<br />
==Monte Carlo Truth Tools on AOD==<br />
*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<br />
<pre><br />
#include "TruthParticleAlgs/McVtxFilterTool.h"<br />
#include "TruthParticleAlgs/TruthParticleCnvTool.h"<br />
#include "AnalysisUtils/McVtxFilter.h"<br />
#include "ParticleEvent/TruthParticle.h"<br />
#include "ParticleEvent/TruthParticleContainer.h"<br />
</pre><br />
*with the following:<br />
<pre><br />
#include "McParticleTools/McVtxFilterTool.h"<br />
#include "McParticleTools/TruthParticleCnvTool.h"<br />
#include "McParticleUtils/McVtxFilter.h"<br />
#include "McParticleEvent/TruthParticle.h"<br />
#include "McParticleEvent/TruthParticleContainer.h"<br />
</pre><br />
*Also in your requirements file, you may need to add the following lines and redo cmt config and gmake:<br />
<pre><br />
cmt co -r McParticleTools McParticleTools-00-* PhysicsAnalysis/TruthParticleID<br />
cmt co -r McParticleUtils McParticleUtils-00-* PhysicsAnalysis/TruthParticleID<br />
cmt co -r McParticleEvent McParticleEvent-00-* PhysicsAnalysis/TruthParticleID<br />
</pre><br />
<br />
*Now follow this link, McTrtuh on AOD, make sure that you make the above modifications before running.<br />
<br />
==Analysis with the EventView==<br />
*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.<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job estatus monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
==GANGA==<br />
*For further details vistit [https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga ganga wiki]<br />
*A very simple example of how to use panda move to your ${HOME} directory and do:<br />
<pre><br />
export PATH=$PATH:/afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/<br />
<br />
or <br />
<br />
setenv PATH /afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/:${PATH}<br />
</pre><br />
<br />
*Generate a ${HOME}/.gangarc with<br />
<pre><br />
ganga -g<br />
</pre><br />
<br />
*Edit $HOME/.gangarc as follows: <br />
<br />
1. In the section labelled [Configuration] add the line:<br />
<pre><br />
RUNTIME_PATH = GangaAtlas<br />
</pre><br />
2. In the section labelled [LCG] add the line:<br />
<pre><br />
VirtualOrganisation = atlas<br />
</pre><br />
<br />
*Now move to the run directory again and try this:<br />
<pre><br />
ganga<br />
</pre><br />
<br />
*Inside the Python interpreter:<br />
<pre><br />
j = Job()<br />
j.application=Athena()<br />
j.application.prepare()<br />
j.application.option_file='$HOME/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZmumuOnAOD_jobOptions.py'<br />
j.inputdata=DQ2Dataset()<br />
j.inputdata.type='DQ2_LOCAL'<br />
j.inputdata.dataset='csc11.005145.PythiaZmumu.recon.AOD.v11004103'<br />
j.outputdata=DQ2OutputDataset()<br />
j.outputdata.outputdata=['ZmumuOnAOD.aan.root']<br />
j.backend=LCG()<br />
j.submit()<br />
</pre><br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1115NIKHEF PAT workshop Oct20062006-10-12T08:09:18Z<p>Gusord: /* Interactive Analysis in ATHENA */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one gave by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new Run directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
</pre><br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena>theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run your own Python script<br />
<pre><br />
athena>emacs test.py<br />
</pre><br />
*put your python code:<br />
<pre><br />
it = mc.particles_begin()<br />
itE = mc.particles_end()<br />
while (it != itE):<br />
p = it.next()<br />
print p.pdg_id()<br />
<br />
print "Done"<br />
</pre><br />
*e.g., test.py. Then Ctrl+XC to close emacs<br />
<br />
<pre><br />
athena>execfile("test.py")<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
<br />
*See pT distribution of muons<br />
<br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
<br />
==Monte Carlo Truth Tools on AOD==<br />
*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<br />
<pre><br />
#include "TruthParticleAlgs/McVtxFilterTool.h"<br />
#include "TruthParticleAlgs/TruthParticleCnvTool.h"<br />
#include "AnalysisUtils/McVtxFilter.h"<br />
#include "ParticleEvent/TruthParticle.h"<br />
#include "ParticleEvent/TruthParticleContainer.h"<br />
</pre><br />
*with the following:<br />
<pre><br />
#include "McParticleTools/McVtxFilterTool.h"<br />
#include "McParticleTools/TruthParticleCnvTool.h"<br />
#include "McParticleUtils/McVtxFilter.h"<br />
#include "McParticleEvent/TruthParticle.h"<br />
#include "McParticleEvent/TruthParticleContainer.h"<br />
</pre><br />
*Also in your requirements file, you may need to add the following lines and redo cmt config and gmake:<br />
<pre><br />
cmt co -r McParticleTools McParticleTools-00-* PhysicsAnalysis/TruthParticleID<br />
cmt co -r McParticleUtils McParticleUtils-00-* PhysicsAnalysis/TruthParticleID<br />
cmt co -r McParticleEvent McParticleEvent-00-* PhysicsAnalysis/TruthParticleID<br />
</pre><br />
<br />
*Now follow this link, McTrtuh on AOD, make sure that you make the above modifications before running.<br />
<br />
==Analysis with the EventView==<br />
*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.<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job estatus monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
==GANGA==<br />
*For further details vistit [https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga ganga wiki]<br />
*A very simple example of how to use panda move to your ${HOME} directory and do:<br />
<pre><br />
export PATH=$PATH:/afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/<br />
<br />
or <br />
<br />
setenv PATH /afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/:${PATH}<br />
</pre><br />
<br />
*Generate a ${HOME}/.gangarc with<br />
<pre><br />
ganga -g<br />
</pre><br />
<br />
*Edit $HOME/.gangarc as follows: <br />
<br />
1. In the section labelled [Configuration] add the line:<br />
<pre><br />
RUNTIME_PATH = GangaAtlas<br />
</pre><br />
2. In the section labelled [LCG] add the line:<br />
<pre><br />
VirtualOrganisation = atlas<br />
</pre><br />
<br />
*Now move to the run directory again and try this:<br />
<pre><br />
ganga<br />
</pre><br />
<br />
*Inside the Python interpreter:<br />
<pre><br />
j = Job()<br />
j.application=Athena()<br />
j.application.prepare()<br />
j.application.option_file='$HOME/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZmumuOnAOD_jobOptions.py'<br />
j.inputdata=DQ2Dataset()<br />
j.inputdata.type='DQ2_LOCAL'<br />
j.inputdata.dataset='csc11.005145.PythiaZmumu.recon.AOD.v11004103'<br />
j.outputdata=DQ2OutputDataset()<br />
j.outputdata.outputdata=['ZmumuOnAOD.aan.root']<br />
j.backend=LCG()<br />
j.submit()<br />
</pre><br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1114NIKHEF PAT workshop Oct20062006-10-11T17:01:01Z<p>Gusord: /* Interactive Analysis in ATHENA */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one gave by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new Run directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
</pre><br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena> theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena> theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena> mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena>m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena>dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena>m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena>tp = m.track()<br />
athena>dir(tp)<br />
athena>tp.pt()<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena>mc = mcc[0]<br />
athena>mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena>dumpSG()<br />
</pre><br />
<br />
*Run your own Python script<br />
<pre><br />
athena>emacs test.py<br />
</pre><br />
*put your python code:<br />
<pre><br />
it = mc.particles_begin()<br />
itE = mc.particles_end()<br />
while (it != itE):<br />
p = it.next()<br />
print p.pdg_id()<br />
<br />
print "Done"<br />
</pre><br />
*e.g., test.py. Then Ctrl+XC to close emacs<br />
<br />
<pre><br />
athena>execfile("test.py")<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena>theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena>theApp.seek(0)<br />
</pre><br />
<br />
<br />
*See pT distribution of muons<br />
<br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
<br />
==Monte Carlo Truth Tools on AOD==<br />
*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<br />
<pre><br />
#include "TruthParticleAlgs/McVtxFilterTool.h"<br />
#include "TruthParticleAlgs/TruthParticleCnvTool.h"<br />
#include "AnalysisUtils/McVtxFilter.h"<br />
#include "ParticleEvent/TruthParticle.h"<br />
#include "ParticleEvent/TruthParticleContainer.h"<br />
</pre><br />
*with the following:<br />
<pre><br />
#include "McParticleTools/McVtxFilterTool.h"<br />
#include "McParticleTools/TruthParticleCnvTool.h"<br />
#include "McParticleUtils/McVtxFilter.h"<br />
#include "McParticleEvent/TruthParticle.h"<br />
#include "McParticleEvent/TruthParticleContainer.h"<br />
</pre><br />
*Also in your requirements file, you may need to add the following lines and redo cmt config and gmake:<br />
<pre><br />
cmt co -r McParticleTools McParticleTools-00-* PhysicsAnalysis/TruthParticleID<br />
cmt co -r McParticleUtils McParticleUtils-00-* PhysicsAnalysis/TruthParticleID<br />
cmt co -r McParticleEvent McParticleEvent-00-* PhysicsAnalysis/TruthParticleID<br />
</pre><br />
<br />
*Now follow this link, McTrtuh on AOD, make sure that you make the above modifications before running.<br />
<br />
==Analysis with the EventView==<br />
*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.<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job estatus monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
==GANGA==<br />
*For further details vistit [https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga ganga wiki]<br />
*A very simple example of how to use panda move to your ${HOME} directory and do:<br />
<pre><br />
export PATH=$PATH:/afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/<br />
<br />
or <br />
<br />
setenv PATH /afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/:${PATH}<br />
</pre><br />
<br />
*Generate a ${HOME}/.gangarc with<br />
<pre><br />
ganga -g<br />
</pre><br />
<br />
*Edit $HOME/.gangarc as follows: <br />
<br />
1. In the section labelled [Configuration] add the line:<br />
<pre><br />
RUNTIME_PATH = GangaAtlas<br />
</pre><br />
2. In the section labelled [LCG] add the line:<br />
<pre><br />
VirtualOrganisation = atlas<br />
</pre><br />
<br />
*Now move to the run directory again and try this:<br />
<pre><br />
ganga<br />
</pre><br />
<br />
*Inside the Python interpreter:<br />
<pre><br />
j = Job()<br />
j.application=Athena()<br />
j.application.prepare()<br />
j.application.option_file='$HOME/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZmumuOnAOD_jobOptions.py'<br />
j.inputdata=DQ2Dataset()<br />
j.inputdata.type='DQ2_LOCAL'<br />
j.inputdata.dataset='csc11.005145.PythiaZmumu.recon.AOD.v11004103'<br />
j.outputdata=DQ2OutputDataset()<br />
j.outputdata.outputdata=['ZmumuOnAOD.aan.root']<br />
j.backend=LCG()<br />
j.submit()<br />
</pre><br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1113NIKHEF PAT workshop Oct20062006-10-05T15:42:26Z<p>Gusord: /* Interactive Analysis in ATHENA */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one gave by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new Run directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
</pre><br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena> theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena> theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena> mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena> m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena> dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena> m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena> tp = m.track()<br />
athena> dir(tp)<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena> mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena> mc = mcc[0]<br />
athena> mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena> dumpSG()<br />
</pre><br />
<br />
*Run your own Python script<br />
<pre><br />
athena> emacs test.py<br />
</pre><br />
*put your python code:<br />
<pre><br />
x = (1234*GeV, 3456*GeV)<br />
import math<br />
xx = math.sqrt(x[0])<br />
<br />
it = mc.particles_begin()<br />
itE = mc.particles_end()<br />
while (it != itE):<br />
p = it.next()<br />
print p.pdg_id()<br />
<br />
print "Done"<br />
</pre><br />
*e.g., test.py. Then Ctrl+XC to close emacs<br />
<br />
<pre><br />
athena> execfile("test.py")<br />
</pre><br />
<br />
*Run next event<br />
<pre><br />
athena> theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena> theApp.seek(0)<br />
</pre><br />
<br />
<br />
*See pT distribution of muons<br />
<br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
<br />
==Monte Carlo Truth Tools on AOD==<br />
*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<br />
<pre><br />
#include "TruthParticleAlgs/McVtxFilterTool.h"<br />
#include "TruthParticleAlgs/TruthParticleCnvTool.h"<br />
#include "AnalysisUtils/McVtxFilter.h"<br />
#include "ParticleEvent/TruthParticle.h"<br />
#include "ParticleEvent/TruthParticleContainer.h"<br />
</pre><br />
*with the following:<br />
<pre><br />
#include "McParticleTools/McVtxFilterTool.h"<br />
#include "McParticleTools/TruthParticleCnvTool.h"<br />
#include "McParticleUtils/McVtxFilter.h"<br />
#include "McParticleEvent/TruthParticle.h"<br />
#include "McParticleEvent/TruthParticleContainer.h"<br />
</pre><br />
*Also in your requirements file, you may need to add the following lines and redo cmt config and gmake:<br />
<pre><br />
cmt co -r McParticleTools McParticleTools-00-* PhysicsAnalysis/TruthParticleID<br />
cmt co -r McParticleUtils McParticleUtils-00-* PhysicsAnalysis/TruthParticleID<br />
cmt co -r McParticleEvent McParticleEvent-00-* PhysicsAnalysis/TruthParticleID<br />
</pre><br />
<br />
*Now follow this link, McTrtuh on AOD, make sure that you make the above modifications before running.<br />
<br />
==Analysis with the EventView==<br />
*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.<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job estatus monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
==GANGA==<br />
*For further details vistit [https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga ganga wiki]<br />
*A very simple example of how to use panda move to your ${HOME} directory and do:<br />
<pre><br />
export PATH=$PATH:/afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/<br />
<br />
or <br />
<br />
setenv PATH /afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/:${PATH}<br />
</pre><br />
<br />
*Generate a ${HOME}/.gangarc with<br />
<pre><br />
ganga -g<br />
</pre><br />
<br />
*Edit $HOME/.gangarc as follows: <br />
<br />
1. In the section labelled [Configuration] add the line:<br />
<pre><br />
RUNTIME_PATH = GangaAtlas<br />
</pre><br />
2. In the section labelled [LCG] add the line:<br />
<pre><br />
VirtualOrganisation = atlas<br />
</pre><br />
<br />
*Now move to the run directory again and try this:<br />
<pre><br />
ganga<br />
</pre><br />
<br />
*Inside the Python interpreter:<br />
<pre><br />
j = Job()<br />
j.application=Athena()<br />
j.application.prepare()<br />
j.application.option_file='$HOME/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZmumuOnAOD_jobOptions.py'<br />
j.inputdata=DQ2Dataset()<br />
j.inputdata.type='DQ2_LOCAL'<br />
j.inputdata.dataset='csc11.005145.PythiaZmumu.recon.AOD.v11004103'<br />
j.outputdata=DQ2OutputDataset()<br />
j.outputdata.outputdata=['ZmumuOnAOD.aan.root']<br />
j.backend=LCG()<br />
j.submit()<br />
</pre><br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1112NIKHEF PAT workshop Oct20062006-10-05T15:39:38Z<p>Gusord: /* Interactive Analysis in ATHENA */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one gave by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new Run directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
</pre><br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena> theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena> theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena> mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Get the first muon<br />
<pre><br />
athena> m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena> dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena> m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena> tp = m.track()<br />
athena> dir(tp)<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena> mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena> mc = mcc[0]<br />
athena> mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena> dumpSG()<br />
</pre><br />
<br />
*Run your own Python script<br />
<pre><br />
athena> emacs test.py<br />
</pre><br />
*put your python code:<br />
<pre><br />
x = (1234*GeV, 3456*GeV)<br />
import math<br />
xx = math.sqrt(x[0])<br />
<br />
it = mc.particles_begin()<br />
itE = mc.particles_end()<br />
while (it != itE):<br />
p = it.next()<br />
print p.pdg_id()<br />
<br />
print "Done"<br />
</pre><br />
*e.g., test.py. Then Ctrl+XC to close emacs<br />
<br />
*Run next event<br />
<pre><br />
athena> theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena> theApp.seek(0)<br />
</pre><br />
<br />
<br />
*See pT distribution of muons<br />
<br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
<br />
==Monte Carlo Truth Tools on AOD==<br />
*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<br />
<pre><br />
#include "TruthParticleAlgs/McVtxFilterTool.h"<br />
#include "TruthParticleAlgs/TruthParticleCnvTool.h"<br />
#include "AnalysisUtils/McVtxFilter.h"<br />
#include "ParticleEvent/TruthParticle.h"<br />
#include "ParticleEvent/TruthParticleContainer.h"<br />
</pre><br />
*with the following:<br />
<pre><br />
#include "McParticleTools/McVtxFilterTool.h"<br />
#include "McParticleTools/TruthParticleCnvTool.h"<br />
#include "McParticleUtils/McVtxFilter.h"<br />
#include "McParticleEvent/TruthParticle.h"<br />
#include "McParticleEvent/TruthParticleContainer.h"<br />
</pre><br />
*Also in your requirements file, you may need to add the following lines and redo cmt config and gmake:<br />
<pre><br />
cmt co -r McParticleTools McParticleTools-00-* PhysicsAnalysis/TruthParticleID<br />
cmt co -r McParticleUtils McParticleUtils-00-* PhysicsAnalysis/TruthParticleID<br />
cmt co -r McParticleEvent McParticleEvent-00-* PhysicsAnalysis/TruthParticleID<br />
</pre><br />
<br />
*Now follow this link, McTrtuh on AOD, make sure that you make the above modifications before running.<br />
<br />
==Analysis with the EventView==<br />
*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.<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job estatus monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
==GANGA==<br />
*For further details vistit [https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga ganga wiki]<br />
*A very simple example of how to use panda move to your ${HOME} directory and do:<br />
<pre><br />
export PATH=$PATH:/afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/<br />
<br />
or <br />
<br />
setenv PATH /afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/:${PATH}<br />
</pre><br />
<br />
*Generate a ${HOME}/.gangarc with<br />
<pre><br />
ganga -g<br />
</pre><br />
<br />
*Edit $HOME/.gangarc as follows: <br />
<br />
1. In the section labelled [Configuration] add the line:<br />
<pre><br />
RUNTIME_PATH = GangaAtlas<br />
</pre><br />
2. In the section labelled [LCG] add the line:<br />
<pre><br />
VirtualOrganisation = atlas<br />
</pre><br />
<br />
*Now move to the run directory again and try this:<br />
<pre><br />
ganga<br />
</pre><br />
<br />
*Inside the Python interpreter:<br />
<pre><br />
j = Job()<br />
j.application=Athena()<br />
j.application.prepare()<br />
j.application.option_file='$HOME/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZmumuOnAOD_jobOptions.py'<br />
j.inputdata=DQ2Dataset()<br />
j.inputdata.type='DQ2_LOCAL'<br />
j.inputdata.dataset='csc11.005145.PythiaZmumu.recon.AOD.v11004103'<br />
j.outputdata=DQ2OutputDataset()<br />
j.outputdata.outputdata=['ZmumuOnAOD.aan.root']<br />
j.backend=LCG()<br />
j.submit()<br />
</pre><br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1111NIKHEF PAT workshop Oct20062006-10-05T15:39:10Z<p>Gusord: /* Interactive Analysis in ATHENA */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one gave by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new Run directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
</pre><br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena> theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena> theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena> mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Number of Muons<br />
<pre><br />
athena> mcon.size()<br />
</pre><br />
<br />
*Get the first muon<br />
<pre><br />
athena> m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena> dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena> m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena> tp = m.track()<br />
athena> dir(tp)<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena> mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena> mc = mcc[0]<br />
athena> mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena> dumpSG()<br />
</pre><br />
<br />
*Run your own Python script<br />
<pre><br />
athena> emacs test.py<br />
</pre><br />
*put your python code:<br />
<pre><br />
x = (1234*GeV, 3456*GeV)<br />
import math<br />
xx = math.sqrt(x[0])<br />
<br />
it = mc.particles_begin()<br />
itE = mc.particles_end()<br />
while (it != itE):<br />
p = it.next()<br />
print p.pdg_id()<br />
<br />
print "Done"<br />
</pre><br />
*e.g., test.py. Then Ctrl+XC to close emacs<br />
<br />
*Run next event<br />
<pre><br />
athena> theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena> theApp.seek(0)<br />
</pre><br />
<br />
<br />
*See pT distribution of muons<br />
<br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
<br />
==Monte Carlo Truth Tools on AOD==<br />
*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<br />
<pre><br />
#include "TruthParticleAlgs/McVtxFilterTool.h"<br />
#include "TruthParticleAlgs/TruthParticleCnvTool.h"<br />
#include "AnalysisUtils/McVtxFilter.h"<br />
#include "ParticleEvent/TruthParticle.h"<br />
#include "ParticleEvent/TruthParticleContainer.h"<br />
</pre><br />
*with the following:<br />
<pre><br />
#include "McParticleTools/McVtxFilterTool.h"<br />
#include "McParticleTools/TruthParticleCnvTool.h"<br />
#include "McParticleUtils/McVtxFilter.h"<br />
#include "McParticleEvent/TruthParticle.h"<br />
#include "McParticleEvent/TruthParticleContainer.h"<br />
</pre><br />
*Also in your requirements file, you may need to add the following lines and redo cmt config and gmake:<br />
<pre><br />
cmt co -r McParticleTools McParticleTools-00-* PhysicsAnalysis/TruthParticleID<br />
cmt co -r McParticleUtils McParticleUtils-00-* PhysicsAnalysis/TruthParticleID<br />
cmt co -r McParticleEvent McParticleEvent-00-* PhysicsAnalysis/TruthParticleID<br />
</pre><br />
<br />
*Now follow this link, McTrtuh on AOD, make sure that you make the above modifications before running.<br />
<br />
==Analysis with the EventView==<br />
*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.<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job estatus monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
==GANGA==<br />
*For further details vistit [https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga ganga wiki]<br />
*A very simple example of how to use panda move to your ${HOME} directory and do:<br />
<pre><br />
export PATH=$PATH:/afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/<br />
<br />
or <br />
<br />
setenv PATH /afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/:${PATH}<br />
</pre><br />
<br />
*Generate a ${HOME}/.gangarc with<br />
<pre><br />
ganga -g<br />
</pre><br />
<br />
*Edit $HOME/.gangarc as follows: <br />
<br />
1. In the section labelled [Configuration] add the line:<br />
<pre><br />
RUNTIME_PATH = GangaAtlas<br />
</pre><br />
2. In the section labelled [LCG] add the line:<br />
<pre><br />
VirtualOrganisation = atlas<br />
</pre><br />
<br />
*Now move to the run directory again and try this:<br />
<pre><br />
ganga<br />
</pre><br />
<br />
*Inside the Python interpreter:<br />
<pre><br />
j = Job()<br />
j.application=Athena()<br />
j.application.prepare()<br />
j.application.option_file='$HOME/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZmumuOnAOD_jobOptions.py'<br />
j.inputdata=DQ2Dataset()<br />
j.inputdata.type='DQ2_LOCAL'<br />
j.inputdata.dataset='csc11.005145.PythiaZmumu.recon.AOD.v11004103'<br />
j.outputdata=DQ2OutputDataset()<br />
j.outputdata.outputdata=['ZmumuOnAOD.aan.root']<br />
j.backend=LCG()<br />
j.submit()<br />
</pre><br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1110NIKHEF PAT workshop Oct20062006-10-05T15:38:25Z<p>Gusord: /* Interactive Analysis in ATHENA */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one gave by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new Run directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
</pre><br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena> theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena> theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena> mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Number of Muons<br />
<pre><br />
athena> econ.size()<br />
</pre><br />
<br />
*Get the first muon<br />
<pre><br />
athena> m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena> dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena> m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena> tp = m.track()<br />
athena> dir(tp)<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena> mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena> mc = mcc[0]<br />
athena> mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena> dumpSG()<br />
</pre><br />
<br />
*Run your own Python script<br />
<pre><br />
athena> emacs test.py<br />
</pre><br />
*put your python code:<br />
<pre><br />
x = (1234*GeV, 3456*GeV)<br />
import math<br />
xx = math.sqrt(x[0])<br />
<br />
it = mc.particles_begin()<br />
itE = mc.particles_end()<br />
while (it != itE):<br />
p = it.next()<br />
print p.pdg_id()<br />
<br />
print "Done"<br />
</pre><br />
*e.g., test.py. Then Ctrl+XC to close emacs<br />
<br />
*Run next event<br />
<pre><br />
athena> theApp.nextEvent()<br />
</pre><br />
<br />
Rewind event counter<br />
<pre><br />
athena> theApp.seek(0)<br />
</pre><br />
<br />
<br />
*See pT distribution of muons<br />
<br />
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)<br />
<br />
==Monte Carlo Truth Tools on AOD==<br />
*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<br />
<pre><br />
#include "TruthParticleAlgs/McVtxFilterTool.h"<br />
#include "TruthParticleAlgs/TruthParticleCnvTool.h"<br />
#include "AnalysisUtils/McVtxFilter.h"<br />
#include "ParticleEvent/TruthParticle.h"<br />
#include "ParticleEvent/TruthParticleContainer.h"<br />
</pre><br />
*with the following:<br />
<pre><br />
#include "McParticleTools/McVtxFilterTool.h"<br />
#include "McParticleTools/TruthParticleCnvTool.h"<br />
#include "McParticleUtils/McVtxFilter.h"<br />
#include "McParticleEvent/TruthParticle.h"<br />
#include "McParticleEvent/TruthParticleContainer.h"<br />
</pre><br />
*Also in your requirements file, you may need to add the following lines and redo cmt config and gmake:<br />
<pre><br />
cmt co -r McParticleTools McParticleTools-00-* PhysicsAnalysis/TruthParticleID<br />
cmt co -r McParticleUtils McParticleUtils-00-* PhysicsAnalysis/TruthParticleID<br />
cmt co -r McParticleEvent McParticleEvent-00-* PhysicsAnalysis/TruthParticleID<br />
</pre><br />
<br />
*Now follow this link, McTrtuh on AOD, make sure that you make the above modifications before running.<br />
<br />
==Analysis with the EventView==<br />
*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.<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job estatus monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
==GANGA==<br />
*For further details vistit [https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga ganga wiki]<br />
*A very simple example of how to use panda move to your ${HOME} directory and do:<br />
<pre><br />
export PATH=$PATH:/afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/<br />
<br />
or <br />
<br />
setenv PATH /afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/:${PATH}<br />
</pre><br />
<br />
*Generate a ${HOME}/.gangarc with<br />
<pre><br />
ganga -g<br />
</pre><br />
<br />
*Edit $HOME/.gangarc as follows: <br />
<br />
1. In the section labelled [Configuration] add the line:<br />
<pre><br />
RUNTIME_PATH = GangaAtlas<br />
</pre><br />
2. In the section labelled [LCG] add the line:<br />
<pre><br />
VirtualOrganisation = atlas<br />
</pre><br />
<br />
*Now move to the run directory again and try this:<br />
<pre><br />
ganga<br />
</pre><br />
<br />
*Inside the Python interpreter:<br />
<pre><br />
j = Job()<br />
j.application=Athena()<br />
j.application.prepare()<br />
j.application.option_file='$HOME/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZmumuOnAOD_jobOptions.py'<br />
j.inputdata=DQ2Dataset()<br />
j.inputdata.type='DQ2_LOCAL'<br />
j.inputdata.dataset='csc11.005145.PythiaZmumu.recon.AOD.v11004103'<br />
j.outputdata=DQ2OutputDataset()<br />
j.outputdata.outputdata=['ZmumuOnAOD.aan.root']<br />
j.backend=LCG()<br />
j.submit()<br />
</pre><br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1109NIKHEF PAT workshop Oct20062006-10-05T15:36:02Z<p>Gusord: /* Interactive Analysis in ATHENA */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one gave by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new Run directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
</pre><br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena> theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena> theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena> mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Number of Muons<br />
<pre><br />
athena> econ.size()<br />
</pre><br />
<br />
*Get the first muon<br />
<pre><br />
athena> m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena> dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena> m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena> tp = m.track()<br />
athena> dir(tp)<br />
</pre><br />
<br />
*Retrieve the MC Truth<br />
<pre><br />
athena> mcc = PyTruthTools.getMcEvents("TruthEvent")<br />
athena> mc = mcc[0]<br />
athena> mc.alphaQCD()<br />
</pre><br />
<br />
*Dump Data Store<br />
<pre><br />
athena> dumpSG()<br />
</pre><br />
<br />
*Run your own Python script<br />
<pre><br />
athena> emacs test.py<br />
</pre><br />
put your python code, e.g., test.py. Then Ctrl+XC to close emacs<br />
<br />
<pre><br />
x = (1234*GeV, 3456*GeV)<br />
import math<br />
xx = math.sqrt(x[0])<br />
<br />
it = mc.particles_begin()<br />
itE = mc.particles_end()<br />
while (it != itE):<br />
p = it.next()<br />
print p.pdg_id()<br />
<br />
print "Done"<br />
<br />
</pre><br />
<br />
==Monte Carlo Truth Tools on AOD==<br />
*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<br />
<pre><br />
#include "TruthParticleAlgs/McVtxFilterTool.h"<br />
#include "TruthParticleAlgs/TruthParticleCnvTool.h"<br />
#include "AnalysisUtils/McVtxFilter.h"<br />
#include "ParticleEvent/TruthParticle.h"<br />
#include "ParticleEvent/TruthParticleContainer.h"<br />
</pre><br />
*with the following:<br />
<pre><br />
#include "McParticleTools/McVtxFilterTool.h"<br />
#include "McParticleTools/TruthParticleCnvTool.h"<br />
#include "McParticleUtils/McVtxFilter.h"<br />
#include "McParticleEvent/TruthParticle.h"<br />
#include "McParticleEvent/TruthParticleContainer.h"<br />
</pre><br />
*Also in your requirements file, you may need to add the following lines and redo cmt config and gmake:<br />
<pre><br />
cmt co -r McParticleTools McParticleTools-00-* PhysicsAnalysis/TruthParticleID<br />
cmt co -r McParticleUtils McParticleUtils-00-* PhysicsAnalysis/TruthParticleID<br />
cmt co -r McParticleEvent McParticleEvent-00-* PhysicsAnalysis/TruthParticleID<br />
</pre><br />
<br />
*Now follow this link, McTrtuh on AOD, make sure that you make the above modifications before running.<br />
<br />
==Analysis with the EventView==<br />
*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.<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job estatus monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
==GANGA==<br />
*For further details vistit [https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga ganga wiki]<br />
*A very simple example of how to use panda move to your ${HOME} directory and do:<br />
<pre><br />
export PATH=$PATH:/afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/<br />
<br />
or <br />
<br />
setenv PATH /afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/:${PATH}<br />
</pre><br />
<br />
*Generate a ${HOME}/.gangarc with<br />
<pre><br />
ganga -g<br />
</pre><br />
<br />
*Edit $HOME/.gangarc as follows: <br />
<br />
1. In the section labelled [Configuration] add the line:<br />
<pre><br />
RUNTIME_PATH = GangaAtlas<br />
</pre><br />
2. In the section labelled [LCG] add the line:<br />
<pre><br />
VirtualOrganisation = atlas<br />
</pre><br />
<br />
*Now move to the run directory again and try this:<br />
<pre><br />
ganga<br />
</pre><br />
<br />
*Inside the Python interpreter:<br />
<pre><br />
j = Job()<br />
j.application=Athena()<br />
j.application.prepare()<br />
j.application.option_file='$HOME/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZmumuOnAOD_jobOptions.py'<br />
j.inputdata=DQ2Dataset()<br />
j.inputdata.type='DQ2_LOCAL'<br />
j.inputdata.dataset='csc11.005145.PythiaZmumu.recon.AOD.v11004103'<br />
j.outputdata=DQ2OutputDataset()<br />
j.outputdata.outputdata=['ZmumuOnAOD.aan.root']<br />
j.backend=LCG()<br />
j.submit()<br />
</pre><br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre></div>Gusordhttps://wiki.nikhef.nl/atlas/index.php?title=NIKHEF_PAT_workshop_Oct2006&diff=1108NIKHEF PAT workshop Oct20062006-10-05T15:32:56Z<p>Gusord: /* Interactive Analysis in ATHENA */</p>
<hr />
<div>==Pre-Tutorial==<br />
<br />
*This pre-Tutorial is copy of the one gave by Ketevi A. Assamagan, adapted to work in 12.0.2 <br />
<br />
*here is a link to other Tutorials by Ketevi, and other usful PAT links:<br />
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]<br />
<br />
*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<br />
<br />
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]<br />
<br />
==Event Selection==<br />
First we're going to generate a new AAN that we'll use later for selection. <br />
<pre><br />
cd ~scratch0/Workshop/<br />
source setup.sh -tag=12.0.2,opt<br />
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.<br />
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.<br />
cd cmt<br />
gamke<br />
cd ..<br />
mkdir run2<br />
cd run2<br />
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .<br />
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .<br />
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .<br />
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log<br />
</pre><br />
<br />
This will generate the file AnalysisSkeleton.aan.root.<br />
<br />
==Event Selection using TAG==<br />
*First we generate our own TAG.<br />
<br />
*Still in the new Run directory:<br />
<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .<br />
</pre><br />
<br />
*Edit Main_topOptions.py and uncomment the line<br />
<pre><br />
### Create TAG file<br />
doWriteTAG=True<br />
</pre><br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*This will generate the file called ZmumuOnAOD_TAG.root<br />
<br />
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:<br />
<pre><br />
#doWriteTAG=True <br />
</pre><br />
<br />
*and uncomment<br />
<pre><br />
doRunAODwithSelection=True<br />
<br />
and<br />
<br />
useTag=True<br />
</pre><br />
<br />
*Copy:<br />
<pre><br />
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .<br />
</pre><br />
*And run again. Note that only will run the events that satisfy the query:<br />
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000"<br />
<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
*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<br />
<br />
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time<br />
<br />
*Edit again Main_topOptions.py and change:<br />
<br />
<pre><br />
TheApp.EvtMax = 500<br />
<br />
to<br />
<br />
TheApp.EvtMax = 50<br />
</pre><br />
<br />
</pre><br />
*Comment out <br />
<pre><br />
#doRunAODwithSelection=True<br />
</pre><br />
<br />
*uncomment:<br />
<pre><br />
doRewriteAOD=True<br />
</pre><br />
<br />
and run once more<br />
<br />
<pre><br />
athena Main_topOptions.py | tee athenaOut.log<br />
</pre><br />
<br />
You'll see a new Zmumu_new_AOD.root file has been created<br />
<br />
==Event Selection using AAN==<br />
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:<br />
<br />
<br />
<br />
==Interactive Analysis in ATHENA==<br />
*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:<br />
<pre><br />
get_files Interactive_topO.py<br />
</pre><br />
<br />
*Edit Interactive_topO.py and replace this line<br />
<pre><br />
EventSelector.InputCollections = [ "AOD.pool.root" ]<br />
</pre><br />
*with this line:<br />
<pre><br />
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )<br />
</pre><br />
<br />
*run<br />
<pre><br />
athena -i Interactive_topO.py<br />
</pre><br />
*Initialize application manager<br />
<pre><br />
athena> theApp.initialize()<br />
</pre><br />
*Run 1 event<br />
<pre><br />
athena> theApp.nextEvent()<br />
</pre><br />
<br />
*Retrieve Muons from AOD<br />
<pre><br />
athena> mcon = PyParticleTools.getMuons("MuidMuonCollection")<br />
</pre><br />
<br />
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]<br />
<br />
*Number of Muons<br />
<pre><br />
athena> econ.size()<br />
</pre><br />
<br />
*Get the first muon<br />
<pre><br />
athena> m = mcon[0]<br />
</pre><br />
<br />
*Get a list of methods<br />
<pre><br />
athena> dir(m)<br />
</pre><br />
<br />
*See pT<br />
<pre><br />
athena> m.pt()<br />
</pre><br />
<br />
*Get TrackParticle via ElementLink<br />
<pre><br />
athena> tp = m.track()<br />
athena> dir(tp)<br />
</pre><br />
<br />
==Monte Carlo Truth Tools on AOD==<br />
*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<br />
<pre><br />
#include "TruthParticleAlgs/McVtxFilterTool.h"<br />
#include "TruthParticleAlgs/TruthParticleCnvTool.h"<br />
#include "AnalysisUtils/McVtxFilter.h"<br />
#include "ParticleEvent/TruthParticle.h"<br />
#include "ParticleEvent/TruthParticleContainer.h"<br />
</pre><br />
*with the following:<br />
<pre><br />
#include "McParticleTools/McVtxFilterTool.h"<br />
#include "McParticleTools/TruthParticleCnvTool.h"<br />
#include "McParticleUtils/McVtxFilter.h"<br />
#include "McParticleEvent/TruthParticle.h"<br />
#include "McParticleEvent/TruthParticleContainer.h"<br />
</pre><br />
*Also in your requirements file, you may need to add the following lines and redo cmt config and gmake:<br />
<pre><br />
cmt co -r McParticleTools McParticleTools-00-* PhysicsAnalysis/TruthParticleID<br />
cmt co -r McParticleUtils McParticleUtils-00-* PhysicsAnalysis/TruthParticleID<br />
cmt co -r McParticleEvent McParticleEvent-00-* PhysicsAnalysis/TruthParticleID<br />
</pre><br />
<br />
*Now follow this link, McTrtuh on AOD, make sure that you make the above modifications before running.<br />
<br />
==Analysis with the EventView==<br />
*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.<br />
<br />
== Analysis on the GRID ==<br />
* In the following examples we'll run on Zmumu datasets.<br />
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.<br />
<br />
*First we should set up DQ2 tools:<br />
<br />
<pre><br />
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN<br />
</pre><br />
<br />
==PANDA/PATHENA==<br />
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]<br />
*Setup PATHENA :<br />
<pre><br />
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis<br />
cvs update -r UserAnalysis-00-08-13 -A python<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena<br />
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util<br />
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py<br />
cd cmt<br />
source setup.sh<br />
gmake<br />
cd ../run<br />
</pre><br />
<br />
*run pathena<br />
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''<br />
<pre><br />
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \<br />
'user.GustavoOrdonezSanz.00008.AAN.root'<br />
</pre><br />
<br />
*For job estatus monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]<br />
<br />
==GANGA==<br />
*For further details vistit [https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga ganga wiki]<br />
*A very simple example of how to use panda move to your ${HOME} directory and do:<br />
<pre><br />
export PATH=$PATH:/afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/<br />
<br />
or <br />
<br />
setenv PATH /afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/:${PATH}<br />
</pre><br />
<br />
*Generate a ${HOME}/.gangarc with<br />
<pre><br />
ganga -g<br />
</pre><br />
<br />
*Edit $HOME/.gangarc as follows: <br />
<br />
1. In the section labelled [Configuration] add the line:<br />
<pre><br />
RUNTIME_PATH = GangaAtlas<br />
</pre><br />
2. In the section labelled [LCG] add the line:<br />
<pre><br />
VirtualOrganisation = atlas<br />
</pre><br />
<br />
*Now move to the run directory again and try this:<br />
<pre><br />
ganga<br />
</pre><br />
<br />
*Inside the Python interpreter:<br />
<pre><br />
j = Job()<br />
j.application=Athena()<br />
j.application.prepare()<br />
j.application.option_file='$HOME/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZmumuOnAOD_jobOptions.py'<br />
j.inputdata=DQ2Dataset()<br />
j.inputdata.type='DQ2_LOCAL'<br />
j.inputdata.dataset='csc11.005145.PythiaZmumu.recon.AOD.v11004103'<br />
j.outputdata=DQ2OutputDataset()<br />
j.outputdata.outputdata=['ZmumuOnAOD.aan.root']<br />
j.backend=LCG()<br />
j.submit()<br />
</pre><br />
<br />
==DQ2 Tools==<br />
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]<br />
*This tools make your life easier when working on the GRID<br />
<pre><br />
dq2_ls *Zmumu*AOD*<br />
</pre><br />
<br />
*change user.GustavoOrdonezSanz.00008.AAN.root for your own<br />
<pre><br />
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root<br />
</pre></div>Gusord