/[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.33 - (hide annotations) (download)
Fri Jan 17 15:10:39 2014 UTC (10 years, 10 months ago) by mocchiut
Branch: MAIN
CVS Tags: HEAD
Changes since 1.32: +5 -1 lines
Compilation warnings using GCC4.7 fixed

1 pam-fi 1.25 /**
2 pam-fi 1.6 * FTrkCalibQLookExpert.cxx
3 pam-fi 1.1 *
4     * autor: D.Fedele
5 pam-fi 1.30 * version v1r28
6 pam-fi 1.1 * 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 pam-fi 1.6 #include <TFile.h>
22 pam-fi 1.1 #include <TTree.h>
23     #include <TGraph.h>
24     #include <TStyle.h>
25     #include <TString.h>
26 mocchiut 1.33 #include <TAxis.h>
27     #include <TH1F.h>
28     #include <TROOT.h>
29     #include <cstdlib>
30 pam-fi 1.1 //
31     #include <PscuHeader.h>
32     #include <EventHeader.h>
33     #include <CalibTrk1Event.h>
34     #include <CalibTrk2Event.h>
35     //
36    
37 mocchiut 1.33 struct caltrk_def{
38 pam-fi 1.1 Int_t good0[2];
39     Int_t daqmode[12];
40     Int_t dspnum[12];
41     Int_t calibnum[12];
42     Int_t ncalev[12];
43     Int_t calfl[12];
44     Int_t ped1[12];
45     Int_t ped2[12];
46     Int_t ped3[12];
47     Int_t sig1[12];
48     Int_t sig2[12];
49     Int_t sig3[12];
50     Int_t nbad1[12];
51     Int_t nbad2[12];
52     Int_t nbad3[12];
53     Float_t dspped[12][3702];
54     Float_t dspsig[12][3702];
55     Float_t dspbad[12][3702];
56     Int_t crc_c[12][3];
57     Int_t crc_hc[12];
58     };
59    
60    
61     void FTrkCalibQLook_EXPERT(TString file,Int_t step,Int_t fromevent, Int_t toevent,TString outdir,TString outfile)
62     {
63     //
64     // obtain information about the data file and select the output dir
65 pam-fi 1.6 Int_t dwpos = file.Last('/');
66     Int_t dwpos1 = file.Last('.');
67     TString base,ffile ;
68     ffile=file(dwpos+1,dwpos1-(dwpos+1));
69     if(dwpos>0) base=file(0,dwpos);
70 pam-fi 1.1
71     TString out;
72     if(outdir.Length()==0){
73     out = base;
74     }else{
75     out = outdir;
76     }
77 pam-fi 1.6 if(out.Last('/')+1<out.Length()) out+="/";
78 pam-fi 1.1
79     //
80     // inizialise the variables and open the file
81     Int_t nevents=0;
82     Int_t minevent = 0;
83     Int_t maxevent = 0;
84 pam-fi 1.28 ULong_t FOBT[2];
85 pam-fi 1.1
86     FOBT[0]=0;
87     FOBT[1]=0;
88    
89     struct caltrk_def ctrk;
90     ctrk.good0[0]=0;
91     ctrk.good0[1]=0;
92     for(Int_t i=0;i<12;i++){
93     ctrk.daqmode[i]=0;
94 pam-fi 1.17 ctrk.dspnum[i]=0;
95 pam-fi 1.1 ctrk.calibnum[i]=0;
96     ctrk.ncalev[i]=0;
97     ctrk.calfl[i]=0;
98     ctrk.ped1[i]=0;
99     ctrk.ped2[i]=0;
100     ctrk.ped3[i]=0;
101     ctrk.sig1[i]=0;
102     ctrk.sig2[i]=0;
103     ctrk.sig3[i]=0;
104     ctrk.nbad1[i]=0;
105     ctrk.nbad2[i]=0;
106     ctrk.nbad3[i]=0;
107     ctrk.crc_c[i][0]=0;
108     ctrk.crc_c[i][1]=0;
109     ctrk.crc_c[i][2]=0;
110     ctrk.crc_hc[i]=0;
111     for(Int_t iii=0;iii<3072;iii++){
112     ctrk.dspped[i][iii]=0;
113     ctrk.dspsig[i][iii]=0;
114     ctrk.dspbad[i][iii]=0;
115     };
116    
117     };
118    
119     TFile *calibFile = new TFile(file);
120     if ( !calibFile ){
121     printf("No data file, exiting...\n");
122     return;
123     };
124     TTree *otr1,*otr2,*hotr,*totr;
125     pamela::EventHeader *eh1=0,*eh2=0,*eh4=0,*eh3=0;
126     pamela::PscuHeader *ph=0;
127     pamela::CalibTrk1Event *trk1 = 0;
128 pam-fi 1.8 pamela::CalibTrk2Event *trk2 = 0;
129     pamela::EventCounter *cod=0;
130    
131     pamela::PacketType *pctp=0;
132 pam-fi 1.1
133     hotr = (TTree*)calibFile->Get("CalibHeader");
134     hotr->SetBranchAddress("Header", &eh4);
135    
136     totr = (TTree*)calibFile->Get("CalibTrailer");
137     totr->SetBranchAddress("Header", &eh3);
138    
139     otr1 = (TTree*)calibFile->Get("CalibTrk1");
140     otr1->SetBranchAddress("CalibTrk1", &trk1);
141     otr1->SetBranchAddress("Header",&eh1);
142     otr2 = (TTree*)calibFile->Get("CalibTrk2");
143     otr2->SetBranchAddress("CalibTrk2", &trk2);
144     otr2->SetBranchAddress("Header",&eh2);
145    
146     if(otr1->GetEntries()==otr2->GetEntries())
147     nevents = otr1->GetEntries();
148     else{
149     printf("WARNING: CalibTrk1 entries is different from CalibTrk2 entries");
150     return;}
151     if (nevents<=0) {
152     calibFile->Close();
153     printf("No calibration packets found, exiting...\n");
154     return;
155     };
156    
157     printf("Number of calibration packets: %i\n",nevents);
158    
159     if ( fromevent > toevent && toevent ){
160     printf("It must be fromevent < toevent \n");
161     return;
162     };
163    
164     if ( fromevent > nevents || fromevent < 0 ) {
165     printf("You can choose fromevent between 0 (all) and %i \n",nevents);
166     return;
167     };
168    
169     if ( toevent > nevents || toevent < 0 ) {
170     printf("You can choose toevent between 0 (all) and %i \n",nevents);
171     return;
172     };
173     if ( fromevent == 0 ) {
174     minevent = 0;
175     maxevent = nevents;
176     } else {
177     minevent = fromevent - 1;
178     if ( toevent > 0 ){
179     maxevent = toevent;
180     } else if (toevent > nevents) {
181     maxevent = nevents;
182     } else {
183 pam-fi 1.13 maxevent = nevents;
184 pam-fi 1.1 };
185     };
186    
187     //**********************************************************************
188     //
189     // LOOP OVER EVENTS
190     //
191     //**********************************************************************
192    
193 pam-fi 1.8 Int_t hcevent=hotr->GetEntries();
194 pam-fi 1.11 Int_t tcevent=totr->GetEntries();
195 pam-fi 1.28 ULong_t HOBT[hcevent], TOBT[tcevent];
196 pam-fi 1.8 for (Int_t i = 0; i < hcevent; i++){
197     hotr->GetEntry(i);
198     ph = eh4->GetPscuHeader();
199     HOBT[i]= ph->GetOrbitalTime();
200 pam-fi 1.11 }
201     for (Int_t i = 0; i < tcevent; i++){
202     totr->GetEntry(i);
203 pam-fi 1.8 ph = eh3->GetPscuHeader();
204     TOBT[i]= ph->GetOrbitalTime();
205     }
206    
207 pam-fi 1.1 printf("\n Scan of calibration packets from %i to %i ... \n\n",minevent+1,maxevent);
208     for (Int_t i = minevent; i < maxevent; i++){
209    
210     otr1->GetEntry(i);
211 pam-fi 1.8 otr2->GetEntry(i);
212    
213 pam-fi 1.1 ctrk.good0[0]=trk1->good0;
214     ctrk.good0[1]=trk2->good0;
215     for (Int_t m = 0; m < 6; m++){
216     ph = eh1->GetPscuHeader();
217 pam-fi 1.8 cod = eh1->GetCounter();
218 pam-fi 1.1 FOBT[0]= ph->GetOrbitalTime();
219 pam-fi 1.14 if(trk1->DSPnumber[m]>0){
220     if(trk1->DSPnumber[m]<13){
221     ctrk.daqmode[trk1->DSPnumber[m]-1]=trk1->DAQmode[m];
222     ctrk.dspnum[trk1->DSPnumber[m]-1]=trk1->DSPnumber[m];
223     ctrk.calibnum[trk1->DSPnumber[m]-1]=trk1->calibnumber[m];
224     ctrk.ncalev[trk1->DSPnumber[m]-1]=trk1->ncalib_event[m];
225     ctrk.ped1[trk1->DSPnumber[m]-1]=trk1->ped_l1[m];
226     ctrk.ped2[trk1->DSPnumber[m]-1]=trk1->ped_l2[m];
227     ctrk.ped3[trk1->DSPnumber[m]-1]=trk1->ped_l3[m];
228     ctrk.sig1[trk1->DSPnumber[m]-1]=trk1->sig_l1[m];
229     ctrk.sig2[trk1->DSPnumber[m]-1]=trk1->sig_l2[m];
230     ctrk.sig3[trk1->DSPnumber[m]-1]=trk1->sig_l3[m];
231     ctrk.nbad1[trk1->DSPnumber[m]-1]=trk1->nbad_l1[m];
232     ctrk.nbad2[trk1->DSPnumber[m]-1]=trk1->nbad_l2[m];
233     ctrk.nbad3[trk1->DSPnumber[m]-1]=trk1->nbad_l3[m];
234     ctrk.calfl[trk1->DSPnumber[m]-1]=trk1->cal_flag[m];
235     ctrk.crc_c[trk1->DSPnumber[m]-1][0]=trk1->crc_cal[m][0];
236     ctrk.crc_c[trk1->DSPnumber[m]-1][1]=trk1->crc_cal[m][1];
237     ctrk.crc_c[trk1->DSPnumber[m]-1][2]=trk1->crc_cal[m][2];
238     ctrk.crc_hc[trk1->DSPnumber[m]-1]=trk1->crc_hcal[m];
239     for (Int_t j = 0; j < 3072; j++){
240     ctrk.dspped[trk1->DSPnumber[m]-1][j]=trk1->DSPped_par[m][j];
241     ctrk.dspsig[trk1->DSPnumber[m]-1][j]=trk1->DSPsig_par[m][j];
242     ctrk.dspbad[trk1->DSPnumber[m]-1][j]=trk1->DSPbad_par[m][j];
243     };
244     }
245     }
246 pam-fi 1.1 ph = eh2->GetPscuHeader();
247     FOBT[1]= ph->GetOrbitalTime();
248 pam-fi 1.14 if(trk2->DSPnumber[m]>0){
249     if(trk2->DSPnumber[m]<13){
250     ctrk.daqmode[trk2->DSPnumber[m]-1]=trk2->DAQmode[m];
251     ctrk.dspnum[trk2->DSPnumber[m]-1]=trk2->DSPnumber[m];
252     ctrk.calibnum[trk2->DSPnumber[m]-1]=trk2->calibnumber[m];
253     ctrk.ncalev[trk2->DSPnumber[m]-1]=trk2->ncalib_event[m];
254     ctrk.ped1[trk2->DSPnumber[m]-1]=trk2->ped_l1[m];
255     ctrk.ped2[trk2->DSPnumber[m]-1]=trk2->ped_l2[m];
256     ctrk.ped3[trk2->DSPnumber[m]-1]=trk2->ped_l3[m];
257     ctrk.sig1[trk2->DSPnumber[m]-1]=trk2->sig_l1[m];
258     ctrk.sig2[trk2->DSPnumber[m]-1]=trk2->sig_l2[m];
259     ctrk.sig3[trk2->DSPnumber[m]-1]=trk2->sig_l3[m];
260     ctrk.nbad1[trk2->DSPnumber[m]-1]=trk2->nbad_l1[m];
261     ctrk.nbad2[trk2->DSPnumber[m]-1]=trk2->nbad_l2[m];
262     ctrk.nbad3[trk2->DSPnumber[m]-1]=trk2->nbad_l3[m];
263     ctrk.calfl[trk2->DSPnumber[m]-1]=trk2->cal_flag[m];
264     ctrk.crc_c[trk1->DSPnumber[m]-1][0]=trk2->crc_cal[m][0];
265     ctrk.crc_c[trk1->DSPnumber[m]-1][1]=trk2->crc_cal[m][1];
266     ctrk.crc_c[trk1->DSPnumber[m]-1][2]=trk2->crc_cal[m][2];
267     ctrk.crc_hc[trk1->DSPnumber[m]-1]=trk2->crc_hcal[m];
268     for (Int_t j = 0; j < 3072; j++){
269     ctrk.dspped[trk2->DSPnumber[m]-1][j]=trk2->DSPped_par[m][j];
270     ctrk.dspsig[trk2->DSPnumber[m]-1][j]=trk2->DSPsig_par[m][j];
271     ctrk.dspbad[trk2->DSPnumber[m]-1][j]=trk2->DSPbad_par[m][j];
272     }
273     }
274 pam-fi 1.8 }
275     }
276 pam-fi 1.1
277    
278     //
279     // other variables definitions
280 pam-fi 1.20
281 pam-fi 1.1 Int_t risposta=0;
282 pam-fi 1.30 stringstream fromfile,isfile;
283 pam-fi 1.1
284 pam-fi 1.11 fromfile<<"FTrkCalibQLook_EXPERT File: "<<ffile<<" -- CalibHeader OBT= "<<HOBT[(cod->Get(pctp->CalibHeader))-1]<<" -- Calib pkt OBT= "<<FOBT[0]<<" -- CalibTrailer OBT= "<<TOBT[(cod->Get(pctp->CalibTrailer))]<<" --";
285 pam-fi 1.1
286 pam-fi 1.9 gStyle->SetLabelSize(0.07,"x");
287     gStyle->SetLabelSize(0.07,"y");
288 pam-fi 1.1 gStyle->SetTitleFillColor(10);
289 pam-fi 1.9 gStyle->SetTitleFontSize(0.08);
290 pam-fi 1.1 gStyle->SetTitleOffset(0.8,"y");
291 pam-fi 1.9 gStyle->SetTitleOffset(0.9,"x");
292 pam-fi 1.1 gStyle->SetTitleSize(0.06,"y");
293     gStyle->SetTitleSize(0.06,"x");
294 pam-fi 1.9 gStyle->SetOptStat(101110);
295     gStyle->SetStatX(0.9);
296     gStyle->SetStatW(0.4);
297     gStyle->SetStatColor(10);
298     gStyle->SetStatFontSize(0.1);
299 pam-fi 1.1
300     //
301     // draw display area
302 pam-fi 1.9
303 pam-fi 1.1 TLatex *tzz=new TLatex();
304     tzz->SetTextFont(32);
305     tzz->SetTextColor(1);
306     tzz->SetTextAlign(12);
307     tzz->SetTextSize(0.019);
308     Int_t canvasx=1200;
309     Int_t canvasy=900;
310     TCanvas *c1 = new TCanvas("c1","FTrkCalibQLook_EXPERT_ped",canvasx,canvasy);
311     c1->SetFillColor(10);
312 pam-fi 1.30 tzz->DrawLatex(.01,.98,fromfile.str().c_str());
313     tzz->DrawLatex(.90,.98,"PEDESTAL");
314    
315 pam-fi 1.32 isfile<<"Chips with white line at least once showed anomalous behaviour";
316     tzz->SetTextColor(17);
317 pam-fi 1.30 tzz->SetTextSize(0.018);
318 pam-fi 1.32 tzz->DrawLatex(.01,.96,isfile.str().c_str());
319 pam-fi 1.30 isfile.str("");
320    
321     isfile<<"Boxes so colored point out anomalous chips (not necessarily broken)";
322     tzz->SetTextColor(107);
323 pam-fi 1.31 // tzz->DrawLatex(.05,.96,isfile.str().c_str());
324 pam-fi 1.30 isfile.str("");
325    
326 pam-fi 1.1 TCanvas *c2 = new TCanvas("c2","FTrkCalibQLook_EXPERT_sig",canvasx,canvasy);
327     c2->SetFillColor(10);
328 pam-fi 1.30 tzz->SetTextColor(1);
329     tzz->DrawLatex(.01,.98,fromfile.str().c_str());
330     tzz->DrawLatex(.90,.98,"SIGMA");
331    
332 pam-fi 1.31 isfile<<"Chips with white line at least once showed anomalous behaviour";
333     tzz->SetTextColor(17);
334 pam-fi 1.30 tzz->SetTextSize(0.018);
335 pam-fi 1.31 tzz->DrawLatex(.01,.96,isfile.str().c_str());
336 pam-fi 1.30 isfile.str("");
337    
338     isfile<<"Boxes so colored point out anomalous chips (not necessarily broken)";
339     tzz->SetTextColor(107);
340 pam-fi 1.31 // tzz->DrawLatex(.05,.96,isfile.str().c_str());
341 pam-fi 1.30 isfile.str("");
342 pam-fi 1.1
343 pam-fi 1.9
344     TCanvas *sig=new TCanvas("sig","FTrkCalibQLook_EXPERT_histosig",canvasx,canvasy);
345     sig->SetFillColor(10);
346 pam-fi 1.30 tzz->SetTextColor(1);
347     tzz->DrawLatex(.01,.98,fromfile.str().c_str());
348     tzz->DrawLatex(.85,.97,"Histograms of the sigmas");
349 pam-fi 1.9
350    
351    
352 pam-fi 1.1 // draw pads
353 pam-fi 1.9 TPad *trkpad1[12],*trkpad2[12],*trkpad3[36]; //pad for histos
354 pam-fi 1.1 TPaveText *trkpadtext[12]; //pad for header
355     TH1F *histosig[12]; //histos of sigma
356     TH1F *histoped[12]; //histos of pedestals
357     TH1F *histoasig[12]; //histos of sigma
358     TH1F *histoaped[12]; //histos of pedestals
359 pam-fi 1.9
360     TH1F *histosiglad[12][3]; //histos of sigma
361     stringstream title;
362     stringstream hid;
363 pam-fi 1.1
364 pam-fi 1.3 Float_t posy = 0.95; // up y-coord - top pads
365     Float_t hpad = 0.15; // pad height
366     Float_t posx1=0; // left x-coord - pad column
367     Float_t posx2=0; // right x-coord - pad olumn
368     Float_t posx0=0; // x-coord - column division
369     Float_t wrel = 0.6; // relative x size of first sub-column
370     Float_t marg = 0.004; // margin among pads
371 pam-fi 1.1
372 pam-fi 1.9
373 pam-fi 1.1 for(Int_t n = 0; n<12; n++){
374     if ( (n+1)%2 ) {
375     if(n>1)posy = posy-(marg*2+hpad);
376     posx1 = marg;
377     posx2 = 0.5 - marg;
378     posx0 = 0.5*wrel;
379 pam-fi 1.9
380 pam-fi 1.1 } else {
381     posx1 = posx1 + 0.5;
382     posx2 = posx2 + 0.5;
383     posx0 = posx0 + 0.5;
384 pam-fi 1.9
385 pam-fi 1.1 };
386     /* -----------> pad for histograms */
387     trkpad1[n] = new TPad("pad1"," ",posx1,posy-hpad,posx0-marg,posy,18,0,0);
388     trkpad2[n] = new TPad("pad2"," ",posx1,posy-hpad,posx0-marg,posy,18,0,0);
389     /* -----------> pad for header dump */
390     trkpadtext[n] = new TPaveText((posx0+marg),(posy-hpad),posx2,posy);
391     /* -----------> HISTOGRAMS */
392     /* calibration parameters */
393     title<<"DSP "<<n+1;
394 pam-fi 1.4 hid<<"h"<<n<<"i"<<i;
395 pam-fi 1.1 histosig[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3072,0.5,3072.5);
396     hid.str("");
397 pam-fi 1.4 hid<<"hh"<<n<<"i"<<i;
398 pam-fi 1.1 histoped[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3072,0.5,3072.5);
399     hid.str("");
400 pam-fi 1.4 hid<<"hhh"<<n<<"i"<<i;
401 pam-fi 1.1 hid.str("");
402     /* AVERAGE calibration parameters */
403 pam-fi 1.4 hid<<"ah"<<n<<"i"<<i;
404 pam-fi 1.1 histoasig[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3,0.5,3072.5);
405     hid.str("");
406 pam-fi 1.4 hid<<"ahh"<<n<<"i"<<i;
407 pam-fi 1.1 histoaped[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3,0.5,3072.5);
408     hid.str("");
409 pam-fi 1.9 for(int ii=0;ii<3;ii++){
410     title.str("");
411     title<<"DSP "<<n+1<<" / Lad "<<ii+1;
412     hid<<"hhhh"<<n<<"i"<<i<<"ii"<<ii;
413     histosiglad[n][ii] = new TH1F(hid.str().c_str(),title.str().c_str(),32,-0.5,30.5);
414     hid.str("");
415     }
416     title.str("");
417 pam-fi 1.1 }; //end loop on views
418 pam-fi 1.9
419     Float_t tposy = 0.95; // up y-coord - top pads
420     Float_t thpad = 0.; // pad height
421     Float_t tposx1=0; // left x-coord - pad column
422     Float_t tposx0=0; // x-coord - column division
423     Float_t twrel = 0.; // relative x size of first sub-column
424     Float_t tmarg = 0.002; // margin among pads
425     thpad = (tposy-tmarg*11)/6;
426     twrel = (1-tmarg*12)/6;
427    
428     for(Int_t n = 0; n<36; n++){
429     if ( (n+1)%6==1 ) {
430     if(n>1) tposy = tposy-(tmarg*2+thpad);
431     tposx1 = tmarg;
432     tposx0 = tposx1 + twrel;
433     } else {
434     tposx1 = tposx0 + 2*tmarg;
435     tposx0 = tposx1 + twrel;
436     }
437     trkpad3[n]= new TPad("pad3"," ",tposx1,tposy-thpad,tposx0,tposy,18,0,0);
438     }
439    
440    
441 pam-fi 1.1 stringstream message;
442 pam-fi 1.9
443 pam-fi 1.1 //--------------------------------
444     //CHECK CALIBRATION procedure
445     //--------------------------------
446     Int_t nn=0;
447     Int_t calok = 0;//BAD
448     for(Int_t n = 0; n<12; n++){
449     if(ctrk.ncalev[n]==0 && ctrk.calfl[n]==0)calok = 1;//GOOD
450 pam-fi 1.9
451 pam-fi 1.17 if(ctrk.dspnum[n]==0)
452 pam-fi 1.16 continue;
453    
454 pam-fi 1.1 nn=ctrk.dspnum[n]-1;
455     /*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*
456     *
457     * Write event LEVEL0 report
458     *
459     *.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/
460     trkpadtext[nn]->SetTextFont(40);
461     trkpadtext[nn]->SetFillColor(33);
462     if(calok==0)trkpadtext[nn]->SetFillColor(2);
463     trkpadtext[nn]->SetTextSize(0.013);
464     trkpadtext[nn]->SetTextAlign(13);
465     trkpadtext[nn]->SetTextColor(1);
466    
467     trkpadtext[nn]->AddText(" ");
468     message<<"DSP num --------> "<<ctrk.dspnum[n];
469     trkpadtext[nn]->AddText(message.str().c_str());
470     message.str("");
471     message<<"DAQ mode -------> "<<ctrk.daqmode[n];
472     trkpadtext[nn]->AddText(message.str().c_str());
473     message.str("");
474     message<<"Calibnumber ----> "<<ctrk.calibnum[n];
475     trkpadtext[nn]->AddText(message.str().c_str());
476     message.str("");
477     message<<"ncalib_event ---> "<<ctrk.ncalev[n];
478     trkpadtext[nn]->AddText(message.str().c_str());
479     message.str("");
480     message<<"Cal_flag -------> "<<ctrk.calfl[n];
481     trkpadtext[nn]->AddText(message.str().c_str());
482     message.str("");
483     message<<"crc_hcal -------> "<<ctrk.crc_hc[n];
484     trkpadtext[nn]->AddText(message.str().c_str());
485     message.str("");
486     message<<"crc_cal: l1- ";message.width(5);message<< ctrk.crc_c[n][0];
487     message<<" l2- ";message.width(5);message<< ctrk.crc_c[n][1];
488     message<<" l3- ";message.width(5);message<< ctrk.crc_c[n][2];
489     trkpadtext[nn]->AddText(message.str().c_str());
490     message.str("");
491     message<<"<PED>: l1- "; message.width(5);message<< ctrk.ped1[n];
492     message<<" l2-"; message.width(5);message<< ctrk.ped2[n];
493     message<<" l3-"; message.width(5);message<< ctrk.ped3[n];
494     trkpadtext[nn]->AddText(message.str().c_str());
495     message.str("");
496     message<<"<SIG>: l1- "; message.width(5);message<< ctrk.sig1[n];
497     message<<" l2-"; message.width(5);message<< ctrk.sig2[n];
498     message<<" l3-"; message.width(5);message<< ctrk.sig3[n];
499     trkpadtext[nn]->AddText(message.str().c_str());
500     message.str("");
501     message<<"n.BAD: l1- "; message.width(5);message<<ctrk.nbad1[n];
502     message<<" l2-"; message.width(5);message<< ctrk.nbad2[n];
503     message<<" l3-"; message.width(5);message<< ctrk.nbad3[n];
504     trkpadtext[nn]->AddText(message.str().c_str());
505     message.str("");
506    
507     if(calok==0){
508    
509     message.str("*** FAILED ***");
510     TText *t=trkpadtext[nn]->AddText(message.str().c_str());
511     t->SetTextSize(0.02);
512     t->SetTextAlign(23);
513     t->SetTextColor(5);
514     };
515    
516     /*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*
517     *
518     * Plot histo
519     *
520     *.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/
521    
522    
523     /******************************************************/
524     /* fill histos */
525     for(Int_t j = 0; j < 3072; j++){
526 pam-fi 1.16 histosig[nn]->Fill(j,ctrk.dspsig[n][j]);
527     histoped[nn]->Fill(j,ctrk.dspped[n][j]);
528     if(j<1024) histosiglad[nn][0]->Fill(ctrk.dspsig[n][j]);
529     if(j>=1024 && j<2048) histosiglad[nn][1]->Fill(ctrk.dspsig[n][j]);
530     if(j>=2048 && j<3072) histosiglad[nn][2]->Fill(ctrk.dspsig[n][j]);
531 pam-fi 1.1 };
532 pam-fi 1.16 histoasig[nn]->Fill(1,ctrk.sig1[n]);
533     histoasig[nn]->Fill(1025,ctrk.sig2[n]);
534     histoasig[nn]->Fill(2049,ctrk.sig3[n]);
535 pam-fi 1.1 histoaped[nn]->Fill(1,ctrk.ped1[nn]);
536 pam-fi 1.16 histoaped[nn]->Fill(1025,ctrk.ped2[n]);
537     histoaped[nn]->Fill(2049,ctrk.ped3[n]);
538 pam-fi 1.1 /******************************************************/
539 pam-fi 1.20
540     TLine li,liva1;
541 pam-fi 1.1 li.SetLineColor(38);
542 pam-fi 1.20 li.SetLineStyle(4);
543 pam-fi 1.1 li.SetLineWidth(2);
544 pam-fi 1.20 liva1.SetLineColor(42);
545     liva1.SetLineStyle(3);
546     liva1.SetLineWidth(1);
547    
548 pam-fi 1.31 Float_t maxhist=0,va1x=0,minhist=0.;
549 pam-fi 1.2 TBox b;
550 pam-fi 1.1 /* plot PEDESTAL */
551     c1->cd();
552     trkpadtext[nn]->Draw();
553     trkpad1[nn]->Draw();
554     trkpad1[nn]->cd();
555     trkpad1[nn]->SetFillColor(10);
556     trkpad1[nn]->SetFrameFillColor(10);
557 pam-fi 1.9 histoped[nn]->SetStats(kFALSE);
558 pam-fi 1.1 histoped[nn]->SetLineColor(1);
559     histoped[nn]->SetFillColor(12);
560     histoped[nn]->SetLineWidth(1);
561     histoped[nn]->GetYaxis()->SetTitle("PED (ADC channels)");
562     histoped[nn]->GetYaxis()->CenterTitle();
563 pam-fi 1.2 if((nn+1)%2==1) histoped[nn]->GetYaxis()->SetRangeUser(2200,3200);
564     if((nn+1)%2==0) histoped[nn]->GetYaxis()->SetRangeUser(700,1700);
565 pam-fi 1.1 histoaped[nn]->SetLineColor(5);
566     histoaped[nn]->SetLineWidth(1);
567 pam-fi 1.31 // if(ctrk.good0[0]==1 && ctrk.good0[1]==1){
568     histoped[nn]->Draw("b");
569     maxhist=histoped[nn]->GetMaximum();
570     if(nn%2==0) minhist=2200;
571     else minhist=700;
572     b.SetFillColor(19);
573     b.SetFillStyle(3954);
574     if(nn==0){
575     b.DrawBox(0.,minhist,2047.,maxhist);
576     }
577     else if(nn==1){
578     b.DrawBox(128.,minhist,256.,maxhist);
579     b.DrawBox(384.,minhist,512.,maxhist);
580     b.DrawBox(896.,minhist,1024.,maxhist);
581     b.DrawBox(2048.,minhist,2432.,maxhist);
582     b.DrawBox(2816.,minhist,2944.,maxhist);
583     b.DrawBox(2944.,minhist,3070.,maxhist);
584     }
585     else if(nn==3){
586     b.DrawBox(0.,minhist,256.,maxhist);
587     b.DrawBox(2816.,minhist,3070.,maxhist);
588     }
589     else if(nn==4){
590     b.DrawBox(256.,minhist,512.,maxhist);
591     b.DrawBox(1792.,minhist,1920.,maxhist);
592     b.DrawBox(2816.,minhist,3070.,maxhist);
593     }
594     else if(nn==5){
595     b.DrawBox(0.,minhist,256.,maxhist);
596     b.DrawBox(896.,minhist,1024.,maxhist);
597     b.DrawBox(1664.,minhist,1792.,maxhist);
598     }
599     else if(nn==6){
600     b.DrawBox(512.,minhist,768.,maxhist);
601     b.DrawBox(1024.,minhist,1280.,maxhist);
602     b.DrawBox(1280.,minhist,1792.,maxhist);
603     b.DrawBox(2560.,minhist,2816.,maxhist);
604     }
605     else if(nn==7){
606     b.DrawBox(0.,minhist,1535.,maxhist);
607     b.DrawBox(2024.,minhist,2280.,maxhist);
608     }
609     else if(nn==8){
610     b.DrawBox(512.,minhist,768.,maxhist);
611     }
612     else if(nn==9){
613     b.DrawBox(0.,minhist,128.,maxhist);
614     b.DrawBox(256.,minhist,384.,maxhist);
615     b.DrawBox(512.,minhist,640.,maxhist);
616     b.DrawBox(896.,minhist,1152.,maxhist);
617     b.DrawBox(1280.,minhist,1535.,maxhist);
618     b.DrawBox(1664.,minhist,1920.,maxhist);
619     b.DrawBox(2048.,minhist,2304.,maxhist);
620     }
621     else if(nn==10){
622     b.DrawBox(0.,minhist,512.,maxhist);
623     b.DrawBox(1024.,minhist,3070.,maxhist);
624     }
625     else if(nn==11){
626     b.DrawBox(0.,minhist,512.,maxhist);
627     b.DrawBox(768.,minhist,1024.,maxhist);
628     b.DrawBox(1536.,minhist,1664.,maxhist);
629     b.DrawBox(1920.,minhist,2560.,maxhist);
630     b.DrawBox(2816.,minhist,3070.,maxhist);
631     }
632     // }
633     // else histoped[nn]->Draw("axis");
634 pam-fi 1.1 histoaped[nn]->Draw("same");
635     if((nn+1)%2==1) {
636 pam-fi 1.20 for(int va=1; va<24; va++){
637     va1x=128*va;
638     liva1.DrawLine(va1x,2200.,va1x,3200.);
639     }
640     li.DrawLine(1024.5,2200.,1024.5,3200.);
641     li.DrawLine(2048.5,2200.,2048.5,3200.);
642 pam-fi 1.1 }
643     if((nn+1)%2==0) {
644 pam-fi 1.20 for(int va=1; va<24; va++){
645     va1x=128*va;
646     liva1.DrawLine(va1x,700.,va1x,1700.);
647     }
648 pam-fi 1.2 li.DrawLine(1024.5,700,1024.5,1700);
649     li.DrawLine(2048.5,700,2048.5,1700);
650 pam-fi 1.1 }
651 pam-fi 1.16 c1->Update();//draw pads in canvas
652 pam-fi 1.1
653 pam-fi 1.2
654 pam-fi 1.1
655     /* plot SIGMA */
656 pam-fi 1.3 Float_t max=500.;
657 pam-fi 1.1 c2->cd();
658     trkpadtext[nn]->Draw();
659     trkpad2[nn]->SetLogy();
660     trkpad2[nn]->Draw();
661     trkpad2[nn]->cd();
662     trkpad2[nn]->SetFillColor(10);
663     trkpad2[nn]->SetFrameFillColor(10);
664 pam-fi 1.9 histosig[nn]->SetStats(kFALSE);
665 pam-fi 1.1 histosig[nn]->SetLineColor(1);
666     histosig[nn]->SetFillColor(12);
667     histosig[nn]->SetLineWidth(1);
668     histosig[nn]->SetMaximum(max);
669     histosig[nn]->SetMinimum(0.5);
670     histosig[nn]->GetYaxis()->SetTitle("SIG (ADC channels)");
671     histosig[nn]->GetYaxis()->CenterTitle();
672     histoasig[nn]->SetLineColor(5);
673     histoasig[nn]->SetLineWidth(1);
674 pam-fi 1.31 // if(ctrk.good0[0]==1 && ctrk.good0[1]==1){
675     histosig[nn]->Draw("b");
676     maxhist=histosig[nn]->GetMaximum();
677     minhist=0.;
678     b.SetFillColor(19);
679     b.SetFillStyle(3945);
680     if(nn==0){
681     b.DrawBox(0.,minhist,2047.,maxhist);
682     }
683     else if(nn==1){
684     b.DrawBox(128.,minhist,256.,maxhist);
685     b.DrawBox(384.,minhist,512.,maxhist);
686     b.DrawBox(896.,minhist,1024.,maxhist);
687     b.DrawBox(2048.,minhist,2432.,maxhist);
688     b.DrawBox(2816.,minhist,2944.,maxhist);
689     b.DrawBox(2944.,minhist,3070.,maxhist);
690     }
691     else if(nn==3){
692     b.DrawBox(0.,minhist,256.,maxhist);
693     b.DrawBox(2816.,minhist,3070.,maxhist);
694     }
695     else if(nn==4){
696     b.DrawBox(256.,minhist,512.,maxhist);
697     b.DrawBox(1792.,minhist,1920.,maxhist);
698     b.DrawBox(2816.,minhist,3070.,maxhist);
699     }
700     else if(nn==5){
701     b.DrawBox(0.,minhist,256.,maxhist);
702     b.DrawBox(896.,minhist,1024.,maxhist);
703     b.DrawBox(1664.,minhist,1792.,maxhist);
704     }
705     else if(nn==6){
706     b.DrawBox(512.,minhist,768.,maxhist);
707     b.DrawBox(1024.,minhist,1280.,maxhist);
708     b.DrawBox(1280.,minhist,1792.,maxhist);
709     b.DrawBox(2560.,minhist,2816.,maxhist);
710     }
711     else if(nn==7){
712     b.DrawBox(0.,minhist,1535.,maxhist);
713     b.DrawBox(2024.,minhist,2280.,maxhist);
714     }
715     else if(nn==8){
716     b.DrawBox(512.,minhist,768.,maxhist);
717     }
718     else if(nn==9){
719     b.DrawBox(0.,minhist,128.,maxhist);
720     b.DrawBox(256.,minhist,384.,maxhist);
721     b.DrawBox(512.,minhist,640.,maxhist);
722     b.DrawBox(896.,minhist,1152.,maxhist);
723     b.DrawBox(1280.,minhist,1535.,maxhist);
724     b.DrawBox(1664.,minhist,1920.,maxhist);
725     b.DrawBox(2048.,minhist,2304.,maxhist);
726     }
727     else if(nn==10){
728     b.DrawBox(0.,minhist,512.,maxhist);
729     b.DrawBox(1024.,minhist,3070.,maxhist);
730     }
731     else if(nn==11){
732     b.DrawBox(0.,minhist,512.,maxhist);
733     b.DrawBox(768.,minhist,1024.,maxhist);
734     b.DrawBox(1536.,minhist,1664.,maxhist);
735     b.DrawBox(1920.,minhist,2560.,maxhist);
736     b.DrawBox(2816.,minhist,3070.,maxhist);
737     }
738     // }
739     // else histosig[nn]->Draw("axis");
740 pam-fi 1.1 histoasig[nn]->Draw("same");
741 pam-fi 1.20 for(int va=1; va<24; va++){
742     va1x=128*va;
743     liva1.DrawLine(va1x,0.,va1x,max);
744     }
745 pam-fi 1.1 li.DrawLine(1024.5,0,1024.5,max);
746     li.DrawLine(2048.5,0,2048.5,max);
747 pam-fi 1.20 c2->Update();//draw pads in canvas
748 pam-fi 1.2
749 pam-fi 1.9 for(int ii=0;ii<3;ii++){
750     sig->cd();
751     trkpad3[nn*3+ii]->Draw();
752     trkpad3[nn*3+ii]->cd();
753     trkpad3[nn*3+ii]->SetFillColor(10);
754     trkpad3[nn*3+ii]->SetFrameFillColor(10);
755     trkpad3[nn*3+ii]->SetLogy();
756     histosiglad[nn][ii]->SetLineColor(1);
757     histosiglad[nn][ii]->SetFillColor(1);
758     histosiglad[nn][ii]->SetLineWidth(1);
759     histosiglad[nn][ii]->GetXaxis()->SetTitle("SIG (ADC channels)");
760     histosiglad[nn][ii]->GetXaxis()->CenterTitle();
761     histosiglad[nn][ii]->Draw("");
762 pam-fi 1.16 }
763    
764 pam-fi 1.1 };//end loop on views
765     c1->Update();//draw pads in canvas
766     c2->Update();//draw pads in canvas
767 pam-fi 1.9 sig->Update();//draw pads in canvas
768    
769     stringstream nom1,nom2,nom3;
770    
771 pam-fi 1.1 if(!strcmp(outfile.Data(),"ps")||!strcmp(outfile.Data(),"pdf")){
772     nom1.str("");
773     nom2.str("");
774 pam-fi 1.9 nom3.str("");
775 pam-fi 1.1 nom1<<out<<ffile<<"_FTrkCalibQLook_EXPERT-pkt"<<i+1<<".ps(";
776 pam-fi 1.9 nom2<<out<<ffile<<"_FTrkCalibQLook_EXPERT-pkt"<<i+1<<".ps";
777     nom3<<out<<ffile<<"_FTrkCalibQLook_EXPERT-pkt"<<i+1<<".ps)";
778 pam-fi 1.1 c1->Print(nom1.str().c_str(),"Landscape");
779     c2->Print(nom2.str().c_str(),"Landscape");
780 pam-fi 1.9 sig->Print(nom3.str().c_str(),"Landscape");
781    
782 pam-fi 1.1 if(!strcmp(outfile.Data(),"pdf")){
783     stringstream com;
784     com<<"ps2pdf13 "<<out<<ffile<<"_FTrkCalibQLook_EXPERT-pkt"<<i+1<<".ps "<<out<<ffile<<"_FTrkCalibQlook_EXPERT-pkt"<<i+1<<".pdf";
785     system(com.str().c_str());
786     printf("\n---> ps file converted in pdf format!\n");
787     com.str("");
788     com<<"rm -f "<<out<<ffile<<"_FTrkCalibQLook_EXPERT-pkt"<<i+1<<".ps";
789     system(com.str().c_str());
790     printf("---> ps file removed!\n\n");
791     com.str("");
792     }
793     }
794     else{
795     nom1.str("");
796     nom2.str("");
797 pam-fi 1.9 nom3.str("");
798 pam-fi 1.1 nom1<<out<<ffile<<"_FTrkCalibQLook_EXPERT-ped-pkt"<<i+1<<"."<<outfile.Data();
799     nom2<<out<<ffile<<"_FTrkCalibQLook_EXPERT-sig-pkt"<<i+1<<"."<<outfile.Data();
800 pam-fi 1.9 nom3<<out<<ffile<<"_FTrkCalibQLook_EXPERT-histosig-pkt"<<i+1<<"."<<outfile.Data();
801 pam-fi 1.1 c1->Print(nom1.str().c_str());
802     c2->Print(nom2.str().c_str());
803 pam-fi 1.9 sig->Print(nom3.str().c_str());
804 pam-fi 1.1 }
805 pam-fi 1.9
806 pam-fi 1.1 if(step==1 && i!=maxevent-1 ){
807     printf("\n Press 1<enter> to continue, 2<enter> to quit.\n");
808     cin>>risposta;
809     if ( i != maxevent-1 ) {
810     if ( risposta == 2 ) {
811     gROOT->Reset();
812     printf("Exiting...\n");
813     return;
814     }
815     }
816     }
817     };//end loop on events
818    
819     gROOT->Reset();
820     printf("... end of packets. \n");
821     return;
822     }
823    
824    

  ViewVC Help
Powered by ViewVC 1.1.23