/[PAMELA software]/YodaProfiler/src/GLTables.cpp
ViewVC logotype

Diff of /YodaProfiler/src/GLTables.cpp

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

revision 1.2 by mocchiut, Fri Sep 1 12:47:12 2006 UTC revision 1.6 by mocchiut, Wed Sep 6 12:47:18 2006 UTC
# Line 537  Int_t GL_RUN::Query_GL_RUN(UInt_t run, T Line 537  Int_t GL_RUN::Query_GL_RUN(UInt_t run, T
537    myquery << ",VALIDATION";    myquery << ",VALIDATION";
538    myquery << " from GL_RUN where ID=" << run << ";";    myquery << " from GL_RUN where ID=" << run << ";";
539    //    //
540      //  printf(" myquery is %s \n",myquery.str().c_str());
541    pResult = dbc->Query(myquery.str().c_str());    pResult = dbc->Query(myquery.str().c_str());
542    if(!pResult->GetRowCount())return(-50);    //
543      //  printf(" getrowcount %i \n",pResult->GetRowCount());
544      //
545      if( !pResult->GetRowCount() ) return(-50);
546      //
547    for( r=0; r < 1000; r++){    for( r=0; r < 1000; r++){
548        Row = pResult->Next();              Row = pResult->Next();      
549        if( Row == NULL ) break;        if( Row == NULL ) break;
# Line 573  Int_t GL_RUN::Query_GL_RUN(UInt_t run, T Line 578  Int_t GL_RUN::Query_GL_RUN(UInt_t run, T
578            if (t==27) CAL_DSP_MASK      = (UInt_t)atoll(Row->GetField(t));            if (t==27) CAL_DSP_MASK      = (UInt_t)atoll(Row->GetField(t));
579            if (t==28) BOOT_NUMBER       = (UInt_t)atoll(Row->GetField(t));            if (t==28) BOOT_NUMBER       = (UInt_t)atoll(Row->GetField(t));
580            if (t==29) VALIDATION        = (UInt_t)atoll(Row->GetField(t));            if (t==29) VALIDATION        = (UInt_t)atoll(Row->GetField(t));
   
   
581        };        };
582    };    };
583    delete pResult;    //  delete pResult;
584      return(0);
   return 0;  
   
