Cana.C
Go to the documentation of this file.
1 TCut nhitC("(nhitx+nhity)>9&&nhitx>4&&nhity>4");
2 TCut taveC("tave>0.0&&tave<550.0");
3 
4 //
5 // Define two versions of the cuts. A "tight" version used to reduce
6 // backgrounds to a minimum to search for the beam time window and a
7 // "loose" version which assumes we're able to use the time window to
8 // look for neutrino candidates
9 //=
10 // Tight cuts
11 //
12 TCut vetoCt("y1<130.0&&abs(x1)<100.0&&z1>50&&z1<770");
13 TCut phiCt("1");
14 TCut cosCt("cosnumi>0.85");
17 //=
18 // Loose cuts
19 //
20 // Ask for one end point inside the "fiducial volume"
21 //
22 TCut veto1("abs(x1)<110.0&&abs(y1)<140&&z1>30&&z1<790");
23 TCut veto2("abs(x2)<110.0&&abs(y2)<140&&z2>30&&z2<790");
24 TCut vetoCl(veto1||veto2);
25 // TCut cosCl("cosnumi>0.60");
26 TCut cosCl("1");
27 TCut looseC(nhitC&&taveC&&vetoCl&&cosCl);
28 
29 //
30 // Define two timing cuts, a loose one and a tight one
31 //
32 TCut tCl("tave>216&&tave<230");
33 TCut tCt("tave>216.1&&tave<228.3");
34 
35 //......................................................................
36 
37 void Cana()
38 {
39  if (gROOT->IsBatch()) gDirectory->cd("Cana");
40 
42  plot_nhit();
43  plot_angles();
46  plot_times();
47  // events(2);
48 }
49 
50 //......................................................................
51 
52 void events(int which)
53 {
54  if (which==0) {
55  std::cout << "ALL EVENTS PASSING TIGHT CUTS" << std::endl;
56  cana->Scan("evt:run:subrun:tave",tightC);
57  }
58  if (which==1) {
59  std::cout << "INTIME EVENTS PASSING TIGHT CUTS" << std::endl;
60  cana->Scan("evt:run:subrun:tave",tightC&&tCt);
61  }
62  if (which==2) {
63  std::cout << "INTIME EVENTS LOOSE CUTS" << std::endl;
64  cana->Scan("evt:run:subrun:tave",looseC&&tCt);
65  }
66 }
67 
68 //......................................................................
69 
70 void plot_times()
71 {
72  TCanvas* c1 = new TCanvas("tave","tave");
73  TH1F* h1 = new TH1F("taveh","NuMI neutrino candidates;t-t_{0} (usec);Time Windows per 2 usec",350,-100,600);
74  cana->Draw("tave >> taveh",tightC_noTime);
75  c1->Print("tave.pdf");
76  c1->Print("tave.png");
77 
78 
79  TCanvas* cs = new TCanvas("taveS","taveS");
80  TH1F* hs = new TH1F("taves","NuMI neutrino candidates - zoomed;t-t_{0} (usec);Time Windows per .5 usec",100,195,245);
81  cana->Draw("tave >> taves",tightC_noTime);
82  cs->Print("tave-peak.png");
83 
84  gStyle->SetOptStat(1111);
85  TCanvas* c2 = new TCanvas("tave-zoom","tave-zoom");
86  cana->Draw("tave",tightC&&tCl);
87  c2->Print("tave-zoom.pdf");
88  c2->Print("tave-zoom.png");
89 
90  TH1F* h2 = new TH1F("tavefineh",";t-t_{0} (usec)",5500,0,550);
91  cana->Draw("tave >> tavefineh",tightC&&tCl);
92 
93  double tc = h2->GetMean();
94  double rms = h2->GetRMS();
95  double n = h2->Integral();
96  if (n>1) {
97  double sig = rms/sqrt(n-1);
98 
99  //
100  // The magic 41/9 and 49/9 come from taking the spill shape into
101  // account. About 1/2 the time we get 4 booster batches, 1/2 the
102  // time 5.
103  //
104  double ts = tc - (41./9.) - 3*sig;
105  double te = tc + (49./9.) + 3*sig;
106 
107  std::cout << "Time window between " << ts << " and " << te
108  << " at 3 sigma (" << te-ts << " wide)" << std::endl;
109  }
110 }
111 
112 //......................................................................
113 
115 {
116  TCanvas* c2 = new TCanvas("phib","phib");
117  TH1F* h2 = new TH1F("phib",";#phi_{B}",40,-200,200);
118  cana->Draw("phidet >> phib",nhitC&&taveC&&vetoCt);
119  c2->Print("phib.pdf");
120  c2->Print("phib.png");
121 
122  TCanvas* c1 = new TCanvas("costhetab","cosnumi");
123  TH1F* h1 = new TH1F("costhetab",";cos#theta_{B}",50,0.0,1.0);
124  cana->Draw("cosnumi >> costhetab",nhitC&&taveC&&vetoCt&&phiCt);
125  c1->Print("costhetab.pdf");
126  c1->Print("costhetab.png");
127 }
128 
129 //......................................................................
130 
132 {
133  gStyle->SetOptStat(0);
134 
135  TCanvas* c1 = new TCanvas("x1pos","x1pos");
136  TH1F* h1 = new TH1F("x1pos","x1pos",40,-200,200);
137  cana->Draw("x1 >> x1pos",nhitC&&taveC);
138  c1->Print("x1pos.pdf");
139  c1->Print("x1pos.png");
140 
141  TCanvas* c2 = new TCanvas("y1pos","y1pos");
142  TH1F* h2 = new TH1F("y1pos","y1pos",50,-250,250);
143  cana->Draw("y1 >> y1pos",nhitC&&taveC);
144  c2->Print("y1pos.pdf");
145  c2->Print("y1pos.png");
146 
147  TCanvas* c3 = new TCanvas("z1pos","z1pos");
148  TH1F* h3 = new TH1F("z1pos","z1pos",90,-50,850);
149  cana->Draw("z1 >> z1pos",nhitC&&taveC);
150  c3->Print("z1pos.pdf");
151  c3->Print("z1pos.png");
152 
153  // TCut veto("y1<120.0&&abs(x1)<110.0&&z1>50&&z1<760")
154 
155  TCanvas* c4 = new TCanvas("xz","xz");
156  TH2F* h4 = new TH2F("x1z1",";z1 (cm);x1 (cm)",
157  50,-100.0,900,
158  20,-200,200);
159  cana->Draw("x1:z1>>x1z1",nhitC&&taveC,"colz");
160  TBox* b4 = new TBox(50,-100,770,100);
161  b4->SetLineStyle(3);
162  b4->SetFillStyle(0);
163  b4->Draw();
164  c4->Print("xz.pdf");
165  c4->Print("xz.png");
166 
167  TCanvas* c5 = new TCanvas("yz","yz");
168  TH2F* h5 = new TH2F("y1z1",";z1 (cm);y1 (cm)",
169  50,-100.0,900,
170  30,-300,300);
171  cana->Draw("y1:z1>>y1z1",nhitC&&taveC,"colz");
172  TBox* b5 = new TBox(50,-300,770,130);
173  b5->SetLineStyle(3);
174  b5->SetFillStyle(0);
175  b5->Draw();
176  c5->Print("yz.pdf");
177  c5->Print("yz.png");
178 
179  TCanvas* c6 = new TCanvas("yx","yx");
180  TH2F* h6 = new TH2F("y1x1",";x1 (cm);y1 (cm)",
181  20,-200,200,
182  30,-300,300);
183  cana->Draw("y1:x1>>y1x1",nhitC&&taveC,"colz");
184  TBox* b6 = new TBox(-100,-300,100,130);
185  b6->SetLineStyle(3);
186  b6->SetFillStyle(0);
187  b6->Draw();
188 
189  c6->Print("yx.pdf");
190  c6->Print("yx.png");
191 }
192 
193 //......................................................................
194 
195 void plot_angles()
196 {
197  gStyle->SetOptStat(0);
198  TCanvas* c1 = new TCanvas("angles1","angles1",600,700);
199  TH1F* h1 = new TH1F("zenith",";cos(#theta_{Z});Ntracks",100,0.0,1.0);
200  h1->SetMarkerStyle(20);
201  h1->SetMinimum(0);
202  cana->Draw("coscosmic >> zenith",nhitC&&taveC,"e");
203 
204  double sum1 = h1->Integral(1,80);
205  double sum2 = pow(0.8,3)/3.0;
206  char buff[256];
207  sprintf(buff,"(%f/%f)*x**2",sum1,100*sum2);
208  TF1* f2 = new TF1("f2",buff,0,1);
209  f2->Draw("same");
210 
211  c1->Print("angles1.pdf");
212  c1->Print("angles1.png");
213 
214  TCanvas* c2 = new TCanvas("angles2","angles2",600,700);
215  TH1F* h2 = new TH1F("phi",";#phi (deg.);Ntracks",72,-180,180);
216  h2->SetMarkerStyle(20);
217  cana->Draw("phicosmic >> phi",nhitC&&taveC,"e");
218 
219  c2->Print("phi.pdf");
220  c2->Print("phi.png");
221 }
222 
223 //......................................................................
224 
225 void plot_nhit()
226 {
227  gStyle->SetOptStat(1111);
228 
229  TCanvas* c1 = new TCanvas("nhit1","nhit1",400,800);
230  TH1F* h1 = new TH1F("Nhits","Nhits;Nhits;Ntracks",100,0.0,100.0);
231  gPad->SetLogy();
232  cana->Draw("nhit >> Nhits");
233 
234  c1->Print("nhit1.pdf");
235  c1->Print("nhit1.png");
236 
237  TCanvas* c2 = new TCanvas("nhit2","nhit2",400,800);
238 
239  c2->Divide(1,2);
240  c2->cd(1);
241  TH1F* h2 = new TH1F("NhitsX","X view;Nhits;Ntracks",50,0.0,50.0);
242  gPad->SetLogy();
243  cana->Draw("nhitx >> NhitsX");
244 
245  c2->cd(2);
246  TH1F* h3 = new TH1F("NhitsY","Y view;Nhits;Ntracks",50,0.0,50.0);
247  gPad->SetLogy();
248  cana->Draw("nhity >> NhitsY");
249 
250  c2->Print("nhit2.pdf");
251  c2->Print("nhit2.png");
252 }
253 
254 //......................................................................
255 
257 {
258  TCanvas* c1 = new TCanvas("run-summary","run-summary",800,800);
259  c1->Divide(1,2);
260  c1->cd(1);
261  fNhitTotalVsEvent->Draw();
262  TProfile* p = fNhitTotalVsEvent->ProfileX();
263  p->SetMarkerStyle(20);
264  p->SetMarkerColor(2);
265  p->SetLineColor(2);
266  p->Draw("same");
267 
268  c1->cd(2);
269  fNtimeWinVsEvent->Draw();
270  p = fNtimeWinVsEvent->ProfileX();
271  p->SetMarkerStyle(20);
272  p->SetMarkerColor(2);
273  p->SetLineColor(2);
274  p->Draw("same");
275 }
276 
277 ////////////////////////////////////////////////////////////////////////
TCut cosCl("1")
void plot_positions()
Definition: Cana.C:131
TCut veto1("abs(x1)<110.0&&abs(y1)<140&&z1>30&&z1<790")
TCut vetoCt("y1<130.0&&abs(x1)<100.0&&z1>50&&z1<770")
TCut tCl("tave>216&&tave<230")
TCut vetoCl(veto1||veto2)
TCut veto2("abs(x2)<110.0&&abs(y2)<140&&z2>30&&z2<790")
TH1F * h3
Definition: berger.C:36
const char * p
Definition: xmltok.h:285
T sqrt(T number)
Definition: d0nt_math.hpp:156
constexpr T pow(T x)
Definition: pow.h:75
void plot_beam_angles()
Definition: Cana.C:114
TCut nhitC("(nhitx+nhity)>9&&nhitx>4&&nhity>4")
Float_t f2
void plot_runsummary()
Definition: Cana.C:256
void Cana()
Definition: Cana.C:37
c2
Definition: demo5.py:33
void plot_times()
Definition: Cana.C:70
void plot_nhit()
Definition: Cana.C:225
void plot_angles()
Definition: Cana.C:195
OStream cout
Definition: OStream.cxx:6
TH1F * h2
Definition: plot.C:45
TH1F * h1
TCut tightC_noTime(nhitC &&vetoCt &&phiCt &&cosCt)
TCut looseC(nhitC &&taveC &&vetoCl &&cosCl)
TCut cosCt("cosnumi>0.85")
c1
Definition: demo5.py:24
TCut tCt("tave>216.1&&tave<228.3")
TCut taveC("tave>0.0&&tave<550.0")
void events(int which)
Definition: Cana.C:52
TCut tightC(nhitC &&taveC &&vetoCt &&phiCt &&cosCt)
TCut phiCt("1")