ATLAS Offline Software
Functions | Variables
ParticleJetToolsConfig Namespace Reference

Functions

def isAnalysisRelease ()
 
def getMCTruthClassifier ()
 
def getCopyTruthLabelParticles (truthtype)
 
def getCopyTruthJetParticles (modspec, cflags)
 
def _getCommonLabelNames (prefix)
 
def getJetDeltaRFlavorLabelTool (name='jetdrlabeler', jet_pt_min=5000, collection="Final", dr_max=0.3)
 
def getJetQuarkChargeLabelTool (name='jetquarkcharge', output_label="QuarkChargeTruthLabelID", hadron_label="HadronGhostInitialTruthLabelPdgId", parton_label="PartonExtendedTruthLabelID")
 
def getJetDeltaRLabelTool (jetdef, modspec)
 
def getJetQuarkChargeTool (jetdef, modspec)
 
def getJetDeltaRInitialLabelTool (jetdef, modspec)
 
def getJetGhostFlavorLabelTool (name="jetghostlabeler", collection="Final")
 
def getJetGhostInitialLabelTool (jetdef, modspec)
 
def getJetGhostLabelTool (jetdef, modspec)
 
def getJetTruthLabelTool (jetdef, modspec)
 
def getJetTruthLabelToolPrereqs (jetdef, modspec)
 
def getJetPileupLabelTool (jetdef, modspec)
 

Variables

 jrtlog = Logging.logging.getLogger('ParticleJetToolsConfig')
 
dictionary truthpartoptions
 

Function Documentation

◆ _getCommonLabelNames()

def ParticleJetToolsConfig._getCommonLabelNames (   prefix)
private
Internal unlity to name labels

Returns a dictionary to configure labeling tools. Takes one
argument which is prefixed to each label.

Definition at line 89 of file ParticleJetToolsConfig.py.

89 def _getCommonLabelNames(prefix):
90  """Internal unlity to name labels
91 
92  Returns a dictionary to configure labeling tools. Takes one
93  argument which is prefixed to each label.
94  """
95  return dict(
96  LabelName=f"{prefix}TruthLabelID",
97  DoubleLabelName=f"{prefix}ExtendedTruthLabelID",
98  LabelPtName=f"{prefix}TruthLabelPt",
99  LabelLxyName=f"{prefix}TruthLabelLxy",
100  LabelDRName=f"{prefix}TruthLabelDR",
101  LabelPdgIdName=f"{prefix}TruthLabelPdgId",
102  LabelPositionDPhiName=f"{prefix}TruthLabelPositionDPhi",
103  LabelPositionDEtaName=f"{prefix}TruthLabelPositionDEta",
104  LabelBarcodeName=f"{prefix}TruthLabelBarcode",
105  ChildLxyName=f"{prefix}TruthLabelChildLxy",
106  ChildPtName=f"{prefix}TruthLabelChildPt",
107  ChildPdgIdName=f"{prefix}TruthLabelChildPdgId",
108  ChildPositionDPhiName=f"{prefix}TruthLabelChildPositionDPhi",
109  ChildPositionDEtaName=f"{prefix}TruthLabelChildPositionDEta",
110  )
111 
112 

◆ getCopyTruthJetParticles()

def ParticleJetToolsConfig.getCopyTruthJetParticles (   modspec,
  cflags 
)

Definition at line 63 of file ParticleJetToolsConfig.py.

63 def getCopyTruthJetParticles(modspec, cflags):
64  truthclassif = getMCTruthClassifier()
65 
66  truthpartcopy = CompFactory.CopyTruthJetParticles(
67  "truthpartcopy"+modspec,
68  OutputName="JetInputTruthParticles"+modspec,
69  MCTruthClassifier=truthclassif)
70  if modspec=="NoWZ":
71  truthpartcopy.IncludePromptLeptons=False
72  truthpartcopy.IncludePromptPhotons=False
73  truthpartcopy.IncludeMuons=True
74  truthpartcopy.IncludeNeutrinos=True
75  if modspec=="DressedWZ":
76  truthpartcopy.IncludePromptLeptons=False
77  truthpartcopy.IncludePromptPhotons=True
78  truthpartcopy.IncludeMuons=True
79  truthpartcopy.IncludeNeutrinos=True
80  truthpartcopy.DressingDecorationNames=['TruthParticles.dressedPhoton_e','TruthParticles.dressedPhoton_mu']
81 
82  truthpartcopy.ExtraInputs = {( 'xAOD::TruthParticleContainer' , 'StoreGateSvc+TruthParticles.dressedPhoton_e' ),
83  ( 'xAOD::TruthParticleContainer' , 'StoreGateSvc+TruthParticles.dressedPhoton_mu' )}
84  if modspec=="Charged":
85  truthpartcopy.ChargedParticlesOnly=True
86  return truthpartcopy
87 
88 

