11 gStyle->SetOptStat(0);
12 gStyle->SetCanvasColor(0);
13 gStyle->SetTitleColor(1);
14 gStyle->SetStatColor(0);
15 gStyle->SetFrameFillColor(0);
16 gStyle->SetPadColor(0);
17 gStyle->SetPadTickX(1);
18 gStyle->SetPadTickY(1);
19 gStyle->SetTitleSize(0.04);
20 gStyle->SetCanvasBorderMode(0);
21 gStyle->SetFrameBorderMode(0);
22 gStyle->SetFrameLineWidth(2);
23 gStyle->SetPadBorderMode(0);
24 gStyle->SetPalette(1);
25 gStyle->SetTitleAlign(23);
26 gStyle->SetTitleX(.5);
27 gStyle->SetTitleY(0.99);
28 gStyle->SetTitleBorderSize(0);
29 gStyle->SetTitleFillColor(0);
30 gStyle->SetHatchesLineWidth(2);
31 gStyle->SetLineWidth(1.5);
32 gStyle->SetTitleFontSize(0.07);
33 gStyle->SetLabelSize(0.05,
"X");
34 gStyle->SetLabelSize(0.05,
"Y");
35 gStyle->SetTitleSize(0.04,
"X");
36 gStyle->SetTitleSize(0.04,
"Y");
37 gStyle->SetTitleBorderSize(0);
38 gStyle->SetCanvasBorderMode(0);
44 wcsimdirenv = getenv (
"WCSIMDIR");
45 if(wcsimdirenv != NULL){
46 gSystem->Load(
"${WCSIMDIR}/libWCSimRoot.so");
48 gSystem->Load(
"../libWCSimRoot.so");
51 TFile *f =
new TFile(
filename,
"read");
53 cout <<
"Error, could not open input file: " <<
filename << endl;
57 TFile *f2 =
new TFile(filename2,
"read");
59 cout <<
"Error, could not open input file: " << filename2 << endl;
64 TTree *wcsimT = f->Get(
"wcsimT");
65 int nevent = wcsimT->GetEntries();
66 TTree *wcsimT2 = f2->Get(
"wcsimT");
67 int nevent2 = wcsimT2->GetEntries();
71 wcsimT->SetBranchAddress(
"wcsimrootevent",&wcsimrootsuperevent);
73 wcsimT2->SetBranchAddress(
"wcsimrootevent",&wcsimrootsuperevent2);
76 wcsimT->GetBranch(
"wcsimrootevent")->SetAutoDelete(kTRUE);
77 wcsimT2->GetBranch(
"wcsimrootevent")->SetAutoDelete(kTRUE);
82 cout <<
"Stats for the first event in your version of WCSim using " <<
filename << endl;
83 cout <<
"Number of tube hits " << wcsimrootevent->
GetNumTubesHit() << endl;
84 cout <<
"Number of digitized tube hits " << wcsimrootevent->
GetNumDigiTubesHit() << endl;
85 cout <<
"Number of photoelectron hit times " << wcsimrootevent->
GetCherenkovHitTimes()->GetEntries() << endl;
90 cout <<
"***********************************************************" << endl;
91 cout <<
"Stats for the first event of WCSim version on GitHub using "<< filename2 << endl;
92 cout <<
"Number of tube hits " << wcsimrootevent2->
GetNumTubesHit() << endl;
93 cout <<
"Number of digitized tube hits " << wcsimrootevent2->
GetNumDigiTubesHit() << endl;
94 cout <<
"Number of photoelectron hit times " << wcsimrootevent2->
GetCherenkovHitTimes()->GetEntries() << endl;
97 cout <<
"***********************************************************" << endl;
98 if (abs(wcsimrootevent->
GetNumTubesHit() - wcsimrootevent2->
GetNumTubesHit())>1.0e-6){cout <<
"FIRST EVENT TEST FAILED: Number of hit tubes do not match" << endl;}
99 else {cout <<
"FIRST EVENT TEST PASSED: Number of hit tubes matches" << endl;}
100 if (abs(wcsimrootevent->
GetNumDigiTubesHit() - wcsimrootevent2->
GetNumDigiTubesHit())>1.0e-6){cout <<
"FIRST EVENT TEST FAILED: Number of digitized tubes do not match" << endl; }
101 else {cout <<
"FIRST EVENT TEST PASSED: Number of digitized tubes matches" << endl; }
102 if (abs(wcsimrootevent->
GetCherenkovHitTimes()->GetEntries() - wcsimrootevent2->
GetCherenkovHitTimes()->GetEntries())> 1.0e-6){cout <<
"FIRST EVENT TEST FAILED: Number of hit times do not match" << endl;}
103 else {cout <<
"FIRST EVENT TEST PASSED: Number of hit times matches" << endl;}
105 if (nevent != nevent2) {
106 cout <<
"***********************************************************" << endl;
107 cout <<
"The input files don’t contain the same number of events. Only the first events were compared. To see histograms of the number of hits, deposited charge and hit time, please choose two input files which contain the same number of events." << endl;
113 TH1F *hits =
new TH1F(
"PMT Hits",
"# Digitized Hits", 500, 0, 3000);
114 TH1F *
time =
new TH1F(
"Average Time",
"Average Time", 600, 900, 2000);
115 TH1F *charge =
new TH1F(
"Q/# Digitized PMT",
"Average Charge", 200, 0, 5);
117 TH1F *hits2 =
new TH1F(
"PMT Hits 2",
"Digitized Hits", 500, 0, 3000);
118 TH1F *time2 =
new TH1F(
"Average Time 2",
"Average Time", 600, 900, 2000);
119 TH1F *charge2 =
new TH1F(
"Q/# Digitized PMT 2",
"Average Charge", 200, 0, 5);
122 TH1F *h1 =
new TH1F(
"PMT Hits",
"# Digitized Hits", 500, 0, 25000);
123 TH1F *
time =
new TH1F(
"Average time",
"Average time", 600, 500, 5000);
124 TH1F *pe =
new TH1F(
"Q/# Digitzed PMT",
"Average Charge", 200, 0, 5);
125 TH1F *hit_pmts =
new TH1F(
"Hit PMTs",
"# Hit PMTs",500,0,35000);
127 TH1F *tot_charge =
new TH1F(
"tot",
"Total Charge in event",500,0,20000);
129 TH1F *charge =
new TH1F(
"charge",
"",200,0,1000);
130 TH1F *ttime =
new TH1F(
"ttime",
"",200,900,2000);
131 TH2F *t_q =
new TH2F(
"tq",
"",200,900,2000,200,0,20);
133 TH2F *tubeID_q =
new TH2F(
"tubeIDq",
"",300,1400,1700,100,0,300);
134 TH2F *mPMTid_q =
new TH2F(
"mPMTidq",
"",34,1,35,100,0,300);
135 TH1F *occupancy =
new TH1F(
"occupancy",
"",20000,0,20000);
136 TH1F *occupancy_mPMT =
new TH1F(
"occupancy_mPMT",
"",35,0,35);
137 TH1F *occupancy_mPMT2 =
new TH1F(
"occupancy_mPMT2",
"",200,0,20000);
138 TH1F *nhit_pmt =
new TH1F(
"nhit_pmt",
"",30,0,30);
139 std::cout <<
"nevent: " << nevent << std::endl;
141 for (
int ev=0; ev<nevent; ev++)
144 wcsimT->GetEvent(ev);
145 wcsimrootevent = wcsimrootsuperevent->
GetTrigger(0);
147 printf(
"********************************************************");
150 printf(
"Mode %d\n", wcsimrootevent->
GetMode());
151 printf(
"Number of subevents %d\n",
154 printf(
"Vtxvol %d\n", wcsimrootevent->
GetVtxvol());
155 printf(
"Vtx %f %f %f\n", wcsimrootevent->
GetVtx(0),
164 double vtx_x = wcsimrootevent->
GetVtx(0);
165 double vtx_y = wcsimrootevent->
GetVtx(1);
166 double vtx_z = wcsimrootevent->
GetVtx(2);
167 double dist = sqrt(vtx_x*vtx_x + vtx_y * vtx_y);
189 h1->Fill(ncherenkovdigihits);
196 std::cout << ncherenkovdigihits << std::endl;
200 for (
int i=0;
i< ncherenkovdigihits;
i++){
205 float q = wcsimrootcherenkovdigihit->
GetQ();
206 float t = wcsimrootcherenkovdigihit->
GetT();
210 occupancy->Fill(tubeNumber);
212 occupancy_mPMT->Fill(tubeNumber%33 == 0 ? 33 : tubeNumber%33);
213 occupancy_mPMT2->Fill(tubeNumber/33);
217 tubeID_q->Fill(tubeNumber,
q);
218 mPMTid_q->Fill(tubeNumber%33 == 0 ? 33 : tubeNumber%33,
q);
221 tot_charge->Fill(totalq);
222 float av_time = totalt/ncherenkovdigihits;
223 float av_q = totalq/ncherenkovdigihits;
245 TBranch *branch = wcsimT2->GetBranch(
"wcsimrootevent");
246 branch->SetAddress(&wcsimrootsuperevent);
249 wcsimT2->GetBranch(
"wcsimrootevent")->SetAutoDelete(kTRUE);
256 TH1F *h2 =
new TH1F(
"PMT Hits 2",
"# Digitized Hits", 500, 0, 25000);
257 TH1F *time2 =
new TH1F(
"Average time 2",
"Average time", 600, 500, 5000);
258 TH1F *pe2 =
new TH1F(
"Q/# Digitzed PMT 2",
"Q/# Digitzed PMT", 200, 0, 5);
259 TH1F *hit_pmts2 =
new TH1F(
"Hit PMTs 2",
"# Hit PMTs",500,0,35000);
261 TH1F *tot_charge2 =
new TH1F(
"tot2",
"Total Charge in event",500,0,20000);
263 TH1F *charge2 =
new TH1F(
"charge2",
"",200,0,1000);
264 TH1F *ttime2 =
new TH1F(
"ttime2",
"",200,900,2000);
265 TH1F *occupancy2 =
new TH1F(
"occupancy2",
"",200,0,500000);
266 TH1F *occupancy2_mPMT =
new TH1F(
"occupancy2_mPMT",
"",34,0,34);
267 TH1F *occupancy2_mPMT2 =
new TH1F(
"occupancy2_mPMT2",
"",200,0,20000);
270 for (
int ev=0; ev<nevent2; ev++){
272 wcsimT2->GetEvent(ev);
273 wcsimrootevent2 = wcsimrootsuperevent2->
GetTrigger(0);
276 printf(
"********************************************************");
279 printf(
"Mode %d\n", wcsimrootevent2->
GetMode());
280 printf(
"Number of subevents %d\n",
283 printf(
"Vtxvol %d\n", wcsimrootevent2->
GetVtxvol());
284 printf(
"Vtx %f %f %f\n", wcsimrootevent2->
GetVtx(0),
291 h2->Fill(ncherenkovdigihits);
297 for (
int i=0;
i< ncherenkovdigihits;
i++){
302 float q = wcsimrootcherenkovdigihit->
GetQ();
303 float t = wcsimrootcherenkovdigihit->
GetT();
310 tot_charge2->Fill(totalq);
311 if(ncherenkovdigihits > 0){
312 float av_time = totalt/ncherenkovdigihits;
313 float av_q = totalq/ncherenkovdigihits;
317 time2->Fill(av_time);
322 Double_t
ks_hits = hits->KolmogorovTest(hits2);
323 Double_t
ks_charge = charge->KolmogorovTest(charge2);
325 cout <<
"***********************************************************" << endl;
326 cout <<
"ks test for # of digitized hits: " <<
ks_hits << endl;
327 cout <<
"ks test for average charge: " <<
ks_charge << endl;
328 cout <<
"ks test for average time: " <<
ks_time << endl;
331 float win_scale = 0.75;
334 TCanvas* c1 =
new TCanvas(
"c1",
"Test Plots", 500*n_wide*win_scale, 500*n_high*win_scale);
338 hits2->SetLineColor(kRed);
340 c1->cd(1); hits2->Draw(
"SAME");
342 TLegend *
leg =
new TLegend(0.2,0.7,0.55,0.85,
"");
343 leg->SetFillColor(0);
344 leg->SetBorderSize(0);
347 leg->AddEntry(h1,
"mPMT",
"l");
348 leg->AddEntry(h2,
"20in",
"l");
352 charge->GetXaxis()->SetTitle(
"Total Charge / # digitized hits");
354 charge2->SetLineColor(kRed);
355 c1->cd(2); charge2->Draw(
"SAME");
357 time->GetXaxis()->SetTitle(
"Total Time / # digitized hits (ns)");
359 time2->SetLineColor(kRed);
360 c1->cd(3); time2->Draw(
"SAME");
365 hit_pmts2->SetLineColor(kRed);
366 hit_pmts2->Draw(
"same");
368 TCanvas*
c2 =
new TCanvas(
"c2",
"Test Plots", 500*n_wide*win_scale, 500*n_high*win_scale);
369 gStyle->SetOptStat(1);
370 gStyle->SetOptFit(111);
377 tot_charge2->SetLineColor(kRed);
378 tot_charge2->Draw(
"same");
382 TCanvas *
c3 =
new TCanvas();
385 occupancy_mPMT2->Draw();
387 occupancy_mPMT->Draw();
390 ttime2->SetLineColor(kRed);
391 ttime2->Draw(
"same");
394 charge2->SetLineColor(kRed);
395 charge2->Draw(
"same");
398 TCanvas *
c4 =
new TCanvas();
402 TCanvas *
c5 =
new TCanvas();
Int_t GetNumberOfSubEvents() const
Class holding digitised hit (aka digit or digi) information (after PMT & electronics simulation + tri...
Int_t GetNumDigiTubesHit() const
double q[MAX_N_ACTIVE_TUBES]
WCSimRootEventHeader * GetHeader()
TClonesArray * GetTracks() const
Float_t GetVtx(Int_t i=0)
Int_t GetNcherenkovdigihits() const
void verification_HitsChargeTime(char *filename="wcsimtest.root", char *filename2="../../WCSim_clean/verification-test-scripts/wcsimtest.root", bool verbose=false)
Class storing trigger information.
WCSimRootTrigger * GetTrigger(int number)
TClonesArray * GetCherenkovHitTimes() const
Int_t GetNumTubesHit() const
Int_t GetNumberOfEvents() const
Class containing event information.
double t[MAX_N_ACTIVE_TUBES]
TClonesArray * GetCherenkovDigiHits() const
Class holding true track information.