ATLAS Offline Software
Loading...
Searching...
No Matches
python.JetValidationToolsConfig Namespace Reference

Functions

 PhysValJetToolCfg (flags, name="PhysValJetTool", **kwargs)
 JetMonToolCfg (flags, name="HistoFiller", refcontainer='', onlyKinematics=False, globalSelection='', **kwargs)
 JetKinematicHistosCfg (flags, name, **kwargs)
 JetHistogramsAndSelectionCfg (flags, name="hjsel", selection="alljet", histos=[], **kwargs)
 JetEfficiencyResponseHistosCfg (flags, name, **kwargs)
 LeadingJetsRelationsCfg (flags, name="leadingjetrel", **kwargs)
 CreateHistoDefToolCfg (flags, name, **kwargs)
 Create1DHistoToolCfg (flags, name, binning=None, attributeInfo=None, **kwargs)
 Create2DHistoToolCfg (flags, name, binning=None, attributeInfo1=None, attributeInfo2=None, **kwargs)
 AddSelectorCfg (flags, name="", selectString="", typ="float")

Function Documentation

◆ AddSelectorCfg()

python.JetValidationToolsConfig.AddSelectorCfg ( flags,
name = "",
selectString = "",
typ = "float" )

Definition at line 301 of file JetValidationToolsConfig.py.

301def AddSelectorCfg(flags, name="", selectString="", typ="float"):
302 acc = ComponentAccumulator()
303
304 from JetMonitoring.JetAttributeHistoManager import interpretSelStr,findSelectIndex
305 cmin, att, cmax = interpretSelStr(selectString)
306 att, ind = findSelectIndex(att)
307 if ind>-1 and 'vector' not in typ :
308 typ = 'vector<'+typ+'>'
309
310 if name == "":
311 # try to build a unique name
312 name = selectString.replace('<','_inf_')
313 name = name.replace('[','_')
314 name = name.replace(']','_')
315 name = name.replace('.','_')
316 name = 'sel_'+name
317
318 tool = CompFactory.JetSelectorAttributeRunII(name, Attribute=att, AttributeType=typ, VectorIndex=ind)
319 if cmin is not None: tool.CutMin = cmin
320 if cmax is not None: tool.CutMax = cmax
321 acc.setPrivateTools(tool)
322 return acc
323

◆ Create1DHistoToolCfg()

python.JetValidationToolsConfig.Create1DHistoToolCfg ( flags,
name,
binning = None,
attributeInfo = None,
** kwargs )

Definition at line 236 of file JetValidationToolsConfig.py.

238 **kwargs):
239 acc = ComponentAccumulator()
240
241 from JetMonitoring.JetAttributeHistoManager import unpackto3, findSelectIndex, sanitizeName
242 attName, attType, attGeV = unpackto3(attributeInfo)
243 attName, selectIndex = findSelectIndex(attName) # 'JVF[1]' --> 'JVF', 1
244
245 #hname = name if selectIndex==-1 else (name+'_'+str(selectIndex))
246 hname = sanitizeName(name) # remove [ and ] which can be problematic in histo names
247
248 kwargs.setdefault("AttributeTypes", [ attType ])
249 kwargs.setdefault("AttributeNames", [ attName ])
250 kwargs.setdefault("AttributeInGeV", [ bool(attGeV) ])
251 kwargs.setdefault("SelectIndex", selectIndex)
252
253 bin_args = {}
254 bin_args["title"] = binning[0]
255 bin_args["nbinsx"] = binning[1]
256 bin_args["xlow"] = binning[2]
257 bin_args["xup"] = binning[3]
258 kwargs.setdefault("HistoDef", acc.popToolsAndMerge(
259 CreateHistoDefToolCfg(flags, hname, **bin_args)))
260
261 acc.setPrivateTools(CompFactory.JetAttributeHisto(name, **kwargs))
262 return acc
263

◆ Create2DHistoToolCfg()

