ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Jeng/scripts/qcd.h
Revision: 1.1
Committed: Tue Apr 14 21:46:09 2009 UTC (16 years ago) by jengbou
Content type: text/plain
Branch: MAIN
Log Message:
QCD extrapolation fitting

File Contents

# Content
1 //////////////////////////////////////////////////////////
2 // This class has been automatically generated on
3 // Tue Apr 7 16:30:17 2009
4 // from TTree top/top
5 // found on file: nominal/ABCD_TTJets_all.root
6 //////////////////////////////////////////////////////////
7
8 #ifndef qcd_h
9 #define qcd_h
10
11 #include <vector>
12 using namespace std;
13
14 #include <TROOT.h>
15 #include <TChain.h>
16 #include <TFile.h>
17 #include <TH1.h>
18 const Int_t kMaxtop = 1;
19
20 class qcd {
21 public :
22 TTree *fChain; //!pointer to the analyzed TTree or TChain
23 Int_t fCurrent; //!current Tree number in a TChain
24
25 // Declaration of leaf types
26 //BooEventNtuple *top.;
27 Int_t top_event;
28 Int_t top_run;
29 Int_t top_dataType;
30 Int_t top_njets;
31 Int_t top_nmuons;
32 Int_t top_nvertices;
33 Int_t top_ngenjets;
34 vector<float> top_jet_pt;
35 vector<float> top_jet_eta;
36 vector<float> top_jet_phi;
37 vector<float> top_jet_e;
38 vector<float> top_jet_et;
39 vector<int> top_jet_ntrks;
40 vector<int> top_jet_flavour;
41 vector<float> top_jetcorrection;
42 vector<float> top_genjet_pt;
43 vector<float> top_genjet_eta;
44 vector<float> top_genjet_phi;
45 vector<float> top_genjet_e;
46 vector<float> top_muon_px;
47 vector<float> top_muon_py;
48 vector<float> top_muon_pz;
49 vector<float> top_muon_e;
50 vector<float> top_muon_normchi2;
51 vector<float> top_muon_d0;
52 vector<float> top_muon_d0Error;
53 vector<float> top_muon_old_reliso;
54 vector<float> top_muon_new_reliso;
55 vector<float> top_muon_ptrel;
56 vector<float> top_MET;
57 vector<float> top_Ht;
58 vector<float> top_genmuon_px;
59 vector<float> top_genmuon_py;
60 vector<float> top_genmuon_pz;
61 vector<float> top_genmuon_e;
62 vector<int> top_genmuon_pdg;
63 vector<int> top_genmoun_motherpdg;
64 vector<float> top_gentop_px;
65 vector<float> top_gentop_py;
66 vector<float> top_gentop_pz;
67 vector<float> top_gentop_e;
68 vector<float> top_gentop_charge;
69 vector<int> top_gentop_hadronic;
70 vector<float> top_gennu_px;
71 vector<float> top_gennu_py;
72 vector<float> top_gennu_pz;
73 vector<float> top_gennu_e;
74 vector<int> top_gennu_pdg;
75
76 // List of branches
77 TBranch *b_top_event;
78 TBranch *b_top_run;
79 TBranch *b_top_dataType;
80 TBranch *b_top_njets;
81 TBranch *b_top_nmuons;
82 TBranch *b_top_nvertices;
83 TBranch *b_top_ngenjets;
84 TBranch *b_top_jet_pt;
85 TBranch *b_top_jet_eta;
86 TBranch *b_top_jet_phi;
87 TBranch *b_top_jet_e;
88 TBranch *b_top_jet_et;
89 TBranch *b_top_jet_ntrks;
90 TBranch *b_top_jet_flavour;
91 TBranch *b_top_jetcorrection;
92 TBranch *b_top_genjet_pt;
93 TBranch *b_top_genjet_eta;
94 TBranch *b_top_genjet_phi;
95 TBranch *b_top_genjet_e;
96 TBranch *b_top_muon_px;
97 TBranch *b_top_muon_py;
98 TBranch *b_top_muon_pz;
99 TBranch *b_top_muon_e;
100 TBranch *b_top_muon_normchi2;
101 TBranch *b_top_muon_d0;
102 TBranch *b_top_muon_d0Error;
103 TBranch *b_top_muon_old_reliso;
104 TBranch *b_top_muon_new_reliso;
105 TBranch *b_top_muon_ptrel;
106 TBranch *b_top_MET;
107 TBranch *b_top_Ht;
108 TBranch *b_top_genmuon_px;
109 TBranch *b_top_genmuon_py;
110 TBranch *b_top_genmuon_pz;
111 TBranch *b_top_genmuon_e;
112 TBranch *b_top_genmuon_pdg;
113 TBranch *b_top_genmoun_motherpdg;
114 TBranch *b_top_gentop_px;
115 TBranch *b_top_gentop_py;
116 TBranch *b_top_gentop_pz;
117 TBranch *b_top_gentop_e;
118 TBranch *b_top_gentop_charge;
119 TBranch *b_top_gentop_hadronic;
120 TBranch *b_top_gennu_px;
121 TBranch *b_top_gennu_py;
122 TBranch *b_top_gennu_pz;
123 TBranch *b_top_gennu_e;
124 TBranch *b_top_gennu_pdg;
125
126 qcd(TTree *tree=0);
127 virtual ~qcd();
128 virtual Int_t Cut(Long64_t entry);
129 virtual Int_t GetEntry(Long64_t entry);
130 virtual Long64_t LoadTree(Long64_t entry);
131 virtual void Init(TTree *tree);
132 virtual void Loop();
133 virtual void FitBKG(TString,TH1D*,TH1D*,TCanvas*,double, double,double,double,double,double);
134 virtual Bool_t Notify();
135 virtual void Show(Long64_t entry = -1);
136 };
137
138 #endif
139
140 #ifdef qcd_cxx
141 qcd::qcd(TTree *tree)
142 {
143 // if parameter tree is not specified (or zero), connect the file
144 // used to generate this class and read the Tree.
145 /*
146 if (tree == 0) {
147 TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("nominalABCD/ABCD_TTJets_all.root");
148 if (!f) {
149 f = new TFile("nominalABCD/ABCD_TTJets_all.root");
150 }
151 tree = (TTree*)gDirectory->Get("top");
152
153 }
154 */
155 TChain * chain = new TChain("top","");
156 chain->Add("nominal/ABCD_TTJets_all.root/top");
157 chain->Add("nominal/ABCD_MuPt15_all.root/top");
158 chain->Add("nominal/ABCD_WJets_all.root/top");
159 chain->Add("nominal/ABCD_ZJets_all.root/top");
160
161 tree = chain;
162
163
164 Init(tree);
165 }
166
167 qcd::~qcd()
168 {
169 if (!fChain) return;
170 delete fChain->GetCurrentFile();
171 }
172
173 Int_t qcd::GetEntry(Long64_t entry)
174 {
175 // Read contents of entry.
176 if (!fChain) return 0;
177 return fChain->GetEntry(entry);
178 }
179 Long64_t qcd::LoadTree(Long64_t entry)
180 {
181 // Set the environment to read one entry
182 if (!fChain) return -5;
183 Long64_t centry = fChain->LoadTree(entry);
184 if (centry < 0) return centry;
185 if (!fChain->InheritsFrom(TChain::Class())) return centry;
186 TChain *chain = (TChain*)fChain;
187 if (chain->GetTreeNumber() != fCurrent) {
188 fCurrent = chain->GetTreeNumber();
189 Notify();
190 }
191 return centry;
192 }
193
194 void qcd::Init(TTree *tree)
195 {
196 // The Init() function is called when the selector needs to initialize
197 // a new tree or chain. Typically here the branch addresses and branch
198 // pointers of the tree will be set.
199 // It is normally not necessary to make changes to the generated
200 // code, but the routine can be extended by the user if needed.
201 // Init() will be called many times when running on PROOF
202 // (once per file to be processed).
203
204 // Set branch addresses and branch pointers
205 if (!tree) return;
206 fChain = tree;
207 fCurrent = -1;
208 fChain->SetMakeClass(1);
209
210 fChain->SetBranchAddress("top.event", &top_event, &b_top_event);
211 fChain->SetBranchAddress("top.run", &top_run, &b_top_run);
212 fChain->SetBranchAddress("top.dataType", &top_dataType, &b_top_dataType);
213 fChain->SetBranchAddress("top.njets", &top_njets, &b_top_njets);
214 fChain->SetBranchAddress("top.nmuons", &top_nmuons, &b_top_nmuons);
215 fChain->SetBranchAddress("top.nvertices", &top_nvertices, &b_top_nvertices);
216 fChain->SetBranchAddress("top.ngenjets", &top_ngenjets, &b_top_ngenjets);
217 fChain->SetBranchAddress("top.jet_pt", &top_jet_pt, &b_top_jet_pt);
218 fChain->SetBranchAddress("top.jet_eta", &top_jet_eta, &b_top_jet_eta);
219 fChain->SetBranchAddress("top.jet_phi", &top_jet_phi, &b_top_jet_phi);
220 fChain->SetBranchAddress("top.jet_e", &top_jet_e, &b_top_jet_e);
221 fChain->SetBranchAddress("top.jet_et", &top_jet_et, &b_top_jet_et);
222 fChain->SetBranchAddress("top.jet_ntrks", &top_jet_ntrks, &b_top_jet_ntrks);
223 fChain->SetBranchAddress("top.jet_flavour", &top_jet_flavour, &b_top_jet_flavour);
224 fChain->SetBranchAddress("top.jetcorrection", &top_jetcorrection, &b_top_jetcorrection);
225 fChain->SetBranchAddress("top.genjet_pt", &top_genjet_pt, &b_top_genjet_pt);
226 fChain->SetBranchAddress("top.genjet_eta", &top_genjet_eta, &b_top_genjet_eta);
227 fChain->SetBranchAddress("top.genjet_phi", &top_genjet_phi, &b_top_genjet_phi);
228 fChain->SetBranchAddress("top.genjet_e", &top_genjet_e, &b_top_genjet_e);
229 fChain->SetBranchAddress("top.muon_px", &top_muon_px, &b_top_muon_px);
230 fChain->SetBranchAddress("top.muon_py", &top_muon_py, &b_top_muon_py);
231 fChain->SetBranchAddress("top.muon_pz", &top_muon_pz, &b_top_muon_pz);
232 fChain->SetBranchAddress("top.muon_e", &top_muon_e, &b_top_muon_e);
233 fChain->SetBranchAddress("top.muon_normchi2", &top_muon_normchi2, &b_top_muon_normchi2);
234 fChain->SetBranchAddress("top.muon_d0", &top_muon_d0, &b_top_muon_d0);
235 fChain->SetBranchAddress("top.muon_d0Error", &top_muon_d0Error, &b_top_muon_d0Error);
236 fChain->SetBranchAddress("top.muon_old_reliso", &top_muon_old_reliso, &b_top_muon_old_reliso);
237 fChain->SetBranchAddress("top.muon_new_reliso", &top_muon_new_reliso, &b_top_muon_new_reliso);
238 fChain->SetBranchAddress("top.muon_ptrel", &top_muon_ptrel, &b_top_muon_ptrel);
239 fChain->SetBranchAddress("top.MET", &top_MET, &b_top_MET);
240 fChain->SetBranchAddress("top.Ht", &top_Ht, &b_top_Ht);
241 fChain->SetBranchAddress("top.genmuon_px", &top_genmuon_px, &b_top_genmuon_px);
242 fChain->SetBranchAddress("top.genmuon_py", &top_genmuon_py, &b_top_genmuon_py);
243 fChain->SetBranchAddress("top.genmuon_pz", &top_genmuon_pz, &b_top_genmuon_pz);
244 fChain->SetBranchAddress("top.genmuon_e", &top_genmuon_e, &b_top_genmuon_e);
245 fChain->SetBranchAddress("top.genmuon_pdg", &top_genmuon_pdg, &b_top_genmuon_pdg);
246 fChain->SetBranchAddress("top.genmoun_motherpdg", &top_genmoun_motherpdg, &b_top_genmoun_motherpdg);
247 fChain->SetBranchAddress("top.gentop_px", &top_gentop_px, &b_top_gentop_px);
248 fChain->SetBranchAddress("top.gentop_py", &top_gentop_py, &b_top_gentop_py);
249 fChain->SetBranchAddress("top.gentop_pz", &top_gentop_pz, &b_top_gentop_pz);
250 fChain->SetBranchAddress("top.gentop_e", &top_gentop_e, &b_top_gentop_e);
251 fChain->SetBranchAddress("top.gentop_charge", &top_gentop_charge, &b_top_gentop_charge);
252 fChain->SetBranchAddress("top.gentop_hadronic", &top_gentop_hadronic, &b_top_gentop_hadronic);
253 fChain->SetBranchAddress("top.gennu_px", &top_gennu_px, &b_top_gennu_px);
254 fChain->SetBranchAddress("top.gennu_py", &top_gennu_py, &b_top_gennu_py);
255 fChain->SetBranchAddress("top.gennu_pz", &top_gennu_pz, &b_top_gennu_pz);
256 fChain->SetBranchAddress("top.gennu_e", &top_gennu_e, &b_top_gennu_e);
257 fChain->SetBranchAddress("top.gennu_pdg", &top_gennu_pdg, &b_top_gennu_pdg);
258 Notify();
259 }
260
261 Bool_t qcd::Notify()
262 {
263 // The Notify() function is called when a new file is opened. This
264 // can be either for a new TTree in a TChain or when when a new TTree
265 // is started when using PROOF. It is normally not necessary to make changes
266 // to the generated code, but the routine can be extended by the
267 // user if needed. The return value is currently not used.
268
269 return kTRUE;
270 }
271
272 void qcd::Show(Long64_t entry)
273 {
274 // Print contents of entry.
275 // If entry is not specified, print current entry
276 if (!fChain) return;
277 fChain->Show(entry);
278 }
279
280 Int_t qcd::Cut(Long64_t entry)
281 {
282 // This function may be called from Loop.
283 // returns 1 if entry is accepted.
284 // returns -1 otherwise.
285 return 1;
286 }
287
288 #endif // #ifdef qcd_cxx