Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:40:54

0001 //
0002 // adapted TtSemiEvtSolution.cc,v 1.13 2007/07/05 23:43:08 lowette Exp
0003 // for fully hadronic channel
0004 
0005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0006 #include "AnalysisDataFormats/TopObjects/interface/TtHadEvtSolution.h"
0007 
0008 TtHadEvtSolution::TtHadEvtSolution() {
0009   jetCorrScheme_ = 0;
0010   sumAnglejp_ = -999.;
0011   angleHadp_ = -999.;
0012   angleHadq_ = -999.;
0013   angleHadb_ = -999.;
0014   angleHadj_ = -999.;
0015   angleHadk_ = -999.;
0016   angleHadbbar_ = -999.;
0017   changeW1Q_ = -999;
0018   changeW2Q_ = -999;
0019   probChi2_ = -999.;
0020   mcBestJetComb_ = -999;
0021   simpleBestJetComb_ = -999;
0022   lrBestJetComb_ = -999;
0023   lrJetCombLRval_ = -999.;
0024   lrJetCombProb_ = -999.;
0025   lrSignalEvtLRval_ = -999.;
0026   lrSignalEvtProb_ = -999.;
0027 }
0028 
0029 TtHadEvtSolution::~TtHadEvtSolution() {}
0030 
0031 //-------------------------------------------
0032 // get calibrated base objects
0033 //-------------------------------------------
0034 pat::Jet TtHadEvtSolution::getHadb() const {
0035   // WARNING this is obsolete and only
0036   // kept for backwards compatibility
0037   if (jetCorrScheme_ == 1) {
0038     //jet calibrated according to MC truth
0039     return hadb_->correctedJet("HAD", "B");
0040   } else if (jetCorrScheme_ == 2) {
0041     return hadb_->correctedJet("HAD", "B");
0042   } else {
0043     return *hadb_;
0044   }
0045 }
0046 
0047 pat::Jet TtHadEvtSolution::getHadp() const {
0048   // WARNING this is obsolete and only
0049   // kept for backwards compatibility
0050   if (jetCorrScheme_ == 1) {
0051     //jet calibrated according to MC truth
0052     return hadp_->correctedJet("HAD", "UDS");
0053   } else if (jetCorrScheme_ == 2) {
0054     return hadp_->correctedJet("HAD", "UDS");
0055   } else {
0056     return *hadp_;
0057   }
0058 }
0059 
0060 pat::Jet TtHadEvtSolution::getHadq() const {
0061   // WARNING this is obsolete and only
0062   // kept for backwards compatibility
0063   if (jetCorrScheme_ == 1) {
0064     //jet calibrated according to MC truth
0065     return hadq_->correctedJet("HAD", "UDS");
0066   } else if (jetCorrScheme_ == 2) {
0067     return hadq_->correctedJet("HAD", "UDS");
0068   } else {
0069     return *hadq_;
0070   }
0071 }
0072 
0073 pat::Jet TtHadEvtSolution::getHadbbar() const {
0074   // WARNING this is obsolete and only
0075   // kept for backwards compatibility
0076   if (jetCorrScheme_ == 1) {
0077     //jet calibrated according to MC truth
0078     return hadbbar_->correctedJet("HAD", "B");
0079   } else if (jetCorrScheme_ == 2) {
0080     return hadbbar_->correctedJet("HAD", "B");
0081   } else {
0082     return *hadbbar_;
0083   }
0084 }
0085 
0086 pat::Jet TtHadEvtSolution::getHadj() const {
0087   // WARNING this is obsolete and only
0088   // kept for backwards compatibility
0089   if (jetCorrScheme_ == 1) {
0090     //jet calibrated according to MC truth
0091     return hadj_->correctedJet("HAD", "UDS");
0092   } else if (jetCorrScheme_ == 2) {
0093     return hadj_->correctedJet("HAD", "UDS");
0094   } else {
0095     return *hadj_;
0096   }
0097 }
0098 
0099 pat::Jet TtHadEvtSolution::getHadk() const {
0100   // WARNING this is obsolete and only
0101   // kept for backwards compatibility
0102   if (jetCorrScheme_ == 1) {
0103     //jet calibrated according to MC truth
0104     return hadk_->correctedJet("HAD", "UDS");
0105   } else if (jetCorrScheme_ == 2) {
0106     return hadk_->correctedJet("HAD", "UDS");
0107   } else {
0108     return *hadk_;
0109   }
0110 }
0111 
0112 //-------------------------------------------
0113 // get (un-)/calibrated reco objects
0114 //-------------------------------------------
0115 // By definition pq and b are the top quark,
0116 // jk and bbar the anti-top - check if it
0117 // makes sense ....
0118 reco::Particle TtHadEvtSolution::getRecHadt() const {
0119   // FIXME: the charge from the genevent
0120   return reco::Particle(0, this->getRecHadp().p4() + this->getRecHadq().p4() + this->getRecHadb().p4());
0121 }
0122 
0123 reco::Particle TtHadEvtSolution::getRecHadtbar() const {
0124   // FIXME: the charge from the genevent
0125   return reco::Particle(0, this->getRecHadj().p4() + this->getRecHadk().p4() + this->getRecHadbbar().p4());
0126 }
0127 
0128 reco::Particle TtHadEvtSolution::getRecHadW_plus() const {
0129   // FIXME: the charge from the genevent
0130   return reco::Particle(0, this->getRecHadp().p4() + this->getRecHadq().p4());
0131 }
0132 
0133 reco::Particle TtHadEvtSolution::getRecHadW_minus() const {
0134   // FIXME: the charge from the genevent
0135   return reco::Particle(0, this->getRecHadj().p4() + this->getRecHadk().p4());
0136 }
0137 
0138 reco::Particle TtHadEvtSolution::getCalHadt() const {
0139   return reco::Particle(0, this->getCalHadp().p4() + this->getCalHadq().p4() + this->getCalHadb().p4());
0140 }
0141 
0142 reco::Particle TtHadEvtSolution::getCalHadtbar() const {
0143   return reco::Particle(0, this->getCalHadj().p4() + this->getCalHadk().p4() + this->getCalHadbbar().p4());
0144 }
0145 
0146 reco::Particle TtHadEvtSolution::getCalHadW_plus() const {
0147   return reco::Particle(0, this->getCalHadp().p4() + this->getCalHadq().p4());
0148 }
0149 
0150 reco::Particle TtHadEvtSolution::getCalHadW_minus() const {
0151   return reco::Particle(0, this->getCalHadj().p4() + this->getCalHadk().p4());
0152 }
0153 
0154 //-------------------------------------------
0155 // get objects from kinematic fit
0156 //-------------------------------------------
0157 reco::Particle TtHadEvtSolution::getFitHadt() const {
0158   // FIXME: provide the correct charge from generated event
0159   return reco::Particle(0, this->getFitHadp().p4() + this->getFitHadq().p4() + this->getFitHadb().p4());
0160 }
0161 
0162 reco::Particle TtHadEvtSolution::getFitHadtbar() const {
0163   // FIXME: provide the correct charge from generated event
0164   return reco::Particle(0, this->getFitHadj().p4() + this->getFitHadk().p4() + this->getFitHadbbar().p4());
0165 }
0166 
0167 reco::Particle TtHadEvtSolution::getFitHadW_plus() const {
0168   // FIXME: provide the correct charge from generated event
0169   return reco::Particle(0, this->getFitHadp().p4() + this->getFitHadq().p4());
0170 }
0171 
0172 reco::Particle TtHadEvtSolution::getFitHadW_minus() const {
0173   // FIXME: provide the correct charge from generated event
0174   return reco::Particle(0, this->getFitHadj().p4() + this->getFitHadk().p4());
0175 }
0176 
0177 //-------------------------------------------
0178 // get info on the outcome of the signal
0179 // selection LR
0180 //-------------------------------------------
0181 double TtHadEvtSolution::getLRSignalEvtObsVal(unsigned int selObs) const {
0182   double val = -999.;
0183   for (size_t o = 0; o < lrSignalEvtVarVal_.size(); o++) {
0184     if (lrSignalEvtVarVal_[o].first == selObs)
0185       val = lrSignalEvtVarVal_[o].second;
0186   }
0187   return val;
0188 }
0189 
0190 //-------------------------------------------
0191 // get info on the outcome of the signal
0192 // selection LR
0193 //-------------------------------------------
0194 double TtHadEvtSolution::getLRJetCombObsVal(unsigned int selObs) const {
0195   double val = -999.;
0196   for (size_t o = 0; o < lrJetCombVarVal_.size(); o++) {
0197     if (lrJetCombVarVal_[o].first == selObs)
0198       val = lrJetCombVarVal_[o].second;
0199   }
0200   return val;
0201 }
0202 
0203 //-------------------------------------------
0204 // set the generated event
0205 //-------------------------------------------
0206 void TtHadEvtSolution::setGenEvt(const edm::Handle<TtGenEvent>& aGenEvt) {
0207   if (!aGenEvt->isFullHadronic()) {
0208     edm::LogWarning("TtGenEventNotFilled") << "genEvt is not fully hadronic; TtGenEvent is not filled";
0209     return;
0210   }
0211   theGenEvt_ = edm::RefProd<TtGenEvent>(aGenEvt);
0212 }
0213 
0214 //-------------------------------------------
0215 // methods to set the outcome of the different
0216 // jet combination methods
0217 //-------------------------------------------
0218 void TtHadEvtSolution::setLRJetCombObservables(const std::vector<std::pair<unsigned int, double> >& varval) {
0219   lrJetCombVarVal_.clear();
0220   for (size_t ijc = 0; ijc < varval.size(); ijc++)
0221     lrJetCombVarVal_.push_back(varval[ijc]);
0222 }
0223 
0224 //-------------------------------------------
0225 // methods to set the outcome of the signal
0226 // selection LR
0227 //-------------------------------------------
0228 void TtHadEvtSolution::setLRSignalEvtObservables(const std::vector<std::pair<unsigned int, double> >& varval) {
0229   lrSignalEvtVarVal_.clear();
0230   for (size_t ise = 0; ise < varval.size(); ise++)
0231     lrSignalEvtVarVal_.push_back(varval[ise]);
0232 }