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