CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFTauDecayModeTools.cc
Go to the documentation of this file.
1 #include <map>
2 #include <boost/assign.hpp>
6 
7 namespace reco { namespace tau {
8 
9 namespace {
10  // Convert the string decay mode from PhysicsTools to the
11  // PFTau::hadronicDecayMode format
12  static std::map<std::string, reco::PFTau::hadronicDecayMode> dmTranslator =
13  boost::assign::map_list_of
14  ("oneProng0Pi0", reco::PFTau::kOneProng0PiZero)
15  ("oneProng1Pi0", reco::PFTau::kOneProng1PiZero)
16  ("oneProng2Pi0", reco::PFTau::kOneProng2PiZero)
17  ("oneProngOther", reco::PFTau::kOneProngNPiZero)
18  ("threeProng0Pi0", reco::PFTau::kThreeProng0PiZero)
19  ("threeProng1Pi0", reco::PFTau::kThreeProng1PiZero)
20  ("threeProngOther", reco::PFTau::kThreeProngNPiZero)
21  ("electron", reco::PFTau::kNull)
22  ("muon", reco::PFTau::kNull);
23 }
24 
26  int modeAsInt = static_cast<int>(mode);
27  return (modeAsInt / PFTau::kOneProngNPiZero) + 1;
28 }
29 
31  int modeAsInt = static_cast<int>(mode);
32  return (modeAsInt % PFTau::kOneProngNPiZero);
33 }
34 
36  unsigned int nCharged, unsigned int nPiZeros) {
37  // If no tracks exist, this is definitely not a tau!
38  if(!nCharged) return PFTau::kNull;
39  // Find the maximum number of PiZeros our parameterization can hold
40  const unsigned int maxPiZeros = PFTau::kOneProngNPiZero;
41  // Determine our track index
42  unsigned int trackIndex = (nCharged-1)*(maxPiZeros+1);
43  // Check if we handle the given number of tracks
44  if(trackIndex >= PFTau::kRareDecayMode) return PFTau::kRareDecayMode;
45 
46  nPiZeros = (nPiZeros <= maxPiZeros) ? nPiZeros : maxPiZeros;
47  return static_cast<PFTau::hadronicDecayMode>(trackIndex + nPiZeros);
48 }
49 
51  const std::string& name) {
52  std::map<std::string, reco::PFTau::hadronicDecayMode>::const_iterator
53  found = dmTranslator.find(name);
54  if (found != dmTranslator.end()) {
55  return found->second;
56  } else
58 }
59 
61  if (!genJet)
62  return reco::PFTau::kNull;
64 }
65 
66 }} // end namespace reco::tau
std::string genTauDecayMode(const reco::CompositePtrCandidate &c)
Definition: JetMCTag.cc:81
PFTau::hadronicDecayMode translateGenDecayModeToReco(const std::string &genName)
Convert a genTau decay mode string (&#39;oneProng0Pi0&#39;) to the RECO enum.
PFTau::hadronicDecayMode translateDecayMode(unsigned int nCharged, unsigned int nPiZero)
PFTau::hadronicDecayMode getDecayMode(const reco::GenJet *genJet)
Jets made from MC generator particles.
Definition: GenJet.h:25
unsigned int nCharged(const GenJet &jet)
int mode
Definition: AMPTWrapper.h:139
hadronicDecayMode
Definition: PFTau.h:33
unsigned int piZerosInDecayMode(PFTau::hadronicDecayMode mode)
unsigned int chargedHadronsInDecayMode(PFTau::hadronicDecayMode mode)
Reverse mapping of decay modes into multiplicities.