15 |
|
#include <TChain.h> |
16 |
|
#include <TFile.h> |
17 |
|
#include <TH1.h> |
18 |
< |
const Int_t kMaxtop = 1; |
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); |
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_njets; |
28 |
> |
vector<float> top_muon_d0; |
29 |
> |
vector<float> top_muon_d0Error; |
30 |
> |
vector<float> top_muon_old_reliso; |
31 |
> |
vector<float> top_muon_new_reliso; |
32 |
> |
vector<float> top_muon_ptrel; |
33 |
> |
|
34 |
> |
// List of branches |
35 |
> |
TBranch *b_top_njets; |
36 |
> |
TBranch *b_top_muon_d0; |
37 |
> |
TBranch *b_top_muon_d0Error; |
38 |
> |
TBranch *b_top_muon_old_reliso; |
39 |
> |
TBranch *b_top_muon_new_reliso; |
40 |
> |
|
41 |
> |
qcd(TTree *tree=0); |
42 |
> |
virtual ~qcd(); |
43 |
> |
virtual Int_t Cut(Long64_t entry); |
44 |
> |
virtual Int_t GetEntry(Long64_t entry); |
45 |
> |
virtual Long64_t LoadTree(Long64_t entry); |
46 |
> |
virtual void Init(TTree *tree); |
47 |
> |
virtual void Loop(); |
48 |
> |
virtual void FitBKG(TString,TH1D*,TH1D*,double, double,double,double,double); |
49 |
> |
virtual Bool_t Notify(); |
50 |
> |
virtual void Show(Long64_t entry = -1); |
51 |
|
}; |
52 |
|
|
53 |
|
#endif |
55 |
|
#ifdef qcd_cxx |
56 |
|
qcd::qcd(TTree *tree) |
57 |
|
{ |
58 |
< |
// if parameter tree is not specified (or zero), connect the file |
59 |
< |
// used to generate this class and read the Tree. |
60 |
< |
/* |
61 |
< |
if (tree == 0) { |
62 |
< |
TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("nominalABCD/ABCD_TTJets_all.root"); |
63 |
< |
if (!f) { |
64 |
< |
f = new TFile("nominalABCD/ABCD_TTJets_all.root"); |
65 |
< |
} |
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); |
58 |
> |
TChain * chain = new TChain("top",""); |
59 |
> |
chain->Add("nominal/ABCD_TTJets_all.root/top"); |
60 |
> |
chain->Add("nominal/ABCD_MuPt15_all.root/top"); |
61 |
> |
chain->Add("nominal/ABCD_WJets_all.root/top"); |
62 |
> |
chain->Add("nominal/ABCD_ZJets_all.root/top"); |
63 |
> |
|
64 |
> |
tree = chain; |
65 |
> |
Init(tree); |
66 |
|
} |
67 |
|
|
68 |
|
qcd::~qcd() |
69 |
|
{ |
70 |
< |
if (!fChain) return; |
71 |
< |
delete fChain->GetCurrentFile(); |
70 |
> |
if (!fChain) return; |
71 |
> |
delete fChain->GetCurrentFile(); |
72 |
|
} |
73 |
|
|
74 |
|
Int_t qcd::GetEntry(Long64_t entry) |
75 |
|
{ |
76 |
< |
// Read contents of entry. |
77 |
< |
if (!fChain) return 0; |
78 |
< |
return fChain->GetEntry(entry); |
76 |
> |
// Read contents of entry. |
77 |
> |
if (!fChain) return 0; |
78 |
> |
return fChain->GetEntry(entry); |
79 |
|
} |
80 |
|
Long64_t qcd::LoadTree(Long64_t entry) |
81 |
|
{ |
82 |
< |
// Set the environment to read one entry |
83 |
< |
if (!fChain) return -5; |
84 |
< |
Long64_t centry = fChain->LoadTree(entry); |
85 |
< |
if (centry < 0) return centry; |
86 |
< |
if (!fChain->InheritsFrom(TChain::Class())) return centry; |
87 |
< |
TChain *chain = (TChain*)fChain; |
88 |
< |
if (chain->GetTreeNumber() != fCurrent) { |
89 |
< |
fCurrent = chain->GetTreeNumber(); |
90 |
< |
Notify(); |
91 |
< |
} |
92 |
< |
return centry; |
82 |
> |
// Set the environment to read one entry |
83 |
> |
if (!fChain) return -5; |
84 |
> |
Long64_t centry = fChain->LoadTree(entry); |
85 |
> |
if (centry < 0) return centry; |
86 |
> |
if (!fChain->InheritsFrom(TChain::Class())) return centry; |
87 |
> |
TChain *chain = (TChain*)fChain; |
88 |
> |
if (chain->GetTreeNumber() != fCurrent) { |
89 |
> |
fCurrent = chain->GetTreeNumber(); |
90 |
> |
Notify(); |
91 |
> |
} |
92 |
> |
return centry; |
93 |
|
} |
94 |
|
|
95 |
|
void qcd::Init(TTree *tree) |
96 |
|
{ |
97 |
< |
// The Init() function is called when the selector needs to initialize |
98 |
< |
// a new tree or chain. Typically here the branch addresses and branch |
99 |
< |
// pointers of the tree will be set. |
100 |
< |
// It is normally not necessary to make changes to the generated |
101 |
< |
// code, but the routine can be extended by the user if needed. |
102 |
< |
// Init() will be called many times when running on PROOF |
103 |
< |
// (once per file to be processed). |
104 |
< |
|
105 |
< |
// Set branch addresses and branch pointers |
106 |
< |
if (!tree) return; |
107 |
< |
fChain = tree; |
108 |
< |
fCurrent = -1; |
109 |
< |
fChain->SetMakeClass(1); |
110 |
< |
|
111 |
< |
fChain->SetBranchAddress("top.event", &top_event, &b_top_event); |
112 |
< |
fChain->SetBranchAddress("top.run", &top_run, &b_top_run); |
113 |
< |
fChain->SetBranchAddress("top.dataType", &top_dataType, &b_top_dataType); |
114 |
< |
fChain->SetBranchAddress("top.njets", &top_njets, &b_top_njets); |
115 |
< |
fChain->SetBranchAddress("top.nmuons", &top_nmuons, &b_top_nmuons); |
116 |
< |
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(); |
97 |
> |
// The Init() function is called when the selector needs to initialize |
98 |
> |
// a new tree or chain. Typically here the branch addresses and branch |
99 |
> |
// pointers of the tree will be set. |
100 |
> |
// It is normally not necessary to make changes to the generated |
101 |
> |
// code, but the routine can be extended by the user if needed. |
102 |
> |
// Init() will be called many times when running on PROOF |
103 |
> |
// (once per file to be processed). |
104 |
> |
|
105 |
> |
// Set branch addresses and branch pointers |
106 |
> |
if (!tree) return; |
107 |
> |
fChain = tree; |
108 |
> |
fCurrent = -1; |
109 |
> |
fChain->SetMakeClass(1); |
110 |
> |
|
111 |
> |
fChain->SetBranchAddress("top.njets", &top_njets, &b_top_njets); |
112 |
> |
fChain->SetBranchAddress("top.muon_d0", &top_muon_d0, &b_top_muon_d0); |
113 |
> |
fChain->SetBranchAddress("top.muon_d0Error", &top_muon_d0Error, &b_top_muon_d0Error); |
114 |
> |
fChain->SetBranchAddress("top.muon_old_reliso", &top_muon_old_reliso, &b_top_muon_old_reliso); |
115 |
> |
fChain->SetBranchAddress("top.muon_new_reliso", &top_muon_new_reliso, &b_top_muon_new_reliso); |
116 |
> |
Notify(); |
117 |
|
} |
118 |
|
|
119 |
|
Bool_t qcd::Notify() |
120 |
|
{ |
121 |
< |
// The Notify() function is called when a new file is opened. This |
122 |
< |
// can be either for a new TTree in a TChain or when when a new TTree |
123 |
< |
// is started when using PROOF. It is normally not necessary to make changes |
124 |
< |
// to the generated code, but the routine can be extended by the |
125 |
< |
// user if needed. The return value is currently not used. |
121 |
> |
// The Notify() function is called when a new file is opened. This |
122 |
> |
// can be either for a new TTree in a TChain or when when a new TTree |
123 |
> |
// is started when using PROOF. It is normally not necessary to make changes |
124 |
> |
// to the generated code, but the routine can be extended by the |
125 |
> |
// user if needed. The return value is currently not used. |
126 |
|
|
127 |
< |
return kTRUE; |
127 |
> |
return kTRUE; |
128 |
|
} |
129 |
|
|
130 |
|
void qcd::Show(Long64_t entry) |
131 |
|
{ |
132 |
< |
// Print contents of entry. |
133 |
< |
// If entry is not specified, print current entry |
134 |
< |
if (!fChain) return; |
135 |
< |
fChain->Show(entry); |
132 |
> |
// Print contents of entry. |
133 |
> |
// If entry is not specified, print current entry |
134 |
> |
if (!fChain) return; |
135 |
> |
fChain->Show(entry); |
136 |
|
} |
137 |
|
|
138 |
|
Int_t qcd::Cut(Long64_t entry) |
139 |
|
{ |
140 |
< |
// This function may be called from Loop. |
141 |
< |
// returns 1 if entry is accepted. |
142 |
< |
// returns -1 otherwise. |
143 |
< |
return 1; |
140 |
> |
// This function may be called from Loop. |
141 |
> |
// returns 1 if entry is accepted. |
142 |
> |
// returns -1 otherwise. |
143 |
> |
return 1; |
144 |
|
} |
145 |
|
|
146 |
|
#endif // #ifdef qcd_cxx |