Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef TopObjects_TtSemiLeptonicEvent_h
0002 #define TopObjects_TtSemiLeptonicEvent_h
0003 
0004 #include "AnalysisDataFormats/TopObjects/interface/TtEvent.h"
0005 
0006 namespace TtSemiLepDaughter {
0007   /// semi-leptonic daughter names for common
0008   /// use and use with the hypotheses
0009   static const std::string Nu = "Nu", Lep = "Lep", LepW = "LepW", LepB = "LepB", LepTop = "LepTop";
0010   static const std::string HadQ = "HadQ", HadP = "HadP", HadW = "HadW", HadB = "HadB", HadTop = "HadTop";
0011 }  // namespace TtSemiLepDaughter
0012 
0013 /**
0014    \class   TtSemiLeptonicEvent TtSemiLeptonicEvent.h "AnalysisDataFormats/TopObjects/interface/TtSemiLeptonicEvent.h"
0015 
0016    \brief   Class derived from the TtEvent for the semileptonic decay channel
0017 
0018    The structure holds information on the leptonic decay channels, 
0019    all event hypotheses of different classes (user defined during
0020    production) and a reference to the TtGenEvent (if available). It 
0021    provides access and administration.
0022 */
0023 
0024 class TtSemiLeptonicEvent : public TtEvent {
0025 public:
0026   /// empty constructor
0027   TtSemiLeptonicEvent(){};
0028   /// default destructor
0029   ~TtSemiLeptonicEvent() override{};
0030 
0031   /// get hadronic top of the given hypothesis
0032   const reco::Candidate* hadronicDecayTop(const std::string& key, const unsigned& cmb = 0) const {
0033     return hadronicDecayTop(hypoClassKeyFromString(key), cmb);
0034   };
0035   /// get hadronic top of the given hypothesis
0036   const reco::Candidate* hadronicDecayTop(const HypoClassKey& key, const unsigned& cmb = 0) const {
0037     return !isHypoValid(key, cmb) ? nullptr : eventHypo(key, cmb).daughter(TtSemiLepDaughter::HadTop);
0038   };
0039   /// get hadronic b of the given hypothesis
0040   const reco::Candidate* hadronicDecayB(const std::string& key, const unsigned& cmb = 0) const {
0041     return hadronicDecayB(hypoClassKeyFromString(key), cmb);
0042   };
0043   /// get hadronic b of the given hypothesis
0044   const reco::Candidate* hadronicDecayB(const HypoClassKey& key, const unsigned& cmb = 0) const {
0045     return !isHypoValid(key, cmb) ? nullptr : hadronicDecayTop(key, cmb)->daughter(TtSemiLepDaughter::HadB);
0046   };
0047   /// get hadronic W of the given hypothesis
0048   const reco::Candidate* hadronicDecayW(const std::string& key, const unsigned& cmb = 0) const {
0049     return hadronicDecayW(hypoClassKeyFromString(key), cmb);
0050   };
0051   /// get hadronic W of the given hypothesis
0052   const reco::Candidate* hadronicDecayW(const HypoClassKey& key, const unsigned& cmb = 0) const {
0053     return !isHypoValid(key, cmb) ? nullptr : hadronicDecayTop(key, cmb)->daughter(TtSemiLepDaughter::HadW);
0054   };
0055   /// get hadronic light quark of the given hypothesis
0056   const reco::Candidate* hadronicDecayQuark(const std::string& key, const unsigned& cmb = 0) const {
0057     return hadronicDecayQuark(hypoClassKeyFromString(key), cmb);
0058   };
0059   /// get hadronic light quark of the given hypothesis
0060   const reco::Candidate* hadronicDecayQuark(const HypoClassKey& key, const unsigned& cmb = 0) const {
0061     return !isHypoValid(key, cmb) ? nullptr : hadronicDecayW(key, cmb)->daughter(TtSemiLepDaughter::HadP);
0062   };
0063   /// get hadronic light quark of the given hypothesis
0064   const reco::Candidate* hadronicDecayQuarkBar(const std::string& key, const unsigned& cmb = 0) const {
0065     return hadronicDecayQuarkBar(hypoClassKeyFromString(key), cmb);
0066   };
0067   /// get hadronic light quark of the given hypothesis
0068   const reco::Candidate* hadronicDecayQuarkBar(const HypoClassKey& key, const unsigned& cmb = 0) const {
0069     return !isHypoValid(key, cmb) ? nullptr : hadronicDecayW(key, cmb)->daughter(TtSemiLepDaughter::HadQ);
0070   };
0071   /// get leptonic top of the given hypothesis
0072   const reco::Candidate* leptonicDecayTop(const std::string& key, const unsigned& cmb = 0) const {
0073     return leptonicDecayTop(hypoClassKeyFromString(key), cmb);
0074   };
0075   /// get leptonic top of the given hypothesis
0076   const reco::Candidate* leptonicDecayTop(const HypoClassKey& key, const unsigned& cmb = 0) const {
0077     return !isHypoValid(key, cmb) ? nullptr : eventHypo(key, cmb).daughter(TtSemiLepDaughter::LepTop);
0078   };
0079   /// get leptonic b of the given hypothesis
0080   const reco::Candidate* leptonicDecayB(const std::string& key, const unsigned& cmb = 0) const {
0081     return leptonicDecayB(hypoClassKeyFromString(key), cmb);
0082   };
0083   /// get leptonic b of the given hypothesis
0084   const reco::Candidate* leptonicDecayB(const HypoClassKey& key, const unsigned& cmb = 0) const {
0085     return !isHypoValid(key, cmb) ? nullptr : leptonicDecayTop(key, cmb)->daughter(TtSemiLepDaughter::LepB);
0086   };
0087   /// get leptonic W of the given hypothesis
0088   const reco::Candidate* leptonicDecayW(const std::string& key, const unsigned& cmb = 0) const {
0089     return leptonicDecayW(hypoClassKeyFromString(key), cmb);
0090   };
0091   /// get leptonic W of the given hypothesis
0092   const reco::Candidate* leptonicDecayW(const HypoClassKey& key, const unsigned& cmb = 0) const {
0093     return !isHypoValid(key, cmb) ? nullptr : leptonicDecayTop(key, cmb)->daughter(TtSemiLepDaughter::LepW);
0094   };
0095   /// get leptonic light quark of the given hypothesis
0096   const reco::Candidate* singleNeutrino(const std::string& key, const unsigned& cmb = 0) const {
0097     return singleNeutrino(hypoClassKeyFromString(key), cmb);
0098   };
0099   /// get leptonic light quark of the given hypothesis
0100   const reco::Candidate* singleNeutrino(const HypoClassKey& key, const unsigned& cmb = 0) const {
0101     return !isHypoValid(key, cmb) ? nullptr : leptonicDecayW(key, cmb)->daughter(TtSemiLepDaughter::Nu);
0102   };
0103   /// get leptonic light quark of the given hypothesis
0104   const reco::Candidate* singleLepton(const std::string& key, const unsigned& cmb = 0) const {
0105     return singleLepton(hypoClassKeyFromString(key), cmb);
0106   };
0107   /// get leptonic light quark of the given hypothesis
0108   const reco::Candidate* singleLepton(const HypoClassKey& key, const unsigned& cmb = 0) const {
0109     return !isHypoValid(key, cmb) ? nullptr : leptonicDecayW(key, cmb)->daughter(TtSemiLepDaughter::Lep);
0110   };
0111 
0112   /// get hadronic top of the TtGenEvent
0113   const reco::GenParticle* hadronicDecayTop() const {
0114     return (!genEvt_ ? nullptr : this->genEvent()->hadronicDecayTop());
0115   };
0116   /// get hadronic b of the TtGenEvent
0117   const reco::GenParticle* hadronicDecayB() const { return (!genEvt_ ? nullptr : this->genEvent()->hadronicDecayB()); };
0118   /// get hadronic W of the TtGenEvent
0119   const reco::GenParticle* hadronicDecayW() const { return (!genEvt_ ? nullptr : this->genEvent()->hadronicDecayW()); };
0120   /// get hadronic light quark of the TtGenEvent
0121   const reco::GenParticle* hadronicDecayQuark() const {
0122     return (!genEvt_ ? nullptr : this->genEvent()->hadronicDecayQuark());
0123   };
0124   /// get hadronic light quark of the TtGenEvent
0125   const reco::GenParticle* hadronicDecayQuarkBar() const {
0126     return (!genEvt_ ? nullptr : this->genEvent()->hadronicDecayQuarkBar());
0127   };
0128   /// get leptonic top of the TtGenEvent
0129   const reco::GenParticle* leptonicDecayTop() const {
0130     return (!genEvt_ ? nullptr : this->genEvent()->leptonicDecayTop());
0131   };
0132   /// get leptonic b of the TtGenEvent
0133   const reco::GenParticle* leptonicDecayB() const { return (!genEvt_ ? nullptr : this->genEvent()->leptonicDecayB()); };
0134   /// get leptonic W of the TtGenEvent
0135   const reco::GenParticle* leptonicDecayW() const { return (!genEvt_ ? nullptr : this->genEvent()->leptonicDecayW()); };
0136   /// get lepton top of the TtGenEvent
0137   const reco::GenParticle* singleLepton() const { return (!genEvt_ ? nullptr : this->genEvent()->singleLepton()); };
0138   /// get neutrino of the TtGenEvent
0139   const reco::GenParticle* singleNeutrino() const { return (!genEvt_ ? nullptr : this->genEvent()->singleNeutrino()); };
0140 
0141   /// print full content of the structure as formated
0142   /// LogInfo to the MessageLogger output for debugging
0143   void print(const int verbosity = 1) const;
0144 
0145   /// get number of real neutrino solutions for a given hypo class
0146   const int numberOfRealNeutrinoSolutions(const HypoClassKey& key) const {
0147     return (numberOfRealNeutrinoSolutions_.find(key) == numberOfRealNeutrinoSolutions_.end()
0148                 ? -999
0149                 : numberOfRealNeutrinoSolutions_.find(key)->second);
0150   };
0151   /// get number of real neutrino solutions for a given hypo class
0152   const int numberOfRealNeutrinoSolutions(const std::string& key) const {
0153     return numberOfRealNeutrinoSolutions(hypoClassKeyFromString(key));
0154   };
0155 
0156   /// set number of real neutrino solutions for a given hypo class
0157   void setNumberOfRealNeutrinoSolutions(const HypoClassKey& key, const int& nr) {
0158     numberOfRealNeutrinoSolutions_[key] = nr;
0159   };
0160 
0161 protected:
0162   /// number of real neutrino solutions for all hypo classes
0163   std::map<HypoClassKey, int> numberOfRealNeutrinoSolutions_;
0164 };
0165 
0166 #endif