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

Annotation of /quicklook/tracker/flight/macros/FTrkCalibQLook_BASIC.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.11 - (hide annotations) (download)
Fri Jan 17 15:10:38 2014 UTC (10 years, 10 months ago) by mocchiut
Branch: MAIN
CVS Tags: HEAD
Changes since 1.10: +5 -1 lines
Compilation warnings using GCC4.7 fixed

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

  ViewVC Help
Powered by ViewVC 1.1.23