CMS 3D CMS Logo

Classes | Functions | Variables
tauTools Namespace Reference

Classes

class  AddTauCollection
 

Functions

def _buildIDSourcePSet (tauType, idSources, postfix="")
 
def _switchToPFTau (process, tauSource, pfTauType, idSources, patTauLabel="", postfix="")
 
def applyPostfix (process, label, postfix)
 
def switchToPFTauByType (process, pfTauType=None, tauSource=cms.InputTag('hpsPFTauProducer'), patTauLabel="", postfix="")
 
def switchToPFTauFixedCone (process, tauSource=cms.InputTag('fixedConePFTauProducer'), patTauLabel="", postfix="")
 
def switchToPFTauHPS (process, tauSource=cms.InputTag('hpsPFTauProducer'), patTauLabel="", jecLevels=[], postfix="")
 
def switchToPFTauShrinkingCone (process, tauSource=cms.InputTag('shrinkingConePFTauProducer'), patTauLabel="", postfix="")
 

Variables

 classicPFTauIDSources
 
 classicTauIDSources
 
 hpsTauIDSources
 

Function Documentation

def tauTools._buildIDSourcePSet (   tauType,
  idSources,
  postfix = "" 
)
private
Build a PSet defining the tau ID sources to embed into the pat::Tau 

Definition at line 18 of file tauTools.py.

References _switchToPFTau().

Referenced by _switchToPFTau().

18 def _buildIDSourcePSet(tauType, idSources, postfix =""):
19  """ Build a PSet defining the tau ID sources to embed into the pat::Tau """
20  output = cms.PSet()
21  for label, discriminator in idSources:
22  if ":" in discriminator:
23  discr = discriminator.split(":")
24  setattr(output, label, cms.InputTag(tauType + discr[0] + postfix + ":" + discr[1]))
25  else:
26  setattr(output, label, cms.InputTag(tauType + discriminator + postfix))
27  return output
28 
def _buildIDSourcePSet(tauType, idSources, postfix="")
Definition: tauTools.py:18
def tauTools._switchToPFTau (   process,
  tauSource,
  pfTauType,
  idSources,
  patTauLabel = "",
  postfix = "" 
)
private
internal auxiliary function to switch to **any** PFTau collection

Definition at line 34 of file tauTools.py.

References _buildIDSourcePSet(), applyPostfix(), and edm.print().

Referenced by _buildIDSourcePSet(), switchToPFTauFixedCone(), switchToPFTauHPS(), and switchToPFTauShrinkingCone().

34  postfix = ""):
35  """internal auxiliary function to switch to **any** PFTau collection"""
36  print(' switching PAT Tau input to: ', tauSource)
37 
38  applyPostfix(process, "tauMatch" + patTauLabel, postfix).src = tauSource
39  applyPostfix(process, "tauGenJetMatch" + patTauLabel, postfix).src = tauSource
40 
41  applyPostfix(process, "tauIsoDepositPFCandidates" + patTauLabel, postfix).src = tauSource
42  applyPostfix(process, "tauIsoDepositPFCandidates" + patTauLabel, postfix).ExtractorPSet.tauSource = tauSource
43  applyPostfix(process, "tauIsoDepositPFChargedHadrons" + patTauLabel, postfix).src = tauSource
44  applyPostfix(process, "tauIsoDepositPFChargedHadrons" + patTauLabel, postfix).ExtractorPSet.tauSource = tauSource
45  applyPostfix(process, "tauIsoDepositPFNeutralHadrons" + patTauLabel, postfix).src = tauSource
46  applyPostfix(process, "tauIsoDepositPFNeutralHadrons" + patTauLabel, postfix).ExtractorPSet.tauSource = tauSource
47  applyPostfix(process, "tauIsoDepositPFGammas" + patTauLabel, postfix).src = tauSource
48  applyPostfix(process, "tauIsoDepositPFGammas" + patTauLabel, postfix).ExtractorPSet.tauSource = tauSource
49 
50  applyPostfix(process, "patTaus" + patTauLabel, postfix).tauSource = tauSource
51  # CV: reconstruction of tau lifetime information not enabled for tau collections other than 'hpsPFTauProducer' yet
52  applyPostfix(process, "patTaus" + patTauLabel, postfix).tauTransverseImpactParameterSource = ""
53  applyPostfix(process, "patTaus" + patTauLabel, postfix).tauIDSources = _buildIDSourcePSet(pfTauType, idSources, postfix)
54 
55  if hasattr(process, "cleanPatTaus" + patTauLabel + postfix):
56  getattr(process, "cleanPatTaus" + patTauLabel + postfix).preselection = preselection
57 
58 # Name mapping for classic tau ID sources (present for fixed and shrinkingCones)
def _buildIDSourcePSet(tauType, idSources, postfix="")
Definition: tauTools.py:18
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def applyPostfix(process, label, postfix)
Definition: tauTools.py:10
def tauTools.applyPostfix (   process,
  label,
  postfix 
)

