Difference between revisions of "NIKHEF PAT workshop Oct2006"

From Atlas Wiki
Jump to navigation Jump to search
 
(120 intermediate revisions by one other user not shown)
Line 1: Line 1:
 +
==Pre-Tutorial==
  
==Set up CMT==
+
*This pre-Tutorial is copy of the one given by Ketevi A. Assamagan, adapted to work in 12.0.2
 +
 
 +
*here is a link to other Tutorials by Ketevi, and other usful PAT links:
 +
[https://twiki.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisTools, PAT]
 +
 
 +
*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
 +
 
 +
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/NIKHEF_PAT_workshop_Oct2006_pre-Tutorial Pre-Tutorial link]
 +
 
 +
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.
 +
 
 +
==Event Selection==
 +
First we're going to generate a new AAN that we'll use later for selection.
 +
<pre>
 +
cd ~scratch0/Workshop/
 +
source setup.sh -tag=12.0.2,opt
 +
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis
 +
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.
 +
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.
 +
cd cmt
 +
gmake
 +
cd ..
 +
mkdir run2
 +
cd run2
 +
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .
 +
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .
 +
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .
 +
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log
 +
</pre>
 +
 
 +
This will generate the file AnalysisSkeleton.aan.root.
 +
 
 +
==Event Selection using TAG==
 +
*First we generate our own TAG.
 +
 
 +
*Still in the new run2 directory:
  
* Login to lxplus at CERN and create a working directory called "Tutorial". We will use the release 12.0.2 this tutorial:
 
 
<pre>
 
<pre>
ssh lxplus.cern.ch
+
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .
cd scratch0
 
mkdir Tutorial
 
cd Tutorial
 
mkdir 12.0.2
 
 
</pre>
 
</pre>
  
* Create a file called "requirements" and setup CMT. My requirements file looks like this where my working area for 12.0.2 is ${HOME}/scratch0/Workshop/12.0.2:
+
*Edit Main_topOptions.py and uncomment the line
 
<pre>
 
<pre>
set  CMTSITE  CERN
+
### Create TAG file
set  SITEROOT /afs/cern.ch
+
doWriteTAG=True
macro ATLAS_DIST_AREA ${SITEROOT}/atlas/software/dist
+
</pre>
                     
 
macro ATLAS_GROUP_AREA "/afs/cern.ch/atlas/groups/PAT/Tutorial"
 
 
   
 
   
macro ATLAS_TEST_AREA "" \
+
<pre>
        12.0.2 "${HOME}/scratch0/Workshop/12.0.2"
+
athena Main_topOptions.py | tee athenaOut.log
 
 
apply_tag oneTest
 
 
use AtlasLogin AtlasLogin-* $(ATLAS_DIST_AREA)
 
 
</pre>
 
</pre>
  
*Then do the following:
+
*This will generate the file called ZmumuOnAOD_TAG.root
 +
 
 +
*Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:
 
<pre>
 
<pre>
source /afs/cern.ch/sw/contrib/CMT/v1r18p20060301/mgr/setup.sh
+
#doWriteTAG=True
cmt config
 
 
</pre>
 
</pre>
  
==Setup for the release 12.0.2==
+
*and uncomment
*Do the following:
 
 
<pre>
 
<pre>
source setup.sh -tag=12.0.2
+
doRunAODwithSelection=True
 +
 
 +
and
 +
 
 +
useTag=True
 
</pre>
 
</pre>
  
*Check that the CMT path is correct by doing this
+
*Copy:
 
<pre>
 
<pre>
echo $CMTPATH
+
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .
 
</pre>
 
</pre>
 +
*And run again. Note that only will run the events that satisfy the query:
 +
EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt1>10000 && LooseMuonPt2>10000"
 +
  
*Stuff like this should be printed to your screen:
 
 
<pre>
 
<pre>
/afs/cern.ch/user/o/ordonez/scratch0/Workshop/12.0.2:
+
athena Main_topOptions.py | tee athenaOut.log
/afs/cern.ch/atlas/software/builds/AtlasOffline/12.0.2
 
 
</pre>
 
</pre>
  
