-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_TH2_from_MCtree.C
executable file
·285 lines (264 loc) · 18.7 KB
/
create_TH2_from_MCtree.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
#if !defined(__CINT__) || defined(__MAKECINT__)
#include <stdio.h>
#include <TCanvas.h>
#include <TTree.h>
#include <TChain.h>
#include <TFile.h>
#include <TH1.h>
#include <TH2.h>
#include <TH3.h>
#include <TProfile.h>
#include <TStyle.h>
#include <TLegend.h>
#include <TLine.h>
#include <TList.h>
#include <TSystem.h>
#include <TGrid.h>
#include <TString.h>
#include <TStopwatch.h>
#include <TGraphErrors.h>
#include <TMath.h>
#include <TStopwatch.h>
#endif
void create_TH2_from_MCtree(){
//============================================================================
//SET ADDRESS
//============================================================================
//char *PATH_IN = "READ_MC/OUTPUT/";
char *PATH_IN = "/home/luca/cernbox/JPSI/JPSI_POLARIZATION/JIRA_TICKET/READ_MC/OUTPUT"; // for ubuntu
//char *PATH_IN = "~/cernbox/JPSI/JPSI_POLARIZATION/JIRA_TICKET/READ_MC/OUTPUT"; // for mac
char FILE_NAME_IN[400];
sprintf(FILE_NAME_IN,"%s/MC_official_tree_Jpsi_PbPb_Nopol.root",PATH_IN);
//============================================================================
//CREATE HISTOGRAMS
//============================================================================
double PI = TMath::Pi();
TH2D *hCostPhiHE_0pt1_2m_gen = new TH2D("hCostPhiHE_0pt1_2m_gen","hCostPhiHE_0pt1_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_1pt2_2m_gen = new TH2D("hCostPhiHE_1pt2_2m_gen","hCostPhiHE_1pt2_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_2pt3_2m_gen = new TH2D("hCostPhiHE_2pt3_2m_gen","hCostPhiHE_2pt3_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_3pt4_2m_gen = new TH2D("hCostPhiHE_3pt4_2m_gen","hCostPhiHE_3pt4_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_4pt5_2m_gen = new TH2D("hCostPhiHE_4pt5_2m_gen","hCostPhiHE_4pt5_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_5pt6_2m_gen = new TH2D("hCostPhiHE_5pt6_2m_gen","hCostPhiHE_5pt6_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_6pt7_2m_gen = new TH2D("hCostPhiHE_6pt7_2m_gen","hCostPhiHE_6pt7_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_7pt8_2m_gen = new TH2D("hCostPhiHE_7pt8_2m_gen","hCostPhiHE_7pt8_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_8pt9_2m_gen = new TH2D("hCostPhiHE_8pt9_2m_gen","hCostPhiHE_8pt9_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_9pt10_2m_gen = new TH2D("hCostPhiHE_9pt10_2m_gen","hCostPhiHE_9pt10_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_10pt11_2m_gen = new TH2D("hCostPhiHE_10pt11_2m_gen","hCostPhiHE_10pt11_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_11pt12_2m_gen = new TH2D("hCostPhiHE_11pt12_2m_gen","hCostPhiHE_11pt12_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_12ptinf_2m_gen = new TH2D("hCostPhiHE_12ptinf_2m_gen","hCostPhiHE_12ptinf_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_0pt1_2m_gen = new TH2D("hCostPhiCS_0pt1_2m_gen","hCostPhiCS_0pt1_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_1pt2_2m_gen = new TH2D("hCostPhiCS_1pt2_2m_gen","hCostPhiCS_1pt2_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_2pt3_2m_gen = new TH2D("hCostPhiCS_2pt3_2m_gen","hCostPhiCS_2pt3_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_3pt4_2m_gen = new TH2D("hCostPhiCS_3pt4_2m_gen","hCostPhiCS_3pt4_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_4pt5_2m_gen = new TH2D("hCostPhiCS_4pt5_2m_gen","hCostPhiCS_4pt5_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_5pt6_2m_gen = new TH2D("hCostPhiCS_5pt6_2m_gen","hCostPhiCS_5pt6_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_6pt7_2m_gen = new TH2D("hCostPhiCS_6pt7_2m_gen","hCostPhiCS_6pt7_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_7pt8_2m_gen = new TH2D("hCostPhiCS_7pt8_2m_gen","hCostPhiCS_7pt8_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_8pt9_2m_gen = new TH2D("hCostPhiCS_8pt9_2m_gen","hCostPhiCS_8pt9_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_9pt10_2m_gen = new TH2D("hCostPhiCS_9pt10_2m_gen","hCostPhiCS_9pt10_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_10pt11_2m_gen = new TH2D("hCostPhiCS_10pt11_2m_gen","hCostPhiCS_10pt11_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_11pt12_2m_gen = new TH2D("hCostPhiCS_11pt12_2m_gen","hCostPhiCS_11pt12_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_12ptinf_2m_gen = new TH2D("hCostPhiCS_12ptinf_2m_gen","hCostPhiCS_12ptinf_2m_gen",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_0pt1_2m_rec = new TH2D("hCostPhiHE_0pt1_2m_rec","hCostPhiHE_0pt1_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_1pt2_2m_rec = new TH2D("hCostPhiHE_1pt2_2m_rec","hCostPhiHE_1pt2_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_2pt3_2m_rec = new TH2D("hCostPhiHE_2pt3_2m_rec","hCostPhiHE_2pt3_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_3pt4_2m_rec = new TH2D("hCostPhiHE_3pt4_2m_rec","hCostPhiHE_3pt4_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_4pt5_2m_rec = new TH2D("hCostPhiHE_4pt5_2m_rec","hCostPhiHE_4pt5_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_5pt6_2m_rec = new TH2D("hCostPhiHE_5pt6_2m_rec","hCostPhiHE_5pt6_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_6pt7_2m_rec = new TH2D("hCostPhiHE_6pt7_2m_rec","hCostPhiHE_6pt7_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_7pt8_2m_rec = new TH2D("hCostPhiHE_7pt8_2m_rec","hCostPhiHE_7pt8_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_8pt9_2m_rec = new TH2D("hCostPhiHE_8pt9_2m_rec","hCostPhiHE_8pt9_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_9pt10_2m_rec = new TH2D("hCostPhiHE_9pt10_2m_rec","hCostPhiHE_9pt10_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_10pt11_2m_rec = new TH2D("hCostPhiHE_10pt11_2m_rec","hCostPhiHE_10pt11_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_11pt12_2m_rec = new TH2D("hCostPhiHE_11pt12_2m_rec","hCostPhiHE_11pt12_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiHE_12ptinf_2m_rec = new TH2D("hCostPhiHE_12ptinf_2m_rec","hCostPhiHE_12ptinf_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_0pt1_2m_rec = new TH2D("hCostPhiCS_0pt1_2m_rec","hCostPhiCS_0pt1_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_1pt2_2m_rec = new TH2D("hCostPhiCS_1pt2_2m_rec","hCostPhiCS_1pt2_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_2pt3_2m_rec = new TH2D("hCostPhiCS_2pt3_2m_rec","hCostPhiCS_2pt3_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_3pt4_2m_rec = new TH2D("hCostPhiCS_3pt4_2m_rec","hCostPhiCS_3pt4_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_4pt5_2m_rec = new TH2D("hCostPhiCS_4pt5_2m_rec","hCostPhiCS_4pt5_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_5pt6_2m_rec = new TH2D("hCostPhiCS_5pt6_2m_rec","hCostPhiCS_5pt6_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_6pt7_2m_rec = new TH2D("hCostPhiCS_6pt7_2m_rec","hCostPhiCS_6pt7_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_7pt8_2m_rec = new TH2D("hCostPhiCS_7pt8_2m_rec","hCostPhiCS_7pt8_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_8pt9_2m_rec = new TH2D("hCostPhiCS_8pt9_2m_rec","hCostPhiCS_8pt9_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_9pt10_2m_rec = new TH2D("hCostPhiCS_9pt10_2m_rec","hCostPhiCS_9pt10_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_10pt11_2m_rec = new TH2D("hCostPhiCS_10pt11_2m_rec","hCostPhiCS_10pt11_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_11pt12_2m_rec = new TH2D("hCostPhiCS_11pt12_2m_rec","hCostPhiCS_11pt12_2m_rec",100,-1,1,50,0,PI);
TH2D *hCostPhiCS_12ptinf_2m_rec = new TH2D("hCostPhiCS_12ptinf_2m_rec","hCostPhiCS_12ptinf_2m_rec",100,-1,1,50,0,PI);
//============================================================================
//OPENING THE FILE
//============================================================================
TChain *chain = new TChain("MCTree");
Long_t *dummy1 = 0, *dummy2 = 0, *dummy3 = 0, *dummy4 = 0;
if(gSystem -> GetPathInfo(FILE_NAME_IN,dummy1,dummy2,dummy3,dummy4) != 0){
printf("NOT EXISTING FILE\n");
return;
}
printf("Opening %s\n",FILE_NAME_IN);
chain -> Add(FILE_NAME_IN);
//============================================================================
//SET TREE VARIABLES -> GENERATION
//============================================================================
//TStopwatch *clock1 = new TStopwatch();
//clock1 -> Start();
Int_t NDimu_gen;
Double_t DimuPt_gen[3000], DimuY_gen[3000];
Double_t CostHE_gen[3000], PhiHE_gen[3000], CostCS_gen[3000], PhiCS_gen[3000];
chain -> SetBranchAddress("NDimu_gen",&NDimu_gen);
chain -> SetBranchAddress("DimuPt_gen",DimuPt_gen);
chain -> SetBranchAddress("DimuY_gen",DimuY_gen);
chain -> SetBranchAddress("CostHE_gen",CostHE_gen);
chain -> SetBranchAddress("PhiHE_gen",PhiHE_gen);
chain -> SetBranchAddress("CostCS_gen",CostCS_gen);
chain -> SetBranchAddress("PhiCS_gen",PhiCS_gen);
//============================================================================
//FILLING HISTOS
//============================================================================
Int_t NEntries = chain -> GetEntries();
for(int i = 0;i < NEntries;i++){
printf("GENERATED %i -> %i : %3.2f%\r",NEntries,i,(double) i/NEntries*100);
chain -> GetEntry(i);
for(int k = 0;k < NDimu_gen;k++){
if(DimuY_gen[k] > -4. && DimuY_gen[k] < -2.5){
if(DimuPt_gen[k] > 0 && DimuPt_gen[k] <= 1){hCostPhiHE_0pt1_2m_gen -> Fill(CostHE_gen[k],TMath::Abs(PhiHE_gen[k])); hCostPhiCS_0pt1_2m_gen -> Fill(CostCS_gen[k],TMath::Abs(PhiCS_gen[k]));}
if(DimuPt_gen[k] > 1 && DimuPt_gen[k] <= 2){hCostPhiHE_1pt2_2m_gen -> Fill(CostHE_gen[k],TMath::Abs(PhiHE_gen[k])); hCostPhiCS_1pt2_2m_gen -> Fill(CostCS_gen[k],TMath::Abs(PhiCS_gen[k]));}
if(DimuPt_gen[k] > 2 && DimuPt_gen[k] <= 3){hCostPhiHE_2pt3_2m_gen -> Fill(CostHE_gen[k],TMath::Abs(PhiHE_gen[k])); hCostPhiCS_2pt3_2m_gen -> Fill(CostCS_gen[k],TMath::Abs(PhiCS_gen[k]));}
if(DimuPt_gen[k] > 3 && DimuPt_gen[k] <= 4){hCostPhiHE_3pt4_2m_gen -> Fill(CostHE_gen[k],TMath::Abs(PhiHE_gen[k])); hCostPhiCS_3pt4_2m_gen -> Fill(CostCS_gen[k],TMath::Abs(PhiCS_gen[k]));}
if(DimuPt_gen[k] > 4 && DimuPt_gen[k] <= 5){hCostPhiHE_4pt5_2m_gen -> Fill(CostHE_gen[k],TMath::Abs(PhiHE_gen[k])); hCostPhiCS_4pt5_2m_gen -> Fill(CostCS_gen[k],TMath::Abs(PhiCS_gen[k]));}
if(DimuPt_gen[k] > 5 && DimuPt_gen[k] <= 6){hCostPhiHE_5pt6_2m_gen -> Fill(CostHE_gen[k],TMath::Abs(PhiHE_gen[k])); hCostPhiCS_5pt6_2m_gen -> Fill(CostCS_gen[k],TMath::Abs(PhiCS_gen[k]));}
if(DimuPt_gen[k] > 6 && DimuPt_gen[k] <= 7){hCostPhiHE_6pt7_2m_gen -> Fill(CostHE_gen[k],TMath::Abs(PhiHE_gen[k])); hCostPhiCS_6pt7_2m_gen -> Fill(CostCS_gen[k],TMath::Abs(PhiCS_gen[k]));}
if(DimuPt_gen[k] > 7 && DimuPt_gen[k] <= 8){hCostPhiHE_7pt8_2m_gen -> Fill(CostHE_gen[k],TMath::Abs(PhiHE_gen[k])); hCostPhiCS_7pt8_2m_gen -> Fill(CostCS_gen[k],TMath::Abs(PhiCS_gen[k]));}
if(DimuPt_gen[k] > 8 && DimuPt_gen[k] <= 9){hCostPhiHE_8pt9_2m_gen -> Fill(CostHE_gen[k],TMath::Abs(PhiHE_gen[k])); hCostPhiCS_8pt9_2m_gen -> Fill(CostCS_gen[k],TMath::Abs(PhiCS_gen[k]));}
if(DimuPt_gen[k] > 9 && DimuPt_gen[k] <= 10){hCostPhiHE_9pt10_2m_gen -> Fill(CostHE_gen[k],TMath::Abs(PhiHE_gen[k])); hCostPhiCS_9pt10_2m_gen -> Fill(CostCS_gen[k],TMath::Abs(PhiCS_gen[k]));}
if(DimuPt_gen[k] > 10 && DimuPt_gen[k] <= 11){hCostPhiHE_10pt11_2m_gen -> Fill(CostHE_gen[k],TMath::Abs(PhiHE_gen[k])); hCostPhiCS_10pt11_2m_gen -> Fill(CostCS_gen[k],TMath::Abs(PhiCS_gen[k]));}
if(DimuPt_gen[k] > 11 && DimuPt_gen[k] <= 12){hCostPhiHE_11pt12_2m_gen -> Fill(CostHE_gen[k],TMath::Abs(PhiHE_gen[k])); hCostPhiCS_11pt12_2m_gen -> Fill(CostCS_gen[k],TMath::Abs(PhiCS_gen[k]));}
if(DimuPt_gen[k] > 12){hCostPhiHE_12ptinf_2m_gen -> Fill(CostHE_gen[k],TMath::Abs(PhiHE_gen[k])); hCostPhiCS_12ptinf_2m_gen -> Fill(CostCS_gen[k],TMath::Abs(PhiCS_gen[k]));}
}
}
}
printf("\n");
//clock1 -> Stop();
//clock1 -> Print();
//==========================================================================
//SET TREE VARIABLES -> RECONSTRUCTION
//==========================================================================
//TStopwatch *clock2 = new TStopwatch();
//clock2 -> Start();
Int_t NDimu_rec;
Double_t DimuPt_rec[3000], DimuY_rec[3000];
Double_t DimuMass_rec[3000];
Int_t DimuMatch_rec[3000];
Double_t CostHE_rec[3000], PhiHE_rec[3000], CostCS_rec[3000], PhiCS_rec[3000];
//Bool_t IsPhysSelected;
//chain -> SetBranchAddress("FiredTriggerClasses",TrigClass); //???
chain -> SetBranchAddress("NDimu_rec",&NDimu_rec);
chain -> SetBranchAddress("DimuPt_rec",DimuPt_rec);
chain -> SetBranchAddress("DimuY_rec",DimuY_rec);
chain -> SetBranchAddress("DimuMass_rec",DimuMass_rec);
chain -> SetBranchAddress("DimuMatch_rec",DimuMatch_rec);
chain -> SetBranchAddress("CostHE_rec",CostHE_rec);
chain -> SetBranchAddress("PhiHE_rec",PhiHE_rec);
chain -> SetBranchAddress("CostCS_rec",CostCS_rec);
chain -> SetBranchAddress("PhiCS_rec",PhiCS_rec);
//chain -> SetBranchAddress("IsPhysSelected",&IsPhysSelected); //???
//============================================================================
//FILLING HISTOS
//============================================================================
NEntries = chain -> GetEntries();
for(int i = 0;i < NEntries;i++){
printf("RECONSTRUCTED %i -> %i : %3.2f%\r",NEntries,i,(double) i/NEntries*100);
chain -> GetEntry(i);
for(int k = 0;k < NDimu_rec;k++){
//if(IsPhysSelected){
//TString Trigger = TrigClass;
//Bool_t TriggerSelected = kFALSE;
//if(Trigger.Contains("CMUL7-B-NOPF-MUFAST")) TriggerSelected = kTRUE;
if(DimuY_rec[k] > -4. && DimuY_rec[k] < -2.5){
//if(TriggerSelected){
if(DimuMatch_rec[k] == 2){
if(DimuMass_rec[k] > 2 && DimuMass_rec[k] < 5){
if(DimuPt_rec[k] > 0 && DimuPt_rec[k] <= 1){hCostPhiHE_0pt1_2m_rec -> Fill(CostHE_rec[k],TMath::Abs(PhiHE_rec[k])); hCostPhiCS_0pt1_2m_rec -> Fill(CostCS_rec[k],TMath::Abs(PhiCS_rec[k]));}
if(DimuPt_rec[k] > 1 && DimuPt_rec[k] <= 2){hCostPhiHE_1pt2_2m_rec -> Fill(CostHE_rec[k],TMath::Abs(PhiHE_rec[k])); hCostPhiCS_1pt2_2m_rec -> Fill(CostCS_rec[k],TMath::Abs(PhiCS_rec[k]));}
if(DimuPt_rec[k] > 2 && DimuPt_rec[k] <= 3){hCostPhiHE_2pt3_2m_rec -> Fill(CostHE_rec[k],TMath::Abs(PhiHE_rec[k])); hCostPhiCS_2pt3_2m_rec -> Fill(CostCS_rec[k],TMath::Abs(PhiCS_rec[k]));}
if(DimuPt_rec[k] > 3 && DimuPt_rec[k] <= 4){hCostPhiHE_3pt4_2m_rec -> Fill(CostHE_rec[k],TMath::Abs(PhiHE_rec[k])); hCostPhiCS_3pt4_2m_rec -> Fill(CostCS_rec[k],TMath::Abs(PhiCS_rec[k]));}
if(DimuPt_rec[k] > 4 && DimuPt_rec[k] <= 5){hCostPhiHE_4pt5_2m_rec -> Fill(CostHE_rec[k],TMath::Abs(PhiHE_rec[k])); hCostPhiCS_4pt5_2m_rec -> Fill(CostCS_rec[k],TMath::Abs(PhiCS_rec[k]));}
if(DimuPt_rec[k] > 5 && DimuPt_rec[k] <= 6){hCostPhiHE_5pt6_2m_rec -> Fill(CostHE_rec[k],TMath::Abs(PhiHE_rec[k])); hCostPhiCS_5pt6_2m_rec -> Fill(CostCS_rec[k],TMath::Abs(PhiCS_rec[k]));}
if(DimuPt_rec[k] > 6 && DimuPt_rec[k] <= 7){hCostPhiHE_6pt7_2m_rec -> Fill(CostHE_rec[k],TMath::Abs(PhiHE_rec[k])); hCostPhiCS_6pt7_2m_rec -> Fill(CostCS_rec[k],TMath::Abs(PhiCS_rec[k]));}
if(DimuPt_rec[k] > 7 && DimuPt_rec[k] <= 8){hCostPhiHE_7pt8_2m_rec -> Fill(CostHE_rec[k],TMath::Abs(PhiHE_rec[k])); hCostPhiCS_7pt8_2m_rec -> Fill(CostCS_rec[k],TMath::Abs(PhiCS_rec[k]));}
if(DimuPt_rec[k] > 8 && DimuPt_rec[k] <= 9){hCostPhiHE_8pt9_2m_rec -> Fill(CostHE_rec[k],TMath::Abs(PhiHE_rec[k])); hCostPhiCS_8pt9_2m_rec -> Fill(CostCS_rec[k],TMath::Abs(PhiCS_rec[k]));}
if(DimuPt_rec[k] > 9 && DimuPt_rec[k] <= 10){hCostPhiHE_9pt10_2m_rec -> Fill(CostHE_rec[k],TMath::Abs(PhiHE_rec[k])); hCostPhiCS_9pt10_2m_rec -> Fill(CostCS_rec[k],TMath::Abs(PhiCS_rec[k]));}
if(DimuPt_rec[k] > 10 && DimuPt_rec[k] <= 11){hCostPhiHE_10pt11_2m_rec -> Fill(CostHE_rec[k],TMath::Abs(PhiHE_rec[k])); hCostPhiCS_10pt11_2m_rec -> Fill(CostCS_rec[k],TMath::Abs(PhiCS_rec[k]));}
if(DimuPt_rec[k] > 11 && DimuPt_rec[k] <= 12){hCostPhiHE_11pt12_2m_rec -> Fill(CostHE_rec[k],TMath::Abs(PhiHE_rec[k])); hCostPhiCS_11pt12_2m_rec -> Fill(CostCS_rec[k],TMath::Abs(PhiCS_rec[k]));}
if(DimuPt_rec[k] > 12){hCostPhiHE_12ptinf_2m_rec -> Fill(CostHE_rec[k],TMath::Abs(PhiHE_rec[k])); hCostPhiCS_12ptinf_2m_rec -> Fill(CostCS_rec[k],TMath::Abs(PhiCS_rec[k]));}
}
}
//}
}
//}
}
}
printf("\n");
//clock2 -> Stop();
//clock2 -> Print();
//============================================================================
//SAVE FILES
//============================================================================
//char *PATH_OUT = "READING_MC/OUTPUT_TREE/OUTPUT_TH3";
char FILE_NAME_OUT[400];
//sprintf(FILE_NAME_OUT,"/home/luca/cernbox/JPSI/JPSI_POLARIZATION/ANALYSIS/TWO_DIM_APPROACH/ACCXEFF/HISTOS_FOR_ACCXEFF/GIT_OUTPUT/HistosFromOfficialTree_Jpsi_PbPb_Nopol.root"); // for ubuntu
sprintf(FILE_NAME_OUT,"~/cernbox/JPSI/JPSI_POLARIZATION/ANALYSIS/TWO_DIM_APPROACH/ACCXEFF/HISTOS_FOR_ACCXEFF/GIT_OUTPUT/HistosFromOfficialTree_Jpsi_PbPb_Nopol.root"); // for mac
TFile *file_out = new TFile(FILE_NAME_OUT,"RECREATE");
file_out -> cd();
hCostPhiHE_0pt1_2m_gen -> Write();
hCostPhiHE_1pt2_2m_gen -> Write();
hCostPhiHE_2pt3_2m_gen -> Write();
hCostPhiHE_3pt4_2m_gen -> Write();
hCostPhiHE_4pt5_2m_gen -> Write();
hCostPhiHE_5pt6_2m_gen -> Write();
hCostPhiHE_6pt7_2m_gen -> Write();
hCostPhiHE_7pt8_2m_gen -> Write();
hCostPhiHE_8pt9_2m_gen -> Write();
hCostPhiHE_9pt10_2m_gen -> Write();
hCostPhiHE_10pt11_2m_gen -> Write();
hCostPhiHE_11pt12_2m_gen -> Write();
hCostPhiHE_12ptinf_2m_gen -> Write();
hCostPhiCS_0pt1_2m_gen -> Write();
hCostPhiCS_1pt2_2m_gen -> Write();
hCostPhiCS_2pt3_2m_gen -> Write();
hCostPhiCS_3pt4_2m_gen -> Write();
hCostPhiCS_4pt5_2m_gen -> Write();
hCostPhiCS_5pt6_2m_gen -> Write();
hCostPhiCS_6pt7_2m_gen -> Write();
hCostPhiCS_7pt8_2m_gen -> Write();
hCostPhiCS_8pt9_2m_gen -> Write();
hCostPhiCS_9pt10_2m_gen -> Write();
hCostPhiCS_10pt11_2m_gen -> Write();
hCostPhiCS_11pt12_2m_gen -> Write();
hCostPhiCS_12ptinf_2m_gen -> Write();
hCostPhiHE_0pt1_2m_rec -> Write();
hCostPhiHE_1pt2_2m_rec -> Write();
hCostPhiHE_2pt3_2m_rec -> Write();
hCostPhiHE_3pt4_2m_rec -> Write();
hCostPhiHE_4pt5_2m_rec -> Write();
hCostPhiHE_5pt6_2m_rec -> Write();
hCostPhiHE_6pt7_2m_rec -> Write();
hCostPhiHE_7pt8_2m_rec -> Write();
hCostPhiHE_8pt9_2m_rec -> Write();
hCostPhiHE_9pt10_2m_rec -> Write();
hCostPhiHE_10pt11_2m_rec -> Write();
hCostPhiHE_11pt12_2m_rec -> Write();
hCostPhiHE_12ptinf_2m_rec -> Write();
hCostPhiCS_0pt1_2m_rec -> Write();
hCostPhiCS_1pt2_2m_rec -> Write();
hCostPhiCS_2pt3_2m_rec -> Write();
hCostPhiCS_3pt4_2m_rec -> Write();
hCostPhiCS_4pt5_2m_rec -> Write();
hCostPhiCS_5pt6_2m_rec -> Write();
hCostPhiCS_6pt7_2m_rec -> Write();
hCostPhiCS_7pt8_2m_rec -> Write();
hCostPhiCS_8pt9_2m_rec -> Write();
hCostPhiCS_9pt10_2m_rec -> Write();
hCostPhiCS_10pt11_2m_rec -> Write();
hCostPhiCS_11pt12_2m_rec -> Write();
hCostPhiCS_12ptinf_2m_rec -> Write();
}