python.JetValidationToolsConfig.Create2DHistoToolCfg ( flags,
name,
binning = None,
attributeInfo1 = None,
attributeInfo2 = None,
** kwargs )

Definition at line 264 of file JetValidationToolsConfig.py.

266 **kwargs):
267 acc = ComponentAccumulator()
268
269 from JetMonitoring.JetAttributeHistoManager import unpackto3, findSelectIndex, sanitizeName
270 attName1, attType1, attGeV1 = unpackto3(attributeInfo1)
271 attName1, selectIndex1 = findSelectIndex(attName1)
272
273 attName2, attType2, attGeV2 = unpackto3(attributeInfo2)
274 attName2, selectIndex2 = findSelectIndex(attName2)
275
276 # currently support only vector<float> vs float, so there can be only one selected index.
277 selectIndex = max ( selectIndex1, selectIndex2)
278
279 #hname = name if selectIndex==-1 else (name+'_'+str(selectIndex))
280 hname = sanitizeName(name) # remove [ and ] which can be problematic in histo names
281
282 kwargs.setdefault("AttributeTypes", [ attType1, attType2 ])
283 kwargs.setdefault("AttributeNames", [ attName1, attName2 ])
284 kwargs.setdefault("AttributeInGeV", [ bool(attGeV1), bool(attGeV2) ])
285 kwargs.setdefault("SelectIndex", selectIndex)
286
287 bin_args = {}
288 bin_args["title"] = binning[0]
289 bin_args["nbinsx"] = binning[1]
290 bin_args["xlow"] = binning[2]
291 bin_args["xup"] = binning[3]
292 bin_args["nbinsy"] = binning[4]
293 bin_args["ylow"] = binning[5]
294 bin_args["yup"] = binning[6]
295 kwargs.setdefault("HistoDef", acc.popToolsAndMerge(
296 CreateHistoDefToolCfg(flags, hname, **bin_args)))
297
298 acc.setPrivateTools(CompFactory.JetAttributeHisto(name, **kwargs))
299 return acc
300

◆ CreateHistoDefToolCfg()

python.JetValidationToolsConfig.CreateHistoDefToolCfg ( flags,
name,
** kwargs )
Short cut to return a HistoDefinitionTool from a compact list of arguments

Definition at line 217 of file JetValidationToolsConfig.py.

217def CreateHistoDefToolCfg(flags, name, **kwargs):
218 """Short cut to return a HistoDefinitionTool from a compact list of arguments"""
219 acc = ComponentAccumulator()
220
221 kwargs.setdefault("title", name)
222 kwargs.setdefault("hname", name)
223
224 # All of those are default which can be overriden from config call
225 kwargs.setdefault("nbinsx", 10)
226 kwargs.setdefault("xlow", 10.0)
227 kwargs.setdefault("xup", 1.0)
228 kwargs.setdefault("nbinsy", 10)
229 kwargs.setdefault("ylow", 0.0)
230 kwargs.setdefault("yup", 1.0)
231
232 name = "hdef_"+name # athena can causes conflicts when tools of different types have same names
233 acc.setPrivateTools(CompFactory.HistoDefinitionTool(name, **kwargs))
234 return acc
235

◆ JetEfficiencyResponseHistosCfg()

python.JetValidationToolsConfig.JetEfficiencyResponseHistosCfg ( flags,
name,
** kwargs )

Definition at line 150 of file JetValidationToolsConfig.py.

