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