8 '''Builds the internal dictionaries from the enum defined in 9 http://cmslxr.fnal.gov/lxr/source/DataFormats/TauReco/interface/PFTau.h''' 30 self.
decayModes =
dict( (index-1, name)
for index, name
in enumerate( tmp ) )
35 '''Returns the decay mode name corresponding to an int.''' 39 '''Returns the decay mode int corresponding to a name.''' 56 elif dm ==
'electron':
60 elif dm ==
'kOneProngOther':
62 elif dm ==
'kThreeProngOther':
68 ''' Returns generated tau decay mode. Needs to be called on genJet 69 as stored in pat::Tau, if available. 71 Translated from PhysicsTools/JetMCUtils/interface/JetMCTag.h, 72 which is not available in FWlite. 75 daughters = c.daughterPtrVector()
77 return TauDecayModes.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). 90 for daughter
in daughters:
91 pdg_id =
abs(daughter.pdgId())
99 if daughter.charge() != 0:
100 numChargedHadrons += 1
101 elif pdg_id
not in [12, 14, 16]:
102 numNeutralHadrons += 1
104 if numElectrons == 1:
109 if numChargedHadrons == 1:
110 if numNeutralHadrons != 0:
111 return "kOneProngOther" 113 return "kOneProng0PiZero" 114 elif numPhotons == 2:
115 return "kOneProng1PiZero" 116 elif numPhotons == 4:
117 return "kOneProng2PiZero" 118 elif numPhotons == 6:
119 return "kOneProng3PiZero" 121 return "kOneProngNPiZero" 122 elif numChargedHadrons == 3:
123 if numNeutralHadrons != 0:
124 return "kThreeProngOther" 126 return "kThreeProng0PiZero" 127 elif numPhotons == 2:
128 return "kThreeProng1PiZero" 129 elif numPhotons == 4:
130 return "kThreeProng2PiZero" 131 elif numPhotons == 6:
132 return "kThreeProng3PiZero" 134 return "kThreeProngNPiZero" 136 return "kRareDecayMode" 140 if __name__ ==
'__main__':
145 print 0, dec.intToName(0)
146 print 'kThreeProng0PiZero', dec.nameToInt(
'kThreeProng0PiZero')
def nameToInt(self, aName)
def genDecayModeInt(self, daughters)
Abs< T >::type abs(const T &t)
def genDecayModeFromGenJet(c)
def translateGenModeToInt(self, dm)
def genDecayModeFromJetInt(self, c)
def intToName(self, anInt)
def genDecayMode(daughters)