Functions
Cana.C File Reference

Go to the source code of this file.

Functions

TCut nhitC ("(nhitx+nhity)>9&&nhitx>4&&nhity>4")
 
TCut taveC ("tave>0.0&&tave<550.0")
 
TCut vetoCt ("y1<130.0&&abs(x1)<100.0&&z1>50&&z1<770")
 
TCut phiCt ("1")
 
TCut cosCt ("cosnumi>0.85")
 
TCut tightC (nhitC &&taveC &&vetoCt &&phiCt &&cosCt)
 
TCut tightC_noTime (nhitC &&vetoCt &&phiCt &&cosCt)
 
TCut veto1 ("abs(x1)<110.0&&abs(y1)<140&&z1>30&&z1<790")
 
TCut veto2 ("abs(x2)<110.0&&abs(y2)<140&&z2>30&&z2<790")
 
TCut vetoCl (veto1||veto2)
 
TCut cosCl ("1")
 
TCut looseC (nhitC &&taveC &&vetoCl &&cosCl)
 
TCut tCl ("tave>216&&tave<230")
 
TCut tCt ("tave>216.1&&tave<228.3")
 
void Cana ()
 
void events (int which)
 
void plot_times ()
 
void plot_beam_angles ()
 
void plot_positions ()
 
void plot_angles ()
 
void plot_nhit ()
 
void plot_runsummary ()
 

Function Documentation

void Cana ( )

Definition at line 37 of file Cana.C.

References plot_angles(), plot_beam_angles(), plot_nhit(), plot_positions(), plot_runsummary(), and plot_times().

38 {
39  if (gROOT->IsBatch()) gDirectory->cd("Cana");
40 
42  plot_nhit();
43  plot_angles();
46  plot_times();
47  // events(2);
48 }
void plot_positions()
Definition: Cana.C:131
void plot_beam_angles()
Definition: Cana.C:114
void plot_runsummary()
Definition: Cana.C:256
void plot_times()
Definition: Cana.C:70
void plot_nhit()
Definition: Cana.C:225
void plot_angles()
Definition: Cana.C:195
TCut cosCl ( "1"  )
TCut cosCt ( cosnumi,
0.85"   
)
void events ( int  which)

Definition at line 52 of file Cana.C.

References om::cout, allTimeWatchdog::endl, looseC(), tCt(), and tightC().

Referenced by cmf::EventList::AddEvent(), braggPeak(), checkBeam(), ErrorBand(), estimate_cosmics(), estimate_cosmics_triggeronly(), fragmentAngularDistribution(), fragmentAngularDistributionGM(), fragmentAngularDistributionHistogram(), fragmentEnergy(), fragmentEnergyDistributionDifferentAngles(), fragmentYields(), and fragmentYieldsPlot().

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 }
OStream cout
Definition: OStream.cxx:6
TCut looseC(nhitC &&taveC &&vetoCl &&cosCl)
TCut tCt("tave>216.1&&tave<228.3")
TCut tightC(nhitC &&taveC &&vetoCt &&phiCt &&cosCt)
TCut looseC ( nhitC &&taveC &&vetoCl &&  cosCl)

Referenced by events().

TCut nhitC ( nhitx+nhity,
9 &&  nhitx,
4 &&  nhity,
4"   
)
TCut phiCt ( "1"  )

Referenced by plot_beam_angles().

void plot_angles ( )

Definition at line 195 of file Cana.C.

References demo5::c1, demo5::c2, f2, h1, h2, nhitC(), cet::pow(), and taveC().

Referenced by Cana().

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 }
constexpr T pow(T x)
Definition: pow.h:75
TCut nhitC("(nhitx+nhity)>9&&nhitx>4&&nhity>4")
Float_t f2
c2
Definition: demo5.py:33
TH1F * h2
Definition: plot.C:45
TH1F * h1
c1
Definition: demo5.py:24
TCut taveC("tave>0.0&&tave<550.0")
void plot_beam_angles ( )

Definition at line 114 of file Cana.C.

References demo5::c1, demo5::c2, h1, h2, nhitC(), phiCt(), taveC(), and vetoCt().

Referenced by Cana().

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 }
TCut vetoCt("y1<130.0&&abs(x1)<100.0&&z1>50&&z1<770")
TCut nhitC("(nhitx+nhity)>9&&nhitx>4&&nhity>4")
c2
Definition: demo5.py:33
TH1F * h2
Definition: plot.C:45
TH1F * h1
c1
Definition: demo5.py:24
TCut taveC("tave>0.0&&tave<550.0")
TCut phiCt("1")
void plot_nhit ( )

Definition at line 225 of file Cana.C.

References demo5::c1, demo5::c2, h1, h2, and h3.

Referenced by Cana().

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 }
TH1F * h3
Definition: berger.C:36
c2
Definition: demo5.py:33
TH1F * h2
Definition: plot.C:45
TH1F * h1
c1
Definition: demo5.py:24
void plot_positions ( )

Definition at line 131 of file Cana.C.

References demo5::c1, demo5::c2, chisquared::c3, chisquared::c4, h1, h2, h3, PandAna.reco_validation.add_data::h5, nhitC(), and taveC().

Referenced by Cana().

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 }
TH1F * h3
Definition: berger.C:36
TCut nhitC("(nhitx+nhity)>9&&nhitx>4&&nhity>4")
c2
Definition: demo5.py:33
TH1F * h2
Definition: plot.C:45
TH1F * h1
c1
Definition: demo5.py:24
TCut taveC("tave>0.0&&tave<550.0")
void plot_runsummary ( )

Definition at line 256 of file Cana.C.

References demo5::c1.

Referenced by Cana().

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 }
const char * p
Definition: xmltok.h:285
c1
Definition: demo5.py:24
void plot_times ( )

Definition at line 70 of file Cana.C.

References demo5::c1, demo5::c2, om::cout, lem_server::cs, allTimeWatchdog::endl, h1, h2, getGoodRuns4SAM::n, extractScale::rms, std::sqrt(), tCl(), tightC(), and tightC_noTime().

Referenced by Cana().

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 }
TCut tCl("tave>216&&tave<230")
T sqrt(T number)
Definition: d0nt_math.hpp:156
c2
Definition: demo5.py:33
OStream cout
Definition: OStream.cxx:6
TH1F * h2
Definition: plot.C:45
TH1F * h1
TCut tightC_noTime(nhitC &&vetoCt &&phiCt &&cosCt)
c1
Definition: demo5.py:24
TCut tightC(nhitC &&taveC &&vetoCt &&phiCt &&cosCt)
TCut taveC ( tave)
TCut tCl ( tave)

Referenced by plot_times().

TCut tCt ( tave)

Referenced by events().

TCut tightC ( nhitC &&taveC &&vetoCt &&phiCt &&  cosCt)

Referenced by events(), and plot_times().

TCut tightC_noTime ( nhitC &&vetoCt &&phiCt &&  cosCt)

Referenced by plot_times().

TCut veto1 ( )
TCut veto2 ( )
TCut vetoCl ( veto1||  veto2)
TCut vetoCt ( )

Referenced by plot_beam_angles().