DESY Hbb Analysis Framework
PhysicsObjectTreeBase.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 {
21 }
22 template <class Object>
23 PhysicsObjectTreeBase<Object>::PhysicsObjectTreeBase(TChain * tree, const std::string & name) : TreeBase(tree, name)
24 {
25  tree_ -> SetBranchAddress( "n" , &n_ );
26  tree_ -> SetBranchAddress( "pt" , pt_ );
27  tree_ -> SetBranchAddress( "eta", eta_ );
28  tree_ -> SetBranchAddress( "phi", phi_ );
29 // tree_ -> SetBranchAddress( "e" , e_ );
30  std::vector<std::string>::iterator it;
31  it = std::find(branches_.begin(),branches_.end(),"e") ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , e_ );
32  it = std::find(branches_.begin(),branches_.end(),"q") ; if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , q_ );
33  it = std::find(branches_.begin(),branches_.end(),"px"); if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , px_ );
34  it = std::find(branches_.begin(),branches_.end(),"py"); if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , py_ );
35  it = std::find(branches_.begin(),branches_.end(),"pz"); if ( it != branches_.end() ) tree_ -> SetBranchAddress( (*it).c_str() , pz_ );
36 
37 }
38 
39 template <class Object>
41 {
42  // do anything here that needs to be done at desctruction time
43  // (e.g. close files, deallocate resources etc.)
44 }
45 
46 
47 //
48 // member functions
49 //
50 
51 // ------------ method called for each event ------------
52 
53 // ===================================
54 // Specialized for vertex
55 
57 {
58 }
59 
61 {
62  tree_ -> SetBranchAddress( "n" , &n_ );
63  tree_ -> SetBranchAddress( "x" , x_ );
64  tree_ -> SetBranchAddress( "y" , y_ );
65  tree_ -> SetBranchAddress( "z" , z_ );
66  tree_ -> SetBranchAddress( "xe" , xe_ );
67  tree_ -> SetBranchAddress( "ye" , ye_ );
68  tree_ -> SetBranchAddress( "ze" , ze_ );
69  tree_ -> SetBranchAddress( "fake", fake_ );
70  tree_ -> SetBranchAddress( "chi2", chi2_ );
71  tree_ -> SetBranchAddress( "ndof", ndof_ );
72  tree_ -> SetBranchAddress( "rho" , rho_ );
73 }
74 
76 {
77  // do anything here that needs to be done at desctruction time
78  // (e.g. close files, deallocate resources etc.)
79 }
80 
81 
83 template class PhysicsObjectTreeBase<Jet>;
84 template class PhysicsObjectTreeBase<MET>;
85 template class PhysicsObjectTreeBase<Muon>;
86 template class PhysicsObjectTreeBase<Vertex>;
89 template class PhysicsObjectTreeBase<GenJet>;
90 template class PhysicsObjectTreeBase<JetTag>;
91 template class PhysicsObjectTreeBase<L1TMuon>;
92 template class PhysicsObjectTreeBase<L1TJet>;
93 template class PhysicsObjectTreeBase<RecoMuon>;
std::vector< std::string > branches_
Definition: TreeBase.h:58