CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TtSemiLRJetCombObservables.cc
Go to the documentation of this file.
1 //
2 // Author: Jan Heyninck
3 // Created: Tue Apr 3 17:33:23 PDT 2007
4 //
5 // $Id: TtSemiLRJetCombObservables.cc,v 1.16 2011/10/12 13:39:34 snaumann Exp $
6 //
13 
14 // constructor with path; default should not be used
16 
17 
18 // destructor
20 
21 std::vector< TtSemiLRJetCombObservables::IntBoolPair >
23 {
24  bool debug=false;
25 
26  evtselectVarVal.clear();
27  evtselectVarMatch.clear();
28 
29  // Check whether the objects are matched:
30 // bool matchHadt = false; //commented out since gcc461 complained that this variable was set but unused
31 // bool matchLept = false; //commented out since gcc461 complained that this variable was set but unused
32 // bool matchHadW = false; //commented out since gcc461 complained that this variable was set but unused
33 // bool matchLepW = false; //commented out since gcc461 complained that this variable was set but unused
34  bool matchHadb = false;
35  bool matchLepb = false;
36  bool matchHadp = false;
37  bool matchHadq = false;
38  bool matchHadpq = false;
39  bool matchHadqp = false;
40  bool matchLepl = false;
41  bool matchLepn = false;
42 
43  if(debug) std::cout << "== start matching the objects " << std::endl;
44 
45  try {
46 
47  if(debug) std::cout << "== start trying " << std::endl;
48  double drLepl=0, drLepn=0, drHadb=0, drLepb=0, drHadp=0, drHadq=0, drHadpq=0, drHadqp=0; // drHadt=0, drLept=0, drLepW=0, drHadW=0;
49 
51  iEvent.getByLabel ("genEvt",genEvent);
52  if(debug) std::cout << "== found genEvent " << std::endl;
53 
54  if (genEvent->isSemiLeptonic() && genEvent->numberOfBQuarks() == 2) {
55 
56  //if(debug) std::cout << "== genEvent->quarkFromAntiTop() " << genEvent->quarkFromAntiTop()->pt() << std::endl;
57  if(debug) std::cout << "== genEvent->isSemiLeptonic() && genEvent->numberOfBQuarks() == 2 " << std::endl;
58  if(debug) std::cout << "== solution.getDecay() == " <<solution.getDecay()<< std::endl;
59  if(debug) std::cout << "== solution.getRecLepm().pt() = " <<solution.getRecLepm().pt() << std::endl;
60  //if(debug) if(solution.getGenLepl() == 0) std::cout << "solution.getGenLepl() == NULL" << std::endl;
61  if(debug) std::cout << "== *(solution.getGenLept())" << solution.getGenLept()->pt() << std::endl;
62  if(debug) std::cout << "== *(solution.getGenLepl())" << solution.getGenLepl()->pt() << std::endl;
63  // std::cout << "Semilepton:\n";
64  // Match the lepton by deltaR
65  if (solution.getDecay() == "muon") drLepl = DeltaR<pat::Particle, reco::GenParticle>()(solution.getRecLepm(), *(solution.getGenLepl()));
66  if(debug) std::cout << "== matching lepton " << std::endl;
67  if (solution.getDecay() == "electron") drLepl = DeltaR<pat::Particle, reco::GenParticle>()(solution.getRecLepe(), *(solution.getGenLepl()));
68  matchLepl = (drLepl < 0.3);
69 
70  if(debug) std::cout << "== lepton is matched " << std::endl;
71  // Match the neutrino by deltaR
72  drLepn = DeltaR<pat::Particle, reco::GenParticle>()(solution.getRecLepn(), *(solution.getGenLepn()));
73  matchLepn = (drLepn < 0.3);
74 
75  // Match the hadronic b by deltaR
76  drHadb = DeltaR<pat::Jet, reco::GenParticle>()(solution.getRecHadb(), *(solution.getGenHadb()));
77  matchHadb = (drHadb < 0.3);
78 
79  // Match the hadronicleptonic b by deltaR
80  drLepb = DeltaR<pat::Jet, reco::GenParticle>()(solution.getRecLepb(), *(solution.getGenLepb()));
81  matchLepb = (drLepb < 0.3);
82 
83  // Match the hadronic p by deltaR
84  drHadp = DeltaR<pat::Jet, reco::GenParticle>()(solution.getRecHadp(), *(solution.getGenHadp()));
85  matchHadp = (drHadp < 0.3);
86 
87  // Match the hadronic pq by deltaR
88  drHadpq = DeltaR<pat::Jet, reco::GenParticle>()(solution.getRecHadp(), *(solution.getGenHadq()));
89  matchHadpq = (drHadpq < 0.3);
90 
91  // Match the hadronic q by deltaR
92  drHadq = DeltaR<pat::Jet, reco::GenParticle>()(solution.getRecHadq(), *(solution.getGenHadq()));
93  matchHadq = (drHadq < 0.3);
94 
95  // Match the hadronic qp by deltaR
96  drHadqp = DeltaR<pat::Jet, reco::GenParticle>()(solution.getRecHadq(), *(solution.getGenHadp()));
97  matchHadqp = (drHadqp < 0.3);
98 
99  //commented out since gcc461 complained that these variables were set but unused!
100  /*
101  // Match the hadronic W by deltaR
102  drHadW = DeltaR<reco::Particle, reco::GenParticle>()(solution.getRecHadW(), *(solution.getGenHadW()));
103  matchHadW = (drHadW < 0.3);
104 
105  // Match the leptonic W by deltaR
106  drLepW = DeltaR<reco::Particle, reco::GenParticle>()(solution.getRecLepW(), *(solution.getGenLepW()));
107  matchLepW = (drLepW < 0.3);
108 
109  // Match the hadronic t by deltaR
110  drHadt = DeltaR<reco::Particle, reco::GenParticle>()(solution.getRecHadt(), *(solution.getGenHadt()));
111  matchHadt = (drHadt < 0.3);
112 
113  // Match the leptonic t by deltaR
114  drLept = DeltaR<reco::Particle, reco::GenParticle>()(solution.getRecLept(), *(solution.getGenLept()));
115  matchLept = (drLept < 0.3);
116  */
117  }
118  } catch (...){std::cout << "Exception\n";}
119 
120  if(debug) std::cout << "== objects matched" <<std::endl;
121 
123  iEvent.getByLabel(jetSource_, jets);
124 
125  if(debug) std::cout << "== start calculating observables" << std::endl;
126 
127 
128  //obs1 : pt(had top)
129  double AverageTop =((solution.getHadb().p4()+solution.getHadq().p4()+solution.getHadp().p4()).pt()+(solution.getLepb().p4()+solution.getHadq().p4()+solution.getHadp().p4()).pt()+(solution.getHadb().p4()+solution.getLepb().p4()+solution.getHadp().p4()).pt()+(solution.getHadb().p4()+solution.getHadq().p4()+solution.getLepb().p4()).pt())/4.;
130  double Obs1 = ((solution.getHadb().p4()+solution.getHadq().p4()+solution.getHadp().p4()).pt())/AverageTop;
131  evtselectVarVal.push_back(IntDblPair(1,Obs1));
132  evtselectVarMatch.push_back(IntBoolPair(1, ((matchHadq&&matchHadp)||(matchHadpq&&matchHadqp))&&matchHadb));
133 
134  if(debug) std::cout << "== observable 1 " << Obs1 << std::endl;
135 
136  //obs2 : (pt_b1 + pt_b2)/(sum jetpt)
137  double Obs2 = (solution.getHadb().pt()+solution.getLepb().pt())/(solution.getHadp().pt()+solution.getHadq().pt());
138  evtselectVarVal.push_back(IntDblPair(2,Obs2));
139  evtselectVarMatch.push_back(IntBoolPair(2,((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))&&matchHadb&&matchLepb));
140 
141  if(debug) std::cout << "== observable 2 " << Obs2 << std::endl;
142 
143  //obs3: delta R between lep b and lepton
144  double Obs3 = -999;
145  if (solution.getDecay() == "muon") Obs3 = ROOT::Math::VectorUtil::DeltaR( solution.getLepb().p4(),solution.getRecLepm().p4() );
146  if (solution.getDecay() == "electron") Obs3 = ROOT::Math::VectorUtil::DeltaR( solution.getLepb().p4(),solution.getRecLepe().p4() );
147  evtselectVarVal.push_back(IntDblPair(3,Obs3));
148  evtselectVarMatch.push_back(IntBoolPair(3,matchLepb&&matchLepl));
149 
150  if(debug) std::cout << "== observable 3 " << Obs3 << std::endl;
151 
152  //obs4 : del R ( had b, had W)
153  double Obs4 = ROOT::Math::VectorUtil::DeltaR( solution.getHadb().p4(), solution.getHadq().p4()+solution.getHadp().p4() );
154  evtselectVarVal.push_back(IntDblPair(4,Obs4));
155  evtselectVarMatch.push_back(IntBoolPair(4,matchHadb&&((matchHadp&&matchHadp)||(matchHadpq&&matchHadqp))));
156 
157  if(debug) std::cout << "== observable 4 " << Obs4 << std::endl;
158 
159  //obs5 : del R between light quarkssolution.getHadp().phi(
160  double Obs5 = ROOT::Math::VectorUtil::DeltaR( solution.getHadq().p4(),solution.getHadp().p4() );
161  evtselectVarVal.push_back(IntDblPair(5,Obs5));
162  evtselectVarMatch.push_back(IntBoolPair(5,(matchHadp&&matchHadq)||(matchHadpq&&matchHadqp)));
163 
164  if(debug) std::cout << "== observable 5 " << Obs5 << std::endl;
165 
166  //obs6 : b-tagging information
167  double Obs6 = 0;
168  if ( fabs(solution.getHadb().bDiscriminator("trackCountingJetTags") +10) < 0.0001 || fabs(solution.getLepb().bDiscriminator("trackCountingJetTags") +10)< 0.0001 ){
169  Obs6 = -10.;
170  } else {
171  Obs6 = (solution.getHadb().bDiscriminator("trackCountingJetTags")+solution.getLepb().bDiscriminator("trackCountingJetTags"));
172  }
173  evtselectVarVal.push_back(IntDblPair(6,Obs6));
174  evtselectVarMatch.push_back(IntBoolPair(6,1));
175 
176  if(debug) std::cout << "== observable 6 " << Obs6 << std::endl;
177 
178  //obs7 : chi2 value of kinematical fit with W-mass constraint
179  double Obs7 =0;
180  if(solution.getProbChi2() <0){Obs7 = -0;} else { Obs7 = log10(solution.getProbChi2()+.00001);}
181  evtselectVarVal.push_back(IntDblPair(7,Obs7));
182  evtselectVarMatch.push_back(IntBoolPair(7,((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))));
183 
184  if(debug) std::cout << "== observable 7 " << Obs7 << std::endl;
185 
186  //obs8(=7+1)
187  double Obs8 = solution.getCalHadt().p4().pt();
188  evtselectVarVal.push_back(IntDblPair(8,Obs8));
189  evtselectVarMatch.push_back(IntBoolPair(8, matchHadb&&((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))));
190 
191  if(debug) std::cout << "== observable 8 " << Obs8 << std::endl;
192 
193  //obs9
194  double Obs9 = fabs(solution.getCalHadt().p4().eta());
195  evtselectVarVal.push_back(IntDblPair(9,Obs9));
196  evtselectVarMatch.push_back(IntBoolPair(9, matchHadb&&((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))));
197 
198  if(debug) std::cout << "== observable 9 " << Obs9 << std::endl;
199 
200  //obs10
201  double Obs10 = solution.getCalHadt().p4().theta();
202  evtselectVarVal.push_back(IntDblPair(10,Obs10));
203  evtselectVarMatch.push_back(IntBoolPair(10, matchHadb&&((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))));
204 
205  if(debug) std::cout << "== observable 10 " << Obs10 << std::endl;
206 
207  //obs11
208  double Obs11 = solution.getCalHadW().p4().pt();
209  evtselectVarVal.push_back(IntDblPair(11,Obs11));
210  evtselectVarMatch.push_back(IntBoolPair(11, (matchHadp&&matchHadq)||(matchHadpq&&matchHadqp)));
211 
212  if(debug) std::cout << "== observable 11 " << Obs11 << std::endl;
213 
214  //obs12
215  double Obs12 = fabs(solution.getCalHadW().p4().eta());
216  evtselectVarVal.push_back(IntDblPair(12,Obs12));
217  evtselectVarMatch.push_back(IntBoolPair(12, (matchHadp&&matchHadq)||(matchHadpq&&matchHadqp)));
218 
219  if(debug) std::cout << "== observable 12 " << Obs12 << std::endl;
220 
221  //obs13
222  double Obs13 = solution.getCalHadW().p4().theta();
223  evtselectVarVal.push_back(IntDblPair(13,Obs13));
224  evtselectVarMatch.push_back(IntBoolPair(13, (matchHadp&&matchHadq)||(matchHadpq&&matchHadqp)));
225 
226  if(debug) std::cout << "== observable 13 " << Obs13 << std::endl;
227 
228  //obs14
229  double Obs14 = solution.getCalHadb().p4().pt();
230  evtselectVarVal.push_back(IntDblPair(14,Obs14));
231  evtselectVarMatch.push_back(IntBoolPair(14, matchHadb));
232 
233  if(debug) std::cout << "== observable 14 " << Obs14 << std::endl;
234 
235  //obs15
236  double Obs15 = fabs(solution.getCalHadb().p4().eta());
237  evtselectVarVal.push_back(IntDblPair(15,Obs15));
238  evtselectVarMatch.push_back(IntBoolPair(15, matchHadb));
239 
240  if(debug) std::cout << "== observable 15 " << Obs15 << std::endl;
241 
242  //obs16
243  double Obs16 = solution.getCalHadb().p4().theta();
244  evtselectVarVal.push_back(IntDblPair(16,Obs16));
245  evtselectVarMatch.push_back(IntBoolPair(16, matchHadb));
246 
247  if(debug) std::cout << "== observable 16 " << Obs16 << std::endl;
248 
249  //obs17
250  double Obs17 = solution.getCalHadp().p4().pt();
251  evtselectVarVal.push_back(IntDblPair(17,Obs17));
252  evtselectVarMatch.push_back(IntBoolPair(17, matchHadp));
253 
254  if(debug) std::cout << "== observable 17 " << Obs17 << std::endl;
255 
256  //obs18
257  double Obs18 = fabs(solution.getCalHadp().p4().eta());
258  evtselectVarVal.push_back(IntDblPair(18,Obs18));
259  evtselectVarMatch.push_back(IntBoolPair(18, matchHadp));
260 
261  if(debug) std::cout << "== observable 18 " << Obs18 << std::endl;
262 
263  //obs19
264  double Obs19 = solution.getCalHadp().p4().theta();
265  evtselectVarVal.push_back(IntDblPair(19,Obs19));
266  evtselectVarMatch.push_back(IntBoolPair(19, matchHadp));
267 
268  if(debug) std::cout << "== observable 19 " << Obs19 << std::endl;
269 
270  //obs20
271  double Obs20 = solution.getCalHadq().p4().pt();
272  evtselectVarVal.push_back(IntDblPair(20,Obs20));
273  evtselectVarMatch.push_back(IntBoolPair(20, matchHadq));
274 
275  if(debug) std::cout << "== observable 20 " << Obs20 << std::endl;
276 
277  //obs21
278  double Obs21 = fabs(solution.getCalHadq().p4().eta());
279  evtselectVarVal.push_back(IntDblPair(21,Obs21));
280  evtselectVarMatch.push_back(IntBoolPair(21, matchHadq));
281 
282  if(debug) std::cout << "== observable 21 " << Obs21 << std::endl;
283 
284  //obs22
285  double Obs22 = solution.getCalHadq().p4().theta();
286  evtselectVarVal.push_back(IntDblPair(22,Obs22));
287  evtselectVarMatch.push_back(IntBoolPair(22, matchHadq));
288 
289  if(debug) std::cout << "== observable 22 " << Obs22 << std::endl;
290 
291  //obs23
292  double Obs23 = solution.getCalLept().p4().pt();
293  evtselectVarVal.push_back(IntDblPair(23,Obs23));
294  evtselectVarMatch.push_back(IntBoolPair(23, matchLepl&&matchLepn&&matchLepb));
295 
296  if(debug) std::cout << "== observable 23 " << Obs23 << std::endl;
297 
298  //obs24
299  double Obs24 = fabs(solution.getCalLept().p4().eta());
300  evtselectVarVal.push_back(IntDblPair(24,Obs24));
301  evtselectVarMatch.push_back(IntBoolPair(24, matchLepl&&matchLepn&&matchLepb));
302 
303  if(debug) std::cout << "== observable 24 " << Obs24 << std::endl;
304 
305  //obs25
306  double Obs25 = solution.getCalLept().p4().theta();
307  evtselectVarVal.push_back(IntDblPair(25,Obs25));
308  evtselectVarMatch.push_back(IntBoolPair(25, matchLepl&&matchLepn&&matchLepb));
309 
310  if(debug) std::cout << "== observable 25 " << Obs25 << std::endl;
311 
312  //obs26
313  double Obs26 = solution.getRecLepW().p4().pt();
314  evtselectVarVal.push_back(IntDblPair(26,Obs26));
315  evtselectVarMatch.push_back(IntBoolPair(26, matchLepl&&matchLepn));
316 
317  if(debug) std::cout << "== observable 26 " << Obs26 << std::endl;
318 
319  //obs27
320  double Obs27 = fabs(solution.getRecLepW().p4().eta());
321  evtselectVarVal.push_back(IntDblPair(27,Obs27));
322  evtselectVarMatch.push_back(IntBoolPair(27, matchLepl&&matchLepn));
323 
324  if(debug) std::cout << "== observable 27 " << Obs27 << std::endl;
325 
326  //obs28
327  double Obs28 = solution.getRecLepW().p4().theta();
328  evtselectVarVal.push_back(IntDblPair(28,Obs28));
329  evtselectVarMatch.push_back(IntBoolPair(28, matchLepl&&matchLepn));
330 
331  if(debug) std::cout << "== observable 28 " << Obs28 << std::endl;
332 
333  //obs29
334  double Obs29 = solution.getCalLepb().p4().pt();
335  evtselectVarVal.push_back(IntDblPair(29,Obs29));
336  evtselectVarMatch.push_back(IntBoolPair(29, matchLepb));
337 
338  if(debug) std::cout << "== observable 29 " << Obs29 << std::endl;
339 
340  //obs30
341  double Obs30 = fabs(solution.getCalLepb().p4().eta());
342  evtselectVarVal.push_back(IntDblPair(30,Obs30));
343  evtselectVarMatch.push_back(IntBoolPair(30, matchLepb));
344 
345  if(debug) std::cout << "== observable 30 " << Obs30 << std::endl;
346 
347  //obs31
348  double Obs31 = solution.getCalLepb().p4().theta();
349  evtselectVarVal.push_back(IntDblPair(31,Obs31));
350  evtselectVarMatch.push_back(IntBoolPair(31, matchLepb));
351 
352  if(debug) std::cout << "== observable 31 " << Obs31 << std::endl;
353 
354  //obs32
355  double Obs32 = -999.;
356  if (solution.getDecay() == "muon") Obs32 = solution.getRecLepm().p4().pt();
357  if (solution.getDecay() == "electron") Obs32 = solution.getRecLepe().p4().pt();
358  evtselectVarVal.push_back(IntDblPair(32,Obs32));
359  evtselectVarMatch.push_back(IntBoolPair(32, matchLepl));
360 
361  if(debug) std::cout << "== observable 32 " << Obs32 << std::endl;
362 
363  //obs33
364  double Obs33 = -999.;
365  if (solution.getDecay() == "muon") Obs33 = fabs(solution.getRecLepm().p4().eta());
366  if (solution.getDecay() == "electron") Obs33 = fabs(solution.getRecLepe().p4().eta());
367  evtselectVarVal.push_back(IntDblPair(33,Obs33));
368  evtselectVarMatch.push_back(IntBoolPair(33, matchLepl));
369 
370  if(debug) std::cout << "== observable 33 " << Obs33 << std::endl;
371 
372  //obs34
373  double Obs34 = -999.;
374  if (solution.getDecay() == "muon") Obs34 = fabs(solution.getRecLepm().p4().theta());
375  if (solution.getDecay() == "electron") Obs34 = fabs(solution.getRecLepe().p4().theta());
376  evtselectVarVal.push_back(IntDblPair(34,Obs34));
377  evtselectVarMatch.push_back(IntBoolPair(34, matchLepl));
378 
379  if(debug) std::cout << "== observable 34 " << Obs34 << std::endl;
380 
381  //obs35
382  double Obs35 = solution.getFitLepn().p4().pt();
383  evtselectVarVal.push_back(IntDblPair(35,Obs35));
384  evtselectVarMatch.push_back(IntBoolPair(35, matchLepn));
385 
386  if(debug) std::cout << "== observable 35 " << Obs35 << std::endl;
387 
388  //obs36
389  double Obs36 = fabs(solution.getFitLepn().p4().eta());
390  evtselectVarVal.push_back(IntDblPair(36,Obs36));
391  evtselectVarMatch.push_back(IntBoolPair(36, matchLepn));
392 
393  if(debug) std::cout << "== observable 36 " << Obs36 << std::endl;
394 
395  //obs37
396  double Obs37 = solution.getFitLepn().p4().theta();
397  evtselectVarVal.push_back(IntDblPair(37,Obs37));
398  evtselectVarMatch.push_back(IntBoolPair(37, matchLepn));
399 
400  if(debug) std::cout << "== observable 37 " << Obs37 << std::endl;
401 
402  // 2 particle kinematics
403  //obs38
404  double Obs38 = fabs(solution.getCalHadW().p4().phi()- solution.getRecLepW().p4().phi());
405  if (Obs38 > 3.1415927) Obs38 = 2*3.1415927 - Obs31;
406  if (Obs38 < -3.1415927) Obs38 = -2*3.1415927 - Obs31;
407  evtselectVarVal.push_back(IntDblPair(38,Obs38));
408  evtselectVarMatch.push_back(IntBoolPair(38, matchLepl&&matchLepn&&((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))));
409 
410  if(debug) std::cout << "== observable 38 " << Obs38 << std::endl;
411 
412  //obs39
413  double Obs39 = fabs(solution.getCalHadW().p4().eta()- solution.getRecLepW().p4().eta());
414  evtselectVarVal.push_back(IntDblPair(39,Obs39));
415  evtselectVarMatch.push_back(IntBoolPair(39, matchLepl&&matchLepn&&((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))));
416 
417  if(debug) std::cout << "== observable 39 " << Obs39 << std::endl;
418 
419  //obs40
420  double Obs40 = fabs(solution.getCalHadW().p4().theta()- solution.getRecLepW().p4().theta());
421  evtselectVarVal.push_back(IntDblPair(40,Obs40));
422  evtselectVarMatch.push_back(IntBoolPair(40, matchLepl&&matchLepn&&((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))));
423 
424  if(debug) std::cout << "== observable 40 " << Obs40 << std::endl;
425 
426  //obs41
427  double Obs41 = ROOT::Math::VectorUtil::DeltaR(solution.getCalHadW().p4(), solution.getRecLepW().p4());
428  evtselectVarVal.push_back(IntDblPair(41,Obs41));
429  evtselectVarMatch.push_back(IntBoolPair(41, matchLepl&&matchLepn&&((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))));
430 
431  if(debug) std::cout << "== observable 41 " << Obs41 << std::endl;
432 
433  //obs42
434  double Obs42 = fabs(solution.getCalHadb().p4().phi()- solution.getCalLepb().p4().phi());
435  if (Obs42 > 3.1415927) Obs42 = 2*3.1415927 - Obs42;
436  if (Obs42 < -3.1415927) Obs42 = -2*3.1415927 - Obs42;
437  evtselectVarVal.push_back(IntDblPair(42,Obs42));
438  evtselectVarMatch.push_back(IntBoolPair(42, matchHadb&&matchLepb));
439 
440  if(debug) std::cout << "== observable 42 " << Obs42 << std::endl;
441 
442  //obs43
443  double Obs43 = fabs(solution.getCalHadb().p4().eta()- solution.getCalLepb().p4().eta());
444  evtselectVarVal.push_back(IntDblPair(43,Obs43));
445  evtselectVarMatch.push_back(IntBoolPair(43, matchHadb&&matchLepb));
446 
447  if(debug) std::cout << "== observable 43 " << Obs43 << std::endl;
448 
449  //obs44
450  double Obs44 = fabs(solution.getCalHadb().p4().theta()- solution.getCalLepb().p4().theta());
451  evtselectVarVal.push_back(IntDblPair(44,Obs44));
452  evtselectVarMatch.push_back(IntBoolPair(44, matchHadb&&matchLepb));
453 
454  if(debug) std::cout << "== observable 44 " << Obs44 << std::endl;
455 
456  //obs45
457  double Obs45 = ROOT::Math::VectorUtil::DeltaR(solution.getCalHadb().p4(), solution.getCalLepb().p4());
458  evtselectVarVal.push_back(IntDblPair(45,Obs45));
459  evtselectVarMatch.push_back(IntBoolPair(45, matchHadb&&matchLepb));
460 
461  if(debug) std::cout << "== observable 45 " << Obs45 << std::endl;
462 
463  //obs46
464  double Obs46 = fabs(solution.getCalHadb().p4().phi()- solution.getCalHadW().p4().phi());
465  if (Obs46 > 3.1415927) Obs46 = 2*3.1415927 - Obs46;
466  if (Obs46 < -3.1415927) Obs46 = -2*3.1415927 - Obs46;
467  evtselectVarVal.push_back(IntDblPair(46,Obs46));
468  evtselectVarMatch.push_back(IntBoolPair(46, matchHadb&&((matchHadq&&matchHadp)||(matchHadpq&&matchHadqp))));
469 
470  if(debug) std::cout << "== observable 46 " << Obs46 << std::endl;
471 
472  //obs47
473  double Obs47 = fabs(solution.getCalHadb().p4().eta()- solution.getCalHadW().p4().eta());
474  evtselectVarVal.push_back(IntDblPair(47,Obs47));
475  evtselectVarMatch.push_back(IntBoolPair(47, matchHadb&&((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))));
476 
477  if(debug) std::cout << "== observable 47 " << Obs47 << std::endl;
478 
479  //obs48
480  double Obs48 = fabs(solution.getCalHadb().p4().theta()- solution.getCalHadW().p4().theta());
481  evtselectVarVal.push_back(IntDblPair(48,Obs48));
482  evtselectVarMatch.push_back(IntBoolPair(48, matchHadb&&((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))));
483 
484  if(debug) std::cout << "== observable 48 " << Obs48 << std::endl;
485 
486  //obs49
487  double Obs49 = ROOT::Math::VectorUtil::DeltaR(solution.getCalHadb().p4(), solution.getCalHadW().p4());
488  evtselectVarVal.push_back(IntDblPair(49,Obs49));
489  evtselectVarMatch.push_back(IntBoolPair(49, matchHadb&&((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))));
490 
491  if(debug) std::cout << "== observable 49 " << Obs49 << std::endl;
492 
493  //obs50
494  double Obs50 = fabs(solution.getCalLepb().p4().phi()- solution.getRecLepW().p4().phi());
495  if (Obs50 > 3.1415927) Obs50 = 2*3.1415927 - Obs50;
496  if (Obs50 < -3.1415927) Obs50 = -2*3.1415927 - Obs50;
497  evtselectVarVal.push_back(IntDblPair(50,Obs50));
498  evtselectVarMatch.push_back(IntBoolPair(50, matchLepb&&matchLepn&&matchLepl));
499 
500  if(debug) std::cout << "== observable 50 " << Obs50 << std::endl;
501 
502  //obs51
503  double Obs51 = fabs(solution.getCalLepb().p4().eta()- solution.getRecLepW().p4().eta());
504  evtselectVarVal.push_back(IntDblPair(51,Obs51));
505  evtselectVarMatch.push_back(IntBoolPair(51, matchLepb&&matchLepn&&matchLepl));
506 
507  if(debug) std::cout << "== observable 51 " << Obs51 << std::endl;
508 
509  //obs52
510  double Obs52 = fabs(solution.getCalLepb().p4().theta()- solution.getRecLepW().p4().theta());
511  evtselectVarVal.push_back(IntDblPair(52,Obs52));
512  evtselectVarMatch.push_back(IntBoolPair(52, matchLepb&&matchLepn&&matchLepl));
513 
514  if(debug) std::cout << "== observable 52 " << Obs52 << std::endl;
515 
516  //obs53
517  double Obs53 = ROOT::Math::VectorUtil::DeltaR(solution.getCalLepb().p4(), solution.getRecLepW().p4());
518  evtselectVarVal.push_back(IntDblPair(53,Obs53));
519  evtselectVarMatch.push_back(IntBoolPair(53, matchLepb&&matchLepn&&matchLepl));
520 
521  if(debug) std::cout << "== observable 53 " << Obs53 << std::endl;
522 
523  //obs54
524  double Obs54 = fabs(solution.getCalHadp().p4().phi()- solution.getCalHadq().p4().phi());
525  if (Obs54 > 3.1415927) Obs54 = 2*3.1415927 - Obs54;
526  if (Obs54 < -3.1415927) Obs54 = -2*3.1415927 - Obs54;
527  evtselectVarVal.push_back(IntDblPair(54,Obs54));
528  evtselectVarMatch.push_back(IntBoolPair(54, (matchHadp&&matchHadq)||(matchHadpq&&matchHadqp)));
529 
530  if(debug) std::cout << "== observable 54 " << Obs54 << std::endl;
531 
532  //obs55
533  double Obs55 = fabs(solution.getCalHadp().p4().eta()- solution.getCalHadq().p4().eta());
534  evtselectVarVal.push_back(IntDblPair(55,Obs55));
535  evtselectVarMatch.push_back(IntBoolPair(55, (matchHadp&&matchHadq)||(matchHadpq&&matchHadqp)));
536 
537  if(debug) std::cout << "== observable 55 " << Obs55 << std::endl;
538 
539  //obs56
540  double Obs56 = fabs(solution.getCalHadp().p4().theta()- solution.getCalHadq().p4().theta());
541  evtselectVarVal.push_back(IntDblPair(56,Obs56));
542  evtselectVarMatch.push_back(IntBoolPair(56, (matchHadp&&matchHadq)||(matchHadpq&&matchHadqp)));
543 
544  if(debug) std::cout << "== observable 56 " << Obs56 << std::endl;
545 
546  //obs57
547  double Obs57 = ROOT::Math::VectorUtil::DeltaR(solution.getCalHadp().p4(), solution.getCalHadq().p4());
548  evtselectVarVal.push_back(IntDblPair(57,Obs57));
549  evtselectVarMatch.push_back(IntBoolPair(57, (matchHadp&&matchHadq)||(matchHadpq&&matchHadqp)));
550 
551  if(debug) std::cout << "== observable 57 " << Obs57 << std::endl;
552 
553  //obs58
554  double Obs58 = -999.;
555  if (solution.getDecay() == "muon") Obs58 = fabs(solution.getRecLepm().p4().phi()- solution.getRecLepn().p4().phi());
556  if (solution.getDecay() == "electron") Obs58 = fabs(solution.getRecLepe().p4().phi()- solution.getRecLepn().p4().phi());
557  if (Obs58 > 3.1415927) Obs58 = 2*3.1415927 - Obs58;
558  if (Obs58 < -3.1415927) Obs58 = -2*3.1415927 - Obs58;
559  evtselectVarVal.push_back(IntDblPair(58,Obs58));
560  evtselectVarMatch.push_back(IntBoolPair(58, matchLepl&&matchLepn));
561 
562  if(debug) std::cout << "== observable 58 " << Obs58 << std::endl;
563 
564  //obs59
565  double Obs59 = -999.;
566  if (solution.getDecay() == "muon") Obs59 = fabs(solution.getRecLepm().p4().eta()- solution.getRecLepn().p4().eta());
567  if (solution.getDecay() == "electron") Obs59 = fabs(solution.getRecLepe().p4().eta()- solution.getRecLepn().p4().eta());
568  evtselectVarVal.push_back(IntDblPair(59,Obs59));
569  evtselectVarMatch.push_back(IntBoolPair(59, matchLepl&&matchLepn));
570 
571  if(debug) std::cout << "== observable 59 " << Obs59 << std::endl;
572 
573  //obs60
574  double Obs60 = -999.;
575  if (solution.getDecay() == "muon") Obs60 = fabs(solution.getRecLepm().p4().theta()- solution.getRecLepn().p4().theta());
576  if (solution.getDecay() == "electron") Obs60 = fabs(solution.getRecLepe().p4().theta()- solution.getRecLepn().p4().theta());
577  evtselectVarVal.push_back(IntDblPair(60,Obs60));
578  evtselectVarMatch.push_back(IntBoolPair(60, matchLepl&&matchLepn));
579 
580  if(debug) std::cout << "== observable 60 " << Obs60 << std::endl;
581 
582  //obs61
583  double Obs61 = -999.;
584  if (solution.getDecay() == "muon") Obs61 = ROOT::Math::VectorUtil::DeltaR(solution.getRecLepm().p4(), solution.getRecLepn().p4());
585  if (solution.getDecay() == "electron") Obs61 = ROOT::Math::VectorUtil::DeltaR(solution.getRecLepe().p4(), solution.getRecLepn().p4());
586  evtselectVarVal.push_back(IntDblPair(61,Obs61));
587  evtselectVarMatch.push_back(IntBoolPair(61, matchLepl&&matchLepn));
588 
589  if(debug) std::cout << "== observable 61 " << Obs61 << std::endl;
590 
591  // miscellaneous event variables
592 
593 
594  //obs62
595  double Obs62 = ((jets->size() > 4 && (*jets)[3].p4().Et() > 0.00001) ? (*jets)[4].p4().Et() / (*jets)[3].p4().Et() : 1.0);
596  //double Obs62 = 1;
597  evtselectVarVal.push_back(IntDblPair(62,Obs62));
598  evtselectVarMatch.push_back(IntBoolPair(62, ((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))&&matchHadb&&matchLepb));
599 
600  if(debug) std::cout << "== observable 62 " << Obs62 << std::endl;
601 
602  float calJetsSumEt = 0;
603  for (unsigned int i = 4; i < jets->size(); i++) {
604  calJetsSumEt += (*jets)[i].p4().Et();
605  }
606 
607  //obs63
608  double Obs63_den = (jets->size() > 4) ? ((*jets)[0].p4().Et()+(*jets)[1].p4().Et()+(*jets)[2].p4().Et()+(*jets)[3].p4().Et()+(*jets)[4].p4().Et()) : 0.0;
609  double Obs63 = (Obs63_den > 0.00001) ? calJetsSumEt / Obs63_den : 1.0;
610  //double Obs63 =1;
611  evtselectVarVal.push_back(IntDblPair(63,Obs63));
612  evtselectVarMatch.push_back(IntBoolPair(63, ((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))&&matchHadb&&matchLepb));
613 
614  if(debug) std::cout << "== observable 63 " << Obs63 << std::endl;
615 
616  //obs64
617  double Obs64 = solution.getProbChi2();
618  evtselectVarVal.push_back(IntDblPair(64,Obs64));
619  evtselectVarMatch.push_back(IntBoolPair(64, ((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))&&matchHadb&&matchLepb));
620 
621  if(debug) std::cout << "== observable 64 " << Obs64 << std::endl;
622 
623  //obs65
624  double Obs65 = solution.getFitHadt().p4().mass() - solution.getCalHadt().p4().mass();
625  evtselectVarVal.push_back(IntDblPair(65,Obs65));
626  evtselectVarMatch.push_back(IntBoolPair(65, ((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))&&matchHadb&&matchLepb));
627 
628  if(debug) std::cout << "== observable 65 " << Obs65 << std::endl;
629 
630  //obs66
631  double Obs66 = solution.getFitLept().p4().mass() - solution.getCalLept().p4().mass();
632  evtselectVarVal.push_back(IntDblPair(66,Obs66));
633  evtselectVarMatch.push_back(IntBoolPair(66, ((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))&&matchHadb&&matchLepb));
634 
635  if(debug) std::cout << "observables calculated" << std::endl;
636 
637  if (!matchOnly) solution.setLRJetCombObservables(evtselectVarVal);
638  return evtselectVarMatch;
639 }
int i
Definition: DBlmapReader.cc:9
reco::Particle getCalHadW() const
pat::Jet getLepb() const
pat::Jet getRecLepb() const
const LorentzVector & p4(P4Kind kind) const
Definition: GsfElectron.cc:204
std::pair< unsigned int, double > IntDblPair
pat::Jet getHadq() const
Definition: deltaR.h:51
pat::Jet getCalHadq() const
std::pair< unsigned int, bool > IntBoolPair
const reco::GenParticle * getGenLept() const
pat::Particle getFitLepn() const
std::vector< IntDblPair > evtselectVarVal
reco::Particle getFitHadt() const
std::string getDecay() const
const reco::GenParticle * getGenHadq() const
const LorentzVector & p4() const
four-momentum Lorentz vector
Definition: Particle.h:64
const reco::GenParticle * getGenLepb() const
pat::Jet getHadb() const
pat::Electron getRecLepe() const
std::vector< IntBoolPair > operator()(TtSemiEvtSolution &, const edm::Event &iEvent, bool matchOnly=false)
const reco::GenParticle * getGenHadp() const
int iEvent
Definition: GenABIO.cc:243
pat::Jet getRecHadp() const
const reco::GenParticle * getGenHadb() const
vector< PseudoJet > jets
pat::Jet getHadp() const
const reco::GenParticle * getGenLepl() const
reco::Particle getCalLept() const
float bDiscriminator(const std::string &theLabel) const
-— methods for accessing b-tagging info -—
Definition: Jet.cc:314
tuple genEvent
Definition: MCTruth.py:33
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
void setLRJetCombObservables(std::vector< std::pair< unsigned int, double > > varval)
pat::Jet getRecHadb() const
pat::Jet getCalHadb() const
virtual double pt() const
transverse momentum
pat::Jet getRecHadq() const
const reco::GenParticle * getGenLepn() const
pat::Muon getRecLepm() const
pat::Jet getCalLepb() const
tuple cout
Definition: gather_cfg.py:121
pat::MET getRecLepn() const
std::vector< IntBoolPair > evtselectVarMatch
#define debug
Definition: MEtoEDMFormat.h:34
reco::Particle getCalHadt() const
reco::Particle getRecLepW() const
double getProbChi2() const
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
reco::Particle getFitLept() const
pat::Jet getCalHadp() const