ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/pawan/Data/ForRaa.C
Revision: 1.2
Committed: Tue Jul 3 13:40:25 2012 UTC (12 years, 10 months ago) by pawan
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +40 -2 lines
Error occurred while calculating annotation data.
Log Message:
pT dependent smearing factors added

File Contents

# Content
1 #include "/afs/cern.ch/user/p/pawan/scratch0/CMSSW_4_4_2/src/UserCode/HiForest/hiForest.h"
2
3 #include <TChain.h>
4 #include <TTree.h>
5 #include <TSystem.h>
6 #include <TH1.h>
7 #include <TH2.h>
8 #include <TProfile.h>
9 #include <TF1.h>
10 #include <TFile.h>
11 #include <TStyle.h>
12 #include <TStopwatch.h>
13 #include <cstdlib>
14 #include <cmath>
15 #include <iostream>
16 using namespace std;
17
18
19 #ifdef _MAKECINT_
20 //#pragma link off all globals;
21 //#pragma link off all classes;
22 //#pragma link off all functions;
23 #pragma link C++ class HiForest;
24 #pragma link C++ class Hlts;
25 #pragma link C++ class Skims;
26 #pragma link C++ class Evts;
27 #pragma link C++ class Jets;
28 #endif
29
30 const double pi=acos(-1.);
31 const double pi2=2*pi -1;
32
33 const int ncen=7;
34 const char *ccent[ncen]={"0-5%","5-10%","10-30%","30-50%","50-70%","70-90%","pp"};
35
36 //const int knj=7; //! algo 0: ic5, 1: ak3pu
37 //const char *calgo[knj]={"icPu5","akPu2PF","akPu3PF","akPu4PF","akPu2Calo","akPu3Calo","akPu4Calo"};
38
39 const int knj=3; //! algo 0: ic5, 1: ak3pu
40 const char *calgo[knj]={"akPu2PF","akPu3PF","akPu4PF"};
41
42 const int nvtx=4;
43 const int npix=5;
44 const int ketar=4;
45 const int maxruns=62;
46
47 int Run[maxruns];
48 double Lumi[maxruns];
49
50 void LoadRuns (const char */*sp*/);
51 int GetRunIdx (int /*irun*/);
52 int GetCentBin (int /*bin*/);
53 int GetVtxBin (float /*vz*/);
54 int GetPixelBin(int /*hiNpixeltracks*/);
55 int GetEtaBin (float /*eta*/);
56
57
58 class DuplicateEvents {
59 public:
60 DuplicateEvents(TString infname) {
61 inf = TFile::Open(infname);
62 t = (TTree*)inf->Get("hiEvtAnalyzer/HiTree");
63 };
64 ~DuplicateEvents() {
65 delete inf;
66 }
67 void MakeList() {
68 cout << "Starting Making List to check for duplicate events" << endl;
69 evts.clear();
70 occurrence.clear();
71 int run,evt;
72 t->SetBranchAddress("run",&run);
73 t->SetBranchAddress("evt",&evt);
74 for (int i=0;i<t->GetEntries();i++) {
75 t->GetEntry(i);
76 if (i%100000==0) cout <<i<<" / "<<t->GetEntries() << " run: " << run << " evt: " << evt << endl;
77 int occur = (int)FindOccurrences(run,evt);
78 if (occur==0) occurrence.push_back(1);
79 else occurrence.push_back(2);
80 evts.push_back(std::make_pair(run,evt));
81 }
82 }
83 int FindOccurrences(int run, int evt) {
84 int noccur = count(evts.begin(), evts.end(), std::make_pair(run,evt));
85 return noccur;
86 }
87 TFile * inf;
88 TTree * t;
89 vector<pair<int, int> > evts;
90 vector<int> occurrence;
91 };
92
93
94 //! Smearing factor for only akPu's
95 /*
96 //! Reco pT Cut Centrality
97 //! pT>15 GeV 0-5% , 5-10% , 10-30% , 30-50% , 50-70% , 70-90% , pp
98 //! with new pp |vz|<15 cm with full pT hat bins and will be integrated from 80 to 400 GeV in ref pT (in withvtx dir)
99 double smearf[knj][ncen] ={{8.883 , 7.446 , 6.025 , 2.831 , 0.956 , 1.500 , 0.00}, //! akpu2pf
100 {9.905 , 8.865 , 7.354 , 4.664 , 3.163 , 0.000 , 0.00}, //! akpu3pf
101 {11.336 , 10.195 , 8.456 , 5.962 , 4.158 , 1.585 , 0.00}, //! akpu4pf
102 };
103 */
104
105 double ptbins_smear[] = {80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 320, 340, 360, 380, 400};
106 const int bins1 = sizeof(ptbins_smear)/sizeof(double) - 1;
107 const int smbins = bins1;
108 double smearf[knj][ncen][smbins] = {
109 { {10.6069,9.53263,7.99496,6.47572,6.63517,6.43069,4.79561,5.52368,1.51585,4.73694,5.49985,4.34136,2.69882,3.18559,2.75011,0 }, //! 0-5% //! ak2PF
110 {9.5939,7.59408,6.41255,2.52901,0,3.03726,3.73099,5.65377,0,3.46223,0,0,2.48996,5.21187,3.39047,4.0801 }, //! 5-10%
111 {7.52046,7.09926,4.87256,5.56958,6.40448,5.15708,5.45629,3.48318,3.03069,0,5.56163,4.05211,2.18542,0.828933,4.28571,0.963933 }, //! 10-30%
112 {4.15823,4.29915,4.08619,0,4.64429,3.1441,0,2.75549,0,3.51214,1.52933,0,2.96407,2.92293,0,4.12055 }, //! 30-50%
113 {3.40076,1.91548,2.24094,4.40189,0,1.06348,3.58938,2.98547,2.11986,0,0,2.39968,0,0,1.17852,0 }, //! 50-70%
114 {3.46271,1.38165,1.47467,0,3.91275,2.09271,0,0,1.40595,0,2.66064,2.75378,1.6508,0,0,3.06773 }, //! 70-90%
115 { 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,0.00,0.00,0.00,0.00}}, //! pp
116
117 /*
118 { {10.0971,10.0556,11.53382,10.09026,11.04904,11.89586,11.82574,10.04593,6.36579,6.71464,6.78906,7.88803,0,7.553219,7.559386,0}, //! 0-5% //! ak3PF
119 {9.3828,8.2346,8.27719,7.70535,6.25354,7.98441,6.34697,8.95322,8.86133,0,0.097127,0.093448,0,8.376,8.87887,3.3609 }, //! 5-10%
120 {7.486,7.78749,7.84899,7.793231,7.62483,7.73366,6.93853,5.0297,3.58286,0.02722,5.53265,6.9743,0.040309,0,6.25054,0.046698 }, //! 10-30%
121 {5.15368,5.0759,5.3187,4.06908,5.98657,3.83484,3.07333,1.26228,0.50647,3.89258,3.03255,1.04565,1.07938,4.03525,0,4.13655 }, //! 30-50%
122 {3.99394,3.84754,4.03742,4.56218,4.32862,2.39101,3.83596,4.54976,0.041902,0,0,0.09433,0,2.0601,1.49476,0 }, //! 50-70%
123 {2.03394,2.01458,2.79081,0,0.026742,0.0218433,0.021867,0,0,0,0.0281399,0.00403,0.010721,0.048432,0.08341,0.04126 }, //! 70-90%
124 { 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,0.00,0.00,0.00,0.00}}, //! pp
125 */
126
127 { {10.5971,10.8556,11.53382,10.09026,11.04904,12.89586,12.89574,11.24593,6.36579,6.71464,6.98906,6.88803,0,7.553219,7.559386,0}, //! 0-5% //! ak3PF
128 {9.7828,8.5346,8.27719,7.80535,6.05354,7.98441,6.34697,8.95322,8.86133,0,0.097127,0.093448,0,8.376,8.87887,3.3609 }, //! 5-10%
129 {7.986,8.08749,8.78899,8.393231,8.29483,10.23366,7.93853,6.9297,3.58286,0.002722,5.53265,6.9743,0.040309,0,6.25054,0.046698 }, //! 10-30%
130 {6.25368,6.0159,6.1427,3.16908,5.88657,3.83484,3.07333,1.26228,0.50647,3.89258,3.03255,1.04565,1.07938,4.03525,0,4.13655 }, //! 30-50%
131 {4.79394,3.84754,4.53742,4.56218,4.82862,2.79101,3.83596,4.54976,0.041902,0,0,0.09433,0,2.0601,1.49476,0 }, //! 50-70%
132 {2.95394,2.01458,2.99081,0,0.86742,0.818433,0.0021867,0,0,0,0.0281399,0.00403,0.010721,0.048432,0.08341,0.04126 }, //! 70-90%
133 { 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,0.00,0.00,0.00,0.00}}, //! pp
134
135 { {12.2563,11.5695,10.4316,8.80091,6.58487,7.90287,13.62099,13.63562,0.19621,3.12709,4.27031,6.8802,3.91001,3.8079,3.27438,4.06707 }, //! 0-5% //! ak4PF
136 {12.0168,9.35782,8.00736,7.29842,7.97529,6.42666,4.56315,4.51409,5.95295,1.24883,4.64867,3.70103,2.31134,6.32349,4.89873,3.1264 }, //! 5-10%
137 {9.6697,8.94999,13.88295,12.53489,12.92233,15.93666,5.38456,4.00389,4.43362,3.15875,5.23279,4.55506,4.00098,2.07628,4.37486,3.09102 }, //! 10-30%
138 {7.49541,6.63023,5.87943,4.95293,5.67788,4.70276,3.33361,3.45651,2.01514,3.88602,2.04301,2.5694,1.38983,4.30535,2.42315,3.50593 }, //! 30-50%
139 {6.22191,4.93202,5.07923,4.44174,4.10758,2.37307,3.582,4.4269,3.46693,0,3.01783,2.34337,0,1.90033,2.66977,0 }, //! 50-70%
140 {4.56134,3.35514,3.19569,0.1903,0.00174,0.06648,0.045127,0.01317,0.022475,0,0.066526,0.032671,0.082098,0,0.056494,0.098529 }, //! 70-90%
141 { 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,0.00,0.00,0.00,0.00}}, //! pp
142 };
143
144 //! Mean shift
145 double mdiff[knj][ncen][smbins] ={
146 { {0.0466138,0.0335956,0.0410669,0.0214626,0.0212764,0.0102527,0.00735837,0.0150948,0.00857693,0.0144657,0.016494,0.00891602,0.00654143,0.0115819,0.00485879,0.00907028}, //! 0-5% ak2PF
147 {0.03451,0.0209635,0.0196607,0.0182868,0.0160782,0.0148126,0.0154206,0.0154563,0.015108,0.0122203,0.00955594,0.0121442,-0.00145638,0.00384897,0.00753379,0.00716817}, //! 5-10%
148 {0.0327942,0.0296486,0.0294715,0.0244282,0.0178642,0.0167146,0.0159866,0.0218814,0.00932407,0.0112529,0.0132,0.0146015,0.0102656,0.0028168,0.00739276,0.00236583}, //! 10-30%
149 {0.020405,0.0179057,0.0143724,0.0110998,0.0152471,0.00551707,0.0107846,0.0169507,0.00596559,0.0102772,0.0061782,0.00696909,0.0135649,0.00521195,0.0113508,0.00566816}, //! 30-50%
150 {0.0198419,0.0182897,0.0173255,0.0176992,0.00856346,0.00120127,0.0125311,0.00735921,0.0025031,0.0123569,0.00439858,0.00512367,0.00541723,0.00706488,-0.000748277,-0.000551641},//! 50-70%
151 {0.00854647,0.00984675,0.00584471,0.00369465,0.010977,0.00699794,0.0120464,0.00136596,0.0058291,0.00623316,0.0159007,0.00726718,0.00680381,0.00943691,0.00395489,0.0164121}, //! 70-90%
152 { 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,0.00,0.00,0.00,0.00}}, //! pp
153
154 {{0.0275283,0.0160275,0.02755,0.0206593,0.0301418,0.0133881,0.0144465,8.78572e-05,0.00818342,0.0109422,0.00632513,0.00270939,0.00408441,0.00837797,-0.0037446,0.00412363}, //! 0-5% ak3PF
155 {0.0222983,0.0153673,0.00948453,0.0123257,0.0166752,0.0184649,0.0176131,0.0207802,0.0197214,0.00553685,0.00845754,0.0118107,-0.00730062,0.00664508,0.00299364,0.0026263}, //! 5-10%
156 {0.025839,0.0228674,0.0280237,0.0216239,0.0149659,0.0145669,0.0134212,0.0186172,0.00972515,0.00951684,0.0138552,0.0146008,0.00542355,0.00688314,0.00863248,0.00524199}, //! 10-30%
157 {0.0229017,0.019472,0.0171909,0.0162767,0.0133404,0.00681508,0.0162958,0.0126254,0.00831217,0.0121881,0.0081346,0.00847,0.0122618,0.0108246,0.00901532,0.00845671}, //! 30-50%
158 {0.0230601,0.0209836,0.0217522,0.0197152,0.0147748,0.0136688,0.0101818,0.0129468,0.00493681,0.0128581,0.00738484,0.00621325,0.00790799,0.00725496,0.00289834,-0.000387132},//! 50-70%
159 {0.014472,0.0132026,0.00958687,0.0103319,0.0093928,0.00286621,0.00968874,0.00856942,0.0114781,0.00899881,0.014419,0.00767231,0.010763,0.00836527,0.00587088,0.0165011}, //! 70-90%
160 {0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,0.00,0.00,0.00,0.00}}, //! pp
161
162 {{-0.0230864,-0.0174068,0.00241971,-0.00390112,-0.005117,0.00398207,-0.00480783,-0.0194209,-0.00506783,-0.00183988,-0.00425297,-0.0106014,-0.00578606,-0.000967383,-0.0130045,-0.00535274}, //! ak4PF
163 {-0.019231,-0.0157951,-0.0105602,-0.00435889,-0.00425464,-0.00396222,0.0116789,-9.05991e-05,0.0015012,-0.00531197,-0.00483817,0.00190938,-0.0191487,-0.00375295,-0.00938725,-0.00880837},
164 {0.00134224,0.00401467,0.0100971,0.00694209,0.00221646,0.00368696,0.00551653,0.00334269,0.00242603,0.0026049,0.00598705,0.00491709,0.00299436,0.000164628,0.00627947,-0.00392818},
165 {0.0119882,0.0100931,0.00838315,0.00624627,0.0094173,0.00474823,0.00836802,0.00936335,0.00589097,0.00823456,0.0074026,0.00622553,0.00550991,0.0112971,0.00741941,0.00708938},
166 {0.0208756,0.0189031,0.0201291,0.0191174,0.0159798,0.012251,0.00942087,0.00924242,0.00753897,0.0100017,0.00929463,0.00718981,0.00831848,0.00675994,0.00297219,0.00109547},
167 {0.0166439,0.0159987,0.0130083,0.0104476,0.0120092,0.00991774,0.00837511,0.014199,0.011002,0.0101984,0.0153565,0.00764841,0.0101254,0.00801647,0.0104582,0.015758},
168 { 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,0.00,0.00,0.00,0.00}}, //! pp
169 };
170 int GetPtBinSmear(float /*pt*/);
171
172
173
174
175 TStopwatch timer;
176 void ForRaa(const char *ksp="pp")
177 {
178
179 timer.Start();
180
181 const float ketacut=2.;
182 const double kptrecocut=80.;
183 const bool iCountRuns=false;
184
185 //! Load Lib
186 gSystem->Load("/afs/cern.ch/user/p/pawan/scratch0/CMSSW_4_4_2/src/UserCode/HiForest/hiForest_h.so");
187
188 char mrun[6]={0};
189 //! Load Run numbers
190 for(int ir=0;ir<maxruns;ir++){
191 Run[ir]=-999;Lumi[ir]=-999;
192 }
193 if(!iCountRuns)LoadRuns(Form("%s",ksp));
194
195 //! pt binning
196 //! 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
197 //double ptbins[22] ={100.,110.,120.,130.,140.,150.,160.,170.,180.,190.,200.,220.,240.,260.,280.,300.,325.,350.,375.,400.,450.,558.,638.,828};
198
199
200 //! pt binning
201 double ptbins[] ={100, 110, 120, 130, 140, 150, 160, 170, 180, 200, 240, 300};
202 const int bins = sizeof(ptbins)/sizeof(double) - 1;
203
204 //! Define the input file and HiForest
205 //! CMSSW_4_4_2
206
207 TString inname="";
208 bool ispp=false;
209 if(strcmp(ksp,"pbpb")==0){
210 //! merged from prompt reco
211 //inname="rfio:/castor/cern.ch/user/f/frankma/forest2/HiForest-promptskim-hihighpt-hltjet80-pt90-v3_part.root";
212 inname="/d102/yjlee/hiForest2/HiForest-promptskim-hihighpt-hltjet80-pt90-v3_part.root";
213
214 }else if(strcmp(ksp,"pp")==0){
215 //! New production
216 //inname="rfio:/castor/cern.ch/user/f/frankma/forest2/HiForest-ppskim-hihighpt-pt90-v1_v3_part.root";
217 inname="/d102/yjlee/hiForest2PP/HiForest-ppskim-hihighpt-pt90-v1_v3_part.root";
218
219 ispp=true;
220 }
221
222
223 DuplicateEvents dupEvt(inname);
224 if(!ispp){
225 // Check for duplicate events only for PbPb
226 dupEvt.MakeList();
227 }
228
229
230 //! Define the input file and HiForest
231 //! CMSSW_4_4_2
232 HiForest *c = new HiForest(inname,Form("MyForest%s",ksp),ispp,0);
233
234
235 //! Output file
236 //! HIHighPt
237 TFile *fout = 0;
238 if(strcmp(ksp,"pp")==0){
239 fout = new TFile(Form("Output/HLT_Jet60_v1_ppSmearing_HiForest2_%s_pt%0.0f_2012.root",ksp,kptrecocut),"RECREATE");
240 //fout = new TFile(Form("Output/HLT_Jet60_v1_RandomCone_HiForest2_%s_pt%0.0f_2012.root",ksp,kptrecocut),"RECREATE");
241 }else{
242 fout = new TFile(Form("Output/HLT_HIJet80_v1_HiForest2_%s_pt%0.0f_2012.root",ksp,kptrecocut),"RECREATE");
243 }
244
245 std::cout<<"\t"<<std::endl;
246 std::cout<<"\t"<<std::endl;
247 std::cout<<"**************************************************** "<<std::endl;
248 std::cout<<Form("Running for %s ",ksp)<<std::endl;
249 std::cout<<Form("pT cut for %0.3f ",kptrecocut)<<std::endl;
250 std::cout<<Form("eta cut for %0.3f ",ketacut)<<std::endl;
251 std::cout<<"My hiForest Tree : " <<c->GetName()<<"\t Entries "<<c->GetEntries()<<std::endl;
252 std::cout<<"Output file "<<fout->GetName()<<std::endl;
253 std::cout<<"**************************************************** "<<std::endl;
254 std::cout<<"\t"<<std::endl;
255 std::cout<<"\t"<<std::endl;
256
257
258 //! Define event selection cut
259
260 //! Don't want to loop over trees which is not used in the analysis
261 //! event trees
262 //c->hasHltTree=0;
263 //c->hasSkimTree=0;
264 //c->hasEvtTree=0;
265
266 //! jet trees
267 c->hasIcPu5JetTree=0;
268 if(strcmp(ksp,"pp")==0){
269 c->hasAkPu2JetTree=0;
270 c->hasAkPu3JetTree=0;
271 c->hasAkPu4JetTree=0;
272 }else{
273 c->hasAk2JetTree=0;
274 c->hasAk3JetTree=0;
275 c->hasAk4JetTree=0;
276 }
277 c->hasAkPu2CaloJetTree=0;
278 c->hasAkPu3CaloJetTree=0;
279 c->hasAkPu4CaloJetTree=0;
280
281
282 //! photon tree
283 c->hasPhotonTree=0;
284
285 c->hasTrackTree=0;
286 c->hasPixTrackTree=0;
287 c->hasTowerTree=0;
288 c->hasHbheTree=0;
289 c->hasEbTree=0;
290 c->hasGenpTree=0;
291 c->hasGenParticleTree=0;
292
293 //! added by pawan
294 //! Select only the branches you want to use for the analysis
295 //! This increases the speed for running
296
297 //! For Hlt
298 c->hltTree->SetBranchStatus("*",0,0);
299 if(strcmp(ksp,"pp")==0) c->hltTree->SetBranchStatus("HLT_Jet60_v1",1,0);
300 else c->hltTree->SetBranchStatus("HLT_HIJet80_v1",1,0);
301
302 //! for Skim Tree
303 c->skimTree->SetBranchStatus("*",0,0);
304 c->skimTree->SetBranchStatus("pcollisionEventSelection",1,0);
305 c->skimTree->SetBranchStatus("pHBHENoiseFilter",1,0);
306 /*
307 if(ispp){
308 c->skimTree->SetBranchStatus("phiEcalRecHitSpikeFilter",1,0);
309 //c->skimTree->SetBranchStatus("phbheReflagNewTimeEnv",1,0);
310 //c->skimTree->SetBranchStatus("phcalTimingFilter",1,0);
311 //c->skimTree->SetBranchStatus("phfCoincFilter",1,0);
312 //c->skimTree->SetBranchStatus("ppurityFractionFilter",1,0);
313 }
314 */
315
316 //! Evt tree
317 //c->evtTree->SetBranchStatus("*",0,0);
318 //c->evtTree->SetBranchStatus("run",1,0);
319 //c->evtTee->SetBranchStatus("lumi",1,0);
320 //c->evtTree->SetBranchStatus("hiBin",1,0);//! centrality bin
321 //c->evtTree->SetBranchStatus("hiHF",1,0);//! HF
322 //c->evtTree->SetBranchStatus("hiHFplus",1,0); //! HF plus
323 //c->evtTree->SetBranchStatus("hiHFminus",1,0);//! HF minus
324 //c->evtTree->SetBranchStatus("hiZDC",1,0);//!ZDC
325
326 if(c->hasIcPu5JetTree){
327 //! For jets icpu5
328 c->icPu5jetTree->SetBranchStatus("*",0,0);
329 c->icPu5jetTree->SetBranchStatus("nref",1,0);
330 c->icPu5jetTree->SetBranchStatus("rawpt",1,0);
331 c->icPu5jetTree->SetBranchStatus("jtpt",1,0);
332 c->icPu5jetTree->SetBranchStatus("jteta",1,0);
333 c->icPu5jetTree->SetBranchStatus("jtphi",1,0);
334 c->icPu5jetTree->SetBranchStatus("jtpu",1,0);
335 c->icPu5jetTree->SetBranchStatus("trackMax",1,0);
336 }
337
338 //
339 //
340 //
341
342 if(c->hasAk2JetTree){
343 //! For jets ak2pf
344 c->ak2jetTree->SetBranchStatus("*",0,0);
345 c->ak2jetTree->SetBranchStatus("nref",1,0);
346 c->ak2jetTree->SetBranchStatus("rawpt",1,0);
347 c->ak2jetTree->SetBranchStatus("jtpt",1,0);
348 c->ak2jetTree->SetBranchStatus("jteta",1,0);
349 c->ak2jetTree->SetBranchStatus("jtphi",1,0);
350 c->ak2jetTree->SetBranchStatus("jtpu",1,0);
351 c->ak2jetTree->SetBranchStatus("trackMax",1,0);
352 }
353
354 if(c->hasAk3JetTree){
355 //! For jets ak3pf
356 c->ak3jetTree->SetBranchStatus("*",0,0);
357 c->ak3jetTree->SetBranchStatus("nref",1,0);
358 c->ak3jetTree->SetBranchStatus("rawpt",1,0);
359 c->ak3jetTree->SetBranchStatus("jtpt",1,0);
360 c->ak3jetTree->SetBranchStatus("jteta",1,0);
361 c->ak3jetTree->SetBranchStatus("jtphi",1,0);
362 c->ak3jetTree->SetBranchStatus("jtpu",1,0);
363 c->ak3jetTree->SetBranchStatus("trackMax",1,0);
364 }
365
366 if(c->hasAk4JetTree){
367 //! For jets ak4pf
368 c->ak4jetTree->SetBranchStatus("*",0,0);
369 c->ak4jetTree->SetBranchStatus("nref",1,0);
370 c->ak4jetTree->SetBranchStatus("rawpt",1,0);
371 c->ak4jetTree->SetBranchStatus("jtpt",1,0);
372 c->ak4jetTree->SetBranchStatus("jteta",1,0);
373 c->ak4jetTree->SetBranchStatus("jtphi",1,0);
374 c->ak4jetTree->SetBranchStatus("jtpu",1,0);
375 c->ak4jetTree->SetBranchStatus("trackMax",1,0);
376 }
377
378
379 if(c->hasAkPu2JetTree){
380 //! For jets akpu2pf
381 c->akPu2jetTree->SetBranchStatus("*",0,0);
382 c->akPu2jetTree->SetBranchStatus("nref",1,0);
383 c->akPu2jetTree->SetBranchStatus("rawpt",1,0);
384 c->akPu2jetTree->SetBranchStatus("jtpt",1,0);
385 c->akPu2jetTree->SetBranchStatus("jteta",1,0);
386 c->akPu2jetTree->SetBranchStatus("jtphi",1,0);
387 c->akPu2jetTree->SetBranchStatus("jtpu",1,0);
388 c->akPu2jetTree->SetBranchStatus("trackMax",1,0);
389 }
390
391 if(c->hasAkPu3JetTree){
392 //! For jets akpu3pf
393 c->akPu3jetTree->SetBranchStatus("*",0,0);
394 c->akPu3jetTree->SetBranchStatus("nref",1,0);
395 c->akPu3jetTree->SetBranchStatus("rawpt",1,0);
396 c->akPu3jetTree->SetBranchStatus("jtpt",1,0);
397 c->akPu3jetTree->SetBranchStatus("jteta",1,0);
398 c->akPu3jetTree->SetBranchStatus("jtphi",1,0);
399 c->akPu3jetTree->SetBranchStatus("jtpu",1,0);
400 c->akPu3jetTree->SetBranchStatus("trackMax",1,0);
401 }
402
403 if(c->hasAkPu4JetTree){
404 //! For jets akpu4pf
405 c->akPu4jetTree->SetBranchStatus("*",0,0);
406 c->akPu4jetTree->SetBranchStatus("nref",1,0);
407 c->akPu4jetTree->SetBranchStatus("rawpt",1,0);
408 c->akPu4jetTree->SetBranchStatus("jtpt",1,0);
409 c->akPu4jetTree->SetBranchStatus("jteta",1,0);
410 c->akPu4jetTree->SetBranchStatus("jtphi",1,0);
411 c->akPu4jetTree->SetBranchStatus("jtpu",1,0);
412 c->akPu4jetTree->SetBranchStatus("trackMax",1,0);
413 }
414
415
416
417 if(c->hasAkPu2CaloJetTree){
418 //! For jets akpu2calo
419 c->akPu2CaloJetTree->SetBranchStatus("*",0,0);
420 c->akPu2CaloJetTree->SetBranchStatus("nref",1,0);
421 c->akPu2CaloJetTree->SetBranchStatus("rawpt",1,0);
422 c->akPu2CaloJetTree->SetBranchStatus("jtpt",1,0);
423 c->akPu2CaloJetTree->SetBranchStatus("jteta",1,0);
424 c->akPu2CaloJetTree->SetBranchStatus("jtphi",1,0);
425 c->akPu2CaloJetTree->SetBranchStatus("jtpu",1,0);
426 c->akPu2CaloJetTree->SetBranchStatus("trackMax",1,0);
427 }
428
429 if(c->hasAkPu3CaloJetTree){
430 //! For jets akpu3calo
431 c->akPu3CaloJetTree->SetBranchStatus("*",0,0);
432 c->akPu3CaloJetTree->SetBranchStatus("nref",1,0);
433 c->akPu3CaloJetTree->SetBranchStatus("rawpt",1,0);
434 c->akPu3CaloJetTree->SetBranchStatus("jtpt",1,0);
435 c->akPu3CaloJetTree->SetBranchStatus("jteta",1,0);
436 c->akPu3CaloJetTree->SetBranchStatus("jtphi",1,0);
437 c->akPu3CaloJetTree->SetBranchStatus("jtpu",1,0);
438 c->akPu3CaloJetTree->SetBranchStatus("trackMax",1,0);
439 }
440
441 if(c->hasAkPu4CaloJetTree){
442 //! For jets akpu4calo
443 c->akPu4CaloJetTree->SetBranchStatus("*",0,0);
444 c->akPu4CaloJetTree->SetBranchStatus("nref",1,0);
445 c->akPu4CaloJetTree->SetBranchStatus("rawpt",1,0);
446 c->akPu4CaloJetTree->SetBranchStatus("jtpt",1,0);
447 c->akPu4CaloJetTree->SetBranchStatus("jteta",1,0);
448 c->akPu4CaloJetTree->SetBranchStatus("jtphi",1,0);
449 c->akPu4CaloJetTree->SetBranchStatus("jtpu",1,0);
450 c->akPu4CaloJetTree->SetBranchStatus("trackMax",1,0);
451 }
452
453 std::cout<<"Loaded all tree variables "<<std::endl;
454
455
456 //! For jets
457 Jets *mJets;
458
459 int scaFac=1;
460 if(ispp)scaFac=5;
461
462 //! Define histograms here
463 TH1::SetDefaultSumw2();
464 TH2::SetDefaultSumw2();
465 TProfile::SetDefaultSumw2();
466 ////////////////////////////////////////////////////////////////////////////////////////////////////////
467 TH1F *hEvt = new TH1F("hEvt","# of events ",4,0,4);
468 TH1F *hVz = new TH1F("hVz","vertex z distribution",80,-20,20);
469 TH2F *hEvtRun = new TH2F("hEvtRun","# of events in that run",maxruns,-0.5,maxruns-0.5,40,-40,40);
470 TH1F *hLumiBlock = new TH1F("hLumiBlock","Luminosity block from hlt",scaFac*1500,0,scaFac*1500);
471 TH2F *hLumiRun = new TH2F("hLumiRun","Luminosity Run-by-Run",maxruns,-0.5,maxruns-0.5,scaFac*100,0,scaFac*2000);
472 hLumiRun->GetXaxis()->SetLabelSize(0.03);
473 for(int ix=1;ix<=hLumiRun->GetNbinsX();ix++){
474 if(Run[ix-1]!=-999)sprintf(mrun,"%d",Run[ix-1]);
475 else sprintf(mrun,"%s","\0");
476 hLumiRun->GetXaxis()->SetBinLabel(ix,mrun);
477 }
478 TH2F *hHFPlusMinus = new TH2F("hHFPlusMinus","HF plus:minus",600,0,6000,600,0,6000);
479 TH1F *hHF = new TH1F("hHF","HF distribution",600,0,6000);
480 TH1F *hAvHF = new TH1F("hAvHF","HF E/hit distribution",100,0,0.1);
481 TH1F *hAvHFplus = new TH1F("hAvHFplus","HFplus E/hit distribution",100,0,0.1);
482 TH1F *hAvHFminus = new TH1F("hAvHFminus","HFminus E/hit distribution",100,0,0.2);
483
484 TH2F *hAvHFRun = new TH2F("hAvHFRun","HF E/hit distribution Run-by-Run",maxruns,-0.5,maxruns-0.5,100,0,0.1);
485 TH2F *hAvHFplusRun = new TH2F("hAvHFplusRun","HFplus E/hit distribution Run-by-Run",maxruns,-0.5,maxruns-0.5,100,0,0.1);
486 TH2F *hAvHFminusRun = new TH2F("hAvHFminusRun","HFminus E/hit distribution Run-by-Run",maxruns,-0.5,maxruns-0.5,100,0,0.2);
487
488 TH2F *hZDCPlusMinus = new TH2F("hZDCPlusMinus","ZDC plus:minus",1000,0,45000,1000,0,45000);
489 TH1F *hZDC = new TH1F("hZDC","ZDC distribution",5000,0,1e+05);
490
491 //! EE
492 TH1F *hET = new TH1F("hET","hiET",200,0,1600);
493 TH1F *hEB = new TH1F("hEB","hiEB",200,0,1200);
494 TH1F *hEE = new TH1F("hEE","hiEE",500,0,2500);
495 TH2F *hEBEE = new TH2F("hEBEE","hEBEE",200,0,1200,500,0,2500);
496 TH2F *hEEPlusMinus = new TH2F("hEEPlusMinus","hEEPlusEEMinus",200,0,1200,200,0,1200);
497
498 //! vertex
499 TH1F *hvz = new TH1F("hvz","hvz",40,-40,40);
500 hvz->Sumw2();
501 TH2F *hvxvy = new TH2F("hvxvy","vx vs vy",100,-0.2,0.2,100,-0.2,0.2);
502 TH2F *hvzrun = new TH2F("hvzrun","hvzrun",maxruns,-0.5,maxruns-0.5,40,-40,40);
503 hvzrun->Sumw2();
504
505 //! Pixel
506 TH1F *hNpix = new TH1F("hNpix","hiNpix",500,0,80000);
507 TH1F *hNpixelTracks = new TH1F("hNpixelTracks","hiNpixelTracks",200,0,3000);
508 TH1F *hNTracks = new TH1F("hNTracks","hiNTracks",100,0,1500);
509 TH2F *hNpixelTracksNTracks = new TH2F("hNpixelTracksNTracks","hNpixelTracksNTracks",500,0,15000,100,0,1500);
510
511 //! Cross correlations
512 TH2F *hHFZDC = new TH2F("hHFZDC","hHFZDC",600,0,6000,1000,0,1e+05);
513 TH2F *hNpixelTracksZDC = new TH2F("hNpixelTracksZDC","hNpixelTracksZDC",200,0,3000,1000,0,1e+05);
514 TH2F *hHFNpixelTracks = new TH2F("hHFNpixelTracks","hHFNpixelTracks",600,0,6000,200,0,3000);
515
516 TH1F *hBin = new TH1F("hBin","Centrality bin",40,-0.5,39.5);
517
518 TH1F *hHF_tr[knj];
519 TH1F *hTotJets[knj];
520
521 TH2F *hJetPtRun[knj];
522 TH2F *hJetPURun[knj];
523 TH2F *hMBJetsRun[knj];
524 TH2F *hTotJetsRun[knj];
525
526 //! mb
527 TH1F *hjetrptmb[knj], *hjetjptmb[knj], *hjetjpumb[knj];
528 TH1F *hjetetamb[knj], *hjetphimb[knj];
529 TH2F *hjetptetamb[knj], *hjetptphimb[knj], *hjetetaphimb[knj];
530 TH2F *hjetptpumb[knj];
531
532 //! vetex bin
533 TH1F *hjetrptvz[knj][nvtx], *hjetjptvz[knj][nvtx], *hjetjpuvz[knj][nvtx];
534 TH1F *hjetetavz[knj][nvtx], *hjetphivz[knj][nvtx];
535 TH2F *hjetptetavz[knj][nvtx], *hjetptphivz[knj][nvtx], *hjetetaphivz[knj][nvtx];
536 TH2F *hjetptpuvz[knj][nvtx];
537
538 //! pixel bin
539 TH1F *hjetrpt_pix[knj][npix], *hjetjpt_pix[knj][npix], *hjetjpu_pix[knj][npix];
540 TH1F *hjeteta_pix[knj][npix], *hjetphi_pix[knj][npix];
541 TH2F *hjetpteta_pix[knj][npix], *hjetptphi_pix[knj][npix], *hjetetaphi_pix[knj][npix];
542 TH2F *hjetptpu_pix[knj][npix];
543
544 //! ncen bin
545 TH1F *hfrpt[knj][ncen], *hfjpt[knj][ncen], *hfpupt[knj][ncen];
546
547 TH1F *hjetrpt [knj][ncen], *hjetjpt[knj][ncen], *hjetjpu[knj][ncen], *hjetspt[knj][ncen];
548 TH1F *hjeteta [knj][ncen], *hjetphi[knj][ncen];
549 TH2F *hjetpteta[knj][ncen], *hjetptphi[knj][ncen], *hjetetaphi[knj][ncen];
550 TH2F *hjetptpu[knj][ncen];
551
552 //! eta dependence
553 TH1F *hjetrptmb_etab[knj][ketar];
554 TH1F *hjetjptmb_etab[knj][ketar];
555 TH1F *hjetjpumb_etab[knj][ketar];
556 TH2F *hjetptpumb_etab[knj][ketar];
557 TH1F *hNevtmb_etab[knj];
558
559 TH1F *hjetrptpix_etab[knj][npix][ketar];
560 TH1F *hjetjptpix_etab[knj][npix][ketar];
561 TH1F *hjetjpupix_etab[knj][npix][ketar];
562 TH2F *hjetptpupix_etab[knj][npix][ketar];
563 TH1F *hNevtpix_etab[knj][npix];
564
565 TH1F *hjetrpt_etab[knj][ncen][ketar];
566 TH1F *hjetjpt_etab[knj][ncen][ketar];
567 TH1F *hjetjpu_etab[knj][ncen][ketar];
568 TH2F *hjetptpu_etab[knj][ncen][ketar];
569 TH1F *hNevt_etab[knj][ncen];
570
571 TH1F *hNref[knj];
572 TH1F *hNjets[knj][ncen], *hNjets_dist[knj][ncen];
573 TH1F *hMBJets[knj];
574
575 TH1F *hNevt [knj][ncen];
576 TH1F *hNevtvz [knj][nvtx];
577 TH1F *hNevtpix [knj][npix];
578 TH1F *hNevt_notr [knj][ncen];
579
580
581 for(int nj=0;nj<knj;nj++){
582 //std::cout<<Form("Histograms for algo %s",calgo[nj])<<std::endl;
583
584 //! Define the histograms for jets
585 hTotJets[nj] = new TH1F(Form("hTotJets%d",nj),Form("# of jets w/o cuts with %s",calgo[nj]),4,0,4);
586 hMBJets[nj] = new TH1F(Form("hMBJets%d",nj),Form("MB distribution of jets in %s",calgo[nj]),50,0,50);
587
588 hMBJetsRun[nj] = new TH2F(Form("hMBJetsRun%d",nj),Form("MB distribution of jets run-by-run in %s",calgo[nj]),maxruns,-0.5,maxruns-0.5,20,0,20);
589 hMBJetsRun[nj]->GetXaxis()->SetLabelSize(0.03);
590
591 //! for jet pt
592 hJetPtRun[nj] = new TH2F(Form("hJetPtRun%d",nj),Form("Jet pt run-by-run in %s",calgo[nj]),maxruns,-0.5,maxruns-0.5,100,0,300);
593
594 //! for jet pile up
595 hJetPURun[nj] = new TH2F(Form("hJetPURun%d",nj),Form("Jet pile up run-by-run in %s",calgo[nj]),maxruns,-0.5,maxruns-0.5,100,0,300);
596
597 hTotJetsRun[nj] = new TH2F(Form("hTotJetsRun%d",nj),Form("Total jets run-by-run in %s",calgo[nj]),maxruns,-0.5,maxruns-0.5,500,0,10000);
598 hTotJetsRun[nj]->GetXaxis()->SetLabelSize(0.03);
599
600 for(int ix=1;ix<=hMBJetsRun[nj]->GetNbinsX();ix++){
601 if(Run[ix-1]!=-999)sprintf(mrun,"%d",Run[ix-1]);
602 else sprintf(mrun,"%s","\0");
603
604 hMBJetsRun[nj]->GetXaxis()->SetBinLabel(ix,mrun);
605 hJetPtRun [nj]->GetXaxis()->SetBinLabel(ix,mrun);
606 hJetPURun [nj]->GetXaxis()->SetBinLabel(ix,mrun);
607 hTotJetsRun[nj]->GetXaxis()->SetBinLabel(ix,mrun);
608 }
609
610 hNref[nj] = new TH1F(Form("hNRef%d",nj),Form("# of jets in %s",calgo[nj]),40,0,100);
611 hHF_tr[nj] = new TH1F(Form("hHF_tr%d",nj),Form("HF triggered events (Jet p_{T} > 85 GeV/c distribution) %s",calgo[nj]),600,0,6000);
612
613 hjetetamb[nj] = new TH1F(Form("hjetetamb%d",nj),Form("jet eta distribution jet %s",calgo[nj]),18,-3.0,3.0);
614 hjetphimb[nj] = new TH1F(Form("hjetphimb%d",nj),Form("jet phi distribution jet %s",calgo[nj]),18,-pi,pi);
615 hjetrptmb[nj] = new TH1F(Form("hjetrptmb%d",nj),Form("jet(raw pt) p_{T} distribution jet %s",calgo[nj]),bins,ptbins);
616 hjetjptmb[nj] = new TH1F(Form("hjetjptmb%d",nj),Form("jet(jt pt) p_{T} distribution jet %s",calgo[nj]),bins,ptbins);
617 hjetjpumb[nj] = new TH1F(Form("hjetjpumb%d",nj),Form("jet(j pu) p_{T} distribution jet %s",calgo[nj]),100,0,300);
618 hjetptpumb[nj] = new TH2F(Form("hjetptpumb%d",nj),Form("jet(pt:pu) distribution jet %s",calgo[nj]),bins,ptbins,100,0,300);
619
620 hjetetaphimb[nj] = new TH2F(Form("hjetetaphimb%d",nj),Form("jet eta-phi distribution jet mb %s",calgo[nj]),36,-3.0,3.0,36,-pi,pi);
621 hjetptetamb[nj] = new TH2F(Form("hjetptetamb%d",nj),Form("jet pt-eta distribution jet mb %s",calgo[nj]),bins,ptbins,36,-3.0,3.0);
622 hjetptphimb[nj] = new TH2F(Form("hjetptphimb%d",nj),Form("jet pt-phi distribution jet mb %s",calgo[nj]),bins,ptbins,36,-pi,pi);
623
624 hNevtmb_etab[nj] = new TH1F(Form("hNevtmb_etab%d",nj),Form("# of events mb jet %s",calgo[nj]),40,-40,40);
625 for(int ie=0;ie<ketar;ie++){
626 hjetrptmb_etab[nj][ie] = new TH1F(Form("hjetrptmb_etab%d_%d",nj,ie),Form("jet(raw pt) p_{T} distribution jet %s etabin %d",calgo[nj],ie),bins,ptbins);
627 hjetjptmb_etab[nj][ie] = new TH1F(Form("hjetjptmb_etab%d_%d",nj,ie),Form("jet(jt pt) p_{T} distribution jet %s etabin %d",calgo[nj],ie),bins,ptbins);
628 hjetjpumb_etab[nj][ie] = new TH1F(Form("hjetjpumb_etab%d_%d",nj,ie),Form("jet(j pu) p_{T} distribution jet %s etabin %d",calgo[nj],ie),100,0,300);
629 hjetptpumb_etab[nj][ie] = new TH2F(Form("hjetptpumb_etab%d_%d",nj,ie),Form("jet(pt:pu) distribution jet %s etabin %d",calgo[nj],ie),bins,ptbins,100,0,300);
630 }
631
632 for(int ip=0;ip<npix;ip++){
633 hjeteta_pix[nj][ip] = new TH1F(Form("hjeteta_pix%d_%d",nj,ip),Form("jet eta distribution jet pix %d %s",ip,calgo[nj]),18,-3.0,3.0);
634 hjetphi_pix[nj][ip] = new TH1F(Form("hjetphi_pix%d_%d",nj,ip),Form("jet phi distribution jet pix %d %s",ip,calgo[nj]),18,-pi,pi);
635 hjetrpt_pix[nj][ip] = new TH1F(Form("hjetrpt_pix%d_%d",nj,ip),Form("jet(raw pt) p_{T} distribution jet pix %d %s",ip,calgo[nj]),bins,ptbins);
636 hjetjpt_pix[nj][ip] = new TH1F(Form("hjetjpt_pix%d_%d",nj,ip),Form("jet(jt pt) p_{T} distribution jet vz pix %d %s",ip,calgo[nj]),bins,ptbins);
637 hjetjpu_pix[nj][ip] = new TH1F(Form("hjetjpu_pix%d_%d",nj,ip),Form("jet(pu) p_{T} distribution jet vz pix %d %s",ip,calgo[nj]),100,0,300);
638 hjetptpu_pix[nj][ip] = new TH2F(Form("hjetptpu_pix%d_%d",nj,ip),Form("jet(pt:pu) distribution jet pix %d %s",ip,calgo[nj]),bins,ptbins,100,0,300);
639
640 hjetetaphi_pix[nj][ip] = new TH2F(Form("hjetetaphi_pix%d_%d",nj,ip),Form("jet eta-phi distribution jet pix %d %s",ip,calgo[nj]),36,-3.0,3.0,36,-pi,pi);
641 hjetpteta_pix [nj][ip] = new TH2F(Form("hjetpteta_pix%d_%d",nj,ip),Form("jet pt-eta distribution jet pix %d %s",ip,calgo[nj]),bins,ptbins,18,-3.0,3.0);
642 hjetptphi_pix [nj][ip] = new TH2F(Form("hjetptphi_pix%d_%d",nj,ip),Form("jet pt-phi distribution jet pix %d %s",ip,calgo[nj]),bins,ptbins,18,-pi,pi);
643
644 hNevtpix[nj][ip] = new TH1F(Form("hNevtpix%d_%d",nj,ip),Form("# of events cent pix %d %s",ip,calgo[nj]),40,-40,40);
645
646 hNevtpix_etab[nj][ip] = new TH1F(Form("hNevtpix_etab%d_%d",nj,ip),Form("# of events cent pix %d jet %s",ip,calgo[nj]),40,-40,40);
647 for(int ie=0;ie<ketar;ie++){
648 hjetrptpix_etab[nj][ip][ie] = new TH1F(Form("hjetrptpix_etab%d_%d_%d",nj,ip,ie),Form("jet(raw pt) p_{T} distribution pix %d jet %s etabin %d",ip,calgo[nj],ie),bins,ptbins);
649 hjetjptpix_etab[nj][ip][ie] = new TH1F(Form("hjetjptpix_etab%d_%d_%d",nj,ip,ie),Form("jet(jt pt) p_{T} distribution pix %d jet %s etabin %d",ip,calgo[nj],ie),bins,ptbins);
650 hjetjpupix_etab[nj][ip][ie] = new TH1F(Form("hjetjpupix_etab%d_%d_%d",nj,ip,ie),Form("jet(pu) p_{T} distribution pix %d jet %s etabin %d",ip,calgo[nj],ie),100,0,300);
651 hjetptpupix_etab[nj][ip][ie] = new TH2F(Form("hjetptpupix_etab%d_%d_%d",nj,ip,ie),Form("jet(pt:pu) distribution pix %d jet %s etabin %d",ip,calgo[nj],ie),bins,ptbins,100,0,300);
652 }
653 }
654
655 for(int iv=0;iv<nvtx;iv++){
656 hNevtvz[nj][iv] = new TH1F(Form("hNevtvz%d_%d",nj,iv),Form("# of events cent vz %d %s",iv,calgo[nj]),40,-40,40);
657 hjetetavz[nj][iv] = new TH1F(Form("hjetetavz%d_%d",nj,iv),Form("jet eta distribution jet vz %s",calgo[nj]),18,-3.0,3.0);
658 hjetphivz[nj][iv] = new TH1F(Form("hjetphivz%d_%d",nj,iv),Form("jet phi distribution jet vz %s",calgo[nj]),18,-pi,pi);
659 hjetrptvz[nj][iv] = new TH1F(Form("hjetrptvz%d_%d",nj,iv),Form("jet(raw pt) p_{T} distribution jet vz %s",calgo[nj]),bins,ptbins);
660 hjetjptvz[nj][iv] = new TH1F(Form("hjetjptvz%d_%d",nj,iv),Form("jet(jt pt) p_{T} distribution jet vz %s",calgo[nj]),bins,ptbins);
661 hjetjpuvz[nj][iv] = new TH1F(Form("hjetjpuvz%d_%d",nj,iv),Form("jet(pu) p_{T} distribution jet vz %s",calgo[nj]),100,0,300);
662 hjetptpuvz[nj][iv] = new TH2F(Form("hjetptpuvz%d_%d",nj,iv),Form("jet(pt:pu) distribution jet vz %s",calgo[nj]),bins,ptbins,100,0,300);
663
664 hjetetaphivz[nj][iv] = new TH2F(Form("hjetetaphivz%d_%d",nj,iv),Form("jet eta-phi distribution jet vz %s",calgo[nj]),36,-3.0,3.0,36,-pi,pi);
665 hjetptetavz[nj][iv] = new TH2F(Form("hjetptetavz%d_%d",nj,iv),Form("jet pt-eta distribution jet vz %s",calgo[nj]),bins,ptbins,18,-3.0,3.0);
666 hjetptphivz[nj][iv] = new TH2F(Form("hjetptphivz%d_%d",nj,iv),Form("jet pt-phi distribution jet vz %s",calgo[nj]),bins,ptbins,18,-pi,pi);
667 }
668
669 for(int icen=0;icen<ncen;icen++){
670 hjeteta[nj][icen] = new TH1F(Form("hjeteta%d_%d",nj,icen),Form("jet eta distribution jet centb %d %s",icen,calgo[nj]),18,-3.0,3.0);
671 hjetphi[nj][icen] = new TH1F(Form("hjetphi%d_%d",nj,icen),Form("jet phi distribution jet centb %d %s",icen,calgo[nj]),18,-pi,pi);
672
673 hfrpt[nj][icen] = new TH1F(Form("hfrpt%d_%d",nj,icen),Form("jet(raw pt) p_{T} distribution jet centb %d %s",icen,calgo[nj]),500,0.,1000);
674 hfjpt[nj][icen] = new TH1F(Form("hfjpt%d_%d",nj,icen),Form("jet(corrected pt) p_{T} distribution jet centb %d %s",icen,calgo[nj]),500,0.,1000);
675 hfpupt[nj][icen] = new TH1F(Form("hfpupt%d_%d",nj,icen),Form("jet(pilup pt) p_{T} distribution jet centb %d %s",icen,calgo[nj]),250,0.,100);
676
677 hjetrpt[nj][icen] = new TH1F(Form("hjetrpt%d_%d",nj,icen),Form("jet(raw pt) p_{T} distribution jet centb %d %s",icen,calgo[nj]),bins,ptbins);
678 hjetjpt[nj][icen] = new TH1F(Form("hjetjpt%d_%d",nj,icen),Form("jet(jt pt) p_{T} distribution jet centb %d %s",icen,calgo[nj]),bins,ptbins);
679 hjetspt[nj][icen] = new TH1F(Form("hjetspt%d_%d",nj,icen),Form("jet(smeared pt) p_{T} distribution jet centb %d %s",icen,calgo[nj]),bins,ptbins);
680 hjetjpu[nj][icen] = new TH1F(Form("hjetjpu%d_%d",nj,icen),Form("jet(pu) p_{T} distribution jet centb %d %s",icen,calgo[nj]),100,0,300);
681 hjetptpu[nj][icen] = new TH2F(Form("hjetptpu%d_%d",nj,icen),Form("jet(pt:pu) distribution jet centb %d %s",icen,calgo[nj]),bins,ptbins,100,0,300);
682
683 hjetetaphi[nj][icen] = new TH2F(Form("hjetetaphi%d_%d",nj,icen),Form("jet eta-phi distribution jet centb %d %s",icen,calgo[nj]),18,-3.0,3.0,18,-pi,pi);
684 hjetpteta[nj][icen] = new TH2F(Form("hjetpteta%d_%d",nj,icen),Form("jet pt-eta distribution jet centb %d %s",icen,calgo[nj]),bins,ptbins,18,-3.0,3.0);
685 hjetptphi[nj][icen] = new TH2F(Form("hjetptphi%d_%d",nj,icen),Form("jet pt-phi distribution jet centb %d %s",icen,calgo[nj]),bins,ptbins,18,-pi,pi);
686
687 hNevt_etab[nj][icen] = new TH1F(Form("hNevt_etab%d_%d",nj,icen),Form("# of events cent %d jet %s",icen,calgo[nj]),40,-40,40);
688 for(int ie=0;ie<ketar;ie++){
689 hjetrpt_etab[nj][icen][ie] = new TH1F(Form("hjetrpt_etab%d_%d_%d",nj,icen,ie),Form("jet(raw pt) p_{T} distribution centb %d jet %s etabin %d",icen,calgo[nj],ie),bins,ptbins);
690 hjetjpt_etab[nj][icen][ie] = new TH1F(Form("hjetjpt_etab%d_%d_%d",nj,icen,ie),Form("jet(jt pt) p_{T} distribution centb %d jet %s etabin %d",icen,calgo[nj],ie),bins,ptbins);
691 hjetjpu_etab[nj][icen][ie] = new TH1F(Form("hjetjpu_etab%d_%d_%d",nj,icen,ie),Form("jet(pu) p_{T} distribution centb %d jet %s etabin %d",icen,calgo[nj],ie),100,0,300);
692 hjetptpu_etab[nj][icen][ie] = new TH2F(Form("hjetptpu_etab%d_%d_%d",nj,icen,ie),Form("jet(pt:pu) distribution centb %d jet %s etabin %d",icen,calgo[nj],ie),bins,ptbins,100,0,300);
693 }
694
695 hNevt[nj][icen] = new TH1F(Form("hNevt%d_%d",nj,icen),Form("# of events cent %d %s",icen,calgo[nj]),40,-40,40);
696
697 hNevt_notr[nj][icen] = new TH1F(Form("hNevt_notr%d_%d",nj,icen),Form("# of events w/o trigger conditioncent %d %d",nj,icen),40,-40,40);
698
699 hNjets[nj][icen] = new TH1F(Form("hNjets%d_%d",nj,icen),Form("# of cent %d jets %s",icen,calgo[nj]),3,0.0,3.0);
700
701 hNjets_dist[nj][icen] = new TH1F(Form("hNjets_dist%d_%d",nj,icen),Form("distribution jets in cent %d %s",icen,calgo[nj]),100,0,100);
702 }
703 //std::cout<<Form("Initialized the histograms %s",calgo[nj]) <<std::endl;
704 std::cout<<"\t"<<std::endl;
705 }
706 /////////////////////////////////////////////////////////////////////////////////////////
707
708 /* for getting number of runs and runnumbers */
709 int runc=0;
710 int newrun=0;
711 int oldrun=-1;
712 int kstat[maxruns]={0};
713
714
715 float njets[knj][ncen];
716 float nmbj[knj];
717 float sumjpt[knj];
718 float sumjpu[knj];
719 int istat[knj];
720 int stat_etab[knj];
721
722 double totjetpt[knj][maxruns];
723 double totjets [knj][maxruns];
724
725 for(int nj=0;nj<knj;nj++){
726 for(int ir=0;ir<maxruns;ir++){
727 totjetpt[nj][ir]=0;
728 totjets[nj][ir]=0;
729 }
730 }
731
732
733 Long64_t nb = 0;
734 Long64_t nentries = c->GetEntries();
735 std::cout<<Form("# of entries in TTree for %s : ",ksp)<<nentries<<std::endl;
736 hEvt->Fill(2,nentries);
737
738 for (Long64_t ievt=0; ievt<nentries;ievt++) {//! event loop
739 //for (Long64_t ievt=0; ievt<200;ievt++) {//! event loop
740 //! load the hiForest event
741 nb += c->GetEntry(ievt);
742
743 //! Remove duplicate events
744 if(!ispp && dupEvt.occurrence[ievt]==2)continue;
745
746
747
748 //! select good events
749 bool goodEvent = false;
750 if(ispp){
751 goodEvent = c->skim.pcollisionEventSelection && c->skim.pHBHENoiseFilter && c->hlt.HLT_Jet60_v1 && fabs(c->evt.vz)<15.;
752 }else{
753 goodEvent = c->skim.pcollisionEventSelection && c->skim.pHBHENoiseFilter && c->hlt.HLT_HIJet80_v1 && fabs(c->evt.vz)<15.; ///! this one to use
754 }
755 if(!goodEvent)continue;
756
757 //! Event variables
758 int RunNo=-999, EvtNo=-999, hiBin=-999, LumiBlock=-999, hiNpix =-999, hiNpixelTracks=-999,hiNtracks=-999;
759 float vx=-999,vy=-999,vz=-999, hiHF=-999,hiHFplus=-999,hiHFminus=-999,hiHFhit=-999,hiHFhitplus=-999,
760 hiHFhitminus=-999,hiZDC=-999,hiZDCplus=-999,hiZDCminus=-999;
761 float hiET=-999,hiEE=-999,hiEB=-999,hiEEplus=-999,hiEEminus=-999;
762
763
764 RunNo = c->evt.run;
765 EvtNo = c->evt.evt;
766 hiBin = c->evt.hiBin;
767 LumiBlock = c->evt.lumi;
768 hiNpix = c->evt.hiNpix;
769 hiNpixelTracks = c->evt.hiNpixelTracks;
770 hiNtracks = c->evt.hiNtracks;
771
772 vx = c->evt.vx;
773 vy = c->evt.vy;
774 vz = c->evt.vz;
775 hiHF = c->evt.hiHF;
776 hiHFplus = c->evt.hiHFplus;
777 hiHFminus = c->evt.hiHFminus;
778 hiHFhit = c->evt.hiHFhit;
779 hiHFhitplus = c->evt.hiHFhitPlus;
780 hiHFhitminus = c->evt.hiHFhitMinus;
781 hiZDC = c->evt.hiZDC;
782 hiZDCplus = c->evt.hiZDCplus;
783 hiZDCminus = c->evt.hiZDCminus;
784 hiET = c->evt.hiET;
785 hiEE = c->evt.hiEE;
786 hiEB = c->evt.hiEB;
787 hiEEplus = c->evt.hiEEplus;
788 hiEEminus = c->evt.hiEEminus;
789
790
791
792 int RunId=0;
793 /* For getting the number of runs and runnumbers */
794 if(iCountRuns){
795 newrun=RunNo;
796 if(newrun!=oldrun){
797 bool mstat=true;
798 for(int ir=0;ir<runc;ir++){
799 if(kstat[ir]==newrun)mstat=false;
800 }
801 if(mstat){
802 oldrun=newrun;
803 kstat[runc]=newrun;
804 runc++;
805 std::cout<<"Run # : " <<newrun<<"\t # of runs : "<<runc<<std::endl;
806 }
807 }
808 }else{
809 RunId = GetRunIdx(RunNo);
810 if(RunId<0){
811 std::cout<<"Something is wrong with the LoadRuns, Current Run number not listed "<<std::endl;
812 exit(0);
813 }
814 }
815
816 //! Centrality bin
817 //! 5 or 7 bins
818 int centb=-1;
819 if(ispp) centb=ncen-1; //pp
820 else{ //! PbPb
821 centb=GetCentBin(hiBin);
822 }
823
824 if(centb<0 || centb>=ncen)continue;
825
826 //! Vertex z bin
827 //! Only two bins v<0 : 0 and vz>0 : 1
828 int vbin = GetVtxBin(vz);
829 //if(vbin<0)continue;
830
831 //! hiPixelTracks bins
832 //! 5 bins
833 int ipix = GetPixelBin(hiNpixelTracks);
834 //if(ipix<0)continue;
835
836 if(ievt%10000==0 && !iCountRuns)std::cout<<" ********** Event # " <<ievt<<"\t Run : "<<RunNo<<"\t HF : "<<hiHF<<std::endl;
837 //std::cout<<" ********** Event # " <<ievt<<"\t Run : "<<RunNo<<"\t HF : "<<hiHF<<std::endl;
838
839 //! Jet Algo loop starts here
840 //! nj : 0 (icpu5calo) and 1 (akpu3pf)
841 for(int nj=0;nj<knj;nj++){
842
843 //! Initialization
844 nmbj[nj]=0;
845 sumjpt[nj]=0;
846 sumjpu[nj]=0;
847 istat[nj]=0;
848 stat_etab[nj]=0;
849 for(int icen=0;icen<ncen;icen++){
850 njets[nj][icen]=0;
851 }
852
853 //! assign the jets for PbPb
854 if(strcmp(ksp,"pp")==0){
855 if(nj==0)mJets = &(c->ak2PF);
856 else if(nj==1)mJets = &(c->ak3PF);
857 else if(nj==2)mJets = &(c->ak4PF);
858 }else{
859 if(nj==0)mJets = &(c->akPu2PF);
860 else if(nj==1)mJets = &(c->akPu3PF);
861 else if(nj==2)mJets = &(c->akPu4PF);
862 }
863
864 /*if(nj==0)mJets = &(c->icPu5);
865 else if(nj==1)mJets = &(c->akPu2PF);
866 else if(nj==2)mJets = &(c->akPu3PF);
867 else if(nj==3)mJets = &(c->akPu4PF);
868 else if(nj==4)mJets = &(c->akPu2Calo);
869 else if(nj==5)mJets = &(c->akPu3Calo);
870 else if(nj==6)mJets = &(c->akPu4Calo);
871 */
872
873 //if(nj==1)std::cout<<" \t \t "<<Form("\t %s : ",calgo[nj])<<mJets->nref<<"\t centb : "<<centb<<std::endl;
874 //! Loop over # of jets in a given algo
875 for(int ij=0; ij<mJets->nref; ij++){
876
877 //! Without any cut how many jets are there
878 hTotJets[nj]->Fill(1.);
879
880 //! jet selction cut
881 if(mJets->jtpt[ij]<kptrecocut || fabs(mJets->jtphi[ij])>pi)continue;
882
883 //! trackMax cuts
884 if(mJets->trackMax[ij]/mJets->jtpt[ij] < 0.01)continue;
885
886 //! jets within different etabins
887 //!
888 int ebin = GetEtaBin(fabs(mJets->jteta[ij]));
889 if(ebin<0)continue;
890 stat_etab[nj]=1;
891 hjetrptmb_etab [nj][ebin]->Fill(mJets->rawpt[ij]);
892 hjetjptmb_etab [nj][ebin]->Fill(mJets->jtpt[ij]);
893 hjetjpumb_etab [nj][ebin]->Fill(mJets->jtpu[ij]);
894 hjetptpumb_etab[nj][ebin]->Fill(mJets->jtpt[ij],mJets->jtpu[ij]);
895
896 if(ipix>=0){
897 hjetrptpix_etab [nj][ipix][ebin]->Fill(mJets->rawpt[ij]);
898 hjetjptpix_etab [nj][ipix][ebin]->Fill(mJets->jtpt[ij]);
899 hjetjpupix_etab [nj][ipix][ebin]->Fill(mJets->jtpu[ij]);
900 hjetptpupix_etab[nj][ipix][ebin]->Fill(mJets->jtpt[ij],mJets->jtpu[ij]);
901 }
902 hjetrpt_etab [nj][centb][ebin]->Fill(mJets->rawpt[ij]);
903 hjetjpt_etab [nj][centb][ebin]->Fill(mJets->jtpt[ij]);
904 hjetjpu_etab [nj][centb][ebin]->Fill(mJets->jtpu[ij]);
905 hjetptpu_etab[nj][centb][ebin]->Fill(mJets->jtpt[ij],mJets->jtpu[ij]);
906
907
908 if(fabs(mJets->jteta[ij]) < ketacut){
909 istat[nj]=1;
910
911 //! minbias
912 hjetrptmb [nj]->Fill(mJets->rawpt[ij]);
913 hjetjptmb [nj]->Fill(mJets->jtpt[ij]);
914 hjetjpumb [nj]->Fill(mJets->jtpu[ij]);
915 hjetptpumb[nj]->Fill(mJets->jtpt[ij],mJets->jtpu[ij]);
916
917 hjetetamb [nj]->Fill(mJets->jteta[ij]);
918 hjetphimb [nj]->Fill(mJets->jtphi[ij]);
919 hjetptetamb [nj]->Fill(mJets->jtpt[ij],mJets->jteta[ij]);
920 hjetptphimb [nj]->Fill(mJets->jtpt[ij],mJets->jtphi[ij]);
921 hjetetaphimb[nj]->Fill(mJets->jteta[ij],mJets->jtphi[ij]);
922
923 if(vbin>=0){
924 //! vertex z dependence
925 hjetrptvz [nj][vbin]->Fill(mJets->rawpt[ij]);
926 hjetjptvz [nj][vbin]->Fill(mJets->jtpt[ij]);
927 hjetjpuvz [nj][vbin]->Fill(mJets->jtpu[ij]);
928 hjetptpuvz[nj][vbin]->Fill(mJets->jtpt[ij],mJets->jtpu[ij]);
929
930 hjetetavz [nj][vbin]->Fill(mJets->jteta[ij]);
931 hjetphivz [nj][vbin]->Fill(mJets->jtphi[ij]);
932 hjetptetavz [nj][vbin]->Fill(mJets->jtpt[ij],mJets->jteta[ij]);
933 hjetptphivz [nj][vbin]->Fill(mJets->jtpt[ij],mJets->jtphi[ij]);
934 hjetetaphivz[nj][vbin]->Fill(mJets->jteta[ij],mJets->jtphi[ij]);
935 }
936 //! pixel tracks dependence
937 hjetrpt_pix [nj][ipix]->Fill(mJets->rawpt[ij]);
938 hjetjpt_pix [nj][ipix]->Fill(mJets->jtpt[ij]);
939 hjetjpu_pix [nj][ipix]->Fill(mJets->jtpu[ij]);
940 hjetptpu_pix[nj][ipix]->Fill(mJets->jtpt[ij],mJets->jtpu[ij]);
941
942 hjeteta_pix [nj][ipix]->Fill(mJets->jteta[ij]);
943 hjetphi_pix [nj][ipix]->Fill(mJets->jtphi[ij]);
944 hjetpteta_pix [nj][ipix]->Fill(mJets->jtpt[ij],mJets->jteta[ij]);
945 hjetptphi_pix [nj][ipix]->Fill(mJets->jtpt[ij],mJets->jtphi[ij]);
946 hjetetaphi_pix[nj][ipix]->Fill(mJets->jteta[ij],mJets->jtphi[ij]);
947
948 //! centrality
949 hNjets [nj][centb]->Fill(1.);
950
951 hfrpt [nj][centb]->Fill(mJets->rawpt[ij]);
952 hfjpt [nj][centb]->Fill(mJets->jtpt[ij]);
953 hfpupt [nj][centb]->Fill(mJets->jtpu[ij]);
954
955
956 hjetrpt [nj][centb]->Fill(mJets->rawpt[ij]);
957 hjetjpt [nj][centb]->Fill(mJets->jtpt[ij]);
958 hjetjpu [nj][centb]->Fill(mJets->jtpu[ij]);
959 hjetptpu[nj][centb]->Fill(mJets->jtpt[ij],mJets->jtpu[ij]);
960
961 //! pp pt smeared with PbPb resolution
962 if(strcmp(ksp,"pp")==0){
963 int smbin = GetPtBinSmear(mJets->jtpt[ij]);
964 if(smbin>=0){
965 for(int ic=0;ic<ncen-1;ic++){
966 float smpt = gRandom->Gaus(mJets->jtpt[ij],smearf[nj][ic][smbin]);
967 smpt -= mdiff[nj][ic][smbin]*smpt;
968 if(smpt<kptrecocut)continue;
969 hjetspt [nj][ic]->Fill(smpt);
970 }
971 }
972 }
973
974 hjeteta [nj][centb]->Fill(mJets->jteta[ij]);
975 hjetphi [nj][centb]->Fill(mJets->jtphi[ij]);
976 hjetpteta [nj][centb]->Fill(mJets->jtpt[ij],mJets->jteta[ij]);
977 hjetptphi [nj][centb]->Fill(mJets->jtpt[ij],mJets->jtphi[ij]);
978 hjetetaphi[nj][centb]->Fill(mJets->jteta[ij],mJets->jtphi[ij]);
979
980 //! For a given event
981 njets[nj][centb]++;
982 sumjpt[nj]+=mJets->jtpt[ij];
983 sumjpu[nj]+=mJets->jtpu[ij];
984 nmbj[nj]++;
985
986 //! For a given run
987 totjetpt[nj][RunId] += mJets->jtpt[ij];
988 totjets [nj][RunId]++;
989
990 } //! etacut
991 //if(centb==4)std::cout<<Form(" \t \t \t mbjets %s : ",calgo[nj]) <<nmbj[nj]<<"\t centb : "<<centb<<"\t jtpt "<<mJets->jtpt[ij]<<std::endl;
992 }//! # jet loop
993
994 hNref[nj]->Fill(mJets->nref);
995 hNevt_notr[nj][centb]->Fill(vz);
996
997 if(stat_etab[nj]){
998 hNevtmb_etab[nj]->Fill(vz);
999 hNevtpix_etab[nj][ipix]->Fill(vz);
1000 hNevt_etab[nj][centb]->Fill(vz);
1001 }
1002
1003 if(istat[nj]){
1004 hNevt[nj][centb]->Fill(vz);
1005 if(vbin>=0)hNevtvz[nj][vbin]->Fill(vz);
1006 if(ipix>=0)hNevtpix[nj][ipix]->Fill(vz);
1007 hMBJets[nj]->Fill(nmbj[nj]);
1008
1009 hHF_tr[nj]->Fill(hiHF);
1010
1011 //! # of jets distribution
1012 hNjets_dist[nj][centb]->Fill(njets[nj][centb]);
1013 hMBJetsRun [nj]->Fill(RunId,nmbj[nj]);
1014 hJetPtRun [nj]->Fill(RunId,sumjpt[nj]/nmbj[nj]);
1015 hJetPURun [nj]->Fill(RunId,sumjpu[nj]/nmbj[nj]);
1016
1017 }
1018 }//! nj loop
1019
1020 //! Vz distribution
1021 hVz->Fill(vz);
1022
1023 //! HF
1024 if(hiHFhit>0){
1025 hAvHF->Fill(hiHF/hiHFhit);
1026 hAvHFRun->Fill(RunId,hiHF/hiHFhit);
1027 }
1028 if(hiHFhitplus>0){
1029 hAvHFplus->Fill(hiHFplus/hiHFhitplus);
1030 hAvHFplusRun->Fill(RunId,hiHFplus/hiHFhitplus);
1031 }
1032 if(hiHFhitminus>0){
1033 hAvHFminus->Fill(hiHFplus/hiHFhitminus);
1034 hAvHFminusRun->Fill(RunId,hiHFplus/hiHFhitminus);
1035 }
1036 hHF->Fill(hiHF);
1037 hHFPlusMinus->Fill(hiHFplus,hiHFminus);
1038
1039 //! Luminosity run-by-run
1040 hLumiRun->Fill(RunId,LumiBlock);
1041 hLumiBlock->Fill(LumiBlock);
1042 hBin->Fill(hiBin);
1043 hEvtRun->Fill(RunId,vz);
1044
1045 //! ZDC
1046 hZDC->Fill(hiZDC);
1047 hZDCPlusMinus->Fill(hiZDCplus,hiZDCminus);
1048
1049 //! EE
1050 hET->Fill(hiET);
1051 hEB->Fill(hiEB);
1052 hEE->Fill(hiEE);
1053 hEBEE->Fill(hiEB,hiEE);
1054 hEEPlusMinus->Fill(hiEEplus,hiEEminus);
1055
1056 //! vertex
1057 hvz->Fill(vz);
1058 hvzrun->Fill(RunId,vz);
1059 hvxvy->Fill(vx,vy);
1060
1061 //! Pixel
1062 hNpix->Fill(hiNpix);
1063 hNpixelTracks->Fill(hiNpixelTracks);
1064 hNTracks->Fill(hiNtracks);
1065 hNpixelTracksNTracks->Fill(hiNpixelTracks,hiNtracks);
1066
1067 //! Cross correlations
1068 hHFZDC->Fill(hiHF,hiZDC);
1069 hNpixelTracksZDC->Fill(hiNpixelTracks,hiZDC);
1070 hHFNpixelTracks->Fill(hiHF,hiNpixelTracks);
1071
1072 }//! event loop ends
1073
1074 if(!iCountRuns){
1075 std::cout<<std::endl;
1076 std::cout<<std::endl;
1077 std::cout<<std::endl;
1078
1079 if(strcmp(ksp,"pp")==0){
1080 for(int nj=0;nj<knj;nj++){
1081 std::cout<<"# of Events : "<<calgo[nj]<<" \t : "<<hNevt[nj][ncen-1]->Integral()<<"\t # of Jets : "<<hNjets[nj][ncen-1]->Integral()<<std::endl;
1082 }
1083 }else{
1084 for(int nj=0;nj<knj;nj++){
1085 for(int ic=0;ic<ncen-1;ic++){
1086 std::cout<<"# of Events : "<<ccent[ic]<<"\t "<<calgo[nj]<<" \t : "<<hNevt[nj][ic]->Integral()<<"\t # of Jets : "<<hNjets[nj][ic]->Integral()<<std::endl;
1087 }
1088 std::cout<<"\t"<<std::endl;
1089 }
1090 }
1091 std::cout<<std::endl;
1092 std::cout<<std::endl;
1093
1094 for(int nj=0;nj<knj;nj++){
1095 std::cout<<Form("For %s algo : ",calgo[nj])<<std::endl;
1096 for(int ir=0;ir<maxruns;ir++){
1097 if(Run[ir]<0 || totjets[nj][ir]==0)continue;
1098 std::cout<<"\t RunNo : "<<Run[ir]<<"\t Sumjetpt : "<<totjetpt[nj][ir]<<"\t Totjets : "<<totjets[nj][ir]<<"\t <pT> : "<<totjetpt[nj][ir]/totjets[nj][ir]<<std::endl;
1099 hTotJetsRun[nj]->Fill(ir+1,totjets[nj][ir]);
1100 }
1101 }
1102 }
1103
1104 //! Write to output file
1105 fout->cd();
1106 fout->Write();
1107 fout->Close();
1108
1109 //! Check
1110 timer.Stop();
1111 float mbytes = 0.000001*nb;
1112 double rtime = timer.RealTime();
1113 double ctime = timer.CpuTime();
1114
1115 std::cout<<"\t"<<std::endl;
1116 std::cout<<Form("RealTime=%f seconds, CpuTime=%f seconds",rtime,ctime)<<std::endl;
1117 std::cout<<Form("You read %f Mbytes/RealTime seconds",mbytes/rtime)<<std::endl;
1118 std::cout<<Form("You read %f Mbytes/CpuTime seconds",mbytes/ctime)<<std::endl;
1119 std::cout<<"\t"<<std::endl;
1120 std::cout<<"Good bye : " <<"\t"<<std::endl;
1121 }
1122 int GetPtBinSmear(float pt)
1123 {
1124 int ibin=-1;
1125 for(int ix=0;ix<smbins;ix++){
1126 if(pt>=ptbins_smear[ix] && pt<ptbins_smear[ix+1]){
1127 return ix;
1128 }
1129 }
1130 return ibin;
1131 }
1132 int GetCentBin(int bin)
1133 {
1134 int ibin=-1;
1135 //! centrality is defined as 2.5% bins of cross section
1136 //! in 0-39 bins
1137 if(bin<2)ibin=0; //! 0-5%
1138 else if(bin>=2 && bin<4)ibin=1; //! 5-10%
1139 else if(bin>=4 && bin<12)ibin=2; //! 10-30%
1140 else if(bin>=12&& bin<20)ibin=3; //! 30-50%
1141 else if(bin>=20&& bin<28)ibin=4; //! 50-70%
1142 else if(bin>=28&& bin<36)ibin=5; //! 70-90%
1143 return ibin;
1144 }
1145 int GetRunIdx(int irun)
1146 {
1147 int runid=-1;
1148 int istat=1;
1149 int ir=0;
1150 while(istat>0){
1151 if(irun==Run[ir]){
1152 runid=ir;
1153 istat=-1;
1154 }
1155 ir++;
1156 }
1157 return runid;
1158 }
1159 int GetVtxBin(float vz)
1160 {
1161 int ibin=-1;
1162 ibin = (int)(nvtx*(vz+15.0)/30.0); //! vertex bin
1163 if(ibin<0 || ibin>=nvtx)return ibin=-1;
1164 else return ibin;
1165
1166 }
1167 int GetPixelBin(int npixtr)
1168 {
1169 int ibin=-1;
1170 if(npixtr>=700)ibin=0;
1171 else if(npixtr>=200 && npixtr<700)ibin=1;
1172 else if(npixtr>=100 && npixtr<200)ibin=2;
1173 else if(npixtr>=50 && npixtr<100)ibin=3;
1174 else if(npixtr<50)ibin=4;
1175
1176 return ibin;
1177 }
1178 int GetEtaBin(float eta)
1179 {
1180 int ibin=-1;
1181
1182 if(eta>=0 && eta<1.3)ibin=0; //! barrel
1183 else if(eta>=1.3 && eta<2.0)ibin=1;//! endcap+tracks
1184 else if(eta>=2.0 && eta<3.0)ibin=2;//! endcap-notracks
1185 else if(eta>=3.0 && eta<5.0)ibin=3;//! forward
1186
1187 return ibin;
1188 }
1189 void LoadRuns(const char *sp)
1190 {
1191 if(strcmp(sp,"pbpb")==0){
1192 /*HiforestDijet_v7.root*/
1193 Run[0] = 181611; Run[1] = 181683; Run[2] = 181684; Run[3] = 181685; Run[4] = 181686;
1194 Run[5] = 181687; Run[6] = 181688; Run[7] = 181689; Run[8] = 181690; Run[9] = 181691;
1195
1196 Run[10] = 181692; Run[11] = 181693; Run[12] = 181695; Run[13] = 181754; Run[14] = 181759;
1197 Run[15] = 181760; Run[16] = 181777; Run[17] = 181778; Run[18] = 181912; Run[19] = 181913;
1198
1199 Run[20] = 181914; Run[21] = 181938; Run[22] = 181946; Run[23] = 181950; Run[24] = 181969;
1200 Run[25] = 181985; Run[26] = 182052; Run[27] = 182065; Run[28] = 182066; Run[29] = 182098;
1201
1202 Run[30] = 182099; Run[31] = 182124; Run[32] = 182133; Run[33] = 182227; Run[34] = 182228;
1203 Run[35] = 182239; Run[36] = 182241; Run[37] = 182257; Run[38] = 182296; Run[39] = 182324;
1204
1205 Run[40] = 182365; Run[41] = 182382; Run[42] = 182398; Run[43] = 182422; Run[44] = 182536;
1206 Run[45] = 182561; Run[46] = 182572; Run[47] = 182591; Run[48] = 182609; Run[49] = 182664;
1207
1208 Run[50] = 182785; Run[51] = 182798; Run[52] = 182822; Run[53] = 182838; Run[54] = 182890;
1209 Run[55] = 182915; Run[56] = 182916; Run[57] = 182927; Run[58] = 182944; Run[59] = 182960;
1210
1211 Run[60] = 182972; Run[61] = 183013;
1212
1213 //! Recorded Luminosity for these runs
1214 //! Luminosity per run (everything is in /mub)
1215 Lumi[0] = 92.362e-03 ; Lumi[1] = 187.220e-03; Lumi[2] = 219.066e-03; Lumi[3] = 148.002e-03; Lumi[4] = 59.739e-03;
1216 Lumi[5] = 241.659e-03; Lumi[6] = 109.47e-03 ; Lumi[7] = 35.597e-03 ; Lumi[8] = 128.991e-03; Lumi[9] = 96.059e-03;
1217
1218 Lumi[10] = 171.437e-03; Lumi[11] = 206.834e-03; Lumi[12] = 83.324e-03 ; Lumi[13] = 38.624e-03 ; Lumi[14] = 100.677e-03;
1219 Lumi[15] = 224.282e-03; Lumi[16] = 103.743e-03; Lumi[17] = 169.573e-03; Lumi[18] = 697.353e-03; Lumi[19] = 2.333;
1220
1221 Lumi[20] = 47.166e-03; Lumi[21] = 3.184; Lumi[22] = 427.845e-03; Lumi[23] = 709.747e-03; Lumi[24] = 4.541;
1222 Lumi[25] = 4.152 ; Lumi[26] = 4.971; Lumi[27] = 189.544e-03; Lumi[28] = 4.286 ; Lumi[29] = 995.874e-03;
1223
1224 Lumi[30] = 4.351; Lumi[31] = 2.632; Lumi[32] = 1.101 ; Lumi[33] = 198.610e-03; Lumi[34] = 119.643e-03;
1225 Lumi[35] = 1.544; Lumi[36] = 3.124; Lumi[37] = 596.649e-03; Lumi[38] = 3.138 ; Lumi[39] = 4.144;
1226
1227 Lumi[40] = 5.207 ; Lumi[41] = 5.366; Lumi[42] = 105.077e-03; Lumi[43] = 5.123; Lumi[44] = 5.327;
1228 Lumi[45] = 816.714e-03; Lumi[46] = 6.188; Lumi[47] = 5.909 ; Lumi[48] = 6.629; Lumi[49] = 1.745;
1229
1230 Lumi[50] = 5.539; Lumi[51] = 4.551 ; Lumi[52] = 5.172; Lumi[53] = 3.397; Lumi[54] = 5.002;
1231 Lumi[55] = 5.193; Lumi[56] = 264.214e-03; Lumi[57] = 6.613; Lumi[58] = 3.569; Lumi[59] = 5.142;
1232
1233 Lumi[60] = 6.264; Lumi[61] = 6.410;
1234 }
1235 else if(strcmp(sp,"pp")==0){
1236 Run[0] = 161366;Run[1] = 161396;Run[2] = 161404;Run[3] = 161439;Run[4] = 161445;Run[5] = 161450;Run[6] = 161454;Run[7] = 161473;Run[8] = 161474;
1237 }
1238 std::cout<<"Run # loaded according to increasing order" <<std::endl;
1239 }