Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:57:30

0001 #ifndef TopObjects_TopGenEvent_h
0002 #define TopObjects_TopGenEvent_h
0003 
0004 #include "DataFormats/Candidate/interface/Candidate.h"
0005 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
0006 
0007 namespace TopDecayID {
0008   /// identification of top decays; used for following
0009   /// the decay chain in TopDecaySubset
0010   static const int stable = 2;
0011   static const int unfrag = 3;
0012   static const int tID = 6;
0013   static const int bID = 5;
0014   static const int glueID = 21;
0015   static const int photID = 22;
0016   static const int ZID = 23;
0017   static const int WID = 24;
0018   static const int elecID = 11;
0019   static const int muonID = 13;
0020   static const int tauID = 15;
0021 }  // namespace TopDecayID
0022 
0023 namespace WDecay {
0024   /// classification of leptons in the decay channel
0025   /// of the W boson used in several places throughout
0026   /// the package
0027   enum LeptonType { kNone, kElec, kMuon, kTau };
0028 }  // namespace WDecay
0029 
0030 /**
0031    \class   TopGenEvent TopGenEvent.h "AnalysisDataFormats/TopObjects/interface/TopGenEvent.h"
0032 
0033    \brief   Base class to hold information for reduced top generator information
0034 
0035    The structure holds reference information to the generator particles 
0036    of the decay chains for each top quark and of the initial partons. It 
0037    provides access and administration.
0038 */
0039 
0040 class TopGenEvent {
0041 public:
0042   /// empty constructor
0043   TopGenEvent(){};
0044   /// default constructor
0045   TopGenEvent(reco::GenParticleRefProd& decaySubset, reco::GenParticleRefProd& iniSubset);
0046   /// default destructor
0047   virtual ~TopGenEvent(){};
0048 
0049   /// return particles of decay chain
0050   const reco::GenParticleCollection& particles() const { return *parts_; }
0051   /// return particles of initial partons
0052   const reco::GenParticleCollection& initialPartons() const { return *initPartons_; }
0053   /// return radiated gluons from particle with pdgId
0054   std::vector<const reco::GenParticle*> radiatedGluons(int pdgId) const;
0055   /// return all light quarks or all quarks including b's
0056   std::vector<const reco::GenParticle*> lightQuarks(bool includingBQuarks = false) const;
0057   /// return number of leptons in the decay chain
0058   int numberOfLeptons(bool fromWBoson = true) const;
0059   /// return number of leptons in the decay chain
0060   int numberOfLeptons(WDecay::LeptonType type, bool fromWBoson = true) const;
0061   /// return number of b quarks in the decay chain
0062   int numberOfBQuarks(bool fromTopQuark = true) const;
0063   /// return number of top anti-top sisters
0064   std::vector<const reco::GenParticle*> topSisters() const;
0065   /// return daughter quark of top quark (which can have flavor b, s or d)
0066   const reco::GenParticle* daughterQuarkOfTop(bool invertCharge = false) const;
0067   /// return daughter quark of anti-top quark (which can have flavor b, s or d)
0068   const reco::GenParticle* daughterQuarkOfTopBar() const { return daughterQuarkOfTop(true); };
0069   /// return quark daughter quark of W boson
0070   const reco::GenParticle* daughterQuarkOfWPlus(bool invertQuarkCharge = false, bool invertBosonCharge = false) const;
0071   /// return quark daughter of anti-W boson
0072   const reco::GenParticle* daughterQuarkOfWMinus() const { return daughterQuarkOfWPlus(false, true); };
0073   /// return anti-quark daughter of W boson
0074   const reco::GenParticle* daughterQuarkBarOfWPlus() const { return daughterQuarkOfWPlus(true, false); };
0075   /// return anti-quark daughter of anti-W boson
0076   const reco::GenParticle* daughterQuarkBarOfWMinus() const { return daughterQuarkOfWPlus(true, true); };
0077 
0078   /// get candidate with given pdg id if available; 0 else
0079   const reco::GenParticle* candidate(int id, unsigned int parentId = 0) const;
0080   /// return electron if available; 0 else
0081   const reco::GenParticle* eMinus() const { return candidate(TopDecayID::elecID, TopDecayID::WID); }
0082   /// return positron if available; 0 else
0083   const reco::GenParticle* ePlus() const { return candidate(-TopDecayID::elecID, TopDecayID::WID); }
0084   /// return muon if available; 0 else
0085   const reco::GenParticle* muMinus() const { return candidate(TopDecayID::muonID, TopDecayID::WID); }
0086   /// return anti-muon if available; 0 else
0087   const reco::GenParticle* muPlus() const { return candidate(-TopDecayID::muonID, TopDecayID::WID); }
0088   /// return tau if available; 0 else
0089   const reco::GenParticle* tauMinus() const { return candidate(TopDecayID::tauID, TopDecayID::WID); }
0090   /// return anti-tau if available; 0 else
0091   const reco::GenParticle* tauPlus() const { return candidate(-TopDecayID::tauID, TopDecayID::WID); }
0092   /// return W minus if available; 0 else
0093   const reco::GenParticle* wMinus() const { return candidate(-TopDecayID::WID, TopDecayID::tID); }
0094   /// return W plus if available; 0 else
0095   const reco::GenParticle* wPlus() const { return candidate(TopDecayID::WID, TopDecayID::tID); }
0096   /// return b quark if available; 0 else
0097   const reco::GenParticle* b() const { return candidate(TopDecayID::bID, TopDecayID::tID); }
0098   /// return anti-b quark if available; 0 else
0099   const reco::GenParticle* bBar() const { return candidate(-TopDecayID::bID, TopDecayID::tID); }
0100   /// return top if available; 0 else
0101   const reco::GenParticle* top() const { return candidate(TopDecayID::tID); }
0102   /// return anti-top if available; 0 else
0103   const reco::GenParticle* topBar() const { return candidate(-TopDecayID::tID); }
0104 
0105   /// print content of the top decay chain as formated
0106   /// LogInfo to the MessageLogger output for debugging
0107   void print() const;
0108 
0109 protected:
0110   /// reference to the top decay chain (has to be kept in the event!)
0111   reco::GenParticleRefProd parts_;
0112   /// reference to the list of initial partons (has to be kept in the event!)
0113   reco::GenParticleRefProd initPartons_;
0114 };
0115 
0116 #endif