Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 //
0002 //
0003 
0004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0005 #include "AnalysisDataFormats/TopObjects/interface/StEvtSolution.h"
0006 
0007 StEvtSolution::StEvtSolution() {
0008   jetCorrScheme_ = 0;
0009   chi2Prob_ = -999.;
0010   pTrueCombExist_ = -999.;
0011   pTrueBJetSel_ = -999.;
0012   pTrueBhadrSel_ = -999.;
0013   pTrueJetComb_ = -999.;
0014   signalPur_ = -999.;
0015   signalLRTot_ = -999.;
0016   sumDeltaRjp_ = -999.;
0017   deltaRB_ = -999.;
0018   deltaRL_ = -999.;
0019   changeBL_ = -999;
0020   bestSol_ = false;
0021 }
0022 
0023 StEvtSolution::~StEvtSolution() {}
0024 
0025 //-------------------------------------------
0026 // get calibrated base objects
0027 //-------------------------------------------
0028 pat::Jet StEvtSolution::getBottom() const {
0029   // WARNING this is obsolete and only
0030   // kept for backwards compatibility
0031   if (jetCorrScheme_ == 1) {
0032     //jet calibrated according to MC truth
0033     return bottom_->correctedJet("HAD", "B");
0034   } else if (jetCorrScheme_ == 2) {
0035     return bottom_->correctedJet("HAD", "B");
0036   } else {
0037     return *bottom_;
0038   }
0039 }
0040 
0041 pat::Jet StEvtSolution::getLight() const {
0042   // WARNING this is obsolete and only
0043   // kept for backwards compatibility
0044   if (jetCorrScheme_ == 1) {
0045     //jet calibrated according to MC truth
0046     return light_->correctedJet("HAD", "UDS");
0047   } else if (jetCorrScheme_ == 2) {
0048     return light_->correctedJet("HAD", "UDS");
0049   } else {
0050     return *light_;
0051   }
0052 }
0053 
0054 reco::Particle StEvtSolution::getLepW() const {
0055   // FIXME: the charge from the genevent
0056   reco::Particle p;
0057   if (this->getDecay() == "muon")
0058     p = reco::Particle(0, this->getMuon().p4() + this->getNeutrino().p4(), math::XYZPoint());
0059   if (this->getDecay() == "electron")
0060     p = reco::Particle(0, this->getElectron().p4() + this->getNeutrino().p4(), math::XYZPoint());
0061   return p;
0062 }
0063 
0064 reco::Particle StEvtSolution::getLept() const {
0065   // FIXME: the charge from the genevent
0066   reco::Particle p;
0067   if (this->getDecay() == "muon")
0068     p = reco::Particle(0, this->getMuon().p4() + this->getNeutrino().p4() + this->getBottom().p4(), math::XYZPoint());
0069   if (this->getDecay() == "electron")
0070     p = reco::Particle(
0071         0, this->getElectron().p4() + this->getNeutrino().p4() + this->getBottom().p4(), math::XYZPoint());
0072   return p;
0073 }
0074 
0075 //-------------------------------------------
0076 // get the matched gen particles
0077 //-------------------------------------------
0078 // FIXME: provide defaults if the genevent is invalid
0079 const reco::GenParticle* StEvtSolution::getGenBottom() const {
0080   if (!theGenEvt_)
0081     return nullptr;
0082   else
0083     return theGenEvt_->decayB();
0084 }
0085 
0086 // FIXME: not implemented yet
0087 // const reco::GenParticle * StEvtSolution::getGenLight() const
0088 // {
0089 //   if(!theGenEvt_) return 0;
0090 //   else return theGenEvt_->recoilQuark();
0091 // }
0092 
0093 const reco::GenParticle* StEvtSolution::getGenLepton() const {
0094   if (!theGenEvt_)
0095     return nullptr;
0096   else
0097     return theGenEvt_->singleLepton();
0098 }
0099 
0100 const reco::GenParticle* StEvtSolution::getGenNeutrino() const {
0101   if (!theGenEvt_)
0102     return nullptr;
0103   else
0104     return theGenEvt_->singleNeutrino();
0105 }
0106 
0107 const reco::GenParticle* StEvtSolution::getGenLepW() const {
0108   if (!theGenEvt_)
0109     return nullptr;
0110   else
0111     return theGenEvt_->singleW();
0112 }
0113 
0114 const reco::GenParticle* StEvtSolution::getGenLept() const {
0115   if (!theGenEvt_)
0116     return nullptr;
0117   else
0118     return theGenEvt_->singleTop();
0119 }
0120 
0121 //-------------------------------------------
0122 // get uncalibrated reco objects
0123 //-------------------------------------------
0124 reco::Particle StEvtSolution::getRecLept() const {
0125   // FIXME: the charge from the genevent
0126   reco::Particle p;
0127   if (this->getDecay() == "muon")
0128     p = reco::Particle(
0129         0, this->getMuon().p4() + this->getNeutrino().p4() + this->getRecBottom().p4(), math::XYZPoint());
0130   if (this->getDecay() == "electron")
0131     p = reco::Particle(
0132         0, this->getElectron().p4() + this->getNeutrino().p4() + this->getRecBottom().p4(), math::XYZPoint());
0133   return p;
0134 }
0135 
0136 //-------------------------------------------
0137 // get objects from kinematic fit
0138 //-------------------------------------------
0139 reco::Particle StEvtSolution::getFitLepW() const {
0140   // FIXME: provide the correct charge from generated event
0141   return reco::Particle(0, this->getFitLepton().p4() + this->getFitNeutrino().p4());
0142 }
0143 
0144 reco::Particle StEvtSolution::getFitLept() const {
0145   // FIXME: provide the correct charge from generated event
0146   return reco::Particle(0, this->getFitLepton().p4() + this->getFitNeutrino().p4() + this->getFitBottom().p4());
0147 }
0148 
0149 //-------------------------------------------
0150 // set the generated event
0151 //-------------------------------------------
0152 void StEvtSolution::setGenEvt(const edm::Handle<StGenEvent>& aGenEvt) {
0153   theGenEvt_ = edm::RefProd<StGenEvent>(aGenEvt);
0154 }
0155 
0156 //-------------------------------------------
0157 // set other info on the event
0158 //-------------------------------------------
0159 void StEvtSolution::setScanValues(const std::vector<double>& val) {
0160   for (unsigned int i = 0; i < val.size(); i++)
0161     scanValues_.push_back(val[i]);
0162 }