◆ getCopyTruthLabelParticles()

def ParticleJetToolsConfig.getCopyTruthLabelParticles (   truthtype)

Definition at line 43 of file ParticleJetToolsConfig.py.

43 def getCopyTruthLabelParticles(truthtype):
44  toolProperties = {}
45  if truthtype == "Partons":
46  truthcategory = "Partons"
47  elif truthtype in ["WBosons", "ZBosons", "HBosons", "TQuarksFinal"]:
48  truthcategory = "BosonTop"
49  toolProperties['ParticleType'] = truthtype
50  else:
51  truthcategory = "FlavourLabel"
52  toolProperties['ParticleType'] = truthtype
53 
54  tooltype = truthpartoptions[truthcategory]["ToolType"]
55  toolProperties.update( PtMin = truthpartoptions[truthcategory]["ptmin"],
56  OutputName = "TruthLabel"+truthtype)
57  ctp = tooltype("truthpartcopy_"+truthtype,
58  **toolProperties
59  )
60  return ctp
61 
62 # Generates input truth particle containers for truth jets

◆ getJetDeltaRFlavorLabelTool()

def ParticleJetToolsConfig.getJetDeltaRFlavorLabelTool (   name = 'jetdrlabeler',
  jet_pt_min = 5000,
  collection = "Final",
  dr_max = 0.3 
)
Get the standard flavor tagging delta-R labeling tool

Uses cone matching to B, C and tau truth particles.

Definition at line 113 of file ParticleJetToolsConfig.py.

113 def getJetDeltaRFlavorLabelTool(name='jetdrlabeler', jet_pt_min=5000, collection="Final", dr_max=0.3):
114  """Get the standard flavor tagging delta-R labeling tool
115 
116  Uses cone matching to B, C and tau truth particles.
117  """
118  prefix_to_name = "HadronConeExcl"
119  if collection != "Final":
120  prefix_to_name += collection
121  name+=collection
122 
123  return CompFactory.ParticleJetDeltaRLabelTool(
124  name,
125  **_getCommonLabelNames(prefix_to_name),
126  BLabelName = "ConeExclBHadrons"+collection,
127  CLabelName = "ConeExclCHadrons"+collection,
128  TauLabelName = "ConeExclTausFinal",
129  BParticleCollection = "TruthLabelBHadrons"+collection,
130  CParticleCollection = "TruthLabelCHadrons"+collection,
131  TauParticleCollection = "TruthLabelTausFinal",
132  PartPtMin = 5000.,
133  DRMax = dr_max,
134  MatchMode = "MinDR",
135  JetPtMin = jet_pt_min,
136  )
137 
138 

◆ getJetDeltaRInitialLabelTool()

def ParticleJetToolsConfig.getJetDeltaRInitialLabelTool (   jetdef,
  modspec 
)
returns a ParticleJetDeltaRLabelTool
Cone matching for B, C and tau truth for all but track jets.

This function is meant to be used as callback from JetRecConfig where
it is called as func(jetdef, modspec). Hence the jetdef argument even if not used in this case.

Definition at line 184 of file ParticleJetToolsConfig.py.

184 def getJetDeltaRInitialLabelTool(jetdef, modspec):
185  """returns a ParticleJetDeltaRLabelTool
186  Cone matching for B, C and tau truth for all but track jets.
187 
188  This function is meant to be used as callback from JetRecConfig where
189  it is called as func(jetdef, modspec). Hence the jetdef argument even if not used in this case.
190  """
191  jetptmin = float(modspec)
192  name = "jetdrlabeler_jetpt{0}GeV".format(int(jetptmin/1000))
193  return getJetDeltaRFlavorLabelTool(name, jetptmin, collection = "Initial")
194 
195 

