AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in ...

58
AOD Tutorial, March 10, 2005 M. Wielers, RAL 1 AOD Tutorial These slides can be found in ppt in http://hepunx.rl.ac.uk/atlasuk/simulation/ level2/egamma/tutorial/ Tutorial_AOD_100305.ppt In pdf http://hepunx.rl.ac.uk/atlasuk/simulation/ level2/egamma/tutorial/ Tutorial_AOD_100305.pdf

Transcript of AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in ...

Page 1: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 1

AOD Tutorial

These slides can be found in ppt inhttp://hepunx.rl.ac.uk/atlasuk/simulation/level2/egamma/tutorial/Tutorial_AOD_100305.ppt

In pdfhttp://hepunx.rl.ac.uk/atlasuk/simulation/level2/egamma/tutorial/Tutorial_AOD_100305.pdf

Page 2: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 2

AOD TutorialOutline

Transferring files via DonQuixoteExercise 1:

Copy a file via DonQuixoteOverview of ESD/AOD productionInteractive AOD sessionExercise 2:

Basic set-upExercise 3:

Look at AOD interactivelyExercise 4:

Basic set-up retrieve electron container and plot some quantities

Useful tools four-momentum, particle, navigableExercise 5:

plot invariant Z-massSome more useful toolsExercise 6:

Use some tools to plot Z-mass

Page 3: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 3

Transferring files via DonQuixoteMost of ESD/AOD prod for Rome will be centrally produced via GRIDTo find out about the Status of Rome productions and available samples

https://uimon.cern.ch/twiki/bin/view/Atlas/RomeStatusWikihttp://atlfarm003.mi.infn.it/%7Enegri/rome_dataset.htm

Files can be transferred via DonQuixotehttps://uimon.cern.ch/twiki/bin/view/Atlas/RomeGetFilesWiki

What is itATLAS Experiment Data Management System integrate all Grid data management services used by ATLASprovide production managers and physicists access to file-resident event data implementing data flow as defined by the ATLAS Computing Model In short: mean to access “official” ATLAS data produced on the GRID

Documentation how to use it inhttps://uimon.cern.ch/twiki/bin/view/Atlas/DonQuijoteEndUserClient

To transfer files you need a GRID certificate and be registered with ATLAS VOYou can install DonQuixote in your lab on a machine with GRID UI

Page 4: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 4

Basic GRID set-upAt CERN lxplus can act as a GRID machineTo be able to run there we have to export the keys and get them on lxplus

This was the exercise to do prior to the tutorial. If you havn’t done so, follow the instructions and watch over someone else’s shoulderhttp://www.grid-support.ac.uk/ca/user-documentation/uk-esc-documentation.pdfhttp://msmizans.home.cern.ch/msmizans/production/dc2/grid0.html

To enable your lxplus session to act as UI source /afs/cern.ch/project/gd/LCG-share/2.3.0/sl3/etc/

profile.d/grid_env.sh source /afs/cern.ch/project/gd/LCG-share/2.3.0/rh73/etc/

profile.d/grid_env.shObtain temporary grid proxy certificate

grid-proxy-init -valid Hours:Minutes (if you don’t give the time, you’ll get 8h)

At the end of your session grid-proxy-destroy

Page 5: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 5

Export your key to CERNFollow indications “how to export your key” in

http://www.grid-support.ac.uk/ca/user-documentation/uk-esc-documentation.pdf

Then let’s install it to CERN (instructions in web page out-dated, so let’s do it together)

http://msmizans.home.cern.ch/msmizans/production/dc2/grid0.htmlLog on lxplus7 and in your home directory, do the following, assuming the key is called: MyKeys.pfx

source /afs/cern.ch/project/gd/LCG-share/2.3.0/rh73/etc/ profile.d/grid_env.sh

openssl pkcs12 -in MyKeys.pfx -clcerts -nokeys -out usercert.pem

openssl pkcs12 -in MyKeys.pfx -nocerts -out userkey.pem chmod 400 userkey.pem chmod 444 usercert.pem mkdir .globus/ mv *.pem .globus/

Page 6: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 6

How to use DonQuixote at CERNSet up lxplus7 to act as GRID UI and identify yourself to the grid

Note: DonQuixote version 2 only works under RH7, version 3 about to come

