1 |
/** |
/** |
2 |
* FTrkQLook_BASIC.cpp |
* FTrkQLook_BASIC.cxx |
3 |
* |
* |
4 |
* autor: D.Fedele |
* autor: D.Fedele |
5 |
* version 2.0 |
* version v1r10 |
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 |
|
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); |
|
|
}; |
|
|
}; |
|
|
|
|
32 |
|
|
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 |
Double_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+=20; |
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 |
//************************************************************************************* |
//************************************************************************************* |
215 |
//*************************************************************************************** |
//*************************************************************************************** |
216 |
|
|
217 |
|
|
218 |
Double_t posy = 0.95; // up y-coord - top pads |
Float_t posy = 0.95; // up y-coord - top pads |
219 |
Double_t hpad = 0; // pad height |
Float_t hpad = 0; // pad height |
220 |
Double_t posx1=0; // left x-coord - pad column |
Float_t posx1=0; // left x-coord - pad column |
221 |
Double_t posx0=0; // x-coord - column division |
Float_t posx0=0; // x-coord - column division |
222 |
Double_t wrel = 0; // relative x size of first sub-column |
Float_t wrel = 0; // relative x size of first sub-column |
223 |
Double_t marg = 0.004; // margin among pads |
Float_t marg = 0.004; // margin among pads |
224 |
|
|
225 |
hpad = (posy-marg*11)/6; |
hpad = (posy-marg*11)/6; |
226 |
wrel = (1-marg*4)/2; |
wrel = (1-marg*4)/2; |
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 |
Double_t x[30000], xb[30000]; |
Long64_t x[MAXSTORAGE], xb[MAXSTORAGE]; |
264 |
Double_t yyd[30000][12],yyb[30000][12]; |
Float_t yyd[MAXSTORAGE][12],yyb[MAXSTORAGE][12]; |
265 |
|
Int_t countbad[12]; |
266 |
|
Float_t perc=0,xMIN=0.,xMAX=0.; |
267 |
|
for (Int_t n=0; n<12 ; n++) |
268 |
|
countbad[n]=0; |
269 |
|
|
270 |
|
// |
271 |
|
// obtain values of the datalenght |
272 |
for (Int_t ev=minev; ev<maxevent; ev++){ |
for (Int_t ev=minev; ev<maxevent; ev++){ |
273 |
tr->GetEntry(ev); |
tr->GetEntry(ev); |
274 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
275 |
|
cod = eh->GetCounter(); |
276 |
|
|
277 |
|
if(ev==minev){ |
278 |
|
if(cod->Get(pctp->CalibTrk1)>0) cin=cod->Get(pctp->CalibTrk1)-1; |
279 |
|
else cin=cod->Get(pctp->CalibTrk1); |
280 |
|
if(cin==cfin-1) cin+=1; |
281 |
|
|
282 |
|
if(cod->Get(pctp->RunHeader)>0) hin=cod->Get(pctp->RunHeader)-1; |
283 |
|
else hin=cod->Get(pctp->RunHeader); |
284 |
|
if(hin==hfin-1) hin+=1; |
285 |
|
} |
286 |
|
|
287 |
if(ev==maxevent-1) maxev=maxevent-1; |
if(ev==maxevent-1) maxev=maxevent-1; |
288 |
// printf("prova00\n"); |
|
289 |
if((ph->GetOrbitalTime()<x[ev-minev-1]&&ev-minev!=0) || ev-minev>30000){ |
if((ph->GetOrbitalTime()<x[ev-minev-1] && ev-minev!=0) || ev-minev==MAXSTORAGE){ |
290 |
maxev=ev; |
maxev=ev; |
|
// printf("prova12\n"); |
|
291 |
break; |
break; |
292 |
} |
} |
293 |
else{ |
else{ |
294 |
|
cfin=cod->Get(pctp->CalibTrk1); |
295 |
|
hfin=cod->Get(pctp->RunHeader); |
296 |
x[(ev-minev)]= ph->GetOrbitalTime(); |
x[(ev-minev)]= ph->GetOrbitalTime(); |
297 |
i=0; |
i=0; |
298 |
|
|
299 |
// printf("prova0 %d\n ",ev); |
for (Int_t n=0; n<12 ; n++){ |
300 |
for (Int_t n=0; n<12 ; n++){ |
i=te->DSPnumber[n]-1; |
301 |
perc=0; |
if(i>=0){ |
302 |
count=0; |
if(i<12){ |
303 |
yyb[count][i]=0; |
yyb[countbad[i]][i]=0; |
304 |
xb[count]= 0; |
xb[countbad[i]]= 0; |
305 |
|
|
306 |
i=te->DSPnumber[n]-1; |
yyd[(ev-minev)][i]=te->DATAlength[n]; |
307 |
|
if(i==6){ |
308 |
yyd[(ev-minev)][i]=te->DATAlength[n]; |
if(yyd[(ev-minev)][i]>1500){ |
309 |
if(i==6){ |
if(yyd[(ev-minev)][i]<3075){ |
310 |
if(yyd[(ev-minev)][i]>1500){ |
yyb[countbad[i]][i]= yyd[(ev-minev)][i]; |
311 |
if(yyd[(ev-minev)][i]<3075){ |
xb[countbad[i]]= x[(ev-minev)]; |
312 |
yyb[count][i]= yyd[(ev-minev)][i]; |
countbad[i]+=1; |
313 |
xb[count]= x[(ev-minev)]; |
} |
314 |
count++; |
} |
315 |
} |
} |
316 |
} |
else{ |
317 |
} |
if(yyd[(ev-minev)][i]>750){ |
318 |
else{ |
if(yyd[(ev-minev)][i]<3075){ |
319 |
if(yyd[(ev-minev)][i]>750){ |
yyb[countbad[i]][i]= yyd[(ev-minev)][i]; |
320 |
if(yyd[(ev-minev)][i]<3075){ |
xb[countbad[i]]= x[(ev-minev)]; |
321 |
yyb[count][i]= yyd[(ev-minev)][i]; |
countbad[i]+=1; |
322 |
xb[count]= x[(ev-minev)]; |
} |
323 |
count++; |
} |
324 |
} |
} |
325 |
} |
} |
326 |
} |
} |
327 |
} |
} |
328 |
} |
} |
329 |
} |
} |
|
|
|
|
// 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; |
|
|
} |
|
330 |
|
|
331 |
|
// |
332 |
|
// define limit for the Xaxis of the graphs |
333 |
|
|
334 |
|
xMAX=x[maxev-minev-1]+(x[maxev-minev-1]-x[0])/10; |
335 |
|
if(xMAX>1000000) xMIN=x[0]-(x[maxev-minev-1]-x[0])/10; |
336 |
|
if(xMAX<1000000 || xMIN<0) xMIN=0.; |
337 |
|
|
338 |
|
|
339 |
for (Int_t i=0; i<12 ; i++){ |
// |
340 |
|
// Draw Histos |
341 |
|
for (Int_t n=0; n<12 ; n++){ |
342 |
|
|
343 |
Double_t y[maxev-minev],yb[maxev-minev]; |
Double_t yd[maxev-minev],ybd[maxev-minev]; |
344 |
|
Double_t xd[maxev-minev],xbd[maxev-minev]; |
345 |
|
|
346 |
for(Int_t v=0;v<maxev-minev;v++){ |
for(Int_t v=0;v<maxev-minev;v++){ |
347 |
y[v]=yyd[v][i]; |
yd[v]=(Double_t)yyd[v][n]; |
348 |
yb[v]=yyb[v][i]; |
ybd[v]=(Double_t)yyb[v][n]; |
349 |
|
xd[v]=(Double_t)x[v]; |
350 |
|
xbd[v]=(Double_t)xb[v]; |
351 |
} |
} |
352 |
|
|
353 |
// printf("prova3\n"); |
if(xMAX<1000000){ |
354 |
|
xd[maxev-minev-1]=0; |
355 |
|
yd[maxev-minev-1]=0.; |
356 |
|
} |
357 |
|
|
358 |
if((maxev-minev)>1000){ |
if((maxev-minev)>1000){ |
359 |
perc=(count*100)/(maxev-minev); |
perc=(countbad[n]*100)/(maxev-minev); |
360 |
if(perc>10) pad[i][ii]->SetFillColor(2); |
if(perc>10) pad[n][ii]->SetFillColor(2); |
361 |
else pad[i][ii]->SetFillColor(10); |
else pad[n][ii]->SetFillColor(10); |
362 |
|
|
363 |
} |
} |
364 |
else{ |
else{ |
365 |
if(count>=100) pad[i][ii]->SetFillColor(2); |
if(countbad[n]>=100) pad[n][ii]->SetFillColor(2); |
366 |
else pad[i][ii]->SetFillColor(10); |
else pad[n][ii]->SetFillColor(10); |
367 |
} |
} |
368 |
|
|
369 |
oss<<"DSP "<<i+1; |
oss<<"DSP "<<n+1; |
370 |
DataTimeCanv[ii]->cd(); |
DataTimeCanv[ii]->cd(); |
371 |
pad[i][ii]->SetFrameFillColor(10); |
pad[n][ii]->SetFrameFillColor(10); |
372 |
pad[i][ii]->Draw(); |
pad[n][ii]->Draw(); |
373 |
pad[i][ii]->cd(); |
pad[n][ii]->cd(); |
374 |
dataletime[i][ii]= new TGraph((maxev-minev),x,y); |
dataletime[n][ii]= new TGraph((maxev-minev),xd,yd); |
375 |
// printf("\nentries nel graph= %d\n",maxev-minev); |
if(maxev-minev==1) dataletime[n][ii]->GetXaxis()->SetNdivisions(-501); |
376 |
dataletime[i][ii]->SetTitle(oss.str().c_str()); |
dataletime[n][ii]->SetTitle(oss.str().c_str()); |
377 |
dataletime[i][ii]->GetXaxis()->SetTitle("OBT (ms)"); |
dataletime[n][ii]->GetXaxis()->SetTitle("OBT (ms)"); |
378 |
dataletime[i][ii]->GetXaxis()->CenterTitle(); |
dataletime[n][ii]->GetXaxis()->CenterTitle(); |
379 |
// dataletime[i][ii]->GetXaxis()->SetRangeUser(min,max); |
dataletime[n][ii]->GetXaxis()->SetRangeUser(xMIN,xMAX); |
380 |
dataletime[i][ii]->GetXaxis()->SetRangeUser(xMIN,xMAX); |
dataletime[n][ii]->GetYaxis()->SetTitle("datalength (Word 13 bit)"); |
381 |
dataletime[i][ii]->GetYaxis()->SetTitle("datalength (Word 13 bit)"); |
dataletime[n][ii]->GetYaxis()->CenterTitle(); |
382 |
dataletime[i][ii]->GetYaxis()->CenterTitle(); |
if(i==6) dataletime[n][ii]->GetYaxis()->SetRangeUser(0,4500); |
383 |
if(i==6) dataletime[i][ii]->GetYaxis()->SetRangeUser(0,4500); |
else dataletime[n][ii]->GetYaxis()->SetRangeUser(0,4000); |
384 |
else dataletime[i][ii]->GetYaxis()->SetRangeUser(0,3500); |
dataletime[n][ii]->SetMarkerStyle(21); |
385 |
dataletime[i][ii]->SetMarkerStyle(21); |
if((maxev-minev)<50) dataletime[n][ii]->SetMarkerSize(0.5); |
386 |
if((maxev-minev)<50) dataletime[i][ii]->SetMarkerSize(0.5); |
else dataletime[n][ii]->SetMarkerSize(0.1); |
387 |
else dataletime[i][ii]->SetMarkerSize(0.3); |
dataletime[n][ii]->SetMarkerColor(4); |
388 |
dataletime[i][ii]->SetMarkerColor(4); |
dataletime[n][ii]->Draw("ap"); |
|
dataletime[i][ii]->Draw("ap"); |
|
389 |
|
|
|
// printf("prova4\n"); |
|
390 |
|
|
391 |
if((maxev-minev)>1000 && perc>10){ |
if((maxev-minev)>1000 && perc>10){ |
392 |
dataletime1[i][ii]= new TGraph(count,xb,yb); |
dataletime1[n][ii]= new TGraph(countbad[n],xbd,ybd); |
393 |
dataletime1[i][ii]->SetMarkerStyle(21); |
dataletime1[n][ii]->SetMarkerStyle(21); |
394 |
if((maxev-minev)<50) dataletime1[i][ii]->SetMarkerSize(0.5); |
dataletime1[n][ii]->SetMarkerSize(0.1); |
395 |
else dataletime1[i][ii]->SetMarkerSize(0.3); |
dataletime1[n][ii]->SetMarkerColor(2); |
396 |
dataletime1[i][ii]->SetMarkerColor(2); |
dataletime1[n][ii]->Draw("psame"); |
397 |
dataletime1[i][ii]->Draw("psame"); |
} |
398 |
} |
else if((maxev-minev)<1000 && countbad[n]>=100){ |
399 |
else if((maxev-minev)<1000 && count>=100){ |
dataletime1[n][ii]= new TGraph(countbad[n],xbd,ybd); |
400 |
dataletime1[i][ii]= new TGraph(count,xb,yb); |
dataletime1[n][ii]->SetMarkerStyle(21); |
401 |
dataletime1[i][ii]->SetMarkerStyle(21); |
if((maxev-minev)<50) dataletime1[n][ii]->SetMarkerSize(0.5); |
402 |
if((maxev-minev)<50) dataletime1[i][ii]->SetMarkerSize(0.5); |
else dataletime1[n][ii]->SetMarkerSize(0.1); |
403 |
else dataletime1[i][ii]->SetMarkerSize(0.3); |
dataletime1[n][ii]->SetMarkerColor(2); |
404 |
dataletime1[i][ii]->SetMarkerColor(2); |
dataletime1[n][ii]->Draw("psame"); |
|
dataletime1[i][ii]->Draw("psame"); |
|
405 |
} |
} |
406 |
li.SetLineColor(1); |
li.SetLineColor(1); |
407 |
li.SetLineStyle(1); |
li.SetLineStyle(1); |
408 |
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); |
|
409 |
if(i!=6) li.DrawLine(xMIN,750,xMAX,750); |
if(i!=6) li.DrawLine(xMIN,750,xMAX,750); |
410 |
else li.DrawLine(xMIN,1500,xMAX,1500); |
else li.DrawLine(xMIN,1500,xMAX,1500); |
411 |
li.DrawLine(xMIN,3075,xMAX,3075); |
li.DrawLine(xMIN,3075,xMAX,3075); |
413 |
li.SetLineColor(12); |
li.SetLineColor(12); |
414 |
li.SetLineStyle(4); |
li.SetLineStyle(4); |
415 |
li.SetLineWidth(1); |
li.SetLineWidth(1); |
416 |
for(Int_t j=countHOBT;j<neventH;j++){ |
for(Int_t j=hin;j<hfin;j++){ |
417 |
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.); |
418 |
if(i==11) countHOBT=j; |
else li.DrawLine(HOBT[j],0.,HOBT[j],4000.); |
419 |
break; |
if(trk_cal_us[j]==104){ |
420 |
} |
calus<<"D"; |
421 |
|
t2->SetTextColor(6); |
422 |
|
if(i==6) t2->DrawLatex(HOBT[j],4350.,calus.str().c_str()); |
423 |
|
else t2->DrawLatex(HOBT[j],3850.,calus.str().c_str()); |
424 |
|
calus.str(""); |
425 |
|
} |
426 |
else{ |
else{ |
427 |
if( HOBT[j]>xMIN && HOBT[j]<x[maxev-minev-1]){ |
calus<<"O"; |
428 |
if(i==6) li.DrawLine(HOBT[j],0.,HOBT[j],4500.); |
t2->SetTextColor(3); |
429 |
else li.DrawLine(HOBT[j],0.,HOBT[j],3500.); |
if(i==6) t2->DrawLatex(HOBT[j],4350.,calus.str().c_str()); |
430 |
if(trk_cal_us[j]==104){ |
else t2->DrawLatex(HOBT[j],3850.,calus.str().c_str()); |
431 |
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(""); |
|
|
} |
|
|
} |
|
432 |
} |
} |
433 |
} |
} |
434 |
// if(ii==0){ |
for(Int_t j=cin;j<cfin;j++){ |
435 |
// 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,"<"); |
436 |
// 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,"<"); |
|
|
} |
|
|
} |
|
437 |
} |
} |
438 |
|
|
439 |
oss.str(""); |
oss.str(""); |
440 |
DataTimeCanv[ii]->Update(); |
DataTimeCanv[ii]->Update(); |
441 |
} |
} |
442 |
|
|
443 |
minev=maxev; |
minev=maxev; |
|
printf("\ncountrun=%d\n",ii); |
|
444 |
if(maxev==maxevent-1) { |
if(maxev==maxevent-1) { |
445 |
countrun=ii+1; |
countnboot=ii+1; |
446 |
break; |
break; |
447 |
} |
} |
448 |
} |
} |
449 |
printf("... end of packets. \n"); |
printf("... end of packets. \n"); |
450 |
|
|
451 |
//************************************************************************* |
//************************************************************************* |
452 |
// Save output Files |
// Save output Files |
453 |
//************************************************************************* |
//************************************************************************* |
454 |
stringstream nom1,nom2,nom3; |
stringstream nom1,nom2,nom3; |
455 |
|
|
456 |
for(Int_t fl=0;fl<countrun;fl++){ |
for(Int_t fl=0;fl<countnboot;fl++){ |
457 |
if(countrun==1){ |
if(countnboot==1){ |
458 |
nom1<<ffile<<"_FTrkQLook_BASIC."<<outfile.Data(); |
nom1<<ffile<<"_FTrkQLook_BASIC."<<outfile.Data(); |
459 |
DataTimeCanv[fl]->Print(out+nom1.str().c_str()); |
DataTimeCanv[fl]->Print(out+nom1.str().c_str()); |
460 |
nom1.str(""); |
nom1.str(""); |
461 |
} |
} |
462 |
|
|
463 |
if(countrun>=2){ |
if(countnboot>=2){ |
464 |
if(!strcmp(outfile.Data(),"ps") || !strcmp(outfile.Data(),"pdf")){ |
if(!strcmp(outfile.Data(),"ps") || !strcmp(outfile.Data(),"pdf")){ |
465 |
nom1.str(""); |
nom1.str(""); |
466 |
nom2.str(""); |
nom2.str(""); |
469 |
nom2<<ffile<<"_FTrkQLook_BASIC.ps"; |
nom2<<ffile<<"_FTrkQLook_BASIC.ps"; |
470 |
nom3<<ffile<<"_FTrkQLook_BASIC.ps)"; |
nom3<<ffile<<"_FTrkQLook_BASIC.ps)"; |
471 |
if(fl==0) DataTimeCanv[fl]->Print(out+nom1.str().c_str(),"portrait"); |
if(fl==0) DataTimeCanv[fl]->Print(out+nom1.str().c_str(),"portrait"); |
472 |
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"); |
473 |
else DataTimeCanv[fl]->Print(out+nom2.str().c_str(),"portrait"); |
else DataTimeCanv[fl]->Print(out+nom2.str().c_str(),"portrait"); |
474 |
|
|
475 |
} |
} |
481 |
} |
} |
482 |
} |
} |
483 |
|
|
484 |
if(!strcmp(outfile.Data(),"pdf") && countrun>=2){ |
// |
485 |
|
// Convert ps to pdf if required |
486 |
|
if(!strcmp(outfile.Data(),"pdf") && countnboot>=2){ |
487 |
stringstream com; |
stringstream com; |
488 |
com<<"ps2pdf13 "<<out<<ffile<<"_FTrkQLook_BASIC.ps "<<out<<ffile<<"_FTrkQLook_BASIC.pdf"; |
com<<"ps2pdf13 "<<out<<ffile<<"_FTrkQLook_BASIC.ps "<<out<<ffile<<"_FTrkQLook_BASIC.pdf"; |
489 |
system(com.str().c_str()); |
system(com.str().c_str()); |