Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:46:22

0001 #ifndef TopObjects_TtGenEvent_h
0002 #define TopObjects_TtGenEvent_h
0003 
0004 #include "CommonTools/CandUtils/interface/pdgIdUtils.h"
0005 #include "AnalysisDataFormats/TopObjects/interface/TopGenEvent.h"
0006 
0007 /**
0008    \class   TtGenEvent TtGenEvent.h "AnalysisDataFormats/TopObjects/interface/TtGenEvent.h"
0009 
0010    \brief   Class derived from the TopGenEvent for ttbar events
0011 
0012    The structure holds reference information to the generator particles 
0013    of the decay chains for each top quark and of the initial partons 
0014    and provides access and administration. The derived class contains 
0015    a few additional getters with respect to its base class.
0016 */
0017 
0018 class TtGenEvent : public TopGenEvent {
0019 public:
0020   /// empty constructor
0021   TtGenEvent(){};
0022   /// default constructor from decaySubset and initSubset
0023   TtGenEvent(reco::GenParticleRefProd& decaySubset, reco::GenParticleRefProd& initSubset);
0024   /// default destructor
0025   ~TtGenEvent() override{};
0026 
0027   /// check if the event can be classified as ttbar
0028   bool isTtBar() const { return (top() && topBar()); }
0029   /// check if the tops were produced from a pair of gluons
0030   bool fromGluonFusion() const;
0031   /// check if the tops were produced from qqbar
0032   bool fromQuarkAnnihilation() const;
0033   /// check if the event can be classified as full hadronic
0034   bool isFullHadronic(bool excludeTauLeptons = false) const {
0035     return isTtBar() ? isNumberOfLeptons(excludeTauLeptons, 0) : false;
0036   }
0037   /// check if the event can be classified as semi-laptonic
0038   bool isSemiLeptonic(bool excludeTauLeptons = false) const {
0039     return isTtBar() ? isNumberOfLeptons(excludeTauLeptons, 1) : false;
0040   }
0041   /// check if the event can be classified as full leptonic
0042   bool isFullLeptonic(bool excludeTauLeptons = false) const {
0043     return isTtBar() ? isNumberOfLeptons(excludeTauLeptons, 2) : false;
0044   }
0045 
0046   /// return decay channel; all leptons including taus are allowed
0047   WDecay::LeptonType semiLeptonicChannel() const;
0048   /// check if the event is semi-leptonic with the lepton being of typeA; all leptons including taus are allowed
0049   bool isSemiLeptonic(WDecay::LeptonType typeA) const { return semiLeptonicChannel() == typeA ? true : false; };
0050   /// check if the event is semi-leptonic with the lepton being of typeA or typeB; all leptons including taus are allowed
0051   bool isSemiLeptonic(WDecay::LeptonType typeA, WDecay::LeptonType typeB) const {
0052     return (semiLeptonicChannel() == typeA || semiLeptonicChannel() == typeB) ? true : false;
0053   };
0054   // return decay channel (as a std::pair of LeptonType's); all leptons including taus are allowed
0055   std::pair<WDecay::LeptonType, WDecay::LeptonType> fullLeptonicChannel() const;
0056   /// check if the event is full leptonic with the lepton being of typeA or typeB irrelevant of order; all leptons including taus are allowed
0057   bool isFullLeptonic(WDecay::LeptonType typeA, WDecay::LeptonType typeB) const;
0058 
0059   /// return single lepton if available; 0 else
0060   const reco::GenParticle* singleLepton(bool excludeTauLeptons = false) const;
0061   /// return single neutrino if available; 0 else
0062   const reco::GenParticle* singleNeutrino(bool excludeTauLeptons = false) const;
0063   /// get W of leptonic decay branch
0064   const reco::GenParticle* leptonicDecayW(bool excludeTauLeptons = false) const;
0065   /// get b of leptonic decay branch
0066   const reco::GenParticle* leptonicDecayB(bool excludeTauLeptons = false) const;
0067   /// get top of leptonic decay branch
0068   const reco::GenParticle* leptonicDecayTop(bool excludeTauLeptons = false) const;
0069   /// get W of hadronic decay branch
0070   const reco::GenParticle* hadronicDecayW(bool excludeTauLeptons = false) const;
0071   /// get b of hadronic decay branch
0072   const reco::GenParticle* hadronicDecayB(bool excludeTauLeptons = false) const;
0073   /// get top of hadronic decay branch
0074   const reco::GenParticle* hadronicDecayTop(bool excludeTauLeptons = false) const;
0075   /// get light quark of hadronic decay branch
0076   const reco::GenParticle* hadronicDecayQuark(bool invertFlavor = false) const;
0077   /// get light anti-quark of hadronic decay branch
0078   const reco::GenParticle* hadronicDecayQuarkBar() const { return hadronicDecayQuark(true); };
0079   /// gluons as radiated from the leptonicly decaying top quark
0080   std::vector<const reco::GenParticle*> leptonicDecayTopRadiation(bool excludeTauLeptons = false) const;
0081   /// gluons as radiated from the hadronicly decaying top quark
0082   std::vector<const reco::GenParticle*> hadronicDecayTopRadiation(bool excludeTauLeptons = false) const;
0083   /// get lepton for semi-leptonic or full leptonic decays
0084   const reco::GenParticle* lepton(bool excludeTauLeptons = false) const;
0085   /// get anti-lepton for semi-leptonic or full leptonic decays
0086   const reco::GenParticle* leptonBar(bool excludeTauLeptons = false) const;
0087   /// get neutrino for semi-leptonic or full leptonic decays
0088   const reco::GenParticle* neutrino(bool excludeTauLeptons = false) const;
0089   /// get anti-neutrino for semi-leptonic or full leptonic decays
0090   const reco::GenParticle* neutrinoBar(bool excludeTauLeptons = false) const;
0091 
0092   /// return combined 4-vector of top and topBar
0093   const math::XYZTLorentzVector* topPair() const { return isTtBar() ? &topPair_ : nullptr; };
0094 
0095 protected:
0096   /// combined 4-vector of top and topBar
0097   math::XYZTLorentzVector topPair_;
0098 
0099 private:
0100   /// check whether the number of leptons among the daughters of the W boson is nlep
0101   /// or not; there is an option to exclude taus from the list of leptons to consider
0102   bool isNumberOfLeptons(bool excludeTauLeptons, int nlep) const {
0103     return excludeTauLeptons ? (numberOfLeptons() - numberOfLeptons(WDecay::kTau)) == nlep : numberOfLeptons() == nlep;
0104   }
0105 };
0106 
0107 inline bool TtGenEvent::isFullLeptonic(WDecay::LeptonType typeA, WDecay::LeptonType typeB) const {
0108   return ((fullLeptonicChannel().first == typeA && fullLeptonicChannel().second == typeB) ||
0109           (fullLeptonicChannel().first == typeB && fullLeptonicChannel().second == typeA));
0110 }
0111 
0112 #endif