-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyAnalysis.h
More file actions
279 lines (254 loc) · 10.2 KB
/
MyAnalysis.h
File metadata and controls
279 lines (254 loc) · 10.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
//////////////////////////////////////////////////////////
// This class has been automatically generated on
// Wed Feb 1 07:53:21 2012 by ROOT version 5.32/00
// from TTree data/
// found on file: data.root
//////////////////////////////////////////////////////////
#ifndef MyAnalysis_h
#define MyAnalysis_h
#include <TROOT.h>
#include <TFile.h>
#include <TChain.h>
#include <TSelector.h>
#include <TH1F.h>
#include <TLorentzVector.h>
#include <vector>
#include "MyJet.h"
#include "MyMuon.h"
#include "MyElectron.h"
#include "MyPhoton.h"
using namespace std;
// Header file for the classes stored in the TTree if any.
// Fixed size dimensions of array or collections stored in the TTree if any.
class MyAnalysis: public TSelector {
public:
TTree *fChain; //!pointer to the analyzed TTree or TChain
// Declaration of leaf types
Int_t NJet;
Float_t Jet_Px[10]; //[NJet]
Float_t Jet_Py[10]; //[NJet]
Float_t Jet_Pz[10]; //[NJet]
Float_t Jet_E[10]; //[NJet]
Float_t Jet_btag[10]; //[NJet]
Float_t Jet_ID[10]; //[NJet]
Int_t NMuon;
Float_t Muon_Px[5]; //[NMuon]
Float_t Muon_Py[5]; //[NMuon]
Float_t Muon_Pz[5]; //[NMuon]
Float_t Muon_E[5]; //[NMuon]
Int_t Muon_Charge[5]; //[NMuon]
Float_t Muon_Iso[5]; //[NMuon]
Int_t NElectron;
Float_t Electron_Px[5]; //[NElectron]
Float_t Electron_Py[5]; //[NElectron]
Float_t Electron_Pz[5]; //[NElectron]
Float_t Electron_E[5]; //[NElectron]
Int_t Electron_Charge[5]; //[NElectron]
Float_t Electron_Iso[5]; //[NElectron]
Int_t NPhoton;
Float_t Photon_Px[5]; //[NPhoton]
Float_t Photon_Py[5]; //[NPhoton]
Float_t Photon_Pz[5]; //[NPhoton]
Float_t Photon_E[5]; //[NPhoton]
Float_t Photon_Iso[5]; //[NPhoton]
Float_t MET_px;
Float_t MET_py;
Float_t MChadronicBottom_px;
Float_t MChadronicBottom_py;
Float_t MChadronicBottom_pz;
Float_t MCleptonicBottom_px;
Float_t MCleptonicBottom_py;
Float_t MCleptonicBottom_pz;
Float_t MChadronicWDecayQuark_px;
Float_t MChadronicWDecayQuark_py;
Float_t MChadronicWDecayQuark_pz;
Float_t MChadronicWDecayQuarkBar_px;
Float_t MChadronicWDecayQuarkBar_py;
Float_t MChadronicWDecayQuarkBar_pz;
Float_t MClepton_px;
Float_t MClepton_py;
Float_t MClepton_pz;
Int_t MCleptonPDGid;
Float_t MCneutrino_px;
Float_t MCneutrino_py;
Float_t MCneutrino_pz;
Int_t NPrimaryVertices;
Bool_t triggerIsoMu24;
Float_t EventWeight;
// List of branches
TBranch *b_NJet; //!
TBranch *b_Jet_Px; //!
TBranch *b_Jet_Py; //!
TBranch *b_Jet_Pz; //!
TBranch *b_Jet_E; //!
TBranch *b_Jet_btag; //!
TBranch *b_Jet_ID; //!
TBranch *b_NMuon; //!
TBranch *b_Muon_Px; //!
TBranch *b_Muon_Py; //!
TBranch *b_Muon_Pz; //!
TBranch *b_Muon_E; //!
TBranch *b_Muon_Charge; //!
TBranch *b_Muon_Iso; //!
TBranch *b_NElectron; //!
TBranch *b_Electron_Px; //!
TBranch *b_Electron_Py; //!
TBranch *b_Electron_Pz; //!
TBranch *b_Electron_E; //!
TBranch *b_Electron_Charge; //!
TBranch *b_Electron_Iso; //!
TBranch *b_NPhoton; //!
TBranch *b_Photon_Px; //!
TBranch *b_Photon_Py; //!
TBranch *b_Photon_Pz; //!
TBranch *b_Photon_E; //!
TBranch *b_Photon_Iso; //!
TBranch *b_MET_px; //!
TBranch *b_MET_py; //!
TBranch *b_MChadronicBottom_px; //!
TBranch *b_MChadronicBottom_py; //!
TBranch *b_MChadronicBottom_pz; //!
TBranch *b_MCleptonicBottom_px; //!
TBranch *b_MCleptonicBottom_py; //!
TBranch *b_MCleptonicBottom_pz; //!
TBranch *b_MChadronicWDecayQuark_px; //!
TBranch *b_MChadronicWDecayQuark_py; //!
TBranch *b_MChadronicWDecayQuark_pz; //!
TBranch *b_MChadronicWDecayQuarkBar_px; //!
TBranch *b_MChadronicWDecayQuarkBar_py; //!
TBranch *b_MChadronicWDecayQuarkBar_pz; //!
TBranch *b_MClepton_px; //!
TBranch *b_MClepton_py; //!
TBranch *b_MClepton_pz; //!
TBranch *b_MCleptonPDGid; //!
TBranch *b_MCneutrino_px; //!
TBranch *b_MCneutrino_py; //!
TBranch *b_MCneutrino_pz; //!
TBranch *b_NPrimaryVertices; //!
TBranch *b_triggerIsoMu24; //!
TBranch *b_EventWeight; //!
MyAnalysis(float sf = 1., float wf = 1, TTree * /*tree*/= 0) :
fChain(0) {
weight_factor = wf;
SF_b = sf;
}
virtual ~MyAnalysis() {
}
virtual Int_t Version() const {
return 2;
}
virtual void Begin(TTree *tree);
virtual void SlaveBegin(TTree *tree);
virtual void Init(TTree *tree);
virtual Bool_t Notify();
virtual Bool_t Process(Long64_t entry);
virtual Int_t GetEntry(Long64_t entry, Int_t getall = 0) {
return fChain ? fChain->GetTree()->GetEntry(entry, getall) : 0;
}
virtual void SetOption(const char *option) {
fOption = option;
}
virtual void SetObject(TObject *obj) {
fObject = obj;
}
virtual void SetInputList(TList *input) {
fInput = input;
}
virtual TList *GetOutputList() const {
return fOutput;
}
virtual void SlaveTerminate();
virtual void Terminate();
void BuildEvent();
int TotalEvents;
vector<MyJet> Jets;
vector<MyMuon> Muons;
vector<MyElectron> Electrons;
vector<MyPhoton> Photons;
TLorentzVector hadB, lepB, hadWq, hadWqb, lepWl, lepWn;
TLorentzVector met;
float weight_factor;
float SF_b;
TH1F *h_Mmumu;
TH1F *h_NMuon;
vector<TH1F*> histograms;
vector<TH1F*> histograms_MC;
};
#endif
#ifdef MyAnalysis_cxx
void MyAnalysis::Init(TTree *tree)
{
// The Init() function is called when the selector needs to initialize
// a new tree or chain. Typically here the branch addresses and branch
// pointers of the tree will be set.
// It is normally not necessary to make changes to the generated
// code, but the routine can be extended by the user if needed.
// Init() will be called many times when running on PROOF
// (once per file to be processed).
// Set branch addresses and branch pointers
if (!tree) return;
fChain = tree;
fChain->SetMakeClass(1);
fChain->SetBranchAddress("NJet", &NJet, &b_NJet);
fChain->SetBranchAddress("Jet_Px", Jet_Px, &b_Jet_Px);
fChain->SetBranchAddress("Jet_Py", Jet_Py, &b_Jet_Py);
fChain->SetBranchAddress("Jet_Pz", Jet_Pz, &b_Jet_Pz);
fChain->SetBranchAddress("Jet_E", Jet_E, &b_Jet_E);
fChain->SetBranchAddress("Jet_btag", Jet_btag, &b_Jet_btag);
fChain->SetBranchAddress("Jet_ID", Jet_ID, &b_Jet_ID);
fChain->SetBranchAddress("NMuon", &NMuon, &b_NMuon);
fChain->SetBranchAddress("Muon_Px", Muon_Px, &b_Muon_Px);
fChain->SetBranchAddress("Muon_Py", Muon_Py, &b_Muon_Py);
fChain->SetBranchAddress("Muon_Pz", Muon_Pz, &b_Muon_Pz);
fChain->SetBranchAddress("Muon_E", Muon_E, &b_Muon_E);
fChain->SetBranchAddress("Muon_Charge", Muon_Charge, &b_Muon_Charge);
fChain->SetBranchAddress("Muon_Iso", Muon_Iso, &b_Muon_Iso);
fChain->SetBranchAddress("NElectron", &NElectron, &b_NElectron);
fChain->SetBranchAddress("Electron_Px", Electron_Px, &b_Electron_Px);
fChain->SetBranchAddress("Electron_Py", Electron_Py, &b_Electron_Py);
fChain->SetBranchAddress("Electron_Pz", Electron_Pz, &b_Electron_Pz);
fChain->SetBranchAddress("Electron_E", Electron_E, &b_Electron_E);
fChain->SetBranchAddress("Electron_Charge", Electron_Charge, &b_Electron_Charge);
fChain->SetBranchAddress("Electron_Iso", Electron_Iso, &b_Electron_Iso);
fChain->SetBranchAddress("NPhoton", &NPhoton, &b_NPhoton);
fChain->SetBranchAddress("Photon_Px", Photon_Px, &b_Photon_Px);
fChain->SetBranchAddress("Photon_Py", Photon_Py, &b_Photon_Py);
fChain->SetBranchAddress("Photon_Pz", Photon_Pz, &b_Photon_Pz);
fChain->SetBranchAddress("Photon_E", Photon_E, &b_Photon_E);
fChain->SetBranchAddress("Photon_Iso", Photon_Iso, &b_Photon_Iso);
fChain->SetBranchAddress("MET_px", &MET_px, &b_MET_px);
fChain->SetBranchAddress("MET_py", &MET_py, &b_MET_py);
fChain->SetBranchAddress("MChadronicBottom_px", &MChadronicBottom_px, &b_MChadronicBottom_px);
fChain->SetBranchAddress("MChadronicBottom_py", &MChadronicBottom_py, &b_MChadronicBottom_py);
fChain->SetBranchAddress("MChadronicBottom_pz", &MChadronicBottom_pz, &b_MChadronicBottom_pz);
fChain->SetBranchAddress("MCleptonicBottom_px", &MCleptonicBottom_px, &b_MCleptonicBottom_px);
fChain->SetBranchAddress("MCleptonicBottom_py", &MCleptonicBottom_py, &b_MCleptonicBottom_py);
fChain->SetBranchAddress("MCleptonicBottom_pz", &MCleptonicBottom_pz, &b_MCleptonicBottom_pz);
fChain->SetBranchAddress("MChadronicWDecayQuark_px", &MChadronicWDecayQuark_px, &b_MChadronicWDecayQuark_px);
fChain->SetBranchAddress("MChadronicWDecayQuark_py", &MChadronicWDecayQuark_py, &b_MChadronicWDecayQuark_py);
fChain->SetBranchAddress("MChadronicWDecayQuark_pz", &MChadronicWDecayQuark_pz, &b_MChadronicWDecayQuark_pz);
fChain->SetBranchAddress("MChadronicWDecayQuarkBar_px", &MChadronicWDecayQuarkBar_px, &b_MChadronicWDecayQuarkBar_px);
fChain->SetBranchAddress("MChadronicWDecayQuarkBar_py", &MChadronicWDecayQuarkBar_py, &b_MChadronicWDecayQuarkBar_py);
fChain->SetBranchAddress("MChadronicWDecayQuarkBar_pz", &MChadronicWDecayQuarkBar_pz, &b_MChadronicWDecayQuarkBar_pz);
fChain->SetBranchAddress("MClepton_px", &MClepton_px, &b_MClepton_px);
fChain->SetBranchAddress("MClepton_py", &MClepton_py, &b_MClepton_py);
fChain->SetBranchAddress("MClepton_pz", &MClepton_pz, &b_MClepton_pz);
fChain->SetBranchAddress("MCleptonPDGid", &MCleptonPDGid, &b_MCleptonPDGid);
fChain->SetBranchAddress("MCneutrino_px", &MCneutrino_px, &b_MCneutrino_px);
fChain->SetBranchAddress("MCneutrino_py", &MCneutrino_py, &b_MCneutrino_py);
fChain->SetBranchAddress("MCneutrino_pz", &MCneutrino_pz, &b_MCneutrino_pz);
fChain->SetBranchAddress("NPrimaryVertices", &NPrimaryVertices, &b_NPrimaryVertices);
fChain->SetBranchAddress("triggerIsoMu24", &triggerIsoMu24, &b_triggerIsoMu24);
fChain->SetBranchAddress("EventWeight", &EventWeight, &b_EventWeight);
TotalEvents = 0;
}
Bool_t MyAnalysis::Notify()
{
// The Notify() function is called when a new file is opened. This
// can be either for a new TTree in a TChain or when when a new TTree
// is started when using PROOF. It is normally not necessary to make changes
// to the generated code, but the routine can be extended by the
// user if needed. The return value is currently not used.
return kTRUE;
}
#endif // #ifdef MyAnalysis_cxx