ATLAS Offline Software
Functions | Variables
JetCalibToolsConfig Namespace Reference

Functions

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

Variables

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

Function Documentation

◆ defineJetCalibTool()

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

Definition at line 185 of file JetCalibToolsConfig.py.

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

◆ getCalibSpecsFromString()

def JetCalibToolsConfig.getCalibSpecsFromString (   jetdef,
  modspec 
)

Definition at line 236 of file JetCalibToolsConfig.py.

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

◆ getJetCalibTool()

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

Definition at line 113 of file JetCalibToolsConfig.py.

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

◆ getJetCalibToolFromString()

def JetCalibToolsConfig.getJetCalibToolFromString (   jetdef,
  modspec 
)

Definition at line 253 of file JetCalibToolsConfig.py.

253 def getJetCalibToolFromString(jetdef, modspec):
254  calibcontext, data_type, calibseq, rhoname, pvname, gscdepth = getCalibSpecsFromString(jetdef, modspec)
255  return getJetCalibTool(jetdef,calibcontext,data_type,calibseq,rhoname,pvname,gscdepth)

◆ getJetCalibToolPrereqs()

def JetCalibToolsConfig.getJetCalibToolPrereqs (   modspec,
  jetdef 
)

Definition at line 205 of file JetCalibToolsConfig.py.

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

Variable Documentation

◆ af2configs

dictionary JetCalibToolsConfig.af2configs
Initial value:
1 = {
2  "AntiKt4EMPFlow": "JES_MC16Recommendation_AFII_PFlow_Apr2019_Rel21.config",
3  "AntiKt4GPFlow": "JES_MC16Recommendation_AFII_PFlow_Apr2019_Rel21.config",
4  "AntiKt4EMTopo": "JES_MC16Recommendation_AFII_EMTopo_Apr2019_Rel21.config",
5  "AntiKt4LCTopo": "JES_MC16Recommendation_AFII_EMTopo_Apr2019_Rel21.config",
6 }

Definition at line 70 of file JetCalibToolsConfig.py.

◆ all

list JetCalibToolsConfig.all = ['getJetCalibTool']

Definition at line 19 of file JetCalibToolsConfig.py.

◆ calibcontexts

dictionary JetCalibToolsConfig.calibcontexts
Initial value:
1 = {
2  # Standard AntiKt4
3  "AntiKt4EMPFlow":pflowcontexts,
4  "AntiKt4EMPFlow_noElectrons":pflowcontexts,
5  "AntiKt4EMPFlow_noMuons":pflowcontexts,
6  "AntiKt4EMPFlow_noLeptons":pflowcontexts,
7  "AntiKt4EMPFlow_tauSeedEleRM":pflowcontexts,
8  "AntiKt4EMPFlowByVertex":pflowcontexts,
9  "AntiKt4GPFlow":pflowcontexts,
10  "AntiKt4UFOCSSK":ufocontexts,
11  "AntiKt4EMTopo":topocontexts,
12  "AntiKt4LCTopo":topocontexts,
13  "AntiKt10LCTopo":fatjetcontexts,
14  # Standard trimmed
15  "AntiKt10LCTopoTrimmedPtFrac5SmallR20":fatjetcontexts,
16  "AntiKt10LCTopoTrimmedPtFrac4SmallR20":fatjetcontexts,
17  # Standard UFO CS+SK jets
18  "AntiKt10UFOCSSKSoftDropBeta100Zcut10":fatjetcontexts,
19  # UFO CS+SK jets with leptons removed
20  "AntiKt10UFOCSSK_noElectronsSoftDropBeta100Zcut10":fatjetcontexts,
21  "AntiKt10UFOCSSK_noMuonsSoftDropBeta100Zcut10":fatjetcontexts,
22  "AntiKt10UFOCSSK_noLeptonsSoftDropBeta100Zcut10":fatjetcontexts,
23  # Large-R PFlow Soft Drop CSSK
24  "AntiKt10EMPFlowCSSKSoftDropBeta100Zcut10":fatjetcontexts,
25  # R-Scan
26  "AntiKt2LCTopo":rscanlc2,
27  "AntiKt6LCTopo":rscanlc6,
28 
29 }

Definition at line 77 of file JetCalibToolsConfig.py.

◆ fatjetcontexts

dictionary JetCalibToolsConfig.fatjetcontexts
Initial value:
1 = {
2  "CombinedMass": ("JES_MC16recommendation_FatJet_Trimmed_JMS_comb_17Oct2018.config","00-04-82","EtaJES_JMS"),
3  "CaloMass": ("JES_MC16recommendation_FatJet_Trimmed_JMS_calo_12Oct2018.config","00-04-82","EtaJES_JMS"),
4  "TAMass": ("JES_MC16recommendation_FatJet_Trimmed_JMS_TA_12Oct2018.config","00-04-82","EtaJES_JMS"),
5  "SoftDrop": ("JES_MC20PreRecommendation_R10_UFO_CSSK_SoftDrop_JMS_R21Insitu_10Mar2023.config","00-04-82","EtaJES_JMS"),
6  "TrigUngroomed": ("JES_Full2012dataset_Rscan_June2014.config","00-04-77","JetArea_EtaJES"),
7  "TrigTrimmed": ("JES_MC15recommendation_FatJet_June2015_PtFrac4.config","00-04-82","EtaJES_JMS"),
8  "TrigSoftDrop": ("JES_MC16recommendation_R10_UFO_CSSK_SoftDrop_JMS_01April2020.config","00-04-82","EtaJES_JMS"),
9  "TrigHLTSoftDrop":("JES_JMS_MC21_R10_PFlow_CSSK_SoftDrop_Dec2023_Trigger.config", "00-04-83","EtaJES_JMS"),
10  "LargeRDNN": ("JES_JMS_MC20dnnc_R10_UFO_CSSK_SoftDrop_Jun2023.config","00-04-83","LargeRDNN"),
11 }

