CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10/src/DataFormats/HepMCCandidate/interface/FlavorHistory.h

Go to the documentation of this file.
00001 #ifndef HepMCCandidate_FlavorHistory_h
00002 #define HepMCCandidate_FlavorHistory_h
00003 
00013 // -------------------------------------------------------------
00014 // Identify the ancestry of the Quark
00015 // 
00016 // 
00017 // Matrix Element:
00018 //    Status 3 parent with precisely 2 "grandparents" that
00019 //    is outside of the "initial" section (0-5) that has the
00020 //    same ID as the status 2 parton in question. 
00021 //
00022 // Flavor excitation:
00023 //    If we find only one outgoing parton.
00024 //
00025 // Gluon splitting:
00026 //    Parent is a quark of a different flavor than the parton
00027 //    in question, or a gluon. 
00028 //    Can come from either ISR or FSR.
00029 //
00030 // True decay:
00031 //    Decays from a resonance like top, Higgs, etc.
00032 // -------------------------------------------------------------
00033 
00034 
00035 #include "DataFormats/Common/interface/Ptr.h"
00036 #include "DataFormats/Common/interface/OwnVector.h"
00037 #include "DataFormats/Common/interface/Handle.h"
00038 #include "DataFormats/Common/interface/View.h"
00039 #include "DataFormats/Candidate/interface/Candidate.h"
00040 #include "DataFormats/Candidate/interface/CandidateFwd.h"
00041 #include "DataFormats/Candidate/interface/ShallowClonePtrCandidate.h"
00042 
00043 #include <fstream>
00044 
00045 namespace reco {
00046 
00047 
00048 class FlavorHistory {
00049 public:
00050 
00051   enum FLAVOR_T { FLAVOR_NULL=0,   // No flavor, unset
00052                   FLAVOR_GS,       // gluon splitting
00053                   FLAVOR_EXC,      // flavor excitation
00054                   FLAVOR_ME,       // matrix element
00055                   FLAVOR_DECAY,    // flavor decay
00056                   N_FLAVOR_TYPES };// total number
00057 
00058   static const int  gluonId=21;
00059   static const int  tQuarkId=6;
00060   static const int  bQuarkId=5;
00061   static const int  cQuarkId=4;
00062   
00063 
00064   FlavorHistory(); 
00065   FlavorHistory( FLAVOR_T flavorSource,
00066                  reco::CandidatePtr const & parton,
00067                  reco::CandidatePtr const & progenitor,
00068                  reco::CandidatePtr const & sister,
00069                  reco::ShallowClonePtrCandidate const & matchedJet,
00070                  reco::ShallowClonePtrCandidate const & sisterJet);
00071   FlavorHistory( FLAVOR_T flavorSource,
00072                  edm::Handle<edm::View<reco::Candidate> > h_partons,
00073                  int iparton,
00074                  int iprogenitor,
00075                  int isister,
00076                  reco::ShallowClonePtrCandidate const & matchedJet,
00077                  reco::ShallowClonePtrCandidate const & sisterJet);
00078   FlavorHistory( FLAVOR_T flavorSource,
00079                  edm::Handle<reco::CandidateCollection > h_partons,
00080                  int iparton,
00081                  int iprogenitor,
00082                  int isister,
00083                  reco::ShallowClonePtrCandidate const & matchedJet,
00084                  reco::ShallowClonePtrCandidate const & sisterJet );
00085   ~FlavorHistory(){}
00086 
00087 
00088   // Accessors
00089   FLAVOR_T       flavorSource          () const { return flavorSource_; }
00090   bool           hasParton             () const { return parton_.isNonnull(); }
00091   bool           hasSister             () const { return sister_.isNonnull(); }
00092   bool           hasProgenitor         () const { return progenitor_.isNonnull();}
00093   bool           hasMatchedJet         () const { return matchedJet_.masterClonePtr().isNonnull(); }
00094   bool           hasSisterJet          () const { return sisterJet_.masterClonePtr().isNonnull(); }
00095   const reco::CandidatePtr & parton    () const { return parton_; }
00096   const reco::CandidatePtr & sister    () const { return sister_; }
00097   const reco::CandidatePtr & progenitor() const { return progenitor_; }
00098   const reco::ShallowClonePtrCandidate & 
00099                              matchedJet() const { return matchedJet_; }
00100   const reco::ShallowClonePtrCandidate & 
00101                              sisterJet() const { return sisterJet_; }
00102 
00103   // Operators for sorting and keys
00104   bool operator< ( FlavorHistory const & right ) const {
00105     return parton_.key() < right.parton_.key();
00106   }
00107   bool operator> ( FlavorHistory const & right ) const {
00108     return parton_.key() > right.parton_.key();
00109   }
00110   bool operator== ( FlavorHistory const & right ) const {
00111     return parton_.key() == right.parton_.key();
00112   }
00113   
00114   
00115 
00116 protected:
00117   FLAVOR_T              flavorSource_;
00118   reco::CandidatePtr    parton_;
00119   reco::CandidatePtr    progenitor_;
00120   reco::CandidatePtr    sister_;
00121   reco::ShallowClonePtrCandidate matchedJet_;
00122   reco::ShallowClonePtrCandidate sisterJet_;
00123 };
00124 
00125 }
00126 
00127 std::ostream & operator<<( std::ostream & out, reco::FlavorHistory const & cand);
00128 
00129 #endif