File indexing completed on 2024-04-06 11:57:32
0001
0002
0003
0004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0005 #include "AnalysisDataFormats/TopObjects/interface/TtSemiEvtSolution.h"
0006 #include "DataFormats/Candidate/interface/ShallowClonePtrCandidate.h"
0007 #include "CommonTools/CandUtils/interface/AddFourMomenta.h"
0008
0009 TtSemiEvtSolution::TtSemiEvtSolution()
0010 : mcHyp_("ttSemiEvtMCHyp"), recoHyp_("ttSemiEvtRecoHyp"), fitHyp_("ttSemiEvtFitHyp") {
0011 jetCorrScheme_ = 0;
0012 sumAnglejp_ = -999.;
0013 angleHadp_ = -999.;
0014 angleHadq_ = -999.;
0015 angleHadb_ = -999.;
0016 angleLepb_ = -999.;
0017 changeWQ_ = -999;
0018 probChi2_ = -999.;
0019 mcBestJetComb_ = -999;
0020 simpleBestJetComb_ = -999;
0021 lrBestJetComb_ = -999;
0022 lrJetCombLRval_ = -999.;
0023 lrJetCombProb_ = -999.;
0024 lrSignalEvtLRval_ = -999.;
0025 lrSignalEvtProb_ = -999.;
0026 }
0027
0028 TtSemiEvtSolution::~TtSemiEvtSolution() {}
0029
0030
0031
0032
0033 pat::Jet TtSemiEvtSolution::getHadb() const {
0034
0035
0036 if (jetCorrScheme_ == 1)
0037 return hadb_->correctedJet("HAD", "B");
0038 else if (jetCorrScheme_ == 2)
0039 return hadb_->correctedJet("HAD", "B");
0040 else
0041 return *hadb_;
0042 }
0043
0044 pat::Jet TtSemiEvtSolution::getHadp() const {
0045
0046
0047 if (jetCorrScheme_ == 1)
0048 return hadp_->correctedJet("HAD", "UDS");
0049 else if (jetCorrScheme_ == 2)
0050 return hadp_->correctedJet("HAD", "UDS");
0051 else
0052 return *hadp_;
0053 }
0054
0055 pat::Jet TtSemiEvtSolution::getHadq() const {
0056
0057
0058 if (jetCorrScheme_ == 1)
0059 return hadq_->correctedJet("HAD", "UDS");
0060 else if (jetCorrScheme_ == 2)
0061 return hadq_->correctedJet("HAD", "UDS");
0062 else
0063 return *hadq_;
0064 }
0065
0066 pat::Jet TtSemiEvtSolution::getLepb() const {
0067
0068
0069 if (jetCorrScheme_ == 1)
0070 return lepb_->correctedJet("HAD", "B");
0071 else if (jetCorrScheme_ == 2)
0072 return lepb_->correctedJet("HAD", "B");
0073 else
0074 return *lepb_;
0075 }
0076
0077
0078
0079
0080 reco::Particle TtSemiEvtSolution::getRecHadt() const {
0081
0082 return reco::Particle(0, this->getRecHadp().p4() + this->getRecHadq().p4() + this->getRecHadb().p4());
0083 }
0084
0085 reco::Particle TtSemiEvtSolution::getRecHadW() const {
0086
0087 return reco::Particle(0, this->getRecHadp().p4() + this->getRecHadq().p4());
0088 }
0089
0090 reco::Particle TtSemiEvtSolution::getRecLept() const {
0091
0092 reco::Particle p;
0093 if (this->getDecay() == "muon")
0094 p = reco::Particle(0, this->getRecLepm().p4() + this->getRecLepn().p4() + this->getRecLepb().p4());
0095 if (this->getDecay() == "electron")
0096 p = reco::Particle(0, this->getRecLepe().p4() + this->getRecLepn().p4() + this->getRecLepb().p4());
0097 return p;
0098 }
0099
0100 reco::Particle TtSemiEvtSolution::getRecLepW() const {
0101
0102 reco::Particle p;
0103 if (this->getDecay() == "muon")
0104 p = reco::Particle(0, this->getRecLepm().p4() + this->getRecLepn().p4());
0105 if (this->getDecay() == "electron")
0106 p = reco::Particle(0, this->getRecLepe().p4() + this->getRecLepn().p4());
0107 return p;
0108 }
0109
0110
0111
0112 reco::Particle TtSemiEvtSolution::getCalHadt() const {
0113 return reco::Particle(0, this->getCalHadp().p4() + this->getCalHadq().p4() + this->getCalHadb().p4());
0114 }
0115
0116 reco::Particle TtSemiEvtSolution::getCalHadW() const {
0117 return reco::Particle(0, this->getCalHadp().p4() + this->getCalHadq().p4());
0118 }
0119
0120 reco::Particle TtSemiEvtSolution::getCalLept() const {
0121 reco::Particle p;
0122 if (this->getDecay() == "muon")
0123 p = reco::Particle(0, this->getRecLepm().p4() + this->getRecLepn().p4() + this->getCalLepb().p4());
0124 if (this->getDecay() == "electron")
0125 p = reco::Particle(0, this->getRecLepe().p4() + this->getRecLepn().p4() + this->getCalLepb().p4());
0126 return p;
0127 }
0128
0129 reco::Particle TtSemiEvtSolution::getCalLepW() const {
0130 reco::Particle p;
0131 if (this->getDecay() == "muon")
0132 p = reco::Particle(0, this->getRecLepm().p4() + this->getRecLepn().p4());
0133 if (this->getDecay() == "electron")
0134 p = reco::Particle(0, this->getRecLepe().p4() + this->getRecLepn().p4());
0135 return p;
0136 }
0137
0138
0139
0140
0141 reco::Particle TtSemiEvtSolution::getFitHadt() const {
0142
0143 return reco::Particle(0, this->getFitHadp().p4() + this->getFitHadq().p4() + this->getFitHadb().p4());
0144 }
0145
0146 reco::Particle TtSemiEvtSolution::getFitHadW() const {
0147
0148 return reco::Particle(0, this->getFitHadp().p4() + this->getFitHadq().p4());
0149 }
0150
0151 reco::Particle TtSemiEvtSolution::getFitLept() const {
0152
0153 return reco::Particle(0, this->getFitLepl().p4() + this->getFitLepn().p4() + this->getFitLepb().p4());
0154 }
0155
0156 reco::Particle TtSemiEvtSolution::getFitLepW() const {
0157
0158 return reco::Particle(0, this->getFitLepl().p4() + this->getFitLepn().p4());
0159 }
0160
0161
0162
0163
0164
0165 double TtSemiEvtSolution::getLRSignalEvtObsVal(unsigned int selObs) const {
0166 double val = -999.;
0167 for (size_t o = 0; o < lrSignalEvtVarVal_.size(); o++) {
0168 if (lrSignalEvtVarVal_[o].first == selObs)
0169 val = lrSignalEvtVarVal_[o].second;
0170 }
0171 return val;
0172 }
0173
0174
0175
0176
0177
0178 double TtSemiEvtSolution::getLRJetCombObsVal(unsigned int selObs) const {
0179 double val = -999.;
0180 for (size_t o = 0; o < lrJetCombVarVal_.size(); o++) {
0181 if (lrJetCombVarVal_[o].first == selObs)
0182 val = lrJetCombVarVal_[o].second;
0183 }
0184 return val;
0185 }
0186
0187
0188
0189
0190 void TtSemiEvtSolution::setGenEvt(const edm::Handle<TtGenEvent>& aGenEvt) {
0191 if (!aGenEvt->isSemiLeptonic()) {
0192 edm::LogWarning("TtGenEventNotFilled") << "genEvt is not semi-leptonic; TtGenEvent is not filled";
0193 return;
0194 }
0195 theGenEvt_ = edm::RefProd<TtGenEvent>(aGenEvt);
0196 }
0197
0198
0199
0200
0201
0202 void TtSemiEvtSolution::setLRJetCombObservables(const std::vector<std::pair<unsigned int, double> >& varval) {
0203 lrJetCombVarVal_.clear();
0204 for (size_t ijc = 0; ijc < varval.size(); ijc++)
0205 lrJetCombVarVal_.push_back(varval[ijc]);
0206 }
0207
0208
0209
0210
0211 void TtSemiEvtSolution::setLRSignalEvtObservables(const std::vector<std::pair<unsigned int, double> >& varval) {
0212 lrSignalEvtVarVal_.clear();
0213 for (size_t ise = 0; ise < varval.size(); ise++)
0214 lrSignalEvtVarVal_.push_back(varval[ise]);
0215 }
0216
0217 void TtSemiEvtSolution::setupHyp() {
0218 AddFourMomenta addFourMomenta;
0219
0220 recoHyp_.clearDaughters();
0221 recoHyp_.clearRoles();
0222
0223
0224 reco::CompositeCandidate recHadt;
0225 reco::CompositeCandidate recLept;
0226 reco::CompositeCandidate recHadW;
0227 reco::CompositeCandidate recLepW;
0228
0229
0230 reco::ShallowClonePtrCandidate hadp(hadp_, hadp_->charge(), hadp_->p4(), hadp_->vertex());
0231 reco::ShallowClonePtrCandidate hadq(hadq_, hadq_->charge(), hadq_->p4(), hadq_->vertex());
0232 reco::ShallowClonePtrCandidate hadb(hadb_, hadb_->charge(), hadb_->p4(), hadb_->vertex());
0233 reco::ShallowClonePtrCandidate lepb(lepb_, lepb_->charge(), lepb_->p4(), lepb_->vertex());
0234
0235 reco::ShallowClonePtrCandidate neutrino(neutrino_, neutrino_->charge(), neutrino_->p4(), neutrino_->vertex());
0236
0237
0238
0239
0240
0241
0242
0243
0244 recHadW.addDaughter(hadp, "hadp");
0245 recHadW.addDaughter(hadq, "hadq");
0246
0247 addFourMomenta.set(recHadW);
0248
0249 recHadt.addDaughter(hadb, "hadb");
0250 recHadt.addDaughter(recHadW, "hadW");
0251
0252 addFourMomenta.set(recHadt);
0253
0254 recLepW.addDaughter(neutrino, "neutrino");
0255 if (getDecay() == "electron") {
0256 reco::ShallowClonePtrCandidate electron(electron_, electron_->charge(), electron_->p4(), electron_->vertex());
0257
0258 recLepW.addDaughter(electron, "electron");
0259 } else if (getDecay() == "muon") {
0260 reco::ShallowClonePtrCandidate muon(muon_, muon_->charge(), muon_->p4(), muon_->vertex());
0261
0262 recLepW.addDaughter(muon, "muon");
0263 }
0264
0265 addFourMomenta.set(recLepW);
0266
0267 recLept.addDaughter(lepb, "lepb");
0268 recLept.addDaughter(recLepW, "lepW");
0269
0270 addFourMomenta.set(recLept);
0271
0272 recoHyp_.addDaughter(recHadt, "hadt");
0273 recoHyp_.addDaughter(recLept, "lept");
0274
0275 addFourMomenta.set(recoHyp_);
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312
0313
0314 }