◆ getJetDeltaRLabelTool()

def ParticleJetToolsConfig.getJetDeltaRLabelTool (   jetdef,
  modspec 
)
returns a ParticleJetDeltaRLabelTool
Cone matching for B, C and tau truth for all but track jets.

This function is meant to be used as callback from JetRecConfig where
it is called as func(jetdef, modspec). Hence the jetdef argument even if not used in this case.

Definition at line 158 of file ParticleJetToolsConfig.py.

158 def getJetDeltaRLabelTool(jetdef, modspec):
159  """returns a ParticleJetDeltaRLabelTool
160  Cone matching for B, C and tau truth for all but track jets.
161 
162  This function is meant to be used as callback from JetRecConfig where
163  it is called as func(jetdef, modspec). Hence the jetdef argument even if not used in this case.
164  """
165  jetptmin = float(modspec)
166  name = "jetdrlabeler_jetpt{0}GeV".format(int(jetptmin/1000))
167  return getJetDeltaRFlavorLabelTool(name, jetptmin)
168 
169 

◆ getJetGhostFlavorLabelTool()

def ParticleJetToolsConfig.getJetGhostFlavorLabelTool (   name = "jetghostlabeler",
  collection = "Final" 
)

Definition at line 196 of file ParticleJetToolsConfig.py.

196 def getJetGhostFlavorLabelTool(name="jetghostlabeler", collection="Final"):
197 
198  prefix_to_name = "HadronGhost"
199  if collection != "Final":
200  prefix_to_name += collection
201  name+=collection
202  return CompFactory.ParticleJetGhostLabelTool(
203  name,
204  **_getCommonLabelNames(prefix_to_name),
205  GhostBName = "GhostBHadrons"+collection,
206  GhostCName = "GhostCHadrons"+collection,
207  GhostTauName = "GhostTausFinal",
208  PartPtMin = 5000.0
209  )
210 

◆ getJetGhostInitialLabelTool()

def ParticleJetToolsConfig.getJetGhostInitialLabelTool (   jetdef,
  modspec 
)
get ghost-based flavor tagging labeling

This is a wrapper for JetRecConfig where it's called as
func(jetdef, modspec)

Definition at line 211 of file ParticleJetToolsConfig.py.

211 def getJetGhostInitialLabelTool(jetdef, modspec):
212  """get ghost-based flavor tagging labeling
213 
214  This is a wrapper for JetRecConfig where it's called as
215  func(jetdef, modspec)
216  """
217  return getJetGhostFlavorLabelTool(modspec,collection = "Initial")
218 

◆ getJetGhostLabelTool()

def ParticleJetToolsConfig.getJetGhostLabelTool (   jetdef,
  modspec 
)
get ghost-based flavor tagging labeling

This is a wrapper for JetRecConfig where it's called as
func(jetdef, modspec)

Definition at line 219 of file ParticleJetToolsConfig.py.

219 def getJetGhostLabelTool(jetdef, modspec):
220  """get ghost-based flavor tagging labeling
221 
222  This is a wrapper for JetRecConfig where it's called as
223  func(jetdef, modspec)
224  """
225  return getJetGhostFlavorLabelTool(modspec)
226 
227 

◆ getJetPileupLabelTool()

def ParticleJetToolsConfig.getJetPileupLabelTool (   jetdef,
  modspec 
)

Definition at line 247 of file ParticleJetToolsConfig.py.

247 def getJetPileupLabelTool(jetdef, modspec):
248 
249  jetPileupLabelTool = CompFactory.JetPileupLabelingTool('pileuplabeler',
250  RecoJetContainer = jetdef.fullname(),
251  TruthJetContainer= "AntiKt4TruthDressedWZJets")
252 
253  return jetPileupLabelTool

◆ getJetQuarkChargeLabelTool()

def ParticleJetToolsConfig.getJetQuarkChargeLabelTool (   name = 'jetquarkcharge',
  output_label = "QuarkChargeTruthLabelID",
  hadron_label = "HadronGhostInitialTruthLabelPdgId",
  parton_label = "PartonExtendedTruthLabelID" 
)
Get the flavor tagging labeling tool to store the quark charge of a jet
It is necessary to have saved before an hadron label and a parton label, otherwise the code will break

