1 |
sixie |
1.1 |
#ifndef ZeeEventTree_H
|
2 |
|
|
#define ZeeEventTree_H
|
3 |
|
|
|
4 |
|
|
#include "TFile.h"
|
5 |
|
|
#include "TTree.h"
|
6 |
|
|
#include "TError.h"
|
7 |
|
|
#include <cmath>
|
8 |
|
|
#include "assert.h"
|
9 |
|
|
|
10 |
|
|
class ZeeEventTree {
|
11 |
|
|
|
12 |
|
|
public:
|
13 |
|
|
|
14 |
|
|
/// variables
|
15 |
|
|
Float_t fWeight;
|
16 |
|
|
UInt_t fRunNumber;
|
17 |
|
|
UInt_t fLumiSectionNumber;
|
18 |
|
|
UInt_t fEventNumber;
|
19 |
|
|
Float_t fRho;
|
20 |
|
|
UInt_t fNVertices;
|
21 |
|
|
|
22 |
|
|
Float_t fMass;
|
23 |
|
|
|
24 |
|
|
Float_t fEle1Pt;
|
25 |
|
|
Float_t fEle1Eta;
|
26 |
|
|
Float_t fEle1Phi;
|
27 |
|
|
Float_t fEle1SCEt;
|
28 |
|
|
Float_t fEle1SCEta;
|
29 |
|
|
Float_t fEle1SCPhi;
|
30 |
|
|
Float_t fEle1HZZICHEP2012IDMVA;
|
31 |
|
|
Float_t fEle1PFIso04;
|
32 |
|
|
Float_t fEle1R9;
|
33 |
|
|
Bool_t fEle1PassLooseSimpleCuts;
|
34 |
|
|
Bool_t fEle1PassTightSimpleCuts;
|
35 |
|
|
Bool_t fEle1PassHZZICHEP2012;
|
36 |
|
|
|
37 |
|
|
Float_t fEle2Pt;
|
38 |
|
|
Float_t fEle2Eta;
|
39 |
|
|
Float_t fEle2Phi;
|
40 |
|
|
Float_t fEle2SCEt;
|
41 |
|
|
Float_t fEle2SCEta;
|
42 |
|
|
Float_t fEle2SCPhi;
|
43 |
|
|
Float_t fEle2HZZICHEP2012IDMVA;
|
44 |
|
|
Float_t fEle2PFIso04;
|
45 |
|
|
Float_t fEle2R9;
|
46 |
|
|
Bool_t fEle2PassLooseSimpleCuts;
|
47 |
|
|
Bool_t fEle2PassTightSimpleCuts;
|
48 |
|
|
Bool_t fEle2PassHZZICHEP2012;
|
49 |
|
|
|
50 |
|
|
public:
|
51 |
|
|
/// this is the main element
|
52 |
|
|
TTree *tree_;
|
53 |
|
|
TFile *f_;
|
54 |
|
|
|
55 |
|
|
/// hold the names of variables to facilitate things (filled during Init)
|
56 |
|
|
std::vector<std::string> variables_;
|
57 |
|
|
|
58 |
|
|
/// default constructor
|
59 |
|
|
ZeeEventTree() {};
|
60 |
|
|
/// default destructor
|
61 |
|
|
~ZeeEventTree(){
|
62 |
|
|
if (f_) f_->Close();
|
63 |
|
|
};
|
64 |
|
|
|
65 |
|
|
/// initialize varibles and fill list of available variables
|
66 |
|
|
void InitVariables() {
|
67 |
|
|
fWeight = 0.0;
|
68 |
|
|
fRunNumber = 0.0;
|
69 |
|
|
fLumiSectionNumber = 0.0;
|
70 |
|
|
fEventNumber = 0.0;
|
71 |
|
|
fRho = 0.0;
|
72 |
|
|
fNVertices = 0.0;
|
73 |
|
|
fMass = 0.0;
|
74 |
|
|
fEle1Pt = 0.0;
|
75 |
|
|
fEle1Eta = 0.0;
|
76 |
|
|
fEle1Phi = 0.0;
|
77 |
|
|
fEle1SCEt = 0.0;
|
78 |
|
|
fEle1SCEta = 0.0;
|
79 |
|
|
fEle1SCPhi = 0.0;
|
80 |
|
|
fEle1HZZICHEP2012IDMVA = 0.0;
|
81 |
|
|
fEle1PFIso04 = 0.0;
|
82 |
|
|
fEle1R9 = 0.0;
|
83 |
|
|
fEle1PassLooseSimpleCuts = kFALSE;
|
84 |
|
|
fEle1PassTightSimpleCuts = kFALSE;
|
85 |
|
|
fEle1PassHZZICHEP2012 = kFALSE;
|
86 |
|
|
fEle2Pt = 0.0;
|
87 |
|
|
fEle2Eta = 0.0;
|
88 |
|
|
fEle2Phi = 0.0;
|
89 |
|
|
fEle2SCEt = 0.0;
|
90 |
|
|
fEle2SCEta = 0.0;
|
91 |
|
|
fEle2SCPhi = 0.0;
|
92 |
|
|
fEle2HZZICHEP2012IDMVA = 0.0;
|
93 |
|
|
fEle2PFIso04 = 0.0;
|
94 |
|
|
fEle2R9 = 0.0;
|
95 |
|
|
fEle2PassLooseSimpleCuts = kFALSE;
|
96 |
|
|
fEle2PassTightSimpleCuts = kFALSE;
|
97 |
|
|
fEle2PassHZZICHEP2012 = kFALSE;
|
98 |
|
|
}
|
99 |
|
|
|
100 |
|
|
/// load a ZeeEventTree
|
101 |
|
|
void LoadTree(const char* file){
|
102 |
|
|
f_ = TFile::Open(file);
|
103 |
|
|
assert(f_);
|
104 |
|
|
tree_ = dynamic_cast<TTree*>(f_->Get("Electrons"));
|
105 |
|
|
assert(tree_);
|
106 |
|
|
}
|
107 |
|
|
|
108 |
|
|
/// create a ZeeEventTree
|
109 |
|
|
void CreateTree(){
|
110 |
|
|
tree_ = new TTree("Electrons","Electrons");
|
111 |
|
|
f_ = 0;
|
112 |
|
|
|
113 |
|
|
//book the branches
|
114 |
|
|
tree_->Branch("weight",&fWeight,"weight/F");
|
115 |
|
|
tree_->Branch("run",&fRunNumber,"run/i");
|
116 |
|
|
tree_->Branch("lumi",&fLumiSectionNumber,"lumi/i");
|
117 |
|
|
tree_->Branch("event",&fEventNumber,"event/i");
|
118 |
|
|
tree_->Branch("rho",&fRho,"rho/F");
|
119 |
|
|
tree_->Branch("vertices",&fNVertices,"vertices/i");
|
120 |
|
|
tree_->Branch("mass",&fMass,"mass/F");
|
121 |
|
|
|
122 |
|
|
tree_->Branch("Ele1Pt",&fEle1Pt,"Ele1Pt/F");
|
123 |
|
|
tree_->Branch("Ele1Eta",&fEle1Eta,"Ele1Eta/F");
|
124 |
|
|
tree_->Branch("Ele1Phi",&fEle1Phi,"Ele1Phi/F");
|
125 |
|
|
tree_->Branch("Ele1SCEt",&fEle1SCEt,"Ele1SCEt/F");
|
126 |
|
|
tree_->Branch("Ele1SCEta",&fEle1SCEta,"Ele1SCEta/F");
|
127 |
|
|
tree_->Branch("Ele1SCPhi",&fEle1SCPhi,"Ele1SCPhi/F");
|
128 |
|
|
tree_->Branch("Ele1HZZICHEP2012IDMVA",&fEle1HZZICHEP2012IDMVA,"Ele1HZZICHEP2012IDMVA/F");
|
129 |
|
|
tree_->Branch("Ele1PFIso04",&fEle1PFIso04,"Ele1PFIso04/F");
|
130 |
|
|
tree_->Branch("Ele1R9",&fEle1R9,"Ele1R9/F");
|
131 |
|
|
tree_->Branch("Ele1PassLooseSimpleCuts",&fEle1PassLooseSimpleCuts,"Ele1PassLooseSimpleCuts/F");
|
132 |
|
|
tree_->Branch("Ele1PassTightSimpleCuts",&fEle1PassTightSimpleCuts,"Ele1PassTightSimpleCuts/F");
|
133 |
|
|
tree_->Branch("Ele1PassHZZICHEP2012",&fEle1PassHZZICHEP2012,"Ele1PassHZZICHEP2012/F");
|
134 |
|
|
tree_->Branch("Ele2Pt",&fEle2Pt,"Ele2Pt/F");
|
135 |
|
|
tree_->Branch("Ele2Eta",&fEle2Eta,"Ele2Eta/F");
|
136 |
|
|
tree_->Branch("Ele2Phi",&fEle2Phi,"Ele2Phi/F");
|
137 |
|
|
tree_->Branch("Ele2SCEt",&fEle2SCEt,"Ele2SCEt/F");
|
138 |
|
|
tree_->Branch("Ele2SCEta",&fEle2SCEta,"Ele2SCEta/F");
|
139 |
|
|
tree_->Branch("Ele2SCPhi",&fEle2SCPhi,"Ele2SCPhi/F");
|
140 |
|
|
tree_->Branch("Ele2HZZICHEP2012IDMVA",&fEle2HZZICHEP2012IDMVA,"Ele2HZZICHEP2012IDMVA/F");
|
141 |
|
|
tree_->Branch("Ele2PFIso04",&fEle2PFIso04,"Ele2PFIso04/F");
|
142 |
|
|
tree_->Branch("Ele2R9",&fEle2R9,"Ele2R9/F");
|
143 |
|
|
tree_->Branch("Ele2PassLooseSimpleCuts",&fEle2PassLooseSimpleCuts,"Ele2PassLooseSimpleCuts/F");
|
144 |
|
|
tree_->Branch("Ele2PassTightSimpleCuts",&fEle2PassTightSimpleCuts,"Ele2PassTightSimpleCuts/F");
|
145 |
|
|
tree_->Branch("Ele2PassHZZICHEP2012",&fEle2PassHZZICHEP2012,"Ele2PassHZZICHEP2012/F");
|
146 |
|
|
|
147 |
|
|
}
|
148 |
|
|
|
149 |
|
|
// initialze a ZeeEventTree
|
150 |
|
|
void InitTree(){
|
151 |
|
|
assert(tree_);
|
152 |
|
|
// don't forget to set pointers to zero before you set address
|
153 |
|
|
// or you will fully appreciate that "ROOT sucks" :)
|
154 |
|
|
InitVariables();
|
155 |
|
|
//Set branch address
|
156 |
|
|
Int_t currentState = gErrorIgnoreLevel;
|
157 |
|
|
tree_->SetBranchAddress("weight",&fWeight);
|
158 |
|
|
tree_->SetBranchAddress("run",&fRunNumber);
|
159 |
|
|
tree_->SetBranchAddress("lumi",&fLumiSectionNumber);
|
160 |
|
|
tree_->SetBranchAddress("event",&fEventNumber);
|
161 |
|
|
tree_->SetBranchAddress("rho",&fRho);
|
162 |
|
|
tree_->SetBranchAddress("vertices",&fNVertices);
|
163 |
|
|
tree_->SetBranchAddress("mass",&fMass);
|
164 |
|
|
|
165 |
|
|
tree_->SetBranchAddress("Ele1Pt",&fEle1Pt);
|
166 |
|
|
tree_->SetBranchAddress("Ele1Eta",&fEle1Eta);
|
167 |
|
|
tree_->SetBranchAddress("Ele1Phi",&fEle1Phi);
|
168 |
|
|
tree_->SetBranchAddress("Ele1SCEt",&fEle1SCEt);
|
169 |
|
|
tree_->SetBranchAddress("Ele1SCEta",&fEle1SCEta);
|
170 |
|
|
tree_->SetBranchAddress("Ele1SCPhi",&fEle1SCPhi);
|
171 |
|
|
tree_->SetBranchAddress("Ele1HZZICHEP2012IDMVA",&fEle1HZZICHEP2012IDMVA);
|
172 |
|
|
tree_->SetBranchAddress("Ele1PFIso04",&fEle1PFIso04);
|
173 |
|
|
tree_->SetBranchAddress("Ele1R9",&fEle1R9);
|
174 |
|
|
tree_->SetBranchAddress("Ele1PassLooseSimpleCuts",&fEle1PassLooseSimpleCuts);
|
175 |
|
|
tree_->SetBranchAddress("Ele1PassTightSimpleCuts",&fEle1PassTightSimpleCuts);
|
176 |
|
|
tree_->SetBranchAddress("Ele1PassHZZICHEP2012",&fEle1PassHZZICHEP2012);
|
177 |
|
|
tree_->SetBranchAddress("Ele2Pt",&fEle2Pt);
|
178 |
|
|
tree_->SetBranchAddress("Ele2Eta",&fEle2Eta);
|
179 |
|
|
tree_->SetBranchAddress("Ele2Phi",&fEle2Phi);
|
180 |
|
|
tree_->SetBranchAddress("Ele2SCEt",&fEle2SCEt);
|
181 |
|
|
tree_->SetBranchAddress("Ele2SCEta",&fEle2SCEta);
|
182 |
|
|
tree_->SetBranchAddress("Ele2SCPhi",&fEle2SCPhi);
|
183 |
|
|
tree_->SetBranchAddress("Ele2HZZICHEP2012IDMVA",&fEle2HZZICHEP2012IDMVA);
|
184 |
|
|
tree_->SetBranchAddress("Ele2PFIso04",&fEle2PFIso04);
|
185 |
|
|
tree_->SetBranchAddress("Ele2R9",&fEle2R9);
|
186 |
|
|
tree_->SetBranchAddress("Ele2PassLooseSimpleCuts",&fEle2PassLooseSimpleCuts);
|
187 |
|
|
tree_->SetBranchAddress("Ele2PassTightSimpleCuts",&fEle2PassTightSimpleCuts);
|
188 |
|
|
tree_->SetBranchAddress("Ele2PassHZZICHEP2012",&fEle2PassHZZICHEP2012);
|
189 |
|
|
|
190 |
|
|
gErrorIgnoreLevel = currentState;
|
191 |
|
|
}
|
192 |
|
|
|
193 |
|
|
};
|
194 |
|
|
|
195 |
|
|
|
196 |
|
|
|
197 |
|
|
#endif
|