585  };  };
586    
587  /**  /**
# Line 836  Int_t GL_S4_CALIB::Query_GL_S4_CALIB(UIn Line 837  Int_t GL_S4_CALIB::Query_GL_S4_CALIB(UIn
837    // ----------------    // ----------------
838    myquery.str("");    myquery.str("");
839    myquery << "select * from GL_S4_CALIB where FROM_TIME <= "<< time;    myquery << "select * from GL_S4_CALIB where FROM_TIME <= "<< time;
840    myquery << " AND VALIDATION = 1 ORDER BY FROM_TIME DESC LIMIT 1;";          myquery << " ORDER BY FROM_TIME DESC LIMIT 1;";      
841    //  myquery << " ORDER BY FROM_TIME DESC LIMIT 1;";          //  myquery << " ORDER BY FROM_TIME DESC LIMIT 1;";      
842    pResult = dbc->Query(myquery.str().c_str());    pResult = dbc->Query(myquery.str().c_str());
843    if(!pResult->GetRowCount())return (-55);//throw -55;    if(!pResult->GetRowCount())return (-55);//throw -55;
# Line 1001  GL_TIMESYNC::GL_TIMESYNC(UInt_t id, TStr Line 1002  GL_TIMESYNC::GL_TIMESYNC(UInt_t id, TStr
1002        toffset = (UInt_t)atoll(Row->GetField(1)) - (UInt_t)(this->DBobt((UInt_t)atoll(Row->GetField(0)))/1000) + t0;        toffset = (UInt_t)atoll(Row->GetField(1)) - (UInt_t)(this->DBobt((UInt_t)atoll(Row->GetField(0)))/1000) + t0;
1003      };      };
1004    };    };
1005      //
1006      file->Close();
1007    delete pResult;          delete pResult;      
1008  };  };
1009    
# Line 1047  UInt_t GL_TIMESYNC::DBpkt(UInt_t pkt_num Line 1050  UInt_t GL_TIMESYNC::DBpkt(UInt_t pkt_num
1050    return(pkt_num);    return(pkt_num);
1051    //    //
1052  };  };
1053    
1054    /*
1055     *
1056     * Convert the time in the DB from UInt_t to a string
1057     *
1058     * @param dbt time in the DB
1059     * @param tzone Time Zone, can be UTC,GMT,CET,CEST,MSD default is MSK
1060     *
1061     */
1062    TString GL_TIMESYNC::ConvertTime(TString tzone, UInt_t dbt){
1063      //
1064      TDatime *time = new TDatime();
1065      TString rtime;
1066      //
1067      time->Set(dbt,false); // MSK = Moscow Winter Time
1068      //
1069      if ( !strcmp(tzone.Data(),"UTC") || !strcmp(tzone.Data(),"GMT") ){
1070        //
1071        UInt_t timeUTC = time->Convert() - 60*60*3; // UTC (Coordinated Universal Time) = Moscow Winter Time - 3 hs
1072        time->Set(timeUTC,false);
1073        //
1074      };
1075      //
1076      if ( !strcmp(tzone.Data(),"CET") ){
1077        //
1078        UInt_t timeCET = time->Convert() - 60*60*2; // CET (Central European Time) = Moscow Winter Time - 2 hs
1079        time->Set(timeCET,false);
1080        //
1081      };
1082      //
1083      if ( !strcmp(tzone.Data(),"CEST") ){
1084        //
1085        UInt_t timeCEST = time->Convert() - 60*60*1; // CEST (Central European Summer Time) = Moscow Winter Time - 1 h
1086        time->Set(timeCEST,false);
1087        //
1088      };
1089      //
1090      if ( !strcmp(tzone.Data(),"MSD") ){
1091        //
1092        UInt_t timeMSD = time->Convert() + 60*60*1; // MSD (Moscow Summer Time) = Moscow Winter Time + 1 h
1093        time->Set(timeMSD,false);
1094        //
1095      };
1096      //
1097      rtime = time->AsSQLString();
1098      //
1099      return(rtime);
1100    }
1101    
1102    /*
1103     *
1104     * Convert the time in the DB from UInt_t to a string
1105     *
1106     * @param dbt time in the DB
1107     * @param tzone Time Zone, can be UTC,GMT,CET,CEST,MSD default is MSK
1108     *
1109     */
1110    TString GL_TIMESYNC::UnConvertTime(TString tzone, UInt_t dbt){
1111      //
1112      TDatime *time = new TDatime();
1113      TString rtime;
1114      //
1115      time->Set(dbt,false); // MSK = Moscow Winter Time
1116      //
1117      if ( !strcmp(tzone.Data(),"UTC") || !strcmp(tzone.Data(),"GMT") ){
1118        //
1119        UInt_t timeUTC = time->Convert() + 60*60*3; // UTC (Coordinated Universal Time) +3 hs = Moscow Winter Time
1120        time->Set(timeUTC,false);
1121        //
1122      };
1123      //
1124      if ( !strcmp(tzone.Data(),"CET") ){
1125        //
1126        UInt_t timeCET = time->Convert() + 60*60*2; // CET (Central European Time) + 2 hs = Moscow Winter Time  
1127        time->Set(timeCET,false);
1128        //
1129      };
1130      //
1131      if ( !strcmp(tzone.Data(),"CEST") ){
1132        //
1133        UInt_t timeCEST = time->Convert() + 60*60*1; // CEST (Central European Summer Time) + 1 h = Moscow Winter Time
1134        time->Set(timeCEST,false);
1135        //
1136      };
1137      //
1138      if ( !strcmp(tzone.Data(),"MSD") ){
1139        //
1140        UInt_t timeMSD = time->Convert() - 60*60*1; // MSD (Moscow Summer Time) - 1 h = Moscow Winter Time
1141        time->Set(timeMSD,false);
1142        //
1143      };
1144      //
1145      rtime = time->AsSQLString();
1146      //
1147      return(rtime);
1148    }

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

  ViewVC Help
Powered by ViewVC 1.1.23