slicer_production_validation.C
Go to the documentation of this file.
2 
3  // TODO:
4  // 1. Get the stats boxes to automatically draw in the correct places.
5  // 2. Have the axes auto zoom according to which histogram has the bigger max.
6  // 3. Auto print the canvases.
7 
8  // Define initial parameters:
9  std::string det = "FarDet";
10  std::string rel1 = "S14-03-06";
11  std::string rel2 = "FA14-10-03";
12  std::string cat = "cosmic";
13  char name[256];
14  double max = 0.0;
15  bool print = true;
16 
17  // Old MC
18  TFile *f1 = new TFile("/nova/prod/mc/S14-03-06/reco/validation/hadd/fardet_cosmics_S14-03-06.sim.daq.reco.hist.root");
19  // TFile *f1 = new TFile("/nova/prod/mc/S14-03-06/reco/validation/hadd/fardet_genie_rhc_swap_S14-03-06.sim.daq.reco.hist.root");
20  gDirectory->cd("slicerana");
21  TTree *nt1 = (TTree*)gDirectory->Get("SlicerAna");
22  nt1->SetMarkerStyle(2);
23 
24 
25  // New MC
26  TFile *f2 = new TFile("/nova/ana/users/raddatz/FA14-10-03_Reco_Val/FA14-10-03_files/fd_cry.root");
27  // TFile *f2 = new TFile("/nova/ana/users/raddatz/FA14-10-03_Reco_Val/FA14-10-03_files/fd_genie_rhc_nonswap.root");
28  gDirectory->cd("slicerana");
29  TTree *nt2 = (TTree*)gDirectory->Get("SlicerAna");
30  nt2->SetMarkerStyle(2);
31 
32 
33 
34  double h0min, h0max;
35  double h1min, h1max;
36  double h2minX, h2maxX;
37  double h2minY, h2maxY;
38  double h3min, h3max;
39  double h9min, h9max;
40 
41  double X1, Y1, Y2;
42 
43  double pmin, pmax;
44  double cmin, cmax;
45  double dpmin, dpmax;
46  double dcmin, dcmax;
47 
48  if(det == "NDOS") {
49  h0min = -0.5;
50  h0max = 4.5;
51 
52  h1min = -0.5;
53  h1max = 4.5;
54 
55  h2minX = -0.5;
56  h2maxX = 6.5;
57  h2minY = 1.0;
58  h2maxY = 50000.0;
59 
60  h3min = -0.5;
61  h3max = 4.5;
62 
63  h9min = -0.5;
64  h9max = 4.5;
65 
66  X1 = 200.0;
67  Y1 = 64.0;
68  Y2 = 96.0;
69 
70  pmin = -20.0;
71  pmax = 300.0;
72  cmin = -10.0;
73  cmax = 100.0;
74  dpmin = 0.0;
75  dpmax = 200.0;
76  dcmin = 0.0;
77  dcmax = 100.0;
78  }
79  if(det == "NearDet") {
80  h0min = 9.5;
81  h0max = 60.5;
82 
83  h1min = -0.5;
84  h1max = 30.5;
85 
86  h2minX = -0.5;
87  h2maxX = 30.5;
88  h2minY = 1.0;
89  h2maxY = 50000.0;
90 
91  h3min = -0.5;
92  h3max = 4.5;
93 
94  h9min = -0.5;
95  h9max = 30.5;
96 
97  X1 = 214.0;
98  Y1 = 96.0;
99  Y2 = 96.0;
100 
101  pmin = -20.0;
102  pmax = 300.0;
103  cmin = -10.0;
104  cmax = 100.0;
105  dpmin = 0.0;
106  dpmax = 200.0;
107  dcmin = 0.0;
108  dcmax = 100.0;
109  }
110  if(det == "FarDet") {
111  h0min = -0.5;
112  h0max = 120.5;
113 
114  h1min = -0.5;
115  h1max = 4.5;
116 
117  h2minX = -0.5;
118  h2maxX = 100.5;
119  h2minY = 1.0;
120  h2maxY = 50000.0;
121 
122  h3min = -0.5;
123  h3max = 100.5;
124 
125  h9min = -0.5;
126  h9max = 100.5;
127 
128  X1 = 896.0;
129  Y1 = 384.0;
130  Y2 = 384.0;
131 
132  pmin = -20.0;
133  pmax = 1250.0;
134  cmin = -10.0;
135  cmax = 400.0;
136  dpmin = 0.0;
137  dpmax = 600.0;
138  dcmin = 0.0;
139  dcmax = 400.0;
140  }
141 
142 
143 
144 
145 
146  // book histos...
147  TH1F *h0_1 = new TH1F("h0_1","# of MCT (counted by FLS hits);# of nu;count",201,-0.5,200.5);
148  TH1F *h0_2 = new TH1F("h0_2","# of MCT (counted by FLS hits);# of nu;count",201,-0.5,200.5);
149 
150  TH1F *h1 = new TH1F("h1","# of Nu;# of nu;count",101,-0.5,100.5);
151 
152  TH1F *h2_1 = new TH1F("h2_1","# of non-noise slices;# of non-noise slices;count",201,-0.5,200.5);
153  TH1F *h2_2 = new TH1F("h2_2","# of non-noise slices;# of non-noise slices;count",201,-0.5,200.5);
154 
155  TH1F *h3_1 = new TH1F("h3_1","# of noise slices;# of noise slices;count",101,-0.5,100.5);
156  TH1F *h3_2 = new TH1F("h3_2","# of noise slices;# of noise slices;count",101,-0.5,100.5);
157 
158  TH2F *h9_1 = new TH2F("h9_1","# of MCT vs. # of non-noise slices;# of MCT;# of slices",201,-0.5,200.5,201,-0.5,200.5);
159  TH2F *h9_2 = new TH2F("h9_2","# of MCT vs. # of non-noise slices;# of MCT;# of slices",201,-0.5,200.5,201,-0.5,200.5);
160 
161  TCut Nu = "NumNuFLSHitALL > 0";
162  TCut nhit = "NumHitsX >= 3 && NumHitsY >= 3";
163  TCut noise = "IsNoise == 1";
164  TCut cosmic = "nupdg == 0";
165 
166 
167 
168  // count N slices w/ NHit cut
169 
170  // define leaf types and set branch addresses
171  int NumNuFLSHitALL;
172  int NumNuCellHit;
173  int NumMCTCellHitALL;
174  std::vector<unsigned int> *IsNoise;
175  std::vector<int> *NumHitsX;
176  std::vector<int> *NumHitsY;
177 
178  nt1->SetBranchAddress("NumNuFLSHitALL", &NumNuFLSHitALL);
179  nt1->SetBranchAddress("NumNuCellHit", &NumNuCellHit);
180  nt1->SetBranchAddress("NumNuCellHitALL", &NumMCTCellHitALL);
181  nt1->SetBranchAddress("IsNoise", &IsNoise);
182  nt1->SetBranchAddress("NumHitsX", &NumHitsX);
183  nt1->SetBranchAddress("NumHitsY", &NumHitsY);
184 
185  // loop over NTuple entries...
186  for(unsigned int i = 0; i < nt1->GetEntries(); ++i) {
187 
188  nt1->GetEntry(i);
189 
190  unsigned int N = 0;
191 
192  for(unsigned int j = 0; j < (*IsNoise).size(); ++j) {
193  if((*IsNoise)[j] == 1) continue;
194  if((*NumHitsX)[j] >= 3 && (*NumHitsY)[j] >= 3) N++;
195  }
196 
197  h2_1->Fill(N);
198  h9_1->Fill(NumMCTCellHitALL,N);
199 
200  }
201 
202  nt2->SetBranchAddress("NumMCTFLSHitALL", &NumNuFLSHitALL);
203  nt2->SetBranchAddress("NumMCTCellHit", &NumNuCellHit);
204  nt2->SetBranchAddress("NumMCTCellHitALL", &NumMCTCellHitALL);
205  nt2->SetBranchAddress("IsNoise", &IsNoise);
206  nt2->SetBranchAddress("NumHitsX", &NumHitsX);
207  nt2->SetBranchAddress("NumHitsY", &NumHitsY);
208 
209  // loop over NTuple entries...
210  for(unsigned int i = 0; i < nt2->GetEntries(); ++i) {
211 
212  nt2->GetEntry(i);
213 
214  unsigned int N = 0;
215 
216  for(unsigned int j = 0; j < (*IsNoise).size(); ++j) {
217  if((*IsNoise)[j] == 1) continue;
218  if((*NumHitsX)[j] >= 3 && (*NumHitsY)[j] >= 3) N++;
219  }
220 
221  h2_2->Fill(N);
222  h9_2->Fill(NumMCTCellHitALL,N);
223 
224  }
225 
226 
227 
228  TCanvas *c0 = new TCanvas("c0", "# of nu (by FLShits)",1000,700);
229  c0->cd();
230  nt1->Draw("NumNuFLSHitALL >> h0_1");
231  nt2->Draw("NumMCTFLSHitALL >> h0_2");
232  gStyle->SetOptStat(111111);
233  h0_1->SetLineColor(kBlue);
234  h0_1->SetLineWidth(2);
235  h0_1->Scale(1.0/h0_1->Integral());
236  h0_1->SetAxisRange(h0min,h0max,"X");
237  h0_1->Draw();
238  c0->Update();
239  TPaveStats *s01a = h0_1->FindObject("stats");
240  s01a->SetX1NDC(0.7);
241  s01a->SetX2NDC(0.9);
242  s01a->SetY1NDC(0.7);
243  s01a->SetY2NDC(0.9);
244  s01a->Draw();
245  h0_2->SetLineColor(kRed);
246  h0_2->SetLineWidth(2);
247  h0_2->Scale(1.0/h0_2->Integral());
248  h0_2->SetAxisRange(h0min,h0max,"X");
249  h0_2->Draw("sames");
250  c0->Update();
251  TPaveStats *s01b = h0_2->FindObject("stats");
252  s01b->SetX1NDC(0.7);
253  s01b->SetX2NDC(0.9);
254  s01b->SetY1NDC(0.5);
255  s01b->SetY2NDC(0.7);
256  s01b->Draw();
257  sprintf(name,"NMCT_%s_%s_%s_%s.png",det.c_str(),cat.c_str(),rel1.c_str(),rel2.c_str());
258  if(print) c0->Print(name);
259 
260  TCanvas *c2 = new TCanvas("c2", "# of slices",1000,700);
261  c2->cd();
262  gStyle->SetOptStat(111111);
263  h2_1->SetLineColor(kBlue);
264  h2_1->SetLineWidth(2);
265  h2_1->Scale(1.0/h2_1->Integral());
266  h2_1->SetAxisRange(h2minX,h2maxX,"X");
267  h2_1->Draw();
268  c2->Update();
269  TPaveStats *s02a = h2_1->FindObject("stats");
270  s02a->SetX1NDC(0.7);
271  s02a->SetX2NDC(0.9);
272  s02a->SetY1NDC(0.7);
273  s02a->SetY2NDC(0.9);
274  s02a->Draw();
275  h2_2->SetLineColor(kRed);
276  h2_2->SetLineWidth(2);
277  h2_2->Scale(1.0/h2_2->Integral());
278  h2_2->SetAxisRange(h2minX,h2maxX,"X");
279  h2_2->Draw("sames");
280  c2->Update();
281  TPaveStats *s02b = h2_2->FindObject("stats");
282  s02b->SetX1NDC(0.7);
283  s02b->SetX2NDC(0.9);
284  s02b->SetY1NDC(0.5);
285  s02b->SetY2NDC(0.7);
286  s02b->Draw();
287  sprintf(name,"NSlices_%s_%s_%s_%s.png",det.c_str(),cat.c_str(),rel1.c_str(),rel2.c_str());
288  if(print) c2->Print(name);
289 
290  TCanvas *c3 = new TCanvas("c3", "# of noise slices",1000,700);
291  c3->cd();
292  nt1->Draw("NumNoise >> h3_1");
293  nt2->Draw("NumNoise >> h3_2");
294  gStyle->SetOptStat(111111);
295  h3_1->SetLineColor(kBlue);
296  h3_1->SetLineWidth(2);
297  h3_1->Scale(1.0/h3_1->Integral());
298  h3_1->SetAxisRange(h3min,h3max,"X");
299  h3_1->Draw();
300  c3->Update();
301  TPaveStats *s03a = h3_1->FindObject("stats");
302  s03a->SetX1NDC(0.7);
303  s03a->SetX2NDC(0.9);
304  s03a->SetY1NDC(0.7);
305  s03a->SetY2NDC(0.9);
306  s03a->Draw();
307  h3_2->SetLineColor(kRed);
308  h3_2->SetLineWidth(2);
309  h3_2->Scale(1.0/h3_2->Integral());
310  h3_2->SetAxisRange(h3min,h3max,"X");
311  h3_2->Draw("sames");
312  c3->Update();
313  TPaveStats *s03b = h3_2->FindObject("stats");
314  s03b->SetX1NDC(0.7);
315  s03b->SetX2NDC(0.9);
316  s03b->SetY1NDC(0.5);
317  s03b->SetY2NDC(0.7);
318  s03b->Draw();
319  sprintf(name,"NNoiseSlices_%s_%s_%s_%s.png",det.c_str(),cat.c_str(),rel1.c_str(),rel2.c_str());
320  if(print) c3->Print(name);
321 
322 
323 
324  TH1F *hC_1 = new TH1F("hC_1","completeness for most pure MCTruth in slice; completeness; count",201,-0.005,2.005);
325  TH1F *hP_1 = new TH1F("hP_1","purity for most pure MCTruth in slice; purity; count",201,-0.005,2.005);
326  TH1F *hCN_1 = (TH1F*)f1->FindObjectAny("fCompNoise");
327  TH1F *hPN_1 = (TH1F*)f1->FindObjectAny("fPurNoise");
328  TH1F *hC_2 = new TH1F("hC_2","completeness for most pure MCTruth in slice; completeness; count",201,-0.005,2.005);
329  TH1F *hP_2 = new TH1F("hP_2","purity for most pure MCTruth in slice; purity; count",201,-0.005,2.005);
330  TH1F *hCN_2 = (TH1F*)f2->FindObjectAny("fCompNoise");
331  TH1F *hPN_2 = (TH1F*)f2->FindObjectAny("fPurNoise");
332 
333  TCanvas *cC = new TCanvas("cC", "comp",1000,700);
334  cC->cd();
335  nt1->Draw("nu1Eff >> hC_1", nhit && !noise);
336  nt2->Draw("nu1Eff >> hC_2", nhit && !noise);
337  gStyle->SetOptStat(111111);
338  cC->SetLogy();
339  hC_1->SetLineColor(kBlue);
340  hC_1->SetLineWidth(2);
341  hC_1->Scale(1.0/hC_1->Integral());
342  hC_1->SetAxisRange(0.0,1.2,"X");
343  hC_1->Draw();
344  cC->Update();
345  TPaveStats *sCa = hC_1->FindObject("stats");
346  sCa->SetX1NDC(0.4);
347  sCa->SetX2NDC(0.6);
348  sCa->SetY1NDC(0.7);
349  sCa->SetY2NDC(0.9);
350  sCa->Draw();
351  hC_2->SetLineColor(kRed);
352  hC_2->SetLineWidth(2);
353  hC_2->Scale(1.0/hC_2->Integral());
354  hC_2->SetAxisRange(0.0,1.2,"X");
355  hC_2->Draw("sames");
356  cC->Update();
357  TPaveStats *sCb = hC_2->FindObject("stats");
358  sCb->SetX1NDC(0.4);
359  sCb->SetX2NDC(0.6);
360  sCb->SetY1NDC(0.5);
361  sCb->SetY2NDC(0.7);
362  sCb->Draw();
363  sprintf(name,"Comp_%s_%s_%s_%s.png",det.c_str(),cat.c_str(),rel1.c_str(),rel2.c_str());
364  if(print) cC->Print(name);
365 
366 
367  TCanvas *cP = new TCanvas("cP", "pur",1000,700);
368  cP->cd();
369  nt1->Draw("nu1Pur >> hP_1", nhit && !noise);
370  nt2->Draw("nu1Pur >> hP_2", nhit && !noise);
371  cP->SetLogy();
372  gStyle->SetOptStat(111111);
373  hP_1->SetLineColor(kBlue);
374  hP_1->SetLineWidth(2);
375  hP_1->Scale(1.0/hP_1->Integral());
376  hP_1->SetAxisRange(0.0,1.2,"X");
377  hP_1->Draw();
378  cP->Update();
379  TPaveStats *sPa = hP_1->FindObject("stats");
380  sPa->SetX1NDC(0.4);
381  sPa->SetX2NDC(0.6);
382  sPa->SetY1NDC(0.7);
383  sPa->SetY2NDC(0.9);
384  sPa->Draw();
385  hP_2->SetLineColor(kRed);
386  hP_2->SetLineWidth(2);
387  hP_2->Scale(1.0/hP_2->Integral());
388  hP_2->SetAxisRange(0.0,1.2,"X");
389  hP_2->Draw("sames");
390  cC->Update();
391  TPaveStats *sPb = hP_2->FindObject("stats");
392  sPb->SetX1NDC(0.4);
393  sPb->SetX2NDC(0.6);
394  sPb->SetY1NDC(0.5);
395  sPb->SetY2NDC(0.7);
396  sPb->Draw();
397  sprintf(name,"Pur_%s_%s_%s_%s.png",det.c_str(),cat.c_str(),rel1.c_str(),rel2.c_str());
398  if(print) cP->Print(name);
399 
400 
401  TCanvas *cCN = new TCanvas("cCN", "comp NOISE",1000,700);
402  cCN->cd();
403  cCN->SetLogy();
404  gStyle->SetOptStat(111111);
405  hCN_1->SetLineColor(kBlue);
406  hCN_1->SetLineWidth(2);
407  hCN_1->Scale(1.0/hCN_1->Integral());
408  hCN_1->Draw();
409  cCN->Update();
410  TPaveStats *sCNa = hCN_1->FindObject("stats");
411  sCNa->SetX1NDC(0.4);
412  sCNa->SetX2NDC(0.6);
413  sCNa->SetY1NDC(0.7);
414  sCNa->SetY2NDC(0.9);
415  sCNa->SetName("hCN_1");
416  sCNa->Draw();
417  hCN_2->SetLineColor(kRed);
418  hCN_2->SetLineWidth(2);
419  hCN_2->Scale(1.0/hCN_2->Integral());
420  hCN_2->Draw("sames");
421  cCN->Update();
422  TPaveStats *sCNb = hCN_2->FindObject("stats");
423  sCNb->SetX1NDC(0.4);
424  sCNb->SetX2NDC(0.6);
425  sCNb->SetY1NDC(0.5);
426  sCNb->SetY2NDC(0.7);
427  sCNb->SetName("hCN_2");
428  sCNb->Draw();
429  sprintf(name,"CompNoise_%s_%s_%s_%s.png",det.c_str(),cat.c_str(),rel1.c_str(),rel2.c_str());
430  if(print) cCN->Print(name);
431 
432  TCanvas *cPN = new TCanvas("cPN", "pur NOISE",1000,700);
433  cPN->cd();
434  cPN->SetLogy();
435  gStyle->SetOptStat(111111);
436  hPN_1->SetLineColor(kBlue);
437  hPN_1->SetLineWidth(2);
438  hPN_1->Scale(1.0/hPN_1->Integral());
439  hPN_1->Draw();
440  cPN->Update();
441  TPaveStats *sPNa = hPN_1->FindObject("stats");
442  sPNa->SetX1NDC(0.4);
443  sPNa->SetX2NDC(0.6);
444  sPNa->SetY1NDC(0.7);
445  sPNa->SetY2NDC(0.9);
446  sPNa->SetName("hPN_1");
447  sPNa->Draw();
448  hPN_2->SetLineColor(kRed);
449  hPN_2->SetLineWidth(2);
450  hPN_2->Scale(1.0/hPN_2->Integral());
451  hPN_2->Draw("sames");
452  cPN->Update();
453  TPaveStats *sPNb = hPN_2->FindObject("stats");
454  sPNb->SetX1NDC(0.4);
455  sPNb->SetX2NDC(0.6);
456  sPNb->SetY1NDC(0.5);
457  sPNb->SetY2NDC(0.7);
458  sPNb->SetName("hPN_2");
459  sPNb->Draw();
460  sprintf(name,"PurNoise_%s_%s_%s_%s.png",det.c_str(),cat.c_str(),rel1.c_str(),rel2.c_str());
461  if(print) cPN->Print(name);
462 
463 
464 
465 
466  TH2F *hpcx_1 = new TH2F("hpcx_1","ave hit plane vs. ave hit X cell;plane;X cell",660,-20.0,1300.0,255,-10.0,500.0);
467  TH2F *hpcy_1 = new TH2F("hpcy_1","ave hit plane vs. ave hit Y cell;plane;Y cell",660,-20.0,1300.0,255,-10.0,500.0);
468  TH2F *hdpcx_1 = new TH2F("hdpcx_1","diff btwn hi and lo for plane vs x cell per slice;delta plane;delta x cell",500,0.0,1000.0,250,0.0,500.0);
469  TH2F *hdpcy_1 = new TH2F("hdpcy_1","diff btwn hi and lo for plane vs y cell per slice;delta plane;delta y cell",500,0.0,1000.0,250,0.0,500.0);
470 
471  TH2F *hpcx_2 = new TH2F("hpcx_2","ave hit plane vs. ave hit X cell;plane;X cell",660,-20.0,1300.0,255,-10.0,500.0);
472  TH2F *hpcy_2 = new TH2F("hpcy_2","ave hit plane vs. ave hit Y cell;plane;Y cell",660,-20.0,1300.0,255,-10.0,500.0);
473  TH2F *hdpcx_2 = new TH2F("hdpcx_2","diff btwn hi and lo for plane vs x cell per slice;delta plane;delta x cell",500,0.0,1000.0,250,0.0,500.0);
474  TH2F *hdpcy_2 = new TH2F("hdpcy_2","diff btwn hi and lo for plane vs y cell per slice;delta plane;delta y cell",500,0.0,1000.0,250,0.0,500.0);
475 
476  TLine *L1x = new TLine(0,0,0,Y1);
477  TLine *L2x = new TLine(0,Y1,X1,Y1);
478  TLine *L3x = new TLine(0,0,X1,0);
479  TLine *L4x = new TLine(X1,0,X1,Y1);
480  TLine *L1y = new TLine(0,0,0,Y2);
481  TLine *L2y = new TLine(0,Y2,X1,Y2);
482  TLine *L3y = new TLine(0,0,X1,0);
483  TLine *L4y = new TLine(X1,0,X1,Y2);
484  L1x->SetLineWidth(2);
485  L2x->SetLineWidth(2);
486  L3x->SetLineWidth(2);
487  L4x->SetLineWidth(2);
488  L1y->SetLineWidth(2);
489  L2y->SetLineWidth(2);
490  L3y->SetLineWidth(2);
491  L4y->SetLineWidth(2);
492 
493  TCanvas *c5_1 = new TCanvas("c5_1", "ave plane vs. ave X cell - nt1",1000,700);
494  c5_1->cd();
495  nt1->Draw("CXave:Pave >> hpcx_1", nhit && !noise);
496  gStyle->SetOptStat(111111);
497  hpcx_1->SetAxisRange(pmin,pmax,"X");
498  hpcx_1->SetAxisRange(cmin,cmax,"Y");
499  hpcx_1->Draw("colz");
500  c5_1->Update();
501  TPaveStats *s5_1 = hpcx_1->FindObject("stats");
502  s5_1->SetX1NDC(0.7);
503  s5_1->SetX2NDC(0.9);
504  s5_1->SetY1NDC(0.25);
505  s5_1->SetY2NDC(0.75);
506  s5_1->Draw();
507  L1x->Draw();
508  L2x->Draw();
509  L3x->Draw();
510  L4x->Draw();
511  sprintf(name,"PCXave_%s_%s_%s.png",det.c_str(),cat.c_str(),rel1.c_str());
512  if(print) c5_1->Print(name);
513 
514  TCanvas *c5_2 = new TCanvas("c5_2", "ave plane vs. ave X cell - nt2",1000,700);
515  c5_2->cd();
516  nt2->Draw("CXave:Pave >> hpcx_2", nhit && !noise);
517  gStyle->SetOptStat(111111);
518  hpcx_2->SetAxisRange(pmin,pmax,"X");
519  hpcx_2->SetAxisRange(cmin,cmax,"Y");
520  hpcx_2->Draw("colz");
521  c5_2->Update();
522  TPaveStats *s5_2 = hpcx_2->FindObject("stats");
523  s5_2->SetX1NDC(0.7);
524  s5_2->SetX2NDC(0.9);
525  s5_2->SetY1NDC(0.25);
526  s5_2->SetY2NDC(0.75);
527  s5_2->Draw();
528  L1x->Draw();
529  L2x->Draw();
530  L3x->Draw();
531  L4x->Draw();
532  sprintf(name,"PCXave_%s_%s_%s.png",det.c_str(),cat.c_str(),rel2.c_str());
533  if(print) c5_2->Print(name);
534 
535  TCanvas *c6_1 = new TCanvas("c6_1", "ave plane vs. ave Y cell - nt1",1000,700);
536  c6_1->cd();
537  nt1->Draw("CYave:Pave >> hpcy_1", nhit && !noise);
538  gStyle->SetOptStat(111111);
539  hpcy_1->SetAxisRange(pmin,pmax,"X");
540  hpcy_1->SetAxisRange(cmin,cmax,"Y");
541  hpcy_1->Draw("colz");
542  c6_1->Update();
543  TPaveStats *s6_1 = hpcy_1->FindObject("stats");
544  s6_1->SetX1NDC(0.7);
545  s6_1->SetX2NDC(0.9);
546  s6_1->SetY1NDC(0.25);
547  s6_1->SetY2NDC(0.75);
548  s6_1->Draw();
549  L1y->Draw();
550  L2y->Draw();
551  L3y->Draw();
552  L4y->Draw();
553  sprintf(name,"PCYave_%s_%s_%s.png",det.c_str(),cat.c_str(),rel1.c_str());
554  if(print) c6_1->Print(name);
555 
556  TCanvas *c6_2 = new TCanvas("c6_2", "ave plane vs. ave Y cell - nt2",1000,700);
557  c6_2->cd();
558  nt2->Draw("CYave:Pave >> hpcy_2", nhit && !noise);
559  gStyle->SetOptStat(111111);
560  hpcy_2->SetAxisRange(pmin,pmax,"X");
561  hpcy_2->SetAxisRange(cmin,cmax,"Y");
562  hpcy_2->Draw("colz");
563  c6_2->Update();
564  TPaveStats *s6_2 = hpcy_2->FindObject("stats");
565  s6_2->SetX1NDC(0.7);
566  s6_2->SetX2NDC(0.9);
567  s6_2->SetY1NDC(0.25);
568  s6_2->SetY2NDC(0.75);
569  s6_2->Draw();
570  L1y->Draw();
571  L2y->Draw();
572  L3y->Draw();
573  L4y->Draw();
574  sprintf(name,"PCYave_%s_%s_%s.png",det.c_str(),cat.c_str(),rel2.c_str());
575  if(print) c6_2->Print(name);
576 
577  TH2F *hpcxN_1 = new TH2F("hpcxN_1","ave hit plane vs. ave hit X cell NOISE slice;plane;X cell",660,-20.0,1300.0,255,-10.0,500.0);
578  TH2F *hpcyN_1 = new TH2F("hpcyN_1","ave hit plane vs. ave hit Y cell NOISE slice;plane;Y cell",660,-20.0,1300.0,255,-10.0,500.0);
579 
580  TH2F *hpcxN_2 = new TH2F("hpcxN_2","ave hit plane vs. ave hit X cell NOISE slice;plane;X cell",660,-20.0,1300.0,255,-10.0,500.0);
581  TH2F *hpcyN_2 = new TH2F("hpcyN_2","ave hit plane vs. ave hit Y cell NOISE slice;plane;Y cell",660,-20.0,1300.0,255,-10.0,500.0);
582 
583  TCanvas *c5N_1 = new TCanvas("c5N_1", "ave plane vs. ave X cell NOISE - nt1",1000,700);
584  c5N_1->cd();
585  nt1->Draw("CXave:Pave >> hpcxN_1", noise);
586  gStyle->SetOptStat(111111);
587  hpcxN_1->SetAxisRange(pmin,pmax,"X");
588  hpcxN_1->SetAxisRange(cmin,cmax,"Y");
589  hpcxN_1->Draw("colz");
590  c5N_1->Update();
591  TPaveStats *s5N_1 = hpcxN_1->FindObject("stats");
592  s5N_1->SetX1NDC(0.7);
593  s5N_1->SetX2NDC(0.9);
594  s5N_1->SetY1NDC(0.25);
595  s5N_1->SetY2NDC(0.75);
596  s5N_1->Draw();
597  L1x->Draw();
598  L2x->Draw();
599  L3x->Draw();
600  L4x->Draw();
601  sprintf(name,"PCXaveNoise_%s_%s_%s.png",det.c_str(),cat.c_str(),rel1.c_str());
602  if(print) c5N_1->Print(name);
603 
604  TCanvas *c5N_2 = new TCanvas("c5N_2", "ave plane vs. ave X cell NOISE - nt2",1000,700);
605  c5N_2->cd();
606  nt2->Draw("CXave:Pave >> hpcxN_2", noise);
607  gStyle->SetOptStat(111111);
608  hpcxN_2->SetAxisRange(pmin,pmax,"X");
609  hpcxN_2->SetAxisRange(cmin,cmax,"Y");
610  hpcxN_2->Draw("colz");
611  c5N_2->Update();
612  TPaveStats *s5N_2 = hpcxN_2->FindObject("stats");
613  s5N_2->SetX1NDC(0.7);
614  s5N_2->SetX2NDC(0.9);
615  s5N_2->SetY1NDC(0.25);
616  s5N_2->SetY2NDC(0.75);
617  s5N_2->Draw();
618  L1x->Draw();
619  L2x->Draw();
620  L3x->Draw();
621  L4x->Draw();
622  sprintf(name,"PCXaveNoise_%s_%s_%s.png",det.c_str(),cat.c_str(),rel2.c_str());
623  if(print) c5N_2->Print(name);
624 
625  TCanvas *c6N_1 = new TCanvas("c6N_1", "ave plane vs. ave Y cell NOISE - nt1",1000,700);
626  c6N_1->cd();
627  nt1->Draw("CYave:Pave >> hpcyN_1", noise);
628  gStyle->SetOptStat(111111);
629  hpcyN_1->SetAxisRange(pmin,pmax,"X");
630  hpcyN_1->SetAxisRange(cmin,cmax,"Y");
631  hpcyN_1->Draw("colz");
632  c6N_1->Update();
633  TPaveStats *s6N_1 = hpcyN_1->FindObject("stats");
634  s6N_1->SetX1NDC(0.7);
635  s6N_1->SetX2NDC(0.9);
636  s6N_1->SetY1NDC(0.25);
637  s6N_1->SetY2NDC(0.75);
638  s6N_1->Draw();
639  L1y->Draw();
640  L2y->Draw();
641  L3y->Draw();
642  L4y->Draw();
643  sprintf(name,"PCYaveNoise_%s_%s_%s.png",det.c_str(),cat.c_str(),rel1.c_str());
644  if(print) c6N_1->Print(name);
645 
646  TCanvas *c6N_2 = new TCanvas("c6N_2", "ave plane vs. ave Y cell NOISE - nt2",1000,700);
647  c6N_2->cd();
648  nt2->Draw("CYave:Pave >> hpcyN_2", noise);
649  gStyle->SetOptStat(111111);
650  hpcyN_2->SetAxisRange(pmin,pmax,"X");
651  hpcyN_2->SetAxisRange(cmin,cmax,"Y");
652  hpcyN_2->Draw("colz");
653  c6N_2->Update();
654  TPaveStats *s6N_2 = hpcyN_2->FindObject("stats");
655  s6N_2->SetX1NDC(0.7);
656  s6N_2->SetX2NDC(0.9);
657  s6N_2->SetY1NDC(0.25);
658  s6N_2->SetY2NDC(0.75);
659  s6N_2->Draw();
660  L1y->Draw();
661  L2y->Draw();
662  L3y->Draw();
663  L4y->Draw();
664  sprintf(name,"PCYaveNoise_%s_%s_%s.png",det.c_str(),cat.c_str(),rel2.c_str());
665  if(print) c6N_2->Print(name);
666 
667 
668 
669 
670  TH1F *ht_1 = new TH1F("ht_1","ave hit time per slice; time [ns]; count",120,-50000.0,550000.0);
671  TH1F *htsd_1 = new TH1F("htsd_1","st.dev. of hit time per slice; time [ns]; count",500000,0.0,500000.0);
672  TH1F *ht_2 = new TH1F("ht_2","ave hit time per slice; time [ns]; count",120,-50000.0,550000.0);
673  TH1F *htsd_2 = new TH1F("htsd_2","st.dev. of hit time per slice; time [ns]; count",500000,0.0,500000.0);
674 
675  TCanvas *cT = new TCanvas("cT", "ave time",1000,700);
676  cT->cd();
677  nt1->Draw("Tave >> ht_1", nhit && !noise);
678  nt2->Draw("Tave >> ht_2", nhit && !noise);
679  gStyle->SetOptStat(111111);
680  ht_1->SetLineColor(kBlue);
681  ht_1->SetLineWidth(2);
682  ht_1->Scale(1.0/ht_1->Integral());
683  ht_1->SetAxisRange(-500.0,600000.0,"X");
684  ht_1->Draw();
685  cT->Update();
686  TPaveStats *sTa = ht_1->FindObject("stats");
687  sTa->SetX1NDC(0.7);
688  sTa->SetX2NDC(0.9);
689  sTa->SetY1NDC(0.7);
690  sTa->SetY2NDC(0.9);
691  sTa->Draw();
692  ht_2->SetLineColor(kRed);
693  ht_2->SetLineWidth(2);
694  ht_2->Scale(1.0/ht_2->Integral());
695  ht_2->SetAxisRange(-500.0,600000.0,"X");
696  ht_2->Draw("sames");
697  cT->Update();
698  TPaveStats *sTb = ht_2->FindObject("stats");
699  sTb->SetX1NDC(0.7);
700  sTb->SetX2NDC(0.9);
701  sTb->SetY1NDC(0.5);
702  sTb->SetY2NDC(0.7);
703  sTb->Draw();
704  sprintf(name,"Tave_%s_%s_%s_%s.png",det.c_str(),cat.c_str(),rel1.c_str(),rel2.c_str());
705  if(print) cT->Print(name);
706 
707  TCanvas *cTsd = new TCanvas("cTsd", "sd time",1000,700);
708  cTsd->cd();
709  nt1->Draw("Tsd >> htsd_1", nhit && !noise);
710  nt2->Draw("Tsd >> htsd_2", nhit && !noise);
711  gStyle->SetOptStat(111111);
712  htsd_1->SetLineColor(kBlue);
713  htsd_1->SetLineWidth(2);
714  htsd_1->Scale(1.0/htsd_1->Integral());
715  htsd_1->SetAxisRange(0.0,500.0,"X");
716  htsd_1->Draw();
717  cTsd->Update();
718  TPaveStats *sTsda = htsd_1->FindObject("stats");
719  sTsda->SetX1NDC(0.7);
720  sTsda->SetX2NDC(0.9);
721  sTsda->SetY1NDC(0.7);
722  sTsda->SetY2NDC(0.9);
723  sTsda->Draw();
724  htsd_2->SetLineColor(kRed);
725  htsd_2->SetLineWidth(2);
726  htsd_2->Scale(1.0/htsd_2->Integral());
727  htsd_2->SetAxisRange(0.0,500.0,"X");
728  htsd_2->Draw("sames");
729  cTsd->Update();
730  TPaveStats *sTsdb = htsd_2->FindObject("stats");
731  sTsdb->SetX1NDC(0.7);
732  sTsdb->SetX2NDC(0.9);
733  sTsdb->SetY1NDC(0.5);
734  sTsdb->SetY2NDC(0.7);
735  sTsdb->Draw();
736  sprintf(name,"Tsd_%s_%s_%s_%s.png",det.c_str(),cat.c_str(),rel1.c_str(),rel2.c_str());
737  if(print) cTsd->Print(name);
738 
739  TH1F *htN_1 = new TH1F("htN_1","ave hit time per NOISE slice; time [ns]; count",1000,0.0,500000.0);
740  TH1F *htN_2 = new TH1F("htN_2","ave hit time per NOISE slice; time [ns]; count",1000,0.0,500000.0);
741 
742  TCanvas *cTN = new TCanvas("cTN", "ave time NOISE",1000,700);
743  cTN->cd();
744  nt1->Draw("Tave >> htN_1", noise);
745  nt2->Draw("Tave >> htN_2", noise);
746  gStyle->SetOptStat(111111);
747  htN_1->SetLineColor(kBlue);
748  htN_1->SetLineWidth(2);
749  htN_1->Scale(1.0/htN_1->Integral());
750  htN_1->SetAxisRange(250000.0,300000.0,"X");
751  htN_1->Draw();
752  cTN->Update();
753  TPaveStats *sTNa = htN_1->FindObject("stats");
754  sTNa->SetX1NDC(0.7);
755  sTNa->SetX2NDC(0.9);
756  sTNa->SetY1NDC(0.7);
757  sTNa->SetY2NDC(0.9);
758  sTNa->Draw();
759  htN_2->SetLineColor(kRed);
760  htN_2->SetLineWidth(2);
761  htN_2->Scale(1.0/htN_2->Integral());
762  htN_2->SetAxisRange(250000.0,300000.0,"X");
763  htN_2->Draw("sames");
764  cTN->Update();
765  TPaveStats *sTNb = htN_2->FindObject("stats");
766  sTNb->SetX1NDC(0.7);
767  sTNb->SetX2NDC(0.9);
768  sTNb->SetY1NDC(0.5);
769  sTNb->SetY2NDC(0.7);
770  sTNb->Draw();
771  sprintf(name,"TaveNoise_%s_%s_%s_%s.png",det.c_str(),cat.c_str(),rel1.c_str(),rel2.c_str());
772  if(print) cTN->Print(name);
773 
774 
775 
776 
777 
778 
779  // Below are plots no longer made as part of the standard production validation suite
780 
781  /*
782  TCanvas *c11 = new TCanvas("c11", "delta plane vs delta X cell",1000,700);
783  c11->cd();
784  nt1->Draw("(CXhi-CXlo):(Phi-Plo) >> hdpcx", nhit && !noise);
785  gStyle->SetOptStat(111111);
786  hdpcx->SetAxisRange(dpmin,dpmax,"X");
787  hdpcx->SetAxisRange(dcmin,dcmax,"Y");
788  hdpcx->Draw("colz");
789 
790  TCanvas *c12 = new TCanvas("c12", "delta plane vs delta Y cell",1000,700);
791  c12->cd();
792  nt1->Draw("(CYhi-CYlo):(Phi-Plo) >> hdpcy", nhit && !noise);
793  gStyle->SetOptStat(111111);
794  hdpcy->SetAxisRange(dpmin,dpmax,"X");
795  hdpcy->SetAxisRange(dcmin,dcmax,"Y");
796  hdpcy->Draw("colz");
797 
798  TLine *L0 = new TLine(-0.5,-0.5,100.5,100.5);
799  L0->SetLineWidth(2);
800 
801  TCanvas *c9_1 = new TCanvas("c9_1", "MCT vs. slices - nt1",1000,700);
802  c9_1->cd();
803  gStyle->SetOptStat(111111);
804  h9_1->SetAxisRange(h9min,h9max,"X");
805  h9_1->SetAxisRange(h9min,h9max,"Y");
806  h9_1->Draw("colz");
807  L0->Draw();
808 
809  TCanvas *c9_2 = new TCanvas("c9_2", "MCT vs. slices - nt2",1000,700);
810  c9_2->cd();
811  gStyle->SetOptStat(111111);
812  h9_2->SetAxisRange(h9min,h9max,"X");
813  h9_2->SetAxisRange(h9min,h9max,"Y");
814  h9_2->Draw("colz");
815  L0->SetLineWidth(2);
816  L0->Draw();
817  */
818 
819 }
const int pmax
Definition: cellShifts.C:13
const XML_Char * name
Definition: expat.h:151
const int cmax
Definition: cellShifts.C:14
nhit
Definition: demo1.py:25
void slicer_production_validation()
Float_t f2
c2
Definition: demo5.py:33
Sum up livetimes from individual cosmic triggers.
Double_t X1
Definition: plot.C:264
Double_t Y1
Definition: plot.C:264
bool print
Float_t f1
const double j
Definition: BetheBloch.cxx:29
TH1F * h1
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:68
Double_t Y2
Definition: plot.C:264