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 
108  icf.addFlag( "offlEtaBins" , [] )
109  icf.addFlag( "offlMinHitsVector" , [] )
110  icf.addFlag( "offlMinPtVector" , [] )
111  icf.addFlag( "offlMaxD0Vector" , [] )
112  icf.addFlag( "offlMaxZ0Vector" , [] )
113  icf.addFlag( "offlMinProb" , -9999. )
114  icf.addFlag( "ObjectQuality" , "Medium" )
115  icf.addFlag( "TauType" , "RNN" )
116  icf.addFlag( "TauNprongs" , 1 )
117  icf.addFlag( "TruthProbMin" , 0.5 )
118  # Truth particles selection properties
119  icf.addFlag( "SelectTruthObject" , "" )
120  icf.addFlag( "truthMinPt" , -9999., help="Apply minimum pt cut to truth particle" )
121  icf.addFlag( "truthMaxPt" , -9999., help="Apply maximum pt cut to truth particle" )
122  icf.addFlag( "truthMinEta" , -9999., help="Apply minimum eta cut to truth particle" )
123  icf.addFlag( "truthMaxEta" , -9999., help="Apply maximum eta cut to truth particle" )
124  icf.addFlag( "truthMinPhi" , -9999., help="Apply minimum phi cut to truth particle" )
125  icf.addFlag( "truthMaxPhi" , -9999., help="Apply maximum phi cut to truth particle" )
126  icf.addFlag( "truthMinD0" , -9999., help="Apply minimum d0 cut to truth particle" )
127  icf.addFlag( "truthMaxD0" , -9999., help="Apply maximum d0 cut to truth particle" )
128  icf.addFlag( "truthMinZ0" , -9999., help="Apply minimum z0 cut to truth particle" )
129  icf.addFlag( "truthMaxZ0" , -9999., help="Apply maximum z0 cut to truth particle" )
130  icf.addFlag( "truthMinQoPT" , -9999., help="Apply minimum q/pt cut to truth particle" )
131  icf.addFlag( "truthMaxQoPT" , -9999., help="Apply maximum q/pt cut to truth particle" )
132  icf.addFlag( "truthMinAbsEta" , -9999., help="Apply minimum |eta| cut to truth particle" )
133  icf.addFlag( "truthMaxAbsEta" , -9999., help="Apply maximum |eta| cut to truth particle" )
134  icf.addFlag( "truthMinAbsPhi" , -9999., help="Apply minimum |phi| cut to truth particle" )
135  icf.addFlag( "truthMaxAbsPhi" , -9999., help="Apply maximum |phi| cut to truth particle" )
136  icf.addFlag( "truthMinAbsD0" , -9999., help="Apply minimum |d0| cut to truth particle" )
137  icf.addFlag( "truthMaxAbsD0" , -9999., help="Apply maximum |d0| cut to truth particle" )
138  icf.addFlag( "truthMinAbsZ0" , -9999., help="Apply minimum |z0| cut to truth particle" )
139  icf.addFlag( "truthMaxAbsZ0" , -9999., help="Apply maximum |z0| cut to truth particle" )
140  icf.addFlag( "truthMinAbsQoPT" , -9999., help="Apply minimum |q/pt| cut to truth particle" )
141  icf.addFlag( "truthMaxAbsQoPT" , -9999., help="Apply maximum |q/pt| cut to truth particle" )
142  icf.addFlag( "truthPdgId" , -9999., help="Apply pdgId selection to truth particle" )
143 
144  icf.addFlag( "truthMinParentPt" , -9999. )
145  icf.addFlag( "truthMaxParentPt", -9999. )
146 
147 
148  # Jet-track matching properties
149  icf.addFlag( "JetContainerName", "InTimeAntiKt4TruthJets" )
150  icf.addFlag( "maxTrkJetDR", 0.4 )
151  icf.addFlag( "jetMinAbsEta", -9999. )
152  icf.addFlag( "jetMaxAbsEta", 4.0 )
153  icf.addFlag( "jetMinPt", 1000.0 )
154  icf.addFlag( "jetMaxPt", 5000000.0 )
155  # Histogram properties
156  icf.addFlag( "plotTrackParameters" , True )
157  icf.addFlag( "plotTrackParametersErrors", False )
158  icf.addFlag( "plotTrackMultiplicities" , True )
159  icf.addFlag( "plotEfficiencies" , True )
160  icf.addFlag( "plotTechnicalEfficiencies", False )
161  icf.addFlag( "useActsSiMeasurements" , False )
162  icf.addFlag( "plotResolutions" , True )
163  icf.addFlag( "plotFakeRates" , True )
164  icf.addFlag( "unlinkedAsFakes" , True )
165  icf.addFlag( "plotDuplicateRates" , False )
166  icf.addFlag( "plotHitsOnTracks" , True )
167  icf.addFlag( "plotHitsOnTracksExpert" , False )
168  icf.addFlag( "plotHitsOnTracksReference", False )
169  icf.addFlag( "plotHitsOnMatchedTracks" , False )
170  icf.addFlag( "plotHitsOnFakeTracks" , False )
171  icf.addFlag( "plotVertexParameters" , True )
172  icf.addFlag( "useSelectedVertexTracks" , False )
173  icf.addFlag( "plotOfflineElectrons" , False )
174  icf.addFlag( "ResolutionMethod" , "iterRMS" )
175 
176  return icf
177 
178 
180  flags.addFlagsCategory( "PhysVal.IDTPM",
181  __createIDTPMConfigFlags , prefix=True )
182 
183  flags.addFlag( 'Output.doWriteAOD_IDTPM', False )
184  flags.addFlag( 'Output.AOD_IDTPMFileName', 'myIDTPM_out.AOD_IDTPM.pool.root' )
185  return flags
186 
187 
188 
190  # Set output file names
191  prefix = flags.PhysVal.IDTPM.outputFilePrefix
192  if 'HIST.root' in prefix :
193  flags.PhysVal.OutputFileName = prefix
194  flags.Output.AOD_IDTPMFileName = prefix.replace( 'HIST', 'AOD_IDTPM.pool' )
195  else :
196  flags.PhysVal.OutputFileName = prefix + '.HIST.root'
197  flags.Output.AOD_IDTPMFileName = prefix + '.AOD_IDTPM.pool.root'
198 
199  # Default TrackAnalysis configuration flags category
200  flags.addFlagsCategory( "PhysVal.IDTPM.Default",
201  __createIDTPMTrkAnaConfigFlags,
202  prefix=True )
203 
204  # Common TrackAnalysis configuration flags category
205  # to override individual flags in all the trkanalyses configurations with a common value
206  flags.addFlagsCategory( "PhysVal.IDTPM.Common",
207  __createIDTPMTrkAnaConfigFlags,
208  prefix=True )
209 
210 
211  commonTrkAnaFlags_new = []
212  for f in flags.PhysVal.IDTPM.commonTrkAnaFlags :
213  if "PhysVal.IDTPM.Common." not in f :
214  commonTrkAnaFlags_new.append( "PhysVal.IDTPM.Common."+f )
215  else : commonTrkAnaFlags_new.append(f)
216 
217  # Update PhysVal.IDTPM.Common flags category with values parsed from commonTrkAnaFlags_new
218  # This is used to keep flags values of the correct/consitent type
219  if commonTrkAnaFlags_new :
220  flags.fillFromArgs( listOfArgs=commonTrkAnaFlags_new )
221 
222  from InDetTrackPerfMon.ConfigUtils import getTrkAnaDicts
223  analysesDict = getTrkAnaDicts( flags )
224  trkAnaNames = []
225 
226  if analysesDict:
227  for trkAnaName, trkAnaDict in analysesDict.items():
228  # Append TrkAnalysisName to list
229  trkAnaNames.append( trkAnaName )
230 
231  # separate flag category for each TrkAnalysis
232  flags.addFlagsCategory( "PhysVal.IDTPM."+trkAnaName,
233  __createIDTPMTrkAnaConfigFlags,
234  prefix=True )
235 
236  # set flags from values in trkAnaDict
237  for fname, fvalue in trkAnaDict.items():
238 
239  if fname.startswith( "_comment" ): continue
240 
241  setattr( flags.PhysVal.IDTPM, trkAnaName+"."+fname, fvalue )
242 
243  # override flags for this trkAna with common ones from commonTrkAnaFlags
244  for cflag in commonTrkAnaFlags_new :
245  cfname = cflag.split('=')[0].split('.')[-1] # parsing only the name of the flag
246  cfvalue = getattr( flags.PhysVal.IDTPM.Common, cfname ) # getting its value in the correct type
247  setattr( flags.PhysVal.IDTPM, trkAnaName+"."+cfname, cfvalue )
248 
249 
251  types = [ getattr( flags.PhysVal.IDTPM, trkAnaName+".TestType" ),
252  getattr( flags.PhysVal.IDTPM, trkAnaName+".RefType" ) ]
253  if "Trigger" in types :
254  setattr( flags.PhysVal.IDTPM, trkAnaName+".doTrigNavigation", True )
255 
256  if trkAnaNames:
257  flags.PhysVal.IDTPM.trkAnaNames = trkAnaNames
258 
259  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:179
InDetTrackPerfMonFlags.initializeIDTPMTrkAnaConfigFlags
def initializeIDTPMTrkAnaConfigFlags(flags)
Create flags category and corresponding set of flags.
Definition: InDetTrackPerfMonFlags.py:189
Trk::split
@ split
Definition: LayerMaterialProperties.h:38