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; |
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 |
if((ph->GetOrbitalTime()<x[ev-minev-1]&&ev-minev!=0) || ev-minev==MAXSTORAGE){ |
|
297 |
|
if((ph->GetOrbitalTime()<x[ev-minev-1] && ev-minev!=0) || ev-minev==MAXSTORAGE){ |
298 |
maxev=ev; |
maxev=ev; |
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 |
|
|
334 |
} |
} |
335 |
} |
} |
336 |
} |
} |
|
|
|
|
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 |
|
|
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 |
for(Int_t j=countCOBT;j<neventC;j++){ |
for(Int_t j=cin;j<cfin;j++){ |
433 |
if(COBT[j]<COBT[j-1] && j!=countCOBT || COBT[j]>x[maxev-minev-1]){ |
if(i==6) ar.DrawArrow(COBT[j],1700.,COBT[j],2700.,0.01,"<"); |
434 |
if(i==11) countCOBT=j; |
else ar.DrawArrow(COBT[j],1000.,COBT[j],2000.,0.01,"<"); |
|
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(""); |