Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef TopObjects_TtFullLeptonicEvent_h
0002 #define TopObjects_TtFullLeptonicEvent_h
0003 
0004 #include "AnalysisDataFormats/TopObjects/interface/TtEvent.h"
0005 
0006 namespace TtFullLepDaughter {
0007   /// full leptonic daughter names for common
0008   /// use and use with the hypotheses
0009   static const std::string Nu = "Nu", LepBar = "LepBar", WPlus = "WPlus", B = "B", Top = "Top";
0010   static const std::string NuBar = "NuBar", Lep = "Lep", WMinus = "WMinus", BBar = "BBar", TopBar = "TopBar";
0011 }  // namespace TtFullLepDaughter
0012 
0013 /**
0014    \class   TtFullLeptonicEvent TtFullLeptonicEvent.h "AnalysisDataFormats/TopObjects/interface/TtFullLeptonicEvent.h"
0015 
0016    \brief   Class derived from the TtEvent for the full leptonic 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 TtFullLeptonicEvent : public TtEvent {
0025 public:
0026   /// empty constructor
0027   TtFullLeptonicEvent(){};
0028   /// default destructor
0029   ~TtFullLeptonicEvent() override{};
0030 
0031   /// get top of the given hypothesis
0032   const reco::Candidate* top(const std::string& key, const unsigned& cmb = 0) const {
0033     return top(hypoClassKeyFromString(key), cmb);
0034   };
0035   /// get top of the given hypothesis
0036   const reco::Candidate* top(const HypoClassKey& key, const unsigned& cmb = 0) const {
0037     return !isHypoValid(key, cmb) ? nullptr : eventHypo(key, cmb).daughter(TtFullLepDaughter::Top);
0038   };
0039   /// get b of the given hypothesis
0040   const reco::Candidate* b(const std::string& key, const unsigned& cmb = 0) const {
0041     return b(hypoClassKeyFromString(key), cmb);
0042   };
0043   /// get b of the given hypothesis
0044   const reco::Candidate* b(const HypoClassKey& key, const unsigned& cmb = 0) const {
0045     return !isHypoValid(key, cmb) ? nullptr : top(key, cmb)->daughter(TtFullLepDaughter::B);
0046   };
0047   /// get Wplus of the given hypothesis
0048   const reco::Candidate* wPlus(const std::string& key, const unsigned& cmb = 0) const {
0049     return wPlus(hypoClassKeyFromString(key), cmb);
0050   };
0051   /// get Wplus of the given hypothesis
0052   const reco::Candidate* wPlus(const HypoClassKey& key, const unsigned& cmb = 0) const {
0053     return !isHypoValid(key, cmb) ? nullptr : top(key, cmb)->daughter(TtFullLepDaughter::WPlus);
0054   };
0055   /// get anti-lepton of the given hypothesis
0056   const reco::Candidate* leptonBar(const std::string& key, const unsigned& cmb = 0) const {
0057     return leptonBar(hypoClassKeyFromString(key), cmb);
0058   };
0059   /// get anti-lepton of the given hypothesis
0060   const reco::Candidate* leptonBar(const HypoClassKey& key, const unsigned& cmb = 0) const {
0061     return !isHypoValid(key, cmb) ? nullptr : wPlus(key, cmb)->daughter(TtFullLepDaughter::LepBar);
0062   };
0063   /// get neutrino of the given hypothesis
0064   const reco::Candidate* neutrino(const std::string& key, const unsigned& cmb = 0) const {
0065     return neutrino(hypoClassKeyFromString(key), cmb);
0066   };
0067   /// get neutrino of the given hypothesis
0068   const reco::Candidate* neutrino(const HypoClassKey& key, const unsigned& cmb = 0) const {
0069     return !isHypoValid(key, cmb) ? nullptr : wPlus(key, cmb)->daughter(TtFullLepDaughter::Nu);
0070   };
0071   /// get anti-top of the given hypothesis
0072   const reco::Candidate* topBar(const std::string& key, const unsigned& cmb = 0) const {
0073     return topBar(hypoClassKeyFromString(key), cmb);
0074   };
0075   /// get anti-top of the given hypothesis
0076   const reco::Candidate* topBar(const HypoClassKey& key, const unsigned& cmb = 0) const {
0077     return !isHypoValid(key, cmb) ? nullptr : eventHypo(key, cmb).daughter(TtFullLepDaughter::TopBar);
0078   };
0079   /// get anti-b of the given hypothesis
0080   const reco::Candidate* bBar(const std::string& key, const unsigned& cmb = 0) const {
0081     return bBar(hypoClassKeyFromString(key), cmb);
0082   };
0083   /// get anti-b of the given hypothesis
0084   const reco::Candidate* bBar(const HypoClassKey& key, const unsigned& cmb = 0) const {
0085     return !isHypoValid(key, cmb) ? nullptr : topBar(key, cmb)->daughter(TtFullLepDaughter::BBar);
0086   };
0087   /// get Wminus of the given hypothesis
0088   const reco::Candidate* wMinus(const std::string& key, const unsigned& cmb = 0) const {
0089     return wMinus(hypoClassKeyFromString(key), cmb);
0090   };
0091   /// get Wminus of the given hypothesis
0092   const reco::Candidate* wMinus(const HypoClassKey& key, const unsigned& cmb = 0) const {
0093     return !isHypoValid(key, cmb) ? nullptr : topBar(key, cmb)->daughter(TtFullLepDaughter::WMinus);
0094   };
0095   /// get lepton of the given hypothesis
0096   const reco::Candidate* lepton(const std::string& key, const unsigned& cmb = 0) const {
0097     return lepton(hypoClassKeyFromString(key), cmb);
0098   };
0099   /// get lepton of the given hypothesis
0100   const reco::Candidate* lepton(const HypoClassKey& key, const unsigned& cmb = 0) const {
0101     return !isHypoValid(key, cmb) ? nullptr : wMinus(key, cmb)->daughter(TtFullLepDaughter::Lep);
0102   };
0103   /// get anti-neutrino of the given hypothesis
0104   const reco::Candidate* neutrinoBar(const std::string& key, const unsigned& cmb = 0) const {
0105     return neutrinoBar(hypoClassKeyFromString(key), cmb);
0106   };
0107   /// get anti-neutrino of the given hypothesis
0108   const reco::Candidate* neutrinoBar(const HypoClassKey& key, const unsigned& cmb = 0) const {
0109     return !isHypoValid(key, cmb) ? nullptr : wMinus(key, cmb)->daughter(TtFullLepDaughter::NuBar);
0110   };
0111 
0112   /// get top of the TtGenEvent
0113   const reco::GenParticle* genTop() const { return (!genEvt_ ? nullptr : this->genEvent()->top()); };
0114   /// get b of the TtGenEvent
0115   const reco::GenParticle* genB() const { return (!genEvt_ ? nullptr : this->genEvent()->b()); };
0116   /// get Wplus of the TtGenEvent
0117   const reco::GenParticle* genWPlus() const { return (!genEvt_ ? nullptr : this->genEvent()->wPlus()); };
0118   /// get anti-lepton of the TtGenEvent
0119   const reco::GenParticle* genLeptonBar() const { return (!genEvt_ ? nullptr : this->genEvent()->leptonBar()); };
0120   /// get neutrino of the TtGenEvent
0121   const reco::GenParticle* genNeutrino() const { return (!genEvt_ ? nullptr : this->genEvent()->neutrino()); };
0122   /// get anti-top of the TtGenEvent
0123   const reco::GenParticle* genTopBar() const { return (!genEvt_ ? nullptr : this->genEvent()->topBar()); };
0124   /// get anti-b of the TtGenEvent
0125   const reco::GenParticle* genBBar() const { return (!genEvt_ ? nullptr : this->genEvent()->bBar()); };
0126   /// get Wminus of the TtGenEvent
0127   const reco::GenParticle* genWMinus() const { return (!genEvt_ ? nullptr : this->genEvent()->wMinus()); };
0128   /// get lepton of the TtGenEvent
0129   const reco::GenParticle* genLepton() const { return (!genEvt_ ? nullptr : this->genEvent()->lepton()); };
0130   /// get anti-neutrino of the TtGenEvent
0131   const reco::GenParticle* genNeutrinoBar() const { return (!genEvt_ ? nullptr : this->genEvent()->neutrinoBar()); };
0132 
0133   /// return the weight of the kinematic solution of hypothesis 'cmb' if available; -1 else
0134   double solWeight(const unsigned& cmb = 0) const { return (cmb < solWeight_.size() ? solWeight_[cmb] : -1.); }
0135   /// return if the kinematic solution of hypothesis 'cmb' is right or wrong charge if available; -1 else
0136   bool isWrongCharge() const { return wrongCharge_; }
0137 
0138   /// set weight of kKinSolution hypothesis
0139   void setSolWeight(const std::vector<double>& val) { solWeight_ = val; };
0140   /// set right or wrong charge combination of kKinSolution hypothesis
0141   void setWrongCharge(const bool& val) { wrongCharge_ = val; };
0142 
0143   /// print full content of the structure as formated
0144   /// LogInfo to the MessageLogger output for debugging
0145   void print(const int verbosity = 1) const;
0146 
0147 protected:
0148   /// result of kinematic solution
0149   std::vector<double> solWeight_;
0150   /// right/wrong charge booleans
0151   bool wrongCharge_;
0152 };
0153 
0154 #endif