3 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
4 from 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'''
16 "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets",
17 "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets",
18 "AntiKtVR30Rmax4Rmin02PV0TrackJets",
24 "AntiKt10TruthTrimmedPtFrac5SmallR20Jets",
25 "AntiKt10TruthSoftDropBeta100Zcut10Jets",
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'
39 fillers += [ acc.popToolsAndMerge(
JetMonToolCfg(flags, JetContainer=col,
40 refcontainer=truthJetCollection)) ]
42 kwargs.setdefault(
"HistoTools", fillers)
43 kwargs.setdefault(
"IntervalType", 8)
44 acc.setPrivateTools(CompFactory.JetMonitoringTool(name, **kwargs))
49 refcontainer='', onlyKinematics=False, globalSelection='',
52 filler = CompFactory.JetContainerHistoFiller(kwargs[
"JetContainer"]+name, **kwargs)
54 if globalSelection !=
'':
55 print(
"WARNING global selection is not yet supported in CA, returning plots with no selection.")
65 acc.setPrivateTools(filler)
68 filler.HistoTools += [
74 from JetValidation.JetValidationHistoDefs
import GetJetVariables
78 if "kinematics" in var:
80 elif "leadingjettrel" in var:
82 elif "effresponse" in var:
85 from JetMonitoring.JetHistoTools
import compactSpecification
86 spec = compactSpecification[var]
88 binning, attributeInfo = spec
90 binning, attributeInfo))
92 binning, attributeInfo1, attributeInfo2 = spec
93 doTProfile = var.beginswith(
"Prof_")
95 binning, attributeInfo1, attributeInfo2,
96 DoTProfile=doTProfile))
98 filler.HistoTools += [ tool ]
100 acc.setPrivateTools(filler)
106 if "emscale" in name:
107 kwargs.setdefault(
"JetScale",
"JetEMScaleMomentum")
108 elif "constscale" in name:
109 kwargs.setdefault(
"JetScale",
"JetConstitScaleMomentum")
111 acc.setPrivateTools(CompFactory.JetKinematicHistos(name, **kwargs))
116 selection="alljet", histos=[],
120 name_tool = name +
"_" + selection
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)
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)
139 if "kinematics" in histo:
143 histotools += [ tool ]
144 kwargs.setdefault(
"HistoTools", histotools)
146 acc.setPrivateTools(CompFactory.HistosForJetSelection(name_tool, **kwargs))
153 tool = CompFactory.EfficiencyResponseHistos(name, **kwargs)
157 title=
"Jet p_{T} Efficiency #DeltaR = 0.1;p_{T}^{Truth} (GeV);Efficiency",
158 nbinsx=50, xlow=0, xup=100)),
160 title=
"Jet p_{T} Efficiency #DeltaR = 0.2;p_{T}^{Truth} (GeV);Efficiency",
161 nbinsx=50, xlow=0, xup=100)),
163 title=
"Jet p_{T} Efficiency #DeltaR = 0.3;p_{T}^{Truth} (GeV);Efficiency",
164 nbinsx=50, xlow=0, xup=100)),
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)),
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)),
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)),
177 title=
"Jet p_{T} Response;#frac{p_{T}^{Jet}}{p_{T}^{Truth}};Number of jets",
178 nbinsx=50, xlow=0, xup=2)),
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)),
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)),
187 title=
"#DeltaR between Jet and closest Truth Jet;#DeltaR;Number of jets",
188 nbinsx=50, xlow=0, xup=4)),
191 acc.setPrivateTools(tool)
197 tool = CompFactory.LeadingJetsRelations(name, **kwargs)
201 title=
"#Delta #eta (lead, sublead);#Delta#eta;Entries",
202 nbinsx=100, xlow=-10, xup=10)),
204 title=
"#Delta #Phi (lead, sublead);#Delta#Phi;Entries",
205 nbinsx=100, xlow=0, xup=3.142)),
207 title=
"#Delta R (lead, sublead);#Delta R;Entries",
208 nbinsx=100, xlow=0, xup=10)),
210 title=
"(sublead Pt)/(lead Pt);ratio;Entries",
211 nbinsx=100, xlow=0, xup=1.))
214 acc.setPrivateTools(tool)
218 """Short cut to return a HistoDefinitionTool from a compact list of arguments"""
221 kwargs.setdefault(
"title", name)
222 kwargs.setdefault(
"hname", name)
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)
233 acc.setPrivateTools(CompFactory.HistoDefinitionTool(name, **kwargs))
237 binning=None, attributeInfo=None,
241 from JetMonitoring.JetAttributeHistoManager
import unpackto3, findSelectIndex, sanitizeName
242 attName, attType, attGeV =
unpackto3(attributeInfo)
248 kwargs.setdefault(
"AttributeTypes", [ attType ])
249 kwargs.setdefault(
"AttributeNames", [ attName ])
250 kwargs.setdefault(
"AttributeInGeV", [
bool(attGeV) ])
251 kwargs.setdefault(
"SelectIndex", selectIndex)
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(
261 acc.setPrivateTools(CompFactory.JetAttributeHisto(name, **kwargs))
265 binning=None, attributeInfo1=None, attributeInfo2=None,
269 from JetMonitoring.JetAttributeHistoManager
import unpackto3, findSelectIndex, sanitizeName
270 attName1, attType1, attGeV1 =
unpackto3(attributeInfo1)
273 attName2, attType2, attGeV2 =
unpackto3(attributeInfo2)
277 selectIndex = max ( selectIndex1, selectIndex2)
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)
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(
298 acc.setPrivateTools(CompFactory.JetAttributeHisto(name, **kwargs))
304 from JetMonitoring.JetAttributeHistoManager
import interpretSelStr,findSelectIndex
307 if ind>-1
and 'vector' not in typ :
308 typ =
'vector<'+typ+
'>'
312 name = selectString.replace(
'<',
'_inf_')
313 name = name.replace(
'[',
'_')
314 name = name.replace(
']',
'_')
315 name = name.replace(
'.',
'_')
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)