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

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

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

revision 1.2 by pam-fi, Thu Jun 1 15:23:12 2006 UTC revision 1.11 by mocchiut, Fri Jan 17 15:10:38 2014 UTC
# Line 2  Line 2 
2   * FTrkCalibQLook_BASIC.cxx   * FTrkCalibQLook_BASIC.cxx
3   *   *
4   * autor: D.Fedele   * autor: D.Fedele
5   * version 2.0   * version v1r11
6   * Parameters:   * Parameters:
7   *      file - the data file to analyze   *      file - the data file to analyze
8   *      fromevent - first event to analyze   *      fromevent - first event to analyze
# Line 15  Line 15 
15  #include <TLatex.h>  #include <TLatex.h>
16  #include <TCanvas.h>  #include <TCanvas.h>
17  #include <TGraph.h>  #include <TGraph.h>
18    #include <TFile.h>
19  #include <TTree.h>  #include <TTree.h>
20  #include <TStyle.h>  #include <TStyle.h>
21  #include <TString.h>  #include <TString.h>
22    #include <TAxis.h>
23    #include <TH1F.h>
24    #include <TROOT.h>
25    #include <cstdlib>
26  //  //
27  #include <PscuHeader.h>  #include <PscuHeader.h>
28  #include <EventHeader.h>  #include <EventHeader.h>
# Line 25  Line 30 
30  #include <CalibTrk2Event.h>  #include <CalibTrk2Event.h>
31  //  //
32    
33  void stringcopy(TString& s1, const TString& s2, Int_t from=0, Int_t to=0){      struct caltrk_def{
     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{  
34    Int_t good0[2];    Int_t good0[2];
35    Int_t daqmode[12];    Int_t daqmode[12];
36    Int_t dspnum[12];    Int_t dspnum[12];
# Line 64  void FTrkCalibQLook_BASIC(TString file,I Line 58  void FTrkCalibQLook_BASIC(TString file,I
58  {  {
59    //    //
60    //   obtain information about the data file and select the output dir    //   obtain information about the data file and select the output dir
61    const string filepath=file.Data();    Int_t dwpos = file.Last('/');
62    Int_t dwpos = filepath.rfind("/");    Int_t dwpos1 = file.Last('.');
63    Int_t dwpos1 = filepath.rfind(".root");    TString base,ffile ;
64    TString fpath=(filepath.c_str());    ffile=file(dwpos+1,dwpos1-(dwpos+1));
65    TString base,ffile;    if(dwpos>0) base=file(0,dwpos);
   stringcopy(base,fpath,0,dwpos);  
   stringcopy(ffile,fpath,dwpos+1,dwpos1);  
   if(dwpos>0) base+="/";  
66    
67    TString out;    TString out;
68    if(outdir.Length()==0){    if(outdir.Length()==0){
# Line 79  void FTrkCalibQLook_BASIC(TString file,I Line 70  void FTrkCalibQLook_BASIC(TString file,I
70    }else{    }else{
71      out = outdir;      out = outdir;
72    };    };
73        if(out.Last('/')+1<out.Length()) out+="/";
74    
75    //    //
76    // inizialise the variables and open the file    // inizialise the variables and open the file
77    struct caltrk_def ctrk;    struct caltrk_def ctrk;
78    Int_t nevents=0;    Int_t nevents=0;
79    Int_t minevent = 0;    Int_t minevent = 0;
80    Int_t maxevent = 0;    Int_t maxevent = 0;
81    ULong64_t OBT[2];    ULong_t OBT[2];
82        
83    OBT[0]=0;    OBT[0]=0;
84    OBT[1]=0;    OBT[1]=0;
# Line 175  void FTrkCalibQLook_BASIC(TString file,I Line 167  void FTrkCalibQLook_BASIC(TString file,I
167      } else if (toevent > nevents) {              } else if (toevent > nevents) {        
168        maxevent = nevents;        maxevent = nevents;
169      } else {            } else {      
170        maxevent = fromevent;        maxevent = nevents;
171      };      };
172    };    };
173    
# Line 204  void FTrkCalibQLook_BASIC(TString file,I Line 196  void FTrkCalibQLook_BASIC(TString file,I
196    Int_t canvasx=900;    Int_t canvasx=900;
197    Int_t canvasy=1200;    Int_t canvasy=1200;
198    
199    Int_t ndsp =0,alarm=0;    Int_t alarm=0;
200    Float_t pedav[12][12],pedavtemp[12][12],sigav[12][12],sigavtemp[12][12];    Float_t pedav[12][12],pedavtemp[12][12],sigav[12][12],sigavtemp[12][12];
201    Int_t flpedav[12][12],flsigav[12][12];    Int_t flpedav[12][12],flsigav[12][12];
202    Float_t siglimsup[12][12],sigliminf[12][12],pedlimsup[12][12],pedliminf[12][12];    Float_t siglimsup[12][12],sigliminf[12][12],pedlimsup[12][12],pedliminf[12][12];
# Line 284  void FTrkCalibQLook_BASIC(TString file,I Line 276  void FTrkCalibQLook_BASIC(TString file,I
276      for (Int_t m = 0; m < 6; m++){      for (Int_t m = 0; m < 6; m++){
277        ph1 = eh1->GetPscuHeader();        ph1 = eh1->GetPscuHeader();
278        OBT[0]= ph1->GetOrbitalTime();        OBT[0]= ph1->GetOrbitalTime();
279        ctrk.daqmode[trk1->DSPnumber[m]-1]=trk1->DAQmode[m];        if(trk1->DSPnumber[m]>0){
280        ctrk.dspnum[trk1->DSPnumber[m]-1]=trk1->DSPnumber[m];          if(trk1->DSPnumber[m]<13){
281        ctrk.calibnum[trk1->DSPnumber[m]-1]=trk1->calibnumber[m];            ctrk.daqmode[trk1->DSPnumber[m]-1]=trk1->DAQmode[m];
282        ctrk.ncalev[trk1->DSPnumber[m]-1]=trk1->ncalib_event[m];            ctrk.dspnum[trk1->DSPnumber[m]-1]=trk1->DSPnumber[m];
283        ctrk.ped1[trk1->DSPnumber[m]-1]=trk1->ped_l1[m];            ctrk.calibnum[trk1->DSPnumber[m]-1]=trk1->calibnumber[m];
284        ctrk.ped2[trk1->DSPnumber[m]-1]=trk1->ped_l2[m];            ctrk.ncalev[trk1->DSPnumber[m]-1]=trk1->ncalib_event[m];
285        ctrk.ped3[trk1->DSPnumber[m]-1]=trk1->ped_l3[m];            ctrk.ped1[trk1->DSPnumber[m]-1]=trk1->ped_l1[m];
286        ctrk.sig1[trk1->DSPnumber[m]-1]=trk1->sig_l1[m];            ctrk.ped2[trk1->DSPnumber[m]-1]=trk1->ped_l2[m];
287        ctrk.sig2[trk1->DSPnumber[m]-1]=trk1->sig_l2[m];            ctrk.ped3[trk1->DSPnumber[m]-1]=trk1->ped_l3[m];
288        ctrk.sig3[trk1->DSPnumber[m]-1]=trk1->sig_l3[m];            ctrk.sig1[trk1->DSPnumber[m]-1]=trk1->sig_l1[m];
289        ctrk.nbad1[trk1->DSPnumber[m]-1]=trk1->nbad_l1[m];            ctrk.sig2[trk1->DSPnumber[m]-1]=trk1->sig_l2[m];
290        ctrk.nbad2[trk1->DSPnumber[m]-1]=trk1->nbad_l2[m];            ctrk.sig3[trk1->DSPnumber[m]-1]=trk1->sig_l3[m];
291        ctrk.nbad3[trk1->DSPnumber[m]-1]=trk1->nbad_l3[m];            ctrk.nbad1[trk1->DSPnumber[m]-1]=trk1->nbad_l1[m];
292        ctrk.calfl[trk1->DSPnumber[m]-1]=trk1->cal_flag[m];            ctrk.nbad2[trk1->DSPnumber[m]-1]=trk1->nbad_l2[m];
293        ctrk.crc_c[trk1->DSPnumber[m]-1][0]=trk1->crc_cal[m][0];            ctrk.nbad3[trk1->DSPnumber[m]-1]=trk1->nbad_l3[m];
294        ctrk.crc_c[trk1->DSPnumber[m]-1][1]=trk1->crc_cal[m][1];            ctrk.calfl[trk1->DSPnumber[m]-1]=trk1->cal_flag[m];
295        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];
296        ctrk.crc_hc[trk1->DSPnumber[m]-1]=trk1->crc_hcal[m];            ctrk.crc_c[trk1->DSPnumber[m]-1][1]=trk1->crc_cal[m][1];
297        for (Int_t j = 0; j < 3072; j++){            ctrk.crc_c[trk1->DSPnumber[m]-1][2]=trk1->crc_cal[m][2];
298          ctrk.dspped[trk1->DSPnumber[m]-1][j]=trk1->DSPped_par[m][j];            ctrk.crc_hc[trk1->DSPnumber[m]-1]=trk1->crc_hcal[m];
299          ctrk.dspsig[trk1->DSPnumber[m]-1][j]=trk1->DSPsig_par[m][j];            for (Int_t j = 0; j < 3072; j++){
300          ctrk.dspbad[trk1->DSPnumber[m]-1][j]=trk1->DSPbad_par[m][j];              ctrk.dspped[trk1->DSPnumber[m]-1][j]=trk1->DSPped_par[m][j];
301                ctrk.dspsig[trk1->DSPnumber[m]-1][j]=trk1->DSPsig_par[m][j];
302                ctrk.dspbad[trk1->DSPnumber[m]-1][j]=trk1->DSPbad_par[m][j];
303              }
304            }
305        }        }
306        ph2 = eh2->GetPscuHeader();        ph2 = eh2->GetPscuHeader();
307        OBT[1]= ph2->GetOrbitalTime();        OBT[1]= ph2->GetOrbitalTime();
308        ctrk.daqmode[trk2->DSPnumber[m]-1]=trk2->DAQmode[m];        if(trk2->DSPnumber[m]>0){
309        ctrk.dspnum[trk2->DSPnumber[m]-1]=trk2->DSPnumber[m];          if(trk2->DSPnumber[m]<13){
310        ctrk.calibnum[trk2->DSPnumber[m]-1]=trk2->calibnumber[m];            ctrk.daqmode[trk2->DSPnumber[m]-1]=trk2->DAQmode[m];
311        ctrk.ncalev[trk2->DSPnumber[m]-1]=trk2->ncalib_event[m];            ctrk.dspnum[trk2->DSPnumber[m]-1]=trk2->DSPnumber[m];
312        ctrk.ped1[trk2->DSPnumber[m]-1]=trk2->ped_l1[m];            ctrk.calibnum[trk2->DSPnumber[m]-1]=trk2->calibnumber[m];
313        ctrk.ped2[trk2->DSPnumber[m]-1]=trk2->ped_l2[m];            ctrk.ncalev[trk2->DSPnumber[m]-1]=trk2->ncalib_event[m];
314        ctrk.ped3[trk2->DSPnumber[m]-1]=trk2->ped_l3[m];            ctrk.ped1[trk2->DSPnumber[m]-1]=trk2->ped_l1[m];
315        ctrk.sig1[trk2->DSPnumber[m]-1]=trk2->sig_l1[m];            ctrk.ped2[trk2->DSPnumber[m]-1]=trk2->ped_l2[m];
316        ctrk.sig2[trk2->DSPnumber[m]-1]=trk2->sig_l2[m];            ctrk.ped3[trk2->DSPnumber[m]-1]=trk2->ped_l3[m];
317        ctrk.sig3[trk2->DSPnumber[m]-1]=trk2->sig_l3[m];            ctrk.sig1[trk2->DSPnumber[m]-1]=trk2->sig_l1[m];
318        ctrk.nbad1[trk2->DSPnumber[m]-1]=trk2->nbad_l1[m];            ctrk.sig2[trk2->DSPnumber[m]-1]=trk2->sig_l2[m];
319        ctrk.nbad2[trk2->DSPnumber[m]-1]=trk2->nbad_l2[m];            ctrk.sig3[trk2->DSPnumber[m]-1]=trk2->sig_l3[m];
320        ctrk.nbad3[trk2->DSPnumber[m]-1]=trk2->nbad_l3[m];            ctrk.nbad1[trk2->DSPnumber[m]-1]=trk2->nbad_l1[m];
321        ctrk.calfl[trk2->DSPnumber[m]-1]=trk2->cal_flag[m];            ctrk.nbad2[trk2->DSPnumber[m]-1]=trk2->nbad_l2[m];
322        ctrk.crc_c[trk1->DSPnumber[m]-1][0]=trk2->crc_cal[m][0];            ctrk.nbad3[trk2->DSPnumber[m]-1]=trk2->nbad_l3[m];
323        ctrk.crc_c[trk1->DSPnumber[m]-1][1]=trk2->crc_cal[m][1];            ctrk.calfl[trk2->DSPnumber[m]-1]=trk2->cal_flag[m];
324        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];
325        ctrk.crc_hc[trk1->DSPnumber[m]-1]=trk2->crc_hcal[m];            ctrk.crc_c[trk1->DSPnumber[m]-1][1]=trk2->crc_cal[m][1];
326        for (Int_t j = 0; j < 3072; j++){            ctrk.crc_c[trk1->DSPnumber[m]-1][2]=trk2->crc_cal[m][2];
327          ctrk.dspped[trk2->DSPnumber[m]-1][j]=trk2->DSPped_par[m][j];            ctrk.crc_hc[trk1->DSPnumber[m]-1]=trk2->crc_hcal[m];
328          ctrk.dspsig[trk2->DSPnumber[m]-1][j]=trk2->DSPsig_par[m][j];            for (Int_t j = 0; j < 3072; j++){
329          ctrk.dspbad[trk2->DSPnumber[m]-1][j]=trk2->DSPbad_par[m][j];              ctrk.dspped[trk2->DSPnumber[m]-1][j]=trk2->DSPped_par[m][j];
330                ctrk.dspsig[trk2->DSPnumber[m]-1][j]=trk2->DSPsig_par[m][j];
331                ctrk.dspbad[trk2->DSPnumber[m]-1][j]=trk2->DSPbad_par[m][j];
332              }
333            }
334        }        }
335      }        }  
336    
# Line 345  void FTrkCalibQLook_BASIC(TString file,I Line 345  void FTrkCalibQLook_BASIC(TString file,I
345        }        }
346      }      }
347            
348      Int_t nn,ok=0;      Int_t nn=0,ok=0;
349            
350      //      //
351      // write warning if it occur            // write warning if it occur      
352      for(Int_t n = 0; n<12; n++){      for(Int_t n = 0; n<12; n++){
353                
354        ndsp = ctrk.dspnum[n];        if(ctrk.dspnum[n]==0)
355        nn = ndsp-1;          continue;
356          nn = ctrk.dspnum[n]-1;
357    
358        for(Int_t iii=0;iii<3;iii++){        for(Int_t iii=0;iii<3;iii++){
359          if(ctrk.crc_c[nn][iii]!=0){          if(ctrk.crc_c[nn][iii]!=0){
# Line 419  void FTrkCalibQLook_BASIC(TString file,I Line 420  void FTrkCalibQLook_BASIC(TString file,I
420          space[wc]-=spacep;          space[wc]-=spacep;
421        }        }
422    
423        if(ctrk.good0[0]==1 && ctrk.good0[1]==1){        //      if(ctrk.good0[0]==1 && ctrk.good0[1]==1){
424          //          //
425          // evaluate the mean value of the sigma and pedestal          // evaluate the mean value of the sigma and pedestal
426          for(Int_t j = 0; j < 3072; j++){          for(Int_t j = 0; j < 3072; j++){
# Line 480  void FTrkCalibQLook_BASIC(TString file,I Line 481  void FTrkCalibQLook_BASIC(TString file,I
481              }              }
482            }            }
483          }          }
484        }          //      }
485      }      }
486      if(ok==0 && ctrk.good0[0]==1 && ctrk.good0[1]==1){      if(ok==0){
487    //    if(ok==0 && ctrk.good0[0]==1 && ctrk.good0[1]==1){
488        if(space[wc]<=10){        if(space[wc]<=10){
489          wc+=1;          wc+=1;
490          flcanvas+=1;          flcanvas+=1;

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.23