*You see that the path to your working directory, the path to the release directory and the external are set correctly - do not proceed unless this is done correctly.
+
*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
==Run Time Setup==
+
 
*Go to your working area and check out the follow package:
+
*Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time
 +
 
 +
*Edit again Main_topOptions.py and change:
 +
 
 
<pre>
 
<pre>
cd 12.0.2
+
TheApp.EvtMax = 500
cmt co -r UserAnalysis-00-08-05 PhysicsAnalysis/AnalysisCommon/UserAnalysis
+
 
 +
to
 +
 
 +
TheApp.EvtMax = 50
 
</pre>
 
</pre>
  
*Now compile everything as follows:
+
*Comment out
 
<pre>
 
<pre>
cd PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt
+
#doRunAODwithSelection=True
cmt config
 
source setup.sh
 
cmt broadcast gmake
 
cd ../run
 
 
</pre>
 
</pre>
  
*To test that everything has been done correctly, do:
+
*uncomment:
 
<pre>
 
<pre>
get_files HelloWorldOptions.py
+
doRewriteAOD=True
athena.py -b HelloWorldOptions.py
 
 
</pre>
 
</pre>
  
*Stuff like this should be printed to the screen:
+
and run once more
 +
 
 
<pre>
 
<pre>
HelloWorld          INFO execute()
+
athena Main_topOptions.py | tee athenaOut.log
HelloWorld          INFO An INFO message
 
HelloWorld          WARNING A WARNING message
 
HelloWorld          ERROR An ERROR message
 
HelloWorld          FATAL A FATAL error message
 
AthenaEventLoopMgr  INFO  ===>>>  end of event 9    <<<===
 
HistorySvc          INFO Service finalised successfully
 
ChronoStatSvc.f...  INFO  Service finalized succesfully
 
ToolSvc              INFO Removing all tools created by ToolSvc
 
ApplicationMgr      INFO Application Manager Finalized successfully
 
ApplicationMgr      INFO Application Manager Terminated successfully
 
 
</pre>
 
</pre>
  
==The Next Time You Login==
+
You'll see a new Zmumu_new_AOD_withTAGSelection.root file has been created
*The next time you login, just do the following:
+
 
 +
==Event Selection using AAN==
 +
*Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:
 +
ZmumuOnAOD_withAANSelection.aan.root
 +
Zmumu_new_AOD_withAANSelection.root
 +
 
 +
==Interactive Analysis in ATHENA==
 +
*In this exercise, we will see how to do interactive analysis in ATHENA, how to browse the Raw Data in the AOD. Proceed as follows:
 
<pre>
 
<pre>
cd ${HOME}/scratch0/Workshop
+
get_files Interactive_topO.py
source setup.sh -tag=12.0.2
 
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt
 
source setup.sh
 
cd ../run
 
 
</pre>
 
</pre>
  
==Get The Necessary Files==
+
*Edit Interactive_topO.py and replace this line
*We will use inclusive Z to mumu events (sample 4202), digitized in 11.0.41 but the ESD and AOD produced in the release 12.0.1. Copy the PoolFileCatalog.xml for the AOD, ESD and Raw Data (RDO) into your UserAnalysis "run" directory:
 
 
<pre>
 