Definition at line 139 of file ParticleJetToolsConfig.py.

139 def getJetQuarkChargeLabelTool(name='jetquarkcharge',
140  output_label = "QuarkChargeTruthLabelID",
141  hadron_label = "HadronGhostInitialTruthLabelPdgId",
142  parton_label = "PartonExtendedTruthLabelID"):
143  """Get the flavor tagging labeling tool to store the quark charge of a jet
144  It is necessary to have saved before an hadron label and a parton label, otherwise the code will break
145  """
146 
147  import ParticleJetTools.quarkChargeMap as qcMap
148  charge_map = qcMap.hadrons_dict
149 
150  return CompFactory.JetQuarkChargeLabelingTool(
151  name,
152  HadronDecorationName = hadron_label,
153  PartonDecorationName = parton_label,
154  HadronChargeMap = charge_map,
155  OutputName = output_label,
156  )
157 

◆ getJetQuarkChargeTool()

def ParticleJetToolsConfig.getJetQuarkChargeTool (   jetdef,
  modspec 
)
returns a JetQuarkChargeLabelingTool

This function is meant to be used as callback from JetRecConfig where
it is called as func(jetdef, modspec). Hence the jetdef argument even if not used.

Definition at line 170 of file ParticleJetToolsConfig.py.

170 def getJetQuarkChargeTool(jetdef, modspec):
171  """returns a JetQuarkChargeLabelingTool
172 
173  This function is meant to be used as callback from JetRecConfig where
174  it is called as func(jetdef, modspec). Hence the jetdef argument even if not used.
175  """
176  if modspec == "":
178 
179  outputLabel,hadronLabel,partonLabel = modspec.split(",")
180 
181  name = f"jetquarkcharge_{outputLabel}_{hadronLabel}_{partonLabel}"
182  return getJetQuarkChargeLabelTool(name,output_label = outputLabel, hadron_label = hadronLabel, parton_label = partonLabel)
183 

◆ getJetTruthLabelTool()

def ParticleJetToolsConfig.getJetTruthLabelTool (   jetdef,
  modspec 
)

Definition at line 228 of file ParticleJetToolsConfig.py.

228 def getJetTruthLabelTool(jetdef, modspec):
229 
230  isTruthJet = 'Truth' in jetdef.fullname()
231 
232  if not isinstance(modspec, str):
233  raise ValueError("JetTruthLabelingTool can only be scheduled with str as modspec")
234  else:
235  truthLabel = str(modspec)
236 
237  jetTruthLabelTool = CompFactory.JetTruthLabelingTool('truthlabeler_{0}'.format(truthLabel),
238  RecoJetContainer = jetdef.fullname(),
239  IsTruthJetCollection = isTruthJet,
240  TruthLabelName = truthLabel)
241 
242  return jetTruthLabelTool
243 

◆ getJetTruthLabelToolPrereqs()

def ParticleJetToolsConfig.getJetTruthLabelToolPrereqs (   jetdef,
  modspec 
)

Definition at line 244 of file ParticleJetToolsConfig.py.

244 def getJetTruthLabelToolPrereqs(jetdef, modspec):
245  return ["input:AntiKt10TruthDressedWZSoftDropBeta100Zcut10Jets"] if modspec == "R10WZTruthLabel_R22v1" and jetdef._cflags.Input.isMC else []
246 

◆ getMCTruthClassifier()

def ParticleJetToolsConfig.getMCTruthClassifier ( )

Definition at line 23 of file ParticleJetToolsConfig.py.

24  # Assume mc15 value
25  truthclassif = CompFactory.MCTruthClassifier(
26  "JetMCTruthClassifier"
27  )
28  if not isAnalysisRelease() :
29  truthclassif.xAODTruthLinkVector= ""
30  # Config neessary only for Athena releases
31  import os
32  if "AtlasProject" in os.environ.keys():
33  if os.environ["AtlasProject"] in ["Athena","AthDerivation"]:
34  truthclassif.ParticleCaloExtensionTool=""
35  return truthclassif
36 
37 # Generates truth particle containers for truth labeling

◆ isAnalysisRelease()

def ParticleJetToolsConfig.isAnalysisRelease ( )

Definition at line 19 of file ParticleJetToolsConfig.py.

