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