CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/AnalysisDataFormats/TopObjects/src/TtHadEvtSolution.cc

Go to the documentation of this file.
00001 //
00002 // $Id: TtHadEvtSolution.cc,v 1.8 2008/11/14 19:20:51 rwolf Exp $
00003 // adapted TtSemiEvtSolution.cc,v 1.13 2007/07/05 23:43:08 lowette Exp 
00004 // for fully hadronic channel
00005 
00006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00007 #include "AnalysisDataFormats/TopObjects/interface/TtHadEvtSolution.h"
00008 
00009 TtHadEvtSolution::TtHadEvtSolution() 
00010 {
00011   jetCorrScheme_     = 0;
00012   sumAnglejp_        = -999.;
00013   angleHadp_         = -999.;
00014   angleHadq_         = -999.;
00015   angleHadb_         = -999.;
00016   angleHadj_         = -999.;
00017   angleHadk_         = -999.;
00018   angleHadbbar_      = -999.;
00019   changeW1Q_         = -999;
00020   changeW2Q_         = -999;
00021   probChi2_          = -999.;
00022   mcBestJetComb_     = -999;
00023   simpleBestJetComb_ = -999;
00024   lrBestJetComb_     = -999;
00025   lrJetCombLRval_    = -999.;
00026   lrJetCombProb_     = -999.;
00027   lrSignalEvtLRval_  = -999.;
00028   lrSignalEvtProb_   = -999.;
00029 }
00030 
00031 TtHadEvtSolution::~TtHadEvtSolution() 
00032 {
00033 }
00034 
00035 //-------------------------------------------
00036 // get calibrated base objects 
00037 //-------------------------------------------
00038 pat::Jet TtHadEvtSolution::getHadb() const 
00039 {
00040   // WARNING this is obsolete and only 
00041   // kept for backwards compatibility
00042   if(jetCorrScheme_==1){
00043     //jet calibrated according to MC truth
00044     return hadb_->correctedJet("HAD", "B");
00045   }
00046   else if(jetCorrScheme_==2){
00047     return hadb_->correctedJet("HAD", "B");
00048   }
00049   else{
00050     return *hadb_;
00051   }
00052 }
00053 
00054 pat::Jet TtHadEvtSolution::getHadp() const 
00055 {
00056   // WARNING this is obsolete and only 
00057   // kept for backwards compatibility
00058   if(jetCorrScheme_==1){
00059     //jet calibrated according to MC truth
00060     return hadp_->correctedJet("HAD", "UDS");
00061   }
00062   else if(jetCorrScheme_==2){
00063     return hadp_->correctedJet("HAD", "UDS");
00064   }
00065   else{
00066     return *hadp_;
00067   }
00068 }
00069 
00070 pat::Jet TtHadEvtSolution::getHadq() const 
00071 {
00072   // WARNING this is obsolete and only 
00073   // kept for backwards compatibility
00074   if(jetCorrScheme_==1){
00075     //jet calibrated according to MC truth
00076     return hadq_->correctedJet("HAD", "UDS");
00077   }
00078   else if(jetCorrScheme_==2){
00079     return hadq_->correctedJet("HAD", "UDS");
00080   }
00081   else{
00082     return *hadq_;
00083   }
00084 }
00085 
00086 pat::Jet TtHadEvtSolution::getHadbbar() const 
00087 {
00088   // WARNING this is obsolete and only 
00089   // kept for backwards compatibility
00090   if(jetCorrScheme_==1){
00091     //jet calibrated according to MC truth
00092     return hadbbar_->correctedJet("HAD", "B");
00093   }
00094   else if(jetCorrScheme_==2){
00095     return hadbbar_->correctedJet("HAD", "B");
00096   }
00097   else{
00098     return *hadbbar_;
00099   }
00100 }
00101 
00102 pat::Jet TtHadEvtSolution::getHadj() const 
00103 {
00104   // WARNING this is obsolete and only 
00105   // kept for backwards compatibility
00106   if(jetCorrScheme_==1){
00107     //jet calibrated according to MC truth
00108     return hadj_->correctedJet("HAD", "UDS");
00109   }
00110   else if(jetCorrScheme_==2){
00111     return hadj_->correctedJet("HAD", "UDS");
00112   }
00113   else{
00114     return *hadj_;
00115   }
00116 }
00117 
00118 pat::Jet TtHadEvtSolution::getHadk() const 
00119 {
00120   // WARNING this is obsolete and only 
00121   // kept for backwards compatibility
00122   if(jetCorrScheme_==1){
00123     //jet calibrated according to MC truth
00124     return hadk_->correctedJet("HAD", "UDS");
00125   }
00126   else if(jetCorrScheme_==2){
00127     return hadk_->correctedJet("HAD", "UDS");
00128   }
00129   else{
00130     return *hadk_;
00131   }
00132 }
00133 
00134 //-------------------------------------------
00135 // get (un-)/calibrated reco objects
00136 //-------------------------------------------
00137 // By definition pq and b are the top quark, 
00138 // jk and bbar the anti-top - check if it 
00139 // makes sense ....
00140 reco::Particle TtHadEvtSolution::getRecHadt() const 
00141 {
00142   // FIXME: the charge from the genevent
00143   return reco::Particle(0,this->getRecHadp().p4()+this->getRecHadq().p4()+this->getRecHadb().p4());
00144 }
00145 
00146 reco::Particle TtHadEvtSolution::getRecHadtbar() const 
00147 {
00148   // FIXME: the charge from the genevent
00149   return reco::Particle(0,this->getRecHadj().p4()+this->getRecHadk().p4()+this->getRecHadbbar().p4());
00150 }
00151 
00152 reco::Particle TtHadEvtSolution::getRecHadW_plus() const 
00153 {
00154   // FIXME: the charge from the genevent
00155   return reco::Particle(0,this->getRecHadp().p4()+this->getRecHadq().p4());
00156 }
00157 
00158 reco::Particle TtHadEvtSolution::getRecHadW_minus() const 
00159 {
00160   // FIXME: the charge from the genevent
00161   return reco::Particle(0,this->getRecHadj().p4()+this->getRecHadk().p4());
00162 }
00163 
00164 reco::Particle TtHadEvtSolution::getCalHadt() const 
00165 { 
00166   return reco::Particle(0,this->getCalHadp().p4()+this->getCalHadq().p4()+this->getCalHadb().p4()); 
00167 }
00168 
00169 reco::Particle TtHadEvtSolution::getCalHadtbar() const 
00170 { 
00171   return reco::Particle(0,this->getCalHadj().p4()+this->getCalHadk().p4()+this->getCalHadbbar().p4()); 
00172 }
00173 
00174 reco::Particle TtHadEvtSolution::getCalHadW_plus() const 
00175 { 
00176   return reco::Particle(0,this->getCalHadp().p4()+this->getCalHadq().p4()); 
00177 }
00178 
00179 reco::Particle TtHadEvtSolution::getCalHadW_minus() const 
00180 { 
00181   return reco::Particle(0,this->getCalHadj().p4()+this->getCalHadk().p4()); 
00182 }
00183 
00184 //-------------------------------------------
00185 // get objects from kinematic fit
00186 //-------------------------------------------  
00187 reco::Particle TtHadEvtSolution::getFitHadt() const 
00188 {
00189   // FIXME: provide the correct charge from generated event
00190   return reco::Particle(0, this->getFitHadp().p4()+this->getFitHadq().p4()+this->getFitHadb().p4());
00191 }
00192 
00193 reco::Particle TtHadEvtSolution::getFitHadtbar() const 
00194 {
00195   // FIXME: provide the correct charge from generated event
00196   return reco::Particle(0, this->getFitHadj().p4()+this->getFitHadk().p4()+this->getFitHadbbar().p4());
00197 }
00198 
00199 reco::Particle TtHadEvtSolution::getFitHadW_plus() const 
00200 {
00201   // FIXME: provide the correct charge from generated event
00202   return reco::Particle(0, this->getFitHadp().p4()+this->getFitHadq().p4());
00203 }
00204 
00205 reco::Particle TtHadEvtSolution::getFitHadW_minus() const 
00206 {
00207   // FIXME: provide the correct charge from generated event
00208   return reco::Particle(0, this->getFitHadj().p4()+this->getFitHadk().p4());
00209 }
00210 
00211 //-------------------------------------------  
00212 // get info on the outcome of the signal 
00213 // selection LR
00214 //-------------------------------------------  
00215 double TtHadEvtSolution::getLRSignalEvtObsVal(unsigned int selObs) const 
00216 {
00217   double val = -999.;
00218   for(size_t o=0; o<lrSignalEvtVarVal_.size(); o++){
00219     if(lrSignalEvtVarVal_[o].first == selObs) val = lrSignalEvtVarVal_[o].second;
00220   }
00221   return val;
00222 }
00223 
00224 //-------------------------------------------  
00225 // get info on the outcome of the signal 
00226 // selection LR
00227 //-------------------------------------------  
00228 double TtHadEvtSolution::getLRJetCombObsVal(unsigned int selObs) const 
00229 {
00230   double val = -999.;
00231   for(size_t o=0; o<lrJetCombVarVal_.size(); o++){
00232     if(lrJetCombVarVal_[o].first == selObs) val = lrJetCombVarVal_[o].second;
00233   }
00234   return val;
00235 }
00236 
00237 //-------------------------------------------  
00238 // set the generated event
00239 //-------------------------------------------  
00240 void TtHadEvtSolution::setGenEvt(const edm::Handle<TtGenEvent> & aGenEvt)
00241 {
00242   if( !aGenEvt->isFullHadronic() ){ 
00243     edm::LogWarning( "TtGenEventNotFilled" ) << "genEvt is not fully hadronic; TtGenEvent is not filled";
00244     return;
00245   }
00246   theGenEvt_ = edm::RefProd<TtGenEvent>(aGenEvt);
00247 }
00248 
00249 //-------------------------------------------
00250 // methods to set the outcome of the different 
00251 // jet combination methods
00252 //-------------------------------------------
00253 void TtHadEvtSolution::setLRJetCombObservables(std::vector<std::pair<unsigned int, double> > varval) 
00254 {
00255   lrJetCombVarVal_.clear();
00256   for(size_t ijc = 0; ijc<varval.size(); ijc++) lrJetCombVarVal_.push_back(varval[ijc]);
00257 }
00258 
00259 //-------------------------------------------
00260 // methods to set the outcome of the signal 
00261 // selection LR
00262 //-------------------------------------------
00263 void TtHadEvtSolution::setLRSignalEvtObservables(std::vector<std::pair<unsigned int, double> > varval) 
00264 {
00265   lrSignalEvtVarVal_.clear();
00266   for(size_t ise = 0; ise<varval.size(); ise++) lrSignalEvtVarVal_.push_back(varval[ise]);
00267 }