source /afs/cern.ch/project/gd/LCG-share/2.3.0/rh73/etc/ profile.d/grid_env.sh

grid-proxy-initThe python script you need to use is installed at CERN

/afs/cern.ch/atlas/offline/external/DQClient/dms2/dms2.py Basic commands you are likely to use are:

Search for a dataset dms2.py search ‘rome.003025.digit.B4_jets17filter*’ dms2.py search ‘rome.003025.digit.B4_jets17filter*’ > dijet.out

(more convenient)Copy data to castor (for LCG files)

dms2.py get ‘rome.003025.digit.B4_jets17filter._02010.pool.root’ -–remote

dms2.py get ‘rome.003025.digit.B4_jets17filter*’ --copy –-remote -–multiple

For files from grid3 or NorduGrid (ng) dms2.py –g grid3 or dms2.py –g ng

Page 7: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 7

Exercise 1: copy a file via GridInstall your GRID key at CERNExecute the grid-initOk, let’s try to see which files for dataset “rome.003025.digit.B4_jets17filter*’” was producedNow copy one of the files to CERN

Note: in the CERN setup the datafile will automatically end up in the castor grid directory

/castor/cern.ch/grid/atlas/datafiles/<prod>/<type><prod> = dc1, dc2, rome<type> = evgen, simul, digit, reco

Note: at the end of the copy there will be some error messages, however, the copy probably worked

Check you see it in the castor directoryDon Quixote is a bit buggy, so sometimes you have to try again, some datasets such as digitcalib doesn’t seem to be accepted by the tool. Very likely we don’t have to worry for the large scale AOD Rome productions

The files will be available at CERN from a castor scratch area

Page 8: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 8

Brief Overview of ESD/AOD productionESD : Event Summary Data

Detailed output of reconstructionContains main reconstruction objects, such a EM clusters, track particles, muons, taus, jets… Gives as well list of cells belonging to a cluster, space-points belonging to a track….Thus refinements of combined reco. e.g. particle id, track refitting, jet calibration possibleThings such as re-doing pattern recognition, re-calibration of cells not possible

AOD: Analysis Object DataOnly necessary information to perform most analysis availabledata organised into analysis objects whose classes have physical meaning

Electron, photon, jet, tau, muon, …Also TrackParticle

essential aspect is truth association, which directly links the original Monte Carlo data to the reconstructed objectsAOD is formed from the ESD through the use of AOD BuildersBack-navigation to ESD information possible

Page 9: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 9

Page 10: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 10

Page 11: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 11

Page 12: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 12

LVL1 calo variables, LVL2 calo + track variables

Page 13: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 13

How to produce an ESDSome pre-defined jobOptions available

get_files optRecExtoESD.py

OptRectoESD.py doWriteESD = True # ESD persistency flag DetDescrVersion = "Rome-Initial" # Detector description EvtMax = 5 #number of Event to process doCBNT = False # suppress ntuple doHist = False # suppress histos PoolRDOInput = ["rfio:/castor/cern.ch/xxxx/ MyAOD.pool.root" ] # the input raw data file PoolESDOutput = “ESD.pool.root” # output ESD name

To run athena.py optRecExToESD.py ../share/RecExCommon_topOptions.py

Similar you can run together with the Trigger_forRecExCommon_jobOptions.py file from the TriggerRelease area and produce an ESD with offline and trigger information

Page 14: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 14

How to produce an AODSome pre-defined jobOptions available

get_files optESDtoAOD.py athena optESDtoAOD.py ../share/RecExCommon_topOptions.py

OptESDtoAOD.py AllAlgs = False # Do not re-run the reco. readESD = True # Read the ESD doWriteAOD = True # AOD persistency output DetDescrVersion = "Rome-Initial" # Detector description doHist = False # suppress histograms PoolESDInput = [ "ESD.pool.root" ] # ESD input file PoolAODOutput = "AOD.pool.root“ # AOD output file from AthenaCommon.DetFlags import DetFlags # Detector Flags DetFlags.detdescr.ID_setOn() DetFlags.detdescr.Calo_setOn() DetFlags.detdescr.Muon_setOn() # switch AOD streaming - we are not interested in that here from ParticleEventAthenaPool.AODFlags import AODFlags AODFlags.Streaming = False

