1 |
pam-fi |
1.1 |
/** |
2 |
|
|
* FTrkCalibQLook_BASIC.cxx |
3 |
|
|
* |
4 |
|
|
* autor: D.Fedele |
5 |
pam-fi |
1.6 |
* version v1r08 |
6 |
pam-fi |
1.1 |
* 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 |
pam-fi |
1.4 |
#include <TFile.h> |
19 |
pam-fi |
1.1 |
#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 |
pam-fi |
1.4 |
typedef struct caltrk_def{ |
30 |
pam-fi |
1.1 |
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 |
pam-fi |
1.4 |
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 |
pam-fi |
1.1 |
|
63 |
|
|
TString out; |
64 |
|
|
if(outdir.Length()==0){ |
65 |
|
|
out = base; |
66 |
|
|
}else{ |
67 |
|
|
out = outdir; |
68 |
|
|
}; |
69 |
pam-fi |
1.4 |
if(out.Last('/')+1<out.Length()) out+="/"; |
70 |
|
|
|
71 |
pam-fi |
1.1 |
// |
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 = fromevent; |
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 ndsp =0,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 |
pam-fi |
1.2 |
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 |
pam-fi |
1.1 |
} |
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 |
pam-fi |
1.2 |
const Int_t cnum=alarm/30 + 100; |
235 |
pam-fi |
1.1 |
Int_t flcanvas=1; |
236 |
|
|
Float_t spacep=1.5,space[cnum]; |
237 |
pam-fi |
1.2 |
TCanvas *c[cnum]; |
238 |
pam-fi |
1.1 |
// |
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 |
pam-fi |
1.2 |
c[i]->SetFillColor(10); |
249 |
pam-fi |
1.1 |
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 |
|
|
ctrk.daqmode[trk1->DSPnumber[m]-1]=trk1->DAQmode[m]; |
276 |
|
|
ctrk.dspnum[trk1->DSPnumber[m]-1]=trk1->DSPnumber[m]; |
277 |
|
|
ctrk.calibnum[trk1->DSPnumber[m]-1]=trk1->calibnumber[m]; |
278 |
|
|
ctrk.ncalev[trk1->DSPnumber[m]-1]=trk1->ncalib_event[m]; |
279 |
|
|
ctrk.ped1[trk1->DSPnumber[m]-1]=trk1->ped_l1[m]; |
280 |
|
|
ctrk.ped2[trk1->DSPnumber[m]-1]=trk1->ped_l2[m]; |
281 |
|
|
ctrk.ped3[trk1->DSPnumber[m]-1]=trk1->ped_l3[m]; |
282 |
|
|
ctrk.sig1[trk1->DSPnumber[m]-1]=trk1->sig_l1[m]; |
283 |
|
|
ctrk.sig2[trk1->DSPnumber[m]-1]=trk1->sig_l2[m]; |
284 |
|
|
ctrk.sig3[trk1->DSPnumber[m]-1]=trk1->sig_l3[m]; |
285 |
|
|
ctrk.nbad1[trk1->DSPnumber[m]-1]=trk1->nbad_l1[m]; |
286 |
|
|
ctrk.nbad2[trk1->DSPnumber[m]-1]=trk1->nbad_l2[m]; |
287 |
|
|
ctrk.nbad3[trk1->DSPnumber[m]-1]=trk1->nbad_l3[m]; |
288 |
|
|
ctrk.calfl[trk1->DSPnumber[m]-1]=trk1->cal_flag[m]; |
289 |
|
|
ctrk.crc_c[trk1->DSPnumber[m]-1][0]=trk1->crc_cal[m][0]; |
290 |
|
|
ctrk.crc_c[trk1->DSPnumber[m]-1][1]=trk1->crc_cal[m][1]; |
291 |
|
|
ctrk.crc_c[trk1->DSPnumber[m]-1][2]=trk1->crc_cal[m][2]; |
292 |
|
|
ctrk.crc_hc[trk1->DSPnumber[m]-1]=trk1->crc_hcal[m]; |
293 |
|
|
for (Int_t j = 0; j < 3072; j++){ |
294 |
|
|
ctrk.dspped[trk1->DSPnumber[m]-1][j]=trk1->DSPped_par[m][j]; |
295 |
|
|
ctrk.dspsig[trk1->DSPnumber[m]-1][j]=trk1->DSPsig_par[m][j]; |
296 |
|
|
ctrk.dspbad[trk1->DSPnumber[m]-1][j]=trk1->DSPbad_par[m][j]; |
297 |
|
|
} |
298 |
|
|
ph2 = eh2->GetPscuHeader(); |
299 |
|
|
OBT[1]= ph2->GetOrbitalTime(); |
300 |
|
|
ctrk.daqmode[trk2->DSPnumber[m]-1]=trk2->DAQmode[m]; |
301 |
|
|
ctrk.dspnum[trk2->DSPnumber[m]-1]=trk2->DSPnumber[m]; |
302 |
|
|
ctrk.calibnum[trk2->DSPnumber[m]-1]=trk2->calibnumber[m]; |
303 |
|
|
ctrk.ncalev[trk2->DSPnumber[m]-1]=trk2->ncalib_event[m]; |
304 |
|
|
ctrk.ped1[trk2->DSPnumber[m]-1]=trk2->ped_l1[m]; |
305 |
|
|
ctrk.ped2[trk2->DSPnumber[m]-1]=trk2->ped_l2[m]; |
306 |
|
|
ctrk.ped3[trk2->DSPnumber[m]-1]=trk2->ped_l3[m]; |
307 |
|
|
ctrk.sig1[trk2->DSPnumber[m]-1]=trk2->sig_l1[m]; |
308 |
|
|
ctrk.sig2[trk2->DSPnumber[m]-1]=trk2->sig_l2[m]; |
309 |
|
|
ctrk.sig3[trk2->DSPnumber[m]-1]=trk2->sig_l3[m]; |
310 |
|
|
ctrk.nbad1[trk2->DSPnumber[m]-1]=trk2->nbad_l1[m]; |
311 |
|
|
ctrk.nbad2[trk2->DSPnumber[m]-1]=trk2->nbad_l2[m]; |
312 |
|
|
ctrk.nbad3[trk2->DSPnumber[m]-1]=trk2->nbad_l3[m]; |
313 |
|
|
ctrk.calfl[trk2->DSPnumber[m]-1]=trk2->cal_flag[m]; |
314 |
|
|
ctrk.crc_c[trk1->DSPnumber[m]-1][0]=trk2->crc_cal[m][0]; |
315 |
|
|
ctrk.crc_c[trk1->DSPnumber[m]-1][1]=trk2->crc_cal[m][1]; |
316 |
|
|
ctrk.crc_c[trk1->DSPnumber[m]-1][2]=trk2->crc_cal[m][2]; |
317 |
|
|
ctrk.crc_hc[trk1->DSPnumber[m]-1]=trk2->crc_hcal[m]; |
318 |
|
|
for (Int_t j = 0; j < 3072; j++){ |
319 |
|
|
ctrk.dspped[trk2->DSPnumber[m]-1][j]=trk2->DSPped_par[m][j]; |
320 |
|
|
ctrk.dspsig[trk2->DSPnumber[m]-1][j]=trk2->DSPsig_par[m][j]; |
321 |
|
|
ctrk.dspbad[trk2->DSPnumber[m]-1][j]=trk2->DSPbad_par[m][j]; |
322 |
|
|
} |
323 |
|
|
} |
324 |
|
|
|
325 |
|
|
for(Int_t n = 0; n<12; n++){ |
326 |
|
|
for(Int_t nm = 0; nm<12; nm++){ |
327 |
|
|
pedav[n][nm]=0; |
328 |
|
|
pedavtemp[n][nm]=0; |
329 |
|
|
sigav[n][nm]=0; |
330 |
|
|
sigavtemp[n][nm]=0; |
331 |
|
|
flpedav[n][nm]=0; |
332 |
|
|
flsigav[n][nm]=0; |
333 |
|
|
} |
334 |
|
|
} |
335 |
|
|
|
336 |
|
|
Int_t nn,ok=0; |
337 |
|
|
|
338 |
|
|
// |
339 |
|
|
// write warning if it occur |
340 |
|
|
for(Int_t n = 0; n<12; n++){ |
341 |
|
|
|
342 |
|
|
ndsp = ctrk.dspnum[n]; |
343 |
|
|
nn = ndsp-1; |
344 |
|
|
|
345 |
|
|
for(Int_t iii=0;iii<3;iii++){ |
346 |
|
|
if(ctrk.crc_c[nn][iii]!=0){ |
347 |
|
|
ok=1; |
348 |
|
|
if(space[wc]<=3){ |
349 |
|
|
wc+=1; |
350 |
|
|
flcanvas+=1; |
351 |
|
|
} |
352 |
|
|
c[wc]->cd(); |
353 |
|
|
tzz->SetTextFont(40); |
354 |
|
|
tzz->SetTextSize(0.02); |
355 |
|
|
tzz->SetTextAlign(13); |
356 |
|
|
tzz->SetTextColor(2); |
357 |
|
|
rep<<"***************************************************************************************************************************"; |
358 |
|
|
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
359 |
|
|
rep.str(""); |
360 |
|
|
space[wc]-=spacep; |
361 |
|
|
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]; |
362 |
|
|
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
363 |
|
|
rep.str(""); |
364 |
|
|
space[wc]-=spacep; |
365 |
|
|
} |
366 |
|
|
} |
367 |
|
|
|
368 |
|
|
if(ctrk.crc_hc[nn]!=0){ |
369 |
|
|
ok=1; |
370 |
|
|
if(space[wc]<=3){ |
371 |
|
|
wc+=1; |
372 |
|
|
flcanvas+=1; |
373 |
|
|
} |
374 |
|
|
c[wc]->cd(); |
375 |
|
|
tzz->SetTextFont(40); |
376 |
|
|
tzz->SetTextSize(0.02); |
377 |
|
|
tzz->SetTextAlign(13); |
378 |
|
|
tzz->SetTextColor(2); |
379 |
|
|
rep<<"***************************************************************************************************************************"; |
380 |
|
|
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
381 |
|
|
rep.str(""); |
382 |
|
|
space[wc]-=spacep; |
383 |
|
|
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]; |
384 |
|
|
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
385 |
|
|
rep.str(""); |
386 |
|
|
space[wc]-=spacep; |
387 |
|
|
} |
388 |
|
|
|
389 |
|
|
if(ctrk.calfl[nn]!=0){ |
390 |
|
|
ok=1; |
391 |
|
|
if(space[wc]<=3){ |
392 |
|
|
wc+=1; |
393 |
|
|
flcanvas+=1; |
394 |
|
|
} |
395 |
|
|
c[wc]->cd(); |
396 |
|
|
tzz->SetTextFont(40); |
397 |
|
|
tzz->SetTextSize(0.02); |
398 |
|
|
tzz->SetTextAlign(13); |
399 |
|
|
tzz->SetTextColor(2); |
400 |
|
|
rep<<"***************************************************************************************************************************"; |
401 |
|
|
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
402 |
|
|
rep.str(""); |
403 |
|
|
space[wc]-=spacep; |
404 |
|
|
rep<<" ERROR >>> CALIBRATION pkt "<<i+1<<" -->CalibTrk"<<(nn+1)%2+1<<" at OBT: "<<OBT[(nn+1)%2]<<" --> cal_flag["<<nn+1<<"]= "<<ctrk.calfl[nn]; |
405 |
|
|
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
406 |
|
|
rep.str(""); |
407 |
|
|
space[wc]-=spacep; |
408 |
|
|
} |
409 |
|
|
|
410 |
|
|
if(ctrk.good0[0]==1 && ctrk.good0[1]==1){ |
411 |
|
|
// |
412 |
|
|
// evaluate the mean value of the sigma and pedestal |
413 |
|
|
for(Int_t j = 0; j < 3072; j++){ |
414 |
|
|
sigavtemp[nn][j/256]+=ctrk.dspsig[nn][j]; |
415 |
|
|
pedavtemp[nn][j/256]+=ctrk.dspped[nn][j]; |
416 |
|
|
} |
417 |
|
|
|
418 |
|
|
for(Int_t ii=0;ii<12;ii++){ |
419 |
|
|
pedav[nn][ii]=pedavtemp[nn][ii]/256; |
420 |
|
|
sigav[nn][ii]=sigavtemp[nn][ii]/256; |
421 |
|
|
|
422 |
|
|
if(pedav[nn][ii]>pedlimsup[nn][ii] || pedav[nn][ii]<pedliminf[nn][ii]) flpedav[nn][ii]=1; |
423 |
|
|
if(sigav[nn][ii]>siglimsup[nn][ii] || sigav[nn][ii]<sigliminf[nn][ii]) flsigav[nn][ii]=1; |
424 |
|
|
|
425 |
pam-fi |
1.2 |
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)) |
426 |
|
|
continue; |
427 |
|
|
else{ |
428 |
|
|
if(flpedav[nn][ii]==1){ |
429 |
|
|
ok=1; |
430 |
|
|
if(space[wc]<=3){ |
431 |
|
|
wc+=1; |
432 |
|
|
flcanvas+=1; |
433 |
|
|
} |
434 |
|
|
c[wc]->cd(); |
435 |
|
|
tzz->SetTextFont(40); |
436 |
|
|
tzz->SetTextSize(0.02); |
437 |
|
|
tzz->SetTextAlign(13); |
438 |
|
|
tzz->SetTextColor(50); |
439 |
|
|
rep<<"********************************************************************************************************************************"; |
440 |
|
|
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
441 |
|
|
rep.str(""); |
442 |
|
|
space[wc]-=spacep; |
443 |
|
|
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]; |
444 |
|
|
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
445 |
|
|
rep.str(""); |
446 |
|
|
space[wc]-=spacep; |
447 |
pam-fi |
1.1 |
} |
448 |
pam-fi |
1.2 |
|
449 |
|
|
if(flsigav[nn][ii]==1){ |
450 |
|
|
ok=1; |
451 |
|
|
if(space[wc]<=3){ |
452 |
|
|
wc+=1; |
453 |
|
|
flcanvas+=1; |
454 |
|
|
} |
455 |
|
|
c[wc]->cd(); |
456 |
|
|
tzz->SetTextFont(40); |
457 |
|
|
tzz->SetTextSize(0.02); |
458 |
|
|
tzz->SetTextAlign(13); |
459 |
|
|
tzz->SetTextColor(50); |
460 |
|
|
rep<<"********************************************************************************************************************************"; |
461 |
|
|
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
462 |
|
|
rep.str(""); |
463 |
|
|
space[wc]-=spacep; |
464 |
|
|
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]; |
465 |
|
|
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
466 |
|
|
rep.str(""); |
467 |
|
|
space[wc]-=spacep; |
468 |
pam-fi |
1.1 |
} |
469 |
|
|
} |
470 |
|
|
} |
471 |
|
|
} |
472 |
|
|
} |
473 |
pam-fi |
1.2 |
if(ok==0 && ctrk.good0[0]==1 && ctrk.good0[1]==1){ |
474 |
pam-fi |
1.1 |
if(space[wc]<=10){ |
475 |
|
|
wc+=1; |
476 |
|
|
flcanvas+=1; |
477 |
|
|
} |
478 |
|
|
c[wc]->cd(); |
479 |
|
|
tzz->SetTextFont(40); |
480 |
|
|
tzz->SetTextSize(0.03); |
481 |
|
|
tzz->SetTextAlign(13); |
482 |
|
|
tzz->SetTextColor(1); |
483 |
|
|
rep<<"*********************************** CALIBRATION pkt "<<i+1<<"********************************"; |
484 |
|
|
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
485 |
|
|
rep.str(""); |
486 |
|
|
space[wc]-=spacep+1; |
487 |
|
|
rep<<">>>>>>> CalibTrk1 at OBT: "<<OBT[0]<<" ---------> OK "; |
488 |
|
|
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
489 |
|
|
rep.str(""); |
490 |
|
|
space[wc]-=spacep+1; |
491 |
|
|
rep<<">>>>>>> CalibTrk2 at OBT: "<<OBT[1]<<" ---------> OK "; |
492 |
|
|
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
493 |
|
|
rep.str(""); |
494 |
|
|
space[wc]-=spacep+1; |
495 |
|
|
rep<<"*******************************************************************************************"; |
496 |
|
|
tzz->DrawLatex(2,space[wc],rep.str().c_str()); |
497 |
|
|
rep.str(""); |
498 |
|
|
space[wc]-=spacep+1; |
499 |
|
|
} |
500 |
|
|
};//end loop on events |
501 |
|
|
|
502 |
|
|
printf("... end of packets. \n"); |
503 |
|
|
// |
504 |
|
|
// Save output Files |
505 |
|
|
stringstream nom1,nom2,nom3; |
506 |
|
|
|
507 |
|
|
for(Int_t i=0;i<cnum;i++) |
508 |
|
|
c[i]->Update();//draw pads in canvas |
509 |
|
|
|
510 |
|
|
for(Int_t fl=0;fl<flcanvas;fl++){ |
511 |
|
|
if(flcanvas==1){ |
512 |
|
|
nom1.str(""); |
513 |
|
|
nom1<<ffile<<"_FTrkCalibQLook_BASIC."<<outfile.Data(); |
514 |
|
|
c[fl]->Print(out+nom1.str().c_str()); |
515 |
|
|
nom1.str(""); |
516 |
|
|
} |
517 |
|
|
|
518 |
|
|
if(flcanvas>=2){ |
519 |
|
|
if(!strcmp(outfile.Data(),"ps")||!strcmp(outfile.Data(),"pdf")){ |
520 |
|
|
nom1.str(""); |
521 |
|
|
nom2.str(""); |
522 |
|
|
nom3.str(""); |
523 |
|
|
nom1<<ffile<<"_FTrkCalibQLook_BASIC.ps("; |
524 |
|
|
nom2<<ffile<<"_FTrkCalibQLook_BASIC.ps"; |
525 |
|
|
nom3<<ffile<<"_FTrkCalibQLook_BASIC.ps)"; |
526 |
|
|
if(fl==0) c[fl]->Print(out+nom1.str().c_str(),"portrait"); |
527 |
|
|
else if(fl==flcanvas-1) c[fl]->Print(out+nom3.str().c_str(),"portrait"); |
528 |
|
|
else c[fl]->Print(out+nom2.str().c_str(),"portrait"); |
529 |
|
|
|
530 |
|
|
} |
531 |
|
|
else{ |
532 |
|
|
nom1.str(""); |
533 |
|
|
nom1<<ffile<<"_FTrkCalibQLook_BASIC-pag"<<fl+1<<"."<<outfile.Data(); |
534 |
|
|
c[fl]->Print(out+nom1.str().c_str()); |
535 |
|
|
} |
536 |
|
|
} |
537 |
|
|
} |
538 |
|
|
|
539 |
|
|
if(!strcmp(outfile.Data(),"pdf")&&flcanvas>=2){ |
540 |
|
|
stringstream com; |
541 |
|
|
com<<"ps2pdf13 "<<out<<ffile<<"_FTrkCalibQLook_BASIC.ps "<<out<<ffile<<"_FTrkCalibQLook_BASIC.pdf"; |
542 |
|
|
system(com.str().c_str()); |
543 |
|
|
printf("\n---> ps file converted in pdf format!\n"); |
544 |
|
|
com.str(""); |
545 |
|
|
com<<"rm -f "<<out<<ffile<<"_FTrkCalibQLook_BASIC.ps"; |
546 |
|
|
system(com.str().c_str()); |
547 |
|
|
printf("---> ps file removed!\n\n"); |
548 |
|
|
com.str(""); |
549 |
|
|
} |
550 |
|
|
|
551 |
|
|
|
552 |
|
|
gROOT->Reset(); |
553 |
|
|
return; |
554 |
|
|
|
555 |
|
|
} |