ATLAS Offline Software
Loading...
Searching...
No Matches
JetCalibToolsConfig Namespace Reference

Functions

 getJetCalibTool (jetdef, context, data_type, calibseq="", rhoname="", pvname="PrimaryVertices", gscdepth="auto")
 defineJetCalibTool (jetcollection, context, configfile, calibarea, calibseq, data_type, rhoname, pvname, gscdepth)
 getJetCalibToolPrereqs (modspec, jetdef)
 getCalibSpecsFromString (jetdef, modspec)
 getJetCalibToolFromString (jetdef, modspec)

Variables

 jetcaliblog = Logging.logging.getLogger('JetCalibToolsConfig')
list all = ['getJetCalibTool']
dict pflowcontexts
dict topocontexts
dict ufocontexts
dict rscanlc2
dict rscanlc6
dict fatjetcontexts
dict af2configs
dict calibcontexts
list hasInSitu = ["AntiKt4LCTopo", "AntiKt4EMTopo", "AntiKt4EMPFlow", "AntiKt4EMPFlow_noElectrons", "AntiKt4EMPFlow_noMuons", "AntiKt4EMPFlow_noLeptons", "AntiKt4EMPFlow_inclMuons","AntiKt4EMPFlow_tauSeedEleRM","TrigAntiKt4EMTopo"]

Function Documentation

◆ defineJetCalibTool()

defineJetCalibTool ( jetcollection,
context,
configfile,
calibarea,
calibseq,
data_type,
rhoname,
pvname,
gscdepth )

Definition at line 189 of file JetCalibToolsConfig.py.

189def defineJetCalibTool(jetcollection, context, configfile, calibarea, calibseq, data_type, rhoname, pvname, gscdepth):
190 # Abbreviate the calib sequence
191 calibseqshort = ''.join([ step[0] for step in calibseq.split('_') ])
192 toolname = "jetcalib_{0}_{1}_{2}".format(jetcollection,calibseqshort,context)
193 #
194 from AthenaConfiguration.ComponentFactory import CompFactory
195 jct = CompFactory.JetCalibrationTool(toolname,
196 JetCollection = jetcollection,
197 ConfigFile = configfile,
198 CalibArea = calibarea,
199 CalibSequence = calibseq,
200 IsData = (data_type == "data"),
201 RhoKey = rhoname,
202 PrimaryVerticesContainerName = pvname,
203 GSCDepth = gscdepth
204 )
205 return jct
206
207# This method extends the basic config getter to specify the requisite jet
208# moments or other inputs

◆ getCalibSpecsFromString()

getCalibSpecsFromString ( jetdef,
modspec )

Definition at line 240 of file JetCalibToolsConfig.py.

240def getCalibSpecsFromString(jetdef, modspec):
241 calibseq = ""
242 # for the LCTopo EleRM context used for EleRM taus, we need alternative EventShape container
243 rhoname = "EleRM_Kt4LCTopoOriginEventShape" if jetdef.context == "EleRM" else "auto"
244 pvname = "PrimaryVertices"
245 gscdepth = "auto"
246 calibspecs = modspec.split(':')
247 # Probably want data_type to come from elsewhere
248 calibcontext, data_type = calibspecs[:2]
249 if len(calibspecs)>2: calibseq = calibspecs[2]
250 if len(calibspecs)>3: rhoname = calibspecs[3]
251 if len(calibspecs)>4: pvname = calibspecs[4]
252 if len(calibspecs)>5: gscdepth = calibspecs[5]
253
254 return calibcontext, data_type, calibseq, rhoname, pvname, gscdepth
255
256# This method instantiates the JetCalibTool given the input mod specification

◆ getJetCalibTool()

getJetCalibTool ( jetdef,
context,
data_type,
calibseq = "",
rhoname = "",
pvname = "PrimaryVertices",
gscdepth = "auto" )

Definition at line 115 of file JetCalibToolsConfig.py.