19  def isAnalysisRelease():
20  return True
21 
22 # Putting MCTruthClassifier here as we needn't stick jet configs in really foreign packages

Variable Documentation

◆ jrtlog

ParticleJetToolsConfig.jrtlog = Logging.logging.getLogger('ParticleJetToolsConfig')

Definition at line 12 of file ParticleJetToolsConfig.py.

◆ truthpartoptions

dictionary ParticleJetToolsConfig.truthpartoptions
Initial value:
1 = {
2  "Partons":{"ToolType":CompFactory.CopyTruthPartons,"ptmin":5000},
3  "BosonTop":{"ToolType":CompFactory.CopyBosonTopLabelTruthParticles,"ptmin":100000},
4  "FlavourLabel":{"ToolType":CompFactory.CopyFlavorLabelTruthParticles,"ptmin":5000},
5 }

Definition at line 38 of file ParticleJetToolsConfig.py.

ParticleJetToolsConfig.getJetGhostLabelTool
def getJetGhostLabelTool(jetdef, modspec)
Definition: ParticleJetToolsConfig.py:219
ParticleJetToolsConfig.getJetTruthLabelTool
def getJetTruthLabelTool(jetdef, modspec)
Definition: ParticleJetToolsConfig.py:228
vtune_athena.format
format
Definition: vtune_athena.py:14
ParticleJetToolsConfig.getJetTruthLabelToolPrereqs
def getJetTruthLabelToolPrereqs(jetdef, modspec)
Definition: ParticleJetToolsConfig.py:244
ParticleJetToolsConfig.getJetDeltaRLabelTool
def getJetDeltaRLabelTool(jetdef, modspec)
Definition: ParticleJetToolsConfig.py:158
ParticleJetToolsConfig.getMCTruthClassifier
def getMCTruthClassifier()
Definition: ParticleJetToolsConfig.py:23
ParticleJetToolsConfig.getJetDeltaRFlavorLabelTool
def getJetDeltaRFlavorLabelTool(name='jetdrlabeler', jet_pt_min=5000, collection="Final", dr_max=0.3)
Definition: ParticleJetToolsConfig.py:113
ParticleJetToolsConfig.getJetQuarkChargeTool
def getJetQuarkChargeTool(jetdef, modspec)
Definition: ParticleJetToolsConfig.py:170
ParticleJetToolsConfig.getJetDeltaRInitialLabelTool
def getJetDeltaRInitialLabelTool(jetdef, modspec)
Definition: ParticleJetToolsConfig.py:184
ParticleJetToolsConfig.getJetGhostFlavorLabelTool
def getJetGhostFlavorLabelTool(name="jetghostlabeler", collection="Final")
Definition: ParticleJetToolsConfig.py:196
ParticleJetToolsConfig.isAnalysisRelease
def isAnalysisRelease()
Definition: ParticleJetToolsConfig.py:19
ParticleJetToolsConfig.getJetGhostInitialLabelTool
def getJetGhostInitialLabelTool(jetdef, modspec)
Definition: ParticleJetToolsConfig.py:211
ParticleJetToolsConfig.getJetQuarkChargeLabelTool
def getJetQuarkChargeLabelTool(name='jetquarkcharge', output_label="QuarkChargeTruthLabelID", hadron_label="HadronGhostInitialTruthLabelPdgId", parton_label="PartonExtendedTruthLabelID")
Definition: ParticleJetToolsConfig.py:139
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
ParticleJetToolsConfig._getCommonLabelNames
def _getCommonLabelNames(prefix)
Definition: ParticleJetToolsConfig.py:89
str
Definition: BTagTrackIpAccessor.cxx:11
ParticleJetToolsConfig.getCopyTruthLabelParticles
def getCopyTruthLabelParticles(truthtype)
Definition: ParticleJetToolsConfig.py:43
ParticleJetToolsConfig.getJetPileupLabelTool
def getJetPileupLabelTool(jetdef, modspec)
Definition: ParticleJetToolsConfig.py:247
python.LArMinBiasAlgConfig.float
float
Definition: LArMinBiasAlgConfig.py:65
ParticleJetToolsConfig.getCopyTruthJetParticles
def getCopyTruthJetParticles(modspec, cflags)
Definition: ParticleJetToolsConfig.py:63