CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions
TauDecayModes.TauDecayModes Class Reference
Inheritance diagram for TauDecayModes.TauDecayModes:

Public Member Functions

def __init__ (self)
 
def __str__ (self)
 
def genDecayModeFromJetInt (self, c)
 
def genDecayModeInt (self, daughters)
 
def intToName (self, anInt)
 
def nameToInt (self, aName)
 
def translateGenModeToInt (self, dm)
 

Static Public Member Functions

def genDecayMode (daughters)
 
def genDecayModeFromGenJet (c)
 

Public Attributes

 decayModeNames
 
 decayModes
 

Private Member Functions

def _decayModes (self)
 

Detailed Description

Definition at line 3 of file TauDecayModes.py.

Constructor & Destructor Documentation

◆ __init__()

def TauDecayModes.TauDecayModes.__init__ (   self)

Definition at line 5 of file TauDecayModes.py.

5  def __init__(self):
6  self._decayModes()
7 

References TauDecayModes.TauDecayModes._decayModes().

Member Function Documentation

◆ __str__()

def TauDecayModes.TauDecayModes.__str__ (   self)

Definition at line 42 of file TauDecayModes.py.

42  def __str__(self):
43  return str( self.decayModes )
44 

References TauDecayModes.TauDecayModes.decayModes, and str.

◆ _decayModes()

def TauDecayModes.TauDecayModes._decayModes (   self)
private
Builds the internal dictionaries from the enum defined in 
http://cmslxr.fnal.gov/lxr/source/DataFormats/TauReco/interface/PFTau.h

Definition at line 8 of file TauDecayModes.py.

8  def _decayModes(self):
9  '''Builds the internal dictionaries from the enum defined in
10  http://cmslxr.fnal.gov/lxr/source/DataFormats/TauReco/interface/PFTau.h'''
11  tmp = [
12  'kNull',
13  'kOneProng0PiZero',
14  'kOneProng1PiZero',
15  'kOneProng2PiZero',
16  'kOneProng3PiZero',
17  'kOneProngNPiZero',
18  'kTwoProng0PiZero',
19  'kTwoProng1PiZero',
20  'kTwoProng2PiZero',
21  'kTwoProng3PiZero',
22  'kTwoProngNPiZero',
23  'kThreeProng0PiZero',
24  'kThreeProng1PiZero',
25  'kThreeProng2PiZero',
26  'kThreeProng3PiZero',
27  'kThreeProngNPiZero',
28  'kRareDecayMode'
29  ]
30  self.decayModes = dict( (index-1, name) for index, name in enumerate( tmp ) )
31  self.decayModeNames = dict( (value, key) for key, value \
32  in self.decayModes.items() )
33 

Referenced by TauDecayModes.TauDecayModes.__init__().

◆ genDecayMode()

def TauDecayModes.TauDecayModes.genDecayMode (   daughters)
static
Returns the generated tau decay mode based on a passed list of all
final daughters before further decay (as contained in miniAOD).

Definition at line 80 of file TauDecayModes.py.

80  def genDecayMode(daughters):
81  ''' Returns the generated tau decay mode based on a passed list of all
82  final daughters before further decay (as contained in miniAOD).
83  '''
84  numElectrons = 0
85  numMuons = 0
86  numChargedHadrons = 0
87  numNeutralHadrons = 0
88  numPhotons = 0
89 
90  for daughter in daughters:
91  pdg_id = abs(daughter.pdgId())
92  if pdg_id == 22:
93  numPhotons += 1
94  elif pdg_id == 11:
95  numElectrons +=1
96  elif pdg_id == 13:
97  numMuons += 1
98  else:
99  if daughter.charge() != 0:
100  numChargedHadrons += 1
101  elif pdg_id not in [12, 14, 16]:
102  numNeutralHadrons += 1
103 
104  if numElectrons == 1:
105  return "electron"
106  if numMuons == 1:
107  return "muon"
108 
109  if numChargedHadrons == 1:
110  if numNeutralHadrons != 0:
111  return "kOneProngOther"
112  if numPhotons == 0:
113  return "kOneProng0PiZero"
114  elif numPhotons == 2:
115  return "kOneProng1PiZero"
116  elif numPhotons == 4:
117  return "kOneProng2PiZero"
118  elif numPhotons == 6:
119  return "kOneProng3PiZero"
120  else:
121  return "kOneProngNPiZero"
122  elif numChargedHadrons == 3:
123  if numNeutralHadrons != 0:
124  return "kThreeProngOther"
125  if numPhotons == 0:
126  return "kThreeProng0PiZero"
127  elif numPhotons == 2:
128  return "kThreeProng1PiZero"
129  elif numPhotons == 4:
130  return "kThreeProng2PiZero"
131  elif numPhotons == 6:
132  return "kThreeProng3PiZero"
133  else:
134  return "kThreeProngNPiZero"
135 
136  return "kRareDecayMode"
137 

