ATLAS Offline Software
InDetTrackPerfMonFlags.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 #from AthenaConfiguration.Enums import LHCPeriod
4 
5 
7  from AthenaConfiguration.AthConfigFlags import AthConfigFlags
8  icf = AthConfigFlags()
9 
10  icf.addFlag( "DirName", "InDetTrackPerfMonPlots/" )
11  icf.addFlag( "trkAnaNames", ["Default"] )
12  icf.addFlag( "plotsDefFormat", "JSON" )
13  icf.addFlag( "plotsDefFileList" , "InDetTrackPerfMon/PlotsDefFileList_default.txt" )
14  icf.addFlag( "plotsCommonValuesFile", "" )
15  icf.addFlag( "sortPlotsByChain", False )
16 
17  icf.addFlag( "trkAnaCfgFile", '' )
18  icf.addFlag( 'outputFilePrefix','myIDTPM_out')
19  icf.addFlag( 'unpackTrigChains', False )
20  icf.addFlag( 'commonTrkAnaFlags', [] )
21  return icf
22 
23 
24 
27  from AthenaConfiguration.AthConfigFlags import AthConfigFlags
28  icf = AthConfigFlags()
29 
30  # General properties
31  icf.addFlag( "enabled", True )
32  icf.addFlag( "anaTag", "" )
33  icf.addFlag( "SubFolder", "" )
34  # Test-Reference collections properties
35  icf.addFlag( "TestType", "Offline" )
36  icf.addFlag( "RefType", "Truth" )
37  icf.addFlag( "doTrigNavigation", False )
38  icf.addFlag( "TrigTrkKey" , "" )
39  icf.addFlag( "OfflineTrkKey" , "InDetTrackParticles" )
40  icf.addFlag( "TruthPartKey" , "TruthParticles" )
41  icf.addFlag( "TrigVtxKey" , "" )
42  icf.addFlag( "OfflineVtxKey" , "PrimaryVertices" )
43  icf.addFlag( "TruthVtxKey" , "TruthVertices" )
44  icf.addFlag( "pileupSwitch" , "HardScatter" )
45  # Cluster/space-point collections properties (for offline-type, ITk/ACTS only)
46  icf.addFlag( "doClusterValidation" , False )
47  icf.addFlag( "PixelClusterKey" , "" )
48  icf.addFlag( "StripClusterKey" , "" )
49  icf.addFlag( "PixelSpacePointKey" , "" )
50  icf.addFlag( "StripSpacePointKey" , "" )
51  icf.addFlag( "StripOverlapSpacePointKey", "" )
52  # Matching properties
53  icf.addFlag( "MatchingType" , "DeltaRMatch" )
54  icf.addFlag( "dRmax" , 0.05 )
55  icf.addFlag( "pTResMax" , -9.9 )
56  icf.addFlag( "truthProbCut" , 0.5 )
57  # Trigger-specific properties
58  icf.addFlag( "ChainNames" , [] )
59  icf.addFlag( "RoiKey" , "" )
60  icf.addFlag( "ChainLeg" , -1 )
61  icf.addFlag( "doTagNProbe" , False )
62  icf.addFlag( "RoiKeyTag" , "" )
63  icf.addFlag( "ChainLegTag" , 0 )
64  icf.addFlag( "RoiKeyProbe" , "" )
65  icf.addFlag( "ChainLegProbe" , 1 )
66  # Offline tracks selection properties
67  icf.addFlag( "SelectOfflineObject", "" )
68  icf.addFlag( "OfflineQualityWP" , "", help="Apply track quality selection cuts to the reconstructed tracks, if blank no selections is done" )
69  icf.addFlag( "DoOfflineSelection", False )
70  icf.addFlag( "offlMaxZ0SinTheta", -9999. )
71  icf.addFlag( "offlMinNInnermostLayerHits", -9999. )
72  icf.addFlag( "offlMinNBothInnermostLayersHits", -9999. )
73  icf.addFlag( "offlMaxNInnermostLayerSharedHits",-9999. )
74  icf.addFlag( "offlMinNSiHits", -9999. )
75  icf.addFlag( "offlMaxNSiSharedHits", -9999. )
76  icf.addFlag( "offlMaxNSiHoles", -9999. )
77  icf.addFlag( "offlMinNPixelHits", -9999. )
78  icf.addFlag( "offlMaxNPixelSharedHits", -9999. )
79  icf.addFlag( "offlMaxNPixelHoles", -9999. )
80  icf.addFlag( "offlMinNSctHits", -9999. )
81  icf.addFlag( "offlMaxNSctSharedHits", -9999.)
82  icf.addFlag( "offlMaxNSctHoles", -9999. )
83  icf.addFlag( "offlMaxChiSq", -9999. )
84  icf.addFlag( "offlMaxChiSqperNdf", -9999. )
85  icf.addFlag( "offlMinPt" , -9999.)
86  icf.addFlag( "offlMaxPt" , -9999. )
87  icf.addFlag( "offlMinEta" , -9999. )
88  icf.addFlag( "offlMaxEta" , -9999. )
89  icf.addFlag( "offlMinPhi" , -9999. )
90  icf.addFlag( "offlMaxPhi" , -9999. )
91  icf.addFlag( "offlMinD0" , -9999. )
92  icf.addFlag( "offlMaxD0" , -9999. )
93  icf.addFlag( "offlMinZ0" , -9999. )
94  icf.addFlag( "offlMaxZ0" , -9999. )
95  icf.addFlag( "offlMinQoPT" , -9999. )
96  icf.addFlag( "offlMaxQoPT" , -9999. )
97  icf.addFlag( "offlMaxAbsEta" , -9999. )
98  icf.addFlag( "offlMinAbsEta" , -9999. )
99  icf.addFlag( "offlMinAbsPhi" , -9999. )
100  icf.addFlag( "offlMaxAbsPhi" , -9999. )
101  icf.addFlag( "offlMinAbsD0" , -9999. )
102  icf.addFlag( "offlMaxAbsD0" , -9999. )
103  icf.addFlag( "offlMinAbsZ0" , -9999. )
104  icf.addFlag( "offlMaxAbsZ0" , -9999. )
105  icf.addFlag( "offlMinAbsQoPT" , -9999. )
106  icf.addFlag( "offlMaxAbsQoPT" , -9999. )
107  icf.addFlag( "offlEtaBins" , [] )
108  icf.addFlag( "offlMinHitsVector" , [] )
109  icf.addFlag( "offlMinPtVector" , [] )
110  icf.addFlag( "offlMaxD0Vector" , [] )
111  icf.addFlag( "offlMaxZ0Vector" , [] )
112  icf.addFlag( "offlMinProb" , -9999. )
113  icf.addFlag( "ObjectQuality" , "Medium" )
114  icf.addFlag( "TauType" , "RNN" )
115  icf.addFlag( "TauNprongs" , 1 )
116  icf.addFlag( "TruthProbMin" , 0.5 )
117  # Truth particles selection properties
118  icf.addFlag( "SelectTruthObject" , "" )
119  icf.addFlag( "truthMinPt" , -9999., help="Apply minimum pt cut to truth particle" )
120  icf.addFlag( "truthMaxPt" , -9999., help="Apply maximum pt cut to truth particle" )
121  icf.addFlag( "truthMinEta" , -9999., help="Apply minimum eta cut to truth particle" )
122  icf.addFlag( "truthMaxEta" , -9999., help="Apply maximum eta cut to truth particle" )
123  icf.addFlag( "truthMinPhi" , -9999., help="Apply minimum phi cut to truth particle" )
124  icf.addFlag( "truthMaxPhi" , -9999., help="Apply maximum phi cut to truth particle" )
125  icf.addFlag( "truthMinD0" , -9999., help="Apply minimum d0 cut to truth particle" )
126  icf.addFlag( "truthMaxD0" , -9999., help="Apply maximum d0 cut to truth particle" )
127  icf.addFlag( "truthMinZ0" , -9999., help="Apply minimum z0 cut to truth particle" )
128  icf.addFlag( "truthMaxZ0" , -9999., help="Apply maximum z0 cut to truth particle" )
129  icf.addFlag( "truthMinQoPT" , -9999., help="Apply minimum q/pt cut to truth particle" )
130  icf.addFlag( "truthMaxQoPT" , -9999., help="Apply maximum q/pt cut to truth particle" )
131  icf.addFlag( "truthMinAbsEta" , -9999., help="Apply minimum |eta| cut to truth particle" )
132  icf.addFlag( "truthMaxAbsEta" , -9999., help="Apply maximum |eta| cut to truth particle" )
133  icf.addFlag( "truthMinAbsPhi" , -9999., help="Apply minimum |phi| cut to truth particle" )
134  icf.addFlag( "truthMaxAbsPhi" , -9999., help="Apply maximum |phi| cut to truth particle" )
135  icf.addFlag( "truthMinAbsD0" , -9999., help="Apply minimum |d0| cut to truth particle" )
136  icf.addFlag( "truthMaxAbsD0" , -9999., help="Apply maximum |d0| cut to truth particle" )
137  icf.addFlag( "truthMinAbsZ0" , -9999., help="Apply minimum |z0| cut to truth particle" )
138  icf.addFlag( "truthMaxAbsZ0" , -9999., help="Apply maximum |z0| cut to truth particle" )
139  icf.addFlag( "truthMinAbsQoPT" , -9999., help="Apply minimum |q/pt| cut to truth particle" )
140  icf.addFlag( "truthMaxAbsQoPT" , -9999., help="Apply maximum |q/pt| cut to truth particle" )
141  icf.addFlag( "truthPdgId" , -9999., help="Apply pdgId selection to truth particle" )
142  # Jet-track matching properties
143  icf.addFlag( "JetContainerName", "InTimeAntiKt4TruthJets" )
144  icf.addFlag( "maxTrkJetDR", 0.4 )
145  icf.addFlag( "jetMinAbsEta", -9999. )
146  icf.addFlag( "jetMaxAbsEta", 4.0 )
147  icf.addFlag( "jetMinPt", 1000.0 )
148  icf.addFlag( "jetMaxPt", 5000000.0 )
149  # Histogram properties
150  icf.addFlag( "plotTrackParameters" , True )
151  icf.addFlag( "plotTrackParametersErrors", False )
152  icf.addFlag( "plotTrackMultiplicities" , True )
153  icf.addFlag( "plotEfficiencies" , True )
154  icf.addFlag( "plotTechnicalEfficiencies", False )
155  icf.addFlag( "useActsSiMeasurements" , False )
156  icf.addFlag( "plotResolutions" , True )
157  icf.addFlag( "plotFakeRates" , True )
158  icf.addFlag( "unlinkedAsFakes" , True )
159  icf.addFlag( "plotDuplicateRates" , False )
160  icf.addFlag( "plotHitsOnTracks" , True )
161  icf.addFlag( "plotHitsOnTracksReference", False )
162  icf.addFlag( "plotHitsOnMatchedTracks" , False )
163  icf.addFlag( "plotHitsOnFakeTracks" , False )
164  icf.addFlag( "plotVertexParameters" , True )
165  icf.addFlag( "useSelectedVertexTracks" , False )
166  icf.addFlag( "plotOfflineElectrons" , False )
167  icf.addFlag( "ResolutionMethod" , "iterRMS" )
168 
169  return icf
170 
171 
173  flags.addFlagsCategory( "PhysVal.IDTPM",
174  __createIDTPMConfigFlags , prefix=True )
175 
176  flags.addFlag( 'Output.doWriteAOD_IDTPM', False )
177  flags.addFlag( 'Output.AOD_IDTPMFileName', 'myIDTPM_out.AOD_IDTPM.pool.root' )
178  return flags
179 
180 
181 
183  # Set output file names
184  prefix = flags.PhysVal.IDTPM.outputFilePrefix
185  if 'HIST.root' in prefix :
186  flags.PhysVal.OutputFileName = prefix
187  flags.Output.AOD_IDTPMFileName = prefix.replace( 'HIST', 'AOD_IDTPM.pool' )
188  else :
189  flags.PhysVal.OutputFileName = prefix + '.HIST.root'
190  flags.Output.AOD_IDTPMFileName = prefix + '.AOD_IDTPM.pool.root'
191 
192  # Default TrackAnalysis configuration flags category
193  flags.addFlagsCategory( "PhysVal.IDTPM.Default",
194  __createIDTPMTrkAnaConfigFlags,
195  prefix=True )
196 
197  # Common TrackAnalysis configuration flags category
198  # to override individual flags in all the trkanalyses configurations with a common value
199  flags.addFlagsCategory( "PhysVal.IDTPM.Common",
200  __createIDTPMTrkAnaConfigFlags,
201  prefix=True )
202 
203 
204  commonTrkAnaFlags_new = []
205  for f in flags.PhysVal.IDTPM.commonTrkAnaFlags :
206  if "PhysVal.IDTPM.Common." not in f :
207  commonTrkAnaFlags_new.append( "PhysVal.IDTPM.Common."+f )
208  else : commonTrkAnaFlags_new.append(f)
209 
210  # Update PhysVal.IDTPM.Common flags category with values parsed from commonTrkAnaFlags_new
211  # This is used to keep flags values of the correct/consitent type
212  if commonTrkAnaFlags_new :
213  flags.fillFromArgs( listOfArgs=commonTrkAnaFlags_new )
214 
215  from InDetTrackPerfMon.ConfigUtils import getTrkAnaDicts
216  analysesDict = getTrkAnaDicts( flags )
217  trkAnaNames = []
218 
219  if analysesDict:
220  for trkAnaName, trkAnaDict in analysesDict.items():
221  # Append TrkAnalysisName to list
222  trkAnaNames.append( trkAnaName )
223 
224  # separate flag category for each TrkAnalysis
225  flags.addFlagsCategory( "PhysVal.IDTPM."+trkAnaName,
226  __createIDTPMTrkAnaConfigFlags,
227  prefix=True )
228 
229  # set flags from values in trkAnaDict
230  for fname, fvalue in trkAnaDict.items():
231 
232  if fname.startswith( "_comment" ): continue
233 
234  setattr( flags.PhysVal.IDTPM, trkAnaName+"."+fname, fvalue )
235 
236  # override flags for this trkAna with common ones from commonTrkAnaFlags
237  for cflag in commonTrkAnaFlags_new :
238  cfname = cflag.split('=')[0].split('.')[-1] # parsing only the name of the flag
239  cfvalue = getattr( flags.PhysVal.IDTPM.Common, cfname ) # getting its value in the correct type
240  setattr( flags.PhysVal.IDTPM, trkAnaName+"."+cfname, cfvalue )
241 
242 
244  types = [ getattr( flags.PhysVal.IDTPM, trkAnaName+".TestType" ),
245  getattr( flags.PhysVal.IDTPM, trkAnaName+".RefType" ) ]
246  if "Trigger" in types :
247  setattr( flags.PhysVal.IDTPM, trkAnaName+".doTrigNavigation", True )
248 
249  if trkAnaNames:
250  flags.PhysVal.IDTPM.trkAnaNames = trkAnaNames
251 
252  return flags
InDetTrackPerfMonFlags.__createIDTPMConfigFlags
def __createIDTPMConfigFlags()
IDTPM whole job properties.
Definition: InDetTrackPerfMonFlags.py:6
InDetTrackPerfMonFlags.__createIDTPMTrkAnaConfigFlags
def __createIDTPMTrkAnaConfigFlags()
IDTPM individual TrkAnalysis properties to be read from trkAnaCfgFile in JSON format.
Definition: InDetTrackPerfMonFlags.py:26
ConfigUtils.getTrkAnaDicts
def getTrkAnaDicts(flags)
Definition: ConfigUtils.py:19
InDetTrackPerfMonFlags.initializeIDTPMConfigFlags
def initializeIDTPMConfigFlags(flags)
General config flag category for IDTPM tool job configuration.
Definition: InDetTrackPerfMonFlags.py:172
InDetTrackPerfMonFlags.initializeIDTPMTrkAnaConfigFlags
def initializeIDTPMTrkAnaConfigFlags(flags)
Create flags category and corresponding set of flags.
Definition: InDetTrackPerfMonFlags.py:182
Trk::split
@ split
Definition: LayerMaterialProperties.h:38