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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Thu May 18 13:06:08 2006 UTC (18 years, 6 months ago) by pam-fi
Branch: MAIN
Changes since 1.1: +48 -10 lines
*** empty log message ***

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

  ViewVC Help
Powered by ViewVC 1.1.23