Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:39

0001 #ifndef HepMCCandidate_GenStatusFlags_h
0002 #define HepMCCandidate_GenStatusFlags_h
0003 /** \class reco::GenStatusFlags
0004  *
0005  * enum for generator status flags
0006  *
0007  * \author: Josh Bendavid
0008  *
0009  */
0010 
0011 #include <bitset>
0012 
0013 namespace reco {
0014 
0015   struct GenStatusFlags {
0016     enum StatusBits {
0017       kIsPrompt = 0,
0018       kIsDecayedLeptonHadron,
0019       kIsTauDecayProduct,
0020       kIsPromptTauDecayProduct,
0021       kIsDirectTauDecayProduct,
0022       kIsDirectPromptTauDecayProduct,
0023       kIsDirectHadronDecayProduct,
0024       kIsHardProcess,
0025       kFromHardProcess,
0026       kIsHardProcessTauDecayProduct,
0027       kIsDirectHardProcessTauDecayProduct,
0028       kFromHardProcessBeforeFSR,
0029       kIsFirstCopy,
0030       kIsLastCopy,
0031       kIsLastCopyBeforeFSR
0032     };
0033 
0034     /////////////////////////////////////////////////////////////////////////////
0035     //these are robust, generator-independent functions for categorizing
0036     //mainly final state particles, but also intermediate hadrons/taus
0037 
0038     //is particle prompt (not from hadron, muon, or tau decay)
0039     bool isPrompt() const { return flags_[kIsPrompt]; }
0040     void setIsPrompt(bool b) { flags_[kIsPrompt] = b; }
0041 
0042     //is particle a decayed hadron, muon, or tau (does not include resonance decays like W,Z,Higgs,top,etc)
0043     //This flag is equivalent to status 2 in the current HepMC standard
0044     //but older generators (pythia6, herwig6) predate this and use status 2 also for other intermediate
0045     //particles/states
0046     bool isDecayedLeptonHadron() const { return flags_[kIsDecayedLeptonHadron]; }
0047     void setIsDecayedLeptonHadron(bool b) { flags_[kIsDecayedLeptonHadron] = b; }
0048 
0049     //this particle is a direct or indirect tau decay product
0050     bool isTauDecayProduct() const { return flags_[kIsTauDecayProduct]; }
0051     void setIsTauDecayProduct(bool b) { flags_[kIsTauDecayProduct] = b; }
0052 
0053     //this particle is a direct or indirect decay product of a prompt tau
0054     bool isPromptTauDecayProduct() const { return flags_[kIsPromptTauDecayProduct]; }
0055     void setIsPromptTauDecayProduct(bool b) { flags_[kIsPromptTauDecayProduct] = b; }
0056 
0057     //this particle is a direct tau decay product
0058     bool isDirectTauDecayProduct() const { return flags_[kIsDirectTauDecayProduct]; }
0059     void setIsDirectTauDecayProduct(bool b) { flags_[kIsDirectTauDecayProduct] = b; }
0060 
0061     //this particle is a direct decay product from a prompt tau
0062     bool isDirectPromptTauDecayProduct() const { return flags_[kIsDirectPromptTauDecayProduct]; }
0063     void setIsDirectPromptTauDecayProduct(bool b) { flags_[kIsDirectPromptTauDecayProduct] = b; }
0064 
0065     //this particle is a direct decay product from a hadron
0066     bool isDirectHadronDecayProduct() const { return flags_[kIsDirectHadronDecayProduct]; }
0067     void setIsDirectHadronDecayProduct(bool b) { flags_[kIsDirectHadronDecayProduct] = b; }
0068 
0069     /////////////////////////////////////////////////////////////////////////////
0070     //these are generator history-dependent functions for tagging particles
0071     //associated with the hard process
0072     //Currently implemented for Pythia 6 and Pythia 8 status codes and history
0073     //and may not have 100% consistent meaning across all types of processes
0074     //Users are strongly encouraged to stick to the more robust flags above
0075 
0076     //this particle is part of the hard process
0077     bool isHardProcess() const { return flags_[kIsHardProcess]; }
0078     void setIsHardProcess(bool b) { flags_[kIsHardProcess] = b; }
0079 
0080     //this particle is the direct descendant of a hard process particle of the same pdg id
0081     bool fromHardProcess() const { return flags_[kFromHardProcess]; }
0082     void setFromHardProcess(bool b) { flags_[kFromHardProcess] = b; }
0083 
0084     //this particle is a direct or indirect decay product of a tau
0085     //from the hard process
0086     bool isHardProcessTauDecayProduct() const { return flags_[kIsHardProcessTauDecayProduct]; }
0087     void setIsHardProcessTauDecayProduct(bool b) { flags_[kIsHardProcessTauDecayProduct] = b; }
0088 
0089     //this particle is a direct decay product of a tau
0090     //from the hard process
0091     bool isDirectHardProcessTauDecayProduct() const { return flags_[kIsDirectHardProcessTauDecayProduct]; }
0092     void setIsDirectHardProcessTauDecayProduct(bool b) { flags_[kIsDirectHardProcessTauDecayProduct] = b; }
0093 
0094     //this particle is the direct descendant of a hard process particle of the same pdg id
0095     //For outgoing particles the kinematics are those before QCD or QED FSR
0096     //This corresponds roughly to status code 3 in pythia 6
0097     bool fromHardProcessBeforeFSR() const { return flags_[kFromHardProcessBeforeFSR]; }
0098     void setFromHardProcessBeforeFSR(bool b) { flags_[kFromHardProcessBeforeFSR] = b; }
0099 
0100     //this particle is the first copy of the particle in the chain with the same pdg id
0101     bool isFirstCopy() const { return flags_[kIsFirstCopy]; }
0102     void setIsFirstCopy(bool b) { flags_[kIsFirstCopy] = b; }
0103 
0104     //this particle is the last copy of the particle in the chain with the same pdg id
0105     //(and therefore is more likely, but not guaranteed, to carry the final physical momentum)
0106     bool isLastCopy() const { return flags_[kIsLastCopy]; }
0107     void setIsLastCopy(bool b) { flags_[kIsLastCopy] = b; }
0108 
0109     //this particle is the last copy of the particle in the chain with the same pdg id
0110     //before QED or QCD FSR
0111     //(and therefore is more likely, but not guaranteed, to carry the momentum after ISR)
0112     bool isLastCopyBeforeFSR() const { return flags_[kIsLastCopyBeforeFSR]; }
0113     void setIsLastCopyBeforeFSR(bool b) { flags_[kIsLastCopyBeforeFSR] = b; }
0114 
0115     std::bitset<15> flags_;
0116   };
0117 
0118 }  // namespace reco
0119 
0120 #endif