115def getJetCalibTool(jetdef, context, data_type, calibseq = "", rhoname = "", pvname = "PrimaryVertices", gscdepth = "auto"):
116
117 jetcollection = jetdef.basename
118
119 # In principle we could autoconfigure
120 if data_type not in ['data','mc','afii']:
121 jetcaliblog.error("JetCalibConfig accepts data_type values: 'data', 'mc', 'afii'")
122 raise ValueError("Unsupported data_type provided: '{0}".format(data_type))
123
124 if jetcollection.endswith("Jets"):
125 jetcaliblog.error("Jet collection '{0}'should be specified w/o 'Jets' in the name.".format(jetcollection))
126 raise ValueError("Bad jet collection formatting in getJetCalibTool.")
127
128 jetcaliblog.debug("Preparing calibration for {0}, in context {1} on sample type {2}".format(jetcollection,context,data_type))
129
130 jetcontexts = calibcontexts[jetcollection]
131
132 if jetcollection == "AntiKt4EMTopo" and context == "T0":
133 if jetdef._cflags.GeoModel.Run >= LHCPeriod.Run4:
134 context = "HLLHC"
135
136 try:
137 configfile, calibarea, calibseq_def = jetcontexts[context]
138 _calibseq = calibseq if calibseq else calibseq_def
139
140 # Check that the calib sequence requests something sensible for the in situ calibration
141 # Leave other checks for the tool code.
142 # Might need to specialise if we decide MC trigger jets should also have in situ.
143 if _calibseq.endswith("Insitu"):
144 if data_type == 'data':
145 if jetcollection not in hasInSitu:
146 raise ValueError("In situ calibration does not exist for {0}, context {1}".format(jetcollection,context))
147 else:
148 raise ValueError("In situ calibration requested for MC on {0}, context {1}".format(jetcollection,context))
149 _configfile = configfile
150 if data_type == "afii" and jetcollection in af2configs.keys():
151 _configfile = af2configs[jetcollection]
152 _data_type = data_type
153 # Most likely an oversight, but R20/21 JetRecCalibrationFinder did not set the data flag
154 # This affects the residual correction by scaling mu.
155 # We should revert this later on, set up now for validation purposes
156 if context == "T0":
157 _data_type = "data"
158 _pvname = ""
159 if "Residual" in _calibseq or "GSC" in _calibseq and gscdepth!="EM3" or "LargeRDNN" in _calibseq:
160 _pvname = pvname
161 # HACK: For Trigger HI UPC who want to do pflow but avoid track-GSC
162 if context == "TrigHIUPC":
163 _pvname = pvname
164 # HACK: For testing while we don't have finalised calibrations for trigger PF jets
165 _jetcollection = jetcollection
166 if "PFlow" in jetcollection and (context=="TrigSoftDrop" or context=="TrigHLTSoftDrop"):
167 _jetcollection = jetcollection.replace("EMPFlow","UFO")
168 if "_noElectrons" in jetcollection :
169 _jetcollection = _jetcollection.replace("_noElectrons","")
170 if "_noMuons" in jetcollection :
171 _jetcollection = _jetcollection.replace("_noMuons","")
172 if "_noLeptons" in jetcollection :
173 _jetcollection = _jetcollection.replace("_noLeptons","")
174 if "_inclMuons" in jetcollection :
175 _jetcollection = _jetcollection.replace("_inclMuons","")
176 if "_tauSeedEleRM" in jetcollection :
177 _jetcollection = _jetcollection.replace("_tauSeedEleRM","")
178
179 if "ByVertex" in jetcollection:
180 _jetcollection = jetcollection.replace("ByVertex","")
181 return defineJetCalibTool(_jetcollection, context, _configfile, calibarea, _calibseq, _data_type, rhoname, _pvname, gscdepth)
182 except KeyError as e:
183 jetcaliblog.error("Context '{0}' not found for jet collection '{1}'".format(context,jetcollection))
184 jetcaliblog.error("Options are '{0}".format(','.join(jetcontexts.keys())))
185 raise e
186 return None
187
188# This method actually sets up the tool

◆ getJetCalibToolFromString()

getJetCalibToolFromString ( jetdef,
modspec )

Definition at line 257 of file JetCalibToolsConfig.py.

257def getJetCalibToolFromString(jetdef, modspec):
258 calibcontext, data_type, calibseq, rhoname, pvname, gscdepth = getCalibSpecsFromString(jetdef, modspec)
259 return getJetCalibTool(jetdef,calibcontext,data_type,calibseq,rhoname,pvname,gscdepth)

◆ getJetCalibToolPrereqs()

getJetCalibToolPrereqs ( modspec,
jetdef )

Definition at line 209 of file JetCalibToolsConfig.py.

