CMS 3D CMS Logo

TtSemiEvtSolution.cc
Go to the documentation of this file.
1 //
2 //
3 
8 
10  : mcHyp_("ttSemiEvtMCHyp"), recoHyp_("ttSemiEvtRecoHyp"), fitHyp_("ttSemiEvtFitHyp") {
11  jetCorrScheme_ = 0;
12  sumAnglejp_ = -999.;
13  angleHadp_ = -999.;
14  angleHadq_ = -999.;
15  angleHadb_ = -999.;
16  angleLepb_ = -999.;
17  changeWQ_ = -999;
18  probChi2_ = -999.;
19  mcBestJetComb_ = -999;
20  simpleBestJetComb_ = -999;
21  lrBestJetComb_ = -999;
22  lrJetCombLRval_ = -999.;
23  lrJetCombProb_ = -999.;
24  lrSignalEvtLRval_ = -999.;
25  lrSignalEvtProb_ = -999.;
26 }
27 
29 
30 //-------------------------------------------
31 // get calibrated base objects
32 //-------------------------------------------
34  // WARNING this is obsolete and only
35  // kept for backwards compatibility
36  if (jetCorrScheme_ == 1)
37  return hadb_->correctedJet("HAD", "B"); // calibrate jets according to MC truth
38  else if (jetCorrScheme_ == 2)
39  return hadb_->correctedJet("HAD", "B");
40  else
41  return *hadb_;
42 }
43 
45  // WARNING this is obsolete and only
46  // kept for backwards compatibility
47  if (jetCorrScheme_ == 1)
48  return hadp_->correctedJet("HAD", "UDS"); // calibrate jets according to MC truth
49  else if (jetCorrScheme_ == 2)
50  return hadp_->correctedJet("HAD", "UDS");
51  else
52  return *hadp_;
53 }
54 
56  // WARNING this is obsolete and only
57  // kept for backwards compatibility
58  if (jetCorrScheme_ == 1)
59  return hadq_->correctedJet("HAD", "UDS"); // calibrate jets according to MC truth
60  else if (jetCorrScheme_ == 2)
61  return hadq_->correctedJet("HAD", "UDS");
62  else
63  return *hadq_;
64 }
65 
67  // WARNING this is obsolete and only
68  // kept for backwards compatibility
69  if (jetCorrScheme_ == 1)
70  return lepb_->correctedJet("HAD", "B"); // calibrate jets according to MC truth
71  else if (jetCorrScheme_ == 2)
72  return lepb_->correctedJet("HAD", "B");
73  else
74  return *lepb_;
75 }
76 
77 //-------------------------------------------
78 // get (un-)/calibrated reco objects
79 //-------------------------------------------
81  // FIXME: the charge from the genevent
82  return reco::Particle(0, this->getRecHadp().p4() + this->getRecHadq().p4() + this->getRecHadb().p4());
83 }
84 
86  // FIXME: the charge from the genevent
87  return reco::Particle(0, this->getRecHadp().p4() + this->getRecHadq().p4());
88 }
89 
91  // FIXME: the charge from the genevent
93  if (this->getDecay() == "muon")
94  p = reco::Particle(0, this->getRecLepm().p4() + this->getRecLepn().p4() + this->getRecLepb().p4());
95  if (this->getDecay() == "electron")
96  p = reco::Particle(0, this->getRecLepe().p4() + this->getRecLepn().p4() + this->getRecLepb().p4());
97  return p;
98 }
99 
101  // FIXME: the charge from the genevent
103  if (this->getDecay() == "muon")
104  p = reco::Particle(0, this->getRecLepm().p4() + this->getRecLepn().p4());
105  if (this->getDecay() == "electron")
106  p = reco::Particle(0, this->getRecLepe().p4() + this->getRecLepn().p4());
107  return p;
108 }
109 
110 // FIXME: Why these functions??? Not needed!
111 // methods to get calibrated objects
113  return reco::Particle(0, this->getCalHadp().p4() + this->getCalHadq().p4() + this->getCalHadb().p4());
114 }
115 
117  return reco::Particle(0, this->getCalHadp().p4() + this->getCalHadq().p4());
118 }
119 
122  if (this->getDecay() == "muon")
123  p = reco::Particle(0, this->getRecLepm().p4() + this->getRecLepn().p4() + this->getCalLepb().p4());
124  if (this->getDecay() == "electron")
125  p = reco::Particle(0, this->getRecLepe().p4() + this->getRecLepn().p4() + this->getCalLepb().p4());
126  return p;
127 }
128 
131  if (this->getDecay() == "muon")
132  p = reco::Particle(0, this->getRecLepm().p4() + this->getRecLepn().p4());
133  if (this->getDecay() == "electron")
134  p = reco::Particle(0, this->getRecLepe().p4() + this->getRecLepn().p4());
135  return p;
136 }
137 
138 //-------------------------------------------
139 // get objects from kinematic fit
140 //-------------------------------------------
142  // FIXME: provide the correct charge from generated event
143  return reco::Particle(0, this->getFitHadp().p4() + this->getFitHadq().p4() + this->getFitHadb().p4());
144 }
145 
147  // FIXME: provide the correct charge from generated event
148  return reco::Particle(0, this->getFitHadp().p4() + this->getFitHadq().p4());
149 }
150 
152  // FIXME: provide the correct charge from generated event
153  return reco::Particle(0, this->getFitLepl().p4() + this->getFitLepn().p4() + this->getFitLepb().p4());
154 }
155 
157  // FIXME: provide the correct charge from generated event
158  return reco::Particle(0, this->getFitLepl().p4() + this->getFitLepn().p4());
159 }
160 
161 //-------------------------------------------
162 // get info on the outcome of the signal
163 // selection LR
164 //-------------------------------------------
165 double TtSemiEvtSolution::getLRSignalEvtObsVal(unsigned int selObs) const {
166  double val = -999.;
167  for (size_t o = 0; o < lrSignalEvtVarVal_.size(); o++) {
168  if (lrSignalEvtVarVal_[o].first == selObs)
169  val = lrSignalEvtVarVal_[o].second;
170  }
171  return val;
172 }
173 
174 //-------------------------------------------
175 // get info on the outcome of the different
176 // jet combination methods
177 //-------------------------------------------
178 double TtSemiEvtSolution::getLRJetCombObsVal(unsigned int selObs) const {
179  double val = -999.;
180  for (size_t o = 0; o < lrJetCombVarVal_.size(); o++) {
181  if (lrJetCombVarVal_[o].first == selObs)
182  val = lrJetCombVarVal_[o].second;
183  }
184  return val;
185 }
186 
187 //-------------------------------------------
188 // set the generated event
189 //-------------------------------------------
191  if (!aGenEvt->isSemiLeptonic()) {
192  edm::LogWarning("TtGenEventNotFilled") << "genEvt is not semi-leptonic; TtGenEvent is not filled";
193  return;
194  }
196 }
197 
198 //-------------------------------------------
199 // set the outcome of the different jet
200 // combination methods
201 //-------------------------------------------
202 void TtSemiEvtSolution::setLRJetCombObservables(const std::vector<std::pair<unsigned int, double> >& varval) {
203  lrJetCombVarVal_.clear();
204  for (size_t ijc = 0; ijc < varval.size(); ijc++)
205  lrJetCombVarVal_.push_back(varval[ijc]);
206 }
207 
208 //-------------------------------------------
209 // set the outcome of the signal selection LR
210 //-------------------------------------------
211 void TtSemiEvtSolution::setLRSignalEvtObservables(const std::vector<std::pair<unsigned int, double> >& varval) {
212  lrSignalEvtVarVal_.clear();
213  for (size_t ise = 0; ise < varval.size(); ise++)
214  lrSignalEvtVarVal_.push_back(varval[ise]);
215 }
216 
218  AddFourMomenta addFourMomenta;
219 
222 
223  // Setup transient references
224  reco::CompositeCandidate recHadt;
225  reco::CompositeCandidate recLept;
226  reco::CompositeCandidate recHadW;
227  reco::CompositeCandidate recLepW;
228 
229  // Get refs to leaf nodes
234 
236 
237  // JetCandRef hadp( hadp_->p4(), hadp_->charge(), hadp_->vertex()); hadp.setRef( hadp_ );
238  // JetCandRef hadq( hadq_->p4(), hadq_->charge(), hadq_->vertex()); hadq.setRef( hadq_ );
239  // JetCandRef hadb( hadb_->p4(), hadb_->charge(), hadb_->vertex()); hadb.setRef( hadb_ );
240  // JetCandRef lepb( lepb_->p4(), lepb_->charge(), lepb_->vertex()); lepb.setRef( lepb_ );
241 
242  // METCandRef neutrino ( neutrino_->p4(), neutrino_->charge(), neutrino_->vertex() ); neutrino.setRef( neutrino_ );
243 
244  recHadW.addDaughter(hadp, "hadp");
245  recHadW.addDaughter(hadq, "hadq");
246 
247  addFourMomenta.set(recHadW);
248 
249  recHadt.addDaughter(hadb, "hadb");
250  recHadt.addDaughter(recHadW, "hadW");
251 
252  addFourMomenta.set(recHadt);
253 
254  recLepW.addDaughter(neutrino, "neutrino");
255  if (getDecay() == "electron") {
257  // ElectronCandRef electron ( electron_->p4(), electron_->charge(), electron_->vertex() ); electron.setRef( electron_ );
258  recLepW.addDaughter(electron, "electron");
259  } else if (getDecay() == "muon") {
261  // MuonCandRef muon ( muon_->p4(), muon_->charge(), muon_->vertex() ); muon.setRef( muon_ );
262  recLepW.addDaughter(muon, "muon");
263  }
264 
265  addFourMomenta.set(recLepW);
266 
267  recLept.addDaughter(lepb, "lepb");
268  recLept.addDaughter(recLepW, "lepW");
269 
270  addFourMomenta.set(recLept);
271 
272  recoHyp_.addDaughter(recHadt, "hadt");
273  recoHyp_.addDaughter(recLept, "lept");
274 
275  addFourMomenta.set(recoHyp_);
276 
277  // // Setup transient references
278  // reco::CompositeCandidate fitHadt;
279  // reco::CompositeCandidate fitLept;
280  // reco::CompositeCandidate fitHadW;
281  // reco::CompositeCandidate fitLepW;
282 
283  // // Get refs to leaf nodes
284  // pat::Particle afitHadp = getFitHadp();
285  // pat::Particle afitHadq = getFitHadq();
286  // pat::Particle afitHadb = getFitHadb();
287  // pat::Particle afitLepb = getFitLepb();
288  // reco::ShallowClonePtrCandidate fitHadp( hadp_, afitHadp.charge(), afitHadp.p4(), afitHadp.vertex());
289  // reco::ShallowClonePtrCandidate fitHadq( hadq_, afitHadq.charge(), afitHadq.p4(), afitHadq.vertex());
290  // reco::ShallowClonePtrCandidate fitHadb( hadb_, afitHadb.charge(), afitHadb.p4(), afitHadb.vertex());
291  // reco::ShallowClonePtrCandidate fitLepb( lepb_, afitLepb.charge(), afitLepb.p4(), afitLepb.vertex());
292 
293  // reco::ShallowClonePtrCandidate fitNeutrino ( neutrino_, fitLepn_.charge(), fitLepn_.p4(), fitLepn_.vertex() );
294 
295  // fitHadW.addDaughter( fitHadp, "hadp" );
296  // fitHadW.addDaughter( fitHadq, "hadq" );
297  // fitHadt.addDaughter( fitHadb, "hadb" );
298  // fitHadt.addDaughter( fitHadW, "hadW" );
299 
300  // fitLepW.addDaughter( fitNeutrino,"neutrino" );
301 
302  // if ( getDecay() == "electron" ) {
303  // reco::ShallowClonePtrCandidate fitElectron ( electron_, electron_.charge(), electron_.p4(), electron_.vertex() );
304  // fitLepW.addDaughter ( fitElectron, "electron" );
305  // } else if ( getDecay() == "muon" ) {
306  // reco::ShallowClonePtrCandidate fitMuon ( muon_, muon_.charge(), muon_.p4(), muon_.vertex() );
307  // fitLepW.addDaughter ( fitMuon, "muon" );
308  // }
309  // fitLept.addDaughter( fitLepb, "lepb" );
310  // fitLept.addDaughter( fitLepW, "lepW" );
311 
312  // fitHyp_.addDaughter( fitHadt, "hadt" );
313  // fitHyp_.addDaughter( fitLept, "lept" );
314 }
TtSemiEvtSolution::getRecLepn
pat::MET getRecLepn() const
Definition: TtSemiEvtSolution.h:133
edm::RefProd< TtGenEvent >
TtSemiEvtSolution::getFitLepn
pat::Particle getFitLepn() const
Definition: TtSemiEvtSolution.h:160
TtSemiEvtSolution::getHadq
pat::Jet getHadq() const
Definition: TtSemiEvtSolution.cc:55
TtSemiEvtSolution::~TtSemiEvtSolution
virtual ~TtSemiEvtSolution()
Definition: TtSemiEvtSolution.cc:28
MessageLogger.h
muon
Definition: MuonCocktails.h:17
reco::Particle
Definition: Particle.h:16
TtSemiEvtSolution::getCalHadb
pat::Jet getCalHadb() const
Definition: TtSemiEvtSolution.h:138
TtSemiEvtSolution::getCalHadp
pat::Jet getCalHadp() const
Definition: TtSemiEvtSolution.h:139
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
TtSemiEvtSolution::getHadp
pat::Jet getHadp() const
Definition: TtSemiEvtSolution.cc:44
TtSemiEvtSolution::getRecLepe
pat::Electron getRecLepe() const
Definition: TtSemiEvtSolution.h:132
TtSemiEvtSolution::setGenEvt
void setGenEvt(const edm::Handle< TtGenEvent > &aGenEvt)
Definition: TtSemiEvtSolution.cc:190
TtSemiEvtSolution::setLRSignalEvtObservables
void setLRSignalEvtObservables(const std::vector< std::pair< unsigned int, double > > &varval)
Definition: TtSemiEvtSolution.cc:211
TtSemiEvtSolution::getRecLepb
pat::Jet getRecLepb() const
Definition: TtSemiEvtSolution.h:130
TtSemiEvtSolution::getLepb
pat::Jet getLepb() const
Definition: TtSemiEvtSolution.cc:66
TtSemiEvtSolution::angleLepb_
double angleLepb_
Definition: TtSemiEvtSolution.h:331
TtSemiEvtSolution::hadb_
edm::Ptr< pat::Jet > hadb_
Definition: TtSemiEvtSolution.h:316
TtSemiEvtSolution::lrJetCombProb_
double lrJetCombProb_
Definition: TtSemiEvtSolution.h:336
TtSemiEvtSolution::getFitLept
reco::Particle getFitLept() const
Definition: TtSemiEvtSolution.cc:151
TtSemiEvtSolution::jetCorrScheme_
int jetCorrScheme_
Definition: TtSemiEvtSolution.h:330
TtSemiEvtSolution::getFitLepl
pat::Particle getFitLepl() const
Definition: TtSemiEvtSolution.h:159
edm::Handle
Definition: AssociativeIterator.h:50
dqmdumpme.first
first
Definition: dqmdumpme.py:55
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
TtSemiEvtSolution::getCalHadq
pat::Jet getCalHadq() const
Definition: TtSemiEvtSolution.h:140
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:36
TtSemiEvtSolution::getCalHadW
reco::Particle getCalHadW() const
Definition: TtSemiEvtSolution.cc:116
TtSemiEvtSolution::lrJetCombVarVal_
std::vector< std::pair< unsigned int, double > > lrJetCombVarVal_
Definition: TtSemiEvtSolution.h:338
TtSemiEvtSolution::getRecLept
reco::Particle getRecLept() const
Definition: TtSemiEvtSolution.cc:90
TtSemiEvtSolution::getFitHadq
pat::Particle getFitHadq() const
Definition: TtSemiEvtSolution.h:155
TtSemiEvtSolution::getFitHadp
pat::Particle getFitHadp() const
Definition: TtSemiEvtSolution.h:154
pat::Jet
Analysis-level calorimeter jet class.
Definition: Jet.h:77
TtSemiEvtSolution::getCalLept
reco::Particle getCalLept() const
Definition: TtSemiEvtSolution.cc:120
TtSemiEvtSolution::getRecHadW
reco::Particle getRecHadW() const
Definition: TtSemiEvtSolution.cc:85
TtGenEvent::isSemiLeptonic
bool isSemiLeptonic(bool excludeTauLeptons=false) const
check if the event can be classified as semi-laptonic
Definition: TtGenEvent.h:38
TtSemiEvtSolution::getFitHadt
reco::Particle getFitHadt() const
Definition: TtSemiEvtSolution.cc:141
TtSemiEvtSolution::getRecLepW
reco::Particle getRecLepW() const
Definition: TtSemiEvtSolution.cc:100
HLT_FULL_cff.muon
muon
Definition: HLT_FULL_cff.py:11710
TtSemiEvtSolution::getFitLepb
pat::Particle getFitLepb() const
Definition: TtSemiEvtSolution.h:158
TtSemiEvtSolution::hadp_
edm::Ptr< pat::Jet > hadp_
Definition: TtSemiEvtSolution.h:316
TtSemiEvtSolution::sumAnglejp_
double sumAnglejp_
Definition: TtSemiEvtSolution.h:331
TtSemiEvtSolution::changeWQ_
int changeWQ_
Definition: TtSemiEvtSolution.h:332
metsig::electron
Definition: SignAlgoResolutions.h:48
TtSemiEvtSolution::getLRJetCombObsVal
double getLRJetCombObsVal(unsigned int) const
Definition: TtSemiEvtSolution.cc:178
TtSemiEvtSolution::angleHadq_
double angleHadq_
Definition: TtSemiEvtSolution.h:331
reco::CompositeCandidate::addDaughter
void addDaughter(const Candidate &, const std::string &s="")
add a clone of the passed candidate as daughter
Definition: CompositeCandidate.cc:108
TtSemiEvtSolution::mcBestJetComb_
int mcBestJetComb_
Definition: TtSemiEvtSolution.h:335
reco::CompositeCandidate::clearRoles
void clearRoles()
Definition: CompositeCandidate.h:73
TtSemiEvtSolution::getFitHadW
reco::Particle getFitHadW() const
Definition: TtSemiEvtSolution.cc:146
TtSemiEvtSolution::recoHyp_
reco::CompositeCandidate recoHyp_
Definition: TtSemiEvtSolution.h:324
TtSemiEvtSolution::neutrino_
edm::Ptr< pat::MET > neutrino_
Definition: TtSemiEvtSolution.h:319
TtSemiEvtSolution::getHadb
pat::Jet getHadb() const
Definition: TtSemiEvtSolution.cc:33
TtSemiEvtSolution::setLRJetCombObservables
void setLRJetCombObservables(const std::vector< std::pair< unsigned int, double > > &varval)
Definition: TtSemiEvtSolution.cc:202
TtSemiEvtSolution::lrJetCombLRval_
double lrJetCombLRval_
Definition: TtSemiEvtSolution.h:336
TtSemiEvtSolution::electron_
edm::Ptr< pat::Electron > electron_
Definition: TtSemiEvtSolution.h:318
TtSemiEvtSolution::getCalLepb
pat::Jet getCalLepb() const
Definition: TtSemiEvtSolution.h:143
TtSemiEvtSolution::lrBestJetComb_
int lrBestJetComb_
Definition: TtSemiEvtSolution.h:335
AddFourMomenta.h
TtSemiEvtSolution::theGenEvt_
edm::RefProd< TtGenEvent > theGenEvt_
Definition: TtSemiEvtSolution.h:309
TtSemiEvtSolution::lrSignalEvtVarVal_
std::vector< std::pair< unsigned int, double > > lrSignalEvtVarVal_
Definition: TtSemiEvtSolution.h:339
TtSemiEvtSolution.h
TtSemiEvtSolution::getFitLepW
reco::Particle getFitLepW() const
Definition: TtSemiEvtSolution.cc:156
TtSemiEvtSolution::lrSignalEvtProb_
double lrSignalEvtProb_
Definition: TtSemiEvtSolution.h:337
ShallowClonePtrCandidate.h
TtSemiEvtSolution::TtSemiEvtSolution
TtSemiEvtSolution()
Definition: TtSemiEvtSolution.cc:9
reco::LeafCandidate::p4
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:114
p4
double p4[4]
Definition: TauolaWrapper.h:92
TtSemiEvtSolution::lrSignalEvtLRval_
double lrSignalEvtLRval_
Definition: TtSemiEvtSolution.h:337
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
TtSemiEvtSolution::getDecay
std::string getDecay() const
Definition: TtSemiEvtSolution.h:165
reco::LeafCandidate::charge
int charge() const final
electric charge
Definition: LeafCandidate.h:106
TtSemiEvtSolution::getRecHadb
pat::Jet getRecHadb() const
Definition: TtSemiEvtSolution.h:125
TtSemiEvtSolution::setupHyp
void setupHyp()
Definition: TtSemiEvtSolution.cc:217
TtSemiEvtSolution::probChi2_
double probChi2_
Definition: TtSemiEvtSolution.h:334
reco::GsfElectron::p4
const LorentzVector & p4(P4Kind kind) const
Definition: GsfElectron.cc:211
TtSemiEvtSolution::getCalHadt
reco::Particle getCalHadt() const
Definition: TtSemiEvtSolution.cc:112
TtSemiEvtSolution::angleHadp_
double angleHadp_
Definition: TtSemiEvtSolution.h:331
reco::LeafCandidate::vertex
const Point & vertex() const override
vertex position (overwritten by PF...)
Definition: LeafCandidate.h:165
TtSemiEvtSolution::getRecHadt
reco::Particle getRecHadt() const
Definition: TtSemiEvtSolution.cc:80
TtSemiEvtSolution::lepb_
edm::Ptr< pat::Jet > lepb_
Definition: TtSemiEvtSolution.h:316
heppy_batch.val
val
Definition: heppy_batch.py:351
TtSemiEvtSolution::getLRSignalEvtObsVal
double getLRSignalEvtObsVal(unsigned int) const
Definition: TtSemiEvtSolution.cc:165
reco::CompositeCandidate::clearDaughters
void clearDaughters()
clear daughters
Definition: CompositeCandidate.h:71
TtSemiEvtSolution::getRecHadq
pat::Jet getRecHadq() const
Definition: TtSemiEvtSolution.h:127
TtSemiEvtSolution::muon_
edm::Ptr< pat::Muon > muon_
Definition: TtSemiEvtSolution.h:317
TtSemiEvtSolution::hadq_
edm::Ptr< pat::Jet > hadq_
Definition: TtSemiEvtSolution.h:316
AddFourMomenta::set
void set(reco::Candidate &c) const
set up a candidate
Definition: AddFourMomenta.cc:6
pat::Jet::correctedJet
Jet correctedJet(const std::string &level, const std::string &flavor="none", const std::string &set="") const
TtSemiEvtSolution::getCalLepW
reco::Particle getCalLepW() const
Definition: TtSemiEvtSolution.cc:129
AddFourMomenta
Definition: AddFourMomenta.h:18
TtSemiEvtSolution::simpleBestJetComb_
int simpleBestJetComb_
Definition: TtSemiEvtSolution.h:335
reco::ShallowClonePtrCandidate
Definition: ShallowClonePtrCandidate.h:15
TtSemiEvtSolution::angleHadb_
double angleHadb_
Definition: TtSemiEvtSolution.h:331
TtSemiEvtSolution::getRecLepm
pat::Muon getRecLepm() const
Definition: TtSemiEvtSolution.h:131
reco::CompositeCandidate
Definition: CompositeCandidate.h:21
TtSemiEvtSolution::getFitHadb
pat::Particle getFitHadb() const
Definition: TtSemiEvtSolution.h:153
TtSemiEvtSolution::getRecHadp
pat::Jet getRecHadp() const
Definition: TtSemiEvtSolution.h:126