150def JetEfficiencyResponseHistosCfg(flags, name, **kwargs):
151 acc = ComponentAccumulator()
152
153 tool = CompFactory.EfficiencyResponseHistos(name, **kwargs)
154
155 tool.HistoDef = [
156 acc.popToolsAndMerge(CreateHistoDefToolCfg(flags, name='erhEfficiencyR1',
157 title="Jet p_{T} Efficiency #DeltaR = 0.1;p_{T}^{Truth} (GeV);Efficiency",
158 nbinsx=50, xlow=0, xup=100)),
159 acc.popToolsAndMerge(CreateHistoDefToolCfg(flags, name='erhEfficiencyR2',
160 title="Jet p_{T} Efficiency #DeltaR = 0.2;p_{T}^{Truth} (GeV);Efficiency",
161 nbinsx=50, xlow=0, xup=100)),
162 acc.popToolsAndMerge(CreateHistoDefToolCfg(flags, name='erhEfficiencyR3',
163 title="Jet p_{T} Efficiency #DeltaR = 0.3;p_{T}^{Truth} (GeV);Efficiency",
164 nbinsx=50, xlow=0, xup=100)),
165
166 acc.popToolsAndMerge(CreateHistoDefToolCfg(flags, name='erhResponse',
167 title="Jet p_{T} Response;#frac{p_{T}^{Jet} - p_{T}^{Truth}}{p_{T}^{Truth}};Number of jets",
168 nbinsx=50, xlow=-1, xup=1)),
169 acc.popToolsAndMerge(CreateHistoDefToolCfg(flags, name='erhResponseVsEta',
170 title="Jet p_{T} Response vs #eta;#eta of jet;#frac{p_{T}^{Jet} - p_{T}^{Truth}}{p_{T}^{Truth}}",
171 nbinsx=50, xlow=-5, xup=5)),
172 acc.popToolsAndMerge(CreateHistoDefToolCfg(flags, name='erhResponseVsPt',
173 title="Jet p_{T} Response vs p_{T};p_{T}^{Truth} of jet;#frac{p_{T}^{Jet} - p_{T}^{Truth}}{p_{T}^{Truth}}",
174 nbinsx=50, xlow=0, xup=1000)),
175
176 acc.popToolsAndMerge(CreateHistoDefToolCfg(flags, name='erhResponse_noShift',
177 title="Jet p_{T} Response;#frac{p_{T}^{Jet}}{p_{T}^{Truth}};Number of jets",
178 nbinsx=50, xlow=0, xup=2)),
179 acc.popToolsAndMerge(CreateHistoDefToolCfg(flags, name='erhResponseVsEta_noShift',
180 title="Jet p_{T} Response vs #eta;#eta of jet;#frac{p_{T}^{Jet}}{p_{T}^{Truth}}",
181 nbinsx=50, xlow=-5, xup=5)),
182 acc.popToolsAndMerge(CreateHistoDefToolCfg(flags, name='erhResponseVsPt_noShift',
183 title="Jet p_{T} Response vs p_{T};p_{T}^{Truth} of jet;#frac{p_{T}^{Jet}}{p_{T}^{Truth}}",
184 nbinsx=50, xlow=0, xup=1000)),
185
186 acc.popToolsAndMerge(CreateHistoDefToolCfg(flags, name='erhDeltaR',
187 title="#DeltaR between Jet and closest Truth Jet;#DeltaR;Number of jets",
188 nbinsx=50, xlow=0, xup=4)),
189 ]
190
191 acc.setPrivateTools(tool)
192 return acc
193

◆ JetHistogramsAndSelectionCfg()

python.JetValidationToolsConfig.JetHistogramsAndSelectionCfg ( flags,
name = "hjsel",
selection = "alljet",
histos = [],
** kwargs )

Definition at line 115 of file JetValidationToolsConfig.py.

