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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by pam-fi, Wed May 10 10:06:54 2006 UTC revision 1.33 by mocchiut, Fri Jan 17 15:10:39 2014 UTC
# Line 1  Line 1 
1  /**  /**
2   * FTrkCalibQLookExpert.cpp   * FTrkCalibQLookExpert.cxx
3   *   *
4   * autor: D.Fedele   * autor: D.Fedele
5   * version 2.0   * version v1r28
6   * Parameters:   * Parameters:
7   *      file - the data file to analyze   *      file - the data file to analyze
8   *      step - select =1 in order to analyze one event at time   *      step - select =1 in order to analyze one event at time
# Line 18  Line 18 
18  #include <TPaveText.h>  #include <TPaveText.h>
19  #include <TLatex.h>  #include <TLatex.h>
20  #include <TCanvas.h>  #include <TCanvas.h>
21    #include <TFile.h>
22  #include <TTree.h>  #include <TTree.h>
23  #include <TGraph.h>  #include <TGraph.h>
24  #include <TStyle.h>  #include <TStyle.h>
25  #include <TString.h>  #include <TString.h>
26    #include <TAxis.h>
27    #include <TH1F.h>
28    #include <TROOT.h>
29    #include <cstdlib>
30  //  //
31  #include <PscuHeader.h>  #include <PscuHeader.h>
32  #include <EventHeader.h>  #include <EventHeader.h>
# Line 29  Line 34 
34  #include <CalibTrk2Event.h>  #include <CalibTrk2Event.h>
35  //  //
36    
37    struct caltrk_def{
 void stringcopy(TString& s1, const TString& s2, Int_t from=0, Int_t to=0){      
     if ( to == 0 ){  
         Int_t t2length = s2.Length();  
         s1 = "";  
         to = t2length;  
     };  
     for (Int_t i = from; i<to; i++){  
         s1.Append(s2[i],1);  
     };  
 };  
   
  typedef struct caltrk_def{  
38    Int_t good0[2];    Int_t good0[2];
39    Int_t daqmode[12];    Int_t daqmode[12];
40    Int_t dspnum[12];    Int_t dspnum[12];
# Line 69  void FTrkCalibQLook_EXPERT(TString file, Line 62  void FTrkCalibQLook_EXPERT(TString file,
62  {    {  
63    //    //
64    //   obtain information about the data file and select the output dir    //   obtain information about the data file and select the output dir
65    const string filepath=file.Data();    Int_t dwpos = file.Last('/');
66    Int_t dwpos = filepath.rfind("DW_");    Int_t dwpos1 = file.Last('.');
67    Int_t dwpos1 = filepath.find(".root");    TString base,ffile ;
68    TString fpath=(filepath.c_str());    ffile=file(dwpos+1,dwpos1-(dwpos+1));
69    TString base,ffile;    if(dwpos>0) base=file(0,dwpos);
   stringcopy(base,fpath,0,dwpos);  
   stringcopy(ffile,fpath,dwpos,dwpos1);  
70    
71    TString out;    TString out;
72    if(outdir.Length()==0){    if(outdir.Length()==0){
# Line 83  void FTrkCalibQLook_EXPERT(TString file, Line 74  void FTrkCalibQLook_EXPERT(TString file,
74    }else{    }else{
75      out = outdir;      out = outdir;
76    }    }
77      if(out.Last('/')+1<out.Length()) out+="/";
78    
79    //    //
80    // inizialise the variables and open the file    // inizialise the variables and open the file
81    Int_t nevents=0;    Int_t nevents=0;
82    Int_t minevent = 0;    Int_t minevent = 0;
83    Int_t maxevent = 0;    Int_t maxevent = 0;
84    ULong64_t FOBT[2], HOBT=0, TOBT=0;    ULong_t FOBT[2];
85        
86    FOBT[0]=0;    FOBT[0]=0;
87    FOBT[1]=0;    FOBT[1]=0;
# Line 133  void FTrkCalibQLook_EXPERT(TString file, Line 125  void FTrkCalibQLook_EXPERT(TString file,
125    pamela::EventHeader *eh1=0,*eh2=0,*eh4=0,*eh3=0;    pamela::EventHeader *eh1=0,*eh2=0,*eh4=0,*eh3=0;
126    pamela::PscuHeader *ph=0;    pamela::PscuHeader *ph=0;
127    pamela::CalibTrk1Event *trk1 = 0;    pamela::CalibTrk1Event *trk1 = 0;
128    pamela::CalibTrk2Event *trk2 = 0;        pamela::CalibTrk2Event *trk2 = 0;
129      pamela::EventCounter *cod=0;  
130      
131      pamela::PacketType *pctp=0;  
132        
133    hotr = (TTree*)calibFile->Get("CalibHeader");    hotr = (TTree*)calibFile->Get("CalibHeader");
134    hotr->SetBranchAddress("Header", &eh4);    hotr->SetBranchAddress("Header", &eh4);
# Line 185  void FTrkCalibQLook_EXPERT(TString file, Line 180  void FTrkCalibQLook_EXPERT(TString file,
180      } else if (toevent > nevents) {              } else if (toevent > nevents) {        
181        maxevent = nevents;        maxevent = nevents;
182      } else {            } else {      
183        maxevent = fromevent;        maxevent = nevents;
184      };      };
185    };    };
186            
# Line 195  void FTrkCalibQLook_EXPERT(TString file, Line 190  void FTrkCalibQLook_EXPERT(TString file,
190    //    //
191    //**********************************************************************    //**********************************************************************
192            
193      Int_t hcevent=hotr->GetEntries();
194      Int_t tcevent=totr->GetEntries();
195      ULong_t HOBT[hcevent], TOBT[tcevent];
196      for (Int_t i = 0; i < hcevent; i++){
197        hotr->GetEntry(i);
198        ph = eh4->GetPscuHeader();
199        HOBT[i]= ph->GetOrbitalTime();
200      }
201      for (Int_t i = 0; i < tcevent; i++){
202        totr->GetEntry(i);
203        ph = eh3->GetPscuHeader();
204        TOBT[i]= ph->GetOrbitalTime();
205      }
206        
207    printf("\n Scan of calibration packets from %i to %i ... \n\n",minevent+1,maxevent);    printf("\n Scan of calibration packets from %i to %i ... \n\n",minevent+1,maxevent);
208    for (Int_t i = minevent; i < maxevent; i++){        for (Int_t i = minevent; i < maxevent; i++){    
209            
210      otr1->GetEntry(i);      otr1->GetEntry(i);
211      otr2->GetEntry(i);      otr2->GetEntry(i);
212      totr->GetEntry(i);      
     hotr->GetEntry(i);  
     ph = eh4->GetPscuHeader();  
     HOBT= ph->GetOrbitalTime();  
     ph = eh3->GetPscuHeader();  
     TOBT= ph->GetOrbitalTime();  
         
213      ctrk.good0[0]=trk1->good0;      ctrk.good0[0]=trk1->good0;
214      ctrk.good0[1]=trk2->good0;      ctrk.good0[1]=trk2->good0;
215      for (Int_t m = 0; m < 6; m++){      for (Int_t m = 0; m < 6; m++){
216        ph = eh1->GetPscuHeader();        ph = eh1->GetPscuHeader();
217          cod = eh1->GetCounter();
218        FOBT[0]= ph->GetOrbitalTime();        FOBT[0]= ph->GetOrbitalTime();
219        ctrk.daqmode[trk1->DSPnumber[m]-1]=trk1->DAQmode[m];        if(trk1->DSPnumber[m]>0){
220        ctrk.dspnum[trk1->DSPnumber[m]-1]=trk1->DSPnumber[m];          if(trk1->DSPnumber[m]<13){
221        ctrk.calibnum[trk1->DSPnumber[m]-1]=trk1->calibnumber[m];            ctrk.daqmode[trk1->DSPnumber[m]-1]=trk1->DAQmode[m];
222        ctrk.ncalev[trk1->DSPnumber[m]-1]=trk1->ncalib_event[m];            ctrk.dspnum[trk1->DSPnumber[m]-1]=trk1->DSPnumber[m];
223        ctrk.ped1[trk1->DSPnumber[m]-1]=trk1->ped_l1[m];            ctrk.calibnum[trk1->DSPnumber[m]-1]=trk1->calibnumber[m];
224        ctrk.ped2[trk1->DSPnumber[m]-1]=trk1->ped_l2[m];            ctrk.ncalev[trk1->DSPnumber[m]-1]=trk1->ncalib_event[m];
225        ctrk.ped3[trk1->DSPnumber[m]-1]=trk1->ped_l3[m];            ctrk.ped1[trk1->DSPnumber[m]-1]=trk1->ped_l1[m];
226        ctrk.sig1[trk1->DSPnumber[m]-1]=trk1->sig_l1[m];            ctrk.ped2[trk1->DSPnumber[m]-1]=trk1->ped_l2[m];
227        ctrk.sig2[trk1->DSPnumber[m]-1]=trk1->sig_l2[m];            ctrk.ped3[trk1->DSPnumber[m]-1]=trk1->ped_l3[m];
228        ctrk.sig3[trk1->DSPnumber[m]-1]=trk1->sig_l3[m];            ctrk.sig1[trk1->DSPnumber[m]-1]=trk1->sig_l1[m];
229        ctrk.nbad1[trk1->DSPnumber[m]-1]=trk1->nbad_l1[m];            ctrk.sig2[trk1->DSPnumber[m]-1]=trk1->sig_l2[m];
230        ctrk.nbad2[trk1->DSPnumber[m]-1]=trk1->nbad_l2[m];            ctrk.sig3[trk1->DSPnumber[m]-1]=trk1->sig_l3[m];
231        ctrk.nbad3[trk1->DSPnumber[m]-1]=trk1->nbad_l3[m];            ctrk.nbad1[trk1->DSPnumber[m]-1]=trk1->nbad_l1[m];
232        ctrk.calfl[trk1->DSPnumber[m]-1]=trk1->cal_flag[m];            ctrk.nbad2[trk1->DSPnumber[m]-1]=trk1->nbad_l2[m];
233        ctrk.crc_c[trk1->DSPnumber[m]-1][0]=trk1->crc_cal[m][0];            ctrk.nbad3[trk1->DSPnumber[m]-1]=trk1->nbad_l3[m];
234        ctrk.crc_c[trk1->DSPnumber[m]-1][1]=trk1->crc_cal[m][1];            ctrk.calfl[trk1->DSPnumber[m]-1]=trk1->cal_flag[m];
235        ctrk.crc_c[trk1->DSPnumber[m]-1][2]=trk1->crc_cal[m][2];            ctrk.crc_c[trk1->DSPnumber[m]-1][0]=trk1->crc_cal[m][0];
236        ctrk.crc_hc[trk1->DSPnumber[m]-1]=trk1->crc_hcal[m];            ctrk.crc_c[trk1->DSPnumber[m]-1][1]=trk1->crc_cal[m][1];
237        for (Int_t j = 0; j < 3072; j++){            ctrk.crc_c[trk1->DSPnumber[m]-1][2]=trk1->crc_cal[m][2];
238          ctrk.dspped[trk1->DSPnumber[m]-1][j]=trk1->DSPped_par[m][j];            ctrk.crc_hc[trk1->DSPnumber[m]-1]=trk1->crc_hcal[m];
239          ctrk.dspsig[trk1->DSPnumber[m]-1][j]=trk1->DSPsig_par[m][j];            for (Int_t j = 0; j < 3072; j++){
240          ctrk.dspbad[trk1->DSPnumber[m]-1][j]=trk1->DSPbad_par[m][j];              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        ph = eh2->GetPscuHeader();        ph = eh2->GetPscuHeader();
247        FOBT[1]= ph->GetOrbitalTime();        FOBT[1]= ph->GetOrbitalTime();
248        ctrk.daqmode[trk2->DSPnumber[m]-1]=trk2->DAQmode[m];        if(trk2->DSPnumber[m]>0){
249        ctrk.dspnum[trk2->DSPnumber[m]-1]=trk2->DSPnumber[m];          if(trk2->DSPnumber[m]<13){
250        ctrk.calibnum[trk2->DSPnumber[m]-1]=trk2->calibnumber[m];            ctrk.daqmode[trk2->DSPnumber[m]-1]=trk2->DAQmode[m];
251        ctrk.ncalev[trk2->DSPnumber[m]-1]=trk2->ncalib_event[m];            ctrk.dspnum[trk2->DSPnumber[m]-1]=trk2->DSPnumber[m];
252        ctrk.ped1[trk2->DSPnumber[m]-1]=trk2->ped_l1[m];            ctrk.calibnum[trk2->DSPnumber[m]-1]=trk2->calibnumber[m];
253        ctrk.ped2[trk2->DSPnumber[m]-1]=trk2->ped_l2[m];            ctrk.ncalev[trk2->DSPnumber[m]-1]=trk2->ncalib_event[m];
254        ctrk.ped3[trk2->DSPnumber[m]-1]=trk2->ped_l3[m];            ctrk.ped1[trk2->DSPnumber[m]-1]=trk2->ped_l1[m];
255        ctrk.sig1[trk2->DSPnumber[m]-1]=trk2->sig_l1[m];            ctrk.ped2[trk2->DSPnumber[m]-1]=trk2->ped_l2[m];
256        ctrk.sig2[trk2->DSPnumber[m]-1]=trk2->sig_l2[m];            ctrk.ped3[trk2->DSPnumber[m]-1]=trk2->ped_l3[m];
257        ctrk.sig3[trk2->DSPnumber[m]-1]=trk2->sig_l3[m];            ctrk.sig1[trk2->DSPnumber[m]-1]=trk2->sig_l1[m];
258        ctrk.nbad1[trk2->DSPnumber[m]-1]=trk2->nbad_l1[m];            ctrk.sig2[trk2->DSPnumber[m]-1]=trk2->sig_l2[m];
259        ctrk.nbad2[trk2->DSPnumber[m]-1]=trk2->nbad_l2[m];            ctrk.sig3[trk2->DSPnumber[m]-1]=trk2->sig_l3[m];
260        ctrk.nbad3[trk2->DSPnumber[m]-1]=trk2->nbad_l3[m];            ctrk.nbad1[trk2->DSPnumber[m]-1]=trk2->nbad_l1[m];
261        ctrk.calfl[trk2->DSPnumber[m]-1]=trk2->cal_flag[m];            ctrk.nbad2[trk2->DSPnumber[m]-1]=trk2->nbad_l2[m];
262        ctrk.crc_c[trk1->DSPnumber[m]-1][0]=trk2->crc_cal[m][0];            ctrk.nbad3[trk2->DSPnumber[m]-1]=trk2->nbad_l3[m];
263        ctrk.crc_c[trk1->DSPnumber[m]-1][1]=trk2->crc_cal[m][1];            ctrk.calfl[trk2->DSPnumber[m]-1]=trk2->cal_flag[m];
264        ctrk.crc_c[trk1->DSPnumber[m]-1][2]=trk2->crc_cal[m][2];            ctrk.crc_c[trk1->DSPnumber[m]-1][0]=trk2->crc_cal[m][0];
265        ctrk.crc_hc[trk1->DSPnumber[m]-1]=trk2->crc_hcal[m];            ctrk.crc_c[trk1->DSPnumber[m]-1][1]=trk2->crc_cal[m][1];
266        for (Int_t j = 0; j < 3072; j++){            ctrk.crc_c[trk1->DSPnumber[m]-1][2]=trk2->crc_cal[m][2];
267          ctrk.dspped[trk2->DSPnumber[m]-1][j]=trk2->DSPped_par[m][j];            ctrk.crc_hc[trk1->DSPnumber[m]-1]=trk2->crc_hcal[m];
268          ctrk.dspsig[trk2->DSPnumber[m]-1][j]=trk2->DSPsig_par[m][j];            for (Int_t j = 0; j < 3072; j++){
269          ctrk.dspbad[trk2->DSPnumber[m]-1][j]=trk2->DSPbad_par[m][j];              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          }
275        }
276                                
277    
278      //      //
279      // other variables definitions      // other variables definitions
280    
281      Int_t risposta=0;      Int_t risposta=0;
282      stringstream fromfile;      stringstream fromfile,isfile;
283    
284      fromfile<<"FTrkCalibQLook_EXPERT      File: "<<ffile<<"        -- CalibHeader OBT= "<<HOBT<<" -- Calib pkt OBT= "<<FOBT[0]<<" -- CalibTrailer OBT= "<<TOBT<<" --";      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            
286      gStyle->SetLabelSize(0.08,"x");      gStyle->SetLabelSize(0.07,"x");
287      gStyle->SetLabelSize(0.08,"y");      gStyle->SetLabelSize(0.07,"y");
288      gStyle->SetTitleFillColor(10);      gStyle->SetTitleFillColor(10);
289      gStyle->SetTitleFontSize(0.1);      gStyle->SetTitleFontSize(0.08);
290      gStyle->SetTitleOffset(0.8,"y");      gStyle->SetTitleOffset(0.8,"y");
291      gStyle->SetTitleOffset(1.,"x");      gStyle->SetTitleOffset(0.9,"x");
292      gStyle->SetTitleSize(0.06,"y");      gStyle->SetTitleSize(0.06,"y");
293      gStyle->SetTitleSize(0.06,"x");      gStyle->SetTitleSize(0.06,"x");
294      gStyle->SetOptStat(0);      gStyle->SetOptStat(101110);  
295        gStyle->SetStatX(0.9);  
296        gStyle->SetStatW(0.4);    
297        gStyle->SetStatColor(10);
298        gStyle->SetStatFontSize(0.1);
299            
300      //      //
301      //  draw display area      //  draw display area
302    
303      TLatex *tzz=new TLatex();      TLatex *tzz=new TLatex();
304      tzz->SetTextFont(32);      tzz->SetTextFont(32);
305      tzz->SetTextColor(1);      tzz->SetTextColor(1);
# Line 291  void FTrkCalibQLook_EXPERT(TString file, Line 309  void FTrkCalibQLook_EXPERT(TString file,
309      Int_t canvasy=900;      Int_t canvasy=900;
310      TCanvas *c1 = new TCanvas("c1","FTrkCalibQLook_EXPERT_ped",canvasx,canvasy);      TCanvas *c1 = new TCanvas("c1","FTrkCalibQLook_EXPERT_ped",canvasx,canvasy);
311      c1->SetFillColor(10);      c1->SetFillColor(10);
312      tzz->DrawLatex(.01,0.98,fromfile.str().c_str());      tzz->DrawLatex(.01,.98,fromfile.str().c_str());
313      tzz->DrawLatex(.90,0.98,"PEDESTAL");      tzz->DrawLatex(.90,.98,"PEDESTAL");
314        
315        isfile<<"Chips with white line at least once showed anomalous behaviour";
316        tzz->SetTextColor(17);
317        tzz->SetTextSize(0.018);
318        tzz->DrawLatex(.01,.96,isfile.str().c_str());
319        isfile.str("");
320    
321        isfile<<"Boxes so colored point out anomalous chips (not necessarily broken)";
322        tzz->SetTextColor(107);
323        //    tzz->DrawLatex(.05,.96,isfile.str().c_str());
324        isfile.str("");
325    
326      TCanvas *c2 = new TCanvas("c2","FTrkCalibQLook_EXPERT_sig",canvasx,canvasy);      TCanvas *c2 = new TCanvas("c2","FTrkCalibQLook_EXPERT_sig",canvasx,canvasy);
327      c2->SetFillColor(10);      c2->SetFillColor(10);
328      tzz->DrawLatex(.01,0.98,fromfile.str().c_str());      tzz->SetTextColor(1);
329      tzz->DrawLatex(.90,0.98,"SIGMA");      tzz->DrawLatex(.01,.98,fromfile.str().c_str());
330        tzz->DrawLatex(.90,.98,"SIGMA");
331        
332        isfile<<"Chips with white line at least once showed anomalous behaviour";
333        tzz->SetTextColor(17);
334        tzz->SetTextSize(0.018);
335        tzz->DrawLatex(.01,.96,isfile.str().c_str());
336        isfile.str("");
337    
338        isfile<<"Boxes so colored point out anomalous chips (not necessarily broken)";
339        tzz->SetTextColor(107);
340        //    tzz->DrawLatex(.05,.96,isfile.str().c_str());
341        isfile.str("");
342    
343      
344        TCanvas *sig=new TCanvas("sig","FTrkCalibQLook_EXPERT_histosig",canvasx,canvasy);
345        sig->SetFillColor(10);
346        tzz->SetTextColor(1);
347        tzz->DrawLatex(.01,.98,fromfile.str().c_str());
348        tzz->DrawLatex(.85,.97,"Histograms of the sigmas");
349        
350    
351    
352      //  draw pads      //  draw pads
353      TPad *trkpad1[12],*trkpad2[12];        //pad for histos      TPad *trkpad1[12],*trkpad2[12],*trkpad3[36];        //pad for histos
354      TPaveText *trkpadtext[12]; //pad for header      TPaveText *trkpadtext[12]; //pad for header
355      TH1F *histosig[12];           //histos of sigma      TH1F *histosig[12];           //histos of sigma
356      TH1F *histoped[12];          //histos of pedestals        TH1F *histoped[12];          //histos of pedestals  
357      TH1F *histoasig[12];           //histos of sigma      TH1F *histoasig[12];           //histos of sigma
358      TH1F *histoaped[12];          //histos of pedestals      TH1F *histoaped[12];          //histos of pedestals
359        
360      Double_t posy = 0.95;    // up y-coord - top pads      TH1F *histosiglad[12][3];           //histos of sigma
     Double_t hpad = 0.15;   // pad height  
     Double_t posx1=0;          // left  x-coord - pad column  
     Double_t posx2=0;          // right x-coord - pad olumn  
     Double_t posx0=0;          //       x-coord - column division  
     Double_t wrel = 0.6;     // relative x size of first sub-column  
     Double_t marg = 0.004;   // margin among pads  
361      stringstream title;      stringstream title;
362      stringstream hid;      stringstream hid;
363        
364        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    
372        
373      for(Int_t n = 0; n<12; n++){      for(Int_t n = 0; n<12; n++){
374        if ( (n+1)%2 ) {        if ( (n+1)%2 ) {
375          if(n>1)posy = posy-(marg*2+hpad);          if(n>1)posy = posy-(marg*2+hpad);
376          posx1 = marg;          posx1 = marg;
377          posx2 = 0.5 - marg;          posx2 = 0.5 - marg;
378          posx0 = 0.5*wrel;          posx0 = 0.5*wrel;
379    
380        } else {        } else {
381          posx1 = posx1 + 0.5;          posx1 = posx1 + 0.5;
382          posx2 = posx2 + 0.5;          posx2 = posx2 + 0.5;
383          posx0 = posx0 + 0.5;          posx0 = posx0 + 0.5;
384    
385        };        };
386        /* -----------> pad for histograms  */        /* -----------> pad for histograms  */
387        trkpad1[n] = new TPad("pad1"," ",posx1,posy-hpad,posx0-marg,posy,18,0,0);        trkpad1[n] = new TPad("pad1"," ",posx1,posy-hpad,posx0-marg,posy,18,0,0);
# Line 335  void FTrkCalibQLook_EXPERT(TString file, Line 391  void FTrkCalibQLook_EXPERT(TString file,
391        /* -----------> HISTOGRAMS          */        /* -----------> HISTOGRAMS          */
392        /* calibration parameters */        /* calibration parameters */
393        title<<"DSP "<<n+1;        title<<"DSP "<<n+1;
394        hid<<"h"<<n;        hid<<"h"<<n<<"i"<<i;
395        histosig[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3072,0.5,3072.5);        histosig[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3072,0.5,3072.5);
396        hid.str("");        hid.str("");
397        hid<<"hh"<<n;        hid<<"hh"<<n<<"i"<<i;
398        histoped[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3072,0.5,3072.5);        histoped[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3072,0.5,3072.5);
399        hid.str("");        hid.str("");
400        hid<<"hhh"<<n;        hid<<"hhh"<<n<<"i"<<i;
       title.str("");  