Definition at line 10 of file tauTools.py.

Referenced by _switchToPFTau(), and switchToPFTauHPS().

10 def applyPostfix(process, label, postfix):
11  result = None
12  if hasattr(process, label+postfix):
13  result = getattr(process, label + postfix)
14  else:
15  raise ValueError("Error in <applyPostfix>: No module of name = %s attached to process !!" % (label + postfix))
16  return result
17 
def applyPostfix(process, label, postfix)
Definition: tauTools.py:10
def tauTools.switchToPFTauByType (   process,
  pfTauType = None,
  tauSource = cms.InputTag('hpsPFTauProducer'),
  patTauLabel = "",
  postfix = "" 
)

Definition at line 199 of file tauTools.py.

Referenced by pfTools.adaptPFTaus(), switchToPFTauHPS(), and tauTools.AddTauCollection.toolCode().

199  postfix = "" ):
200  mapping = {
201  'shrinkingConePFTau' : switchToPFTauShrinkingCone,
202  'fixedConePFTau' : switchToPFTauFixedCone,
203  'hpsPFTau' : switchToPFTauHPS
204  }
205  if not pfTauType in mapping.keys():
206  raise ValueError("Error in <switchToPFTauByType>: Undefined pfTauType = %s !!" % pfTauType)
207 
208  mapping[pfTauType](process, tauSource = tauSource,
209  patTauLabel = patTauLabel, postfix = postfix)
210 
def tauTools.switchToPFTauFixedCone (   process,
  tauSource = cms.InputTag('fixedConePFTauProducer'),
  patTauLabel = "",
  postfix = "" 
)

Definition at line 159 of file tauTools.py.

References _switchToPFTau(), and switchToPFTauShrinkingCone().

159  postfix = ""):
160  fixedConeIDSources = copy.copy(classicTauIDSources)
161  fixedConeIDSources.extend(classicPFTauIDSources)
162 
163  _switchToPFTau(process, tauSource, 'fixedConePFTau', fixedConeIDSources,
164  patTauLabel = patTauLabel, postfix = postfix)
165 
166 # switch to PFTau collection produced for shrinking signal cone of size dR = 5.0/Et(PFTau)
def _switchToPFTau(process, tauSource, pfTauType, idSources, patTauLabel="", postfix="")
Definition: tauTools.py:34
def tauTools.switchToPFTauHPS (   process,
  tauSource = cms.InputTag('hpsPFTauProducer'),
  patTauLabel = "",
  jecLevels = [],
  postfix = "" 
)

Definition at line 182 of file tauTools.py.

References _switchToPFTau(), applyPostfix(), python.rootplot.root2matplotlib.replace(), and switchToPFTauByType().

Referenced by switchToPFTauShrinkingCone().

182  postfix = ""):
183 
184  _switchToPFTau(process, tauSource, 'hpsPFTau', hpsTauIDSources,
185  patTauLabel = patTauLabel, postfix = postfix)
186 
187  # CV: enable tau lifetime information for HPS PFTaus
188  applyPostfix(process, "patTaus" + patTauLabel, postfix).tauTransverseImpactParameterSource = tauSource.value().replace("Producer", "TransverseImpactParameters")
189 
190  ## adapt cleanPatTaus
191  if hasattr(process, "cleanPatTaus" + patTauLabel + postfix):
192  getattr(process, "cleanPatTaus" + patTauLabel + postfix).preselection = preselection
193 
194 # Select switcher by string
def replace(string, replacements)
def _switchToPFTau(process, tauSource, pfTauType, idSources, patTauLabel="", postfix="")
Definition: tauTools.py:34
def applyPostfix(process, label, postfix)
Definition: tauTools.py:10
def tauTools.switchToPFTauShrinkingCone (   process,
  tauSource = cms.InputTag('shrinkingConePFTauProducer'),
  patTauLabel = "",
  postfix = "" 
)

Definition at line 170 of file tauTools.py.

References _switchToPFTau(), and switchToPFTauHPS().

Referenced by switchToPFTauFixedCone().

170  postfix = ""):
171  shrinkingIDSources = copy.copy(classicTauIDSources)
172  shrinkingIDSources.extend(classicPFTauIDSources)
173 
174  _switchToPFTau(process, tauSource, 'shrinkingConePFTau', shrinkingIDSources,
175  patTauLabel = patTauLabel, postfix = postfix)
176 
177 # switch to hadron-plus-strip(s) (HPS) PFTau collection
def _switchToPFTau(process, tauSource, pfTauType, idSources, patTauLabel="", postfix="")
Definition: tauTools.py:34

Variable Documentation

tauTools.classicPFTauIDSources

Definition at line 69 of file tauTools.py.

tauTools.classicTauIDSources

Definition at line 59 of file tauTools.py.

tauTools.hpsTauIDSources

Definition at line 77 of file tauTools.py.