/[PAMELA software]/DarthVader/TrackerLevel2/src/TrkParams.cpp
ViewVC logotype

Diff of /DarthVader/TrackerLevel2/src/TrkParams.cpp

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

revision 1.9 by pam-fi, Tue May 15 16:22:19 2007 UTC revision 1.14 by pam-fi, Mon Aug 27 12:57:15 2007 UTC
# Line 5  Line 5 
5    
6  #include <TrkParams.h>  #include <TrkParams.h>
7  #include <iostream>  #include <iostream>
8    #include <iomanip>
9  using namespace std;  using namespace std;
10    
11    
# Line 23  UInt_t       TrkParams::trkparamtype[] = Line 24  UInt_t       TrkParams::trkparamtype[] =
24  GL_PARAM     TrkParams::gl[]           = {GL_PARAM(),GL_PARAM(),GL_PARAM(),GL_PARAM(),GL_PARAM(),GL_PARAM(),GL_PARAM()};  GL_PARAM     TrkParams::gl[]           = {GL_PARAM(),GL_PARAM(),GL_PARAM(),GL_PARAM(),GL_PARAM(),GL_PARAM(),GL_PARAM()};
25  TString      TrkParams::glpath[]       = {"","","","","","",""};  TString      TrkParams::glpath[]       = {"","","","","","",""};
26  Bool_t       TrkParams::glload[]       = {false,false,false,false,false,false,false};  Bool_t       TrkParams::glload[]       = {false,false,false,false,false,false,false};
 cDbg         TrkParams::dbg_mode       = {0,0,0};  