Page 15: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 15

How to produce an AODIn addition something similar exists for ATLFAST

I don’t think we should try to do this here, but have a look athttp://www.usatlas.bnl.gov/PAT/tutorial904.html#Prod_ESD_AOD

Page 16: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 16

Ok, let’s try to look at an AOD and do basic set-up

This tutorial is based on release 10Though AOD’s are from 9.0.4Not everything can be tested due to changes in persistified classes

E.g. back navigation doesn’t work Let’s start with the basic set-upAsk for Release 10.0.0 in cmt requirements file

source /afs/cern.ch/sw/contrib/CMT/v1r16p20040901/mgr/setup.sh cmt config source setup.sh –tag=opt

create Tutorial area (where ever it’s convenient)cd to your tutorial area

cmt co -r UserAnalysis-00-02-00 PhysicsAnalysis/AnalysisCommon/UserAnalysis

cmt co Control/AthenaServices cd PhysicsAnalysis/AnalysisCommon/UserAnalysis/ UserAnalysis-00-02-

00/src cp ~mwielers/maxidisk/tutorial_files/AnalysisSkeleton.cxx . cd ../UserAnalysis

Page 17: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 17

Exercise 2: Basic set-up for tutorial cp ~mwielers/maxidisk/tutorial_files/AnalysisSkeleton.h . cd ../cmt Add AthenaServices to your requirements

Use AthenaServices AthenaServices-* Control cmt bro cmt config source setup.sh cmt bro gmake cd ../run cp ~mwielers/maxidisk/tutorial_files/PoolFileCatalog.xml . get_files PDGTABLE.MeV cp ~mwielers/maxidisk/tutorial_files/AnalysisSkeleton_jobOptions.py . cp ~mwielers/maxidisk/tutorial_files/zee.aod.py .

Let’s look at an ESD and AOD by just opening the pool file and see what persistified object are in there

Open ESD file with root~mwielers/maxidisk/tutorial_files/ESD.pool.rootDo you see some trigger stuff?

Open AOD file with root~mwielers/maxidisk/tutorial_files/AOD.pool.root

Page 18: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 18

Interactive AOD sessionUnfortunately it only works under RH73 and doesn’t run out of the box in 10

cmt co Control/AthenaServices (already done)Only works on AOD’s not directly on ESD’s (though possible via back-navigation)

get_files -jo Interactive_topO.py pool_insertFileToCatalog

/afs/cern.ch/user/m/mwielers/maxidisk/tutorial_files/AOD.pool.rootedit the jobO (if needed)

e.g., change input file EventSelector.InputCollections = [ "AOD.pool.root" ]

