respProfiles.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////
2 // //
3 // SECOND ANALYSIS //
4 // //
5 // Detector response //
6 // TH2 and TProfiles of PECorr/cm vs W //
7 // Ratio between profiles in both x and y views //
8 // //
9 // Created by: Diana Patricia Mendez //
10 // 10 March 2016 //
11 // //
12 // Input files generated with COLZ.cxx //
13 ////////////////////////////////////////////////////////////////
14 
15 #include <iostream>
16 #include <TFile.h>
17 #include <TPad.h>
18 #include <TProfile.h>
19 #include <TProfile2D.h>
20 #include <TH1.h>
21 #include <TH2.h>
22 #include <TH3.h>
23 #include <TH1F.h>
24 #include <TH2F.h>
25 #include <TH3F.h>
26 #include <TH1D.h>
27 #include <TH2D.h>
28 #include <TH3D.h>
29 #include <TCanvas.h>
30 #include <TVector.h>
31 #include <TColor.h>
32 #include <TLegend.h>
33 #include <TLatex.h>
34 #include <TMath.h>
35 #include <TStyle.h>
36 #include <TROOT.h>
37 #include <TPad.h>
38 #include <TFile.h>
39 #include <TTree.h>
40 #include <TSystem.h>
41 #include <TColor.h>
42 
43 //nova_PlotStyle.C in Utilities package
44 //You can modify this and write other cool stuff :D
45 #include "Utilities/rootlogon.C"
46 
47 // canvas size
48 #define c1_x 700
49 #define c1_y 500
50 
51 #define c2_x 1000
52 #define c2_y 500
53 
54 
55 double GetHistMax(TH1* h0, TH1* h1, TH1* h2, TH1* h3){
56  double max[4];
57  max[0] = h0->GetMaximum();
58  max[1] = h1->GetMaximum();
59  max[2] = h2->GetMaximum();
60  max[3] = h3->GetMaximum();
61 
62  double hiy = 0;
63  for(int i=1;i<4;i++){
64  if(max[i]>hiy)
65  hiy = max[i];
66  }
67  return (hiy * 1.1);
68 }
69 
70 
71 int main(){
72 
73  gROOT->ForceStyle();
74 
75 
76  double const fdmcg100 = 1;
77  double const fdmcg140 = 1;
78  double const fddatap1 = 1;
79  double const fddatap2 = 1;
80  double const fddatae3b = 1;
81  double const fddatae3c = 1;
82  double const ndmcprod2 = 1;
83  double const nddatap2 = 1;
84  double const nddatae3b = 1;
85  double const nddatae3c = 1;
86  // double const fdmcg100 = 40.2581;
87  // double const fdmcg140 = 39.8785;
88  // double const fddatap1 = 40.9849;
89  // double const fddatap2 = 41.009;
90  // double const fddatae3b = 40.6475;
91  // double const fddatae3c = 40.6484;
92  // double const ndmcprod2 = 41.6168;
93  // double const nddatap2 = 41.3987;
94  // double const nddatae3b = 41.7269;
95  // double const nddatae3c = 41.7548;
96 
97 
98  TFile *fmc_gain100 = new TFile("mcg100.root");
99  TH2D *hfdmc_gain100_PECorrWX1 = (TH2D*)fmc_gain100->Get("hPECorrWX");
100  TH2D *hfdmc_gain100_PECorrWY1 = (TH2D*)fmc_gain100->Get("hPECorrWY");
101  TH1D *hfdmc_gain100_WX = (TH1D*)fmc_gain100->Get("hWX");
102  TH1D *hfdmc_gain100_WY = (TH1D*)fmc_gain100->Get("hWY");
103  hfdmc_gain100_WX->Scale(1000/hfdmc_gain100_WX->Integral());
104  hfdmc_gain100_WY->Scale(1000/hfdmc_gain100_WY->Integral());
105 
106 
107  TFile *fmc_gain140 = new TFile("mcg140.root");
108  TH2D *hfdmc_gain140_PECorrWX1 = (TH2D*)fmc_gain140->Get("hPECorrWX");
109  TH2D *hfdmc_gain140_PECorrWY1 = (TH2D*)fmc_gain140->Get("hPECorrWY");
110  TH1D *hfdmc_gain140_WX = (TH1D*)fmc_gain140->Get("hWX");
111  TH1D *hfdmc_gain140_WY = (TH1D*)fmc_gain140->Get("hWY");
112  hfdmc_gain140_WX->Scale(1000/hfdmc_gain140_WX->Integral());
113  hfdmc_gain140_WY->Scale(1000/hfdmc_gain140_WY->Integral());
114 
115 
116  TFile *fmc_prod2 = new TFile("ndmc_prod2.root");
117  TH2D *hndmc_prod2_PECorrWX1 = (TH2D*)fmc_prod2->Get("hPECorrWX");
118  TH2D *hndmc_prod2_PECorrWY1 = (TH2D*)fmc_prod2->Get("hPECorrWY");
119  TH1D *hndmc_prod2_WX = (TH1D*)fmc_prod2->Get("hWX");
120  TH1D *hndmc_prod2_WY = (TH1D*)fmc_prod2->Get("hWY");
121  hndmc_prod2_WX->Scale(1000/hndmc_prod2_WX->Integral());
122  hndmc_prod2_WY->Scale(1000/hndmc_prod2_WY->Integral());
123 
124 
125  TFile *fdata_period1 = new TFile("fddata_period1.root");
126  TH2D *hfddata_period1_PECorrWX1 = (TH2D*)fdata_period1->Get("hPECorrWX");
127  TH2D *hfddata_period1_PECorrWY1 = (TH2D*)fdata_period1->Get("hPECorrWY");
128  TH1D *hfddata_period1_WX = (TH1D*)fdata_period1->Get("hWX");
129  TH1D *hfddata_period1_WY = (TH1D*)fdata_period1->Get("hWY");
130  hfddata_period1_WX->Scale(1000/hfddata_period1_WX->Integral());
131  hfddata_period1_WY->Scale(1000/hfddata_period1_WY->Integral());
132 
133 
134  TFile *fdata_period2 = new TFile("fddata_period2.root");
135  TH2D *hfddata_period2_PECorrWX1 = (TH2D*)fdata_period2->Get("hPECorrWX");
136  TH2D *hfddata_period2_PECorrWY1 = (TH2D*)fdata_period2->Get("hPECorrWY");
137  TH1D *hfddata_period2_WX = (TH1D*)fdata_period2->Get("hWX");
138  TH1D *hfddata_period2_WY = (TH1D*)fdata_period2->Get("hWY");
139  hfddata_period2_WX->Scale(1000/hfddata_period2_WX->Integral());
140  hfddata_period2_WY->Scale(1000/hfddata_period2_WY->Integral());
141 
142 
143  TFile *fdata_epoch3b = new TFile("fddata_epoch3b.root");
144  TH2D *hfddata_epoch3b_PECorrWX1 = (TH2D*)fdata_epoch3b->Get("hPECorrWX");
145  TH2D *hfddata_epoch3b_PECorrWY1 = (TH2D*)fdata_epoch3b->Get("hPECorrWY");
146  TH1D *hfddata_epoch3b_WX = (TH1D*)fdata_epoch3b->Get("hWX");
147  TH1D *hfddata_epoch3b_WY = (TH1D*)fdata_epoch3b->Get("hWY");
148  hfddata_epoch3b_WX->Scale(1000/hfddata_epoch3b_WX->Integral());
149  hfddata_epoch3b_WY->Scale(1000/hfddata_epoch3b_WY->Integral());
150 
151 
152  TFile *fdata_epoch3c = new TFile("fddata_epoch3c.root");
153  TH2D *hfddata_epoch3c_PECorrWX1 = (TH2D*)fdata_epoch3c->Get("hPECorrWX");
154  TH2D *hfddata_epoch3c_PECorrWY1 = (TH2D*)fdata_epoch3c->Get("hPECorrWY");
155  TH1D *hfddata_epoch3c_WX = (TH1D*)fdata_epoch3c->Get("hWX");
156  TH1D *hfddata_epoch3c_WY = (TH1D*)fdata_epoch3c->Get("hWY");
157  hfddata_epoch3c_WX->Scale(1000/hfddata_epoch3c_WX->Integral());
158  hfddata_epoch3c_WY->Scale(1000/hfddata_epoch3c_WY->Integral());
159 
160 
161  TFile *fnddata_period2 = new TFile("nddata_period2.root");
162  TH2D *hnddata_period2_PECorrWX1 = (TH2D*)fnddata_period2->Get("hPECorrWX");
163  TH2D *hnddata_period2_PECorrWY1 = (TH2D*)fnddata_period2->Get("hPECorrWY");
164  TH1D *hnddata_period2_WX = (TH1D*)fnddata_period2->Get("hWX");
165  TH1D *hnddata_period2_WY = (TH1D*)fnddata_period2->Get("hWY");
166  hnddata_period2_WX->Scale(1000/hnddata_period2_WX->Integral());
167  hnddata_period2_WY->Scale(1000/hnddata_period2_WY->Integral());
168 
169 
170  TFile *fnddata_epoch3b = new TFile("nddata_epoch3b.root");
171  TH2D *hnddata_epoch3b_PECorrWX1 = (TH2D*)fnddata_epoch3b->Get("hPECorrWX");
172  TH2D *hnddata_epoch3b_PECorrWY1 = (TH2D*)fnddata_epoch3b->Get("hPECorrWY");
173  TH1D *hnddata_epoch3b_WX = (TH1D*)fnddata_epoch3b->Get("hWX");
174  TH1D *hnddata_epoch3b_WY = (TH1D*)fnddata_epoch3b->Get("hWY");
175  hnddata_epoch3b_WX->Scale(1000/hnddata_epoch3b_WX->Integral());
176  hnddata_epoch3b_WY->Scale(1000/hnddata_epoch3b_WY->Integral());
177 
178 
179  TFile *fnddata_epoch3c = new TFile("nddata_epoch3c.root");
180  TH2D *hnddata_epoch3c_PECorrWX1 = (TH2D*)fnddata_epoch3c->Get("hPECorrWX");
181  TH2D *hnddata_epoch3c_PECorrWY1 = (TH2D*)fnddata_epoch3c->Get("hPECorrWY");
182  TH1D *hnddata_epoch3c_WX = (TH1D*)fnddata_epoch3c->Get("hWX");
183  TH1D *hnddata_epoch3c_WY = (TH1D*)fnddata_epoch3c->Get("hWY");
184  hnddata_epoch3c_WX->Scale(1000/hnddata_epoch3c_WX->Integral());
185  hnddata_epoch3c_WY->Scale(1000/hnddata_epoch3c_WY->Integral());
186 
187 
188 
189  TH1D* one = new TH1D("one","one",160,-800,800);
190  TH1D* frac = new TH1D("frac","frac",160,-800,800);
191  for(unsigned int k=0; k<160; k++){
192  one->SetBinContent(k+1,1);
193  frac->SetBinContent(k+1,1.775);
194  }
195  one->SetLineStyle(7);
196  frac->SetLineStyle(7);
197 
198 
199 
200 
201 
202  /////////////////////////////////////
203  // 2D PECorr/cm vs W Histograms //
204  /////////////////////////////////////
205 
206 
207  TH1D* hfdmc_gain100_PECorrWX = (TH1D*)(hfdmc_gain100_PECorrWX1->ProfileX())->Clone("hfdmc_gain100_PECorrWX");
208  TH1D* hfdmc_gain100_PECorrWY = (TH1D*)(hfdmc_gain100_PECorrWY1->ProfileX())->Clone("hfdmc_gain100_PECorrWY");
209  TH1D* hfdmc_gain140_PECorrWX = (TH1D*)(hfdmc_gain140_PECorrWX1->ProfileX())->Clone("hfdmc_gain140_PECorrWX");
210  TH1D* hfdmc_gain140_PECorrWY = (TH1D*)(hfdmc_gain140_PECorrWY1->ProfileX())->Clone("hfdmc_gain140_PECorrWY");
211  TH1D* hndmc_prod2_PECorrWX = (TH1D*)(hndmc_prod2_PECorrWX1->ProfileX())->Clone("hndmc_prod2_PECorrWX");
212  TH1D* hndmc_prod2_PECorrWY = (TH1D*)(hndmc_prod2_PECorrWY1->ProfileX())->Clone("hndmc_prod2_PECorrWY");
213 
214  TH1D* hfddata_period1_PECorrWX = (TH1D*)(hfddata_period1_PECorrWX1->ProfileX())->Clone("hfddata_period1_PECorrWX");
215  TH1D* hfddata_period1_PECorrWY = (TH1D*)(hfddata_period1_PECorrWY1->ProfileX())->Clone("hfddata_period1_PECorrWY");
216  TH1D* hfddata_period2_PECorrWX = (TH1D*)(hfddata_period2_PECorrWX1->ProfileX())->Clone("hfddata_period2_PECorrWX");
217  TH1D* hfddata_period2_PECorrWY = (TH1D*)(hfddata_period2_PECorrWY1->ProfileX())->Clone("hfddata_period2_PECorrWY");
218  TH1D* hfddata_epoch3b_PECorrWX = (TH1D*)(hfddata_epoch3b_PECorrWX1->ProfileX())->Clone("hfddata_epoch3b_PECorrWX");
219  TH1D* hfddata_epoch3b_PECorrWY = (TH1D*)(hfddata_epoch3b_PECorrWY1->ProfileX())->Clone("hfddata_epoch3b_PECorrWY");
220  TH1D* hfddata_epoch3c_PECorrWX = (TH1D*)(hfddata_epoch3c_PECorrWX1->ProfileX())->Clone("hfddata_epoch3c_PECorrWX");
221  TH1D* hfddata_epoch3c_PECorrWY = (TH1D*)(hfddata_epoch3c_PECorrWY1->ProfileX())->Clone("hfddata_epoch3c_PECorrWY");
222 
223  TH1D* hnddata_period2_PECorrWX = (TH1D*)(hnddata_period2_PECorrWX1->ProfileX())->Clone("hnddata_period2_PECorrWX");
224  TH1D* hnddata_period2_PECorrWY = (TH1D*)(hnddata_period2_PECorrWY1->ProfileX())->Clone("hnddata_period2_PECorrWY");
225  TH1D* hnddata_epoch3b_PECorrWX = (TH1D*)(hnddata_epoch3b_PECorrWX1->ProfileX())->Clone("hnddata_epoch3b_PECorrWX");
226  TH1D* hnddata_epoch3b_PECorrWY = (TH1D*)(hnddata_epoch3b_PECorrWY1->ProfileX())->Clone("hnddata_epoch3b_PECorrWY");
227  TH1D* hnddata_epoch3c_PECorrWX = (TH1D*)(hnddata_epoch3c_PECorrWX1->ProfileX())->Clone("hnddata_epoch3c_PECorrWX");
228  TH1D* hnddata_epoch3c_PECorrWY = (TH1D*)(hnddata_epoch3c_PECorrWY1->ProfileX())->Clone("hnddata_epoch3c_PECorrWY");
229 
230  hfdmc_gain100_PECorrWX ->Scale(1/fdmcg100);
231  hfdmc_gain100_PECorrWY ->Scale(1/fdmcg100);
232  hfdmc_gain140_PECorrWX ->Scale(1/fdmcg140);
233  hfdmc_gain140_PECorrWY ->Scale(1/fdmcg140);
234  hndmc_prod2_PECorrWX ->Scale(1/ndmcprod2);
235  hndmc_prod2_PECorrWY ->Scale(1/ndmcprod2);
236  hfddata_period1_PECorrWX ->Scale(1/fddatap1);
237  hfddata_period1_PECorrWY ->Scale(1/fddatap1);
238  hfddata_period2_PECorrWX ->Scale(1/fddatap2);
239  hfddata_period2_PECorrWY ->Scale(1/fddatap2);
240  hfddata_epoch3b_PECorrWX ->Scale(1/fddatae3b);
241  hfddata_epoch3b_PECorrWY ->Scale(1/fddatae3b);
242  hfddata_epoch3c_PECorrWX ->Scale(1/fddatae3c);
243  hfddata_epoch3c_PECorrWY ->Scale(1/fddatae3c);
244  hnddata_period2_PECorrWX ->Scale(1/nddatap2);
245  hnddata_period2_PECorrWY ->Scale(1/nddatap2);
246  hnddata_epoch3b_PECorrWX ->Scale(1/nddatae3b);
247  hnddata_epoch3b_PECorrWY ->Scale(1/nddatae3b);
248  hnddata_epoch3c_PECorrWX ->Scale(1/nddatae3c);
249  hnddata_epoch3c_PECorrWY ->Scale(1/nddatae3c);
250 
251 
252  TH1D* fddatax_p1 = (TH1D*)(hfddata_period1_PECorrWX)->Clone("fddatax_p1");
253  TH1D* fddatax_p2 = (TH1D*)(hfddata_period2_PECorrWX)->Clone("fddatax_p2");
254  TH1D* fddatax_e3b = (TH1D*)(hfddata_epoch3b_PECorrWX)->Clone("fddatax_e3b");
255  TH1D* fddatax_e3c = (TH1D*)(hfddata_epoch3c_PECorrWX)->Clone("fddatax_e3c");
256 
257  TH1D* fddatay_p1 = (TH1D*)(hfddata_period1_PECorrWY)->Clone("fddatay_p1");
258  TH1D* fddatay_p2 = (TH1D*)(hfddata_period2_PECorrWY)->Clone("fddatay_p2");
259  TH1D* fddatay_e3b = (TH1D*)(hfddata_epoch3b_PECorrWY)->Clone("fddatay_e3b");
260  TH1D* fddatay_e3c = (TH1D*)(hfddata_epoch3c_PECorrWY)->Clone("fddatay_e3c");
261 
262 
263  fddatax_p1 ->Divide(hfdmc_gain100_PECorrWX); // Data/MC
264  fddatax_p2 ->Divide(hfdmc_gain100_PECorrWX); // Data/MC
265  fddatax_e3b ->Divide(hfdmc_gain140_PECorrWX); // Data/MC
266  fddatax_e3c ->Divide(hfdmc_gain140_PECorrWX); // Data/MC
267 
268  fddatay_p1 ->Divide(hfdmc_gain100_PECorrWY); // Data/MC
269  fddatay_p2 ->Divide(hfdmc_gain100_PECorrWY); // Data/MC
270  fddatay_e3b ->Divide(hfdmc_gain140_PECorrWY); // Data/MC
271  fddatay_e3c ->Divide(hfdmc_gain140_PECorrWY); // Data/MC
272 
273  fddatax_p1 ->SetLineColor(kGreen+1);
274  fddatax_p2 ->SetLineColor(kMagenta+2);
275  fddatax_e3b ->SetLineColor(kOrange-3);
276  fddatax_e3c ->SetLineColor(kBlue-7);
277 
278  fddatay_p1 ->SetLineColor(kGreen+1);
279  fddatay_p2 ->SetLineColor(kMagenta+2);
280  fddatay_e3b ->SetLineColor(kOrange-3);
281  fddatay_e3c ->SetLineColor(kBlue-7);
282 
283 
284 
285 
286 
287  TCanvas *cFD_X = new TCanvas("cFD_X","cFD_X", 700, 500);
288  cFD_X->cd();
289 
290  TPad *p1FD_X = new TPad("p1FD_X","p1FD_X",0.,0.,1.,1.);
291  p1FD_X->SetBottomMargin(0.0);
292  p1FD_X->SetLeftMargin(0.12);
293  p1FD_X->SetRightMargin(0.05);
294  cFD_X->cd();
295  p1FD_X->Draw();
296  p1FD_X->cd();
297  gPad->SetTicky(1);
298  hfddata_period1_PECorrWX->GetYaxis()->SetRangeUser(0, 80);
299  hfddata_period1_PECorrWX->GetXaxis()->SetTitle("W, x-view");
300  hfddata_period1_PECorrWX->GetYaxis()->SetTitle("PECorr/cm");
301  CenterTitles(hfddata_period1_PECorrWX);
302  hfdmc_gain100_PECorrWX->SetLineColor(kBlack);
303  hfdmc_gain140_PECorrWX->SetLineColor(kPink+9);
304  hfddata_period1_PECorrWX->SetLineColor(kGreen+1);
305  hfddata_period2_PECorrWX->SetLineColor(kMagenta+2);
306  hfddata_epoch3b_PECorrWX->SetLineColor(kOrange-3);
307  hfddata_epoch3c_PECorrWX->SetLineColor(kBlue-7);
308  // hfdmc_gain100_PECorrWX->Draw("lep");
309  // hfdmc_gain140_PECorrWX->Draw("lep same");
310  // frac->Draw("hist same");
311  hfddata_period1_PECorrWX->Draw("hist");
312  hfddata_period2_PECorrWX->Draw("hist same");
313  hfddata_epoch3b_PECorrWX->Draw("hist same");
314  hfddata_epoch3c_PECorrWX->Draw("hist same");
315  hfdmc_gain100_PECorrWX->Draw("lep same");
316  hfdmc_gain140_PECorrWX->Draw("lep same");
317  TLegend* lFD_X = new TLegend(0.3,0.2,0.6,0.4,"");
318  lFD_X ->AddEntry(hfdmc_gain100_PECorrWX, "MC gain 100","p");
319  lFD_X ->AddEntry(hfdmc_gain140_PECorrWX, "MC gain 140","p");
320  lFD_X ->AddEntry(hfddata_period1_PECorrWX, "Data period 1","l");
321  lFD_X ->AddEntry(hfddata_period2_PECorrWX, "Data period 2","l");
322  lFD_X ->AddEntry(hfddata_epoch3b_PECorrWX, "Data epoch 3b","l");
323  lFD_X ->AddEntry(hfddata_epoch3c_PECorrWX, "Data epoch 3c","l");
324  lFD_X ->SetFillStyle(0);
325  lFD_X ->SetBorderSize(0);
326  lFD_X ->SetTextFont(42);
327  lFD_X ->SetTextSize(0.05);
328  // lFD_X ->Draw();
329 
330  TPad *p2FD_X = new TPad("p2FD_X","p2FD_X",0.,0.,1.,0.3);
331  p2FD_X->SetTopMargin(0.0);
332  p2FD_X->SetBottomMargin(0.22);
333  p2FD_X->SetLeftMargin(0.12);
334  p2FD_X->SetRightMargin(0.05);
335  cFD_X->cd();
336  p2FD_X->Draw();
337  p2FD_X->cd();
338  gPad->SetTickx(1);
339  gPad->SetTicky(1);
340  fddatax_p1->GetYaxis()->SetRangeUser(0.9,1.1);
341  fddatax_p1->GetYaxis()->SetTitle("Data/MC");
342  fddatax_p1->GetXaxis()->SetTitle("W, x-view");
343  fddatax_p1->GetXaxis()->SetTitleSize(0.055*(0.7/0.3));
344  fddatax_p1->GetYaxis()->SetTitleSize(0.055*(0.7/0.3));
345  fddatax_p1->GetXaxis()->SetLabelSize(0.04*(0.7/0.3));
346  fddatax_p1->GetYaxis()->SetLabelSize(0.04*(0.7/0.3));
347  fddatax_p1->GetYaxis()->SetLabelOffset(0.005);
348  fddatax_p1->GetYaxis()->SetTitleOffset(0.35);
349  CenterTitles(fddatax_p1);
350  (fddatax_p1) ->Draw("hist");
351  (fddatax_p2) ->Draw("hist same");
352  (fddatax_e3b)->Draw("hist same");
353  (fddatax_e3c)->Draw("hist same");
354  one ->Draw("hist same");
355  TLegend* legendX = new TLegend(0.7,0.65,0.95,0.9,"");
356  legendX->AddEntry(fddatax_p1, "Data p1/MC g100", "l");
357  legendX->AddEntry(fddatax_p2, "Data p2/MC g100", "l");
358  legendX->AddEntry(fddatax_e3b, "Data e3b/MC g140", "l");
359  legendX->AddEntry(fddatax_e3c, "Data e3c/MC g140", "l");
360  legendX ->SetFillStyle(0);
361  legendX ->SetBorderSize(0);
362  legendX ->SetTextFont(42);
363  legendX ->SetTextSize(0.05*(0.7/0.3));
364  // legendX->Draw();
365 
366  cFD_X -> Print("cFD_X.pdf");
367  cFD_X -> Print("cFD_X.png");
368 
369 
370 
371  TCanvas *cFD_Y = new TCanvas("cFD_Y","cFD_Y", 700, 500);
372  cFD_Y->cd();
373 
374  TPad *p1FD_Y = new TPad("p1FD_Y","p1FD_Y",0.,0.,1.,1.);
375  p1FD_Y->SetBottomMargin(0.0);
376  p1FD_Y->SetLeftMargin(0.12);
377  p1FD_Y->SetRightMargin(0.05);
378  cFD_Y->cd();
379  p1FD_Y->Draw();
380  p1FD_Y->cd();
381  gPad->SetTicky(1);
382  hfddata_period1_PECorrWY->GetYaxis()->SetRangeUser(0, 80);
383  hfddata_period1_PECorrWY->GetXaxis()->SetTitle("W, y-view");
384  hfddata_period1_PECorrWY->GetYaxis()->SetTitle("PECorr/cm");
385  CenterTitles(hfddata_period1_PECorrWY);
386  hfdmc_gain100_PECorrWY->SetLineColor(kBlack);
387  hfdmc_gain140_PECorrWY->SetLineColor(kPink+9);
388  hfddata_period1_PECorrWY->SetLineColor(kGreen+1);
389  hfddata_period2_PECorrWY->SetLineColor(kMagenta+2);
390  hfddata_epoch3b_PECorrWY->SetLineColor(kOrange-3);
391  hfddata_epoch3c_PECorrWY->SetLineColor(kBlue-7);
392  // frac->Draw("hist same");
393  hfddata_period1_PECorrWY->Draw("hist same");
394  hfddata_period2_PECorrWY->Draw("hist same");
395  hfddata_epoch3b_PECorrWY->Draw("hist same");
396  hfddata_epoch3c_PECorrWY->Draw("hist same");
397  hfdmc_gain100_PECorrWY->Draw("lep same");
398  hfdmc_gain140_PECorrWY->Draw("lep same");
399  TLegend* lFD_Y = new TLegend(0.6,0.6,0.8,0.85,"");
400  lFD_Y ->AddEntry(hfdmc_gain100_PECorrWY, "MC gain 100","lep");
401  lFD_Y ->AddEntry(hfdmc_gain140_PECorrWY, "MC gain 140","lep");
402  lFD_Y ->AddEntry(hfddata_period1_PECorrWY, "Data period 1","l");
403  lFD_Y ->AddEntry(hfddata_period2_PECorrWY, "Data period 2","l");
404  lFD_Y ->AddEntry(hfddata_epoch3b_PECorrWY, "Data epoch 3b","l");
405  lFD_Y ->AddEntry(hfddata_epoch3c_PECorrWY, "Data epoch 3c","l");
406  lFD_Y ->SetFillStyle(0);
407  lFD_Y ->SetBorderSize(0);
408  lFD_Y ->SetTextFont(42);
409  lFD_Y ->SetTextSize(0.05);
410  lFD_Y ->Draw();
411 
412  TPad *p2FD_Y = new TPad("p2FD_Y","p2FD_Y",0.,0.,1.,0.3);
413  p2FD_Y->SetTopMargin(0.0);
414  p2FD_Y->SetBottomMargin(0.22);
415  p2FD_Y->SetLeftMargin(0.12);
416  p2FD_Y->SetRightMargin(0.05);
417  cFD_Y->cd();
418  p2FD_Y->Draw();
419  p2FD_Y->cd();
420  gPad->SetTickx(1);
421  gPad->SetTicky(1);
422  fddatay_p1->GetYaxis()->SetRangeUser(0.9,1.1);
423  fddatay_p1->GetYaxis()->SetTitle("Data/MC");
424  fddatay_p1->GetXaxis()->SetTitle("W, y-view");
425  fddatay_p1->GetXaxis()->SetTitleSize(0.055*(0.7/0.3));
426  fddatay_p1->GetYaxis()->SetTitleSize(0.055*(0.7/0.3));
427  fddatay_p1->GetXaxis()->SetLabelSize(0.04*(0.7/0.3));
428  fddatay_p1->GetYaxis()->SetLabelSize(0.04*(0.7/0.3));
429  fddatay_p1->GetYaxis()->SetLabelOffset(0.005);
430  fddatay_p1->GetYaxis()->SetTitleOffset(0.35);
431  CenterTitles(fddatay_p1);
432  (fddatay_p1) ->Draw("hist");
433  (fddatay_p2) ->Draw("hist same");
434  (fddatay_e3b)->Draw("hist same");
435  (fddatay_e3c)->Draw("hist same");
436  one ->Draw("hist same");
437  TLegend* legendY = new TLegend(0.6,0.5,0.8,0.9,"");
438  legendY->AddEntry(fddatax_p1, "Data p1/MC g100", "l");
439  legendY->AddEntry(fddatax_p2, "Data p2/MC g100", "l");
440  legendY->AddEntry(fddatax_e3b, "Data e3b/MC g140", "l");
441  legendY->AddEntry(fddatax_e3c, "Data e3c/MC g140", "l");
442  legendY ->SetFillStyle(0);
443  legendY ->SetBorderSize(0);
444  legendY ->SetTextFont(42);
445  legendY ->SetTextSize(0.05*(0.7/0.3));
446  // legendY->Draw();
447 
448  cFD_Y -> Print("cFD_Y.pdf");
449  cFD_Y -> Print("cFD_Y.png");
450 
451 
452 
453 
454 
455 
456 
457  /////////////////////////////////////////////////////
458  /// 1D plots hits vs w //
459  ///////////////////////////////////////////////////
460 
461  hfdmc_gain100_WX->SetLineStyle(2);
462  hfdmc_gain140_WX->SetLineStyle(2);
463  hfdmc_gain100_WX->SetLineColor(kBlack);
464  hfdmc_gain140_WX->SetLineColor(kPink+9);
465  hfddata_period1_WX->SetLineColor(kGreen+1);
466  hfddata_period2_WX->SetLineColor(kMagenta+2);
467  hfddata_epoch3b_WX->SetLineColor(kOrange-3);
468  hfddata_epoch3c_WX->SetLineColor(kBlue-7);
469 
470  hfdmc_gain100_WY->SetLineStyle(2);
471  hfdmc_gain140_WY->SetLineStyle(2);
472  hfdmc_gain100_WY->SetLineColor(kBlack);
473  hfdmc_gain140_WY->SetLineColor(kPink+9);
474  hfddata_period1_WY->SetLineColor(kGreen+1);
475  hfddata_period2_WY->SetLineColor(kMagenta+2);
476  hfddata_epoch3b_WY->SetLineColor(kOrange-3);
477  hfddata_epoch3c_WY->SetLineColor(kBlue-7);
478 
479  TH1D* fddata_p1_wx = (TH1D*)(hfddata_period1_WX)->Clone("fddata_p1_wx");
480  TH1D* fddata_p2_wx = (TH1D*)(hfddata_period2_WX)->Clone("fddata_p2_wx");
481  TH1D* fddata_e3b_wx = (TH1D*)(hfddata_epoch3b_WX)->Clone("fddata_e3b_wx");
482  TH1D* fddata_e3c_wx = (TH1D*)(hfddata_epoch3c_WX)->Clone("fddata_e3c_wx");
483 
484  TH1D* fddata_p1_wy = (TH1D*)(hfddata_period1_WY)->Clone("fddata_p1_wy");
485  TH1D* fddata_p2_wy = (TH1D*)(hfddata_period2_WY)->Clone("fddata_p2_wy");
486  TH1D* fddata_e3b_wy = (TH1D*)(hfddata_epoch3b_WY)->Clone("fddata_e3b_wy");
487  TH1D* fddata_e3c_wy = (TH1D*)(hfddata_epoch3c_WY)->Clone("fddata_e3c_wy");
488 
489  (fddata_p1_wx->Divide(hfdmc_gain100_WX));
490  (fddata_p2_wx->Divide(hfdmc_gain100_WX));
491  (fddata_e3b_wx->Divide(hfdmc_gain140_WX));
492  (fddata_e3c_wx->Divide(hfdmc_gain140_WX));
493 
494  (fddata_p1_wy->Divide(hfdmc_gain100_WY));
495  (fddata_p2_wy->Divide(hfdmc_gain100_WY));
496  (fddata_e3b_wy->Divide(hfdmc_gain140_WY));
497  (fddata_e3c_wy->Divide(hfdmc_gain140_WY));
498 
499 
500 
501 
502  TCanvas *cFD_WX = new TCanvas("cFD_WX","cFD_WX", 700, 500);
503  cFD_WX->cd();
504 
505  TPad *p1FD_WX = new TPad("p1FD_WX","p1FD_WX",0.,0.,1.,1.);
506  p1FD_WX->SetBottomMargin(0.0);
507  p1FD_WX->SetLeftMargin(0.12);
508  p1FD_WX->SetRightMargin(0.05);
509  cFD_WX->cd();
510  p1FD_WX->Draw();
511  p1FD_WX->cd();
512  gPad->SetTicky(1);
513  hfddata_period1_WX->GetXaxis()->SetTitle("W, x-view");
514  hfddata_period1_WX->GetYaxis()->SetTitle("Tricells");
515  CenterTitles(hfddata_period1_WX);
516  hfdmc_gain100_WX->GetXaxis()->SetTitle("W, x-view");
517  hfdmc_gain100_WX->GetYaxis()->SetTitle("Tricells");
518  CenterTitles(hfdmc_gain100_WX);
519  hfddata_period1_WX->GetYaxis()->SetRangeUser(0,25);
520  hfddata_period1_WX ->Draw("hist");
521  hfddata_period2_WX ->Draw("hist same");
522  hfddata_epoch3b_WX ->Draw("hist same");
523  hfddata_epoch3c_WX ->Draw("hist same");
524  TLegend* lFDMC_WX = new TLegend(0.2,0.5,0.5,0.85,"");
525  lFDMC_WX ->AddEntry(hfdmc_gain100_WX, "MC gain 100","l");
526  lFDMC_WX ->AddEntry(hfdmc_gain140_WX, "MC gain 140","l");
527  lFDMC_WX ->AddEntry(hfddata_period1_WX, "Data period 1","l");
528  lFDMC_WX ->AddEntry(hfddata_period2_WX, "Data period 2","l");
529  lFDMC_WX ->AddEntry(hfddata_epoch3b_WX, "Data epoch 3b","l");
530  lFDMC_WX ->AddEntry(hfddata_epoch3c_WX, "Data epoch 3b","l");
531  lFDMC_WX ->SetFillStyle(0);
532  lFDMC_WX ->SetBorderSize(0);
533  lFDMC_WX ->SetTextFont(42);
534  lFDMC_WX ->SetTextSize(0.05);
535  // lFDMC_WX ->Draw();
536 
537  TPad *p2FD_WX = new TPad("p2FD_WX","p2FD_WX",0.,0.,1.,0.3);
538  p2FD_WX->SetTopMargin(0.0);
539  p2FD_WX->SetBottomMargin(0.22);
540  p2FD_WX->SetLeftMargin(0.12);
541  p2FD_WX->SetRightMargin(0.05);
542  cFD_WX->cd();
543  p2FD_WX->Draw();
544  p2FD_WX->cd();
545  gPad->SetTickx(1);
546  gPad->SetTicky(1);
547  fddata_p1_wx->GetXaxis()->SetTitle("W, x-view");
548  fddata_p1_wx->GetXaxis()->SetTitleSize(0.055*(0.7/0.3));
549  fddata_p1_wx->GetYaxis()->SetTitleSize(0.055*(0.7/0.3));
550  fddata_p1_wx->GetXaxis()->SetLabelSize(0.04*(0.7/0.3));
551  fddata_p1_wx->GetYaxis()->SetLabelSize(0.04*(0.7/0.3));
552  fddata_p1_wx->GetYaxis()->SetLabelOffset(0.005);
553  fddata_p1_wx->GetYaxis()->SetTitleOffset(0.35);
554  CenterTitles(fddata_p1_wx);
555  // hRateDataMCX ->SetLineStyle(7);
556  // hfddata_period1_WX ->SetMarkerStyle(8);
557  // hfddata_period1_WX ->SetMarkerSize(0.3);
558  fddata_p1_wx ->GetYaxis()->SetRangeUser(0,5);
559  (fddata_p1_wx)->Draw("hist same");
560  (fddata_p2_wx)->Draw("hist same");
561  (fddata_e3b_wx)->Draw("hist same");
562  (fddata_e3c_wx)->Draw("hist same");
563  one ->Draw("hist same");
564  TLegend* lFDMC_WX2 = new TLegend(0.5,0.5,0.9,0.9,"");
565  lFDMC_WX2 ->AddEntry(fddata_p1_wx, "Data p1/MC g100","l");
566  lFDMC_WX2 ->AddEntry(fddata_p2_wx, "Data p2/MC g100","l");
567  lFDMC_WX2 ->AddEntry(fddata_e3b_wx, "Data epoech3b/MC g140","l");
568  lFDMC_WX2 ->AddEntry(fddata_e3c_wx, "Data epoech3c/MC g140","l");
569  lFDMC_WX2 ->SetFillStyle(0);
570  lFDMC_WX2 ->SetBorderSize(0);
571  lFDMC_WX2 ->SetTextFont(42);
572  lFDMC_WX2 ->SetTextSize(0.05*(0.7/0.3));
573  // // lFDMC_WX2 ->Draw();
574 
575  cFD_WX->Print("cFD_WXRates.pdf");
576  cFD_WX->Print("cFD_WXRates.png");
577 
578 
579 
580  // For MC and data LG
581  TCanvas *cFD_WY = new TCanvas("cFD_WY","cFD_WY", 700, 500);
582  cFD_WY->cd();
583 
584  TPad *p1FD_WY = new TPad("p1FD_WY","p1FD_WY",0.,0.,1.,1.);
585  p1FD_WY->SetBottomMargin(0.0);
586  p1FD_WY->SetLeftMargin(0.12);
587  p1FD_WY->SetRightMargin(0.05);
588  cFD_WY->cd();
589  p1FD_WY->Draw();
590  p1FD_WY->cd();
591  gPad->SetTicky(1);
592  hfddata_period1_WY->GetXaxis()->SetTitle("W, y-view");
593  hfddata_period1_WY->GetYaxis()->SetTitle("Tricells");
594  CenterTitles(hfddata_period1_WY);
595  hfddata_period1_WY->GetYaxis()->SetRangeUser(0,25);
596  hfddata_period1_WY ->Draw("hist");
597  hfddata_period2_WY ->Draw("hist same");
598  hfddata_epoch3b_WY ->Draw("hist same");
599  hfddata_epoch3c_WY ->Draw("hist same");
600  TLegend* lFDMC_WY = new TLegend(0.2,0.5,0.5,0.85,"");
601  lFDMC_WY ->AddEntry(hfdmc_gain100_WY, "MC gain 100","l");
602  lFDMC_WY ->AddEntry(hfdmc_gain140_WY, "MC gain 140","l");
603  lFDMC_WY ->AddEntry(hfddata_period1_WY, "Data period 1","l");
604  lFDMC_WY ->AddEntry(hfddata_period2_WY, "Data period 2","l");
605  lFDMC_WY ->AddEntry(hfddata_epoch3b_WY, "Data epoch 3b","l");
606  lFDMC_WY ->AddEntry(hfddata_epoch3c_WY, "Data epoch 3b","l");
607  lFDMC_WY ->SetFillStyle(0);
608  lFDMC_WY ->SetBorderSize(0);
609  lFDMC_WY ->SetTextFont(42);
610  lFDMC_WY ->SetTextSize(0.05);
611  // lFDMC_WY ->Draw();
612 
613  TPad *p2FD_WY = new TPad("p2FD_WY","p2FD_WY",0.,0.,1.,0.3);
614  p2FD_WY->SetTopMargin(0.0);
615  p2FD_WY->SetBottomMargin(0.22);
616  p2FD_WY->SetLeftMargin(0.12);
617  p2FD_WY->SetRightMargin(0.05);
618  cFD_WY->cd();
619  p2FD_WY->Draw();
620  p2FD_WY->cd();
621  gPad->SetTickx(1);
622  gPad->SetTicky(1);
623  fddata_p1_wy->GetXaxis()->SetTitle("W, y-view");
624  fddata_p1_wy->GetXaxis()->SetTitleSize(0.055*(0.7/0.3));
625  fddata_p1_wy->GetYaxis()->SetTitleSize(0.055*(0.7/0.3));
626  fddata_p1_wy->GetXaxis()->SetLabelSize(0.04*(0.7/0.3));
627  fddata_p1_wy->GetYaxis()->SetLabelSize(0.04*(0.7/0.3));
628  fddata_p1_wy->GetYaxis()->SetLabelOffset(0.005);
629  fddata_p1_wy->GetYaxis()->SetTitleOffset(0.35);
630  CenterTitles(fddata_p1_wy);
631  // hRateDataMCY ->SetLineStyle(7);
632  // hRateDataY ->SetMarkerStyle(8);
633  // hRateDataY ->SetMarkerSize(0.3);
634  fddata_p1_wy ->GetYaxis()->SetRangeUser(0,5);
635  fddata_p2_wy ->Draw("hist same");
636  fddata_e3b_wy ->Draw("hist same");
637  fddata_e3c_wy ->Draw("hist same");
638  one ->Draw("hist same");
639 
640  TLegend* lFDMC_WY2 = new TLegend(0.9,0.5,0.5,0.9,"");
641  lFDMC_WY2 ->AddEntry(fddata_p1_wy, "Data p1/MC g100","l");
642  lFDMC_WY2 ->AddEntry(fddata_p2_wy, "Data p2/MC g100","l");
643  lFDMC_WY2 ->AddEntry(fddata_e3b_wy, "Data e3b/MC g140","l");
644  lFDMC_WY2 ->AddEntry(fddata_e3c_wy, "Data e3c/MC g140","l");
645  lFDMC_WY2 ->SetFillStyle(0);
646  lFDMC_WY2 ->SetBorderSize(0);
647  lFDMC_WY2 ->SetTextFont(42);
648  lFDMC_WY2 ->SetTextSize(0.05*(0.7/0.3));
649  lFDMC_WY2 ->Draw();
650 
651 
652  cFD_WY->Print("cFD_WYRates.pdf");
653  cFD_WY->Print("cFD_WYRates.png");
654 
655 
656 }
657 
659  return main();
660 }
661 
662 
663 
664 
tree Draw("slc.nhit")
int respProfiles()
TH1F * h3
Definition: berger.C:36
legendX
Definition: plotROC.py:65
legendY
Definition: plotROC.py:66
void CenterTitles(TH1 *h)
double frac(double x)
Fractional part.
int main()
TH1F * h2
Definition: plot.C:45
void Print(std::string prefix, std::string name, std::string suffix="")
Definition: nue_pid_effs.C:68
TH1F * h1
double GetHistMax(TH1 *h0, TH1 *h1, TH1 *h2, TH1 *h3)
auto one()
Definition: PMNS.cxx:49
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:68