1 from __future__
import print_function
9 '''Builds the internal dictionaries from the enum defined in 10 http://cmslxr.fnal.gov/lxr/source/DataFormats/TauReco/interface/PFTau.h''' 31 self.
decayModes = dict( (index-1, name)
for index, name
in enumerate( tmp ) )
36 '''Returns the decay mode name corresponding to an int.''' 40 '''Returns the decay mode int corresponding to a name.''' 57 elif dm ==
'electron':
61 elif dm ==
'kOneProngOther':
63 elif dm ==
'kThreeProngOther':
69 ''' Returns generated tau decay mode. Needs to be called on genJet 70 as stored in pat::Tau, if available. 72 Translated from PhysicsTools/JetMCUtils/interface/JetMCTag.h, 73 which is not available in FWlite. 76 daughters = c.daughterPtrVector()
78 return TauDecayModes.genDecayMode(daughters)
82 ''' Returns the generated tau decay mode based on a passed list of all 83 final daughters before further decay (as contained in miniAOD). 91 for daughter
in daughters:
92 pdg_id =
abs(daughter.pdgId())
100 if daughter.charge() != 0:
101 numChargedHadrons += 1
102 elif pdg_id
not in [12, 14, 16]:
103 numNeutralHadrons += 1
105 if numElectrons == 1:
110 if numChargedHadrons == 1:
111 if numNeutralHadrons != 0:
112 return "kOneProngOther" 114 return "kOneProng0PiZero" 115 elif numPhotons == 2:
116 return "kOneProng1PiZero" 117 elif numPhotons == 4:
118 return "kOneProng2PiZero" 119 elif numPhotons == 6:
120 return "kOneProng3PiZero" 122 return "kOneProngNPiZero" 123 elif numChargedHadrons == 3:
124 if numNeutralHadrons != 0:
125 return "kThreeProngOther" 127 return "kThreeProng0PiZero" 128 elif numPhotons == 2:
129 return "kThreeProng1PiZero" 130 elif numPhotons == 4:
131 return "kThreeProng2PiZero" 132 elif numPhotons == 6:
133 return "kThreeProng3PiZero" 135 return "kThreeProngNPiZero" 137 return "kRareDecayMode" 141 if __name__ ==
'__main__':
146 print(0, dec.intToName(0))
147 print(
'kThreeProng0PiZero', dec.nameToInt(
'kThreeProng0PiZero'))
def nameToInt(self, aName)
S & print(S &os, JobReport::InputFile const &f)
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)