To EventSelector.InputCollections = [

“/afs/cern.ch/user/m/mwielers/maxidisk/tutorial_files/AOD.pool.root" ]Or

EventSelector.InputCollections = [ “rfio/castor/cern.ch/user/m/mwielers/aod/AOD.pool.root" ]

EventSelector.InputCollections = ["AOD.pool_1.root“, “AOD.pool_2.root”]

Page 19: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 19

start an interactive session athena -i Interactive_topO.py -l FATAL Don’t forget -i option!! MCTruth::TruthStrategyManager: registered strategy DMuonCatchAll MCTruth::TruthStrategyManager: registered strategy IDETIonization MCTruth::TruthStrategyManager: registered strategy IDETDecay MCTruth::TruthStrategyManager: registered strategy IDETConversion MCTruth::TruthStrategyManager: registered strategy IDETBrems MCTruth::TruthStrategyManager: registered strategy CALOCatchAll ==> New TileCablingService created Loaded dictionary PyAnalysisCoreDict Loaded dictionary PyParticleToolsDict Loaded dictionary PyTriggerToolsDict Loaded dictionary PyKernelDict

Initialize application manager athena> theApp.initialize()

Run 1 event athena> theApp.nextEvent()

Page 20: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 20

Basic commands in interactive AOD session

Retrieve ElectronCollection athena> econ = PyParticleTools.getElectrons("ElectronCollection")

where “ElectronCollection” is key name in the StoreGate. Other methods are defined in PyParticleTools e.g., for Muon, PyParticleTools.getMuons(”MuonCollection”)

Number of electrons athena> len(econ) 5

Get the first electron athena> e = econ[0]

See pT athena> e.pt() 33299.1563339692

Create and fill a ROOT histogram on the fly: plot("ElectronContainer#ElectronCollection","$x.pt()",nEvent=5)

nEvent has to be less than the number of events in the file… Only works once, then you’re at the end of the file and we don’t know how to re-start, unless you re-start your interactive session

Page 21: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 21

Get a list of methods athena> dir(e) ['Electron', 'Navigable', 'P4EEtaPhiM', '_C_instance', '_C_metaclass',

'__class__', '__del__', '__delattr__', '__dict__', '__doc__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__', '_empty_instance', '_made_in_Python', 'author', 'begin', 'charge', 'contains', 'cosTh', 'cotTh', 'd0wrtPrimVtx', 'dataType', 'e', 'eg', 'end', 'et', 'eta', 'fillToken', 'getContainer', 'getEgammaWeight', 'getIndex', 'getParameter', 'hasCharge', 'hasPdgId', 'hasTrack', 'hlv', 'iPt', 'isEM', 'm', 'm_author', 'm_charge', 'm_constituents', 'm_dataType', 'm_e', 'm_eta', 'm_hasCharge', 'm_hasPdgId', 'm_hasTrack', 'm_isEM', 'm_m', 'm_origin', 'm_parameters', 'm_pdgId', 'm_phi', 'm_track', 'numberOfBLayerHits', 'numberOfPixelHits', 'numberOfSCTHits', 'numberOfTRTHighThresholdHits', 'numberOfTRTHits', 'origin', 'p', 'parameter', 'pdgId', 'phi', 'pt', 'putElement', 'px', 'py', 'pz', 'remove', 'removeAll', 'set4Mom', 'setE', 'setEta', 'setM', 'setPhi', 'set_all', 'set_charge', 'set_dataType', 'set_eg', 'set_isEM', 'set_origin', 'set_parameter', 'set_pdgId', 'set_track', 'sinTh', 'size', 'track', 'z0wrtPrimVtx', '~Electron', '~I4Momentum', '~INavigable', '~INavigable4Momentum', '~IParticle', '~Navigable', '~P4EEtaPhiM', '~P4EEtaPhiMBase', '~ParticleBase']Unfortunately you don’t just see the members, but as well all method provided by the class

Page 22: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 22

See AOD contents using PyPoolBrowser athena> include ("PyAnalysisExamples/PyPoolBrowser.py")

 double-click “/”

click “+” of ElectronCollection → “+” on 0 → double click on “pt”, then you will see a histogram for pT distribution of electrons

Doesn’t really work in 9.0.4

Be patient… very slowUnfortunately only works on AOD’s right now, not on ESD’sUse Ctrl-D to exit

Page 23: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 23

Exercise 2: Interactive AOD session

Do basic set-up Run interactive AOD session and try out some of the commands

For more examples/possibilities, seehttp://tmaeno.home.cern.ch/tmaeno/Inter.htmAllows navigation via ElementLink

going from electron track track quantitiesAllows navigation back to ESD

e.g. electron egammaObject in ESD

Page 24: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 24

How to access the ContainerJust as you do in the reconstruction

Retrieve via StoreGate

Example: std::string m_electronContainerName = "ElectronCollection"; ... const ElectronContainer* elecTES; sc=m_storeGate->retrieve( elecTES, m_electronContainerName ); if( sc.isFailure() || !elecTES ) { mLog << MSG::WARNING << "No AOD electron container" <<

endreq; return StatusCode::SUCCESS; } mLog << MSG::DEBUG << "ElectronContainer retrieved" << endreq; ... // iterators over the container ElectronContainer::const_iterator elecItr = elecTES->begin();

ElectronContainer::const_iterator elecItrE = elecTES->end(); for (; elecItr != elecItrE; ++elecItr) { double pT = (*elecItr)->pt(); ...

Page 25: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 25

StoreGate keys for AOD Container (1)

Container Name Name of collection commentElectronContainer ElectronCollectionPhotonContainer PhotonCollectionMuonContainer MuonCollectionTauJetContainer TauJetCollectionBJetContainer BCandidates to be removed

after 10.0.0JetTagContainer BJetCollection since 10.0.0ParticleJetContainer ParticleJetContainer up to

9.4.0/9.0.4ParticleJetContainers KtTowerParticleJets,

Cone4TowerParticleJets, ConeTowerJets

since 10.0.0

Missing Et object MET_BaseMissing Et calibrated object

MET_Calib

Missing Et Truth object MET_TruthMissing Et Muon object MET_MuonMissing Et Final object MET_FinalMissing Et Cryostat correction

MET_Cryo since 10.0.0

Page 26: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 26

StoreGate keys for AOD Container (2)

Container Name Name of collection commentTruthParticleContainer SpclMCInner Detector TrackParticles TrackParticleCandidateMuonboy TrackParticles MuonboyTrackParticlesSTACO TrackParticles StacoTrackParticlesMOORE TrackParticles MooreTrackParticlesMuID StandAlone TrackParticles

MuidStandAloneTrackParticles

MuID Combined TrackParticles

MuidCombnoSeedTrackParticles

Slimmed McEventCollection GEN_AODTrackParticleTruthCollection TrackParticleTruthCollectionCTP Decision CTP_DecisionLVL1 RoI LVL1_ROIVertex Container VxPrimaryCandidateTrack Record Collection MuonEntryRecordTruth ParticleJetContainers KtTruthParticleJets,

Cone4TruthParticleJets, ConeTruthJets

since 10.0.0

Page 27: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 27

StoreGate keys for Atlfast AOD Container

Container Name Name of collection

ElectronContainer AtlfastElectronCollection

PhotonContainer AtlfastPhotonCollection

MuonContainer AtlfastMuonCollection

TauJetContainer AtlfastTauJetContainer

BJetContainer AtlfastBJetContainer

ParticleJetContainer AtlfastParticleJetContainer

Missing Et object AtlfastMissingEt

TruthParticleContainer SpclMC

Page 28: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 28

Glimpse at one of the classes: ElectronElectron.h in PhysicsAnalysis/AnalysisCommon/ParticleEvent

class Electron : public ParticleBase, public P4EEtaPhiM, public Navigable<egammaContainer,double> { int isEM() const { return m_isEM; } bool hasTrack() const { return m_hasTrack; } const Rec::TrackParticle* track() const { return ((m_hasTrack) ? (*m_track) : 0) ; } Via navigation to track (e.g. (*m_track)->trackSummary()-

>get( Trk::numberOfBLayerHits ) ) double z0wrtPrimVtx() const ; double d0wrtPrimVtx() const ; int numberOfBLayerHits() const int numberOfPixelHits() const; int numberOfSCTHits() const; int numberOfTRTHits() const; int numberOfTRTHighThresholdHits() const;

Page 29: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 29

Glimpse at one of the classes: Electron

ElectronParamDefs.h enum ParamDef { // common enums EoverP = 0, // Enum's for egamma etaBE2 = 1, et37 = 2, e237 = 3, e277 = 4, ethad1 = 5, weta1 = 6, weta2 = 7, f1 = 8,

e2tsts1 = 9, emins1 = 10, wtots1 = 11, fracs1 = 12, epiNN = 13, // Enum's for softe etaCorrMag = 1, f1core = 2, f3core = 3, Pos7 = 4, Iso = 5, Widths2 = 6, emWeight = 7, pionWeight = 8

Access via (*elec)->parameter(ElectronParameters::EoverP)

Page 30: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 30

To find out which objects in each class

Hopefully soon via PAT web pagehttps://uimon.cern.ch/twiki/bin/view/Atlas/PhysicsAnalysisToolsAt least that’s promised for in the next weeks

Via interactive python sessionUnfortunately you get more than just the class members, also all methodsBut probably the easiest way right now

Via doxigenLook directly at class in release areaSome members in Kyle’s talk

http://agenda.cern.ch/fullAgenda.php?ida=a045107#s2

Ask an “expert”

Page 31: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 31

More about 4-momentum

Most particles such as electrons, photons, muon, tau, jets inherit from I4Momentum For example:

for (; elecItr != elecItrE; ++elecItr) { if( (*elecItr)->pt()> m_etElecCut ) { double electronEta = (*elecItr)->eta(); ...

Complete listdouble px(), py(), pz(), m() double p(), eta(), phi() double e(), et(), pt(), double iPt() double cosTh(), sinTh(), cotTh()HepLorentzVector hlv()

Page 32: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 32

HepLorentzVector

xxx

Page 33: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 33

Exercise 4

Modify AnalysisSkeleton.cxx and plot some histograms of quantities in the ElectronContainer

Retrieve ElectronContainerPlot size of itPlot pT, eta and EoverP of the electron candidates with pT>20GeVRun and check your histograms with rootWatch out for the fix me in the code!

Page 34: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 34

More about ParticleParticle have a 4-momentum representation (see more on next slide)Particles have constituents (e.g. are navigable)

Daughters from particle decayReconstruction-level object

methods of IParticleParticleDataType::DataType dataType()

Enum with {Data = 0, Full = 1, FastShower = 2, Fast = 3, True = 4}

Trk::RecVertex* origin() RecVertex corresponding to particle Origin

bool hasCharge()check if charge information is available

ChargeType charge() Returns charge

bool hasPdgId()check if particle id information is available

PDG::pidType pdgId() PDG code

Page 35: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 35

in Event/EventKernel

Page 36: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 36

Page 37: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 37

NavigationNavigation to Constituents from AOD back to ESD:

CompositeParticle* W = new CompositeParticle(); W->add(jetContainer, jet1, jet2); If (!W->contains(jet3)) { do something;} NavigationToken<CaloCell,double>* cellToken = new

NavigationToken<CaloCell,double>(); jet->fillToken(*cellToken); NavigationToken<CaloCell, double>::const_iterator c =

cellToken->begin(); NavigationToken<CaloCell,double>::const_iterator cend =

cellToken->end(); for(; c != cend; ++c) { const CaloCell* thisCell = *c; double weight = jet->getParameter(thisCell); // double weight = (*c).second; double et = weight * thisCell->et(); ….

Page 38: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 38

Exercise 5: Plot inv. Z-mass

Add to AnalysisSkeleton.cxx Use 4-vector method to combine 2 electrons with pT>20GeV and put it in histoRun and check histo

Page 39: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 39

Analysis Tools, UtilitiesThe following tools are currently available – Look in CVS:

offline/PhysicsAnalysis/AnalysisCommon/AnalysisUtilsAnalysisTools

Main toolsCombinationPermutationDeltaR matchingSelectorFilterSpecial Utilities NavigationAssociation

Page 40: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 40

IAnalysisToolsDelta phi between two particles

deltaPhi (const INavigable4Momentum *p1, const INavigable4Momentum *p2)

Delta R between 2 particles double deltaR (const INavigable4Momentum *p1, const

INavigable4Momentum *p2)Invariant mass between 2 particles

imass2 (const INavigable4Momentum *p1, const INavigable4Momentum *p2)

Invariant mass between 4 particles imass4 (const INavigable4Momentum *p1, const

INavigable4Momentum *p2, const INavigable4Momentum *p3, const INavigable4Momentum *p4)

Page 41: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 41

IAnalysisToolsfind the closest (in R) element in a collection to an INavigable4Momentum

bool matchR (const INavigable4Momentum *t, COLL *coll, int &index, double &deltaR)

bool matchR (const INavigable4Momentum *t, COLL *coll, ELEMENT *element, double &deltaR)

bool matchR (const INavigable4Momentum *t, COLL *coll, int &index, double &deltaR, const int pdg)

sort by pT, eta, phi sortPT (COLL *coll) sortEta (COLL *coll) sortPhi (COLL *coll)

classify by charge (pos, neg) classifyCharge (const COLL *coll, std::vector<typename COLL::value_type> &pos, std::vector<typename COLL::value_type> &neg)

Page 42: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 42

DeltaR MatchingGet a handle on the tools in the initialize() method:

IAlgTool *tmp_analysisTools; sc = toolSvc->retrieveTool("AnalysisTools",tmp_analysisTools); if (StatusCode::SUCCESS != sc) { mLog << MSG::ERROR << "Can't get handle on ana tools" <<

endreq; return StatusCode::FAILURE; }

Then in execute m_analysisTools=dynamic_cast<IAnalysisTools *>(tmp_analysisTools); int index = -1; double deltaRMatch; /// find a match to this electron in the MC truth container /// the index and deltaR are returned bool findAMatch = m_analysisTools->matchR((*elecItr), mcpartTES,

index, deltaRMatch, (*elecItr)->pdgId()); /// the matched object and deltaR are returned bool findAMatch = m_analysisTools->matchR((*elecItr), mcpartTES,

element, deltaRMatch, (*elecItr)->pdgId());

Page 43: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 43

Combination Example: Wjj AnalysisUtils::Combination<const ParticleJetContainer>

comb(jetTDS,2);get all the combinations of 2 jets

std::vector<const IParticleContainer::base_value_type*> jj; while (comb.get(jj)) { double mjj = (jj[0]->hlv()+jj[1]->hlv()).m(); m_jj->fill(mjj,m_eventWeight); if ( fabs(mjj-mW) < m_deltaMjj ) { CompositeParticle * Wjj = new CompositeParticle(); Jet* newJet = new Jet( oldjet ) Wjj->add(jetTDS,jj[0],jj[1]); Wjj->set_charge(1); Wjj->set_pdgId(PDG::W_plus); Wjj->set_dataType(m_dataType); m_WjjContainer->push_back(Wjj); } } }

Page 44: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 44

Special Utility for NeutrinoIn some analyses, you want to reconstruct neutrino

NeutrinoIParticleTo help you in PhysicsAnalysis/AnalysisCommon/SpecialUtils

candidatesFromWMass(lepton, pxMiss, pyMiss, neutrinoContainer)neutrinosFromColinearApproximation(particleA, particleB, pxMiss, pyMiss, neutrinoContainer)

Objective is: each user does not have to write the same piece of code for general solutions to a subclass of problemExample: use the W mass constraint for the pz solution of the neutrino momentum

for (; leptonItr != leptonItrE; ++leptonItr) { bool findNeutrino = NeutrinoUtils::candidatesFromWMass((*leptonItr), m_pxMiss, m_pyMiss, (*m_neutrinoContainer));

if (findNeutrino) { do something …} }

Page 45: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 45

Special Particle: CompositeParticleCompositeParticle is made up of other IParticlesadd two particles to make a composite particleIn 9.0.4 (need symlink with ParticleBaseContainer)

CompositeParticle* myZ = new CompositeParticlemyZ->add(myBJetContainer, oldEle )

In 10.0.0 (no need for container, but need to make a copy before adding)

CompositeParticle* myZ = new CompositeParticleElectron* newEle = new Electron( oldEle )

Composite particles can Navigate to its daughters

Page 46: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 46

Creating Your Own ContainersMuonContainer * muonContainer = new MuonContainer();

Muon * newMuon = new Muon();newMuonset_IDTrack(…);newMuonset4Mom(HepLorentzVector(px,py,pz,e));…muonContainer->push_back(newMuon);m_storeGaterecord(muonContainer, “containerName”);

The muonContainer “owns” all the newMuon inside it:Delete muonContainer; will also delete all the newMuon

Page 47: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 47

Some caveats if you put particles in your container

PhotonContainer* photonContainer= new PhotonContainer(SG::VIEW_ELEMENTS);

photonContainerpush_back(newPhoton);photonContainer does not own the newPhoton inside itDelete photonContainer; will NOT delete the newPhotonsThe AOD container that you retrieve from POOL owns its AOD

If you create your own container of pre-selected AOD, be careful:m_userElectronContainer->push_back(*elecItr); *elecItr is pointer to an Electron AOD in original electron AOD container: that container own *elecItr: m_userElectronContainer can NOT own *elecItr. So m_userElectronContainer must be previously created with “View elements”

Container ownership: SG::OWN_ELEMENTS, SG::VIEW_ELEMENTS

Page 48: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 48

Page 49: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 49

Page 50: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 50

Exercise 6: again Z mass peakThis time use some of the tools you just learned

1) Use tool for combinatorics

2) Now write a selector which only selects electron with pT>20GeV and use that within the combinatorics tool

Note there is the method bool goodOnes(CALLER *caller, OUT &comb, CRITERIA criteria)

with CALLER = AnalysisSkeleton OUT = std::vector<const Electron*, std::allocator<const

Electron*> > CRITERIA = bool (AnalysisSkeleton::*) (const

std::vector<const Electron*, std::allocator<const Electron*> >&), COLL = const ElectronContainer]

Selection routine must be friend of AnalysisSkeleton You need something like

selectElectron(AnalysisSkeleton * self, const std::vector<const ElectronContainer::base_value_type*> &ll)

Page 51: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 51

More ExamplesLook in the package AnalysisExamples

https://uimon.cern.ch/twiki/bin/view/Atlas/AnalysisExamples(a) Batch production of large scale ESD and AOD (b) Merging AOD files (c) Documentation (d) Single Particle Identification Example (e) Z -> 2 leptons example (f) Higgs -> 4 leptons example (g) ttbar example (h) How to use the analysis tools (i) How to do back navigation from the AOD to the ESD (j) Access to tracks (k) Interface to the interactive analysis (l) How to use ntuple and histograms in your analysis

algorithms

Page 52: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 52

Some words on MC TruthAim

to do a navigation between mother and daughters in Truth block very similar to HepMCCan exchange an AOD container from reconstruction with TruthParticle containerUser analysis can run transparently either on MC truth or on reconstructed data

Within athena truth is stored asA HepMC::GenEvent, which contains

HepMC::GenVertexHepMC::GenParticle

AtlfastGenEvent contains truth from Event Generator

Full simulationTruth from Event Generator + GEANT4 hits

Page 53: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 53

Page 54: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 54

Page 55: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 55

Available filters for MC TruthMcVtxFilter tool

Usefull for selecting particles such as Z ee, , bb.. McAODFilter.McVtxFilterTool.DecayPatterns += [ "Z[e+,e]" ]

Also possible McAODFilter.McVtxFilterTool.DecayPatterns += [ "#id 6[24,5]" ]

this is the decay pattern for a t->W+ b And simple ones work as well

McAODFilter.McVtxFilterTool.DecayPatterns += [ "gamma" ] Selection filter

easy selection of particle by flavour/type Examples (not only MCTruth, also reco objects):

//Create a filter of electrons AnalysisUtils::Selection<PdgIdFilter<ParticleBase> > eleFilter; eleFilter.set_pdgId( PDG::e_minus ); // loose cut on sign: selects both e+ and e- eleFilter.set_matchSign( false );

// Create a IParticleFilter to select jets AnalysisUtils::Selection<IParticleFilter> filter; filter.set_ptMin( 60.*GeV ); std::vector<ParticleJet*> myJets; filter.getObjects( jets, myJets );

Page 56: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 56

Few words on ESD Same can be done on ESD’sInstead of using the electron you use the egammaObject from the reconstruction start with the AOD but then go to ESD via back navigation

EventSelector.BackNavigation = True Advantage you have the particle Electron and can use 4-vector utilities

But of course you can start directly from ESDExample in

~mwielers/maxidisk/tutorial_files/results/ZeeOnESD.cxxIf we have time and you’re still keen

Just have a look at itI doesn’t work…. It crashes due to incompatibility between 9.0.4 and 10.0.0

Might work with new AOD/ESD’s but not sure

Page 57: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 57

In principlecopy ZeeOnESD.cxx to srccopy ZeeOnESD.h to UserAnalysisAdd to requirements

use egammaEvent egammaEvent-01-* Reconstruction Add ZeeOnESD to src/components/UserAnalysis_entries.cxxChange jobOptions

theApp.TopAlg += [ "ZeeOnESD" ] ZeeOnESD = Algorithm( "ZeeOnESD" ) ZeeOnESD.egamma

Container = "egammaCollection" ZeeOnESD.egammaEtCut = 20.0*GeV ZeeOnESD.egammaEtaCut = 2.5

Add ZeeOnESD to src/components/UserAnalysis_entries.cxxNew AOD’s produced with release 10 available in

XxxI will try to get the Z->ee example running under 10 soonWill also give example for an analysis only on ESD level

Page 58: AOD Tutorial, March 10, 2005M. Wielers, RAL1 AOD Tutorial These slides can be found in ppt in  /tutorial/Tutorial_AOD_100305.ppt.

AOD Tutorial, March 10, 2005

M. Wielers, RAL 58

Last remark

Results of the exercises are in~mwielers/maxidisk/tutorial_files/result