File indexing completed on 2024-09-07 04:34:44
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
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 class TtGenEvent : public TopGenEvent {
0019 public:
0020
0021 TtGenEvent() {}
0022
0023 TtGenEvent(reco::GenParticleRefProd& decaySubset, reco::GenParticleRefProd& initSubset);
0024
0025 ~TtGenEvent() override {}
0026
0027
0028 bool isTtBar() const { return (top() && topBar()); }
0029
0030 bool fromGluonFusion() const;
0031
0032 bool fromQuarkAnnihilation() const;
0033
0034 bool isFullHadronic(bool excludeTauLeptons = false) const {
0035 return isTtBar() ? isNumberOfLeptons(excludeTauLeptons, 0) : false;
0036 }
0037
0038 bool isSemiLeptonic(bool excludeTauLeptons = false) const {
0039 return isTtBar() ? isNumberOfLeptons(excludeTauLeptons, 1) : false;
0040 }
0041
0042 bool isFullLeptonic(bool excludeTauLeptons = false) const {
0043 return isTtBar() ? isNumberOfLeptons(excludeTauLeptons, 2) : false;
0044 }
0045
0046
0047 WDecay::LeptonType semiLeptonicChannel() const;
0048
0049 bool isSemiLeptonic(WDecay::LeptonType typeA) const { return semiLeptonicChannel() == typeA ? true : false; };
0050
0051 bool isSemiLeptonic(WDecay::LeptonType typeA, WDecay::LeptonType typeB) const {
0052 return (semiLeptonicChannel() == typeA || semiLeptonicChannel() == typeB) ? true : false;
0053 };
0054
0055 std::pair<WDecay::LeptonType, WDecay::LeptonType> fullLeptonicChannel() const;
0056
0057 bool isFullLeptonic(WDecay::LeptonType typeA, WDecay::LeptonType typeB) const;
0058
0059
0060 const reco::GenParticle* singleLepton(bool excludeTauLeptons = false) const;
0061
0062 const reco::GenParticle* singleNeutrino(bool excludeTauLeptons = false) const;
0063
0064 const reco::GenParticle* leptonicDecayW(bool excludeTauLeptons = false) const;
0065
0066 const reco::GenParticle* leptonicDecayB(bool excludeTauLeptons = false) const;
0067
0068 const reco::GenParticle* leptonicDecayTop(bool excludeTauLeptons = false) const;
0069
0070 const reco::GenParticle* hadronicDecayW(bool excludeTauLeptons = false) const;
0071
0072 const reco::GenParticle* hadronicDecayB(bool excludeTauLeptons = false) const;
0073
0074 const reco::GenParticle* hadronicDecayTop(bool excludeTauLeptons = false) const;
0075
0076 const reco::GenParticle* hadronicDecayQuark(bool invertFlavor = false) const;
0077
0078 const reco::GenParticle* hadronicDecayQuarkBar() const { return hadronicDecayQuark(true); };
0079
0080 std::vector<const reco::GenParticle*> leptonicDecayTopRadiation(bool excludeTauLeptons = false) const;
0081
0082 std::vector<const reco::GenParticle*> hadronicDecayTopRadiation(bool excludeTauLeptons = false) const;
0083
0084 const reco::GenParticle* lepton(bool excludeTauLeptons = false) const;
0085
0086 const reco::GenParticle* leptonBar(bool excludeTauLeptons = false) const;
0087
0088 const reco::GenParticle* neutrino(bool excludeTauLeptons = false) const;
0089
0090 const reco::GenParticle* neutrinoBar(bool excludeTauLeptons = false) const;
0091
0092
0093 const math::XYZTLorentzVector* topPair() const { return isTtBar() ? &topPair_ : nullptr; };
0094
0095 protected:
0096
0097 math::XYZTLorentzVector topPair_;
0098
0099 private:
0100
0101
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