Definition at line 57 of file JetCalibToolsConfig.py.

◆ hasInSitu

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

Definition at line 107 of file JetCalibToolsConfig.py.

◆ jetcaliblog

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

Definition at line 17 of file JetCalibToolsConfig.py.

◆ pflowcontexts

dictionary JetCalibToolsConfig.pflowcontexts
Initial value:
1 = {
2  "T0":("JES_MC15cRecommendation_PFlow_Aug2016_rel21.config","00-04-77","JetArea_Residual_EtaJES"),
3  # Omit smearing, to avoid any efficiency loss
4  "AnalysisLatest":("PreRec_R22_PFlow_ResPU_EtaJES_GSC_February23_230215.config","00-04-82","JetArea_Residual_EtaJES_GSC_Insitu"),
5  "TrigLS2":("JES_MC16Recommendation_Consolidated_PFlow_Apr2019_Rel21_Trigger.config","00-04-82","JetArea_Residual_EtaJES_GSC_Insitu"),
6  "Trigger":("JES_MC16Recommendation_Consolidated_PFlow_30May2022_Rel22_Trigger.config","00-04-82","JetArea_Residual_EtaJES_GSC_Insitu"),
7  "TrigR22Prerec":("PreRec_R22_PFlow_ResPU_EtaJES_GSC_February23_230215.config", "00-04-82", "JetArea_Residual_EtaJES_GSC_Insitu"),
8  "TrigHIUPC" : ("JES_MC16Recommendation_LowMu1718_MCJES_GSC_nTrkOn_PFlow_Sep2023_Rel21.config", "00-04-82", "EtaJES_GSC"),
9 }

Definition at line 24 of file JetCalibToolsConfig.py.

◆ rscanlc2

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

Definition at line 49 of file JetCalibToolsConfig.py.

◆ rscanlc6

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

Definition at line 53 of file JetCalibToolsConfig.py.

◆ topocontexts

dictionary JetCalibToolsConfig.topocontexts
Initial value:
1 = {
2  "T0":("JES_MC15cRecommendation_May2016_rel21.config","00-04-77","JetArea_Residual_EtaJES"),
3  # Omit smearing, to avoid any efficiency loss
4  "AnalysisLatest":("JES_MC16Recommendation_Consolidated_EMTopo_Apr2019_Rel21.config","00-04-82","JetArea_Residual_EtaJES_GSC_Insitu"),
5  "TrigRun2":("JES_MC15cRecommendation_May2016_Trigger.config","00-04-77","JetArea_EtaJES_GSC_Insitu"),
6  "TrigRun2GSC":("JES_data2016_data2015_Recommendation_Dec2016_rel21.config","00-04-77","JetArea_EtaJES_GSC_Insitu"),
7  "TrigLS2":("JES_MC16Recommendation_Consolidated_EMTopo_Apr2019_Rel21_Trigger.config","00-04-82","JetArea_Residual_EtaJES_GSC_Insitu"),
8  "Trigger":("JES_MC16Recommendation_Consolidated_EMTopo_Apr2019_Rel21_Trigger.config","00-04-82","JetArea_Residual_EtaJES_GSC_Insitu"),
9  "HLLHC":("HLLHC/JES_MC16_HLLHC_Aug2021_rel21.config","00-04-82","JetArea_Residual_EtaJES"),
10 }

Definition at line 34 of file JetCalibToolsConfig.py.

◆ ufocontexts

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

Definition at line 45 of file JetCalibToolsConfig.py.

JetCalibToolsConfig.defineJetCalibTool
def defineJetCalibTool(jetcollection, context, configfile, calibarea, calibseq, data_type, rhoname, pvname, gscdepth)
Definition: JetCalibToolsConfig.py:185
vtune_athena.format
format
Definition: vtune_athena.py:14
JetCalibToolsConfig.getCalibSpecsFromString
def getCalibSpecsFromString(jetdef, modspec)
Definition: JetCalibToolsConfig.py:236
JetCalibToolsConfig.getJetCalibToolPrereqs
def getJetCalibToolPrereqs(modspec, jetdef)
Definition: JetCalibToolsConfig.py:205
JetCalibToolsConfig.getJetCalibTool
def getJetCalibTool(jetdef, context, data_type, calibseq="", rhoname="", pvname="PrimaryVertices", gscdepth="auto")
Definition: JetCalibToolsConfig.py:113
python.StandardJetContext.inputsFromContext
def inputsFromContext(inputKey, prefix="", suffix="")
Definition: StandardJetContext.py:112
JetCalibToolsConfig.getJetCalibToolFromString
def getJetCalibToolFromString(jetdef, modspec)
Definition: JetCalibToolsConfig.py:253
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
str
Definition: BTagTrackIpAccessor.cxx:11