/[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.11 by pam-fi, Fri Aug 17 14:36:05 2007 UTC revision 1.16 by pam-fi, Tue Oct 9 15:54:37 2007 UTC
# Line 24  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  int    TrkParams::init__pfa            = 14;//COG4  cDbg   TrkParams::init__dbg_mode       = {0,0,0};
31    //int    TrkParams::init__pfa            = 14;//COG4
32    int    TrkParams::init__pfa            = 5;//ETAL
33  int    TrkParams::init__mini_trackmode = 0;  int    TrkParams::init__mini_trackmode = 0;
34  int    TrkParams::init__mini_istepmin  = 3;  int    TrkParams::init__mini_istepmin  = 5; //3;
35  double TrkParams::init__mini_fact      = 100.;  double TrkParams::init__mini_fact      = 1.e4; //100.;
36    float  TrkParams::init__pfa_e234ax[]   = {0.,10.,10.,15.,15.,90.};
37    float  TrkParams::init__pfa_e234ay[]   = {0.,20.,90.,90.,90.,90.};
38    
39  TrkParams::TrkParams(){  TrkParams::TrkParams(){
40    
# Line 623  Bool_t TrkParams::Set( GL_RUN* glrun , T Line 626  Bool_t TrkParams::Set( GL_RUN* glrun , T
626      UInt_t index = TrkParams::GetIndex( type );      UInt_t index = TrkParams::GetIndex( type );
627      if(index < 0)return false;      if(index < 0)return false;
628    
629        UInt_t runheadtime=0;
630        UInt_t runid=0;
631    //    UInt_t runheadtime = numeric_limits<UInt_t>::max();
632        if(glrun){
633            runheadtime = glrun->RUNHEADER_TIME;
634            runid       = glrun->ID;
635        }else cout <<"Bool_t TrkParams::Set(GL_RUN*,TSQLServer*,UInt_t) >> Missing run info -- taking first entry (**WARNING** check that this is ok!! )"<<endl;
636    
637    //    if(TrkParams::VerboseMode())
638        cout << "<< set TrkParams type "<<type<<" from DB << RUN "<<runid<<endl;
639    
640    
641      if( !TrkParams::IsLoaded(type) ||      if( !TrkParams::IsLoaded(type) ||
642          glrun->RUNHEADER_TIME < gl[index].FROM_TIME   ||          runheadtime < gl[index].FROM_TIME   ||
643          glrun->RUNHEADER_TIME > gl[index].TO_TIME     ||                  runheadtime > gl[index].TO_TIME     ||  
644          false ){          false ){
645    
646          if( !dbc || (dbc && !dbc->IsConnected()) ){          if( !dbc || (dbc && !dbc->IsConnected()) ){
# Line 659  Bool_t TrkParams::Set( GL_RUN* glrun , T Line 674  Bool_t TrkParams::Set( GL_RUN* glrun , T
674              }              }
675          }          }
676    
   
         UInt_t runheadtime = numeric_limits<UInt_t>::max();  
         if(glrun)runheadtime = glrun->RUNHEADER_TIME;  
         else cout <<"Missing run info -- taking last entry "<<endl;  
   
677          GL_PARAM q4;          GL_PARAM q4;
678          if( q4.Query_GL_PARAM(runheadtime,type,dbc) )return false;          if( q4.Query_GL_PARAM(runheadtime,type,dbc) )return false;
679    
680          gl[index]     = q4;          gl[index]     = q4;
681          glpath[index] = q4.PATH+q4.NAME;          glpath[index] = q4.PATH+q4.NAME;
682          glload[index] = false;          glload[index] = false;
683          if(TrkParams::VerboseMode())cout << "<< set TrkParams type "<<type<<" >> (from DB) "<<endl;  
684          return true;          return true;
685    
686      }      }
# Line 690  Bool_t TrkParams::Set( TString path , UI Line 700  Bool_t TrkParams::Set( TString path , UI
700    
701      gl[index].TYPE= type;      gl[index].TYPE= type;
702      glpath[index] = path;      glpath[index] = path;
703      if(TrkParams::VerboseMode())cout << "<< set TrkParams type "<<type<<" >> (from input) "<<endl;      if(TrkParams::VerboseMode())
704            cout << "<< set TrkParams type "<<type<<" from path << "<<path<<endl;
705      glload[index] = false;      glload[index] = false;
706    
707  //    return TrkParams::Load(type);  //    return TrkParams::Load(type);
# Line 706  Bool_t TrkParams::Set( TString path , UI Line 717  Bool_t TrkParams::Set( TString path , UI
717   */   */
718  Bool_t TrkParams::Set(UInt_t type){  Bool_t TrkParams::Set(UInt_t type){
719    
     UInt_t index = TrkParams::GetIndex( type );  
     if(index < 0)return false;  
720    
721      gl[index].TYPE= type;      return Set(0,0,type);
722      glload[index] = false;  
723    //     UInt_t index = TrkParams::GetIndex( type );
724    //     if(index < 0)return false;
725    
726    //     gl[index].TYPE= type;
727    //     glload[index] = false;
728    
729      // -----------------------------------------  //     // -----------------------------------------
730      // check if enviroment variables are defined  //     // check if enviroment variables are defined
731      // -----------------------------------------  //     // -----------------------------------------
732      glpath[index] = gSystem->Getenv("PAM_CALIB");  //     glpath[index] = gSystem->Getenv("PAM_CALIB");
733    
734      if( !glpath[index].IsNull() ){  //     if( !glpath[index].IsNull() ){
735            
736          switch(type){  //      switch(type){
737          case 1:  //      case 1:
738              glpath[index].Append("/trk-param/field_param-0/");  //          glpath[index].Append("/trk-param/field_param-0/");
739              break;  //          break;
740          case 2:  //      case 2:
741              glpath[index].Append("/trk-param/mip_param-0/");  //          glpath[index].Append("/trk-param/mip_param-0/");
742              break;  //          break;
743          case 3:  //      case 3:
744              glpath[index].Append("/trk-param/charge_param-1/");  //          glpath[index].Append("/trk-param/charge_param-1/");
745              break;  //          break;
746          case 4:  //      case 4:
747              glpath[index].Append("/trk-param/eta_param-0/");  //          glpath[index].Append("/trk-param/eta_param-2/");
748              break;  //          break;
749          case 5:  //      case 5:
750              glpath[index].Append("/trk-param/align_param-0/");  //          glpath[index].Append("/trk-param/align_param-Q.A/");
751              break;  //          break;
752          case 6:  //      case 6:
753              glpath[index].Append("/trk-param/mask_param-1/");  //          glpath[index].Append("/trk-param/mask_param-1/");
754              break;  //          break;
755          case 7:  //      case 7:
756              glpath[index].Append("/trk-param/default_calib/");  //          glpath[index].Append("/trk-param/default_calib/");
757              break;  //          break;
758          }  //      }
759                    
760      }else{  //     }else{
761          cout << " TrkParams::Set( UInt_t type) ==> No PAMELA environment variables defined "<<endl;  //      cout << " TrkParams::Set( UInt_t type) ==> No PAMELA environment variables defined "<<endl;
762          return false;  //      return false;
763                    
764      }  //     }
765    
766      if(TrkParams::VerboseMode())cout << "<< set TrkParams type "<<type<<" (from env var PAM_CALIB) >>"<<endl;  // //    if(TrkParams::VerboseMode())cout << "<< set TrkParams type "<<type<<" (from env var PAM_CALIB + default path) >>"<<endl;
767  //    return TrkParams::Load(type);  //     cout << "<< set TrkParams type "<<type<<" (from env var PAM_CALIB + default path) >>  **WARNING** does not use DB info !!!!"<<endl;
768      return true;  
769    // //    return TrkParams::Load(type);
770    //     return true;
771    
772  };  };
773  /**  /**
# Line 762  Bool_t TrkParams::Set(UInt_t type){ Line 778  Bool_t TrkParams::Set(UInt_t type){
778   */   */
779  Bool_t  TrkParams::Set( ){  Bool_t  TrkParams::Set( ){
780    
781      Bool_t connected = false;  //    Bool_t connected = false;
   
782  //    cout <<" Missing DB connection -- check PAMELA environment variables "<<endl;  //    cout <<" Missing DB connection -- check PAMELA environment variables "<<endl;
783      TString host = "mysql://localhost/pamelaprod";  //     TString host = "mysql://localhost/pamelaprod";
784      TString user = "anonymous";  //     TString user = "anonymous";
785      TString psw = "";  //     TString psw = "";
786      const char *pamdbhost=gSystem->Getenv("PAM_DBHOST");  //     const char *pamdbhost=gSystem->Getenv("PAM_DBHOST");
787      const char *pamdbuser=gSystem->Getenv("PAM_DBUSER");  //     const char *pamdbuser=gSystem->Getenv("PAM_DBUSER");
788      const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW");  //     const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW");
789      if ( !pamdbhost ) pamdbhost = "";  //     if ( !pamdbhost ) pamdbhost = "";
790      if ( !pamdbuser ) pamdbuser = "";  //     if ( !pamdbuser ) pamdbuser = "";
791      if ( !pamdbpsw ) pamdbpsw = "";  //     if ( !pamdbpsw ) pamdbpsw = "";
792      if ( strcmp(pamdbhost,"") ) host = pamdbhost;  //     if ( strcmp(pamdbhost,"") ) host = pamdbhost;
793      if ( strcmp(pamdbuser,"") ) user = pamdbuser;  //     if ( strcmp(pamdbuser,"") ) user = pamdbuser;
794      if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw;  //     if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw;
795      if(TrkParams::VerboseMode()){  //     if(TrkParams::VerboseMode()){
796          cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;  //      cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
797          cout<<"Connecting to DB"<<endl;  //      cout<<"Connecting to DB"<<endl;
798          cout<<"HOST "<<host<<endl;  //      cout<<"HOST "<<host<<endl;
799          cout<<"USER "<<user<<endl;  //      cout<<"USER "<<user<<endl;
800          cout<<"PSW  "<<psw<<endl;  //      cout<<"PSW  "<<psw<<endl;
801      }  //     }
802      TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data());  //     TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data());
803      if( dbc || dbc->IsConnected() )connected = true;  //     if( dbc || dbc->IsConnected() )connected = true;
804      else cout << " >> DB connection FAILED!!!"<<endl;  //     else cout << " >> DB connection FAILED!!!"<<endl;
805      if(TrkParams::VerboseMode())cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;  //     if(TrkParams::VerboseMode())cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
806            
807      if(connected){  //     if(connected){
808          if ( !TrkParams::Set(0,dbc) )return false;  //      if ( !TrkParams::Set(0,dbc) )return false;
809          dbc->Close();  //      dbc->Close();
810      }else for(Int_t i=0; i<NTYPES; i++)if ( !TrkParams::Set(trkparamtype[i])) return false;  //     }else for(Int_t i=0; i<NTYPES; i++)if ( !TrkParams::Set(trkparamtype[i])) return false;
811    
812        for(Int_t i=0; i<NTYPES; i++)if ( !TrkParams::Set(trkparamtype[i])) return false;
813    
814      return true;      return true;
815  }  }
# Line 959  void TrkParams::SetStepMin(int istepmin) Line 976  void TrkParams::SetStepMin(int istepmin)
976  };  };
977    
978  /**  /**
979     * Fill F77 commons with PFA settings
980     */
981    void TrkParams::SetPFA(){
982        sw_.pfaid = init__pfa;    
983        for(int i=0; i<6; i++){
984            pfa_.e234ax[i] = init__pfa_e234ax[i];
985            pfa_.e234ay[i] = init__pfa_e234ay[i];
986        }
987    };
988    /**
989   * \brief Set p.f.a.   * \brief Set p.f.a.
990   *   *
991   * Implemented algorythms:   * Implemented algorythms:
# Line 979  void TrkParams::SetPFA(int pfaid){ Line 1006  void TrkParams::SetPFA(int pfaid){
1006      SetPFA();      SetPFA();
1007  };  };
1008  /**  /**
1009     * \brief Set p.f.a. angular intervals
1010     *
1011     * This methods allows to set these amgular intervals to apply ETA2,ETA3 or ETA4
1012     * algorythm, in case ETA or ETAL is chosen (see TrkParams::SetPFA(int pfaid)).
1013     * @param v Pointer to a vector of 12 components, which represent the
1014     * angular limits for ETA2,ETA3 and ETA4, for x and y views, respectivelly.
1015     *
1016     */
1017    void TrkParams::SetPFA(float *v){
1018        for(int i=0; i<6; i++){
1019            init__pfa_e234ax[i]  = v[i];
1020            init__pfa_e234ay[i]  = v[i+6];
1021        }
1022        SetPFA();
1023    };
1024    
1025    
1026    /**
1027   * \brief Get spatial resolution.   * \brief Get spatial resolution.
1028   *   *
1029   * Method to retrieve the spatial resolution associated with the   * Method to retrieve the spatial resolution associated with the
# Line 1000  float TrkParams::GetResolution(int view, Line 1045  float TrkParams::GetResolution(int view,
1045    
1046    
1047    
1048    
1049  ClassImp(TrkParams);  ClassImp(TrkParams);

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

  ViewVC Help
Powered by ViewVC 1.1.23