00001
00002
00003
00004
00005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00006 #include "AnalysisDataFormats/TopObjects/interface/TtSemiEvtSolution.h"
00007 #include "DataFormats/Candidate/interface/ShallowClonePtrCandidate.h"
00008 #include "CommonTools/CandUtils/interface/AddFourMomenta.h"
00009
00010 TtSemiEvtSolution::TtSemiEvtSolution() :
00011 mcHyp_ ("ttSemiEvtMCHyp"),
00012 recoHyp_("ttSemiEvtRecoHyp"),
00013 fitHyp_ ("ttSemiEvtFitHyp")
00014 {
00015 jetCorrScheme_ = 0;
00016 sumAnglejp_ = -999.;
00017 angleHadp_ = -999.;
00018 angleHadq_ = -999.;
00019 angleHadb_ = -999.;
00020 angleLepb_ = -999.;
00021 changeWQ_ = -999;
00022 probChi2_ = -999.;
00023 mcBestJetComb_ = -999;
00024 simpleBestJetComb_ = -999;
00025 lrBestJetComb_ = -999;
00026 lrJetCombLRval_ = -999.;
00027 lrJetCombProb_ = -999.;
00028 lrSignalEvtLRval_ = -999.;
00029 lrSignalEvtProb_ = -999.;
00030 }
00031
00032 TtSemiEvtSolution::~TtSemiEvtSolution()
00033 {
00034 }
00035
00036
00037
00038
00039 pat::Jet TtSemiEvtSolution::getHadb() const
00040 {
00041
00042
00043 if (jetCorrScheme_ == 1) return hadb_->correctedJet("HAD", "B");
00044 else if (jetCorrScheme_ == 2) return hadb_->correctedJet("HAD", "B");
00045 else return *hadb_;
00046 }
00047
00048 pat::Jet TtSemiEvtSolution::getHadp() const
00049 {
00050
00051
00052 if (jetCorrScheme_ == 1) return hadp_->correctedJet("HAD", "UDS");
00053 else if (jetCorrScheme_ == 2) return hadp_->correctedJet("HAD", "UDS");
00054 else return *hadp_;
00055 }
00056
00057 pat::Jet TtSemiEvtSolution::getHadq() const
00058 {
00059
00060
00061 if (jetCorrScheme_ == 1) return hadq_->correctedJet("HAD", "UDS");
00062 else if (jetCorrScheme_ == 2) return hadq_->correctedJet("HAD", "UDS");
00063 else return *hadq_;
00064 }
00065
00066 pat::Jet TtSemiEvtSolution::getLepb() const
00067 {
00068
00069
00070 if (jetCorrScheme_ == 1) return lepb_->correctedJet("HAD", "B");
00071 else if (jetCorrScheme_ == 2) return lepb_->correctedJet("HAD", "B");
00072 else return *lepb_;
00073 }
00074
00075
00076
00077
00078 reco::Particle TtSemiEvtSolution::getRecHadt() const
00079 {
00080
00081 return reco::Particle(0,this->getRecHadp().p4() + this->getRecHadq().p4() + this->getRecHadb().p4());
00082 }
00083
00084 reco::Particle TtSemiEvtSolution::getRecHadW() const
00085 {
00086
00087 return reco::Particle(0,this->getRecHadp().p4() + this->getRecHadq().p4());
00088 }
00089
00090 reco::Particle TtSemiEvtSolution::getRecLept() const
00091 {
00092
00093 reco::Particle p;
00094 if (this->getDecay() == "muon") p = reco::Particle(0,this->getRecLepm().p4() + this->getRecLepn().p4() + this->getRecLepb().p4());
00095 if (this->getDecay() == "electron") p = reco::Particle(0,this->getRecLepe().p4() + this->getRecLepn().p4() + this->getRecLepb().p4());
00096 return p;
00097 }
00098
00099 reco::Particle TtSemiEvtSolution::getRecLepW() const
00100 {
00101
00102 reco::Particle p;
00103 if (this->getDecay() == "muon") p = reco::Particle(0,this->getRecLepm().p4() + this->getRecLepn().p4());
00104 if (this->getDecay() == "electron") p = reco::Particle(0,this->getRecLepe().p4() + this->getRecLepn().p4());
00105 return p;
00106 }
00107
00108
00109
00110 reco::Particle TtSemiEvtSolution::getCalHadt() const
00111 {
00112 return reco::Particle(0,this->getCalHadp().p4() + this->getCalHadq().p4() + this->getCalHadb().p4());
00113 }
00114
00115 reco::Particle TtSemiEvtSolution::getCalHadW() const
00116 {
00117 return reco::Particle(0,this->getCalHadp().p4() + this->getCalHadq().p4());
00118 }
00119
00120 reco::Particle TtSemiEvtSolution::getCalLept() const
00121 {
00122 reco::Particle p;
00123 if (this->getDecay() == "muon") p = reco::Particle(0,this->getRecLepm().p4() + this->getRecLepn().p4() + this->getCalLepb().p4());
00124 if (this->getDecay() == "electron") p = reco::Particle(0,this->getRecLepe().p4() + this->getRecLepn().p4() + this->getCalLepb().p4());
00125 return p;
00126 }
00127
00128 reco::Particle TtSemiEvtSolution::getCalLepW() const
00129 {
00130 reco::Particle p;
00131 if (this->getDecay() == "muon") p = reco::Particle(0,this->getRecLepm().p4() + this->getRecLepn().p4());
00132 if (this->getDecay() == "electron") p = reco::Particle(0,this->getRecLepe().p4() + this->getRecLepn().p4());
00133 return p;
00134 }
00135
00136
00137
00138
00139 reco::Particle TtSemiEvtSolution::getFitHadt() const
00140 {
00141
00142 return reco::Particle(0, this->getFitHadp().p4() + this->getFitHadq().p4() + this->getFitHadb().p4());
00143 }
00144
00145 reco::Particle TtSemiEvtSolution::getFitHadW() const
00146 {
00147
00148 return reco::Particle(0, this->getFitHadp().p4() + this->getFitHadq().p4());
00149 }
00150
00151 reco::Particle TtSemiEvtSolution::getFitLept() const
00152 {
00153
00154 return reco::Particle(0, this->getFitLepl().p4() + this->getFitLepn().p4() + this->getFitLepb().p4());
00155 }
00156
00157 reco::Particle TtSemiEvtSolution::getFitLepW() const
00158 {
00159
00160 return reco::Particle(0, this->getFitLepl().p4() + this->getFitLepn().p4());
00161 }
00162
00163
00164
00165
00166
00167 double TtSemiEvtSolution::getLRSignalEvtObsVal(unsigned int selObs) const {
00168 double val = -999.;
00169 for(size_t o=0; o<lrSignalEvtVarVal_.size(); o++){
00170 if(lrSignalEvtVarVal_[o].first == selObs) val = lrSignalEvtVarVal_[o].second;
00171 }
00172 return val;
00173 }
00174
00175
00176
00177
00178
00179 double TtSemiEvtSolution::getLRJetCombObsVal(unsigned int selObs) const
00180 {
00181 double val = -999.;
00182 for(size_t o=0; o<lrJetCombVarVal_.size(); o++){
00183 if(lrJetCombVarVal_[o].first == selObs) val = lrJetCombVarVal_[o].second;
00184 }
00185 return val;
00186 }
00187
00188
00189
00190
00191 void TtSemiEvtSolution::setGenEvt(const edm::Handle<TtGenEvent> & aGenEvt)
00192 {
00193 if( !aGenEvt->isSemiLeptonic() ){
00194 edm::LogWarning( "TtGenEventNotFilled" ) << "genEvt is not semi-leptonic; TtGenEvent is not filled";
00195 return;
00196 }
00197 theGenEvt_ = edm::RefProd<TtGenEvent>(aGenEvt);
00198 }
00199
00200
00201
00202
00203
00204 void TtSemiEvtSolution::setLRJetCombObservables(std::vector<std::pair<unsigned int, double> > varval)
00205 {
00206 lrJetCombVarVal_.clear();
00207 for(size_t ijc = 0; ijc<varval.size(); ijc++) lrJetCombVarVal_.push_back(varval[ijc]);
00208 }
00209
00210
00211
00212
00213 void TtSemiEvtSolution::setLRSignalEvtObservables(std::vector<std::pair<unsigned int, double> > varval)
00214 {
00215 lrSignalEvtVarVal_.clear();
00216 for(size_t ise = 0; ise<varval.size(); ise++) lrSignalEvtVarVal_.push_back(varval[ise]);
00217 }
00218
00219
00220 void TtSemiEvtSolution::setupHyp()
00221 {
00222
00223 AddFourMomenta addFourMomenta;
00224
00225 recoHyp_.clearDaughters();
00226 recoHyp_.clearRoles();
00227
00228
00229 reco::CompositeCandidate recHadt;
00230 reco::CompositeCandidate recLept;
00231 reco::CompositeCandidate recHadW;
00232 reco::CompositeCandidate recLepW;
00233
00234
00235 reco::ShallowClonePtrCandidate hadp( hadp_, hadp_->charge(), hadp_->p4(), hadp_->vertex() );
00236 reco::ShallowClonePtrCandidate hadq( hadq_, hadq_->charge(), hadq_->p4(), hadq_->vertex() );
00237 reco::ShallowClonePtrCandidate hadb( hadb_, hadb_->charge(), hadb_->p4(), hadb_->vertex() );
00238 reco::ShallowClonePtrCandidate lepb( lepb_, lepb_->charge(), lepb_->p4(), lepb_->vertex() );
00239
00240 reco::ShallowClonePtrCandidate neutrino( neutrino_, neutrino_->charge(), neutrino_->p4(), neutrino_->vertex() );
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252 recHadW.addDaughter( hadp, "hadp" );
00253 recHadW.addDaughter( hadq, "hadq" );
00254
00255 addFourMomenta.set( recHadW );
00256
00257 recHadt.addDaughter( hadb, "hadb" );
00258 recHadt.addDaughter( recHadW, "hadW" );
00259
00260 addFourMomenta.set( recHadt );
00261
00262 recLepW.addDaughter( neutrino,"neutrino" );
00263 if ( getDecay() == "electron" ) {
00264 reco::ShallowClonePtrCandidate electron ( electron_, electron_->charge(), electron_->p4(), electron_->vertex() );
00265
00266 recLepW.addDaughter ( electron, "electron" );
00267 } else if ( getDecay() == "muon" ) {
00268 reco::ShallowClonePtrCandidate muon ( muon_, muon_->charge(), muon_->p4(), muon_->vertex() );
00269
00270 recLepW.addDaughter ( muon, "muon" );
00271 }
00272
00273 addFourMomenta.set( recLepW );
00274
00275 recLept.addDaughter( lepb, "lepb" );
00276 recLept.addDaughter( recLepW, "lepW" );
00277
00278 addFourMomenta.set( recLept );
00279
00280 recoHyp_.addDaughter( recHadt, "hadt" );
00281 recoHyp_.addDaughter( recLept, "lept" );
00282
00283 addFourMomenta.set( recoHyp_ );
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327 }