DESY Hbb Analysis Framework
PhysicsObjectTree.cc
Go to the documentation of this file.
1 // system include files
2 #include <iostream>
3 //
4 // user include files
6 
7 
8 //
9 // class declaration
10 //
11 
12 using namespace analysis;
13 using namespace analysis::tools;
14 
15 //
16 // constructors and destructor
17 //
18 template <class Object>
20 template <class Object>
21  PhysicsObjectTree<Object>::PhysicsObjectTree(TChain * tree, const std::string & name) : PhysicsObjectTreeBase<Object>(tree, name) {}
22 template <class Object>
24 
25 // member function
27 {
28  // DUMMY
30  return obj;
31 }
32 
33 // Candidate
34 // Constructors and destructor
36 {
37 }
39 {
40 }
42 
43 // Member functions
45 {
46  std::vector<Candidate> candidates;
47  for ( int i = 0 ; i < n_ ; ++i )
48  {
49  Candidate cand(pt_[i], eta_[i], phi_[i], e_[i], q_[i]);
50  candidates.push_back(cand);
51  }
52  Collection<Candidate> CandidateCollection(candidates, name_);
53  return CandidateCollection;
54 
55 }
56 
57 
58 // JETS
59 // Constructors and destructor
61 {
62  isSimpleJet_ = false;
63  hasPuppiInfo_ = false;
64  hasQGLikelihood_ = false;
65  hasBRegCorr_ = false;
66  hasBRegRes_ = false;
67  hasRho_ = false;
68 
69 // tree_ -> SetBranchAddress( "btag_csvivf", btag_ );
70  int algos = 0;
71  for ( auto & branch : branches_ )
72  {
73  std::size_t found = branch.find("btag_");
74  if (found!=std::string::npos)
75  {
76  mbtag_[branch] = btags_[algos];
77  ++algos;
78  tree_ -> SetBranchAddress( branch.c_str(), mbtag_[branch]);
79  }
80  }
81 // std::vector<std::string>::iterator it;
82 // it = std::find(branches_.begin(),branches_.end(),"btag_");
83 // if ( it != branches_.end() )
84 // std::cout << *it << std::endl;
85 
86  if ( mbtag_.size() > 0 )
87  {
88  tree_ -> SetBranchAddress( "flavour" , flavour_ );
89  tree_ -> SetBranchAddress( "hadronFlavour" , hadrflavour_ );
90  tree_ -> SetBranchAddress( "partonFlavour" , partflavour_ );
91  tree_ -> SetBranchAddress( "physicsFlavour" , physflavour_ );
92  tree_ -> SetBranchAddress( "id_nHadFrac", nHadFrac_);
93  tree_ -> SetBranchAddress( "id_nEmFrac" , nEmFrac_ );
94  tree_ -> SetBranchAddress( "id_nMult" , nMult_ );
95  tree_ -> SetBranchAddress( "id_cHadFrac", cHadFrac_);
96  tree_ -> SetBranchAddress( "id_cEmFrac" , cEmFrac_ );
97  tree_ -> SetBranchAddress( "id_cMult" , cMult_ );
98  tree_ -> SetBranchAddress( "id_muonFrac", muFrac_ );
99  tree_ -> SetBranchAddress( "jecUncert" , jecUnc_);
100  tree_ -> SetBranchAddress( "jerSF", jerSF_);
101  tree_ -> SetBranchAddress( "jerSFDown", jerSFDown_);
102  tree_ -> SetBranchAddress( "jerSFUp", jerSFUp_);
103  tree_ -> SetBranchAddress( "jerResolution", jerResolution_);
104  std::vector<std::string>::iterator it;
105  it = std::find(branches_.begin(),branches_.end(),"qgLikelihood") ; if ( it != branches_.end() ) { tree_ -> SetBranchAddress( (*it).c_str() , qgLikelihood_ ); hasQGLikelihood_ = true; }
106  it = std::find(branches_.begin(),branches_.end(),"puJetIdFullDiscriminant") ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , puJetIdFullDisc_ );
107  it = std::find(branches_.begin(),branches_.end(),"puJetIdFullId") ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , puJetIdFullId_ );
108  it = std::find(branches_.begin(),branches_.end(),"id_puppi") ; if ( it != branches_.end() ) { tree_ -> SetBranchAddress( (*it).c_str() , puppi_ ) ; hasPuppiInfo_ = true; }
109  it = std::find(branches_.begin(),branches_.end(),"bjetRegCorr") ; if ( it != branches_.end() ) { tree_ -> SetBranchAddress( (*it).c_str() , bRegCorr_ ) ; hasBRegCorr_ = true; }
110  it = std::find(branches_.begin(),branches_.end(),"bjetRegRes") ; if ( it != branches_.end() ) { tree_ -> SetBranchAddress( (*it).c_str() , bRegRes_ ) ; hasBRegRes_ = true; }
111  it = std::find(branches_.begin(),branches_.end(),"Rho") ; if ( it != branches_.end() ) { tree_ -> SetBranchAddress( (*it).c_str() , &rho_ ) ; hasRho_ = true; }
112  }
113  else
114  {
115  isSimpleJet_ = true;
116  }
117 // std::cout << "oioi" << std::endl;
118 // std::vector<std::string>::iterator it;
119 // it = std::find(branches_.begin(),branches_.end(),"jecUncert"); if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str(), jecUnc_);
120 
121 }
123 
124 // Member functions
126 {
127 // std::string treename = (std::string)tree_->GetName();
128 // std::size_t foundPuppi = treename.find("Puppi");
129 // bool ispuppi = (foundPuppi != std::string::npos);
130 
131  std::vector<Jet> jets;
132  for ( int i = 0 ; i < n_ ; ++i )
133  {
134  Jet jet(pt_[i], eta_[i], phi_[i], e_[i]);
135  jet.btag(btag_[i]);
136  for ( auto & b : mbtag_ )
137  jet.btag(b.first,b.second[i]);
138  jet.flavour(flavour_[i]);
139  jet.flavour("Hadron",hadrflavour_[i]);
140  jet.flavour("Parton",partflavour_[i]);
141  jet.flavour("Physics",physflavour_[i]);
142  jet.jecUncert(jecUnc_[i]);
143  // for jet ID depends on Puppi!!!
144  if ( hasPuppiInfo_ )
145  {
146  jet.id(nHadFrac_[i],
147  nEmFrac_[i] ,
148  nMult_[i] ,
149  cHadFrac_[i],
150  cEmFrac_[i] ,
151  cMult_[i] ,
152  muFrac_[i] ,
153  puppi_[i] );
154  }
155  else
156  {
157  jet.id(nHadFrac_[i],
158  nEmFrac_[i] ,
159  nMult_[i] ,
160  cHadFrac_[i],
161  cEmFrac_[i] ,
162  cMult_[i] ,
163  muFrac_[i] ,
164  -1. );
165  }
166  jet.jerPtResolution(jerResolution_[i]);
167  jet.jerSF(jerSF_[i]);
168  jet.jerSFup(jerSFUp_[i]);
169  jet.jerSFdown(jerSFDown_[i]);
170  if ( hasQGLikelihood_ ) jet.qgLikelihood(qgLikelihood_[i]);
171  else jet.qgLikelihood(-10.);
172  jet.pileupJetIdFullDiscriminant(puJetIdFullDisc_[i]);
173  jet.pileupJetIdFullId(puJetIdFullId_[i]);
174  if ( hasBRegCorr_ ) jet.bRegCorr(bRegCorr_[i]);
175  else jet.bRegCorr(1);
176  if ( hasBRegRes_ ) jet.bRegRes (bRegRes_[i]);
177  else jet.bRegRes(1);
178  if ( hasRho_ ) jet.rho(rho_);
179  else jet.rho(-1);
180 
181  jets.push_back(jet);
182  }
183  Collection<Jet> jetCollection(jets, name_);
184  return jetCollection;
185 
186 }
187 
188 // GENPARTICLE
189 // Constructors and destructor
191 {
192  gp_has_indx_ = false;
193 
194  tree_ -> SetBranchAddress( "pdg" , pdgid_ );
195  tree_ -> SetBranchAddress( "status", status_ );
196  tree_ -> SetBranchAddress( "higgs_dau", higgs_dau_ );
197 
198  std::vector<std::string>::iterator it;
199  it = std::find(branches_.begin(),branches_.end(),"index") ; if ( it != branches_.end() ) { tree_ -> SetBranchAddress( (*it).c_str() , indx_ ); gp_has_indx_ = true; }
200  if ( gp_has_indx_ )
201  {
202  it = std::find(branches_.begin(),branches_.end(),"mother1") ; if ( it != branches_.end() ) { tree_ -> SetBranchAddress( (*it).c_str() , mo1_ ); }
203  it = std::find(branches_.begin(),branches_.end(),"mother2") ; if ( it != branches_.end() ) { tree_ -> SetBranchAddress( (*it).c_str() , mo2_ ); }
204  it = std::find(branches_.begin(),branches_.end(),"daughter1") ; if ( it != branches_.end() ) { tree_ -> SetBranchAddress( (*it).c_str() , da1_ ); }
205  it = std::find(branches_.begin(),branches_.end(),"daughter2") ; if ( it != branches_.end() ) { tree_ -> SetBranchAddress( (*it).c_str() , da2_ ); }
206  }
207 
208 }
210 
211 // Member functions
213 {
214  std::vector<GenParticle> particles;
215  for ( int i = 0 ; i < n_ ; ++i )
216  {
217  GenParticle p(pt_[i], eta_[i], phi_[i], e_[i], q_[i]);
218  p.pdgId(pdgid_[i]);
219  p.status(status_[i]);
220  p.higgsDaughter(higgs_dau_[i]);
221  if ( gp_has_indx_ )
222  {
223  p.index(indx_[i]);
224  p.mother(1,mo1_[i]);
225  p.mother(2,mo2_[i]);
226  p.daughter(1,da1_[i]);
227  p.daughter(2,da2_[i]);
228  }
229  particles.push_back(p);
230  }
231  Collection<GenParticle> genPartCollection(particles, name_);
232  return genPartCollection;
233 
234 }
235 
236 // MET
237 // Constructors and destructor
239 {
240  tree_ -> SetBranchAddress( "sigxx" , sigxx_ );
241  tree_ -> SetBranchAddress( "sigxy" , sigxy_ );
242  tree_ -> SetBranchAddress( "sigyx" , sigyx_ );
243  tree_ -> SetBranchAddress( "sigyy" , sigyy_ );
244  // Exists in MC; check if available and set
245  // Maybe it's better to use analysis::isMC() for this perpouse?
246  std::vector<std::string>::iterator it;
247  it = std::find(branches_.begin(),branches_.end(),"gen_px"); if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str(), gen_px_);
248  it = std::find(branches_.begin(),branches_.end(),"gen_py"); if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str(), gen_py_);
249  it = std::find(branches_.begin(),branches_.end(),"gen_pz"); if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str(), gen_pz_);
250 }
252 
253 // Member function
255 {
256  std::vector<MET> mets;
257  for ( int i = 0 ; i < n_ ; ++i )
258  {
259  MET met(px_[i], py_[i], pz_[i]);
260  met.significanceMatrix(sigxx_[i],sigxy_[i],sigyx_[i],sigyy_[i]);
261  met.genP(gen_px_[i],gen_py_[i],gen_pz_[i]);
262  mets.push_back(met);
263  }
264  Collection<MET> metCollection(mets, name_);
265  return metCollection;
266 
267 }
268 
269 // MUON
270 // Constructors and destructor
272 {
273 }
275 {
276  hasTightMuon_ = false;
277  tree_ -> SetBranchAddress ("isPFMuon" , isPFMuon_ ) ;
278  tree_ -> SetBranchAddress ("isGlobalMuon" , isGlobalMuon_ ) ;
279  tree_ -> SetBranchAddress ("isTrackerMuon" , isTrackerMuon_) ;
280  tree_ -> SetBranchAddress ("isLooseMuon" , isLooseMuon_ ) ;
281  tree_ -> SetBranchAddress ("isMediumMuon" , isMediumMuon_ ) ;
282 // tree_ -> SetBranchAddress ("isTightMuon" , isTightMuon_ ) ;
283 
284  tree_ -> SetBranchAddress ("validFraction" ,validFraction_ ) ;
285  tree_ -> SetBranchAddress ("segmentCompatibility" , segmentCompatibility_) ;
286  tree_ -> SetBranchAddress ("trkKink" , trkKink_) ;
287  tree_ -> SetBranchAddress ("chi2LocalPos" ,chi2LocalPos_) ;
288 
289  tree_ -> SetBranchAddress ("normChi2" , normChi2_) ;
290 
291  // to preserve backward compatibility with old ntuples
292  std::vector<std::string>::iterator it;
293  it = std::find(branches_.begin(),branches_.end(),"isTightMuon") ; if ( it != branches_.end() ) { tree_ -> SetBranchAddress( (*it).c_str() , isTightMuon_ ); hasTightMuon_ = true; }
294 
295  if ( ! hasTightMuon_ ) std::cout << "*** warning *** PhysicsObjectTree<Muon> constructor: muon id tight is not available in this ntuple production, isIdTight -> false" << std::endl;
296 
297 }
299 {
300 }
301 // Member functions
303 {
304  std::vector<Muon> muons;
305  for ( int i = 0 ; i < n_ ; ++i )
306  {
307  Muon muon(pt_[i], eta_[i], phi_[i], e_[i], q_[i]);
308  muon.isPFMuon(isPFMuon_[i]) ;
309  muon.isGlobalMuon(isGlobalMuon_[i]) ;
310  muon.isTrackerMuon(isTrackerMuon_[i]) ;
311  muon.isLooseMuon(isLooseMuon_[i]) ;
312  muon.isMediumMuon(isMediumMuon_[i]) ;
313  if ( hasTightMuon_ ) muon.isTightMuon(isTightMuon_[i]) ;
314  else muon.isTightMuon(false) ;
315 
316  muon.validFraction(validFraction_[i]) ;
317  muon.segmentCompatibility(segmentCompatibility_[i]) ;
318  muon.trkKink(trkKink_[i]) ;
319  muon.chi2LocalPos(chi2LocalPos_[i]) ;
320 
321  muon.normChi2(normChi2_[i]) ;
322  muons.push_back(muon);
323  }
324  Collection<Muon> muonCollection(muons, name_);
325  return muonCollection;
326 }
327 
328 // JETTAG
329 // Constructors and destructor
331 {
332 }
334 {
335  tree_ -> SetBranchAddress( "btag", btag_ );
336 }
338 {
339 }
340 // Member functions
342 {
343  std::vector<JetTag> jetstags;
344  for ( int i = 0 ; i < n_ ; ++i )
345  {
346  JetTag jettag(pt_[i], eta_[i], phi_[i], e_[i]);
347  jettag.btag(btag_[i]);
348  jetstags.push_back(jettag);
349  }
350  Collection<JetTag> jettagCollection(jetstags, name_);
351  return jettagCollection;
352 }
353 
354 
355 // GenJet
356 // Constructors and destructor
358 {
359 }
361 {
362 }
364 {
365 }
366 // Member functions
368 {
369  std::vector<GenJet> genjets;
370  for ( int i = 0 ; i < n_ ; ++i )
371  {
372  GenJet genjet(pt_[i], eta_[i], phi_[i], e_[i], q_[i]);
373  genjets.push_back(genjet);
374  }
375  Collection<GenJet> genjetCollection(genjets, name_);
376  return genjetCollection;
377 }
378 
379 
380 
381 // VERTEX
382 // Constructors and destructor
386 
387 // Member functions
389 {
390  std::vector<Vertex> vertices;
391  for ( int i = 0 ; i < n_ ; ++i )
392  {
393  Vertex vertex(x_[i], y_[i], z_[i]);
394  vertex.chi2(chi2_[i]);
395  vertex.ndof(ndof_[i]);
396  vertex.rho(rho_[i]);
397  vertex.fake(fake_[i]);
398 
399  vertices.push_back(vertex);
400  }
401  Collection<Vertex> vertexCollection(vertices, name_ );
402  return vertexCollection;
403 }
404 
405 // TriggerObjects
406 // Constructors and destructor
408 {
409 }
411 {
412  tree_ -> SetBranchAddress ("type" , type_ ) ;
413 }
415 
416 // Member functions
418 {
419  std::vector<TriggerObject> triggers;
420  for ( int i = 0 ; i < n_ ; ++i )
421  {
422  TriggerObject trig(pt_[i], eta_[i], phi_[i], e_[i]);
423  trig.type(type_[i]);
424  triggers.push_back(trig);
425  }
426  Collection<TriggerObject> TriggerObjectCollection(triggers, name_);
427  return TriggerObjectCollection;
428 
429 }
430 
431 // L1TMuon
432 // Constructors and destructor
434 {
435 }
437 {
438  tree_ -> SetBranchAddress ("hwQual" , hwQual_ ) ;
439  tree_ -> SetBranchAddress ("etaAtVtx" , etaAtVtx_ ) ;
440  tree_ -> SetBranchAddress ("phiAtVtx" , phiAtVtx_ ) ;
441 }
443 {
444 }
445 // Member functions
447 {
448  std::vector<L1TMuon> muons;
449  for ( int i = 0 ; i < n_ ; ++i )
450  {
451  L1TMuon muon(pt_[i], eta_[i], phi_[i], e_[i], q_[i]);
452  muon.hwQual (hwQual_ [i]) ;
453  muon.etaAtVtx(etaAtVtx_[i]) ;
454  muon.phiAtVtx(phiAtVtx_[i]) ;
455  muons.push_back(muon);
456  }
457  Collection<L1TMuon> muonCollection(muons, name_);
458  return muonCollection;
459 }
460 
461 // L1TJet
462 // Constructors and destructor
464 {
465 }
467 {
468 }
470 {
471 }
472 // Member functions
474 {
475  std::vector<L1TJet> jets;
476  for ( int i = 0 ; i < n_ ; ++i )
477  {
478  L1TJet jet(pt_[i], eta_[i], phi_[i], e_[i], 0);
479  jets.push_back(jet);
480  }
481  Collection<L1TJet> jetCollection(jets, name_);
482  return jetCollection;
483 }
484 
485 // RecoMuon
486 // Constructors and destructor
488 {
489 }
491 {
492 }
494 
495 // Member functions
497 {
498  std::vector<RecoMuon> candidates;
499  for ( int i = 0 ; i < n_ ; ++i )
500  {
501  RecoMuon cand(pt_[i], eta_[i], phi_[i], e_[i], q_[i]);
502  candidates.push_back(cand);
503  }
504  Collection<RecoMuon> RecoMuonCollection(candidates, name_);
505  return RecoMuonCollection;
506 
507 }
508 
509 // RecoTrack
510 // Constructors and destructor
512 {
513 }
515 {
516  std::vector<std::string>::iterator it;
517  it = std::find(branches_.begin(),branches_.end(),"chi2" ) ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , chi2_ );
518  it = std::find(branches_.begin(),branches_.end(),"ndof" ) ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , ndof_ );
519  it = std::find(branches_.begin(),branches_.end(),"d0" ) ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , d0_ );
520  it = std::find(branches_.begin(),branches_.end(),"dxy" ) ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , dxy_ );
521  it = std::find(branches_.begin(),branches_.end(),"numberOfLostMuonHits" ) ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , nLostMuHits_ );
522  it = std::find(branches_.begin(),branches_.end(),"numberOfBadMuonHits" ) ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , nBadMuHits_ );
523  it = std::find(branches_.begin(),branches_.end(),"numberOfValidMuonHits" ) ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , nValMuHits_ );
524  it = std::find(branches_.begin(),branches_.end(),"numberOfValidTrackerHits" ) ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , nValTrackerHits_ );
525  it = std::find(branches_.begin(),branches_.end(),"numberOfValidStripTECHits" ) ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , nValStripTECHits_ );
526  it = std::find(branches_.begin(),branches_.end(),"numberOfValidStripTIBHits" ) ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , nValStripTIBHits_ );
527  it = std::find(branches_.begin(),branches_.end(),"numberOfValidStripTIDHits" ) ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , nValStripTIDHits_ );
528  it = std::find(branches_.begin(),branches_.end(),"numberOfValidStripTOBHits" ) ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , nValStripTOBHits_ );
529  it = std::find(branches_.begin(),branches_.end(),"muonStationsWithValidHits" ) ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , muStationsWithValHits_ );
530  it = std::find(branches_.begin(),branches_.end(),"muonStationsWithBadHits" ) ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , muStationsWithBadHits_ );
531  it = std::find(branches_.begin(),branches_.end(),"innermostMuonStationWithValidHits") ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , inMuStationWithValHits_ );
532  it = std::find(branches_.begin(),branches_.end(),"outermostMuonStationWithValidHits") ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , outMuStationWithValHits_ );
533 
534  mqual_[undefQuality ] = qual_[0];
535  mqual_[loose ] = qual_[1];
536  mqual_[tight ] = qual_[2];
537  mqual_[highPurity ] = qual_[3];
538  mqual_[confirmed ] = qual_[4];
539  mqual_[goodIterative ] = qual_[5];
540  mqual_[looseSetWithPV ] = qual_[6];
541  mqual_[highPuritySetWithPV] = qual_[7];
542  mqual_[discarded ] = qual_[8];
543  mqual_[qualitySize ] = qual_[9];
544 
545  it = std::find(branches_.begin(),branches_.end(),"quality_undefQuality" ) ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , mqual_[TrackQuality::undefQuality ] );
546  it = std::find(branches_.begin(),branches_.end(),"quality_loose" ) ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , mqual_[TrackQuality::loose ] );
547  it = std::find(branches_.begin(),branches_.end(),"quality_tight" ) ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , mqual_[TrackQuality::tight ] );
548  it = std::find(branches_.begin(),branches_.end(),"quality_highPurity" ) ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , mqual_[TrackQuality::highPurity ] );
549  it = std::find(branches_.begin(),branches_.end(),"quality_confirmed" ) ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , mqual_[TrackQuality::confirmed ] );
550  it = std::find(branches_.begin(),branches_.end(),"quality_goodIterative" ) ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , mqual_[TrackQuality::goodIterative ] );
551  it = std::find(branches_.begin(),branches_.end(),"quality_looseSetWithPV" ) ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , mqual_[TrackQuality::looseSetWithPV ] );
552  it = std::find(branches_.begin(),branches_.end(),"quality_highPuritySetWithPV") ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , mqual_[TrackQuality::highPuritySetWithPV] );
553  it = std::find(branches_.begin(),branches_.end(),"quality_discarded" ) ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , mqual_[TrackQuality::discarded ] );
554  it = std::find(branches_.begin(),branches_.end(),"quality_qualitySize" ) ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , mqual_[TrackQuality::qualitySize ] );
555 
556 
557 
558 }
560 
561 // Member functions
563 {
564 // std::cout << " nnnnn = " << n_ << " " << chi2_ << std::endl;
565 
566  std::vector<RecoTrack> trks;
567  for ( int i = 0 ; i < n_ ; ++i )
568  {
569  RecoTrack trk(px_[i], py_[i], px_[i], q_[i]);
570  trk.chi2(chi2_ [i]);
571  trk.ndof(ndof_ [i]);
572  trk.d0 (d0_ [i]);
573  trk.dxy (dxy_ [i]);
574  trk.numberOfLostMuonHits (nLostMuHits_ [i]) ;
575  trk.numberOfBadMuonHits (nBadMuHits_ [i]) ;
576  trk.numberOfValidMuonHits (nValMuHits_ [i]) ;
577  trk.numberOfValidTrackerHits (nValTrackerHits_ [i]) ;
578  trk.numberOfValidStripTECHits (nValStripTECHits_ [i]) ;
579  trk.numberOfValidStripTIBHits (nValStripTIBHits_ [i]) ;
580  trk.numberOfValidStripTIDHits (nValStripTIDHits_ [i]) ;
581  trk.numberOfValidStripTOBHits (nValStripTOBHits_ [i]) ;
582  trk.muonStationsWithValidHits (muStationsWithValHits_ [i]) ;
583  trk.muonStationsWithBadHits (muStationsWithBadHits_ [i]) ;
584  trk.innermostMuonStationWithValidHits(inMuStationWithValHits_ [i]) ;
585  trk.outermostMuonStationWithValidHits(outMuStationWithValHits_[i]) ;
587  trk.quality(loose ,mqual_[TrackQuality::loose ][i]);
588  trk.quality(tight ,mqual_[TrackQuality::tight ][i]);
589  trk.quality(highPurity ,mqual_[TrackQuality::highPurity ][i]);
590  trk.quality(confirmed ,mqual_[TrackQuality::confirmed ][i]);
594  trk.quality(discarded ,mqual_[TrackQuality::discarded ][i]);
596 
597  trks.push_back(trk);
598  }
599  Collection<RecoTrack> RecoTrackCollection(trks, name_);
600  return RecoTrackCollection;
601 
602 }
603 
604 
605 // ======================================
606 // Templates declarations
607 template class PhysicsObjectTree<Candidate>;
608 template class PhysicsObjectTree<Jet>;
609 template class PhysicsObjectTree<MET>;
610 template class PhysicsObjectTree<Muon>;
611 template class PhysicsObjectTree<Vertex>;
612 template class PhysicsObjectTree<TriggerObject>;
613 template class PhysicsObjectTree<GenParticle>;
614 template class PhysicsObjectTree<GenJet>;
615 template class PhysicsObjectTree<L1TMuon>;
616 template class PhysicsObjectTree<L1TJet>;
617 template class PhysicsObjectTree<RecoMuon>;
618 template class PhysicsObjectTree<RecoTrack>;
float bRegCorr() const
b-jet regression
Definition: Jet.cc:235
float rho() const
returns rho coordinate of vertex position
Definition: Vertex.cc:50
float normChi2() const
Definition: Muon.cc:67
std::vector< std::string > branches_
Definition: TreeBase.h:58
float jerSF() const
returns jet energy resolution SF
Definition: Jet.cc:72
float btag() const
returns the btag value of btag_csvivf
Definition: JetTag.cc:38
bool id(const std::string &wp="tight") const
returns if jet has a given working point
Definition: Jet.cc:253
float phiAtVtx() const
Definition: L1TMuon.cc:44
int muonStationsWithBadHits() const
Definition: RecoTrack.cc:53
int pileupJetIdFullId() const
Definition: Jet.cc:233
bool fake() const
returns if vertex is fake or not
Definition: Vertex.cc:51
void status(const int &status)
Definition: GenParticle.h:85
float jerPtResolution() const
returns jet pt resolution
Definition: Jet.cc:71
void daughter(const int &, const int &)
Definition: GenParticle.h:94
float bRegRes() const
Definition: Jet.cc:236
int numberOfLostMuonHits() const
Definition: RecoTrack.cc:44
matrix< float > significanceMatrix()
Definition: MET.cc:39
int type() const
returns the type of the trigger object (L1mu, L1jet, hltmu, etc)
bool isTightMuon() const
Definition: Muon.cc:47
float trkKink() const
Definition: Muon.cc:63
void mother(const int &, const int &)
Definition: GenParticle.h:89
float ndof() const
returns number of degrees of freedom of the vertex fit
Definition: Vertex.cc:49
int flavour() const
returns the flavour with the Hadron definition (=0 for data)
Definition: Jet.cc:58
int numberOfValidMuonHits() const
Definition: RecoTrack.cc:46
int numberOfValidTrackerHits() const
Definition: RecoTrack.cc:47
bool isPFMuon() const
Definition: Muon.cc:42
int numberOfValidStripTIDHits() const
Definition: RecoTrack.cc:50
float * genP()
Definition: MET.cc:44
int numberOfValidStripTOBHits() const
Definition: RecoTrack.cc:51
void higgsDaughter(const bool &higgs_dau)
Definition: GenParticle.h:86
bool isGlobalMuon() const
Definition: Muon.cc:43
bool isLooseMuon() const
Definition: Muon.cc:45
float jecUncert() const
returns the jet energy correction uncertainty
Definition: Jet.cc:62
bool quality(const TrackQuality &trkqual)
Definition: RecoTrack.cc:56
int numberOfBadMuonHits() const
Definition: RecoTrack.cc:45
int hwQual() const
Definition: L1TMuon.cc:42
float chi2LocalPos() const
Definition: Muon.cc:64
float jerSFdown() const
returns jet energy resolution SF Down variation
Definition: Jet.cc:73
double rho() const
Rho.
Definition: Jet.cc:250
int outermostMuonStationWithValidHits() const
Definition: RecoTrack.cc:55
int muonStationsWithValidHits() const
Definition: RecoTrack.cc:52
float btag(const std::string &) const
returns the btag value of btag_csvivf
Definition: Jet.cc:57
int innermostMuonStationWithValidHits() const
Definition: RecoTrack.cc:54
bool isMediumMuon() const
Definition: Muon.cc:46
void index(const int &)
Definition: GenParticle.h:88
float validFraction() const
Definition: Muon.cc:61
void pdgId(const int &pdgId)
Definition: GenParticle.h:84
int numberOfValidStripTIBHits() const
Definition: RecoTrack.cc:49
float chi2() const
returns chi^2 of the vertex fit
Definition: Vertex.cc:48
float segmentCompatibility() const
Definition: Muon.cc:62
float qgLikelihood() const
quark-gluon separation
Definition: Jet.cc:231
float pileupJetIdFullDiscriminant() const
pile up jet id
Definition: Jet.cc:232
float etaAtVtx() const
Definition: L1TMuon.cc:43
int numberOfValidStripTECHits() const
Definition: RecoTrack.cc:48
float jerSFup() const
returns jet energy resolution SF Up variation
Definition: Jet.cc:74
bool isTrackerMuon() const
Definition: Muon.cc:44