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 |
|
double obmin=firstime; |
152 |
|
double obmax=lastime; |
153 |
|
|
154 |
//************************** HISTOGRAMS ***************************************************// |
//************************** HISTOGRAMS ***************************************************// |
155 |
//---------------------------- First histograms -----------------------------------------// |
//---------------------------- First histograms -----------------------------------------// |
156 |
oss.str(""); |
oss.str(""); |
157 |
oss <<"Bottom Background Neutrons with poissionian fit (DeltaT = " << DeltaT << " ms)"; |
oss <<"Distribution of Bottom Background Neutrons collected in DeltaT = " << DeltaT << " ms"; |
158 |
oss1.str(""); |
oss1.str(""); |
159 |
oss1 <<"Upper Background Neutrons with poissionian fit (DeltaT = " << DeltaT << " ms)"; |
oss1 <<"Distribution of Upper Background Neutrons collected in DeltaT = " << DeltaT << " ms"; |
160 |
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); |
161 |
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); |
|
162 |
//---------------------------- Second histograms -----------------------------------------// |
//---------------------------- Second histograms -----------------------------------------// |
163 |
title=""; |
title.str(""); |
164 |
title=filename+": Bottom Background & Upper Background: Time Evolution (DT="+DeltaTevtime+" min)"; |
title<<filename<<": Bottom Background & Upper Background: Time Evolution (DT="<<DeltaTevtime<<" min)"; |
165 |
title1=""; |
title1.str(""); |
166 |
title1=filename+". Ratio: UpperBackground / BottomBackground: Time Evolution (DT="+DeltaTevtime+" min)"; |
title1<<filename<<". Ratio: UpperBackground / BottomBackground: Time Evolution (DT="<<DeltaTevtime<<" min)"; |
167 |
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); |
168 |
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); |
169 |
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); |
170 |
//---------------------------- Third histograms -----------------------------------------// |
//---------------------------- Third histograms -----------------------------------------// |
171 |
|
|
172 |
oss.str(""); |
oss.str(""); |
208 |
yTrig=0; |
yTrig=0; |
209 |
} |
} |
210 |
|
|
211 |
for (Int_t i = 0; i < nevents; i++){ |
|
212 |
|
Int_t newBin1=(int)((h1->GetMaximum())-(h1->GetMinimum())); |
213 |
|
Int_t newBin3=(int)((h3->GetMaximum())-(h3->GetMinimum())); |
214 |
|
oss.str(""); |
215 |
|
oss <<"Distribution of Bottom Background Neutrons collected in DeltaT = " << DeltaT << " ms"; |
216 |
|
oss1.str(""); |
217 |
|
oss1 <<"Distribution of Upper Background Neutrons collected in DeltaT = " << DeltaT << " ms"; |
218 |
|
TH1F *h1bis = new TH1F (filename.Data(), oss.str().c_str(), newBin1, h1->GetMinimum(), h1->GetMaximum()); |
219 |
|
TH1F *h3bis = new TH1F (filename.Data(), oss1.str().c_str(), newBin3, h3->GetMinimum(), h3->GetMaximum()); |
220 |
|
for (Int_t i = 0; i < nbin1; i++){ |
221 |
h1bis->Fill(h1->GetBinContent(i)); |
h1bis->Fill(h1->GetBinContent(i)); |
222 |
h3bis->Fill(h3->GetBinContent(i)); |
h3bis->Fill(h3->GetBinContent(i)); |
223 |
} |
} |
224 |
|
|
225 |
//********************************* CANVASES ************************************************// |
//********************************* CANVASES ************************************************// |
226 |
//--------------------------------- First canvas --------------------------------------------// |
//--------------------------------- First canvas --------------------------------------------// |
236 |
h1bis->GetXaxis()->CenterTitle(); |
h1bis->GetXaxis()->CenterTitle(); |
237 |
h1bis->GetYaxis()->SetTitle("Number of events"); |
h1bis->GetYaxis()->SetTitle("Number of events"); |
238 |
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"); |
|
239 |
h1bis->Draw(); |
h1bis->Draw(); |
240 |
|
|
241 |
histoCanv->cd(2); |
histoCanv->cd(2); |
246 |
h3bis->GetXaxis()->CenterTitle(); |
h3bis->GetXaxis()->CenterTitle(); |
247 |
h3bis->GetYaxis()->SetTitle("Number of events"); |
h3bis->GetYaxis()->SetTitle("Number of events"); |
248 |
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"); |
|
249 |
h3bis->Draw(); |
h3bis->Draw(); |
250 |
|
|
251 |
//---------------------------------- Second Canvas -----------------------------------------// |
//---------------------------------- Second Canvas -----------------------------------------// |
257 |
histo1->SetStats(kFALSE); |
histo1->SetStats(kFALSE); |
258 |
histo1->GetYaxis()->SetTitle("Number of recorded Neutrons / DT (min^-1) "); |
histo1->GetYaxis()->SetTitle("Number of recorded Neutrons / DT (min^-1) "); |
259 |
histo1->GetYaxis()->SetTitleSize(0.04); |
histo1->GetYaxis()->SetTitleSize(0.04); |
260 |
histo1->GetYaxis()->SetTitleOffset(0.5); |
histo1->GetYaxis()->SetTitleOffset(1); |
261 |
histo1->GetYaxis()->CenterTitle(); |
histo1->GetYaxis()->CenterTitle(); |
262 |
histo1->GetYaxis()->SetLabelSize(0.03); |
histo1->GetYaxis()->SetLabelSize(0.03); |
263 |
histo1->GetXaxis()->CenterTitle(); |
histo1->GetXaxis()->CenterTitle(); |
403 |
TString path; |
TString path; |
404 |
TString outDir ="./"; |
TString outDir ="./"; |
405 |
TString format ="jpg"; |
TString format ="jpg"; |
406 |
ULong_t DeltaT =1000; |
ULong_t DeltaT =1000;//era 1000 |
407 |
ULong_t DeltaTevtime =5; |
Double_t DeltaTevtime =1; |
408 |
|
|
409 |
if (argc < 2){ |
if (argc < 2){ |
410 |
printf("You have to insert at least the file to analyze \n"); |
printf("You have to insert at least the file to analyze \n"); |
417 |
printf( "\t -outDir[path] Path where to put the output [default ./] \n"); |
printf( "\t -outDir[path] Path where to put the output [default ./] \n"); |
418 |
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"); |
419 |
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"); |
420 |
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"); |
421 |
exit(1); |
exit(1); |
422 |
} |
} |
423 |
path=argv[1]; |
path=argv[1]; |
462 |
exit(1); |
exit(1); |
463 |
} |
} |
464 |
else{ |
else{ |
465 |
DeltaTevtime = atol(argv[i]); |
DeltaTevtime = atof(argv[i]); |
466 |
continue; |
continue; |
467 |
} |
} |
468 |
} |
} |