ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetRecConfig
share
test_AnalysisBaseEventLoopJob.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
2
#
3
# This script is an example of how to run jet algorithms in AnalysisBase.
4
# Jet algs are configured wth the r22 new -style configuration.
5
#
6
# simply invoke it with
7
# python test_AnalysisBaseEventLoopJob.py
8
#
9
# WARNING : this is experimental. Pay attention to the TEMPORARY comments : these are still needed to run the job.
10
import
ROOT
11
12
ROOT.JetSorter
# TEMPORARY : ask ROOT/cppyy to load simple jet tool first. Otherwise loading other tools might result in crash.
13
14
15
16
inputFilePath =
"/eos/atlas/atlascerngroupdisk/trig-jet/AOD_AthenaMTvalidations/11thRound/ttbar_withPileup/valid1/"
17
filePattern =
'AOD.24230077._000510.pool.root.1'
18
19
# if the above input file from trigger community disapear, we can use the one below from the tutorials :
20
#inputFilePath = '/cvmfs/atlas.cern.ch/repo/tutorials/asg/cern-nov2020/mc16_13TeV.410470.PhPy8EG_A14_ttbar_hdamp258p75_nonallhad.deriv.DAOD_PHYS.e6337_s3126_r10201_p4172/'
21
#filePattern = 'DAOD_PHYS.21569875._001323.pool.root.1'
22
23
24
#****************************************************
25
# the athena-like configuration
26
27
# This makes all the Athena config module available :
28
import
JetRecConfig.JetAnalysisCommon
29
30
from
JetRecConfig.JetRecConfig
import
JetRecCfg
31
from
JetRecConfig.StandardSmallRJets
import
AntiKt4LCTopo, AntiKt4Truth
32
33
34
# TEMPORARY : we need to run a simplistic AnaAlgorithm (and NOT a AnaReentrantAlgorithm like jet algs) as the
35
# 1st alg and this alg has to access a ReadHandle. Otherwise AnaReentrantAlgorithm will crash when accessing ReadHandle with "no active event".
36
from
AthenaConfiguration.ComponentFactory
import
CompFactory
37
aa = CompFactory.TCAlg(
'AA'
)
38
39
40
# We need to setup the flags according to our input file :
41
flags = JetRecConfig.JetAnalysisCommon.setupFlags(inputFiles=[inputFilePath+filePattern])
42
43
#*******************************************************************
44
# Some flags are not available in AnalysisBase.
45
# Add them manually :
46
flags.addFlag(
'Reco.EnableTracking'
,
True
)
47
flags.addFlag(
'Reco.EnableCombinedMuon'
,
True
)
48
49
# Schedule 2 jet containers
50
# truth jets :
51
acc=JetRecCfg(flags, AntiKt4Truth )
52
53
# we re-define AntiKt4LCTopo adding a suffix to the output and the modifiers :
54
myAk4LCtopo = AntiKt4LCTopo.clone(suffix=
"ReDone"
,
55
modifiers = (
'ConstitFourMom'
,
'CaloEnergies'
,
'Calib:T0:mc'
,
'Sort'
,
'Filter:10000'
,
'LArHVCorr'
,
'Width'
,
'CaloQuality'
,
'PartonTruthLabel'
,
'TruthPartonDR'
,
'JetDeltaRLabel:5000'
,
'ECPSFrac'
,
'ClusterMoments'
)
56
# tracks moments not working yet
57
# 'TrackMoments', 'TrackSumMoments', 'JVF', 'JVT', 'OriginSetPV', 'Charge',
58
)
59
60
# generate the config and append it to acc :
61
acc.merge(JetRecCfg( flags, myAk4LCtopo ))
62
63
# acc contains all the algs (inputs + jet finding) needed. Just set debug mode for the last one :
64
acc.algs[-1].OutputLevel = 2
65
66
67
68
69
#****************************************************
70
# EL::Job configuration
71
72
sh = ROOT.SH.SampleHandler()
73
sh.setMetaString(
'nc_tree'
,
'CollectionTree'
)
74
ROOT.SH.ScanDir().
filePattern
( filePattern ).
scan
( sh, inputFilePath )
75
76
sh.printContent()
77
78
79
job = ROOT.EL.Job()
80
job.options().setString( ROOT.EL.Job.optSubmitDirMode,
'unique-link'
)
81
job.sampleHandler( sh )
82
job.options().setDouble( ROOT.EL.Job.optMaxEvents, 5 )
83
84
85
86
job.addManyAlgs( [aa] )
# TEMPORARY : schedule the simplistic alg first
87
# schedule our jet algs to the EL job.
88
job.addManyAlgs( acc )
89
90
91
# Run the job using the direct driver.
92
driver = ROOT.EL.DirectDriver()
93
driver.submit( job,
"out"
)
scan
void scan(TDirectory *td=0, int depth=0)
Definition
listroot.cxx:440
test_AnalysisBaseEventLoopJob.filePattern
str filePattern
Definition
test_AnalysisBaseEventLoopJob.py:17
Generated on
for ATLAS Offline Software by
1.17.0