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 299 of file JetValidationToolsConfig.py.

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

◆ Create1DHistoToolCfg()

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

Definition at line 234 of file JetValidationToolsConfig.py.

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

◆ Create2DHistoToolCfg()

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

Definition at line 262 of file JetValidationToolsConfig.py.

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

◆ CreateHistoDefToolCfg()

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

Definition at line 215 of file JetValidationToolsConfig.py.

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

◆ JetEfficiencyResponseHistosCfg()

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

Definition at line 148 of file JetValidationToolsConfig.py.

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

◆ JetHistogramsAndSelectionCfg()

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

Definition at line 113 of file JetValidationToolsConfig.py.

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

◆ JetKinematicHistosCfg()

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

Definition at line 101 of file JetValidationToolsConfig.py.

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

◆ JetMonToolCfg()

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

Definition at line 46 of file JetValidationToolsConfig.py.

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

◆ LeadingJetsRelationsCfg()

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

Definition at line 192 of file JetValidationToolsConfig.py.

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

◆ 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 "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets",
17 "AntiKtVR30Rmax4Rmin02PV0TrackJets",
18 ]
19
20 if flags.Input.isMC:
21 jetcollections +=[
22 "AntiKt4TruthJets",
23 "AntiKt10TruthSoftDropBeta100Zcut10Jets",
24 ]
25
26 fillers = []
27 for col in jetcollections:
28 truthJetCollection = ''
29 if flags.Input.isMC and 'Truth' not in col:
30 if col == 'AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets':
31 truthJetCollection = 'AntiKt10TruthTrimmedPtFrac5SmallR20Jets'
32 elif col == 'AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets':
33 truthJetCollection = 'AntiKt10TruthSoftDropBeta100Zcut10Jets'
34 elif 'AntiKt4' in col:
35 truthJetCollection = 'AntiKt4TruthJets'
36
37 fillers += [ acc.popToolsAndMerge(JetMonToolCfg(flags, JetContainer=col,
38 refcontainer=truthJetCollection)) ]
39
40 kwargs.setdefault("HistoTools", fillers)
41 kwargs.setdefault("IntervalType", 8)
42 acc.setPrivateTools(CompFactory.JetMonitoringTool(name, **kwargs))
43
44 return acc
45