<pre>
cp ~ordonez/scratch0/Workshop/12.0.2/data/PoolFileCatalog.xml .
+
EventSelector.InputCollections = [ "AOD.pool.root" ]
cp ~ordonez/scratch0/Workshop/12.0.2/data/*.py .
 
 
</pre>
 
</pre>
 
+
*with this line:
==Run the AnalysisSkeleton for 500 Events==
 
*get the necessary job options file from the release:
 
 
<pre>
 
<pre>
get_files AnalysisSkeleton_jobOptions.py
+
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )
 
</pre>
 
</pre>
  
*Edit AnalysisSkeleton_jobOptions.py and specify the input data to be the AOD files that you just copied in the previous step: to do this, replace these lines
+
*run
 
<pre>
 
<pre>
EventSelector.InputCollections = [
+
athena -i Interactive_topO.py
  "AOD.pool.root"
 
                                ]
 
 
 
 
</pre>
 
</pre>
*with this line
+
*Initialize application manager
 
<pre>
 
<pre>
include( "mc11.004201.ZeeJimmy.recon.AOD.v11000401.py" )
+
athena>theApp.initialize()
 
</pre>
 
</pre>
*Check that in AnalysisSkeleton_jobOptions.py, the number of events to run is set to 500:
+
*Run 1 event
 
<pre>
 
<pre>
# Number of Events to process
+
athena>theApp.nextEvent()
theApp.EvtMax = 500
 
 
</pre>
 
</pre>
*Now run the AnalysisSkeleton_jobOptions.py. It should produce a file called AnalysisSkeleton.aan.root which contains some ROOT histograms and an AthenaAwareNTuple:
+
 
 +
*Retrieve Muons from AOD
 
<pre>
 
<pre>
athena.py AnalysisSkeleton_jobOptions.py | tee athenaout.log
+
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")
 
</pre>
 
</pre>
*You've just produced the AthenaAwareNTuple in a standalone way, directly on the AOD, or the ESD or even on the RDO. For Further details on how to produce the AthenaAwareNTuple in this way, follow this link: AthenaAwareNTuple.
 
  
*Now, you may look at the the AnalysisSkeleton.h, the AnalysisSkeleton.cxx and AnalysisSkeleton_jobOptions.py to see how the ROOT histograms and the AthenaAwareNTuple of the output file AnalysisSkeleton.aan.root are defined, filled and saved: Follow this link to the AnalysisSkeleton. For further details on how to produces ROOT histograms and Tuples in ATHENA, look at the THistSvc.
+
*Other methods are defined in [http://tmaeno.home.cern.ch/tmaeno/PyParticleTools/index.html PyParticleTools]
  
*You should open the output file AnalysisSkeleton.aan.root in ROOT and browse the histograms and the AthenaAwareNTuple:
+
*Get the first muon
 
<pre>
 
<pre>
root AnalysisSkeleton.aan.root
+
athena>m = mcon[0]
new TBrowser
 
 
</pre>
 
</pre>
*You will notice that beside the user-defined NTuple, the AthenaAwareNTuple tools add references to the AOD, ESD and Raw Data, in addition the RunNumber and the EventNumber.
 
  
==More Information==
+
*Get a list of methods
*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 StoregateKeysForESD, StoregateKeysForAOD and TagForEventSelection.
+
<pre>
 +
athena>dir(m)
 +
</pre>
  
==Z to mumu on AOD==
+
*See pT
*In this exercise, we will do Z to mumu reconstruction on AOD: we will use the association objects Analysis::Muon and its associated TrackParticle. Proceed as follows: copy the code from my area, compiling and running it, then we go through it:
 
 
<pre>
 
<pre>
cd ../src
+
athena>m.pt()
cp ~ordonez/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/src/ZmumuOnAOD.cxx .
 
cd ../UserAnalysis
 
cp ~ordonez/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/UserAnalysis/ZmumuOnAOD.h .
 
cd ../run
 
cp ~ordonez/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZmumuOnAOD_jobOptions.py .
 
 
</pre>
 
</pre>
  
*Now, you want to go the src/components directory and declare this new algorithm ZmumuOnAOD.
+
*Get TrackParticle via ElementLink
 
<pre>
 
<pre>
cd ../src/components
+
athena>tp = m.track()
 +
athena>dir(tp)
 +
athena>tp.pt()
 
</pre>
 
</pre>
  
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:
+
*Retrieve the MC Truth
 
<pre>
 
<pre>
#include "UserAnalysis/ZmumuOnAOD.h"
+
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")
 +
athena>mc = mcc[0]
 +
athena>mc.alphaQCD()
 +
</pre>
  
DECLARE_ALGORITHM_FACTORY( ZmumuOnAOD )
+
*Dump Data Store
 +
<pre>
 +
athena>dumpSG()
 +
</pre>
  
  DECLARE_ALGORITHM( ZmumuOnAOD )
+
*Run next event
 +
<pre>
 +
athena>theApp.nextEvent()
 
</pre>
 
</pre>
  
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:
+
Rewind event counter
 
<pre>
 
<pre>
cd ../../cmt
+
athena>theApp.seek(0)
cp ~ordonez/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt/requirements .
 
cmt config
 
cmt broadcast gmake
 
cd ../run
 
 
</pre>
 
</pre>
*Now you may run the ZmumuOnAOD algorithm as follows:
+
 
 +
*See pT distribution of muons
 
<pre>
 
<pre>
athena.py ZmumuOnAOD_jobOptions.py
+
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)
 
</pre>
 
</pre>
  
*This should produce an AthenaAwareNTuple file, ZmumuOnAOD.aan.root. While Athena is running, let's go through the code by following this link: ZmumuOnAOD for the details of the algorithm and the selection cuts.
 
  
*Now, open this file in ROOT and browse the AthenaAwareNTuple:
+
 
 +
==Analysis with the EventView==
 +
*Due to the time I won't cover this section during the Workshop. But now you should have the basic knowledge requiered to understand it. You can learn about the [https://twiki.cern.ch/twiki/bin/view/Atlas/EventView Event View] here
 +
 
 +
== Analysis on the GRID ==
 +
* In the following examples we'll run on Zmumu datasets.
 +
*This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.
 +
 
 +
*First we should set up DQ2 tools:
 +
 
 
<pre>
 
<pre>
root -l
+
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN
TFile *f = TFile::Open("ZmumuOnAOD.aan.root")
 
new TBrowser
 
TTree * zmumuOnAOD=(TTree*) gDirectory->Get("CollectionTree");
 
zmumuOnAOD->SetMarkerStyle(20)
 
zmumuOnAOD->SetMarkerSize(0.5)
 
zmumuOnAOD->SetMarkerColor(2)
 
zmumuOnAOD->SetLineColor(4)
 
zmumuOnAOD->SetLineWidth(2)
 
zmumuOnAOD->Draw("ZmmMass")
 
 
</pre>
 
</pre>
*By default, we used the Muonboy/STACO/MuTag association objects in the AOD and the associated TrackParticles. But you may change it in the job options ZmumuOnAOD_jobOptions.py: the StoreGate keys for the various objects in the AOD are listed here: StoregateKeysForAOD.
 
  
*Exercise: add a piece code to access the number of hits in the various stations of the Inner Detector and the Muon Spectrometer. Recompile, and run. Then in ROOT look at the NTuple in ROOT and check that the distributions look OK.
+
==PANDA/PATHENA==
 
+
*For further details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/DAonPanda panda wiki]
 
+
*Setup PATHENA :
==Z to ee on AOD==
 
*In this exercise, we will do Z to ee reconstruction on AOD: we will use the association objects Electron/Photon and its associated Electron TrackParticle. Proceed as follows: copy the code from my area, compiling and running it, then we go through it:
 
 
<pre>
 
<pre>
cd ../src
+
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis
cp ~ordonez/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/src/ZeeOnAOD.cxx .
+
cvs update -r UserAnalysis-00-08-13 -A python
cd ../UserAnalysis
+
cvs update -r UserAnalysis-00-08-13 -A share/pathena
cp ~ordonez/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/UserAnalysis/ZeeOnAOD.h .
+
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util
 +
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py
 +
cd cmt
 +
source setup.sh
 +
gmake
 
cd ../run
 
cd ../run
cp ~ordonez/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZeeOnAOD_jobOptions.py .
 
 
</pre>
 
</pre>
  
*Now, you want to go the src/components directory and declare this new algorithm ZeeOnAOD.
+
*run pathena
 +
Note: '''change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!'''
 
<pre>
 
<pre>
cd ../src/components
+
pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \
 +
'user.GustavoOrdonezSanz.00008.AAN.root'
 
</pre>
 
</pre>
  
*Edit UserAnalysis_entries.cxx and add these lines - follow the example that is already in there for the AnalysisSkeleton:
+
*For job status monitoring visit: [http://gridui02.usatlas.bnl.gov:25880/server/pandamon/query Monitoring]
<pre>
 
#include "UserAnalysis/ZeeOnAOD.h"
 
  
DECLARE_ALGORITHM_FACTORY( ZeeOnAOD )
 
  
  DECLARE_ALGORITHM( ZeeOnAOD )
 
</pre>
 
  
*Save UserAnalysis_entries.cxx and go back the cmt directory and compile:
+
==DQ2 Tools==
 +
*For furhter details visit [https://twiki.cern.ch/twiki/bin/view/Atlas/UsingDQ2 DQ2 wiki]
 +
*This tools make your life easier when working on the GRID
 
<pre>
 
<pre>
cd ../../cmt
+
dq2_ls *Zmumu*AOD*
cmt config
 
cmt broadcast gmake
 
cd ../run
 
 
</pre>
 
</pre>
  
*Now you may run the ZeeOnAOD algorithm as follows:
+
*Have a look at the files contained in one of the sets
 
<pre>
 
<pre>
athena.py -b ZeeOnAOD_jobOptions.py
+
dq2_ls -f <datasetname>
 
</pre>
 
</pre>
  
*This should produce an AthenaAwareNTuple file, ZeeOnAOD.aan.root. While Athena is running, let's go through the code by following this link: ZeeOnAOD for the details of the algorithm and the selection cuts.
+
*change user.GustavoOrdonezSanz.00008.AAN.root for your own
 
 
*Now, open this file in ROOT and browse the AthenaAwareNTuple:
 
 
<pre>
 
<pre>
root
+
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root
TFile *_file0 = TFile::Open("ZeeOnAOD.aan.root")
 
new TBrowser
 
TTree * zmumuOnAOD=(TTree*) gDirectory->Get("CollectionTree");
 
zeeOnAOD->SetMarkerStyle(20)
 
zeeOnAOD->SetMarkerSize(0.5)
 
zeeOnAOD->SetMarkerColor(2)
 
zeeOnAOD->SetLineColor(4)
 
zeeOnAOD->SetLineWidth(2)
 
zeeOnAOD->Draw("ZeeMass")
 
ZeeOnAOD->Draw("ElectronIsEM")
 
 
</pre>
 
</pre>
  
*The StoreGate keys for the various objects in the AOD are listed here: StoregateKeysForAOD.
+
==Ganga==
 +
We're not going to cover Ganga in this tutorial. But for reference look at:[https://twiki.cern.ch/twiki/bin/view/Atlas/DistributedAnalysisUsingGanga Ganga link]
 +
 
 +
==Final Exercice==
 +
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.
  
*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.
+
Good luck!

Latest revision as of 09:08, 25 October 2006

Pre-Tutorial

  • This pre-Tutorial is copy of the one given by Ketevi A. Assamagan, adapted to work in 12.0.2
  • here is a link to other Tutorials by Ketevi, and other usful PAT links:

PAT

  • 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

Pre-Tutorial link

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.

Event Selection

First we're going to generate a new AAN that we'll use later for selection.

cd ~scratch0/Workshop/
source setup.sh -tag=12.0.2,opt
cd 12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis
cp ~ordonez/public/Workshop_files/src/AnalysisSkeleton.cxx src/.
cp ~ordonez/public/Workshop_files/UserAnalysis/AnalysisSkeleton.h UserAnalysis/.
cd cmt
gmake
cd ..
mkdir run2
cd run2
cp ~ordonez/public/Workshop_files/run2/AnalysisSkeleton_jobOptions.py .
cp ~ordonez/public/Workshop_files/data2/PoolFileCatalog.xml .
cp ~ordonez/public/Workshop_files/data2/mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py .
athena AnalysisSkeleton_jobOptions.py | tee athenaOut_AnalysisSkeleton.log

This will generate the file AnalysisSkeleton.aan.root.

Event Selection using TAG

  • First we generate our own TAG.
  • Still in the new run2 directory:
cp ~ordonez/public/Workshop_files/run2/Main_topOptions.py .
  • Edit Main_topOptions.py and uncomment the line
### Create TAG file
doWriteTAG=True
athena Main_topOptions.py | tee athenaOut.log
  • This will generate the file called ZmumuOnAOD_TAG.root
  • Now we are ready to run our algorithms with a TAG selection on the fly. Edit Main_topOptions.py again comment out:
#doWriteTAG=True 
  • and uncomment
doRunAODwithSelection=True

and

useTag=True
  • Copy:
cp ~ordonez/public/Workshop_files/run2/ZmumuOnAOD_new_jobOptions.py .
  • And run again. Note that only will run the events that satisfy the query:

EventSelector.Query = "NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt1>10000 && LooseMuonPt2>10000"


athena Main_topOptions.py | tee athenaOut.log
  • 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
  • Now we'll rewrite our own AOD containeing only the events selected. We'll do it for only 50 events to gain some time
  • Edit again Main_topOptions.py and change:
TheApp.EvtMax = 500

to

TheApp.EvtMax = 50
  • Comment out
#doRunAODwithSelection=True
  • uncomment:
doRewriteAOD=True

and run once more

athena Main_topOptions.py | tee athenaOut.log

You'll see a new Zmumu_new_AOD_withTAGSelection.root file has been created

Event Selection using AAN

  • Follow as in the previous section but useANN=True instead of useTAG=True. In the end you should have the following two files:

ZmumuOnAOD_withAANSelection.aan.root Zmumu_new_AOD_withAANSelection.root

Interactive Analysis in ATHENA

  • In this exercise, we will see how to do interactive analysis in ATHENA, how to browse the Raw Data in the AOD. Proceed as follows:
get_files Interactive_topO.py
  • Edit Interactive_topO.py and replace this line
EventSelector.InputCollections = [ "AOD.pool.root" ]
  • with this line:
include ( "mc11.004202.ZmumuJimmy.recon.AOD.v11000401.py" )
  • run
athena -i Interactive_topO.py
  • Initialize application manager
athena>theApp.initialize()
  • Run 1 event
athena>theApp.nextEvent()
  • Retrieve Muons from AOD
athena>mcon = PyParticleTools.getMuons("MuidMuonCollection")
  • Get the first muon
athena>m = mcon[0]
  • Get a list of methods
athena>dir(m)
  • See pT
athena>m.pt()
  • Get TrackParticle via ElementLink
athena>tp = m.track()
athena>dir(tp)
athena>tp.pt()
  • Retrieve the MC Truth
athena>mcc = PyTruthTools.getMcEvents("TruthEvent")
athena>mc = mcc[0]
athena>mc.alphaQCD()
  • Dump Data Store
athena>dumpSG()
  • Run next event
athena>theApp.nextEvent()

Rewind event counter

athena>theApp.seek(0)
  • See pT distribution of muons
athena> plot("MuonContainer#MuidMuonCollection","$x.pt()",nEvent=5)


Analysis with the EventView

  • Due to the time I won't cover this section during the Workshop. But now you should have the basic knowledge requiered to understand it. You can learn about the Event View here

Analysis on the GRID

  • In the following examples we'll run on Zmumu datasets.
  • This will be a brief introduction to GRID tools for those of you who already went through the trouble of getting a GRID certificate.
  • First we should set up DQ2 tools:
source /afs/usatlas.bnl.gov/Grid/Don-Quijote/dq2_user_client/setup.csh.CERN

PANDA/PATHENA

  • For further details visit panda wiki
  • Setup PATHENA :
cd ~/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis
cvs update -r UserAnalysis-00-08-13 -A python
cvs update -r UserAnalysis-00-08-13 -A share/pathena
cvs update -r UserAnalysis-00-08-13 -A share/pathena_util
cvs update -r UserAnalysis-00-08-13 -A share/ConfigExtractor.py
cd cmt
source setup.sh
gmake
cd ../run
  • run pathena

Note: change user.GustavoOrdonezSanz.00008.AAN.root with an appropiate name!!

pathena ZmumuOnAOD_jobOptions.py --inDS 'csc11.005145.PythiaZmumu.recon.AOD.v11004103' --outDS \
'user.GustavoOrdonezSanz.00008.AAN.root'


DQ2 Tools

  • For furhter details visit DQ2 wiki
  • This tools make your life easier when working on the GRID
dq2_ls *Zmumu*AOD*
  • Have a look at the files contained in one of the sets
dq2_ls -f <datasetname>
  • change user.GustavoOrdonezSanz.00008.AAN.root for your own
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root

Ganga

We're not going to cover Ganga in this tutorial. But for reference look at:Ganga link

Final Exercice

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.

Good luck!