209def getJetCalibToolPrereqs(modspec,jetdef):
210 calibcontext, data_type, calibseq, rhoname, pvname, gscdepth = getCalibSpecsFromString(jetdef, modspec)
211 if calibseq=="":
212 cfg, calibarea, calibseq = calibcontexts[jetdef.basename][calibcontext]
213
214 # For now, only dependent on calibseq -- can ignore Insitu, which is
215 # added when getting the concrete tool
216 prereqs = []
217 prereqs.append("mod:ConstitFourMom")
218 if "JetArea" in calibseq: # Will not insert a prefix here
219 if calibcontext.startswith("Trig"): prereqs.append("input:HLT_EventDensity")
220 elif pvname == "PrimaryVertices_initial": prereqs.append("input:EventDensityCustomVtxGNN")
221 elif pvname != "PrimaryVertices": prereqs.append("input:EventDensityCustomVtx")
222 else: prereqs.append(inputsFromContext("EventDensity")(jetdef))
223 if "GSC" in calibseq:
224 prereqs += ["mod:CaloEnergies"]
225 if calibcontext != "TrigRun2": # No track/MS GSC for trigger w/o FTK
226 prereqs += ["mod:TrackMoments",
227 "ghost:MuonSegment"]
228 if "GNNC" in calibseq:
229 prereqs += ["mod:CaloQuality","mod:TrackMoments"]
230 if "CombinedMass" in calibcontext:
231 prereqs += ["mod:TrackSumMoments"]
232 if "LargeRDNN" in calibseq:
233 prereqs += ["mod:CaloEnergiesLargeR","mod:ConstitFrac","mod:groomMRatio","mod:Width",
234 "mod:nsubjettiness","mod:nsubjettinessR","mod:ktsplitter","mod:ecorr",
235 "mod:ecorrR","mod:qw"]
236 jetcaliblog.debug("Prereqs for calibseq '{0}': {1}".format(calibseq,str(prereqs)))
237 return prereqs
238
239# This method translates the mod specification string into calibration specifications

Variable Documentation

◆ af2configs

dict JetCalibToolsConfig.af2configs
Initial value:
= {
"AntiKt4EMPFlow": "JES_MC16Recommendation_AFII_PFlow_Apr2019_Rel21.config",
"AntiKt4GPFlow": "JES_MC16Recommendation_AFII_PFlow_Apr2019_Rel21.config",
"AntiKt4EMTopo": "JES_MC16Recommendation_AFII_EMTopo_Apr2019_Rel21.config",
"AntiKt4LCTopo": "JES_MC16Recommendation_AFII_EMTopo_Apr2019_Rel21.config",
}

Definition at line 70 of file JetCalibToolsConfig.py.

◆ all

list JetCalibToolsConfig.all = ['getJetCalibTool']

Definition at line 19 of file JetCalibToolsConfig.py.

◆ calibcontexts

dict JetCalibToolsConfig.calibcontexts

Definition at line 77 of file JetCalibToolsConfig.py.

◆ fatjetcontexts

dict JetCalibToolsConfig.fatjetcontexts
Initial value:
= {
"CombinedMass": ("JES_MC16recommendation_FatJet_Trimmed_JMS_comb_17Oct2018.config","00-04-82","EtaJES_JMS"),
"CaloMass": ("JES_MC16recommendation_FatJet_Trimmed_JMS_calo_12Oct2018.config","00-04-82","EtaJES_JMS"),
"TAMass": ("JES_MC16recommendation_FatJet_Trimmed_JMS_TA_12Oct2018.config","00-04-82","EtaJES_JMS"),
"SoftDrop": ("JES_MC20PreRecommendation_R10_UFO_CSSK_SoftDrop_JMS_R21Insitu_26Nov2024.config","00-04-83","EtaJES_JMS"),
"TrigUngroomed": ("JES_Full2012dataset_Rscan_June2014.config","00-04-77","JetArea_EtaJES"),
"TrigTrimmed": ("JES_MC15recommendation_FatJet_June2015_PtFrac4.config","00-04-82","EtaJES_JMS"),
"TrigSoftDrop": ("JES_MC16recommendation_R10_UFO_CSSK_SoftDrop_JMS_01April2020.config","00-04-82","EtaJES_JMS"),
"TrigHLTSoftDrop":("JES_JMS_MC21_R10_PFlow_CSSK_SoftDrop_Dec2023_Trigger.config", "00-04-83","EtaJES_JMS"),
"LargeRDNN": ("JES_JMS_MC20dnnc_R10_UFO_CSSK_SoftDrop_Jun2023.config","00-04-83","LargeRDNN"),
}

Definition at line 57 of file JetCalibToolsConfig.py.

◆ hasInSitu