401        hid.str("");        hid.str("");
402        /* AVERAGE calibration parameters */            /* AVERAGE calibration parameters */    
403        hid<<"ah"<<n;        hid<<"ah"<<n<<"i"<<i;
404        histoasig[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3,0.5,3072.5);        histoasig[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3,0.5,3072.5);
405        hid.str("");        hid.str("");
406        hid<<"ahh"<<n;        hid<<"ahh"<<n<<"i"<<i;
407        histoaped[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3,0.5,3072.5);        histoaped[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3,0.5,3072.5);
408        hid.str("");        hid.str("");
409          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      };                     //end loop on views      };                     //end loop on views
418        
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      stringstream message;      stringstream message;
442      
443      //--------------------------------      //--------------------------------
444      //CHECK CALIBRATION procedure      //CHECK CALIBRATION procedure
445      //--------------------------------      //--------------------------------
# Line 363  void FTrkCalibQLook_EXPERT(TString file, Line 447  void FTrkCalibQLook_EXPERT(TString file,
447      Int_t calok = 0;//BAD        Int_t calok = 0;//BAD  
448      for(Int_t n = 0; n<12; n++){      for(Int_t n = 0; n<12; n++){
449        if(ctrk.ncalev[n]==0 && ctrk.calfl[n]==0)calok = 1;//GOOD        if(ctrk.ncalev[n]==0 && ctrk.calfl[n]==0)calok = 1;//GOOD
450          
451                if(ctrk.dspnum[n]==0)
452            continue;
453    
454        nn=ctrk.dspnum[n]-1;        nn=ctrk.dspnum[n]-1;
455        /*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*        /*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*
456         *         *
# Line 437  void FTrkCalibQLook_EXPERT(TString file, Line 523  void FTrkCalibQLook_EXPERT(TString file,
523        /******************************************************/        /******************************************************/
524        /* fill histos */        /* fill histos */
525        for(Int_t j = 0; j < 3072; j++){        for(Int_t j = 0; j < 3072; j++){
526          histosig[nn]->Fill((Float_t)j,ctrk.dspsig[nn][j]);          histosig[nn]->Fill(j,ctrk.dspsig[n][j]);
527          histoped[nn]->Fill((Float_t)j,ctrk.dspped[nn][j]);          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        };        };
532        histoasig[nn]->Fill(1,ctrk.sig1[nn]);        histoasig[nn]->Fill(1,ctrk.sig1[n]);
533        histoasig[nn]->Fill(1025,ctrk.sig2[nn]);        histoasig[nn]->Fill(1025,ctrk.sig2[n]);
534        histoasig[nn]->Fill(2049,ctrk.sig3[nn]);        histoasig[nn]->Fill(2049,ctrk.sig3[n]);
535        histoaped[nn]->Fill(1,ctrk.ped1[nn]);        histoaped[nn]->Fill(1,ctrk.ped1[nn]);
536        histoaped[nn]->Fill(1025,ctrk.ped2[nn]);        histoaped[nn]->Fill(1025,ctrk.ped2[n]);
537        histoaped[nn]->Fill(2049,ctrk.ped3[nn]);        histoaped[nn]->Fill(2049,ctrk.ped3[n]);
538        /******************************************************/        /******************************************************/
539                    
540        TLine li;        TLine li,liva1;
541        li.SetLineColor(38);        li.SetLineColor(38);
542        li.SetLineStyle(3);        li.SetLineStyle(4);
543        li.SetLineWidth(2);        li.SetLineWidth(2);
544                liva1.SetLineColor(42);
545                liva1.SetLineStyle(3);
546          liva1.SetLineWidth(1);
547    
548          Float_t maxhist=0,va1x=0,minhist=0.;
549          TBox b;
550        /* plot PEDESTAL */        /* plot PEDESTAL */
551        c1->cd();        c1->cd();
552        trkpadtext[nn]->Draw();        trkpadtext[nn]->Draw();
# Line 461  void FTrkCalibQLook_EXPERT(TString file, Line 554  void FTrkCalibQLook_EXPERT(TString file,
554        trkpad1[nn]->cd();        trkpad1[nn]->cd();
555        trkpad1[nn]->SetFillColor(10);        trkpad1[nn]->SetFillColor(10);
556        trkpad1[nn]->SetFrameFillColor(10);        trkpad1[nn]->SetFrameFillColor(10);
557          histoped[nn]->SetStats(kFALSE);
558        histoped[nn]->SetLineColor(1);        histoped[nn]->SetLineColor(1);
559        histoped[nn]->SetFillColor(12);        histoped[nn]->SetFillColor(12);
560        histoped[nn]->SetLineWidth(1);        histoped[nn]->SetLineWidth(1);
561        histoped[nn]->GetYaxis()->SetTitle("PED (ADC channels)");        histoped[nn]->GetYaxis()->SetTitle("PED (ADC channels)");
562        histoped[nn]->GetYaxis()->CenterTitle();        histoped[nn]->GetYaxis()->CenterTitle();
563        if((nn+1)%2==1)  histoped[nn]->GetYaxis()->SetRangeUser(2500,3200);        if((nn+1)%2==1)  histoped[nn]->GetYaxis()->SetRangeUser(2200,3200);
564        if((nn+1)%2==0)  histoped[nn]->GetYaxis()->SetRangeUser(1000,1700);        if((nn+1)%2==0)  histoped[nn]->GetYaxis()->SetRangeUser(700,1700);
565        histoaped[nn]->SetLineColor(5);        histoaped[nn]->SetLineColor(5);
566        histoaped[nn]->SetLineWidth(1);        histoaped[nn]->SetLineWidth(1);
567        if(ctrk.good0[0]==1 && ctrk.good0[1]==1) histoped[nn]->Draw("b");        //       if(ctrk.good0[0]==1 && ctrk.good0[1]==1){
568        else histoped[nn]->Draw("axis");        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        histoaped[nn]->Draw("same");        histoaped[nn]->Draw("same");
635        if((nn+1)%2==1) {        if((nn+1)%2==1) {
636          li.DrawLine(1024.5,2500,1024.5,3200);          for(int va=1; va<24; va++){
637          li.DrawLine(2048.5,2500,2048.5,3200);            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        }        }
643        if((nn+1)%2==0) {        if((nn+1)%2==0) {
644          li.DrawLine(1024.5,1000,1024.5,1700);          for(int va=1; va<24; va++){
645          li.DrawLine(2048.5,1000,2048.5,1700);            va1x=128*va;
646              liva1.DrawLine(va1x,700.,va1x,1700.);
647            }
648            li.DrawLine(1024.5,700,1024.5,1700);
649            li.DrawLine(2048.5,700,2048.5,1700);
650        }        }
651          c1->Update();//draw pads in canvas
652                
653    
654                
655        /* plot SIGMA */        /* plot SIGMA */
656        Double_t max=500.;        Float_t max=500.;
657        c2->cd();        c2->cd();
658        trkpadtext[nn]->Draw();        trkpadtext[nn]->Draw();
659        trkpad2[nn]->SetLogy();        trkpad2[nn]->SetLogy();
# Line 492  void FTrkCalibQLook_EXPERT(TString file, Line 661  void FTrkCalibQLook_EXPERT(TString file,
661        trkpad2[nn]->cd();        trkpad2[nn]->cd();
662        trkpad2[nn]->SetFillColor(10);        trkpad2[nn]->SetFillColor(10);
663        trkpad2[nn]->SetFrameFillColor(10);        trkpad2[nn]->SetFrameFillColor(10);
664          histosig[nn]->SetStats(kFALSE);
665        histosig[nn]->SetLineColor(1);        histosig[nn]->SetLineColor(1);
666        histosig[nn]->SetFillColor(12);        histosig[nn]->SetFillColor(12);
667        histosig[nn]->SetLineWidth(1);        histosig[nn]->SetLineWidth(1);
# Line 501  void FTrkCalibQLook_EXPERT(TString file, Line 671  void FTrkCalibQLook_EXPERT(TString file,
671        histosig[nn]->GetYaxis()->CenterTitle();        histosig[nn]->GetYaxis()->CenterTitle();
672        histoasig[nn]->SetLineColor(5);        histoasig[nn]->SetLineColor(5);
673        histoasig[nn]->SetLineWidth(1);        histoasig[nn]->SetLineWidth(1);
674        if(ctrk.good0[0]==1 && ctrk.good0[1]==1) histosig[nn]->Draw("b");        //      if(ctrk.good0[0]==1 && ctrk.good0[1]==1){
675        else histosig[nn]->Draw("axis");        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        histoasig[nn]->Draw("same");        histoasig[nn]->Draw("same");
741          for(int va=1; va<24; va++){
742            va1x=128*va;
743            liva1.DrawLine(va1x,0.,va1x,max);
744          }
745        li.DrawLine(1024.5,0,1024.5,max);        li.DrawLine(1024.5,0,1024.5,max);
746        li.DrawLine(2048.5,0,2048.5,max);        li.DrawLine(2048.5,0,2048.5,max);
747                  c2->Update();//draw pads in canvas
748          
749          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          }
763          
764      };//end loop on views      };//end loop on views
       
765      c1->Update();//draw pads in canvas      c1->Update();//draw pads in canvas
766      c2->Update();//draw pads in canvas      c2->Update();//draw pads in canvas
767        sig->Update();//draw pads in canvas
768      stringstream nom1;      
769      stringstream nom2;      stringstream nom1,nom2,nom3;
770          
771      if(!strcmp(outfile.Data(),"ps")||!strcmp(outfile.Data(),"pdf")){      if(!strcmp(outfile.Data(),"ps")||!strcmp(outfile.Data(),"pdf")){
772        nom1.str("");        nom1.str("");
773        nom2.str("");        nom2.str("");
774          nom3.str("");
775        nom1<<out<<ffile<<"_FTrkCalibQLook_EXPERT-pkt"<<i+1<<".ps(";        nom1<<out<<ffile<<"_FTrkCalibQLook_EXPERT-pkt"<<i+1<<".ps(";
776        nom2<<out<<ffile<<"_FTrkCalibQLook_EXPERT-pkt"<<i+1<<".ps)";        nom2<<out<<ffile<<"_FTrkCalibQLook_EXPERT-pkt"<<i+1<<".ps";
777          nom3<<out<<ffile<<"_FTrkCalibQLook_EXPERT-pkt"<<i+1<<".ps)";
778        c1->Print(nom1.str().c_str(),"Landscape");        c1->Print(nom1.str().c_str(),"Landscape");
779        c2->Print(nom2.str().c_str(),"Landscape");        c2->Print(nom2.str().c_str(),"Landscape");
780          sig->Print(nom3.str().c_str(),"Landscape");
781          
782        if(!strcmp(outfile.Data(),"pdf")){        if(!strcmp(outfile.Data(),"pdf")){
783          stringstream com;          stringstream com;
784          com<<"ps2pdf13 "<<out<<ffile<<"_FTrkCalibQLook_EXPERT-pkt"<<i+1<<".ps "<<out<<ffile<<"_FTrkCalibQlook_EXPERT-pkt"<<i+1<<".pdf";          com<<"ps2pdf13 "<<out<<ffile<<"_FTrkCalibQLook_EXPERT-pkt"<<i+1<<".ps "<<out<<ffile<<"_FTrkCalibQlook_EXPERT-pkt"<<i+1<<".pdf";
# Line 537  void FTrkCalibQLook_EXPERT(TString file, Line 794  void FTrkCalibQLook_EXPERT(TString file,
794      else{      else{
795        nom1.str("");        nom1.str("");
796        nom2.str("");        nom2.str("");
797          nom3.str("");
798        nom1<<out<<ffile<<"_FTrkCalibQLook_EXPERT-ped-pkt"<<i+1<<"."<<outfile.Data();        nom1<<out<<ffile<<"_FTrkCalibQLook_EXPERT-ped-pkt"<<i+1<<"."<<outfile.Data();
799        nom2<<out<<ffile<<"_FTrkCalibQLook_EXPERT-sig-pkt"<<i+1<<"."<<outfile.Data();        nom2<<out<<ffile<<"_FTrkCalibQLook_EXPERT-sig-pkt"<<i+1<<"."<<outfile.Data();
800          nom3<<out<<ffile<<"_FTrkCalibQLook_EXPERT-histosig-pkt"<<i+1<<"."<<outfile.Data();
801        c1->Print(nom1.str().c_str());        c1->Print(nom1.str().c_str());
802        c2->Print(nom2.str().c_str());        c2->Print(nom2.str().c_str());
803          sig->Print(nom3.str().c_str());
804      }      }
805              
806      if(step==1 && i!=maxevent-1 ){        if(step==1 && i!=maxevent-1 ){  
807        printf("\n Press 1<enter> to continue, 2<enter> to quit.\n");        printf("\n Press 1<enter> to continue, 2<enter> to quit.\n");
808        cin>>risposta;        cin>>risposta;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.33

  ViewVC Help
Powered by ViewVC 1.1.23