1 |
/** |
2 |
* FTrkCalibQLookExpert.cxx |
3 |
* |
4 |
* autor: D.Fedele |
5 |
* version v1r06 |
6 |
* Parameters: |
7 |
* file - the data file to analyze |
8 |
* step - select =1 in order to analyze one event at time |
9 |
* fromevent - first event to analyze |
10 |
* toevent - last event to analyze |
11 |
* outdir - total path of output file |
12 |
* outfile - extension of output file (pdf,ps,gif,jpg) |
13 |
* |
14 |
*/ |
15 |
// |
16 |
#include <iostream> |
17 |
// |
18 |
#include <TPaveText.h> |
19 |
#include <TLatex.h> |
20 |
#include <TCanvas.h> |
21 |
#include <TFile.h> |
22 |
#include <TTree.h> |
23 |
#include <TGraph.h> |
24 |
#include <TStyle.h> |
25 |
#include <TString.h> |
26 |
// |
27 |
#include <PscuHeader.h> |
28 |
#include <EventHeader.h> |
29 |
#include <CalibTrk1Event.h> |
30 |
#include <CalibTrk2Event.h> |
31 |
// |
32 |
|
33 |
typedef struct caltrk_def{ |
34 |
Int_t good0[2]; |
35 |
Int_t daqmode[12]; |
36 |
Int_t dspnum[12]; |
37 |
Int_t calibnum[12]; |
38 |
Int_t ncalev[12]; |
39 |
Int_t calfl[12]; |
40 |
Int_t ped1[12]; |
41 |
Int_t ped2[12]; |
42 |
Int_t ped3[12]; |
43 |
Int_t sig1[12]; |
44 |
Int_t sig2[12]; |
45 |
Int_t sig3[12]; |
46 |
Int_t nbad1[12]; |
47 |
Int_t nbad2[12]; |
48 |
Int_t nbad3[12]; |
49 |
Float_t dspped[12][3702]; |
50 |
Float_t dspsig[12][3702]; |
51 |
Float_t dspbad[12][3702]; |
52 |
Int_t crc_c[12][3]; |
53 |
Int_t crc_hc[12]; |
54 |
}; |
55 |
|
56 |
|
57 |
void FTrkCalibQLook_EXPERT(TString file,Int_t step,Int_t fromevent, Int_t toevent,TString outdir,TString outfile) |
58 |
{ |
59 |
// |
60 |
// obtain information about the data file and select the output dir |
61 |
Int_t dwpos = file.Last('/'); |
62 |
Int_t dwpos1 = file.Last('.'); |
63 |
TString base,ffile ; |
64 |
ffile=file(dwpos+1,dwpos1-(dwpos+1)); |
65 |
if(dwpos>0) base=file(0,dwpos); |
66 |
|
67 |
TString out; |
68 |
if(outdir.Length()==0){ |
69 |
out = base; |
70 |
}else{ |
71 |
out = outdir; |
72 |
} |
73 |
if(out.Last('/')+1<out.Length()) out+="/"; |
74 |
|
75 |
// |
76 |
// inizialise the variables and open the file |
77 |
Int_t nevents=0; |
78 |
Int_t minevent = 0; |
79 |
Int_t maxevent = 0; |
80 |
ULong64_t FOBT[2]; |
81 |
|
82 |
FOBT[0]=0; |
83 |
FOBT[1]=0; |
84 |
|
85 |
struct caltrk_def ctrk; |
86 |
ctrk.good0[0]=0; |
87 |
ctrk.good0[1]=0; |
88 |
for(Int_t i=0;i<12;i++){ |
89 |
ctrk.daqmode[i]=0; |
90 |
ctrk.dspnum[i]=0; |
91 |
ctrk.calibnum[i]=0; |
92 |
ctrk.ncalev[i]=0; |
93 |
ctrk.calfl[i]=0; |
94 |
ctrk.ped1[i]=0; |
95 |
ctrk.ped2[i]=0; |
96 |
ctrk.ped3[i]=0; |
97 |
ctrk.sig1[i]=0; |
98 |
ctrk.sig2[i]=0; |
99 |
ctrk.sig3[i]=0; |
100 |
ctrk.nbad1[i]=0; |
101 |
ctrk.nbad2[i]=0; |
102 |
ctrk.nbad3[i]=0; |
103 |
ctrk.crc_c[i][0]=0; |
104 |
ctrk.crc_c[i][1]=0; |
105 |
ctrk.crc_c[i][2]=0; |
106 |
ctrk.crc_hc[i]=0; |
107 |
for(Int_t iii=0;iii<3072;iii++){ |
108 |
ctrk.dspped[i][iii]=0; |
109 |
ctrk.dspsig[i][iii]=0; |
110 |
ctrk.dspbad[i][iii]=0; |
111 |
}; |
112 |
|
113 |
}; |
114 |
|
115 |
TFile *calibFile = new TFile(file); |
116 |
if ( !calibFile ){ |
117 |
printf("No data file, exiting...\n"); |
118 |
return; |
119 |
}; |
120 |
TTree *otr1,*otr2,*hotr,*totr; |
121 |
pamela::EventHeader *eh1=0,*eh2=0,*eh4=0,*eh3=0; |
122 |
pamela::PscuHeader *ph=0; |
123 |
pamela::CalibTrk1Event *trk1 = 0; |
124 |
pamela::CalibTrk2Event *trk2 = 0; |
125 |
pamela::EventCounter *cod=0; |
126 |
|
127 |
pamela::PacketType *pctp=0; |
128 |
|
129 |
hotr = (TTree*)calibFile->Get("CalibHeader"); |
130 |
hotr->SetBranchAddress("Header", &eh4); |
131 |
|
132 |
totr = (TTree*)calibFile->Get("CalibTrailer"); |
133 |
totr->SetBranchAddress("Header", &eh3); |
134 |
|
135 |
otr1 = (TTree*)calibFile->Get("CalibTrk1"); |
136 |
otr1->SetBranchAddress("CalibTrk1", &trk1); |
137 |
otr1->SetBranchAddress("Header",&eh1); |
138 |
otr2 = (TTree*)calibFile->Get("CalibTrk2"); |
139 |
otr2->SetBranchAddress("CalibTrk2", &trk2); |
140 |
otr2->SetBranchAddress("Header",&eh2); |
141 |
|
142 |
if(otr1->GetEntries()==otr2->GetEntries()) |
143 |
nevents = otr1->GetEntries(); |
144 |
else{ |
145 |
printf("WARNING: CalibTrk1 entries is different from CalibTrk2 entries"); |
146 |
return;} |
147 |
if (nevents<=0) { |
148 |
calibFile->Close(); |
149 |
printf("No calibration packets found, exiting...\n"); |
150 |
return; |
151 |
}; |
152 |
|
153 |
printf("Number of calibration packets: %i\n",nevents); |
154 |
|
155 |
if ( fromevent > toevent && toevent ){ |
156 |
printf("It must be fromevent < toevent \n"); |
157 |
return; |
158 |
}; |
159 |
|
160 |
if ( fromevent > nevents || fromevent < 0 ) { |
161 |
printf("You can choose fromevent between 0 (all) and %i \n",nevents); |
162 |
return; |
163 |
}; |
164 |
|
165 |
if ( toevent > nevents || toevent < 0 ) { |
166 |
printf("You can choose toevent between 0 (all) and %i \n",nevents); |
167 |
return; |
168 |
}; |
169 |
if ( fromevent == 0 ) { |
170 |
minevent = 0; |
171 |
maxevent = nevents; |
172 |
} else { |
173 |
minevent = fromevent - 1; |
174 |
if ( toevent > 0 ){ |
175 |
maxevent = toevent; |
176 |
} else if (toevent > nevents) { |
177 |
maxevent = nevents; |
178 |
} else { |
179 |
maxevent = fromevent; |
180 |
}; |
181 |
}; |
182 |
|
183 |
//********************************************************************** |
184 |
// |
185 |
// LOOP OVER EVENTS |
186 |
// |
187 |
//********************************************************************** |
188 |
|
189 |
Int_t hcevent=hotr->GetEntries(); |
190 |
printf("\n%d\n",hcevent); |
191 |
ULong64_t HOBT[hcevent], TOBT[hcevent]; |
192 |
for (Int_t i = 0; i < hcevent; i++){ |
193 |
totr->GetEntry(i); |
194 |
hotr->GetEntry(i); |
195 |
ph = eh4->GetPscuHeader(); |
196 |
HOBT[i]= ph->GetOrbitalTime(); |
197 |
ph = eh3->GetPscuHeader(); |
198 |
TOBT[i]= ph->GetOrbitalTime(); |
199 |
} |
200 |
|
201 |
printf("\n Scan of calibration packets from %i to %i ... \n\n",minevent+1,maxevent); |
202 |
for (Int_t i = minevent; i < maxevent; i++){ |
203 |
|
204 |
otr1->GetEntry(i); |
205 |
otr2->GetEntry(i); |
206 |
|
207 |
ctrk.good0[0]=trk1->good0; |
208 |
ctrk.good0[1]=trk2->good0; |
209 |
for (Int_t m = 0; m < 6; m++){ |
210 |
ph = eh1->GetPscuHeader(); |
211 |
cod = eh1->GetCounter(); |
212 |
FOBT[0]= ph->GetOrbitalTime(); |
213 |
ctrk.daqmode[trk1->DSPnumber[m]-1]=trk1->DAQmode[m]; |
214 |
ctrk.dspnum[trk1->DSPnumber[m]-1]=trk1->DSPnumber[m]; |
215 |
ctrk.calibnum[trk1->DSPnumber[m]-1]=trk1->calibnumber[m]; |
216 |
ctrk.ncalev[trk1->DSPnumber[m]-1]=trk1->ncalib_event[m]; |
217 |
ctrk.ped1[trk1->DSPnumber[m]-1]=trk1->ped_l1[m]; |
218 |
ctrk.ped2[trk1->DSPnumber[m]-1]=trk1->ped_l2[m]; |
219 |
ctrk.ped3[trk1->DSPnumber[m]-1]=trk1->ped_l3[m]; |
220 |
ctrk.sig1[trk1->DSPnumber[m]-1]=trk1->sig_l1[m]; |
221 |
ctrk.sig2[trk1->DSPnumber[m]-1]=trk1->sig_l2[m]; |
222 |
ctrk.sig3[trk1->DSPnumber[m]-1]=trk1->sig_l3[m]; |
223 |
ctrk.nbad1[trk1->DSPnumber[m]-1]=trk1->nbad_l1[m]; |
224 |
ctrk.nbad2[trk1->DSPnumber[m]-1]=trk1->nbad_l2[m]; |
225 |
ctrk.nbad3[trk1->DSPnumber[m]-1]=trk1->nbad_l3[m]; |
226 |
ctrk.calfl[trk1->DSPnumber[m]-1]=trk1->cal_flag[m]; |
227 |
ctrk.crc_c[trk1->DSPnumber[m]-1][0]=trk1->crc_cal[m][0]; |
228 |
ctrk.crc_c[trk1->DSPnumber[m]-1][1]=trk1->crc_cal[m][1]; |
229 |
ctrk.crc_c[trk1->DSPnumber[m]-1][2]=trk1->crc_cal[m][2]; |
230 |
ctrk.crc_hc[trk1->DSPnumber[m]-1]=trk1->crc_hcal[m]; |
231 |
for (Int_t j = 0; j < 3072; j++){ |
232 |
ctrk.dspped[trk1->DSPnumber[m]-1][j]=trk1->DSPped_par[m][j]; |
233 |
ctrk.dspsig[trk1->DSPnumber[m]-1][j]=trk1->DSPsig_par[m][j]; |
234 |
ctrk.dspbad[trk1->DSPnumber[m]-1][j]=trk1->DSPbad_par[m][j]; |
235 |
}; |
236 |
ph = eh2->GetPscuHeader(); |
237 |
FOBT[1]= ph->GetOrbitalTime(); |
238 |
ctrk.daqmode[trk2->DSPnumber[m]-1]=trk2->DAQmode[m]; |
239 |
ctrk.dspnum[trk2->DSPnumber[m]-1]=trk2->DSPnumber[m]; |
240 |
ctrk.calibnum[trk2->DSPnumber[m]-1]=trk2->calibnumber[m]; |
241 |
ctrk.ncalev[trk2->DSPnumber[m]-1]=trk2->ncalib_event[m]; |
242 |
ctrk.ped1[trk2->DSPnumber[m]-1]=trk2->ped_l1[m]; |
243 |
ctrk.ped2[trk2->DSPnumber[m]-1]=trk2->ped_l2[m]; |
244 |
ctrk.ped3[trk2->DSPnumber[m]-1]=trk2->ped_l3[m]; |
245 |
ctrk.sig1[trk2->DSPnumber[m]-1]=trk2->sig_l1[m]; |
246 |
ctrk.sig2[trk2->DSPnumber[m]-1]=trk2->sig_l2[m]; |
247 |
ctrk.sig3[trk2->DSPnumber[m]-1]=trk2->sig_l3[m]; |
248 |
ctrk.nbad1[trk2->DSPnumber[m]-1]=trk2->nbad_l1[m]; |
249 |
ctrk.nbad2[trk2->DSPnumber[m]-1]=trk2->nbad_l2[m]; |
250 |
ctrk.nbad3[trk2->DSPnumber[m]-1]=trk2->nbad_l3[m]; |
251 |
ctrk.calfl[trk2->DSPnumber[m]-1]=trk2->cal_flag[m]; |
252 |
ctrk.crc_c[trk1->DSPnumber[m]-1][0]=trk2->crc_cal[m][0]; |
253 |
ctrk.crc_c[trk1->DSPnumber[m]-1][1]=trk2->crc_cal[m][1]; |
254 |
ctrk.crc_c[trk1->DSPnumber[m]-1][2]=trk2->crc_cal[m][2]; |
255 |
ctrk.crc_hc[trk1->DSPnumber[m]-1]=trk2->crc_hcal[m]; |
256 |
for (Int_t j = 0; j < 3072; j++){ |
257 |
ctrk.dspped[trk2->DSPnumber[m]-1][j]=trk2->DSPped_par[m][j]; |
258 |
ctrk.dspsig[trk2->DSPnumber[m]-1][j]=trk2->DSPsig_par[m][j]; |
259 |
ctrk.dspbad[trk2->DSPnumber[m]-1][j]=trk2->DSPbad_par[m][j]; |
260 |
} |
261 |
} |
262 |
|
263 |
|
264 |
// |
265 |
// other variables definitions |
266 |
Int_t risposta=0; |
267 |
stringstream fromfile; |
268 |
|
269 |
printf("\n\t%d\n",cod->Get(pctp->CalibHeader)); |
270 |
fromfile<<"FTrkCalibQLook_EXPERT File: "<<ffile<<" -- CalibHeader OBT= "<<HOBT[(cod->Get(pctp->CalibHeader))-1]<<" -- Calib pkt OBT= "<<FOBT[0]<<" -- CalibTrailer OBT= "<<TOBT[(cod->Get(pctp->CalibHeader))-1]<<" --"; |
271 |
|
272 |
gStyle->SetLabelSize(0.08,"x"); |
273 |
gStyle->SetLabelSize(0.08,"y"); |
274 |
gStyle->SetTitleFillColor(10); |
275 |
gStyle->SetTitleFontSize(0.1); |
276 |
gStyle->SetTitleOffset(0.8,"y"); |
277 |
gStyle->SetTitleOffset(1.,"x"); |
278 |
gStyle->SetTitleSize(0.06,"y"); |
279 |
gStyle->SetTitleSize(0.06,"x"); |
280 |
gStyle->SetOptStat(0); |
281 |
|
282 |
// |
283 |
// draw display area |
284 |
TLatex *tzz=new TLatex(); |
285 |
tzz->SetTextFont(32); |
286 |
tzz->SetTextColor(1); |
287 |
tzz->SetTextAlign(12); |
288 |
tzz->SetTextSize(0.019); |
289 |
Int_t canvasx=1200; |
290 |
Int_t canvasy=900; |
291 |
TCanvas *c1 = new TCanvas("c1","FTrkCalibQLook_EXPERT_ped",canvasx,canvasy); |
292 |
c1->SetFillColor(10); |
293 |
tzz->DrawLatex(.01,0.98,fromfile.str().c_str()); |
294 |
tzz->DrawLatex(.90,0.98,"PEDESTAL"); |
295 |
TCanvas *c2 = new TCanvas("c2","FTrkCalibQLook_EXPERT_sig",canvasx,canvasy); |
296 |
c2->SetFillColor(10); |
297 |
tzz->DrawLatex(.01,0.98,fromfile.str().c_str()); |
298 |
tzz->DrawLatex(.90,0.98,"SIGMA"); |
299 |
|
300 |
// draw pads |
301 |
TPad *trkpad1[12],*trkpad2[12]; //pad for histos |
302 |
TPaveText *trkpadtext[12]; //pad for header |
303 |
TH1F *histosig[12]; //histos of sigma |
304 |
TH1F *histoped[12]; //histos of pedestals |
305 |
TH1F *histoasig[12]; //histos of sigma |
306 |
TH1F *histoaped[12]; //histos of pedestals |
307 |
|
308 |
Float_t posy = 0.95; // up y-coord - top pads |
309 |
Float_t hpad = 0.15; // pad height |
310 |
Float_t posx1=0; // left x-coord - pad column |
311 |
Float_t posx2=0; // right x-coord - pad olumn |
312 |
Float_t posx0=0; // x-coord - column division |
313 |
Float_t wrel = 0.6; // relative x size of first sub-column |
314 |
Float_t marg = 0.004; // margin among pads |
315 |
stringstream title; |
316 |
stringstream hid; |
317 |
|
318 |
for(Int_t n = 0; n<12; n++){ |
319 |
if ( (n+1)%2 ) { |
320 |
if(n>1)posy = posy-(marg*2+hpad); |
321 |
posx1 = marg; |
322 |
posx2 = 0.5 - marg; |
323 |
posx0 = 0.5*wrel; |
324 |
} else { |
325 |
posx1 = posx1 + 0.5; |
326 |
posx2 = posx2 + 0.5; |
327 |
posx0 = posx0 + 0.5; |
328 |
}; |
329 |
/* -----------> pad for histograms */ |
330 |
trkpad1[n] = new TPad("pad1"," ",posx1,posy-hpad,posx0-marg,posy,18,0,0); |
331 |
trkpad2[n] = new TPad("pad2"," ",posx1,posy-hpad,posx0-marg,posy,18,0,0); |
332 |
/* -----------> pad for header dump */ |
333 |
trkpadtext[n] = new TPaveText((posx0+marg),(posy-hpad),posx2,posy); |
334 |
/* -----------> HISTOGRAMS */ |
335 |
/* calibration parameters */ |
336 |
title<<"DSP "<<n+1; |
337 |
hid<<"h"<<n<<"i"<<i; |
338 |
histosig[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3072,0.5,3072.5); |
339 |
hid.str(""); |
340 |
hid<<"hh"<<n<<"i"<<i; |
341 |
histoped[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3072,0.5,3072.5); |
342 |
hid.str(""); |
343 |
hid<<"hhh"<<n<<"i"<<i; |
344 |
title.str(""); |
345 |
hid.str(""); |
346 |
/* AVERAGE calibration parameters */ |
347 |
hid<<"ah"<<n<<"i"<<i; |
348 |
histoasig[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3,0.5,3072.5); |
349 |
hid.str(""); |
350 |
hid<<"ahh"<<n<<"i"<<i; |
351 |
histoaped[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3,0.5,3072.5); |
352 |
hid.str(""); |
353 |
}; //end loop on views |
354 |
|
355 |
|
356 |
stringstream message; |
357 |
|
358 |
//-------------------------------- |
359 |
//CHECK CALIBRATION procedure |
360 |
//-------------------------------- |
361 |
Int_t nn=0; |
362 |
Int_t calok = 0;//BAD |
363 |
for(Int_t n = 0; n<12; n++){ |
364 |
if(ctrk.ncalev[n]==0 && ctrk.calfl[n]==0)calok = 1;//GOOD |
365 |
|
366 |
|
367 |
nn=ctrk.dspnum[n]-1; |
368 |
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
369 |
* |
370 |
* Write event LEVEL0 report |
371 |
* |
372 |
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
373 |
trkpadtext[nn]->SetTextFont(40); |
374 |
trkpadtext[nn]->SetFillColor(33); |
375 |
if(calok==0)trkpadtext[nn]->SetFillColor(2); |
376 |
trkpadtext[nn]->SetTextSize(0.013); |
377 |
trkpadtext[nn]->SetTextAlign(13); |
378 |
trkpadtext[nn]->SetTextColor(1); |
379 |
|
380 |
trkpadtext[nn]->AddText(" "); |
381 |
message<<"DSP num --------> "<<ctrk.dspnum[n]; |
382 |
trkpadtext[nn]->AddText(message.str().c_str()); |
383 |
message.str(""); |
384 |
message<<"DAQ mode -------> "<<ctrk.daqmode[n]; |
385 |
trkpadtext[nn]->AddText(message.str().c_str()); |
386 |
message.str(""); |
387 |
message<<"Calibnumber ----> "<<ctrk.calibnum[n]; |
388 |
trkpadtext[nn]->AddText(message.str().c_str()); |
389 |
message.str(""); |
390 |
message<<"ncalib_event ---> "<<ctrk.ncalev[n]; |
391 |
trkpadtext[nn]->AddText(message.str().c_str()); |
392 |
message.str(""); |
393 |
message<<"Cal_flag -------> "<<ctrk.calfl[n]; |
394 |
trkpadtext[nn]->AddText(message.str().c_str()); |
395 |
message.str(""); |
396 |
message<<"crc_hcal -------> "<<ctrk.crc_hc[n]; |
397 |
trkpadtext[nn]->AddText(message.str().c_str()); |
398 |
message.str(""); |
399 |
message<<"crc_cal: l1- ";message.width(5);message<< ctrk.crc_c[n][0]; |
400 |
message<<" l2- ";message.width(5);message<< ctrk.crc_c[n][1]; |
401 |
message<<" l3- ";message.width(5);message<< ctrk.crc_c[n][2]; |
402 |
trkpadtext[nn]->AddText(message.str().c_str()); |
403 |
message.str(""); |
404 |
message<<"<PED>: l1- "; message.width(5);message<< ctrk.ped1[n]; |
405 |
message<<" l2-"; message.width(5);message<< ctrk.ped2[n]; |
406 |
message<<" l3-"; message.width(5);message<< ctrk.ped3[n]; |
407 |
trkpadtext[nn]->AddText(message.str().c_str()); |
408 |
message.str(""); |
409 |
message<<"<SIG>: l1- "; message.width(5);message<< ctrk.sig1[n]; |
410 |
message<<" l2-"; message.width(5);message<< ctrk.sig2[n]; |
411 |
message<<" l3-"; message.width(5);message<< ctrk.sig3[n]; |
412 |
trkpadtext[nn]->AddText(message.str().c_str()); |
413 |
message.str(""); |
414 |
message<<"n.BAD: l1- "; message.width(5);message<<ctrk.nbad1[n]; |
415 |
message<<" l2-"; message.width(5);message<< ctrk.nbad2[n]; |
416 |
message<<" l3-"; message.width(5);message<< ctrk.nbad3[n]; |
417 |
trkpadtext[nn]->AddText(message.str().c_str()); |
418 |
message.str(""); |
419 |
|
420 |
if(calok==0){ |
421 |
|
422 |
message.str("*** FAILED ***"); |
423 |
TText *t=trkpadtext[nn]->AddText(message.str().c_str()); |
424 |
t->SetTextSize(0.02); |
425 |
t->SetTextAlign(23); |
426 |
t->SetTextColor(5); |
427 |
}; |
428 |
|
429 |
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
430 |
* |
431 |
* Plot histo |
432 |
* |
433 |
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
434 |
|
435 |
|
436 |
/******************************************************/ |
437 |
/* fill histos */ |
438 |
for(Int_t j = 0; j < 3072; j++){ |
439 |
histosig[nn]->Fill((Float_t)j,ctrk.dspsig[nn][j]); |
440 |
histoped[nn]->Fill((Float_t)j,ctrk.dspped[nn][j]); |
441 |
}; |
442 |
histoasig[nn]->Fill(1,ctrk.sig1[nn]); |
443 |
histoasig[nn]->Fill(1025,ctrk.sig2[nn]); |
444 |
histoasig[nn]->Fill(2049,ctrk.sig3[nn]); |
445 |
histoaped[nn]->Fill(1,ctrk.ped1[nn]); |
446 |
histoaped[nn]->Fill(1025,ctrk.ped2[nn]); |
447 |
histoaped[nn]->Fill(2049,ctrk.ped3[nn]); |
448 |
/******************************************************/ |
449 |
|
450 |
TLine li; |
451 |
li.SetLineColor(38); |
452 |
li.SetLineStyle(3); |
453 |
li.SetLineWidth(2); |
454 |
|
455 |
Float_t maxhist=0; |
456 |
TBox b; |
457 |
b.SetFillColor(6); |
458 |
b.SetFillStyle(3945); |
459 |
/* plot PEDESTAL */ |
460 |
c1->cd(); |
461 |
trkpadtext[nn]->Draw(); |
462 |
trkpad1[nn]->Draw(); |
463 |
trkpad1[nn]->cd(); |
464 |
trkpad1[nn]->SetFillColor(10); |
465 |
trkpad1[nn]->SetFrameFillColor(10); |
466 |
histoped[nn]->SetLineColor(1); |
467 |
histoped[nn]->SetFillColor(12); |
468 |
histoped[nn]->SetLineWidth(1); |
469 |
histoped[nn]->GetYaxis()->SetTitle("PED (ADC channels)"); |
470 |
histoped[nn]->GetYaxis()->CenterTitle(); |
471 |
if((nn+1)%2==1) histoped[nn]->GetYaxis()->SetRangeUser(2200,3200); |
472 |
if((nn+1)%2==0) histoped[nn]->GetYaxis()->SetRangeUser(700,1700); |
473 |
histoaped[nn]->SetLineColor(5); |
474 |
histoaped[nn]->SetLineWidth(1); |
475 |
if(ctrk.good0[0]==1 && ctrk.good0[1]==1){ |
476 |
histoped[nn]->Draw("b"); |
477 |
if(nn==1){ |
478 |
maxhist=histoped[nn]->GetMaximum(); |
479 |
b.DrawBox(2816.,700.,3060.,maxhist); |
480 |
} |
481 |
else if(nn==6){ |
482 |
maxhist=histoped[nn]->GetMaximum(); |
483 |
b.DrawBox(2560.,2200.,2816.,maxhist); |
484 |
b.DrawBox(512.,2200.,768.,maxhist); |
485 |
b.DrawBox(1024.,2200.,1792.,maxhist); |
486 |
} |
487 |
else if(nn==11){ |
488 |
maxhist=histoped[nn]->GetMaximum(); |
489 |
b.DrawBox(768.,700.,1024.,maxhist); |
490 |
} |
491 |
} |
492 |
else histoped[nn]->Draw("axis"); |
493 |
histoaped[nn]->Draw("same"); |
494 |
if((nn+1)%2==1) { |
495 |
li.DrawLine(1024.5,2200,1024.5,3200); |
496 |
li.DrawLine(2048.5,2200,2048.5,3200); |
497 |
} |
498 |
if((nn+1)%2==0) { |
499 |
li.DrawLine(1024.5,700,1024.5,1700); |
500 |
li.DrawLine(2048.5,700,2048.5,1700); |
501 |
} |
502 |
|
503 |
|
504 |
|
505 |
/* plot SIGMA */ |
506 |
Float_t max=500.; |
507 |
c2->cd(); |
508 |
trkpadtext[nn]->Draw(); |
509 |
trkpad2[nn]->SetLogy(); |
510 |
trkpad2[nn]->Draw(); |
511 |
trkpad2[nn]->cd(); |
512 |
trkpad2[nn]->SetFillColor(10); |
513 |
trkpad2[nn]->SetFrameFillColor(10); |
514 |
histosig[nn]->SetLineColor(1); |
515 |
histosig[nn]->SetFillColor(12); |
516 |
histosig[nn]->SetLineWidth(1); |
517 |
histosig[nn]->SetMaximum(max); |
518 |
histosig[nn]->SetMinimum(0.5); |
519 |
histosig[nn]->GetYaxis()->SetTitle("SIG (ADC channels)"); |
520 |
histosig[nn]->GetYaxis()->CenterTitle(); |
521 |
histoasig[nn]->SetLineColor(5); |
522 |
histoasig[nn]->SetLineWidth(1); |
523 |
if(ctrk.good0[0]==1 && ctrk.good0[1]==1){ |
524 |
histosig[nn]->Draw("b"); |
525 |
if(nn==1){ |
526 |
maxhist=histosig[nn]->GetMaximum(); |
527 |
b.DrawBox(2816.,0.,3060.,maxhist); |
528 |
} |
529 |
else if(nn==6){ |
530 |
maxhist=histosig[nn]->GetMaximum(); |
531 |
b.DrawBox(2560.,0.,2816.,maxhist); |
532 |
b.DrawBox(512.,0.,768.,maxhist); |
533 |
b.DrawBox(1024.,0.,1792.,maxhist); |
534 |
} |
535 |
else if(nn==11){ |
536 |
maxhist=histosig[nn]->GetMaximum(); |
537 |
b.DrawBox(768.,0.,1024.,maxhist); |
538 |
} |
539 |
} |
540 |
else histosig[nn]->Draw("axis"); |
541 |
histoasig[nn]->Draw("same"); |
542 |
li.DrawLine(1024.5,0,1024.5,max); |
543 |
li.DrawLine(2048.5,0,2048.5,max); |
544 |
|
545 |
|
546 |
|
547 |
};//end loop on views |
548 |
|
549 |
c1->Update();//draw pads in canvas |
550 |
c2->Update();//draw pads in canvas |
551 |
|
552 |
stringstream nom1; |
553 |
stringstream nom2; |
554 |
|
555 |
if(!strcmp(outfile.Data(),"ps")||!strcmp(outfile.Data(),"pdf")){ |
556 |
nom1.str(""); |
557 |
nom2.str(""); |
558 |
nom1<<out<<ffile<<"_FTrkCalibQLook_EXPERT-pkt"<<i+1<<".ps("; |
559 |
nom2<<out<<ffile<<"_FTrkCalibQLook_EXPERT-pkt"<<i+1<<".ps)"; |
560 |
c1->Print(nom1.str().c_str(),"Landscape"); |
561 |
c2->Print(nom2.str().c_str(),"Landscape"); |
562 |
if(!strcmp(outfile.Data(),"pdf")){ |
563 |
stringstream com; |
564 |
com<<"ps2pdf13 "<<out<<ffile<<"_FTrkCalibQLook_EXPERT-pkt"<<i+1<<".ps "<<out<<ffile<<"_FTrkCalibQlook_EXPERT-pkt"<<i+1<<".pdf"; |
565 |
system(com.str().c_str()); |
566 |
printf("\n---> ps file converted in pdf format!\n"); |
567 |
com.str(""); |
568 |
com<<"rm -f "<<out<<ffile<<"_FTrkCalibQLook_EXPERT-pkt"<<i+1<<".ps"; |
569 |
system(com.str().c_str()); |
570 |
printf("---> ps file removed!\n\n"); |
571 |
com.str(""); |
572 |
} |
573 |
} |
574 |
else{ |
575 |
nom1.str(""); |
576 |
nom2.str(""); |
577 |
nom1<<out<<ffile<<"_FTrkCalibQLook_EXPERT-ped-pkt"<<i+1<<"."<<outfile.Data(); |
578 |
nom2<<out<<ffile<<"_FTrkCalibQLook_EXPERT-sig-pkt"<<i+1<<"."<<outfile.Data(); |
579 |
c1->Print(nom1.str().c_str()); |
580 |
c2->Print(nom2.str().c_str()); |
581 |
} |
582 |
|
583 |
if(step==1 && i!=maxevent-1 ){ |
584 |
printf("\n Press 1<enter> to continue, 2<enter> to quit.\n"); |
585 |
cin>>risposta; |
586 |
if ( i != maxevent-1 ) { |
587 |
if ( risposta == 2 ) { |
588 |
gROOT->Reset(); |
589 |
printf("Exiting...\n"); |
590 |
return; |
591 |
} |
592 |
} |
593 |
} |
594 |
};//end loop on events |
595 |
|
596 |
gROOT->Reset(); |
597 |
printf("... end of packets. \n"); |
598 |
return; |
599 |
} |
600 |
|
601 |
|