117 **kwargs):
118 acc = ComponentAccumulator()
119
120 name_tool = name + "_" + selection
121
122 if "alljet" == selection:
123 kwargs.setdefault("SelectionType", 0)
124 elif "leadingjet" == selection:
125 kwargs.setdefault("SelectionType", 1)
126 elif "subleadingjet" == selection:
127 kwargs.setdefault("SelectionType", 2)
128
129 else:
130 kwargs.setdefault("SelectionType", 3)
131 selTool = acc.popToolsAndMerge(AddSelectorCfg(flags, selectString=selection))
132 name_tool = name + "_" + selTool.name
133 kwargs.setdefault("JetSelectorTool", selTool)
134 kwargs.setdefault("HistoTitleSuffix", '('+selection+')')
135 kwargs.setdefault("HistoNameSuffix", selTool.name)
136
137 histotools = []
138 for histo in histos:
139 if "kinematics" in histo:
140 tool = acc.popToolsAndMerge(JetKinematicHistosCfg(flags, histo))
141 else:
142 tool = acc.popToolsAndMerge(CreateHistoDefToolCfg(flags, histo))
143 histotools += [ tool ]
144 kwargs.setdefault("HistoTools", histotools)
145
146 acc.setPrivateTools(CompFactory.HistosForJetSelection(name_tool, **kwargs))
147 return acc
148
149

◆ JetKinematicHistosCfg()

python.JetValidationToolsConfig.JetKinematicHistosCfg ( flags,
name,
** kwargs )

Definition at line 103 of file JetValidationToolsConfig.py.

103def JetKinematicHistosCfg(flags, name, **kwargs):
104 acc = ComponentAccumulator()
105
106 if "emscale" in name:
107 kwargs.setdefault("JetScale", "JetEMScaleMomentum")
108 elif "constscale" in name:
109 kwargs.setdefault("JetScale", "JetConstitScaleMomentum")
110
111 acc.setPrivateTools(CompFactory.JetKinematicHistos(name, **kwargs))
112
113 return acc
114

◆ JetMonToolCfg()

python.JetValidationToolsConfig.JetMonToolCfg ( flags,
name = "HistoFiller",
refcontainer = '',
onlyKinematics = False,
globalSelection = '',
** kwargs )

Definition at line 48 of file JetValidationToolsConfig.py.

50 **kwargs):
51 acc = ComponentAccumulator()
52 filler = CompFactory.JetContainerHistoFiller(kwargs["JetContainer"]+name, **kwargs)
53
54 if globalSelection !='':
55 print("WARNING global selection is not yet supported in CA, returning plots with no selection.")
56
57 filler.HistoTools = [
58 acc.popToolsAndMerge(JetKinematicHistosCfg(flags, 'kinematics',
59 PlotOccupancy=False,
60 PlotAveragePt=False,
61 PlotNJet=True))
62 ]
63
64 if onlyKinematics: #TODO add JetValidation flags for these
65 acc.setPrivateTools(filler)
66 return acc
67
68 filler.HistoTools += [
69 acc.popToolsAndMerge(JetHistogramsAndSelectionCfg(flags, selection="leadingjet", histos=["basickinematics"])),
70 acc.popToolsAndMerge(JetHistogramsAndSelectionCfg(flags, selection="subleadingjet", histos=["basickinematics"]))
71 ]
72
73
74 from JetValidation.JetValidationHistoDefs import GetJetVariables
75 vars = GetJetVariables(kwargs["JetContainer"], refcontainer)
76
77 for var in vars:
78 if "kinematics" in var:
79 tool = acc.popToolsAndMerge(JetKinematicHistosCfg(flags, var))
80 elif "leadingjettrel" in var:
81 tool = acc.popToolsAndMerge(LeadingJetsRelationsCfg(flags, var))
82 elif "effresponse" in var:
83 tool = acc.popToolsAndMerge(JetEfficiencyResponseHistosCfg(flags, var, RefContainer=refcontainer))
84 else:
85 from JetMonitoring.JetHistoTools import compactSpecification
86 spec = compactSpecification[var]
87 if len(spec) == 2:
88 binning, attributeInfo = spec
89 tool = acc.popToolsAndMerge(Create1DHistoToolCfg(flags, var,
90 binning, attributeInfo))
91 if len(spec) == 3:
92 binning, attributeInfo1, attributeInfo2 = spec
93 doTProfile = var.beginswith("Prof_")
94 tool = acc.popToolsAndMerge(Create2DHistoToolCfg(flags, var,
95 binning, attributeInfo1, attributeInfo2,
96 DoTProfile=doTProfile))
97
98 filler.HistoTools += [ tool ]
99
100 acc.setPrivateTools(filler)
101 return acc
102
void print(char *figname, TCanvas *c1)

