NIKHEF PAT workshop Oct2006
Pre-Tutorial
- This pre-Tutorial is copy of the one gave 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:
- 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
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 gamke cd .. mkdir run2 cd run2 cp ~ordonez/public/Workshop_files/data2/AnalysisSkeleton_jobOptions.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 Run directory:
cp ~ordonez/public/data/Main_topOptions.py . cp ~ordonez/public/data/ZmumuOnAOD_new_jobOptions.py .
Edit Main_topOptions.py and uncomment the line writeTAG=True
athena Main_topOptions.py | tee athenaOut.log
This will generate the file called ZmumuOnAOD_TAG.root
Event Selection with the TAG
- In this exercise, we will use the TAG to select the final states of interest. The data that we are contains Z to mumu so there is not must selection final state we can do with the TAG on this data but this exercise will give a flavor of what you can to with the TAG and how to it. Consider the following job options.
#################################################### #Author - Ketevi A. Assamagan AllAlgs = False doHist = False doCBNT = False doWriteTAG = False doWriteESD = False readAOD = True doAOD = False doWriteAOD = True # read the TAG as input to the job readColl = True # Number of Events EvtMax = 20 # Use the TAG that you just produce to select the events # define also the selection criteria include ( "mc11.004202.ZmumuJimmy.recon.TAG.v11000401.py" ) CollInputQuery="NLooseMuon>0 && NLooseMuon<3 && abs(LooseMuonEta1)<2.5 && abs(LooseMuonEta2)<2.5 && LooseMuonPt2>10000 && LooseMuonPt2>10000" #Create a new RDO, ESD and AOD that contain only selected events PoolAODOutput = "mc11.004202.ZmumuJimmy.recon.AOD.TagSel.v11000401.root" # main reconstruction job jobOptions include ("RecExCommon/RecExCommon_topOptions.py") #######################################################
- Create a file called TagBasedEventSelection_topOptions.py and copy the above options into it and save it. We are using the TAG file as input and selecting the events at the AOD level. Our selection criteria are defined in the CollInputQuery. We are querying for the events having:
Two one or 2 loose muons Eta of each loose muons within 2.5 Pt of 2 loose muons above 10 GeV - unit in MeV
- For the all the events that pass the selection, we create an AOD file that contains ONLY the selected events: for details on how to use the TAG and which TAG content or attributes you can make selection on, follow this link: TagForEventSelection. The new AOD file name should be mc11.004202.ZmumuJimmy.recon.AOD.TagSel.v11000401.root as specified in the above job options. To select events at the ESD level, one would simply add this lines:
readESD = True readAOD = False
- Now run this job options and see that you have a new AOD file that contains only the selected events. An easy and a quick way to see the TAG attributes is to just open the TAG file in ROOT and browse. Copy a sample TAG file from my area and open it in ROOT:
cp ~ordonez/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/TAG.fromAOD.pool.root . root TAG.fromAOD.pool.root new TBrowser
- Now you can do analysis on the new AOD that contains ONLY the selected events.
Event Selection with the AthenaAwareNTuple
- In this exercise, we will use the AthenaAwareNTuple that you produced in the introdcution: you should have an NTuple called AnalysisSkeleton.aan.root. Proceed as follows:
cp AnalysisSkeleton_jobOptions.py AanSelectionAnalysis_topOptions.py
- Edit AanSelectionAnalysis_topOptions.py and replace this line
include( "mc11.004201.ZeeJimmy.recon.AOD.v11000401.py" )
- with these lines
EventSelector.InputCollections = [ "AnalysisSkeleton.aan" ] EventSelector.Query="NElectrons>0 && NElectrons<3 && abs(ElectronEta[0])<2.5 && abs(ElectronEta[1])<2.5 && ElectronPt[0]>10000 && ElectronPt[1]>10000" EventSelector.CollectionType = "ExplicitROOT"
- Here, we are using the AthenaAwareNTuple called AnalysisSkeleton.aan.root to selected the event at the AOD. Then, we are run the Analysis code, AnalysisSkeleton.cxx on the selected events. Note that when you use the TAG or the AthenaAwareNTuple to event selection, the file extension .root must not be specified: it is assumed and will be appended. In these exercises, we are using the ROOT version of the TAG --- also, our AthenaAwareNTuple is a ROOT file. This is why we specify the CollectionType to be ExplicitROOT. There is also a database version of the TAG: for details see TagForEventSelection. In AanSelectionAnalysis_topOptions.py, replace these lines
THistSvc.Output = ["AANT DATAFILE='AnalysisSkeleton.aan.root' OPT='RECREATE'"] AANTupleStream.OutputName = 'AnalysisSkeleton.aan.root'
- with these lines:
THistSvc.Output = ["AANT DATAFILE='AnalysisSkeleton.sel.aan.root' OPT='RECREATE'"] AANTupleStream.OutputName = 'AnalysisSkeleton.sel.aan.root'
- Now run:
athena.py AanSelectionAnalysis_topOptions.py
- You should have a new AthenaAwareNTuple file called AnalysisSkeleton.sel.aan.root. That we've just done is the following: we use a previously available AthenaAwareNTuple or TAG to select events and we did analysis on the selected events creating a new AthenaAwareNTuple. We also saw that it is possible to create a new AOD that contains ONLY the selected events. Now check that the selection criteria that we specified above were indeed apply: open AnalysisSkeleton.sel.aan.root and plot the EventNumber and the NElectrons (this should be one or two) according to our selection criteria.
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.004100.T1_McAtNLO_top.recon.AOD.v11000401.py" )
- Then start the interactive analysis session from this link.
Monte Carlo Truth Tools on AOD
- 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
#include "TruthParticleAlgs/McVtxFilterTool.h" #include "TruthParticleAlgs/TruthParticleCnvTool.h" #include "AnalysisUtils/McVtxFilter.h" #include "ParticleEvent/TruthParticle.h" #include "ParticleEvent/TruthParticleContainer.h"
- with the following:
#include "McParticleTools/McVtxFilterTool.h" #include "McParticleTools/TruthParticleCnvTool.h" #include "McParticleUtils/McVtxFilter.h" #include "McParticleEvent/TruthParticle.h" #include "McParticleEvent/TruthParticleContainer.h"
- Also in your requirements file, you may need to add the following lines and redo cmt config and gmake:
cmt co -r McParticleTools McParticleTools-00-* PhysicsAnalysis/TruthParticleID cmt co -r McParticleUtils McParticleUtils-00-* PhysicsAnalysis/TruthParticleID cmt co -r McParticleEvent McParticleEvent-00-* PhysicsAnalysis/TruthParticleID
- Now follow this link, McTrtuh on AOD, make sure that you make the above modifications before running.
Analysis with the EventView
- 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.
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'
- For job estatus monitoring visit: Monitoring
GANGA
- For further details vistit ganga wiki
- A very simple example of how to use panda move to your ${HOME} directory and do:
export PATH=$PATH:/afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/ or setenv PATH /afs/cern.ch/sw/ganga/install/slc3_gcc323/4.2.0-beta7/bin/:${PATH}
- Generate a ${HOME}/.gangarc with
ganga -g
- Edit $HOME/.gangarc as follows:
1. In the section labelled [Configuration] add the line:
RUNTIME_PATH = GangaAtlas
2. In the section labelled [LCG] add the line:
VirtualOrganisation = atlas
- Now move to the run directory again and try this:
ganga
- Inside the Python interpreter:
j = Job() j.application=Athena() j.application.prepare() j.application.option_file='$HOME/scratch0/Workshop/12.0.2/PhysicsAnalysis/AnalysisCommon/UserAnalysis/run/ZmumuOnAOD_jobOptions.py' j.inputdata=DQ2Dataset() j.inputdata.type='DQ2_LOCAL' j.inputdata.dataset='csc11.005145.PythiaZmumu.recon.AOD.v11004103' j.outputdata=DQ2OutputDataset() j.outputdata.outputdata=['ZmumuOnAOD.aan.root'] j.backend=LCG() j.submit()
DQ2 Tools
- For furhter details visit DQ2 wiki
- This tools make your life easier when working on the GRID
dq2_ls *Zmumu*AOD*
- change user.GustavoOrdonezSanz.00008.AAN.root for your own
dq2_get -rv -d . user.GustavoOrdonezSanz.00008.AAN.root