1 |
#include <fstream>
|
2 |
#include <iomanip>
|
3 |
#include <iostream>
|
4 |
#include <string.h>
|
5 |
#include <fstream>
|
6 |
|
7 |
#include <TFile.h>
|
8 |
#include <TH1.h>
|
9 |
#include <TTree.h>
|
10 |
#include <TCanvas.h>
|
11 |
#include <TF1.h>
|
12 |
#include <TStyle.h>
|
13 |
|
14 |
int TreeReader(char *infile = "temp.root")
|
15 |
{
|
16 |
|
17 |
TFile *outf = new TFile("eidRobustTight.root","RECREATE");
|
18 |
|
19 |
|
20 |
// TH1D * hEt3;
|
21 |
TH1D * hlepton_calo_iso = new TH1D("hlepton_calo_iso", "lepton calo iso", 120, 0., 120.);
|
22 |
TH1D * hlepton_track_iso = new TH1D("hlepton_track_iso", "lepton track iso", 120, 0., 120.);
|
23 |
// TH1 * hmuon_isGood_AllGlobalMuons = new TH1( "hmuon_isGood_AllGlobalMuons", "muon isGood AllGlobalMuons", 120, 0., 120.);
|
24 |
//TH1 * hmuon_isGood_AllStandAloneMuons = new TH1( "hmuon_isGood_AllStandAloneMuons", "muon isGood AllStandAloneMuons", 120, 0., 120.);
|
25 |
|
26 |
|
27 |
TH1D * hMt = new TH1D( "hMt", "Mt (all) ", 100, 0., 90.);
|
28 |
TH1D * hMt_nominal = new TH1D( "hMt_nominal", "Mt (nominal selection)", 100, 0., 90.);
|
29 |
TH1D * hMt_reversed = new TH1D( "hMt_reversed", "Mt (reversed selection)", 100, 0., 90.);
|
30 |
|
31 |
|
32 |
TH1D * hht = new TH1D( "hht", "ht (all) ", 500, 0., 2000.);
|
33 |
TH1D * hht_nominal = new TH1D( "hht_nominal", "ht (nominal) ", 500, 0., 2000.);
|
34 |
TH1D * hht_reversed = new TH1D( "hht_reversed", "ht (reversed) ", 500, 0., 2000.);
|
35 |
|
36 |
TH1D * hM123inv = new TH1D( "hM123inv", "M123inv (all) ", 500, 0., 4500.);
|
37 |
TH1D * hM123inv_nominal = new TH1D( "hM123inv_nominal", "M123inv (nominal selection)", 500, 0., 4500.);
|
38 |
TH1D * hM123inv_reversed = new TH1D( "hM123inv_reversed", "M123inv (reversed selection)", 500, 0., 4500.);
|
39 |
|
40 |
TH1D * hgetHt3 = new TH1D( "hgetHt3", "Ht3 (all) ", 100, 0., 900.);
|
41 |
TH1D * hgetHt3_nominal = new TH1D( "hgetHt3_nominal", "Ht3 (nominal selection)", 100, 0., 900.);
|
42 |
TH1D * hgetHt3_reversed = new TH1D( "hgetHt3_reversed", "Ht3 (reversed selection)", 100, 0., 900.);
|
43 |
|
44 |
|
45 |
TH1D * hktMinPrime = new TH1D( "hktMinPrime", "ktMinPrime (all) ", 100, 0., 25.);
|
46 |
TH1D * hktMinPrime_nominal = new TH1D( "hktMinPrime_nominal", "ktMinPrime (nominal selection)", 100, 0., 25.);
|
47 |
TH1D * hktMinPrime_reversed = new TH1D( "hktMinPrime_reversed", "ktMinPrime (reversed selection)", 100, 0., 25.);
|
48 |
|
49 |
|
50 |
TH1D * hht2p = new TH1D( "hht2p", "ht2p (all) ", 100, 0., 4.);
|
51 |
TH1D * hht2p_nominal = new TH1D( "hht2p_nominal", "ht2p (nominal selection)", 100, 0., 4.);
|
52 |
TH1D * hht2p_reversed = new TH1D( "hht2p_reversed", "ht2p (reversed selection)", 100, 0., 4.);
|
53 |
|
54 |
TH1D * hcentrality = new TH1D( "hcentrality", "centrality (all) ", 100, 0., 1.);
|
55 |
TH1D * hcentrality_nominal = new TH1D( "hcentrality_nominal", "centrality (nominal selection)", 100, 0., 1.);
|
56 |
TH1D * hcentrality_reversed = new TH1D( "hcentrality_reversed", "centrality (reversed selection)", 100, 0., 1.);
|
57 |
|
58 |
TH1D * hsphericity = new TH1D( "hsphericity", "sphericity (all) ", 100, 0., 1.);
|
59 |
TH1D * hsphericity_nominal = new TH1D( "hsphericity_nominal", "sphericity (nominal selection)", 100, 0., 1.);
|
60 |
TH1D * hsphericity_reversed = new TH1D( "hsphericity_reversed", "sphericity (reversed selection)", 100, 0., 1.);
|
61 |
|
62 |
TH1D * hhtPlusLepton = new TH1D( "hhtPlusLepton", "htPlusLepton (all) ", 500, 0., 3000.);
|
63 |
TH1D * hhtPlusLepton_nominal = new TH1D( "hhtPlusLepton_nominal", "htPlusLepton (nominal selection)", 500, 0., 3000.);
|
64 |
TH1D * hhtPlusLepton_reversed = new TH1D( "hhtPlusLepton_reversed", "htPlusLepton (reversed selection)", 500, 0., 3000.);
|
65 |
|
66 |
TH1D * hdPhiLMet = new TH1D( "hdPhiLMet", "dPhiLMet (all) ", 100, 0., 3.5);
|
67 |
TH1D * hdPhiLMet_nominal = new TH1D( "hdPhiLMet_nominal", "dPhiLMet (nominal selection)", 100, 0., 3.5);
|
68 |
TH1D * hdPhiLMet_reversed = new TH1D( "hdPhiLMet_reversed", "dPhiLMet (reversed selection)", 100, 0., 3.5);
|
69 |
|
70 |
TH1D * hDphiJMET = new TH1D( "hDphiJMET", "DphiJMET (all) ", 100, 0., 3.5);
|
71 |
TH1D * hDphiJMET_nominal = new TH1D( "hDphiJMET_nominal", "DphiJMET (nominal selection)", 100, 0., 3.5);
|
72 |
TH1D * hDphiJMET_reversed = new TH1D( "hDphiJMET_reversed", "DphiJMET (reversed selection)", 100, 0., 3.5);
|
73 |
|
74 |
|
75 |
TH1D * haplanarity = new TH1D( "haplanarity", "aplanarity (all) ", 100, 0., 0.5);
|
76 |
TH1D * haplanarity_nominal = new TH1D( "haplanarity_nominal", "aplanarity (nominal selection)", 100, 0., 0.5);
|
77 |
TH1D * haplanarity_reversed = new TH1D( "haplanarity_reversed", "aplanarity (reversed selection)", 100, 0., 0.5);
|
78 |
|
79 |
TH1D * hW_MT = new TH1D( "hW_MT", "W_MT (all) ", 500, 0., 5000);
|
80 |
TH1D * hW_MT_nominal = new TH1D( "hW_MT_nominal", "W_MT (nominal selection)", 500, 0., 5000);
|
81 |
TH1D * hW_MT_reversed = new TH1D( "hW_MT_reversed", "W_MT (reversed selection)", 500, 0., 5000);
|
82 |
|
83 |
TH1D * hmetHtPlusLepton = new TH1D( "hmetHtPlusLepton", "metHtPlusLepton (all) ", 500, 0., 4000.);
|
84 |
TH1D * hmetHtPlusLepton_nominal = new TH1D( "hmetHtPlusLepton_nominal", "metHtPlusLepton (nominal selection)", 500, 0., 4000.);
|
85 |
TH1D * hmetHtPlusLepton_reversed = new TH1D( "hmetHtPlusLepton_reversed", "metHtPlusLepton (reversed selection)", 500, 0., 4000.);
|
86 |
|
87 |
|
88 |
|
89 |
TFile *fin = TFile::Open(infile);
|
90 |
TTree * t1 = (TTree*)fin->Get("ttljets");
|
91 |
|
92 |
Double_t lepton_track_iso, lepton_calo_iso;
|
93 |
Double_t ht, Mt, M123inv,getHt3, ktMinPrime, ht2p,centrality,aplanarity, sphericity,htPlusLepton;
|
94 |
Double_t dPhiLMet,DphiJMET,W_MT,metHtPlusLepton,leptonJetDeltaR,muon_track_Chi2,muon_track_nChi2,muon_track_ndof,lepton_pt;
|
95 |
Bool_t muon_isGood_AllGlobalMuons,muon_isGood_TMLastStationTight,muon_isGood_TMLastStationLoose;
|
96 |
Float_t eidRobustLoose,eidRobustTight;
|
97 |
Bool_t muon_isGood_TM2DCompatibilityTight,muon_isGood_TM2DCompatibilityLoose;
|
98 |
|
99 |
t1->SetBranchAddress("lepton_track_iso",&lepton_track_iso);
|
100 |
t1->SetBranchAddress("lepton_calo_iso",&lepton_calo_iso);
|
101 |
t1->SetBranchAddress("ht",&ht);
|
102 |
t1->SetBranchAddress("getMt",&Mt);
|
103 |
t1->SetBranchAddress("getM123inv",&M123inv);
|
104 |
t1->SetBranchAddress("getHt3",&getHt3);
|
105 |
t1->SetBranchAddress("ktMinPrime",&ktMinPrime);
|
106 |
t1->SetBranchAddress("ht2p",&ht2p);
|
107 |
t1->SetBranchAddress("centrality",¢rality);
|
108 |
t1->SetBranchAddress("aplanarity",&aplanarity);
|
109 |
t1->SetBranchAddress("sphericity",&sphericity);
|
110 |
t1->SetBranchAddress("htPlusLepton",&htPlusLepton);
|
111 |
t1->SetBranchAddress("dPhiLMet",&dPhiLMet);
|
112 |
t1->SetBranchAddress("DphiJMET",&DphiJMET);
|
113 |
t1->SetBranchAddress("W_MT",&W_MT);
|
114 |
t1->SetBranchAddress("metHtPlusLepton",&metHtPlusLepton);
|
115 |
t1->SetBranchAddress("muon_isGood_AllGlobalMuons",&muon_isGood_AllGlobalMuons);
|
116 |
t1->SetBranchAddress("leptonJetDeltaR",&leptonJetDeltaR);
|
117 |
t1->SetBranchAddress("muon_track_nChi2",&muon_track_nChi2);
|
118 |
t1->SetBranchAddress("muon_track_ndof",&muon_track_ndof);
|
119 |
t1->SetBranchAddress("muon_track_chi2",&muon_track_Chi2);
|
120 |
t1->SetBranchAddress("muon_isGood_TMLastStationTight",&muon_isGood_TMLastStationTight);
|
121 |
t1->SetBranchAddress("muon_isGood_TMLastStationLoose",&muon_isGood_TMLastStationLoose);
|
122 |
t1->SetBranchAddress("muon_isGood_TM2DCompatibilityTight",&muon_isGood_TM2DCompatibilityTight);
|
123 |
t1->SetBranchAddress("muon_isGood_TM2DCompatibilityLoose",&muon_isGood_TM2DCompatibilityLoose);
|
124 |
t1->SetBranchAddress("lepton_pt",&lepton_pt);
|
125 |
t1->SetBranchAddress("eidRobustLoose",&eidRobustLoose);
|
126 |
t1->SetBranchAddress("eidRobustTight",&eidRobustTight);
|
127 |
|
128 |
|
129 |
Int_t n_gen = (Int_t)t1->GetEntries();
|
130 |
cout<<"No of entries from trees "<<n_gen<<endl;
|
131 |
bool leptonid_cut;
|
132 |
|
133 |
|
134 |
for(Int_t i=0; i<n_gen; i++){
|
135 |
t1->GetEntry(i);
|
136 |
|
137 |
hht->Fill(ht);
|
138 |
hMt->Fill(Mt);
|
139 |
hM123inv->Fill(M123inv);
|
140 |
hgetHt3->Fill(getHt3);
|
141 |
hktMinPrime->Fill(ktMinPrime);
|
142 |
hht2p->Fill(ht2p);
|
143 |
haplanarity->Fill(aplanarity);
|
144 |
hcentrality->Fill(centrality);
|
145 |
hsphericity->Fill(sphericity);
|
146 |
hdPhiLMet->Fill(dPhiLMet);
|
147 |
hDphiJMET->Fill(DphiJMET);
|
148 |
hW_MT->Fill(W_MT);
|
149 |
hhtPlusLepton->Fill(htPlusLepton);
|
150 |
hmetHtPlusLepton->Fill(metHtPlusLepton);
|
151 |
//leptonid_cut = (muon_isGood_TM2DCompatibilityLoose && (1.0/(1.0+(lepton_calo_iso+lepton_track_iso)/lepton_pt)) > 0.67 );
|
152 |
//leptonid_cut = (muon_isGood_TMLastStationLoose && muon_track_nChi2 < 5 );
|
153 |
leptonid_cut = (eidRobustTight == 1);
|
154 |
if(leptonid_cut){
|
155 |
hht_nominal->Fill(ht);
|
156 |
hMt_nominal->Fill(Mt);
|
157 |
hM123inv_nominal->Fill(M123inv);
|
158 |
hgetHt3_nominal->Fill(getHt3);
|
159 |
hktMinPrime_nominal->Fill(ktMinPrime);
|
160 |
hht2p_nominal->Fill(ht2p);
|
161 |
haplanarity_nominal->Fill(aplanarity);
|
162 |
hcentrality_nominal->Fill(centrality);
|
163 |
hsphericity_nominal->Fill(sphericity);
|
164 |
hdPhiLMet_nominal->Fill(dPhiLMet);
|
165 |
hDphiJMET_nominal->Fill(DphiJMET);
|
166 |
hW_MT_nominal->Fill(W_MT);
|
167 |
hhtPlusLepton_nominal->Fill(htPlusLepton);
|
168 |
hmetHtPlusLepton_nominal->Fill(metHtPlusLepton);
|
169 |
}
|
170 |
// hlepton_iso->Fill(lepton_calo_iso);
|
171 |
if(!leptonid_cut){
|
172 |
hht_reversed->Fill(ht);
|
173 |
hMt_reversed->Fill(Mt);
|
174 |
hM123inv_reversed->Fill(M123inv);
|
175 |
hgetHt3_reversed->Fill(getHt3);
|
176 |
hktMinPrime_reversed->Fill(ktMinPrime);
|
177 |
hht2p_reversed->Fill(ht2p);
|
178 |
haplanarity_reversed->Fill(aplanarity);
|
179 |
hcentrality_reversed->Fill(centrality);
|
180 |
hsphericity_reversed->Fill(sphericity);
|
181 |
hdPhiLMet_reversed->Fill(dPhiLMet);
|
182 |
hDphiJMET_reversed->Fill(DphiJMET);
|
183 |
hW_MT_reversed->Fill(W_MT);
|
184 |
hhtPlusLepton_reversed->Fill(htPlusLepton);
|
185 |
hmetHtPlusLepton_reversed->Fill(metHtPlusLepton);
|
186 |
}
|
187 |
|
188 |
|
189 |
}
|
190 |
|
191 |
outf->Write();
|
192 |
outf->Close();
|
193 |
|
194 |
|
195 |
}
|