◆ LeadingJetsRelationsCfg()

python.JetValidationToolsConfig.LeadingJetsRelationsCfg ( flags,
name = "leadingjetrel",
** kwargs )

Definition at line 194 of file JetValidationToolsConfig.py.

194def LeadingJetsRelationsCfg(flags, name="leadingjetrel", **kwargs):
195 acc = ComponentAccumulator()
196
197 tool = CompFactory.LeadingJetsRelations(name, **kwargs)
198
199 tool.HistoDef = [
200 acc.popToolsAndMerge(CreateHistoDefToolCfg(flags, name='ljrDeltaEta',
201 title="#Delta #eta (lead, sublead);#Delta#eta;Entries",
202 nbinsx=100, xlow=-10, xup=10)),
203 acc.popToolsAndMerge(CreateHistoDefToolCfg(flags, name='ljrDeltaPhi',
204 title="#Delta #Phi (lead, sublead);#Delta#Phi;Entries",
205 nbinsx=100, xlow=0, xup=3.142)),
206 acc.popToolsAndMerge(CreateHistoDefToolCfg(flags, name='ljrDeltaR',
207 title="#Delta R (lead, sublead);#Delta R;Entries",
208 nbinsx=100, xlow=0, xup=10)),
209 acc.popToolsAndMerge(CreateHistoDefToolCfg(flags, name='ljrFrac',
210 title="(sublead Pt)/(lead Pt);ratio;Entries",
211 nbinsx=100, xlow=0, xup=1.))
212 ]
213
214 acc.setPrivateTools(tool)
215 return acc
216

◆ PhysValJetToolCfg()

python.JetValidationToolsConfig.PhysValJetToolCfg ( flags,
name = "PhysValJetTool",
** kwargs )
Following the logic defined for JetMonitoring JetMonitoringStandard.py but adding
collections that were present in the old PhysVal config

Definition at line 6 of file JetValidationToolsConfig.py.

6def PhysValJetToolCfg(flags, name="PhysValJetTool", **kwargs):
7 '''Following the logic defined for JetMonitoring JetMonitoringStandard.py but adding
8 collections that were present in the old PhysVal config'''
9 acc = ComponentAccumulator()
10
11 # create a list of JetMonitoringAlg specifications
12 jetcollections = [
13 "AntiKt4LCTopoJets",
14 "AntiKt4EMTopoJets",
15 "AntiKt4EMPFlowJets",
16 "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets",
17 "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets",
18 "AntiKtVR30Rmax4Rmin02PV0TrackJets",
19 ]
20
21 if flags.Input.isMC:
22 jetcollections +=[
23 "AntiKt4TruthJets",
24 "AntiKt10TruthTrimmedPtFrac5SmallR20Jets",
25 "AntiKt10TruthSoftDropBeta100Zcut10Jets",
26 ]
27
28 fillers = []
29 for col in jetcollections:
30 truthJetCollection = ''
31 if flags.Input.isMC and 'Truth' not in col:
32 if col == 'AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets':
33 truthJetCollection = 'AntiKt10TruthTrimmedPtFrac5SmallR20Jets'
34 elif col == 'AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets':
35 truthJetCollection = 'AntiKt10TruthSoftDropBeta100Zcut10Jets'
36 elif 'AntiKt4' in col:
37 truthJetCollection = 'AntiKt4TruthJets'
38
39 fillers += [ acc.popToolsAndMerge(JetMonToolCfg(flags, JetContainer=col,
40 refcontainer=truthJetCollection)) ]
41
42 kwargs.setdefault("HistoTools", fillers)
43 kwargs.setdefault("IntervalType", 8)
44 acc.setPrivateTools(CompFactory.JetMonitoringTool(name, **kwargs))
45
46 return acc
47