1 |
/** |
2 |
* FTrkCalibQLook_BASIC.cxx |
3 |
* |
4 |
* autor: D.Fedele |
5 |
* version v1r11 |
6 |
* Parameters: |
7 |
* file - the data file to analyze |
8 |
* fromevent - first event to analyze |
9 |
* toevent - last event to analyze |
10 |
* outdir - total path of output file |
11 |
* outfile - extension of output file (pdf,ps,gif,jpg) |
12 |
* |
13 |
*/ |
14 |
// |
15 |
#include <TLatex.h> |
16 |
#include <TCanvas.h> |
17 |
#include <TGraph.h> |
18 |
#include <TFile.h> |
19 |
#include <TTree.h> |
20 |
#include <TStyle.h> |
21 |
#include <TString.h> |
22 |
// |
23 |
#include <PscuHeader.h> |
24 |
#include <EventHeader.h> |
25 |
#include <CalibTrk1Event.h> |
26 |
#include <CalibTrk2Event.h> |
27 |
// |
28 |
|
29 |
typedef struct caltrk_def{ |
30 |
Int_t good0[2]; |
31 |
Int_t daqmode[12]; |
32 |
Int_t dspnum[12]; |
33 |
Int_t calibnum[12]; |
34 |
Int_t ncalev[12]; |
35 |
Int_t calfl[12]; |
36 |
Int_t ped1[12]; |
37 |
Int_t ped2[12]; |
38 |
Int_t ped3[12]; |
39 |
Int_t sig1[12]; |
40 |
Int_t sig2[12]; |
41 |
Int_t sig3[12]; |
42 |
Int_t nbad1[12]; |
43 |
Int_t nbad2[12]; |
44 |
Int_t nbad3[12]; |
45 |
Float_t dspped[12][3702]; |
46 |
Float_t dspsig[12][3702]; |
47 |
Float_t dspbad[12][3702]; |
48 |
Int_t crc_c[12][3]; |
49 |
Int_t crc_hc[12]; |
50 |
}; |
51 |
|
52 |
|
53 |
void FTrkCalibQLook_BASIC(TString file,Int_t fromevent,Int_t toevent,TString outdir,TString outfile) |
54 |
{ |
55 |
// |
56 |
// obtain information about the data file and select the output dir |
57 |
Int_t dwpos = file.Last('/'); |
58 |
Int_t dwpos1 = file.Last('.'); |
59 |
TString base,ffile ; |
60 |
ffile=file(dwpos+1,dwpos1-(dwpos+1)); |
61 |
if(dwpos>0) base=file(0,dwpos); |
62 |
|
63 |
TString out; |
64 |
if(outdir.Length()==0){ |
65 |
out = base; |
66 |
}else{ |
67 |
out = outdir; |
68 |
}; |
69 |
if(out.Last('/')+1<out.Length()) out+="/"; |
70 |
|
71 |
// |
72 |
// inizialise the variables and open the file |
73 |
struct caltrk_def ctrk; |
74 |
Int_t nevents=0; |
75 |
Int_t minevent = 0; |
76 |
Int_t maxevent = 0; |
77 |
ULong64_t OBT[2]; |
78 |
|
79 |
OBT[0]=0; |
80 |
OBT[1]=0; |
81 |
ctrk.good0[0]=0; |
82 |
ctrk.good0[1]=0; |
83 |
for(Int_t i=0;i<12;i++){ |
84 |
ctrk.daqmode[i]=0; |
85 |
ctrk.dspnum[i]=0; |
86 |
ctrk.calibnum[i]=0; |
87 |
ctrk.ncalev[i]=0; |
88 |
ctrk.calfl[i]=0; |
89 |
ctrk.ped1[i]=0; |
90 |
ctrk.ped2[i]=0; |
91 |
ctrk.ped3[i]=0; |
92 |
ctrk.sig1[i]=0; |
93 |
ctrk.sig2[i]=0; |
94 |
ctrk.sig3[i]=0; |
95 |
ctrk.nbad1[i]=0; |
96 |
ctrk.nbad2[i]=0; |
97 |
ctrk.nbad3[i]=0; |
98 |
ctrk.crc_hc[i]=0; |
99 |
ctrk.crc_c[i][0]=0; |
100 |
ctrk.crc_c[i][1]=0; |
101 |
ctrk.crc_c[i][2]=0; |
102 |
for(Int_t iii=0;iii<3072;iii++){ |
103 |
ctrk.dspped[i][iii]=0; |
104 |
ctrk.dspsig[i][iii]=0; |
105 |
ctrk.dspbad[i][iii]=0; |
106 |
} |
107 |
} |
108 |
|
109 |
pamela::EventHeader *eh1=0,*eh2=0; |
110 |
pamela::PscuHeader *ph1=0,*ph2=0; |
111 |
pamela::CalibTrk1Event *trk1 = 0; |
112 |
pamela::CalibTrk2Event *trk2 = 0; |
113 |
|
114 |
TFile *datafile = new TFile(file); |
115 |
if ( !datafile ){ |
116 |
printf("No data file, exiting...\n"); |
117 |
return; |
118 |
}; |
119 |
TTree *otr1,*otr2; |
120 |
|
121 |
otr1 = (TTree*)datafile->Get("CalibTrk1"); |
122 |
otr1->SetBranchAddress("CalibTrk1", &trk1); |
123 |
otr1->SetBranchAddress("Header",&eh1); |
124 |
otr2 = (TTree*)datafile->Get("CalibTrk2"); |
125 |
otr2->SetBranchAddress("CalibTrk2", &trk2); |
126 |
otr2->SetBranchAddress("Header",&eh2); |
127 |
|
128 |
|
129 |
if(otr1->GetEntries()==otr2->GetEntries()) |
130 |
nevents = otr1->GetEntries(); |
131 |
else{ |
132 |
printf("WARNING: CalibTrk1 entries is different from CalibTrk2 entries"); |
133 |
return;} |
134 |
|
135 |
if (nevents<=0) { |
136 |
datafile->Close(); |
137 |
printf("No calibration packets found, exiting...\n"); |
138 |
return; |
139 |
}; |
140 |
printf("Number of calibration packets: %i\n",nevents); |
141 |
|
142 |
if ( fromevent > toevent && toevent ){ |
143 |
printf("It must be fromevent < toevent \n"); |
144 |
return; |
145 |
}; |
146 |
|
147 |
if ( fromevent > nevents || fromevent < 0 ) { |
148 |
printf("You can choose fromevent between 0 (all) and %i \n",nevents); |
149 |
return; |
150 |
}; |
151 |
|
152 |
if ( toevent > nevents || toevent < 0 ) { |
153 |
printf("You can choose toevent between 0 (all) and %i \n",nevents); |
154 |
return; |
155 |
}; |
156 |
if ( fromevent == 0 ) { |
157 |
minevent = 0; |
158 |
maxevent = nevents; |
159 |
} else { |
160 |
minevent = fromevent - 1; |
161 |
if ( toevent > 0 ){ |
162 |
maxevent = toevent; |
163 |
} else if (toevent > nevents) { |
164 |
maxevent = nevents; |
165 |
} else { |
166 |
maxevent = nevents; |
167 |
}; |
168 |
}; |
169 |
|
170 |
// |
171 |
// other variables definitions |
172 |
stringstream fromfile,rep,tit; |
173 |
fromfile<<"FTrkCalibQLook_BASIC File: "<<ffile; |
174 |
|
175 |
gStyle->SetLabelSize(0.08,"x"); |
176 |
gStyle->SetLabelSize(0.08,"y"); |
177 |
gStyle->SetFillColor(0); |
178 |
gStyle->SetTitleFillColor(0); |
179 |
gStyle->SetTitleFontSize(0.1); |
180 |
gStyle->SetTitleOffset(0.8,"y"); |
181 |
gStyle->SetTitleOffset(1.,"x"); |
182 |
gStyle->SetTitleSize(0.06,"y"); |
183 |
gStyle->SetTitleSize(0.06,"x"); |
184 |
gStyle->SetOptStat(0); |
185 |
|
186 |
TLatex *tzz=new TLatex(); |
187 |
tzz->SetTextFont(32); |
188 |
tzz->SetTextColor(1); |
189 |
tzz->SetTextAlign(12); |
190 |
tzz->SetTextSize(0.02); |
191 |
|
192 |
Int_t canvasx=900; |
193 |
Int_t canvasy=1200; |
194 |
|
195 |
Int_t alarm=0; |
196 |
Float_t pedav[12][12],pedavtemp[12][12],sigav[12][12],sigavtemp[12][12]; |
197 |
Int_t flpedav[12][12],flsigav[12][12]; |
198 |
Float_t siglimsup[12][12],sigliminf[12][12],pedlimsup[12][12],pedliminf[12][12]; |
199 |
|
200 |
// |
201 |
// inizialize the limits for simga and pedestall |
202 |
for(Int_t i=0;i<12;i++){ |
203 |
for(Int_t ii=0;ii<12;ii++){ |
204 |
siglimsup[i][ii]=30.; |
205 |
sigliminf[i][ii]=1.5; |
206 |
if(!(i%2)){ |
207 |
pedlimsup[i][ii]=3700.; |
208 |
pedliminf[i][ii]=1700.; |
209 |
} |
210 |
else{ |
211 |
pedlimsup[i][ii]=2200.; |
212 |
pedliminf[i][ii]=200.; |
213 |
} |
214 |
} |
215 |
} |
216 |
|
217 |
// |
218 |
// count of possible alarm to set the number of output pages |
219 |
alarm+=(maxevent-minevent)/9 +1; |
220 |
for (Int_t i = minevent; i < maxevent; i++){ |
221 |
otr1->GetEntry(i); |
222 |
otr2->GetEntry(i); |
223 |
for(Int_t m=0;m<6;m++){ |
224 |
for(Int_t mm=0;mm<3;mm++){ |
225 |
if(trk1->crc_cal[m][mm]!=0) alarm+=1; |
226 |
if(trk2->crc_cal[m][mm]!=0 ) alarm+=1; |
227 |
} |
228 |
if(trk1->crc_hcal[m]!=0 ) alarm+=1; |
229 |
if(trk1->cal_flag[m]!=0 ) alarm+=1; |
230 |
if(trk2->crc_hcal[m]!=0) alarm+=1; |
231 |
if(trk2->cal_flag[m]!=0) alarm+=1; |
232 |
} |
233 |
} |
234 |
const Int_t cnum=alarm/30 + 100; |
235 |
Int_t flcanvas=1; |
236 |
Float_t spacep=1.5,space[cnum]; |
237 |
TCanvas *c[cnum]; |
238 |
// |
239 |
// create output canvas |
240 |
for(Int_t i=0;i<cnum;i++){ |
241 |
space[i]=96.0; |
242 |
rep.str(""); |
243 |
tit.str(""); |
244 |
tit<<"c"<<i; |
245 |
rep<<"FTrkCalibQLook_BASIC_pag"<<i+1; |
246 |
c[i]=new TCanvas(tit.str().c_str(),rep.str().c_str(),canvasx,canvasy); |
247 |
c[i]->Range(0,0,100,100); |
248 |
c[i]->SetFillColor(10); |
249 |
tzz->DrawLatex(1,98.5,fromfile.str().c_str()); |
250 |
rep.str(""); |
251 |
rep<<"CALIBRATION REPORT pag"<<i+1; |
252 |
tzz->DrawLatex(70,98.5,rep.str().c_str()); |
253 |
rep.str(""); |
254 |
} |
255 |
|
256 |
|
257 |
//********************************************************************** |
258 |
// |
259 |
// LOOP OVER EVENTS |
260 |
// |
261 |
//********************************************************************** |
262 |
|
263 |
Int_t wc=0; |
264 |
printf("\n Scan of calibration packets from %i to %i ... \n",minevent+1,maxevent); |
265 |
for (Int_t i = minevent; i < maxevent; i++){ |
266 |
|
267 |
otr1->GetEntry(i); |
268 |
otr2->GetEntry(i); |
269 |
|
270 |
ctrk.good0[0]=trk1->good0; |
271 |
ctrk.good0[1]=trk2->good0; |
272 |
for (Int_t m = 0; m < 6; m++){ |
273 |
ph1 = eh1->GetPscuHeader(); |
274 |
OBT[0]= ph1->GetOrbitalTime(); |
275 |
if(trk1->DSPnumber[m]>0){ |
276 |
if(trk1->DSPnumber[m]<13){ |
277 |
ctrk.daqmode[trk1->DSPnumber[m]-1]=trk1->DAQmode[m]; |
278 |
ctrk.dspnum[trk1->DSPnumber[m]-1]=trk1->DSPnumber[m]; |
279 |
ctrk.calibnum[trk1->DSPnumber[m]-1]=trk1->calibnumber[m]; |
280 |
ctrk.ncalev[trk1->DSPnumber[m]-1]=trk1->ncalib_event[m]; |
281 |
ctrk.ped1[trk1->DSPnumber[m]-1]=trk1->ped_l1[m]; |
282 |
ctrk.ped2[trk1->DSPnumber[m]-1]=trk1->ped_l2[m]; |
283 |
ctrk.ped3[trk1->DSPnumber[m]-1]=trk1->ped_l3[m]; |
284 |
ctrk.sig1[trk1->DSPnumber[m]-1]=trk1->sig_l1[m]; |
285 |
ctrk.sig2[trk1->DSPnumber[m]-1]=trk1->sig_l2[m]; |
286 |
ctrk.sig3[trk1->DSPnumber[m]-1]=trk1->sig_l3[m]; |
287 |
ctrk.nbad1[trk1->DSPnumber[m]-1]=trk1->nbad_l1[m]; |
288 |
ctrk.nbad2[trk1->DSPnumber[m]-1]=trk1->nbad_l2[m]; |
289 |
ctrk.nbad3[trk1->DSPnumber[m]-1]=trk1->nbad_l3[m]; |
290 |
ctrk.calfl[trk1->DSPnumber[m]-1]=trk1->cal_flag[m]; |
291 |
ctrk.crc_c[trk1->DSPnumber[m]-1][0]=trk1->crc_cal[m][0]; |
292 |
ctrk.crc_c[trk1->DSPnumber[m]-1][1]=trk1->crc_cal[m][1]; |
293 |
ctrk.crc_c[trk1->DSPnumber[m]-1][2]=trk1->crc_cal[m][2]; |
294 |
ctrk.crc_hc[trk1->DSPnumber[m]-1]=trk1->crc_hcal[m]; |
295 |
for (Int_t j = 0; j < 3072; j++){ |
296 |
ctrk.dspped[trk1->DSPnumber[m]-1][j]=trk1->DSPped_par[m][j]; |
297 |
ctrk.dspsig[trk1->DSPnumber[m]-1][j]=trk1->DSPsig_par[m][j]; |
298 |
ctrk.dspbad[trk1->DSPnumber[m]-1][j]=trk1->DSPbad_par[m][j]; |
299 |
} |
300 |
} |
301 |
} |
302 |
ph2 = eh2->GetPscuHeader(); |
303 |
OBT[1]= ph2->GetOrbitalTime(); |
304 |
if(trk2->DSPnumber[m]>0){ |
305 |
if(trk2->DSPnumber[m]<13){ |
306 |
ctrk.daqmode[trk2->DSPnumber[m]-1]=trk2->DAQmode[m]; |
307 |
ctrk.dspnum[trk2->DSPnumber[m]-1]=trk2->DSPnumber[m]; |
308 |
ctrk.calibnum[trk2->DSPnumber[m]-1]=trk2->calibnumber[m]; |
309 |
ctrk.ncalev[trk2->DSPnumber[m]-1]=trk2->ncalib_event[m]; |
310 |
ctrk.ped1[trk2->DSPnumber[m]-1]=trk2->ped_l1[m]; |
311 |
ctrk.ped2[trk2->DSPnumber[m]-1]=trk2->ped_l2[m]; |
312 |
ctrk.ped3[trk2->DSPnumber[m]-1]=trk2->ped_l3[m]; |
313 |
ctrk.sig1[trk2->DSPnumber[m]-1]=trk2->sig_l1[m]; |
314 |
ctrk.sig2[trk2->DSPnumber[m]-1]=trk2->sig_l2[m]; |
315 |
ctrk.sig3[trk2->DSPnumber[m]-1]=trk2->sig_l3[m]; |
316 |
ctrk.nbad1[trk2->DSPnumber[m]-1]=trk2->nbad_l1[m]; |
317 |
ctrk.nbad2[trk2->DSPnumber[m]-1]=trk2->nbad_l2[m]; |
318 |
ctrk.nbad3[trk2->DSPnumber[m]-1]=trk2->nbad_l3[m]; |
319 |
ctrk.calfl[trk2->DSPnumber[m]-1]=trk2->cal_flag[m]; |
320 |
ctrk.crc_c[trk1->DSPnumber[m]-1][0]=trk2->crc_cal[m][0]; |
321 |
ctrk.crc_c[trk1->DSPnumber[m]-1][1]=trk2->crc_cal[m][1]; |
322 |
ctrk.crc_c[trk1->DSPnumber[m]-1][2]=trk2->crc_cal[m][2]; |
323 |
ctrk.crc_hc[trk1->DSPnumber[m]-1]=trk2->crc_hcal[m]; |
324 |
for (Int_t j = 0; j < 3072; j++){ |
325 |
ctrk.dspped[trk2->DSPnumber[m]-1][j]=trk2->DSPped_par[m][j]; |
326 |
ctrk.dspsig[trk2->DSPnumber[m]-1][j]=trk2->DSPsig_par[m][j]; |
327 |
ctrk.dspbad[trk2->DSPnumber[m]-1][j]=trk2->DSPbad_par[m][j]; |
328 |
} |
329 |
} |
330 |
} |
331 |
} |
332 |
|
333 |
for(Int_t n = 0; n<12; n++){ |
334 |
for(Int_t nm = 0; nm<12; nm++){ |
335 |
pedav[n][nm]=0; |
336 |
pedavtemp[n][nm]=0; |
337 |
sigav[n][nm]=0; |
338 |
sigavtemp[n][nm]=0; |
339 |
flpedav[n][nm]=0; |
340 |
flsigav[n][nm]=0; |
341 |
} |
342 |
} |
343 |
|
344 |
Int_t nn=0,ok=0; |
345 |
|
346 |
// |
347 |
// write warning if it occur |
348 |
for(Int_t n = 0; n<12; n++){ |
349 |
|
350 |
if(ctrk.dspnum[n]==0) |
351 |
continue; |
352 |
nn = ctrk.dspnum[n]-1; |
353 |
|
354 |
for(Int_t iii=0;iii<3;iii++){ |
355 |
if(ctrk.crc_c[nn][iii]!=0){ |
356 |
ok=1; |
357 |
if(space[wc]<=3){ |
358 |
wc+=1; |
359 |
flcanvas+=1; |
360 |
} |
361 |
c[wc]->cd(); |
362 |
tzz->SetTextFont(40); |
363 |
tzz->SetTextSize(0.02); |
364 |
tzz->SetTextAlign(13); |
365 |
tzz->SetTextColor(2); |
366 |
rep<<"***************************************************************************************************************************"; |
367 |
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
368 |
rep.str(""); |
369 |
space[wc]-=spacep; |
370 |
rep<<" ERROR >>> CALIBRATION pkt "<<i+1<<" -->CalibTrk"<<(nn+1)%2+1<<" at OBT: "<<OBT[(nn+1)%2]<<" --> crc_cal["<<nn+1<<"]["<<iii+1<<"]= "<<ctrk.crc_c[nn][iii]; |
371 |
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
372 |
rep.str(""); |
373 |
space[wc]-=spacep; |
374 |
} |
375 |
} |
376 |
|
377 |
if(ctrk.crc_hc[nn]!=0){ |
378 |
ok=1; |
379 |
if(space[wc]<=3){ |
380 |
wc+=1; |
381 |
flcanvas+=1; |
382 |
} |
383 |
c[wc]->cd(); |
384 |
tzz->SetTextFont(40); |
385 |
tzz->SetTextSize(0.02); |
386 |
tzz->SetTextAlign(13); |
387 |
tzz->SetTextColor(2); |
388 |
rep<<"***************************************************************************************************************************"; |
389 |
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
390 |
rep.str(""); |
391 |
space[wc]-=spacep; |
392 |
rep<<" ERROR >>> CALIBRATION pkt "<<i+1<<" -->CalibTrk"<<(nn+1)%2+1<<" at OBT: "<<OBT[(nn+1)%2]<<" --> crc_hcal["<<nn+1<<"]= "<<ctrk.crc_hc[nn]; |
393 |
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
394 |
rep.str(""); |
395 |
space[wc]-=spacep; |
396 |
} |
397 |
|
398 |
if(ctrk.calfl[nn]!=0){ |
399 |
ok=1; |
400 |
if(space[wc]<=3){ |
401 |
wc+=1; |
402 |
flcanvas+=1; |
403 |
} |
404 |
c[wc]->cd(); |
405 |
tzz->SetTextFont(40); |
406 |
tzz->SetTextSize(0.02); |
407 |
tzz->SetTextAlign(13); |
408 |
tzz->SetTextColor(2); |
409 |
rep<<"***************************************************************************************************************************"; |
410 |
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
411 |
rep.str(""); |
412 |
space[wc]-=spacep; |
413 |
rep<<" ERROR >>> CALIBRATION pkt "<<i+1<<" -->CalibTrk"<<(nn+1)%2+1<<" at OBT: "<<OBT[(nn+1)%2]<<" --> cal_flag["<<nn+1<<"]= "<<ctrk.calfl[nn]; |
414 |
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
415 |
rep.str(""); |
416 |
space[wc]-=spacep; |
417 |
} |
418 |
|
419 |
// if(ctrk.good0[0]==1 && ctrk.good0[1]==1){ |
420 |
// |
421 |
// evaluate the mean value of the sigma and pedestal |
422 |
for(Int_t j = 0; j < 3072; j++){ |
423 |
sigavtemp[nn][j/256]+=ctrk.dspsig[nn][j]; |
424 |
pedavtemp[nn][j/256]+=ctrk.dspped[nn][j]; |
425 |
} |
426 |
|
427 |
for(Int_t ii=0;ii<12;ii++){ |
428 |
pedav[nn][ii]=pedavtemp[nn][ii]/256; |
429 |
sigav[nn][ii]=sigavtemp[nn][ii]/256; |
430 |
|
431 |
if(pedav[nn][ii]>pedlimsup[nn][ii] || pedav[nn][ii]<pedliminf[nn][ii]) flpedav[nn][ii]=1; |
432 |
if(sigav[nn][ii]>siglimsup[nn][ii] || sigav[nn][ii]<sigliminf[nn][ii]) flsigav[nn][ii]=1; |
433 |
|
434 |
if((nn==1 && ii==11)||(nn==6 && ii==2)||(nn==6 && ii==4)||(nn==6 && ii==5)||(nn==6 && ii==6)||(nn==6 && ii==10)||(nn==11 && ii==3)) |
435 |
continue; |
436 |
else{ |
437 |
if(flpedav[nn][ii]==1){ |
438 |
ok=1; |
439 |
if(space[wc]<=3){ |
440 |
wc+=1; |
441 |
flcanvas+=1; |
442 |
} |
443 |
c[wc]->cd(); |
444 |
tzz->SetTextFont(40); |
445 |
tzz->SetTextSize(0.02); |
446 |
tzz->SetTextAlign(13); |
447 |
tzz->SetTextColor(50); |
448 |
rep<<"********************************************************************************************************************************"; |
449 |
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
450 |
rep.str(""); |
451 |
space[wc]-=spacep; |
452 |
rep<<"WARNING >>> CALIBRATION pkt "<<i+1<<" -->CalibTrk"<<(nn+1)%2+1<<" at OBT: "<<OBT[(nn+1)%2]<<"-->DSP "<<nn+1<<" -VA1 "<<2*ii+1<<"-"<<2*ii+2<<" --> <PED>= "<<pedav[nn][ii]; |
453 |
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
454 |
rep.str(""); |
455 |
space[wc]-=spacep; |
456 |
} |
457 |
|
458 |
if(flsigav[nn][ii]==1){ |
459 |
ok=1; |
460 |
if(space[wc]<=3){ |
461 |
wc+=1; |
462 |
flcanvas+=1; |
463 |
} |
464 |
c[wc]->cd(); |
465 |
tzz->SetTextFont(40); |
466 |
tzz->SetTextSize(0.02); |
467 |
tzz->SetTextAlign(13); |
468 |
tzz->SetTextColor(50); |
469 |
rep<<"********************************************************************************************************************************"; |
470 |
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
471 |
rep.str(""); |
472 |
space[wc]-=spacep; |
473 |
rep<<"WARNING >>> CALIBRATION pkt "<<i+1<<" -->CalibTrk"<<(nn+1)%2+1<<" at OBT: "<<OBT[(nn+1)%2]<<"-->DSP "<<nn+1<<" -VA1 "<<2*ii+1<<"-"<<2*ii+2<<" --> <SIG>= "<<sigav[nn][ii]; |
474 |
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
475 |
rep.str(""); |
476 |
space[wc]-=spacep; |
477 |
} |
478 |
} |
479 |
} |
480 |
// } |
481 |
} |
482 |
if(ok==0){ |
483 |
// if(ok==0 && ctrk.good0[0]==1 && ctrk.good0[1]==1){ |
484 |
if(space[wc]<=10){ |
485 |
wc+=1; |
486 |
flcanvas+=1; |
487 |
} |
488 |
c[wc]->cd(); |
489 |
tzz->SetTextFont(40); |
490 |
tzz->SetTextSize(0.03); |
491 |
tzz->SetTextAlign(13); |
492 |
tzz->SetTextColor(1); |
493 |
rep<<"*********************************** CALIBRATION pkt "<<i+1<<"********************************"; |
494 |
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
495 |
rep.str(""); |
496 |
space[wc]-=spacep+1; |
497 |
rep<<">>>>>>> CalibTrk1 at OBT: "<<OBT[0]<<" ---------> OK "; |
498 |
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
499 |
rep.str(""); |
500 |
space[wc]-=spacep+1; |
501 |
rep<<">>>>>>> CalibTrk2 at OBT: "<<OBT[1]<<" ---------> OK "; |
502 |
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
503 |
rep.str(""); |
504 |
space[wc]-=spacep+1; |
505 |
rep<<"*******************************************************************************************"; |
506 |
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
507 |
rep.str(""); |
508 |
space[wc]-=spacep+1; |
509 |
} |
510 |
};//end loop on events |
511 |
|
512 |
printf("... end of packets. \n"); |
513 |
// |
514 |
// Save output Files |
515 |
stringstream nom1,nom2,nom3; |
516 |
|
517 |
for(Int_t i=0;i<cnum;i++) |
518 |
c[i]->Update();//draw pads in canvas |
519 |
|
520 |
for(Int_t fl=0;fl<flcanvas;fl++){ |
521 |
if(flcanvas==1){ |
522 |
nom1.str(""); |
523 |
nom1<<ffile<<"_FTrkCalibQLook_BASIC."<<outfile.Data(); |
524 |
c[fl]->Print(out+nom1.str().c_str()); |
525 |
nom1.str(""); |
526 |
} |
527 |
|
528 |
if(flcanvas>=2){ |
529 |
if(!strcmp(outfile.Data(),"ps")||!strcmp(outfile.Data(),"pdf")){ |
530 |
nom1.str(""); |
531 |
nom2.str(""); |
532 |
nom3.str(""); |
533 |
nom1<<ffile<<"_FTrkCalibQLook_BASIC.ps("; |
534 |
nom2<<ffile<<"_FTrkCalibQLook_BASIC.ps"; |
535 |
nom3<<ffile<<"_FTrkCalibQLook_BASIC.ps)"; |
536 |
if(fl==0) c[fl]->Print(out+nom1.str().c_str(),"portrait"); |
537 |
else if(fl==flcanvas-1) c[fl]->Print(out+nom3.str().c_str(),"portrait"); |
538 |
else c[fl]->Print(out+nom2.str().c_str(),"portrait"); |
539 |
|
540 |
} |
541 |
else{ |
542 |
nom1.str(""); |
543 |
nom1<<ffile<<"_FTrkCalibQLook_BASIC-pag"<<fl+1<<"."<<outfile.Data(); |
544 |
c[fl]->Print(out+nom1.str().c_str()); |
545 |
} |
546 |
} |
547 |
} |
548 |
|
549 |
if(!strcmp(outfile.Data(),"pdf")&&flcanvas>=2){ |
550 |
stringstream com; |
551 |
com<<"ps2pdf13 "<<out<<ffile<<"_FTrkCalibQLook_BASIC.ps "<<out<<ffile<<"_FTrkCalibQLook_BASIC.pdf"; |
552 |
system(com.str().c_str()); |
553 |
printf("\n---> ps file converted in pdf format!\n"); |
554 |
com.str(""); |
555 |
com<<"rm -f "<<out<<ffile<<"_FTrkCalibQLook_BASIC.ps"; |
556 |
system(com.str().c_str()); |
557 |
printf("---> ps file removed!\n\n"); |
558 |
com.str(""); |
559 |
} |
560 |
|
561 |
|
562 |
gROOT->Reset(); |
563 |
return; |
564 |
|
565 |
} |