3from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory
import CompFactory
7 '''Following the logic defined for JetMonitoring JetMonitoringStandard.py but adding
8 collections that were present in the old PhysVal config'''
9 acc = ComponentAccumulator()
16 "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets",
17 "AntiKtVR30Rmax4Rmin02PV0TrackJets",
23 "AntiKt10TruthSoftDropBeta100Zcut10Jets",
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'
37 fillers += [ acc.popToolsAndMerge(
JetMonToolCfg(flags, JetContainer=col,
38 refcontainer=truthJetCollection)) ]
40 kwargs.setdefault(
"HistoTools", fillers)
41 kwargs.setdefault(
"IntervalType", 8)
42 acc.setPrivateTools(CompFactory.JetMonitoringTool(name, **kwargs))
47 refcontainer='', onlyKinematics=False, globalSelection='',
49 acc = ComponentAccumulator()
50 filler = CompFactory.JetContainerHistoFiller(kwargs[
"JetContainer"]+name, **kwargs)
52 if globalSelection !=
'':
53 print(
"WARNING global selection is not yet supported in CA, returning plots with no selection.")
63 acc.setPrivateTools(filler)
66 filler.HistoTools += [
72 from JetValidation.JetValidationHistoDefs
import GetJetVariables
73 vars = GetJetVariables(kwargs[
"JetContainer"], refcontainer)
76 if "kinematics" in var:
78 elif "leadingjettrel" in var:
80 elif "effresponse" in var:
83 from JetMonitoring.JetHistoTools
import compactSpecification
84 spec = compactSpecification[var]
86 binning, attributeInfo = spec
88 binning, attributeInfo))
90 binning, attributeInfo1, attributeInfo2 = spec
91 doTProfile = var.beginswith(
"Prof_")
93 binning, attributeInfo1, attributeInfo2,
94 DoTProfile=doTProfile))
96 filler.HistoTools += [ tool ]
98 acc.setPrivateTools(filler)
102 acc = ComponentAccumulator()
104 if "emscale" in name:
105 kwargs.setdefault(
"JetScale",
"JetEMScaleMomentum")
106 elif "constscale" in name:
107 kwargs.setdefault(
"JetScale",
"JetConstitScaleMomentum")
109 acc.setPrivateTools(CompFactory.JetKinematicHistos(name, **kwargs))
114 selection="alljet", histos=[],
116 acc = ComponentAccumulator()
118 name_tool = name +
"_" + selection
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)
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)
137 if "kinematics" in histo:
141 histotools += [ tool ]
142 kwargs.setdefault(
"HistoTools", histotools)
144 acc.setPrivateTools(CompFactory.HistosForJetSelection(name_tool, **kwargs))
149 acc = ComponentAccumulator()
151 tool = CompFactory.EfficiencyResponseHistos(name, **kwargs)
155 title=
"Jet p_{T} Efficiency #DeltaR = 0.1;p_{T}^{Truth} (GeV);Efficiency",
156 nbinsx=50, xlow=0, xup=100)),
158 title=
"Jet p_{T} Efficiency #DeltaR = 0.2;p_{T}^{Truth} (GeV);Efficiency",
159 nbinsx=50, xlow=0, xup=100)),
161 title=
"Jet p_{T} Efficiency #DeltaR = 0.3;p_{T}^{Truth} (GeV);Efficiency",
162 nbinsx=50, xlow=0, xup=100)),
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)),
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)),
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)),
175 title=
"Jet p_{T} Response;#frac{p_{T}^{Jet}}{p_{T}^{Truth}};Number of jets",
176 nbinsx=50, xlow=0, xup=2)),
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)),
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)),
185 title=
"#DeltaR between Jet and closest Truth Jet;#DeltaR;Number of jets",
186 nbinsx=50, xlow=0, xup=4)),
189 acc.setPrivateTools(tool)
193 acc = ComponentAccumulator()
195 tool = CompFactory.LeadingJetsRelations(name, **kwargs)
199 title=
"#Delta #eta (lead, sublead);#Delta#eta;Entries",
200 nbinsx=100, xlow=-10, xup=10)),
202 title=
"#Delta #Phi (lead, sublead);#Delta#Phi;Entries",
203 nbinsx=100, xlow=0, xup=3.142)),
205 title=
"#Delta R (lead, sublead);#Delta R;Entries",
206 nbinsx=100, xlow=0, xup=10)),
208 title=
"(sublead Pt)/(lead Pt);ratio;Entries",
209 nbinsx=100, xlow=0, xup=1.))
212 acc.setPrivateTools(tool)
216 """Short cut to return a HistoDefinitionTool from a compact list of arguments"""
217 acc = ComponentAccumulator()
219 kwargs.setdefault(
"title", name)
220 kwargs.setdefault(
"hname", name)
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)
231 acc.setPrivateTools(CompFactory.HistoDefinitionTool(name, **kwargs))
235 binning=None, attributeInfo=None,
237 acc = ComponentAccumulator()
239 from JetMonitoring.JetAttributeHistoManager
import unpackto3, findSelectIndex, sanitizeName
240 attName, attType, attGeV = unpackto3(attributeInfo)
241 attName, selectIndex = findSelectIndex(attName)
244 hname = sanitizeName(name)
246 kwargs.setdefault(
"AttributeTypes", [ attType ])
247 kwargs.setdefault(
"AttributeNames", [ attName ])
248 kwargs.setdefault(
"AttributeInGeV", [ bool(attGeV) ])
249 kwargs.setdefault(
"SelectIndex", selectIndex)
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(
259 acc.setPrivateTools(CompFactory.JetAttributeHisto(name, **kwargs))
263 binning=None, attributeInfo1=None, attributeInfo2=None,
265 acc = ComponentAccumulator()
267 from JetMonitoring.JetAttributeHistoManager
import unpackto3, findSelectIndex, sanitizeName
268 attName1, attType1, attGeV1 = unpackto3(attributeInfo1)
269 attName1, selectIndex1 = findSelectIndex(attName1)
271 attName2, attType2, attGeV2 = unpackto3(attributeInfo2)
272 attName2, selectIndex2 = findSelectIndex(attName2)
275 selectIndex = max ( selectIndex1, selectIndex2)
278 hname = sanitizeName(name)
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)
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(
296 acc.setPrivateTools(CompFactory.JetAttributeHisto(name, **kwargs))
300 acc = ComponentAccumulator()
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+
'>'
310 name = selectString.replace(
'<',
'_inf_')
311 name = name.replace(
'[',
'_')
312 name = name.replace(
']',
'_')
313 name = name.replace(
'.',
'_')
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)
void print(char *figname, TCanvas *c1)