28 |
// other parameters |
// other parameters |
29 |
// ---------------- |
// ---------------- |
30 |
cDbg TrkParams::init__dbg_mode = {0,0,0}; |
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__pfa = 5;//ETAL |
33 |
int TrkParams::init__mini_trackmode = 0; |
int TrkParams::init__mini_trackmode = 0; |
34 |
int TrkParams::init__mini_istepmin = 5; //3; |
int TrkParams::init__mini_istepmin = 5; //3; |
35 |
double TrkParams::init__mini_fact = 1.e4; //100.; |
double TrkParams::init__mini_fact = 1.e4; //100.; |
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()) ){ |
668 |
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
669 |
if( !dbc )return false; |
if( !dbc )return false; |
670 |
if( !dbc->IsConnected() )return false; |
if( !dbc->IsConnected() )return false; |
671 |
|
stringstream myquery; // EMILIANO |
672 |
|
myquery.str(""); // EMILIANO |
673 |
|
myquery << "SET time_zone='+0:00'"; // EMILIANO |
674 |
|
dbc->Query(myquery.str().c_str()); // EMILIANO |
675 |
if(TrkParams::VerboseMode()){ |
if(TrkParams::VerboseMode()){ |
676 |
cout << " ...done"<<endl; |
cout << " ...done"<<endl; |
677 |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
678 |
} |
} |
679 |
} |
} |
680 |
|
|
|
|
|
|
UInt_t runheadtime = numeric_limits<UInt_t>::max(); |
|
|
if(glrun)runheadtime = glrun->RUNHEADER_TIME; |
|
|
else cout <<"Missing run info -- taking last entry "<<endl; |
|
|
|
|
681 |
GL_PARAM q4; |
GL_PARAM q4; |
682 |
if( q4.Query_GL_PARAM(runheadtime,type,dbc) )return false; |
if( q4.Query_GL_PARAM(runheadtime,type,dbc) )return false; |
683 |
|
|
684 |
gl[index] = q4; |
gl[index] = q4; |
685 |
glpath[index] = q4.PATH+q4.NAME; |
glpath[index] = q4.PATH+q4.NAME; |
686 |
glload[index] = false; |
glload[index] = false; |
687 |
if(TrkParams::VerboseMode()) |
|
|
cout << "<< set TrkParams type "<<type<<" from DB << RUN "<<glrun->ID<<endl; |
|
688 |
return true; |
return true; |
689 |
|
|
690 |
} |
} |
721 |
*/ |
*/ |
722 |
Bool_t TrkParams::Set(UInt_t type){ |
Bool_t TrkParams::Set(UInt_t type){ |
723 |
|
|
|
UInt_t index = TrkParams::GetIndex( type ); |
|
|
if(index < 0)return false; |
|
724 |
|
|
725 |
gl[index].TYPE= type; |
return Set(0,0,type); |
726 |
glload[index] = false; |
|
727 |
|
// UInt_t index = TrkParams::GetIndex( type ); |
728 |
|
// if(index < 0)return false; |
729 |
|
|
730 |
// ----------------------------------------- |
// gl[index].TYPE= type; |
731 |
// check if enviroment variables are defined |
// glload[index] = false; |
|
// ----------------------------------------- |
|
|
glpath[index] = gSystem->Getenv("PAM_CALIB"); |
|
732 |
|
|
733 |
if( !glpath[index].IsNull() ){ |
// // ----------------------------------------- |
734 |
|
// // check if enviroment variables are defined |
735 |
|
// // ----------------------------------------- |
736 |
|
// glpath[index] = gSystem->Getenv("PAM_CALIB"); |
737 |
|
|
738 |
|
// if( !glpath[index].IsNull() ){ |
739 |
|
|
740 |
switch(type){ |
// switch(type){ |
741 |
case 1: |
// case 1: |
742 |
glpath[index].Append("/trk-param/field_param-0/"); |
// glpath[index].Append("/trk-param/field_param-0/"); |
743 |
break; |
// break; |
744 |
case 2: |
// case 2: |
745 |
glpath[index].Append("/trk-param/mip_param-0/"); |
// glpath[index].Append("/trk-param/mip_param-0/"); |
746 |
break; |
// break; |
747 |
case 3: |
// case 3: |
748 |
glpath[index].Append("/trk-param/charge_param-1/"); |
// glpath[index].Append("/trk-param/charge_param-1/"); |
749 |
break; |
// break; |
750 |
case 4: |
// case 4: |
751 |
glpath[index].Append("/trk-param/eta_param-0/"); |
// glpath[index].Append("/trk-param/eta_param-2/"); |
752 |
break; |
// break; |
753 |
case 5: |
// case 5: |
754 |
glpath[index].Append("/trk-param/align_param-0/"); |
// glpath[index].Append("/trk-param/align_param-Q.A/"); |
755 |
break; |
// break; |
756 |
case 6: |
// case 6: |
757 |
glpath[index].Append("/trk-param/mask_param-1/"); |
// glpath[index].Append("/trk-param/mask_param-1/"); |
758 |
break; |
// break; |
759 |
case 7: |
// case 7: |
760 |
glpath[index].Append("/trk-param/default_calib/"); |
// glpath[index].Append("/trk-param/default_calib/"); |
761 |
break; |
// break; |
762 |
} |
// } |
763 |
|
|
764 |
}else{ |
// }else{ |
765 |
cout << " TrkParams::Set( UInt_t type) ==> No PAMELA environment variables defined "<<endl; |
// cout << " TrkParams::Set( UInt_t type) ==> No PAMELA environment variables defined "<<endl; |
766 |
return false; |
// return false; |
767 |
|
|
768 |
} |
// } |
769 |
|
|
770 |
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; |
771 |
// return TrkParams::Load(type); |
// cout << "<< set TrkParams type "<<type<<" (from env var PAM_CALIB + default path) >> **WARNING** does not use DB info !!!!"<<endl; |
772 |
return true; |
|
773 |
|
// // return TrkParams::Load(type); |
774 |
|
// return true; |
775 |
|
|
776 |
}; |
}; |
777 |
/** |
/** |
782 |
*/ |
*/ |
783 |
Bool_t TrkParams::Set( ){ |
Bool_t TrkParams::Set( ){ |
784 |
|
|
785 |
Bool_t connected = false; |
// Bool_t connected = false; |
|
|
|
786 |
// cout <<" Missing DB connection -- check PAMELA environment variables "<<endl; |
// cout <<" Missing DB connection -- check PAMELA environment variables "<<endl; |
787 |
TString host = "mysql://localhost/pamelaprod"; |
// TString host = "mysql://localhost/pamelaprod"; |
788 |
TString user = "anonymous"; |
// TString user = "anonymous"; |
789 |
TString psw = ""; |
// TString psw = ""; |
790 |
const char *pamdbhost=gSystem->Getenv("PAM_DBHOST"); |
// const char *pamdbhost=gSystem->Getenv("PAM_DBHOST"); |
791 |
const char *pamdbuser=gSystem->Getenv("PAM_DBUSER"); |
// const char *pamdbuser=gSystem->Getenv("PAM_DBUSER"); |
792 |
const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW"); |
// const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW"); |
793 |
if ( !pamdbhost ) pamdbhost = ""; |
// if ( !pamdbhost ) pamdbhost = ""; |
794 |
if ( !pamdbuser ) pamdbuser = ""; |
// if ( !pamdbuser ) pamdbuser = ""; |
795 |
if ( !pamdbpsw ) pamdbpsw = ""; |
// if ( !pamdbpsw ) pamdbpsw = ""; |
796 |
if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
// if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
797 |
if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
// if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
798 |
if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw; |
// if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw; |
799 |
if(TrkParams::VerboseMode()){ |
// if(TrkParams::VerboseMode()){ |
800 |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
// cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
801 |
cout<<"Connecting to DB"<<endl; |
// cout<<"Connecting to DB"<<endl; |
802 |
cout<<"HOST "<<host<<endl; |
// cout<<"HOST "<<host<<endl; |
803 |
cout<<"USER "<<user<<endl; |
// cout<<"USER "<<user<<endl; |
804 |
cout<<"PSW "<<psw<<endl; |
// cout<<"PSW "<<psw<<endl; |
805 |
} |
// } |
806 |
TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
// TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
807 |
if( dbc || dbc->IsConnected() )connected = true; |
// if( dbc || dbc->IsConnected() )connected = true; |
808 |
else cout << " >> DB connection FAILED!!!"<<endl; |
// else cout << " >> DB connection FAILED!!!"<<endl; |
809 |
if(TrkParams::VerboseMode())cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
// if(TrkParams::VerboseMode())cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
810 |
|
|
811 |
if(connected){ |
// if(connected){ |
812 |
if ( !TrkParams::Set(0,dbc) )return false; |
// if ( !TrkParams::Set(0,dbc) )return false; |
813 |
dbc->Close(); |
// dbc->Close(); |
814 |
}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; |
815 |
|
|
816 |
|
for(Int_t i=0; i<NTYPES; i++)if ( !TrkParams::Set(trkparamtype[i])) return false; |
817 |
|
|
818 |
return true; |
return true; |
819 |
} |
} |