54 |
|
|
55 |
using namespace std; |
using namespace std; |
56 |
|
|
57 |
void ND_QL(TString base, TString outDir, TString format, ULong_t DeltaT, ULong_t DeltaTevtime){ // DeltaT in ms, DeltaTevtime in minute |
void ND_QL(TString base, TString outDir, TString format, ULong_t DeltaT, Double_t DeltaTevtime){ // DeltaT in ms, DeltaTevtime in minute |
58 |
|
|
59 |
//---------------- Variables initialization --------------------------// |
//---------------- Variables initialization --------------------------// |
60 |
Int_t tmpSize=0; |
Int_t tmpSize=0; |
61 |
Int_t yTrig=0; |
Int_t yTrig=0; |
62 |
Int_t yUpperBackground=0; |
Int_t yUpperBackground=0; |
63 |
Int_t yBottomBackground=0; |
Int_t yBottomBackground=0; |
64 |
ULong_t lastime=0, firstime=0; |
ULong_t lastime=0, firstime=700000000; |
65 |
Double_t scale= 1./DeltaTevtime; |
Double_t scale= 1./DeltaTevtime; |
66 |
string title, title1; |
stringstream title, title1; |
67 |
double obt; |
double obt; |
|
Float_t cut; |
|
68 |
stringstream oss, noentries; |
stringstream oss, noentries; |
69 |
stringstream oss1, oss2, oss3; |
stringstream oss1, oss2, oss3; |
70 |
|
|
131 |
} |
} |
132 |
|
|
133 |
//------------ first and last events -> nbin ---------------------------------// |
//------------ first and last events -> nbin ---------------------------------// |
134 |
phystr->GetEntry(0); |
headBr->GetEntry(0); |
135 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
136 |
firstime = ph->GetOrbitalTime(); |
firstime = ph->GetOrbitalTime(); |
137 |
phystr->GetEntry(nevents-1); |
|
138 |
ph = eh->GetPscuHeader(); |
for (Int_t i = 0; i < nevents; i++){ |
139 |
lastime = ph->GetOrbitalTime(); |
headBr->GetEntry(i); |
140 |
const ULong_t nint=((lastime-firstime)/(DeltaTevtime*60000)); |
ph = eh->GetPscuHeader(); |
141 |
const ULong_t nint1=((lastime-firstime)/(DeltaT)); |
if((ph->GetOrbitalTime()) <= firstime) firstime=ph->GetOrbitalTime(); |
142 |
const ULong_t nint2=lastime-firstime; |
if((ph->GetOrbitalTime()) >= lastime) lastime=ph->GetOrbitalTime(); |
143 |
int nbin=(int)nint; |
} |
|
int nbin1=(int)nint1; |
|
|
int nbin2=(int)nint2; |
|
|
double obmin=firstime; |
|
|
double obmax=lastime; |
|
144 |
|
|
145 |
|
const Double_t nint=((lastime-firstime)/(DeltaTevtime*60000)); |
146 |
|
const Double_t nint1=((lastime-firstime)/(DeltaT));// |
147 |
|
const Double_t nint2=lastime-firstime; |
148 |
|
int nbin=(int)nint; |
149 |
|
int nbin1=(int)nint1; |
150 |
|
int nbin2=(int)nint2; |
151 |
|
if(nbin2 >= 37000000) nbin2=37000000; |
152 |
|
double obmin=firstime; |
153 |
|
double obmax=lastime; |
154 |
|
|
155 |
//************************** HISTOGRAMS ***************************************************// |
//************************** HISTOGRAMS ***************************************************// |
156 |
//---------------------------- First histograms -----------------------------------------// |
//---------------------------- First histograms -----------------------------------------// |
157 |
oss.str(""); |
oss.str(""); |
158 |
oss <<"Bottom Background Neutrons with poissionian fit (DeltaT = " << DeltaT << " ms)"; |
oss <<"Distribution of Bottom Background Neutrons collected in DeltaT = " << DeltaT << " ms"; |
159 |
oss1.str(""); |
oss1.str(""); |
160 |
oss1 <<"Upper Background Neutrons with poissionian fit (DeltaT = " << DeltaT << " ms)"; |
oss1 <<"Distribution of Upper Background Neutrons collected in DeltaT = " << DeltaT << " ms"; |
161 |
TH1F *h1 = new TH1F (filename.Data(), oss.str().c_str(), nbin1,obmin,obmax); |
TH1F *h1 = new TH1F (filename.Data(), oss.str().c_str(), nbin1,obmin,obmax); |
162 |
TH1F *h3 = new TH1F (filename.Data(), oss1.str().c_str(), nbin1,obmin,obmax); |
TH1F *h3 = new TH1F (filename.Data(), oss1.str().c_str(), nbin1,obmin,obmax); |
|
TH1F *h1bis = new TH1F (filename.Data(), oss.str().c_str(), 30, 0 ,30); |
|
|
TH1F *h3bis = new TH1F (filename.Data(), oss1.str().c_str(), 30, 0, 30); |
|
163 |
//---------------------------- Second histograms -----------------------------------------// |
//---------------------------- Second histograms -----------------------------------------// |
164 |
title=""; |
title.str(""); |
165 |
title=filename+": Bottom Background & Upper Background: Time Evolution (DT="+DeltaTevtime+" min)"; |
title<<filename<<": Bottom Background & Upper Background: Time Evolution (DT="<<DeltaTevtime<<" min)"; |
166 |
title1=""; |
title1.str(""); |
167 |
title1=filename+". Ratio: UpperBackground / BottomBackground: Time Evolution (DT="+DeltaTevtime+" min)"; |
title1<<filename<<". Ratio: UpperBackground / BottomBackground: Time Evolution (DT="<<DeltaTevtime<<" min)"; |
168 |
TH1F *histo1= new TH1F(title.c_str(),title.c_str(),nbin,obmin,obmax); |
TH1F *histo1= new TH1F(title.str().c_str(),title.str().c_str(),nbin,obmin,obmax); |
169 |
TH1F *histo1bis= new TH1F(title1.c_str(),title1.c_str(),nbin,obmin,obmax); |
TH1F *histo1bis= new TH1F(title1.str().c_str(),title1.str().c_str(),nbin,obmin,obmax); |
170 |
TH1F *histo2= new TH1F(title.c_str(),title.c_str(),nbin,obmin,obmax); |
TH1F *histo2= new TH1F(title.str().c_str(),title.str().c_str(),nbin,obmin,obmax); |
171 |
|
|
172 |
//---------------------------- Third histograms -----------------------------------------// |
//---------------------------- Third histograms -----------------------------------------// |
173 |
|
|
174 |
oss.str(""); |
oss.str(""); |
201 |
histo2->Fill(ph->GetOrbitalTime(), yBottomBackground); |
histo2->Fill(ph->GetOrbitalTime(), yBottomBackground); |
202 |
h1->Fill(ph->GetOrbitalTime(), yBottomBackground); |
h1->Fill(ph->GetOrbitalTime(), yBottomBackground); |
203 |
h3->Fill(ph->GetOrbitalTime(), yUpperBackground); |
h3->Fill(ph->GetOrbitalTime(), yUpperBackground); |
204 |
|
|
205 |
Trig->Fill(ph->GetOrbitalTime(), yTrig); |
Trig->Fill(ph->GetOrbitalTime(), yTrig); |
206 |
Trigger->Fill(ph->GetOrbitalTime(), yTrig); |
Trigger->Fill(ph->GetOrbitalTime(), yTrig); |
207 |
if(yTrig >=10) |
if(yTrig >=10) |
211 |
yTrig=0; |
yTrig=0; |
212 |
} |
} |
213 |
|
|
214 |
for (Int_t i = 0; i < nevents; i++){ |
|
215 |
|
Int_t newBin1=(int)((h1->GetMaximum())-(h1->GetMinimum())); |
216 |
|
Int_t newBin3=(int)((h3->GetMaximum())-(h3->GetMinimum())); |
217 |
|
oss.str(""); |
218 |
|
oss <<"Distribution of Bottom Background Neutrons collected in DeltaT = " << DeltaT << " ms"; |
219 |
|
oss1.str(""); |
220 |
|
oss1 <<"Distribution of Upper Background Neutrons collected in DeltaT = " << DeltaT << " ms"; |
221 |
|
TH1F *h1bis = new TH1F (filename.Data(), oss.str().c_str(), newBin1, h1->GetMinimum(), h1->GetMaximum()); |
222 |
|
TH1F *h3bis = new TH1F (filename.Data(), oss1.str().c_str(), newBin3, h3->GetMinimum(), h3->GetMaximum()); |
223 |
|
for (Int_t i = 0; i < nbin1; i++){ |
224 |
h1bis->Fill(h1->GetBinContent(i)); |
h1bis->Fill(h1->GetBinContent(i)); |
225 |
h3bis->Fill(h3->GetBinContent(i)); |
h3bis->Fill(h3->GetBinContent(i)); |
226 |
} |
} |
227 |
|
|
228 |
//********************************* CANVASES ************************************************// |
//********************************* CANVASES ************************************************// |
229 |
//--------------------------------- First canvas --------------------------------------------// |
//--------------------------------- First canvas --------------------------------------------// |
232 |
histoCanv->Divide(1,2); |
histoCanv->Divide(1,2); |
233 |
|
|
234 |
histoCanv->cd(1); |
histoCanv->cd(1); |
235 |
|
gPad->SetLogy(); |
236 |
h1bis->SetLineColor(kRed); |
h1bis->SetLineColor(kRed); |
237 |
h1bis->SetFillStyle(3004); |
h1bis->SetFillStyle(3004); |
238 |
h1bis->SetFillColor(kRed); |
h1bis->SetFillColor(kRed); |
240 |
h1bis->GetXaxis()->CenterTitle(); |
h1bis->GetXaxis()->CenterTitle(); |
241 |
h1bis->GetYaxis()->SetTitle("Number of events"); |
h1bis->GetYaxis()->SetTitle("Number of events"); |
242 |
h1bis->GetYaxis()->CenterTitle(); |
h1bis->GetYaxis()->CenterTitle(); |
|
gStyle->SetOptFit(1111); |
|
|
TF1 *h2 = new TF1 ("h2", "[0]*TMath::PoissonI(x, [1])" , -1., 30); |
|
|
h2->SetParName(0, "NEvents"); |
|
|
h2->SetParName(1, "meanFreq"); |
|
|
h2->SetParameter(0, size/2); |
|
|
h2->SetParameter(1, 1); |
|
|
h2->SetLineColor(kRed); |
|
|
h1bis->Fit("h2"); |
|
243 |
h1bis->Draw(); |
h1bis->Draw(); |
244 |
|
|
245 |
histoCanv->cd(2); |
histoCanv->cd(2); |
246 |
|
gPad->SetLogy(); |
247 |
h3bis->SetLineColor(kBlue); |
h3bis->SetLineColor(kBlue); |
248 |
h3bis->SetFillStyle(3004); |
h3bis->SetFillStyle(3004); |
249 |
h3bis->SetFillColor(kBlue); |
h3bis->SetFillColor(kBlue); |
251 |
h3bis->GetXaxis()->CenterTitle(); |
h3bis->GetXaxis()->CenterTitle(); |
252 |
h3bis->GetYaxis()->SetTitle("Number of events"); |
h3bis->GetYaxis()->SetTitle("Number of events"); |
253 |
h3bis->GetYaxis()->CenterTitle(); |
h3bis->GetYaxis()->CenterTitle(); |
|
gStyle->SetOptFit(1111); |
|
|
TF1 *h4 = new TF1 ("h4", "[0]*TMath::PoissonI(x, [1])" , -1., 30); |
|
|
h4->SetParName(0, "NEvents"); |
|
|
h4->SetParName(1, "meanFreq"); |
|
|
h4->SetParameter(0, size/2); |
|
|
h4->SetParameter(1, 1); |
|
|
h4->SetLineColor(kBlue); |
|
|
h3bis->Fit("h4"); |
|
254 |
h3bis->Draw(); |
h3bis->Draw(); |
255 |
|
|
256 |
//---------------------------------- Second Canvas -----------------------------------------// |
//---------------------------------- Second Canvas -----------------------------------------// |
262 |
histo1->SetStats(kFALSE); |
histo1->SetStats(kFALSE); |
263 |
histo1->GetYaxis()->SetTitle("Number of recorded Neutrons / DT (min^-1) "); |
histo1->GetYaxis()->SetTitle("Number of recorded Neutrons / DT (min^-1) "); |
264 |
histo1->GetYaxis()->SetTitleSize(0.04); |
histo1->GetYaxis()->SetTitleSize(0.04); |
265 |
histo1->GetYaxis()->SetTitleOffset(0.5); |
histo1->GetYaxis()->SetTitleOffset(1); |
266 |
histo1->GetYaxis()->CenterTitle(); |
histo1->GetYaxis()->CenterTitle(); |
267 |
histo1->GetYaxis()->SetLabelSize(0.03); |
histo1->GetYaxis()->SetLabelSize(0.03); |
268 |
histo1->GetXaxis()->CenterTitle(); |
histo1->GetXaxis()->CenterTitle(); |
270 |
histo1->GetXaxis()->SetTitleOffset(1); |
histo1->GetXaxis()->SetTitleOffset(1); |
271 |
histo1->GetXaxis()->SetLabelSize(0.03); |
histo1->GetXaxis()->SetLabelSize(0.03); |
272 |
histo1->GetXaxis()->SetTitle("OBT (ms)"); |
histo1->GetXaxis()->SetTitle("OBT (ms)"); |
273 |
histo1->SetMarkerSize(.5); |
histo1->SetMarkerSize(.3); |
274 |
histo1->SetMarkerStyle(21); |
histo1->SetMarkerStyle(21); |
275 |
histo1->SetMarkerColor(3); |
histo1->SetMarkerColor(3); |
276 |
histo1->Scale(scale); |
histo1->Scale(scale); |
278 |
histo1->Draw("9p0"); |
histo1->Draw("9p0"); |
279 |
|
|
280 |
histo2->SetStats(kFALSE); |
histo2->SetStats(kFALSE); |
281 |
histo2->SetMarkerSize(.5); |
histo2->SetMarkerSize(.3); |
282 |
histo2->SetMarkerStyle(21); |
histo2->SetMarkerStyle(21); |
283 |
histo2->SetMarkerColor(2); |
histo2->SetMarkerColor(2); |
284 |
histo2->Scale(scale); |
histo2->Scale(scale); |
291 |
leg->Draw(); |
leg->Draw(); |
292 |
|
|
293 |
finalCanv->cd(2); |
finalCanv->cd(2); |
294 |
histo1bis->SetMarkerSize(.5); |
histo1bis->SetMarkerSize(.3); |
295 |
histo1bis->SetStats(kFALSE); |
histo1bis->SetStats(kFALSE); |
296 |
histo1bis->SetMarkerStyle(21); |
histo1bis->SetMarkerStyle(21); |
297 |
histo1bis->SetMarkerColor(4); |
histo1bis->SetMarkerColor(4); |
331 |
triggerCanv->cd(1); |
triggerCanv->cd(1); |
332 |
Trig->SetStats(kFALSE); |
Trig->SetStats(kFALSE); |
333 |
Trig->SetMarkerStyle(21); |
Trig->SetMarkerStyle(21); |
334 |
Trig->SetMarkerSize(.7); |
Trig->SetMarkerSize(.4); |
335 |
Trig->SetMarkerColor(2); |
Trig->SetMarkerColor(2); |
336 |
Trig->GetXaxis()->SetTitle("OBT (ms)"); |
Trig->GetXaxis()->SetTitle("OBT (ms)"); |
337 |
Trig->GetXaxis()->CenterTitle(); |
Trig->GetXaxis()->CenterTitle(); |
347 |
triggerCanv->cd(2); |
triggerCanv->cd(2); |
348 |
Trigger->SetStats(kFALSE); |
Trigger->SetStats(kFALSE); |
349 |
Trigger->SetMarkerStyle(21); |
Trigger->SetMarkerStyle(21); |
350 |
Trigger->SetMarkerSize(.7); |
Trigger->SetMarkerSize(.4); |
351 |
Trigger->SetMarkerColor(4); |
Trigger->SetMarkerColor(4); |
352 |
Trigger->GetYaxis()->SetTitle("Number of Neutrons"); |
Trigger->GetYaxis()->SetTitle("Number of Neutrons"); |
353 |
Trigger->GetYaxis()->SetTitleSize(0.06); |
Trigger->GetYaxis()->SetTitleSize(0.06); |
364 |
triggerCanv->cd(3); |
triggerCanv->cd(3); |
365 |
Triggercut->SetStats(kFALSE); |
Triggercut->SetStats(kFALSE); |
366 |
Triggercut->SetMarkerStyle(21); |
Triggercut->SetMarkerStyle(21); |
367 |
Triggercut->SetMarkerSize(.7); |
Triggercut->SetMarkerSize(.4); |
368 |
Triggercut->SetMarkerColor(4); |
Triggercut->SetMarkerColor(4); |
369 |
Triggercut->GetYaxis()->SetTitle("Number of Neutrons"); |
Triggercut->GetYaxis()->SetTitle("Number of Neutrons"); |
370 |
Triggercut->GetYaxis()->SetTitleSize(0.06); |
Triggercut->GetYaxis()->SetTitleSize(0.06); |
408 |
TString path; |
TString path; |
409 |
TString outDir ="./"; |
TString outDir ="./"; |
410 |
TString format ="jpg"; |
TString format ="jpg"; |
411 |
ULong_t DeltaT =1000; |
ULong_t DeltaT =1000;//era 1000 |
412 |
ULong_t DeltaTevtime =5; |
Double_t DeltaTevtime =1; |
413 |
|
|
414 |
if (argc < 2){ |
if (argc < 2){ |
415 |
printf("You have to insert at least the file to analyze \n"); |
printf("You have to insert at least the file to analyze \n"); |
422 |
printf( "\t -outDir[path] Path where to put the output [default ./] \n"); |
printf( "\t -outDir[path] Path where to put the output [default ./] \n"); |
423 |
printf( "\t -format[jpg|gif|ps] Format for output files [default 'jpg'] \n"); |
printf( "\t -format[jpg|gif|ps] Format for output files [default 'jpg'] \n"); |
424 |
printf( "\t -DeltaT Time interval to bin histograms in ms [default = 1000ms] \n"); |
printf( "\t -DeltaT Time interval to bin histograms in ms [default = 1000ms] \n"); |
425 |
printf( "\t -DeltaTevtime Time interval to control time evolution of acquired data in minute [default = 1 min.] \n"); |
printf( "\t -DeltaTevtime Time interval to control time evolution of acquired data in minute [default = 5 min.] \n"); |
426 |
exit(1); |
exit(1); |
427 |
} |
} |
428 |
path=argv[1]; |
path=argv[1]; |
467 |
exit(1); |
exit(1); |
468 |
} |
} |
469 |
else{ |
else{ |
470 |
DeltaTevtime = atol(argv[i]); |
DeltaTevtime = atof(argv[i]); |
471 |
continue; |
continue; |
472 |
} |
} |
473 |
} |
} |