References funct.abs().

Referenced by TauDecayModes.TauDecayModes.genDecayModeInt().

◆ genDecayModeFromGenJet()

def TauDecayModes.TauDecayModes.genDecayModeFromGenJet (   c)
static
Returns generated tau decay mode. Needs to be called on genJet
as stored in pat::Tau, if available.

Translated from PhysicsTools/JetMCUtils/interface/JetMCTag.h,
which is not available in FWlite.

Definition at line 67 of file TauDecayModes.py.

67  def genDecayModeFromGenJet(c):
68  ''' Returns generated tau decay mode. Needs to be called on genJet
69  as stored in pat::Tau, if available.
70 
71  Translated from PhysicsTools/JetMCUtils/interface/JetMCTag.h,
72  which is not available in FWlite.
73  '''
74 
75  daughters = c.daughterPtrVector()
76 
77  return TauDecayModes.genDecayMode(daughters)
78 

Referenced by TauDecayModes.TauDecayModes.genDecayModeFromJetInt().

◆ genDecayModeFromJetInt()

def TauDecayModes.TauDecayModes.genDecayModeFromJetInt (   self,
  c 
)

Definition at line 49 of file TauDecayModes.py.

49  def genDecayModeFromJetInt(self, c):
50  dm = self.genDecayModeFromGenJet(c)
51  return self.translateGenModeToInt(dm)
52 

References TauDecayModes.TauDecayModes.genDecayModeFromGenJet(), and TauDecayModes.TauDecayModes.translateGenModeToInt().

◆ genDecayModeInt()

def TauDecayModes.TauDecayModes.genDecayModeInt (   self,
  daughters 
)

Definition at line 45 of file TauDecayModes.py.

45  def genDecayModeInt(self, daughters):
46  dm = self.genDecayMode(daughters)
47  return self.translateGenModeToInt(dm)
48 

References TauDecayModes.TauDecayModes.genDecayMode(), and TauDecayModes.TauDecayModes.translateGenModeToInt().

◆ intToName()

def TauDecayModes.TauDecayModes.intToName (   self,
  anInt 
)
Returns the decay mode name corresponding to an int.

Definition at line 34 of file TauDecayModes.py.

34  def intToName( self, anInt ):
35  '''Returns the decay mode name corresponding to an int.'''
36  return self.decayModes[ anInt ]
37 

References TauDecayModes.TauDecayModes.decayModes.

◆ nameToInt()

def TauDecayModes.TauDecayModes.nameToInt (   self,
  aName 
)
Returns the decay mode int corresponding to a name.

Definition at line 38 of file TauDecayModes.py.

38  def nameToInt( self, aName ):
39  '''Returns the decay mode int corresponding to a name.'''
40  return self.decayModeNames[ aName ]
41 

References TauDecayModes.TauDecayModes.decayModeNames.

Referenced by TauDecayModes.TauDecayModes.translateGenModeToInt().

◆ translateGenModeToInt()

def TauDecayModes.TauDecayModes.translateGenModeToInt (   self,
  dm 
)

Definition at line 53 of file TauDecayModes.py.

53  def translateGenModeToInt(self, dm):
54  if dm in self.decayModeNames:
55  return self.nameToInt(dm)
56  elif dm == 'electron':
57  return -11
58  elif dm == 'muon':
59  return -13
60  elif dm == 'kOneProngOther':
61  return 100 # one-prong + 100
62  elif dm == 'kThreeProngOther':
63  return 110 # three-prong + 100
64  return -99
65 

References TauDecayModes.TauDecayModes.decayModeNames, and TauDecayModes.TauDecayModes.nameToInt().

Referenced by TauDecayModes.TauDecayModes.genDecayModeFromJetInt(), and TauDecayModes.TauDecayModes.genDecayModeInt().

Member Data Documentation

◆ decayModeNames

TauDecayModes.TauDecayModes.decayModeNames

◆ decayModes

TauDecayModes.TauDecayModes.decayModes
mps_monitormerge.items
list items
Definition: mps_monitormerge.py:29
str
#define str(s)
Definition: TestProcessor.cc:53
TriggerAnalyzer.__str__
def __str__(self)
Definition: TriggerAnalyzer.py:103
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22