/[PAMELA software]/quicklook/tracker/flight/macros/FTrkCalibQLook_EXPERT.cxx
ViewVC logotype

Contents of /quicklook/tracker/flight/macros/FTrkCalibQLook_EXPERT.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations) (download)
Sun Jul 2 17:41:14 2006 UTC (18 years, 5 months ago) by pam-fi
Branch: MAIN
CVS Tags: v1r05
Changes since 1.6: +1 -2 lines
release tagged v1r05

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

  ViewVC Help
Powered by ViewVC 1.1.23