48 |
#include "TGraph.h" |
#include "TGraph.h" |
49 |
#include "TH1F.h" |
#include "TH1F.h" |
50 |
#include "TF1.h" |
#include "TF1.h" |
51 |
|
#include "TH2F.h" |
52 |
|
#include "TF2.h" |
53 |
#include "TGaxis.h" |
#include "TGaxis.h" |
54 |
#include "TString.h" |
#include "TString.h" |
55 |
#include "TPaveText.h" |
#include "TPaveText.h" |
75 |
TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString(); |
TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString(); |
76 |
filename = ((TObjString*)filename.Tokenize('.')->First())->GetString(); |
filename = ((TObjString*)filename.Tokenize('.')->First())->GetString(); |
77 |
char *trc; |
char *trc; |
78 |
TString trcs; |
TString trcs,ciao; |
79 |
TString str; |
TString str; |
80 |
TString trcsstot[31]; |
TString trcsstot[31]; |
81 |
TString trcsstot2; |
TString trcsstot2; |
82 |
|
|
83 |
TString trgconf[31]={"TOF1","TOF2","TOF3","TOF4","TOF5","TOF6","TOF7","S4","CALO","CALO-S4","TOF1-S4","TOF2-S4","TOF3-S4","TOF4-S4","TOF5-S4","TOF6-S4","TOF7-S4","TOF1-CALO","TOF2-CALO","TOF3-CALO","TOF4-CALO","TOF5-CALO","TOF6-CALO","TOF7-CALO","TOF1-CALO-S4","TOF2-CALO-S4","TOF3-CALO-S4","TOF4-CALO-S4","TOF5-CALO-S4","TOF6-CALO-S4","TOF7-CALO-S4",}; |
TString trgconf[31]={"TOF1","TOF2","TOF3","TOF4","TOF5","TOF6","TOF7","S4","CALO","CALO-S4","TOF1-S4","TOF2-S4","TOF3-S4","TOF4-S4","TOF5-S4","TOF6-S4","TOF7-S4","TOF1-CALO","TOF2-CALO","TOF3-CALO","TOF4-CALO","TOF5-CALO","TOF6-CALO","TOF7-CALO","TOF1-CALO-S4","TOF2-CALO-S4","TOF3-CALO-S4","TOF4-CALO-S4","TOF5-CALO-S4","TOF6-CALO-S4","TOF7-CALO-S4",}; |
84 |
stringstream oss, oss1, oss2, oss3, s4soglia, buffer, conftrig, noentries; |
stringstream oss, oss1, oss2, oss3, s4soglia, buffer, conftrig, noentries; |
85 |
ULong_t lastime, firstime; |
ULong_t lastime, firstime,obmin,obmax,obt; |
86 |
Int_t vardumpentries = 0; |
Int_t vardumpentries = 0; |
87 |
Int_t channels = 4096; |
Int_t channels = 4096; |
88 |
char S4_TRH[10]; |
char S4_TRH[10]; |
90 |
Int_t trigconf = 0; |
Int_t trigconf = 0; |
91 |
Long64_t nevents; |
Long64_t nevents; |
92 |
string title; |
string title; |
93 |
double obmin=0.; |
|
|
double obmax=0.; |
|
|
double obt; |
|
94 |
double s4rate; |
double s4rate; |
95 |
//------to open headerfile, s4file, Trigfile and vardumpfile---------------------------/ |
//------to open headerfile, s4file, Trigfile and vardumpfile---------------------------/ |
96 |
TFile *file =new TFile(base.Data()) ; |
TFile *file =new TFile(base.Data()) ; |
212 |
//cout<<i<<"\n"; |
//cout<<i<<"\n"; |
213 |
//cout<<nevents<<"\n\n"; |
//cout<<nevents<<"\n\n"; |
214 |
} |
} |
215 |
/////////////////////////////////////////////////////////////////// |
//--------------------------// |
216 |
for(Int_t k=0; k<31; k++){ |
for(Int_t k=0; k<31; k++){ |
217 |
for(Int_t p=0; p<j ; p++){ |
for(Int_t p=0; p<j ; p++){ |
218 |
if(trgconf[k]==trcss[p]){ |
if(trgconf[k]==trcss[p]){ |
260 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
261 |
firstime = ph->GetOrbitalTime(); |
firstime = ph->GetOrbitalTime(); |
262 |
|
|
263 |
int iii =0; |
headBr->GetEntry(nevents); |
264 |
|
ph = eh->GetPscuHeader(); |
265 |
|
lastime = ph->GetOrbitalTime(); |
266 |
|
headBr->GetEntry(nevents-100); |
267 |
|
ph = eh->GetPscuHeader(); |
268 |
|
obt=ph->GetOrbitalTime(); |
269 |
|
if(lastime-obt> 100000)nevents=nevents-100; |
270 |
|
int iii=0,MaxR=0; |
271 |
while(iii < nevents){ |
while(iii < nevents){ |
272 |
headBr->GetEntry(iii); |
headBr->GetEntry(iii); |
273 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
274 |
if((ph->GetOrbitalTime()) <= firstime) firstime=ph->GetOrbitalTime(); |
obt=ph->GetOrbitalTime(); |
275 |
if((ph->GetOrbitalTime()) >= lastime) lastime=ph->GetOrbitalTime(); |
if(obt<=firstime) firstime=ph->GetOrbitalTime(); |
276 |
|
if(obt>=lastime) lastime=ph->GetOrbitalTime(); |
277 |
|
TriggerBr->GetEntry(iii); |
278 |
|
if(trige->s4calcount[0]>MaxR)MaxR=trige->s4calcount[0]; |
279 |
iii++; |
iii++; |
280 |
} |
} |
281 |
|
MaxR=2*(1.05*MaxR/2); |
282 |
|
|
283 |
obmin=firstime; |
obmin=firstime; |
284 |
obmax=lastime; |
obmax=lastime; |
285 |
const ULong_t nint=(((lastime-firstime)/(DeltaT*60000))); |
const ULong_t nint=(((lastime-firstime)/(DeltaT*60000))); |
298 |
const Int_t size2 = (Int_t)((nint2+1)); // one bin every 10 second |
const Int_t size2 = (Int_t)((nint2+1)); // one bin every 10 second |
299 |
const ULong_t nint3=(lastime-firstime)/1000; |
const ULong_t nint3=(lastime-firstime)/1000; |
300 |
const Int_t size3 = (Int_t)((nint3+1)); // one bin every 1 second |
const Int_t size3 = (Int_t)((nint3+1)); // one bin every 1 second |
301 |
TH1F *rate= new TH1F(title.c_str(), title.c_str(), size2, obmin, obmax); |
const Int_t Rbin = MaxR/2; |
302 |
TH1F *rateline= new TH1F(filename+". S4 rate from Trigger Packet: mean value over 100 events", filename+". S4 rate from Trigger Packet: mean value over 100 events", size3, obmin, obmax); |
TH2I *rate= new TH2I(title.c_str(), title.c_str(), size2,obmin,obmax,Rbin,0,MaxR); |
303 |
|
TH2I *rateline= new TH2I(filename+". S4 rate from Trigger Packet: mean value over 100 events", filename+". S4 rate from Trigger Packet: mean value over 100 events",size3,obmin,obmax,Rbin,0,MaxR); |
304 |
|
|
305 |
//------------------------------------------------------------------------------------------------------------------ |
//------------------------------------------------------------------------------------------------------------------ |
306 |
//------- fill histograms ---------// |
//------- fill histograms ---------// |
311 |
S4Br->GetEntry(i); |
S4Br->GetEntry(i); |
312 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
313 |
if (s4e->unpackError == 1 && (s4e->S4_DATA)==0) continue; |
if (s4e->unpackError == 1 && (s4e->S4_DATA)==0) continue; |
314 |
s4rate= trige->s4calcount[0]; |
obt=ph->GetOrbitalTime(); |
315 |
rate->Fill(ph->GetOrbitalTime(), s4rate); |
rate->Fill(obt,trige->s4calcount[0]); |
316 |
h1->Fill(s4e->S4_DATA); |
h1->Fill(s4e->S4_DATA); |
317 |
Allev->Fill(ph->GetOrbitalTime(),s4e->S4_DATA); |
Allev->Fill(obt,s4e->S4_DATA); |
318 |
Alltime->Fill(ph->GetOrbitalTime()); |
Alltime->Fill(obt); |
319 |
if ((trige->patterntrig[0] == 0)&&(trige->patterntrig[1] != 0)&&(trige->patterntrig[2] == 0)&&(trige->patterntrig[3] == 0)&&(trige->patterntrig[4] == 0)&&(trige->patterntrig[5] == 0)){ |
if ((trige->patterntrig[0] == 0)&&(trige->patterntrig[1] != 0)&&(trige->patterntrig[2] == 0)&&(trige->patterntrig[3] == 0)&&(trige->patterntrig[4] == 0)&&(trige->patterntrig[5] == 0)){ |
320 |
h2->Fill(s4e->S4_DATA); |
h2->Fill(s4e->S4_DATA); |
321 |
S4ev->Fill(ph->GetOrbitalTime(),s4e->S4_DATA); |
S4ev->Fill(obt,s4e->S4_DATA); |
322 |
S4time->Fill(ph->GetOrbitalTime()); |
S4time->Fill(obt); |
323 |
p=p+1; |
p=p+1; |
324 |
} |
} |
325 |
} |
} |
326 |
Int_t kk=0; |
Int_t kk=0; |
327 |
|
ULong_t Aobt=0; |
328 |
while (kk < nevents){ |
while (kk < nevents){ |
329 |
obt=0; |
obt=0; |
330 |
s4rate=0; |
s4rate=0; |
331 |
|
Aobt=0; |
332 |
for(Int_t jj=kk; jj< (kk+100); jj++){ |
for(Int_t jj=kk; jj< (kk+100); jj++){ |
333 |
TriggerBr->GetEntry(jj); |
TriggerBr->GetEntry(jj); |
334 |
headBr->GetEntry(jj); |
headBr->GetEntry(jj); |
335 |
obt = obt+(ph->GetOrbitalTime()); |
obt=ph->GetOrbitalTime(); |
336 |
s4rate= s4rate+(trige->s4calcount[0]); |
s4rate= s4rate+(trige->s4calcount[0]); |
337 |
|
Aobt=Aobt-obmin+obt; |
338 |
|
//*(trige->s4calcount[0])/1000; |
339 |
} |
} |
340 |
rateline->Fill((obt/100),(s4rate/100)); |
Aobt=Aobt/100; |
341 |
|
Aobt=Aobt+obmin; |
342 |
|
rateline->Fill(Aobt,s4rate/100); |
343 |
|
//rateline->Fill(ph->GetOrbitalTime(),(s4rate/100)); |
344 |
kk=kk+100; |
kk=kk+100; |
345 |
} |
} |
346 |
|
|
543 |
rate->GetXaxis()->CenterTitle(); |
rate->GetXaxis()->CenterTitle(); |
544 |
rate->GetYaxis()->SetTitle("S4 rate (Hz)"); |
rate->GetYaxis()->SetTitle("S4 rate (Hz)"); |
545 |
rate->GetYaxis()->CenterTitle(); |
rate->GetYaxis()->CenterTitle(); |
546 |
if(rate->GetMaximum() > 1000) gPad->SetLogy(); |
if(MaxR>500) gPad->SetLogy(); |
547 |
rate->Draw("9p"); |
rate->Draw("9p"); |
548 |
|
|
549 |
canvas3->cd(2); |
canvas3->cd(2); |
556 |
rateline->GetYaxis()->SetTitle("S4 rate (Hz)"); |
rateline->GetYaxis()->SetTitle("S4 rate (Hz)"); |
557 |
rateline->GetYaxis()->CenterTitle(); |
rateline->GetYaxis()->CenterTitle(); |
558 |
rateline->SetMaximum(rate->GetMaximum()); |
rateline->SetMaximum(rate->GetMaximum()); |
559 |
if(rateline->GetMaximum() > 1000) gPad->SetLogy(); |
if(MaxR>500) gPad->SetLogy(); |
560 |
rateline->Draw("9p"); |
rateline->Draw("9p"); |
561 |
|
|
562 |
|
|
640 |
S4_QL(argv[1], outDir, format, DeltaT); |
S4_QL(argv[1], outDir, format, DeltaT); |
641 |
|
|
642 |
} |
} |
|
|
|