24 |
#include <PscuHeader.h> |
#include <PscuHeader.h> |
25 |
#include <EventHeader.h> |
#include <EventHeader.h> |
26 |
#include <RunHeaderEvent.h> |
#include <RunHeaderEvent.h> |
27 |
|
#include <EventCounter.h> |
28 |
|
#include <PacketType.h> |
29 |
// |
// |
30 |
#define MAXSTORAGE 50000 |
#define MAXSTORAGE 50000 |
31 |
|
#define GAP 10040*4 |
32 |
|
|
33 |
void stringcopy(TString& s1, const TString& s2, Int_t from=0, Int_t to=0){ |
void stringcopy(TString& s1, const TString& s2, Int_t from=0, Int_t to=0){ |
34 |
if ( to == 0 ){ |
if ( to == 0 ){ |
68 |
pamela::EventHeader *eh=0,*eH=0,*ceh=0; |
pamela::EventHeader *eh=0,*eH=0,*ceh=0; |
69 |
pamela::RunHeaderEvent *reh=0; |
pamela::RunHeaderEvent *reh=0; |
70 |
pamela::PscuHeader *ph=0,*pH=0; |
pamela::PscuHeader *ph=0,*pH=0; |
71 |
|
pamela::EventCounter *cod=0; |
72 |
|
|
73 |
|
pamela::PacketType *pctp=0; |
74 |
|
|
75 |
TFile *datafile = new TFile(file); |
TFile *datafile = new TFile(file); |
76 |
TTree *otr = (TTree*)datafile->Get("RunHeader"); |
TTree *otr = (TTree*)datafile->Get("RunHeader"); |
81 |
tr->SetBranchAddress("Header",&eh); |
tr->SetBranchAddress("Header",&eh); |
82 |
TTree *ctr = (TTree*)datafile->Get("CalibTrk1"); |
TTree *ctr = (TTree*)datafile->Get("CalibTrk1"); |
83 |
ctr->SetBranchAddress("Header",&ceh); |
ctr->SetBranchAddress("Header",&ceh); |
|
|
|
84 |
|
|
85 |
Long64_t neventC = ctr->GetEntries(); |
Long64_t neventC = ctr->GetEntries(); |
86 |
Long64_t nevent = tr->GetEntries(); |
Long64_t nevent = tr->GetEntries(); |
129 |
const Int_t sizeC=neventC; |
const Int_t sizeC=neventC; |
130 |
Int_t count=0,trk_cal_us[sizeH],countrun=1; |
Int_t count=0,trk_cal_us[sizeH],countrun=1; |
131 |
Float_t perc=0,xMIN=0,xMAX=0; |
Float_t perc=0,xMIN=0,xMAX=0; |
132 |
ULong64_t HOBT[sizeH],COBT[sizeC]; |
Int_t HOBT[sizeH],COBT[sizeC]; |
133 |
|
|
134 |
for (Int_t vi=0; vi<sizeH;vi++){ |
for (Int_t vi=0; vi<sizeH;vi++){ |
135 |
HOBT[vi]=0; |
HOBT[vi]=0; |
155 |
// printf("\n%lld\t\tcountrun=%d\n",HOBT[ev],countrun); |
// printf("\n%lld\t\tcountrun=%d\n",HOBT[ev],countrun); |
156 |
} |
} |
157 |
countrun+=(Int_t)nevent/30000; |
countrun+=(Int_t)nevent/30000; |
158 |
printf("\ncountrun=%d\n",countrun); |
// printf("\ncountrun=%d\n",countrun); |
159 |
|
|
160 |
// |
// |
161 |
// information about calibration OBT |
// information about calibration OBT |
162 |
for (Int_t ev=0; ev<neventC; ev++){ |
for (Int_t ev=0; ev<neventC; ev++){ |
181 |
gStyle->SetTitleSize(0.055,"x"); |
gStyle->SetTitleSize(0.055,"x"); |
182 |
|
|
183 |
|
|
184 |
Int_t minev=minevent,maxev=maxevent,countHOBT=0,countCOBT=0; |
Int_t minev=minevent,maxev=maxevent,hin=0,hfin=0,cin=0,cfin=0; |
185 |
TPad *pad[12][countrun] ; //pad for histos |
TPad *pad[12][countrun] ; //pad for histos |
186 |
TGraph *dataletime[12][countrun],*dataletime1[12][countrun]; |
TGraph *dataletime[12][countrun],*dataletime1[12][countrun]; |
187 |
TCanvas *DataTimeCanv[countrun]; |
TCanvas *DataTimeCanv[countrun]; |
217 |
fromfile.str(""); |
fromfile.str(""); |
218 |
isfile.str(""); |
isfile.str(""); |
219 |
|
|
220 |
fromfile<<"The green arrow (if present) points out the time of the online calibration"; |
fromfile<<"The green arrow (if present) probably points out the time of the online calibration"; |
221 |
t->DrawLatex(10.,96.,fromfile.str().c_str()); |
t->DrawLatex(7.,96.,fromfile.str().c_str()); |
222 |
fromfile.str(""); |
fromfile.str(""); |
223 |
|
|
224 |
//************************************************************************************* |
//************************************************************************************* |
279 |
for (Int_t ev=minev; ev<maxevent; ev++){ |
for (Int_t ev=minev; ev<maxevent; ev++){ |
280 |
tr->GetEntry(ev); |
tr->GetEntry(ev); |
281 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
282 |
|
cod = eh->GetCounter(); |
283 |
|
|
284 |
|
if(ev==minev){ |
285 |
|
if(cod->Get(pctp->CalibTrk1)>0) |
286 |
|
cin=cod->Get(pctp->CalibTrk1)-1; |
287 |
|
else |
288 |
|
cin=cod->Get(pctp->CalibTrk1); |
289 |
|
if(cod->Get(pctp->RunHeader)>0) |
290 |
|
hin=cod->Get(pctp->RunHeader)-1; |
291 |
|
else |
292 |
|
hin=cod->Get(pctp->RunHeader); |
293 |
|
} |
294 |
|
|
295 |
if(ev==maxevent-1) maxev=maxevent-1; |
if(ev==maxevent-1) maxev=maxevent-1; |
296 |
// printf("prova00\n"); |
|
297 |
if((ph->GetOrbitalTime()<x[ev-minev-1]&&ev-minev!=0) || ev-minev==MAXSTORAGE){ |
if((ph->GetOrbitalTime()<x[ev-minev-1] && ev-minev!=0) || ev-minev==MAXSTORAGE){ |
298 |
maxev=ev; |
maxev=ev; |
|
// printf("prova12\n"); |
|
299 |
break; |
break; |
300 |
} |
} |
301 |
else{ |
else{ |
302 |
|
cfin=cod->Get(pctp->CalibTrk1); |
303 |
|
hfin=cod->Get(pctp->RunHeader); |
304 |
x[(ev-minev)]= ph->GetOrbitalTime(); |
x[(ev-minev)]= ph->GetOrbitalTime(); |
305 |
i=0; |
i=0; |
306 |
|
|
|
// printf("prova0 %d\n ",ev); |
|
307 |
for (Int_t n=0; n<12 ; n++){ |
for (Int_t n=0; n<12 ; n++){ |
308 |
perc=0; |
perc=0; |
309 |
count=0; |
count=0; |
334 |
} |
} |
335 |
} |
} |
336 |
} |
} |
|
|
|
|
// printf("prova2\n"); |
|
|
if(ii==0 && COBT[0]<x[0]){ |
|
|
// printf("\n%f-(%f-%lld) div 10 \n",x[0],x[maxev-minev-1],COBT[0]); |
|
|
xMIN=x[0]-(x[maxev-minev-1]-COBT[0])/10; |
|
|
xMAX=x[maxev-minev-1]+(x[maxev-minev-1]-COBT[0])/10; |
|
|
// printf("\nxMIN=%f\txMAX=%f\n",xMIN,xMAX); |
|
|
} |
|
|
else{ |
|
|
// printf("\n%f\t%f \n",x[0],x[maxev-minev-1]); |
|
|
xMIN=x[0]-(x[maxev-minev-1]-x[0])/10; |
|
|
xMAX=x[maxev-minev-1]+(x[maxev-minev-1]-x[0])/10; |
|
|
// printf("\nxMIN=%f\txMAX=%f\n",xMIN,xMAX); |
|
|
if(xMIN<0) xMIN=0; |
|
|
} |
|
337 |
|
|
338 |
|
Float_t xmin1=0,xmin2=0; |
339 |
|
xmin1=x[0]-(x[maxev-minev-1]-x[0])/10; |
340 |
|
xmin2=x[0]-(x[maxev-minev-1]-COBT[cin])/10; |
341 |
|
// printf("\n%f\t%f \n",x[0],x[maxev-minev-1]); |
342 |
|
if(xmin1<xmin2) xMIN=xmin1; |
343 |
|
else if(xmin2<xmin1) xMIN=xmin2; |
344 |
|
xMAX=x[maxev-minev-1]+(x[maxev-minev-1]-x[0])/10; |
345 |
|
// printf("\nxMIN=%f\txMAX=%f\n",xMIN,xMAX); |
346 |
|
if(xMIN<0) xMIN=0; |
347 |
|
|
348 |
|
|
349 |
for (Int_t i=0; i<12 ; i++){ |
for (Int_t i=0; i<12 ; i++){ |
350 |
|
|
354 |
yb[v]=yyb[v][i]; |
yb[v]=yyb[v][i]; |
355 |
} |
} |
356 |
|
|
|
// printf("prova3\n"); |
|
357 |
if((maxev-minev)>1000){ |
if((maxev-minev)>1000){ |
358 |
perc=(count*100)/(maxev-minev); |
perc=(count*100)/(maxev-minev); |
359 |
if(perc>10) pad[i][ii]->SetFillColor(2); |
if(perc>10) pad[i][ii]->SetFillColor(2); |
370 |
pad[i][ii]->Draw(); |
pad[i][ii]->Draw(); |
371 |
pad[i][ii]->cd(); |
pad[i][ii]->cd(); |
372 |
dataletime[i][ii]= new TGraph((maxev-minev),x,y); |
dataletime[i][ii]= new TGraph((maxev-minev),x,y); |
|
// printf("\nentries nel graph= %d\n",maxev-minev); |
|
373 |
dataletime[i][ii]->SetTitle(oss.str().c_str()); |
dataletime[i][ii]->SetTitle(oss.str().c_str()); |
374 |
dataletime[i][ii]->GetXaxis()->SetTitle("OBT (ms)"); |
dataletime[i][ii]->GetXaxis()->SetTitle("OBT (ms)"); |
375 |
dataletime[i][ii]->GetXaxis()->CenterTitle(); |
dataletime[i][ii]->GetXaxis()->CenterTitle(); |
|
// dataletime[i][ii]->GetXaxis()->SetRangeUser(min,max); |
|
376 |
dataletime[i][ii]->GetXaxis()->SetRangeUser(xMIN,xMAX); |
dataletime[i][ii]->GetXaxis()->SetRangeUser(xMIN,xMAX); |
377 |
dataletime[i][ii]->GetYaxis()->SetTitle("datalength (Word 13 bit)"); |
dataletime[i][ii]->GetYaxis()->SetTitle("datalength (Word 13 bit)"); |
378 |
dataletime[i][ii]->GetYaxis()->CenterTitle(); |
dataletime[i][ii]->GetYaxis()->CenterTitle(); |
384 |
dataletime[i][ii]->SetMarkerColor(4); |
dataletime[i][ii]->SetMarkerColor(4); |
385 |
dataletime[i][ii]->Draw("ap"); |
dataletime[i][ii]->Draw("ap"); |
386 |
|
|
|
// printf("prova4\n"); |
|
387 |
|
|
388 |
if((maxev-minev)>1000 && perc>10){ |
if((maxev-minev)>1000 && perc>10){ |
389 |
dataletime1[i][ii]= new TGraph(count,xb,yb); |
dataletime1[i][ii]= new TGraph(count,xb,yb); |
404 |
li.SetLineColor(1); |
li.SetLineColor(1); |
405 |
li.SetLineStyle(1); |
li.SetLineStyle(1); |
406 |
li.SetLineWidth(1); |
li.SetLineWidth(1); |
|
// if(i!=6) li.DrawLine(min,750,max,750); |
|
|
// else li.DrawLine(min,1500,max,1500); |
|
|
// li.DrawLine(min,3075,max,3075); |
|
407 |
if(i!=6) li.DrawLine(xMIN,750,xMAX,750); |
if(i!=6) li.DrawLine(xMIN,750,xMAX,750); |
408 |
else li.DrawLine(xMIN,1500,xMAX,1500); |
else li.DrawLine(xMIN,1500,xMAX,1500); |
409 |
li.DrawLine(xMIN,3075,xMAX,3075); |
li.DrawLine(xMIN,3075,xMAX,3075); |
411 |
li.SetLineColor(12); |
li.SetLineColor(12); |
412 |
li.SetLineStyle(4); |
li.SetLineStyle(4); |
413 |
li.SetLineWidth(1); |
li.SetLineWidth(1); |
414 |
for(Int_t j=countHOBT;j<neventH;j++){ |
for(Int_t j=hin;j<hfin;j++){ |
415 |
if(HOBT[j]<HOBT[j-1] && j!=countHOBT || HOBT[j]>x[maxev-minev-1]){ |
if(i==6) li.DrawLine(HOBT[j],0.,HOBT[j],4500.); |
416 |
if(i==11) countHOBT=j; |
else li.DrawLine(HOBT[j],0.,HOBT[j],3500.); |
417 |
break; |
if(trk_cal_us[j]==104){ |
418 |
} |
calus<<"D"; |
419 |
|
t2->SetTextColor(6); |
420 |
|
if(i==6) t2->DrawLatex(HOBT[j],4350.,calus.str().c_str()); |
421 |
|
else t2->DrawLatex(HOBT[j],3350.,calus.str().c_str()); |
422 |
|
calus.str(""); |
423 |
|
} |
424 |
else{ |
else{ |
425 |
if( HOBT[j]>xMIN && HOBT[j]<x[maxev-minev-1]){ |
calus<<"O"; |
426 |
if(i==6) li.DrawLine(HOBT[j],0.,HOBT[j],4500.); |
t2->SetTextColor(3); |
427 |
else li.DrawLine(HOBT[j],0.,HOBT[j],3500.); |
if(i==6) t2->DrawLatex(HOBT[j],4350.,calus.str().c_str()); |
428 |
if(trk_cal_us[j]==104){ |
else t2->DrawLatex(HOBT[j],3350.,calus.str().c_str()); |
429 |
calus<<"D"; |
calus.str(""); |
|
t2->SetTextColor(6); |
|
|
if(i==6) t2->DrawLatex(HOBT[j],4350.,calus.str().c_str()); |
|
|
else t2->DrawLatex(HOBT[j],3350.,calus.str().c_str()); |
|
|
calus.str(""); |
|
|
} |
|
|
else{ |
|
|
calus<<"O"; |
|
|
t2->SetTextColor(3); |
|
|
if(i==6) t2->DrawLatex(HOBT[j],4350.,calus.str().c_str()); |
|
|
else t2->DrawLatex(HOBT[j],3350.,calus.str().c_str()); |
|
|
calus.str(""); |
|
|
} |
|
|
} |
|
430 |
} |
} |
431 |
} |
} |
432 |
// if(ii==0){ |
for(Int_t j=cin;j<cfin;j++){ |
433 |
// if(i==6) ar.DrawArrow(COBT[0],1700.,COBT[0],2700.,0.01,"<"); |
if(i==6) ar.DrawArrow(COBT[j],1700.,COBT[j],2700.,0.01,"<"); |
434 |
// else ar.DrawArrow(COBT[0],1000.,COBT[0],2000.,0.01,"<"); |
else ar.DrawArrow(COBT[j],1000.,COBT[j],2000.,0.01,"<"); |
|
// } |
|
|
for(Int_t j=countCOBT;j<neventC;j++){ |
|
|
if(COBT[j]<COBT[j-1] && j!=countCOBT || COBT[j]>x[maxev-minev-1]){ |
|
|
if(i==11) countCOBT=j; |
|
|
break; |
|
|
} |
|
|
else{ |
|
|
if( COBT[j]>xMIN && COBT[j]<x[maxev-minev-1]){ |
|
|
if(i==6) ar.DrawArrow(COBT[j],1700.,COBT[j],2700.,0.01,"<"); |
|
|
else ar.DrawArrow(COBT[j],1000.,COBT[j],2000.,0.01,"<"); |
|
|
} |
|
|
} |
|
435 |
} |
} |
436 |
|
|
437 |
oss.str(""); |
oss.str(""); |
439 |
} |
} |
440 |
|
|
441 |
minev=maxev; |
minev=maxev; |
442 |
printf("\ncountrun=%d\n",ii); |
// printf("\ncountrun=%d\n",ii); |
443 |
if(maxev==maxevent-1) { |
if(maxev==maxevent-1) { |
444 |
countrun=ii+1; |
countrun=ii+1; |
445 |
break; |
break; |