Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef HepMCCandidate_FlavorHistory_h
0002 #define HepMCCandidate_FlavorHistory_h
0003 
0004 /** \class reco::FlavorHistory
0005  *
0006  * Stores information about the flavor history of a parton
0007  *
0008  * \author: Stephen Mrenna (FNAL), Salvatore Rappoccio (JHU)
0009  *
0010  */
0011 
0012 // -------------------------------------------------------------
0013 // Identify the ancestry of the Quark
0014 //
0015 //
0016 // Matrix Element:
0017 //    Status 3 parent with precisely 2 "grandparents" that
0018 //    is outside of the "initial" section (0-5) that has the
0019 //    same ID as the status 2 parton in question.
0020 //
0021 // Flavor excitation:
0022 //    If we find only one outgoing parton.
0023 //
0024 // Gluon splitting:
0025 //    Parent is a quark of a different flavor than the parton
0026 //    in question, or a gluon.
0027 //    Can come from either ISR or FSR.
0028 //
0029 // True decay:
0030 //    Decays from a resonance like top, Higgs, etc.
0031 // -------------------------------------------------------------
0032 
0033 #include "DataFormats/Common/interface/Ptr.h"
0034 #include "DataFormats/Common/interface/OwnVector.h"
0035 #include "DataFormats/Common/interface/Handle.h"
0036 #include "DataFormats/Common/interface/View.h"
0037 #include "DataFormats/Candidate/interface/Candidate.h"
0038 #include "DataFormats/Candidate/interface/CandidateFwd.h"
0039 #include "DataFormats/Candidate/interface/ShallowClonePtrCandidate.h"
0040 
0041 #include <fstream>
0042 
0043 namespace reco {
0044 
0045   class FlavorHistory {
0046   public:
0047     enum FLAVOR_T {
0048       FLAVOR_NULL = 0,  // No flavor, unset
0049       FLAVOR_GS,        // gluon splitting
0050       FLAVOR_EXC,       // flavor excitation
0051       FLAVOR_ME,        // matrix element
0052       FLAVOR_DECAY,     // flavor decay
0053       N_FLAVOR_TYPES
0054     };  // total number
0055 
0056     static const int gluonId = 21;
0057     static const int tQuarkId = 6;
0058     static const int bQuarkId = 5;
0059     static const int cQuarkId = 4;
0060 
0061     FlavorHistory();
0062     FlavorHistory(FLAVOR_T flavorSource,
0063                   reco::CandidatePtr const& parton,
0064                   reco::CandidatePtr const& progenitor,
0065                   reco::CandidatePtr const& sister,
0066                   reco::ShallowClonePtrCandidate const& matchedJet,
0067                   reco::ShallowClonePtrCandidate const& sisterJet);
0068     FlavorHistory(FLAVOR_T flavorSource,
0069                   edm::Handle<edm::View<reco::Candidate> > h_partons,
0070                   int iparton,
0071                   int iprogenitor,
0072                   int isister,
0073                   reco::ShallowClonePtrCandidate const& matchedJet,
0074                   reco::ShallowClonePtrCandidate const& sisterJet);
0075     FlavorHistory(FLAVOR_T flavorSource,
0076                   edm::Handle<reco::CandidateCollection> h_partons,
0077                   int iparton,
0078                   int iprogenitor,
0079                   int isister,
0080                   reco::ShallowClonePtrCandidate const& matchedJet,
0081                   reco::ShallowClonePtrCandidate const& sisterJet);
0082     ~FlavorHistory() {}
0083 
0084     // Accessors
0085     FLAVOR_T flavorSource() const { return flavorSource_; }
0086     bool hasParton() const { return parton_.isNonnull(); }
0087     bool hasSister() const { return sister_.isNonnull(); }
0088     bool hasProgenitor() const { return progenitor_.isNonnull(); }
0089     bool hasMatchedJet() const { return matchedJet_.masterClonePtr().isNonnull(); }
0090     bool hasSisterJet() const { return sisterJet_.masterClonePtr().isNonnull(); }
0091     const reco::CandidatePtr& parton() const { return parton_; }
0092     const reco::CandidatePtr& sister() const { return sister_; }
0093     const reco::CandidatePtr& progenitor() const { return progenitor_; }
0094     const reco::ShallowClonePtrCandidate& matchedJet() const { return matchedJet_; }
0095     const reco::ShallowClonePtrCandidate& sisterJet() const { return sisterJet_; }
0096 
0097     // Operators for sorting and keys
0098     bool operator<(FlavorHistory const& right) const { return parton_.key() < right.parton_.key(); }
0099     bool operator>(FlavorHistory const& right) const { return parton_.key() > right.parton_.key(); }
0100     bool operator==(FlavorHistory const& right) const { return parton_.key() == right.parton_.key(); }
0101 
0102   protected:
0103     FLAVOR_T flavorSource_;
0104     reco::CandidatePtr parton_;
0105     reco::CandidatePtr progenitor_;
0106     reco::CandidatePtr sister_;
0107     reco::ShallowClonePtrCandidate matchedJet_;
0108     reco::ShallowClonePtrCandidate sisterJet_;
0109   };
0110 
0111 }  // namespace reco
0112 
0113 std::ostream& operator<<(std::ostream& out, reco::FlavorHistory const& cand);
0114 
0115 #endif