27  // ----------------  // ----------------
28  // other parameters  // other parameters
29  // ----------------  // ----------------
30    cDbg   TrkParams::init__dbg_mode       = {0,0,0};
31  int    TrkParams::init__pfa            = 14;//COG4  int    TrkParams::init__pfa            = 14;//COG4
32  int    TrkParams::init__mini_trackmode = 0;  int    TrkParams::init__mini_trackmode = 0;
33  int    TrkParams::init__mini_istepmin  = 3;  int    TrkParams::init__mini_istepmin  = 5; //3;
34  double TrkParams::init__mini_fact      = 100.;  double TrkParams::init__mini_fact      = 1.e4; //100.;
35    float  TrkParams::init__pfa_e234ax[]   = {0.,10.,10.,15.,15.,90.};
36    float  TrkParams::init__pfa_e234ay[]   = {0.,20.,90.,90.,90.,90.};
37    
38  TrkParams::TrkParams(){  TrkParams::TrkParams(){
39    
# Line 51  float anint(float f){ Line 54  float anint(float f){
54      return ret1;              return ret1;        
55  }  }
56  /**  /**
57   * Static method to set the calibration to be loaded.   * \brief Static method to set the calibration to be loaded.
58    
59   * It retrieves the calibration associated to a given run, from   * It retrieves the calibration associated to a given run, from
60   * a given DB. It fills the F77 common.   * a given DB. It fills the F77 common.
# Line 69  Bool_t TrkParams::SetCalib( GL_RUN *glru Line 72  Bool_t TrkParams::SetCalib( GL_RUN *glru
72          glrun->RUNHEADER_TIME > calib.TO_TIME     ||          glrun->RUNHEADER_TIME > calib.TO_TIME     ||
73          false ){          false ){
74    
75    //      cout <<">>> isloaded?      "<< CalibIsLoaded() << endl;
76    //      cout <<">>> trk_calib_used "<< glrun->TRK_CALIB_USED<<endl;
77    //      cout <<">>> 104 loaded?    "<< calib104 <<endl;
78    //      cout <<">>> from time      "<< calib.FROM_TIME<<endl;
79    //      cout <<">>> to time        "<< calib.TO_TIME<<endl;
80    //      if( !dbc || (dbc && !dbc->IsConnected()) ){
81    
82    //          if(TrkParams::WarningMode())cout <<" Missing DB connection -- check PAMELA environment variables "<<endl;
83    //          TString host = "mysql://localhost/pamelaprod";
84    //          TString user = "anonymous";
85    //          TString psw = "";
86    //          const char *pamdbhost=gSystem->Getenv("PAM_DBHOST");
87    //          const char *pamdbuser=gSystem->Getenv("PAM_DBUSER");
88    //          const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW");
89    //          if ( !pamdbhost ) pamdbhost = "";
90    //          if ( !pamdbuser ) pamdbuser = "";
91    //          if ( !pamdbpsw ) pamdbpsw = "";
92    //          if ( strcmp(pamdbhost,"") ) host = pamdbhost;
93    //          if ( strcmp(pamdbuser,"") ) user = pamdbuser;
94    //          if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw;
95    //          if(TrkParams::VerboseMode()){
96    //              cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
97    //              cout<<"Connecting to DB"<<endl;
98    //              cout<<"HOST "<<host<<endl;
99    //              cout<<"USER "<<user<<endl;
100    //              cout<<"PSW  "<<psw<<endl;
101    //          }
102    //          dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data());
103    //          if( !dbc )return false;
104    //          if( !dbc->IsConnected() )return false;    
105    //          if(TrkParams::VerboseMode()){
106    //              cout << " ...done"<<endl;
107    //              cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
108    //          }
109    //      }
110    
111          GL_TRK_CALIB q2;          GL_TRK_CALIB q2;
112          GL_ROOT q3;          GL_ROOT q3;
113          GL_PARAM q4;          GL_PARAM q4;
# Line 112  Bool_t TrkParams::SetCalib( GL_RUN *glru Line 151  Bool_t TrkParams::SetCalib( GL_RUN *glru
151   */   */
152  UInt_t TrkParams::ValidateTrkCalib( CalibTrk1Event* caltrk){  UInt_t TrkParams::ValidateTrkCalib( CalibTrk1Event* caltrk){
153    
154        UInt_t validate = 1;
155      Int_t vorder[]={5,5,3,3,4,4,2,2,1,1,0,0};      Int_t vorder[]={5,5,3,3,4,4,2,2,1,1,0,0};
156  //    UInt_t timeaftercalib=120000; //2000;  //    UInt_t timeaftercalib=120000; //2000;
157      TString classname = caltrk->GetName();      TString classname = caltrk->GetName();
# Line 126  UInt_t TrkParams::ValidateTrkCalib( Cali Line 166  UInt_t TrkParams::ValidateTrkCalib( Cali
166                  if(TrkParams::WarningMode())cout<<"(CRC Header)";                  if(TrkParams::WarningMode())cout<<"(CRC Header)";
167  //              if(TrkParams::WarningMode())cout << "ValidateTrkCalib: "<<classname<<" --WARNING-- CRC error in calibration header: pkt "<<ipkt<<endl;      //              if(TrkParams::WarningMode())cout << "ValidateTrkCalib: "<<classname<<" --WARNING-- CRC error in calibration header: pkt "<<ipkt<<endl;    
168  //              return 0; // :-(  //              return 0; // :-(
169                    validate = 0;
170              }              }
171              for(Int_t ilad=0; ilad<3; ilad++)if( caltrk->crc_cal[ipkt][ilad] ){              for(Int_t ilad=0; ilad<3; ilad++)if( caltrk->crc_cal[ipkt][ilad] ){
172                  if(TrkParams::WarningMode())cout<<"(CRC Pkt-"<<ilad<<")";                  if(TrkParams::WarningMode())cout<<"(CRC Pkt-"<<ilad<<")";
173  //              if(TrkParams::WarningMode())cout << "ValidateTrkCalib: "<<classname<<" --WARNING-- CRC error in calibration packet: pkt "<<ipkt<<endl;      //              if(TrkParams::WarningMode())cout << "ValidateTrkCalib: "<<classname<<" --WARNING-- CRC error in calibration packet: pkt "<<ipkt<<endl;    
174  //              return 0; // :-(  //              return 0; // :-(
175                    validate = 0;
176              }              }
177          }          }
178      }      }
# Line 180  UInt_t TrkParams::ValidateTrkCalib( Cali Line 222  UInt_t TrkParams::ValidateTrkCalib( Cali
222              build = build | ( 1<<(base+vorder[caltrk->DSPnumber[ipkt]-1]) );              build = build | ( 1<<(base+vorder[caltrk->DSPnumber[ipkt]-1]) );
223          };          };
224      }      }
225      if( npkts==6 )return 1; // :-)      if( npkts==6 ){}//return 1; // :-)
226      else {      else {
227          if(TrkParams::WarningMode())cout << "ValidateTrkCalib: "<<classname<<" --WARNING-- there might be some missing packets :-(  ( "<<npkts<<" instead of 6 ) --> "<<endl;              if(TrkParams::WarningMode())cout << "ValidateTrkCalib: "<<classname<<" --WARNING-- there might be some missing packets :-(  ( "<<npkts<<" instead of 6 ) --> "<<endl;    
228            validate = 0;
229      }      }
230  //    cout << classname << " "<<eh->GetPscuHeader()->GetOrbitalTime()<<endl;  //    cout << classname << " "<<eh->GetPscuHeader()->GetOrbitalTime()<<endl;
231    
# Line 232  UInt_t TrkParams::ValidateTrkCalib( Cali Line 275  UInt_t TrkParams::ValidateTrkCalib( Cali
275  //       if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) ACQ_BUILD_INFO= >>> "<<hex << (run->ACQ_BUILD_INFO&mask) << " != "<< build << dec<<endl;  //       if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) ACQ_BUILD_INFO= >>> "<<hex << (run->ACQ_BUILD_INFO&mask) << " != "<< build << dec<<endl;
276  //       return 0; // :-(  //       return 0; // :-(
277  //      }  //      }
278        return 1; // :-)  
279    //      return 1; // :-)
280    
281    //    cout << validate << endl;
282        return validate;
283    
284  }  }
285  /**  /**
# Line 241  UInt_t TrkParams::ValidateTrkCalib( Cali Line 288  UInt_t TrkParams::ValidateTrkCalib( Cali
288  void TrkParams::FillACalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){  void TrkParams::FillACalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){
289    
290      cTrkCalib *ca = &pedsigbad_;      cTrkCalib *ca = &pedsigbad_;
291        ca->Reset();
292    
293      TTree *tr1 = (TTree*)f0->Get("CalibTrk1");        TTree *tr1 = (TTree*)f0->Get("CalibTrk1");  
294      TTree *tr2 = (TTree*)f0->Get("CalibTrk2");      TTree *tr2 = (TTree*)f0->Get("CalibTrk2");
# Line 254  void TrkParams::FillACalibFrom(TFile* f0 Line 302  void TrkParams::FillACalibFrom(TFile* f0
302      Int_t dspn1(0),dspn2(0);      Int_t dspn1(0),dspn2(0);
303    
304      // --- TEST TEST TEST TEST --- //      // --- TEST TEST TEST TEST --- //
305      TrkParams::ValidateTrkCalib(calibdata1);  //    TrkParams::ValidateTrkCalib(calibdata1);
306      TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2);  //    TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2);
307            
308        UInt_t test1 = TrkParams::ValidateTrkCalib(calibdata1);
309        UInt_t test2 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2);
310        if( !test1 || !test2 ){
311            if(TrkParams::calib.VALIDATION==1)cout << "--> modify DB info "<<endl;
312            TrkParams::calib.VALIDATION = 0;
313        }
314        if(TrkParams::calib.VALIDATION==0)cout << " ** WARNING ** Calibration not validated "<<endl;
315    
316      for(Int_t i=0;i<6;i++){      for(Int_t i=0;i<6;i++){
317          dspn1=calibdata1->DSPnumber[i]-1;          dspn1=calibdata1->DSPnumber[i]-1;
318          dspn2=calibdata2->DSPnumber[i]-1;          dspn2=calibdata2->DSPnumber[i]-1;
319          /*     cout<<"dspn1= "<<dspn1<<"   dspn2= "<<dspn2<<endl; */  //      cout<<"dspn1= "<<dspn1<<"   dspn2= "<<dspn2<<endl;      
320          for(Int_t ii=0;ii<3072;ii++){          for(Int_t ii=0;ii<3072;ii++){
321              Int_t j=(ii/128);              Int_t j=(ii/128);
322              Int_t jj=ii-j*128;              Int_t jj=ii-j*128;
323              ca->pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii];              if(dspn1>=0 && dspn1<12){
324              ca->pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii];                  ca->pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii];
325              ca->pedestal_t[jj][j][dspn1]=aint(calibdata1->DSPped_par[i][ii]);                  ca->pedestal_t[jj][j][dspn1]=aint(calibdata1->DSPped_par[i][ii]);
326              ca->pedestal_t[jj][j][dspn2]=aint(calibdata2->DSPped_par[i][ii]);                  ca->sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii];
327              ca->sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii];                  ca->sigma_t[jj][j][dspn1]=anint(calibdata1->DSPsig_par[i][ii]);
328              ca->sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii];                  if(calibdata1->DSPbad_par[i][ii]==0)
329              ca->sigma_t[jj][j][dspn1]=anint(calibdata1->DSPsig_par[i][ii]);                      ca->bad[jj][j][dspn1]=1;
330              ca->sigma_t[jj][j][dspn2]=anint(calibdata2->DSPsig_par[i][ii]);                  else if(calibdata1->DSPbad_par[i][ii]==1)
331              //        cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl;                      ca->bad[jj][j][dspn1]=0;
332              //        cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl;                  //            cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl;
333              //        cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl;                  //        cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl;
334              //        cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl;              }
335            
336              //              if(dspn2>=0 && dspn2<12){
337              // invert the bad                  ca->pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii];
338              //                  ca->pedestal_t[jj][j][dspn2]=aint(calibdata2->DSPped_par[i][ii]);
339              if(calibdata1->DSPbad_par[i][ii]==0)                  ca->sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii];
340                  ca->bad[jj][j][dspn1]=1;                  ca->sigma_t[jj][j][dspn2]=anint(calibdata2->DSPsig_par[i][ii]);
341              else if(calibdata1->DSPbad_par[i][ii]==1)                  if(calibdata2->DSPbad_par[i][ii]==0)
342                  ca->bad[jj][j][dspn1]=0;                      ca->bad[jj][j][dspn2]=1;
343              if(calibdata2->DSPbad_par[i][ii]==0)                  else if(calibdata2->DSPbad_par[i][ii]==1)
344                  ca->bad[jj][j][dspn2]=1;                      ca->bad[jj][j][dspn2]=0;
345              else if(calibdata2->DSPbad_par[i][ii]==1)                  //        cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl;
346                  ca->bad[jj][j][dspn2]=0;                  //        cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl;
347                }
348          };          };
349      };      };
350                    
# Line 300  void TrkParams::FillACalibFrom(TFile* f0 Line 357  void TrkParams::FillACalibFrom(TFile* f0
357  void TrkParams::FillFCalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){  void TrkParams::FillFCalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){
358    
359      cTrkCalib *ca = &pedsigbad_;      cTrkCalib *ca = &pedsigbad_;
360    //    ca->Reset();
361    
362      TTree *tr1 = (TTree*)f0->Get("CalibTrk1");        TTree *tr1 = (TTree*)f0->Get("CalibTrk1");  
363      TTree *tr2 = (TTree*)f0->Get("CalibTrk2");      TTree *tr2 = (TTree*)f0->Get("CalibTrk2");
# Line 313  void TrkParams::FillFCalibFrom(TFile* f0 Line 371  void TrkParams::FillFCalibFrom(TFile* f0
371      Int_t dspn1(0),dspn2(0);      Int_t dspn1(0),dspn2(0);
372    
373      // --- TEST TEST TEST TEST --- //      // --- TEST TEST TEST TEST --- //
374      TrkParams::ValidateTrkCalib(calibdata1);  //     TrkParams::ValidateTrkCalib(calibdata1);
375      TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2);  //     TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2);
376        UInt_t test1 = TrkParams::ValidateTrkCalib(calibdata1);
377        UInt_t test2 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2);
378        if( !test1 || !test2 ){
379            if(TrkParams::calib.VALIDATION==1)cout << "--> modify DB info "<<endl;
380            TrkParams::calib.VALIDATION = 0;
381        }
382        if(TrkParams::calib.VALIDATION==0)cout << " ** WARNING ** Calibration not validated "<<endl;
383                    
384      for(Int_t i=0;i<6;i++){      for(Int_t i=0;i<6;i++){
385          dspn1=calibdata1->DSPnumber[i]-1;          dspn1=calibdata1->DSPnumber[i]-1;
# Line 323  void TrkParams::FillFCalibFrom(TFile* f0 Line 388  void TrkParams::FillFCalibFrom(TFile* f0
388          for(Int_t ii=0;ii<3072;ii++){          for(Int_t ii=0;ii<3072;ii++){
389              Int_t j=(ii/128);              Int_t j=(ii/128);
390              Int_t jj=ii-j*128;              Int_t jj=ii-j*128;
391              ca->pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii];              if(dspn1>=0 && dspn1<12){
392              ca->pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii];                  ca->pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii];
393              ca->sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii];                  ca->sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii];
394              ca->sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii];                  if(calibdata1->DSPbad_par[i][ii]==0)
395              //        cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl;                      ca->bad[jj][j][dspn1]=1;
396              //        cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl;                  else if(calibdata1->DSPbad_par[i][ii]==1)
397              //        cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl;                      ca->bad[jj][j][dspn1]=0;
398              //        cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl;                  //            cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl;
399                            //        cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl;
400              //              }
401              // invert the bad              if(dspn2>=0 && dspn2<12){
402              //                  ca->pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii];
403              if(calibdata1->DSPbad_par[i][ii]==0)                  ca->sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii];
404                  ca->bad[jj][j][dspn1]=1;                  if(calibdata2->DSPbad_par[i][ii]==0)
405              else if(calibdata1->DSPbad_par[i][ii]==1)                      ca->bad[jj][j][dspn2]=1;
406                  ca->bad[jj][j][dspn1]=0;                  else if(calibdata2->DSPbad_par[i][ii]==1)
407              if(calibdata2->DSPbad_par[i][ii]==0)                      ca->bad[jj][j][dspn2]=0;
408                  ca->bad[jj][j][dspn2]=1;                  //        cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl;
409              else if(calibdata2->DSPbad_par[i][ii]==1)                  //        cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl;
410                  ca->bad[jj][j][dspn2]=0;              }
411          };          };
412      };      };
413                    
# Line 355  void TrkParams::FillFCalibFrom(TFile* f0 Line 420  void TrkParams::FillFCalibFrom(TFile* f0
420  void TrkParams::FillTCalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){  void TrkParams::FillTCalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){
421    
422      cTrkCalib *ca = &pedsigbad_;      cTrkCalib *ca = &pedsigbad_;
423    //    ca->Reset();
424    
425      TTree *tr1 = (TTree*)f0->Get("CalibTrk1");        TTree *tr1 = (TTree*)f0->Get("CalibTrk1");  
426      TTree *tr2 = (TTree*)f0->Get("CalibTrk2");      TTree *tr2 = (TTree*)f0->Get("CalibTrk2");
# Line 368  void TrkParams::FillTCalibFrom(TFile* f0 Line 434  void TrkParams::FillTCalibFrom(TFile* f0
434      Int_t dspn1(0),dspn2(0);      Int_t dspn1(0),dspn2(0);
435                    
436      // --- TEST TEST TEST TEST --- //      // --- TEST TEST TEST TEST --- //
437      TrkParams::ValidateTrkCalib(calibdata1);  //     TrkParams::ValidateTrkCalib(calibdata1);
438      TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2);  //     TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2);
439        UInt_t test1 = TrkParams::ValidateTrkCalib(calibdata1);
440        UInt_t test2 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2);
441        if( !test1 || !test2 ){
442            if(TrkParams::calib.VALIDATION==1)cout << "--> modify DB info "<<endl;
443            TrkParams::calib.VALIDATION = 0;
444        }
445        if(TrkParams::calib.VALIDATION==0)cout << " ** WARNING ** Calibration not validated "<<endl;
446    
447      for(Int_t i=0;i<6;i++){      for(Int_t i=0;i<6;i++){
448          dspn1=calibdata1->DSPnumber[i]-1;          dspn1=calibdata1->DSPnumber[i]-1;
# Line 378  void TrkParams::FillTCalibFrom(TFile* f0 Line 451  void TrkParams::FillTCalibFrom(TFile* f0
451          for(Int_t ii=0;ii<3072;ii++){          for(Int_t ii=0;ii<3072;ii++){
452              Int_t j=(ii/128);              Int_t j=(ii/128);
453              Int_t jj=ii-j*128;              Int_t jj=ii-j*128;
454              ca->pedestal_t[jj][j][dspn1]=aint(calibdata1->DSPped_par[i][ii]);              if(dspn1>=0 && dspn1<12){
455              ca->pedestal_t[jj][j][dspn2]=aint(calibdata2->DSPped_par[i][ii]);                  ca->pedestal_t[jj][j][dspn1]=aint(calibdata1->DSPped_par[i][ii]);
456              ca->sigma_t[jj][j][dspn1]=anint(calibdata1->DSPsig_par[i][ii]);                  ca->sigma_t[jj][j][dspn1]=anint(calibdata1->DSPsig_par[i][ii]);
457              ca->sigma_t[jj][j][dspn2]=anint(calibdata2->DSPsig_par[i][ii]);                  }
458                if(dspn2>=0 && dspn2<12){
459                    ca->pedestal_t[jj][j][dspn2]=aint(calibdata2->DSPped_par[i][ii]);
460                    ca->sigma_t[jj][j][dspn2]=anint(calibdata2->DSPsig_par[i][ii]);
461                }  
462          };          };
463      };      };
464                    
# Line 404  void TrkParams::FillTCalibFrom(TString p Line 481  void TrkParams::FillTCalibFrom(TString p
481  void TrkParams::FillMask(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){  void TrkParams::FillMask(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){
482            
483      cTrkMask *ma = &mask_;      cTrkMask *ma = &mask_;
484        ma->Reset();
485    
486      TrkCalib *calib = new TrkCalib();      TrkCalib *calib = new TrkCalib();
487    
# Line 426  void TrkParams::FillMask(TFile* f0, Int_ Line 504  void TrkParams::FillMask(TFile* f0, Int_
504              tr->GetEntry(ev_reg2);              tr->GetEntry(ev_reg2);
505          }          }
506          for(Int_t ipkt=0; ipkt<NPLANE; ipkt++){          for(Int_t ipkt=0; ipkt<NPLANE; ipkt++){
507              for(Int_t ivk=0; ivk<NVK; ivk++){              Int_t view   = calib->GetView(ipkt);
508                  Int_t view   = calib->GetView(ipkt);              if( (view-1)>= 0 && (view-1)<12 ){
509                  Float_t sigm = calib->GetMean("SIG-BAD",ipkt,ivk+1);                  for(Int_t ivk=0; ivk<NVK; ivk++){
510                  Float_t sigmin = 0.;                      Float_t sigm = calib->GetMean("SIG-BAD",ipkt,ivk+1);
511                  if(view%2)sigmin = 6.5;                      Float_t sigmin = 0.;
512                  else      sigmin = 2.5;                      if(view%2)sigmin = 6.5;
513                  Int_t mask = 1;                      else      sigmin = 2.5;
514                  if( sigm<sigmin )mask = 0;                      Int_t mask = 1;
515                                    if( sigm<sigmin )mask = 0;              
516                  ma->mask_vk_run[ivk][view-1] = mask;                      ma->mask_vk_run[ivk][view-1] = mask;                    
517                                }      
518  //              if(mask==0)cout<< " VIEW "<<view<<" VK "<<ivk+1<<" -- <SIG> "<<sigm<<" ---> MASKED!"<<endl;              }
             }    
519          }          }
520          if(tr)tr->Delete();          if(tr)tr->Delete();
521      }      }
522    
523        if(TrkParams::VerboseMode()){
524            for(Int_t iv=0; iv<NVIEW; iv++){
525                cout<<"view "<<setw(3)<<iv<<": ";
526                for(Int_t ivk=0; ivk<NVK; ivk++)cout<<ma->mask_vk_run[ivk][iv];
527                cout << endl;
528            }
529        }
530    
531      if(calib)calib->Delete();      if(calib)calib->Delete();
532    
533  };  };
# Line 455  void TrkParams::FillMask(TFile* f0, Int_ Line 540  void TrkParams::FillMask(TFile* f0, Int_
540    
541    
542  /**  /**
543   * Static method to load calibration.   * \brief Static method to load calibration.
544   * Calibration is loaded ONLY IF TrkParams::CalibLoaded()==kTRUE, which appens the   * Calibration is loaded ONLY IF TrkParams::CalibLoaded()==kTRUE, which appens after the method TrkParams::SetCalib(***) is called.
  * first time the method is called (but it does not work becouse I didn't set any  
  * default calibration for the moment) or  after the method TrkParams::SetCalib(***) is called.  
545   */   */
546  Bool_t TrkParams::LoadCalib( ){  Bool_t TrkParams::LoadCalib( ){
547    
# Line 589  Bool_t TrkParams::Set( GL_RUN* glrun , T Line 672  Bool_t TrkParams::Set( GL_RUN* glrun , T
672          gl[index]     = q4;          gl[index]     = q4;
673          glpath[index] = q4.PATH+q4.NAME;          glpath[index] = q4.PATH+q4.NAME;
674          glload[index] = false;          glload[index] = false;
675          if(TrkParams::VerboseMode())cout << "<< set TrkParams type "<<type<<" >> (from DB) "<<endl;          if(TrkParams::VerboseMode())
676                cout << "<< set TrkParams type "<<type<<" from DB << RUN "<<glrun->ID<<endl;
677          return true;          return true;
678    
679      }      }
# Line 609  Bool_t TrkParams::Set( TString path , UI Line 693  Bool_t TrkParams::Set( TString path , UI
693    
694      gl[index].TYPE= type;      gl[index].TYPE= type;
695      glpath[index] = path;      glpath[index] = path;
696      if(TrkParams::VerboseMode())cout << "<< set TrkParams type "<<type<<" >> (from input) "<<endl;      if(TrkParams::VerboseMode())
697            cout << "<< set TrkParams type "<<type<<" from path << "<<path<<endl;
698      glload[index] = false;      glload[index] = false;
699    
700  //    return TrkParams::Load(type);  //    return TrkParams::Load(type);
# Line 878  void TrkParams::SetStepMin(int istepmin) Line 963  void TrkParams::SetStepMin(int istepmin)
963  };  };
964    
965  /**  /**
966     * Fill F77 commons with PFA settings
967     */
968    void TrkParams::SetPFA(){
969        sw_.pfaid = init__pfa;    
970        for(int i=0; i<6; i++){
971            pfa_.e234ax[i] = init__pfa_e234ax[i];
972            pfa_.e234ay[i] = init__pfa_e234ay[i];
973        }
974    };
975    /**
976   * \brief Set p.f.a.   * \brief Set p.f.a.
977   *   *
978   * Implemented algorythms:   * Implemented algorythms:
979   * 0  ETA (default)   * 0  ETA
980   * 1  ---   * 1  ---
981   * 2  ETA2   * 2  ETA2
982   * 3  ETA3   * 3  ETA3
983   * 4  ETA4   * 4  ETA4
984     * 5  ETAL ==> ETA+LANDI
985   * 10 COG   * 10 COG
986   * 11 COG1   * 11 COG1
987   * 12 COG2   * 12 COG2
# Line 897  void TrkParams::SetPFA(int pfaid){ Line 993  void TrkParams::SetPFA(int pfaid){
993      SetPFA();      SetPFA();
994  };  };
995  /**  /**
996     * \brief Set p.f.a. angular intervals
997     *
998     * This methods allows to set these amgular intervals to apply ETA2,ETA3 or ETA4
999     * algorythm, in case ETA or ETAL is chosen (see TrkParams::SetPFA(int pfaid)).
1000     * @param v Pointer to a vector of 12 components, which represent the
1001     * angular limits for ETA2,ETA3 and ETA4, for x and y views, respectivelly.
1002     *
1003     */
1004    void TrkParams::SetPFA(float *v){
1005        for(int i=0; i<6; i++){
1006            init__pfa_e234ax[i]  = v[i];
1007            init__pfa_e234ay[i]  = v[i+6];
1008        }
1009        SetPFA();
1010    };
1011    
1012    
1013    /**
1014   * \brief Get spatial resolution.   * \brief Get spatial resolution.
1015   *   *
1016   * Method to retrieve the spatial resolution associated with the   * Method to retrieve the spatial resolution associated with the
# Line 918  float TrkParams::GetResolution(int view, Line 1032  float TrkParams::GetResolution(int view,
1032    
1033    
1034    
1035    
1036  ClassImp(TrkParams);  ClassImp(TrkParams);

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.14

  ViewVC Help
Powered by ViewVC 1.1.23