list JetCalibToolsConfig.hasInSitu = ["AntiKt4LCTopo", "AntiKt4EMTopo", "AntiKt4EMPFlow", "AntiKt4EMPFlow_noElectrons", "AntiKt4EMPFlow_noMuons", "AntiKt4EMPFlow_noLeptons", "AntiKt4EMPFlow_inclMuons","AntiKt4EMPFlow_tauSeedEleRM","TrigAntiKt4EMTopo"]

Definition at line 109 of file JetCalibToolsConfig.py.

◆ jetcaliblog

JetCalibToolsConfig.jetcaliblog = Logging.logging.getLogger('JetCalibToolsConfig')

Definition at line 17 of file JetCalibToolsConfig.py.

◆ pflowcontexts

dict JetCalibToolsConfig.pflowcontexts
Initial value:
= {
"T0":("JES_MC15cRecommendation_PFlow_Aug2016_rel21.config","00-04-77","JetArea_Residual_EtaJES"),
# Omit smearing, to avoid any efficiency loss
"AnalysisLatest":("PreRec_R22_PFlow_ResPU_EtaJES_GSC_February23_230215.config","00-04-82","JetArea_Residual_EtaJES_GSC_Insitu"),
"TrigLS2":("JES_MC16Recommendation_Consolidated_PFlow_Apr2019_Rel21_Trigger.config","00-04-82","JetArea_Residual_EtaJES_GSC_Insitu"),
"Trigger":("JES_MC16Recommendation_Consolidated_PFlow_30May2022_Rel22_Trigger.config","00-04-82","JetArea_Residual_EtaJES_GSC_Insitu"),
"TrigR22Prerec":("PreRec_R22_PFlow_ResPU_EtaJES_GSC_February23_230215.config", "00-04-82", "JetArea_Residual_EtaJES_GSC_Insitu"),
"TrigHIUPC" : ("JES_MC16Recommendation_LowMu1718_MCJES_GSC_nTrkOn_PFlow_Sep2023_Rel21.config", "00-04-82", "EtaJES_GSC"),
}

Definition at line 24 of file JetCalibToolsConfig.py.

◆ rscanlc2

dict JetCalibToolsConfig.rscanlc2
Initial value:
= {
"RScanLatest":("JES_MC16Recommendation_Rscan2LC_22Feb2018_rel21.config","00-04-81","JetArea_Residual_EtaJES_GSC_Insitu")
}

Definition at line 49 of file JetCalibToolsConfig.py.

◆ rscanlc6

dict JetCalibToolsConfig.rscanlc6
Initial value:
= {
"RScanLatest":("JES_MC16Recommendation_Rscan6LC_22Feb2018_rel21.config","00-04-81","JetArea_Residual_EtaJES_GSC_Insitu")
}

Definition at line 53 of file JetCalibToolsConfig.py.

◆ topocontexts

dict JetCalibToolsConfig.topocontexts
Initial value:
= {
"T0":("JES_MC15cRecommendation_May2016_rel21.config","00-04-77","JetArea_Residual_EtaJES"),
# Omit smearing, to avoid any efficiency loss
"AnalysisLatest":("JES_MC16Recommendation_Consolidated_EMTopo_Apr2019_Rel21.config","00-04-82","JetArea_Residual_EtaJES_GSC_Insitu"),
"TrigRun2":("JES_MC15cRecommendation_May2016_Trigger.config","00-04-77","JetArea_EtaJES_GSC_Insitu"),
"TrigRun2GSC":("JES_data2016_data2015_Recommendation_Dec2016_rel21.config","00-04-77","JetArea_EtaJES_GSC_Insitu"),
"TrigLS2":("JES_MC16Recommendation_Consolidated_EMTopo_Apr2019_Rel21_Trigger.config","00-04-82","JetArea_Residual_EtaJES_GSC_Insitu"),
"Trigger":("JES_MC16Recommendation_Consolidated_EMTopo_Apr2019_Rel21_Trigger.config","00-04-82","JetArea_Residual_EtaJES_GSC_Insitu"),
"HLLHC":("HLLHC/JES_MC16_HLLHC_Aug2021_rel21.config","00-04-82","JetArea_Residual_EtaJES"),
}

Definition at line 34 of file JetCalibToolsConfig.py.

◆ ufocontexts

dict JetCalibToolsConfig.ufocontexts
Initial value:
= {
"T0":("Consolidated_R22_CSSKUFO_ResPU_EtaJES_GNNC_20231103.config", "00-04-83", "Residual_EtaJES_GNNC"),
}

Definition at line 45 of file JetCalibToolsConfig.py.