CMS 3D CMS Logo

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