1 |
/** |
/** |
2 |
* FTrkQLook_BASIC.cpp |
* FTrkQLook_BASIC.cxx |
3 |
* |
* |
4 |
* autor: D.Fedele |
* autor: D.Fedele |
5 |
* version 2.0 |
* version v1r11 |
6 |
* Parameters: |
* Parameters: |
7 |
* file - the data file to analyze |
* file - the data file to analyze |
8 |
* fromevent - first event to analyze |
* fromevent - first event to analyze |
17 |
#include <TCanvas.h> |
#include <TCanvas.h> |
18 |
#include <TGraph.h> |
#include <TGraph.h> |
19 |
#include <TStyle.h> |
#include <TStyle.h> |
20 |
|
#include <TFile.h> |
21 |
#include <TTree.h> |
#include <TTree.h> |
22 |
#include <TArrow.h> |
#include <TArrow.h> |
23 |
// |
// |
25 |
#include <PscuHeader.h> |
#include <PscuHeader.h> |
26 |
#include <EventHeader.h> |
#include <EventHeader.h> |
27 |
#include <RunHeaderEvent.h> |
#include <RunHeaderEvent.h> |
28 |
|
#include <EventCounter.h> |
29 |
|
#include <PacketType.h> |
30 |
// |
// |
31 |
#define MAXSTORAGE 50000 |
#define MAXSTORAGE 50000 |
32 |
|
|
|
void stringcopy(TString& s1, const TString& s2, Int_t from=0, Int_t to=0){ |
|
|
if ( to == 0 ){ |
|
|
Int_t t2length = s2.Length(); |
|
|
s1 = ""; |
|
|
to = t2length; |
|
|
}; |
|
|
for (Int_t i = from; i<to; i++){ |
|
|
s1.Append(s2[i],1); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
33 |
void FTrkQLook_BASIC(TString file,Int_t fromevent,Int_t toevent, TString outdir,TString outfile) |
void FTrkQLook_BASIC(TString file,Int_t fromevent,Int_t toevent, TString outdir,TString outfile) |
34 |
{ |
{ |
35 |
// |
// |
36 |
// obtain information about the data file and select the output dir |
// obtain information about the data file and select the output dir |
37 |
const string filepath=file.Data(); |
Int_t dwpos = file.Last('/'); |
38 |
Int_t dwpos = filepath.rfind("/"); |
Int_t dwpos1 = file.Last('.'); |
|
Int_t dwpos1 = filepath.find(".root"); |
|
|
TString fpath=(filepath.c_str()); |
|
39 |
TString base,ffile ; |
TString base,ffile ; |
40 |
stringcopy(ffile,fpath,dwpos+1,dwpos1); |
ffile=file(dwpos+1,dwpos1-(dwpos+1)); |
41 |
stringcopy(base,fpath,0,dwpos); |
if(dwpos>0) base=file(0,dwpos); |
|
if(dwpos>0) base+="/"; |
|
42 |
|
|
43 |
TString out; |
TString out; |
44 |
if(outdir.Length()==0){ |
if(outdir.Length()==0){ |
46 |
}else{ |
}else{ |
47 |
out = outdir; |
out = outdir; |
48 |
} |
} |
49 |
|
if(out.Last('/')+1<out.Length()) out+="/"; |
50 |
|
|
51 |
// |
// |
52 |
// inizialise the variables and open the file |
// inizialise the variables and open the file |
54 |
pamela::EventHeader *eh=0,*eH=0,*ceh=0; |
pamela::EventHeader *eh=0,*eH=0,*ceh=0; |
55 |
pamela::RunHeaderEvent *reh=0; |
pamela::RunHeaderEvent *reh=0; |
56 |
pamela::PscuHeader *ph=0,*pH=0; |
pamela::PscuHeader *ph=0,*pH=0; |
57 |
|
pamela::EventCounter *cod=0; |
58 |
|
|
59 |
|
pamela::PacketType *pctp=0; |
60 |
|
|
61 |
TFile *datafile = new TFile(file); |
TFile *datafile = new TFile(file); |
62 |
TTree *otr = (TTree*)datafile->Get("RunHeader"); |
TTree *otr = (TTree*)datafile->Get("RunHeader"); |
67 |
tr->SetBranchAddress("Header",&eh); |
tr->SetBranchAddress("Header",&eh); |
68 |
TTree *ctr = (TTree*)datafile->Get("CalibTrk1"); |
TTree *ctr = (TTree*)datafile->Get("CalibTrk1"); |
69 |
ctr->SetBranchAddress("Header",&ceh); |
ctr->SetBranchAddress("Header",&ceh); |
|
|
|
70 |
|
|
71 |
Long64_t neventC = ctr->GetEntries(); |
Long64_t neventC = ctr->GetEntries(); |
72 |
Long64_t nevent = tr->GetEntries(); |
Long64_t nevent = tr->GetEntries(); |
103 |
} else if (toevent > nevent) { |
} else if (toevent > nevent) { |
104 |
maxevent = nevent; |
maxevent = nevent; |
105 |
} else { |
} else { |
106 |
maxevent = toevent+1; |
maxevent = nevent; |
107 |
} |
} |
108 |
nevent=maxevent-minevent ; |
nevent=maxevent-minevent ; |
109 |
} |
} |
111 |
// |
// |
112 |
// other variables definitions |
// other variables definitions |
113 |
stringstream oss,fromfile,isfile; |
stringstream oss,fromfile,isfile; |
114 |
const Int_t sizeH=neventH; |
// |
115 |
const Int_t sizeC=neventC; |
// information about the RunHeader |
116 |
Int_t count=0,trk_cal_us[sizeH],countrun=1; |
ULong64_t HOBT[neventH]; |
117 |
Float_t perc=0,xMIN=0,xMAX=0; |
Int_t trk_cal_us[neventH]; |
118 |
ULong64_t HOBT[sizeH],COBT[sizeC]; |
for (Int_t vi=0; vi<neventH;vi++){ |
|
|
|
|
for (Int_t vi=0; vi<sizeH;vi++){ |
|
119 |
HOBT[vi]=0; |
HOBT[vi]=0; |
120 |
trk_cal_us[vi]=0; |
trk_cal_us[vi]=0; |
121 |
} |
} |
122 |
for (Int_t vi=0; vi<sizeC;vi++){ |
|
|
COBT[vi]=0; |
|
|
} |
|
|
|
|
|
//*************************************************************************************** |
|
|
// LOOP on each event |
|
|
//*************************************************************************************** |
|
|
|
|
123 |
// |
// |
124 |
// information about trk_calib_used |
// information about RunHeader |
125 |
|
Int_t countnboot=1; |
126 |
for (Int_t ev=0; ev<neventH; ev++){ |
for (Int_t ev=0; ev<neventH; ev++){ |
127 |
otr->GetEntry(ev); |
otr->GetEntry(ev); |
128 |
pH = eH->GetPscuHeader(); |
pH = eH->GetPscuHeader(); |
129 |
HOBT[ev]= pH->GetOrbitalTime(); |
HOBT[ev]= pH->GetOrbitalTime(); |
130 |
trk_cal_us[ev]=reh->TRK_CALIB_USED; |
trk_cal_us[ev]=reh->TRK_CALIB_USED; |
131 |
if((HOBT[ev]<HOBT[ev-1]) && ev>0) |
if((HOBT[ev]<HOBT[ev-1]) && ev>0) |
132 |
countrun+=1; |
countnboot+=1; |
|
// printf("\n%lld\t\tcountrun=%d\n",HOBT[ev],countrun); |
|
133 |
} |
} |
134 |
countrun+=(Int_t)nevent/30000; |
countnboot+=(Int_t)(2*nevent/MAXSTORAGE); |
135 |
printf("\ncountrun=%d\n",countrun); |
// printf("\ncountnboot=%d\n",countnboot); |
136 |
|
|
137 |
// |
// |
138 |
// information about calibration OBT |
// information about calibration OBT |
139 |
|
ULong64_t COBT[neventC]; |
140 |
|
for (Int_t vi=0; vi<neventC;vi++){ |
141 |
|
COBT[vi]=0; |
142 |
|
} |
143 |
for (Int_t ev=0; ev<neventC; ev++){ |
for (Int_t ev=0; ev<neventC; ev++){ |
144 |
ctr->GetEntry(ev); |
ctr->GetEntry(ev); |
145 |
pH = ceh->GetPscuHeader(); |
pH = ceh->GetPscuHeader(); |
146 |
COBT[ev]= pH->GetOrbitalTime(); |
COBT[ev]= pH->GetOrbitalTime(); |
147 |
} |
} |
148 |
|
|
149 |
//**************************************************************************************** |
// |
150 |
//Output figure |
// Style options |
|
//**************************************************************************************** |
|
151 |
gStyle->SetLabelSize(0.06,"x"); |
gStyle->SetLabelSize(0.06,"x"); |
152 |
gStyle->SetLabelSize(0.06,"y"); |
gStyle->SetLabelSize(0.06,"y"); |
153 |
gStyle->SetStatFontSize(0.075); |
gStyle->SetStatFontSize(0.075); |
160 |
gStyle->SetTitleSize(0.06,"y"); |
gStyle->SetTitleSize(0.06,"y"); |
161 |
gStyle->SetTitleSize(0.055,"x"); |
gStyle->SetTitleSize(0.055,"x"); |
162 |
|
|
163 |
|
//*************************************************************************************** |
164 |
|
// LOOP on each event |
165 |
|
//*************************************************************************************** |
166 |
|
|
167 |
|
if (fromevent!=0) |
168 |
|
printf("\n Scan of events from %i to %i ... \n",minevent,maxevent-1); |
169 |
|
else |
170 |
|
printf("\n Scan of events from %i to %i ... \n",minevent+1,maxevent); |
171 |
|
|
172 |
|
|
173 |
Int_t minev=minevent,maxev=maxevent,countHOBT=0,countCOBT=0; |
Int_t minev=minevent,maxev=maxevent,hin=0,hfin=0,cin=0,cfin=0; |
174 |
TPad *pad[12][countrun] ; //pad for histos |
TPad *pad[12][countnboot]; |
175 |
TGraph *dataletime[12][countrun],*dataletime1[12][countrun]; |
TGraph *dataletime[12][countnboot],*dataletime1[12][countnboot]; |
176 |
TCanvas *DataTimeCanv[countrun]; |
TCanvas *DataTimeCanv[countnboot]; |
177 |
for(Int_t ii=0; ii<countrun;ii++){ |
for(Int_t ii=0; ii<countnboot;ii++){ |
178 |
fromfile<<"FTrkQLook_BASIC File: "<<ffile; |
fromfile<<"FTrkQLook_BASIC File: "<<ffile; |
179 |
isfile<<"DATALENGTH vs. OBT pag"<<ii+1; |
isfile<<"DATALENGTH vs. OBT pag"<<ii+1; |
180 |
DataTimeCanv[ii]=new TCanvas(isfile.str().c_str(),isfile.str().c_str(),900,1200); |
DataTimeCanv[ii]=new TCanvas(isfile.str().c_str(),isfile.str().c_str(),900,1200); |
207 |
isfile.str(""); |
isfile.str(""); |
208 |
|
|
209 |
fromfile<<"The green arrow (if present) points out the time of the online calibration"; |
fromfile<<"The green arrow (if present) points out the time of the online calibration"; |
210 |
t->DrawLatex(10.,96.,fromfile.str().c_str()); |
t->DrawLatex(7.,96.,fromfile.str().c_str()); |
211 |
fromfile.str(""); |
fromfile.str(""); |
212 |
|
|
213 |
//************************************************************************************* |
//************************************************************************************* |
251 |
|
|
252 |
TArrow ar; |
TArrow ar; |
253 |
ar.SetLineColor(3); |
ar.SetLineColor(3); |
|
//********************************************************************************** |
|
|
// Fill Graphs and Histos |
|
|
//********************************************************************************** |
|
254 |
stringstream calus; |
stringstream calus; |
255 |
|
|
256 |
TLatex *t2=new TLatex(); |
TLatex *t2=new TLatex(); |
260 |
t2->SetTextSize(0.08); |
t2->SetTextSize(0.08); |
261 |
|
|
262 |
Int_t i=0; |
Int_t i=0; |
263 |
Float_t x[MAXSTORAGE], xb[MAXSTORAGE]; |
Long64_t x[MAXSTORAGE], xb[MAXSTORAGE]; |
264 |
Float_t yyd[MAXSTORAGE][12],yyb[MAXSTORAGE][12]; |
Float_t yyd[MAXSTORAGE][12],yyb[MAXSTORAGE][12]; |
265 |
|
Int_t countbad[12]; |
266 |
|
Float_t perc=0; |
267 |
|
Double_t xMIN=0.,xMAX=0.; |
268 |
|
for (Int_t n=0; n<12 ; n++) |
269 |
|
countbad[n]=0; |
270 |
|
|
271 |
|
// |
272 |
|
// obtain values of the datalenght |
273 |
for (Int_t ev=minev; ev<maxevent; ev++){ |
for (Int_t ev=minev; ev<maxevent; ev++){ |
274 |
tr->GetEntry(ev); |
tr->GetEntry(ev); |
275 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
276 |
|
cod = eh->GetCounter(); |
277 |
|
|
278 |
|
if(ev==minev){ |
279 |
|
if(cod->Get(pctp->CalibTrk1)>0) cin=cod->Get(pctp->CalibTrk1)-1; |
280 |
|
else cin=cod->Get(pctp->CalibTrk1); |
281 |
|
if(cin==cfin-1) cin+=1; |
282 |
|
|
283 |
|
if(cod->Get(pctp->RunHeader)>0) hin=cod->Get(pctp->RunHeader)-1; |
284 |
|
else hin=cod->Get(pctp->RunHeader); |
285 |
|
if(hin==hfin-1) hin+=1; |
286 |
|
} |
287 |
|
|
288 |
if(ev==maxevent-1) maxev=maxevent-1; |
if(ev==maxevent-1) maxev=maxevent-1; |
289 |
// printf("prova00\n"); |
|
290 |
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){ |
291 |
maxev=ev; |
maxev=ev; |
|
// printf("prova12\n"); |
|
292 |
break; |
break; |
293 |
} |
} |
294 |
else{ |
else{ |
295 |
|
cfin=cod->Get(pctp->CalibTrk1); |
296 |
|
hfin=cod->Get(pctp->RunHeader); |
297 |
x[(ev-minev)]= ph->GetOrbitalTime(); |
x[(ev-minev)]= ph->GetOrbitalTime(); |
298 |
i=0; |
i=0; |
299 |
|
|
300 |
// printf("prova0 %d\n ",ev); |
for (Int_t n=0; n<12 ; n++){ |
301 |
for (Int_t n=0; n<12 ; n++){ |
i=te->DSPnumber[n]-1; |
302 |
perc=0; |
if(i>=0){ |
303 |
count=0; |
if(i<12){ |
304 |
yyb[count][i]=0; |
yyb[countbad[i]][i]=0; |
305 |
xb[count]= 0; |
xb[countbad[i]]= 0; |
306 |
|
|
307 |
i=te->DSPnumber[n]-1; |
yyd[(ev-minev)][i]=te->DATAlength[n]; |
308 |
|
if(i==6){ |
309 |
yyd[(ev-minev)][i]=te->DATAlength[n]; |
if(yyd[(ev-minev)][i]>1500){ |
310 |
if(i==6){ |
if(yyd[(ev-minev)][i]<3075){ |
311 |
if(yyd[(ev-minev)][i]>1500){ |
yyb[countbad[i]][i]= yyd[(ev-minev)][i]; |
312 |
if(yyd[(ev-minev)][i]<3075){ |
xb[countbad[i]]= x[(ev-minev)]; |
313 |
yyb[count][i]= yyd[(ev-minev)][i]; |
countbad[i]+=1; |
314 |
xb[count]= x[(ev-minev)]; |
} |
315 |
count++; |
} |
316 |
} |
} |
317 |
} |
else{ |
318 |
} |
if(yyd[(ev-minev)][i]>750){ |
319 |
else{ |
if(yyd[(ev-minev)][i]<3075){ |
320 |
if(yyd[(ev-minev)][i]>750){ |
yyb[countbad[i]][i]= yyd[(ev-minev)][i]; |
321 |
if(yyd[(ev-minev)][i]<3075){ |
xb[countbad[i]]= x[(ev-minev)]; |
322 |
yyb[count][i]= yyd[(ev-minev)][i]; |
countbad[i]+=1; |
323 |
xb[count]= x[(ev-minev)]; |
} |
324 |
count++; |
} |
325 |
} |
} |
326 |
} |
} |
327 |
} |
} |
328 |
} |
} |
329 |
} |
} |
330 |
} |
} |
|
|
|
|
// 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; |
|
|
} |
|
331 |
|
|
332 |
|
// |
333 |
|
// define limit for the Xaxis of the graphs |
334 |
|
|
335 |
|
xMAX=x[maxev-minev-1]+(x[maxev-minev-1]-x[0])/10; |
336 |
|
if(xMAX>1000000) xMIN=x[0]-(x[maxev-minev-1]-x[0])/10; |
337 |
|
if(xMAX<1000000 || xMIN<0) xMIN=0.; |
338 |
|
if(xMIN==xMAX) xMIN=x[0] * x[0]/xMAX; |
339 |
|
|
340 |
|
|
341 |
for (Int_t i=0; i<12 ; i++){ |
// |
342 |
|
// Draw Histos |
343 |
|
for (Int_t n=0; n<12 ; n++){ |
344 |
|
|
345 |
Float_t y[maxev-minev],yb[maxev-minev]; |
Double_t yd[maxev-minev],ybd[maxev-minev]; |
346 |
|
Double_t xd[maxev-minev],xbd[maxev-minev]; |
347 |
|
|
348 |
for(Int_t v=0;v<maxev-minev;v++){ |
for(Int_t v=0;v<maxev-minev;v++){ |
349 |
y[v]=yyd[v][i]; |
yd[v]=(Double_t)yyd[v][n]; |
350 |
yb[v]=yyb[v][i]; |
ybd[v]=(Double_t)yyb[v][n]; |
351 |
|
xd[v]=(Double_t)x[v]; |
352 |
|
xbd[v]=(Double_t)xb[v]; |
353 |
} |
} |
354 |
|
|
355 |
// printf("prova3\n"); |
if(xMAX<1000000){ |
356 |
|
xd[maxev-minev-1]=0; |
357 |
|
yd[maxev-minev-1]=0.; |
358 |
|
} |
359 |
|
|
360 |
if((maxev-minev)>1000){ |
if((maxev-minev)>1000){ |
361 |
perc=(count*100)/(maxev-minev); |
perc=(countbad[n]*100)/(maxev-minev); |
362 |
if(perc>10) pad[i][ii]->SetFillColor(2); |
if(perc>10) pad[n][ii]->SetFillColor(2); |
363 |
else pad[i][ii]->SetFillColor(10); |
else pad[n][ii]->SetFillColor(10); |
364 |
|
|
365 |
} |
} |
366 |
else{ |
else{ |
367 |
if(count>=100) pad[i][ii]->SetFillColor(2); |
if(countbad[n]>=100) pad[n][ii]->SetFillColor(2); |
368 |
else pad[i][ii]->SetFillColor(10); |
else pad[n][ii]->SetFillColor(10); |
369 |
} |
} |
370 |
|
|
371 |
oss<<"DSP "<<i+1; |
oss<<"DSP "<<n+1; |
372 |
DataTimeCanv[ii]->cd(); |
DataTimeCanv[ii]->cd(); |
373 |
pad[i][ii]->SetFrameFillColor(10); |
pad[n][ii]->SetFrameFillColor(10); |
374 |
pad[i][ii]->Draw(); |
pad[n][ii]->Draw(); |
375 |
pad[i][ii]->cd(); |
pad[n][ii]->cd(); |
376 |
dataletime[i][ii]= new TGraph((maxev-minev),x,y); |
dataletime[n][ii]= new TGraph((maxev-minev),xd,yd); |
377 |
// printf("\nentries nel graph= %d\n",maxev-minev); |
if(maxev-minev==1) dataletime[n][ii]->GetXaxis()->SetNdivisions(-501); |
378 |
dataletime[i][ii]->SetTitle(oss.str().c_str()); |
dataletime[n][ii]->SetTitle(oss.str().c_str()); |
379 |
dataletime[i][ii]->GetXaxis()->SetTitle("OBT (ms)"); |
dataletime[n][ii]->GetXaxis()->SetTitle("OBT (ms)"); |
380 |
dataletime[i][ii]->GetXaxis()->CenterTitle(); |
dataletime[n][ii]->GetXaxis()->CenterTitle(); |
381 |
// dataletime[i][ii]->GetXaxis()->SetRangeUser(min,max); |
dataletime[n][ii]->GetXaxis()->SetRangeUser(xMIN,xMAX); |
382 |
dataletime[i][ii]->GetXaxis()->SetRangeUser(xMIN,xMAX); |
dataletime[n][ii]->GetYaxis()->SetTitle("datalength (Word 13 bit)"); |
383 |
dataletime[i][ii]->GetYaxis()->SetTitle("datalength (Word 13 bit)"); |
dataletime[n][ii]->GetYaxis()->CenterTitle(); |
384 |
dataletime[i][ii]->GetYaxis()->CenterTitle(); |
if(i==6) dataletime[n][ii]->GetYaxis()->SetRangeUser(0,4500); |
385 |
if(i==6) dataletime[i][ii]->GetYaxis()->SetRangeUser(0,4500); |
else dataletime[n][ii]->GetYaxis()->SetRangeUser(0,4000); |
386 |
else dataletime[i][ii]->GetYaxis()->SetRangeUser(0,3500); |
dataletime[n][ii]->SetMarkerStyle(21); |
387 |
dataletime[i][ii]->SetMarkerStyle(21); |
if((maxev-minev)<50) dataletime[n][ii]->SetMarkerSize(0.5); |
388 |
if((maxev-minev)<50) dataletime[i][ii]->SetMarkerSize(0.5); |
else dataletime[n][ii]->SetMarkerSize(0.1); |
389 |
else dataletime[i][ii]->SetMarkerSize(0.3); |
dataletime[n][ii]->SetMarkerColor(4); |
390 |
dataletime[i][ii]->SetMarkerColor(4); |
dataletime[n][ii]->Draw("ap"); |
|
dataletime[i][ii]->Draw("ap"); |
|
391 |
|
|
|
// printf("prova4\n"); |
|
392 |
|
|
393 |
if((maxev-minev)>1000 && perc>10){ |
if((maxev-minev)>1000 && perc>10){ |
394 |
dataletime1[i][ii]= new TGraph(count,xb,yb); |
dataletime1[n][ii]= new TGraph(countbad[n],xbd,ybd); |
395 |
dataletime1[i][ii]->SetMarkerStyle(21); |
dataletime1[n][ii]->SetMarkerStyle(21); |
396 |
if((maxev-minev)<50) dataletime1[i][ii]->SetMarkerSize(0.5); |
dataletime1[n][ii]->SetMarkerSize(0.1); |
397 |
else dataletime1[i][ii]->SetMarkerSize(0.3); |
dataletime1[n][ii]->SetMarkerColor(2); |
398 |
dataletime1[i][ii]->SetMarkerColor(2); |
dataletime1[n][ii]->Draw("psame"); |
399 |
dataletime1[i][ii]->Draw("psame"); |
} |
400 |
} |
else if((maxev-minev)<1000 && countbad[n]>=100){ |
401 |
else if((maxev-minev)<1000 && count>=100){ |
dataletime1[n][ii]= new TGraph(countbad[n],xbd,ybd); |
402 |
dataletime1[i][ii]= new TGraph(count,xb,yb); |
dataletime1[n][ii]->SetMarkerStyle(21); |
403 |
dataletime1[i][ii]->SetMarkerStyle(21); |
if((maxev-minev)<50) dataletime1[n][ii]->SetMarkerSize(0.5); |
404 |
if((maxev-minev)<50) dataletime1[i][ii]->SetMarkerSize(0.5); |
else dataletime1[n][ii]->SetMarkerSize(0.1); |
405 |
else dataletime1[i][ii]->SetMarkerSize(0.3); |
dataletime1[n][ii]->SetMarkerColor(2); |
406 |
dataletime1[i][ii]->SetMarkerColor(2); |
dataletime1[n][ii]->Draw("psame"); |
|
dataletime1[i][ii]->Draw("psame"); |
|
407 |
} |
} |
408 |
li.SetLineColor(1); |
li.SetLineColor(1); |
409 |
li.SetLineStyle(1); |
li.SetLineStyle(1); |
410 |
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); |
|
411 |
if(i!=6) li.DrawLine(xMIN,750,xMAX,750); |
if(i!=6) li.DrawLine(xMIN,750,xMAX,750); |
412 |
else li.DrawLine(xMIN,1500,xMAX,1500); |
else li.DrawLine(xMIN,1500,xMAX,1500); |
413 |
li.DrawLine(xMIN,3075,xMAX,3075); |
li.DrawLine(xMIN,3075,xMAX,3075); |
415 |
li.SetLineColor(12); |
li.SetLineColor(12); |
416 |
li.SetLineStyle(4); |
li.SetLineStyle(4); |
417 |
li.SetLineWidth(1); |
li.SetLineWidth(1); |
418 |
for(Int_t j=countHOBT;j<neventH;j++){ |
for(Int_t j=hin;j<hfin;j++){ |
419 |
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.); |
420 |
if(i==11) countHOBT=j; |
else li.DrawLine(HOBT[j],0.,HOBT[j],4000.); |
421 |
break; |
if(trk_cal_us[j]==104){ |
422 |
} |
calus<<"D"; |
423 |
|
t2->SetTextColor(6); |
424 |
|
if(i==6) t2->DrawLatex(HOBT[j],4350.,calus.str().c_str()); |
425 |
|
else t2->DrawLatex(HOBT[j],3850.,calus.str().c_str()); |
426 |
|
calus.str(""); |
427 |
|
} |
428 |
else{ |
else{ |
429 |
if( HOBT[j]>xMIN && HOBT[j]<x[maxev-minev-1]){ |
calus<<"O"; |
430 |
if(i==6) li.DrawLine(HOBT[j],0.,HOBT[j],4500.); |
t2->SetTextColor(3); |
431 |
else li.DrawLine(HOBT[j],0.,HOBT[j],3500.); |
if(i==6) t2->DrawLatex(HOBT[j],4350.,calus.str().c_str()); |
432 |
if(trk_cal_us[j]==104){ |
else t2->DrawLatex(HOBT[j],3850.,calus.str().c_str()); |
433 |
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(""); |
|
|
} |
|
|
} |
|
434 |
} |
} |
435 |
} |
} |
436 |
// if(ii==0){ |
for(Int_t j=cin;j<cfin;j++){ |
437 |
// 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,"<"); |
438 |
// 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,"<"); |
|
|
} |
|
|
} |
|
439 |
} |
} |
440 |
|
|
441 |
oss.str(""); |
oss.str(""); |
442 |
DataTimeCanv[ii]->Update(); |
DataTimeCanv[ii]->Update(); |
443 |
} |
} |
444 |
|
|
445 |
minev=maxev; |
minev=maxev; |
|
printf("\ncountrun=%d\n",ii); |
|
446 |
if(maxev==maxevent-1) { |
if(maxev==maxevent-1) { |
447 |
countrun=ii+1; |
countnboot=ii+1; |
448 |
break; |
break; |
449 |
} |
} |
450 |
} |
} |
451 |
printf("... end of packets. \n"); |
printf("... end of packets. \n"); |
452 |
|
|
453 |
//************************************************************************* |
//************************************************************************* |
454 |
// Save output Files |
// Save output Files |
455 |
//************************************************************************* |
//************************************************************************* |
456 |
stringstream nom1,nom2,nom3; |
stringstream nom1,nom2,nom3; |
457 |
|
|
458 |
for(Int_t fl=0;fl<countrun;fl++){ |
for(Int_t fl=0;fl<countnboot;fl++){ |
459 |
if(countrun==1){ |
if(countnboot==1){ |
460 |
nom1<<ffile<<"_FTrkQLook_BASIC."<<outfile.Data(); |
nom1<<ffile<<"_FTrkQLook_BASIC."<<outfile.Data(); |
461 |
DataTimeCanv[fl]->Print(out+nom1.str().c_str()); |
DataTimeCanv[fl]->Print(out+nom1.str().c_str()); |
462 |
nom1.str(""); |
nom1.str(""); |
463 |
} |
} |
464 |
|
|
465 |
if(countrun>=2){ |
if(countnboot>=2){ |
466 |
if(!strcmp(outfile.Data(),"ps") || !strcmp(outfile.Data(),"pdf")){ |
if(!strcmp(outfile.Data(),"ps") || !strcmp(outfile.Data(),"pdf")){ |
467 |
nom1.str(""); |
nom1.str(""); |
468 |
nom2.str(""); |
nom2.str(""); |
471 |
nom2<<ffile<<"_FTrkQLook_BASIC.ps"; |
nom2<<ffile<<"_FTrkQLook_BASIC.ps"; |
472 |
nom3<<ffile<<"_FTrkQLook_BASIC.ps)"; |
nom3<<ffile<<"_FTrkQLook_BASIC.ps)"; |
473 |
if(fl==0) DataTimeCanv[fl]->Print(out+nom1.str().c_str(),"portrait"); |
if(fl==0) DataTimeCanv[fl]->Print(out+nom1.str().c_str(),"portrait"); |
474 |
else if(fl==countrun-1) DataTimeCanv[fl]->Print(out+nom3.str().c_str(),"portrait"); |
else if(fl==countnboot-1) DataTimeCanv[fl]->Print(out+nom3.str().c_str(),"portrait"); |
475 |
else DataTimeCanv[fl]->Print(out+nom2.str().c_str(),"portrait"); |
else DataTimeCanv[fl]->Print(out+nom2.str().c_str(),"portrait"); |
476 |
|
|
477 |
} |
} |
483 |
} |
} |
484 |
} |
} |
485 |
|
|
486 |
if(!strcmp(outfile.Data(),"pdf") && countrun>=2){ |
// |
487 |
|
// Convert ps to pdf if required |
488 |
|
if(!strcmp(outfile.Data(),"pdf") && countnboot>=2){ |
489 |
stringstream com; |
stringstream com; |
490 |
com<<"ps2pdf13 "<<out<<ffile<<"_FTrkQLook_BASIC.ps "<<out<<ffile<<"_FTrkQLook_BASIC.pdf"; |
com<<"ps2pdf13 "<<out<<ffile<<"_FTrkQLook_BASIC.ps "<<out<<ffile<<"_FTrkQLook_BASIC.pdf"; |
491 |
system(com.str().c_str()); |
system(com.str().c_str()); |