/[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.26 by mocchiut, Tue Apr 17 12:06:55 2007 UTC revision 1.39 by mocchiut, Fri Mar 7 13:24:24 2008 UTC
# Line 24  ClassImp(GL_ROOT); Line 24  ClassImp(GL_ROOT);
24  ClassImp(GL_PARAM);  ClassImp(GL_PARAM);
25  ClassImp(GL_S4_CALIB);  ClassImp(GL_S4_CALIB);
26  ClassImp(GL_CALO_CALIB);  ClassImp(GL_CALO_CALIB);
27    ClassImp(GL_CALOPULSE_CALIB);
28  ClassImp(GL_TIMESYNC);  ClassImp(GL_TIMESYNC);
29  ClassImp(GL_TLE);  ClassImp(GL_TLE);
30  //  //
# Line 38  GL_TABLES::GL_TABLES(TString host, TStri Line 39  GL_TABLES::GL_TABLES(TString host, TStri
39    fPsw = new TString(psw.Data());    fPsw = new TString(psw.Data());
40    fSet = true;    fSet = true;
41    fNquery = 0;    fNquery = 0;
42      mh = host.Data();
43      mu = user.Data();
44      mp = psw.Data();
45  };  };
46    
47    
# Line 47  void GL_TABLES::Set(TString host, TStrin Line 51  void GL_TABLES::Set(TString host, TStrin
51    fPsw = new TString(psw.Data());    fPsw = new TString(psw.Data());
52    fSet = true;    fSet = true;
53    fNquery = 0;    fNquery = 0;
54      mh = host.Data();
55      mu = user.Data();
56      mp = psw.Data();
57  };  };
58    
59  Bool_t GL_TABLES::IsConnected(TSQLServer *dbc){  Bool_t GL_TABLES::IsConnected(TSQLServer *&dbc){
60    //    //
61    //    //
62    //    //
# Line 57  Bool_t GL_TABLES::IsConnected(TSQLServer Line 64  Bool_t GL_TABLES::IsConnected(TSQLServer
64      return true;      return true;
65    };    };
66    //    //
67    //    //    printf(" host is %s \n",fHost->Data());
   //  
   //  printf(" host is %s \n",fHost->Data());  
68    //    //
69    stringstream myquery;      stringstream myquery;  
70    myquery.str("");    myquery.str("");
71    myquery << "show databases;";    myquery << "show databases;";
72    dbc->Query(myquery.str().c_str());    if ( dbc ){
73    fNquery++;      if ( dbc->IsConnected() ){
74          dbc->Query(myquery.str().c_str());
75          fNquery++;
76          if ( !(dbc->GetErrorCode()) ){
77            //      printf("ok\n");
78            //
79            //  if ( (dbc->GetErrorCode() != 2013 && dbc->GetErrorCode() != 2006) ){
80            //    if ( !(dbc->GetErrorCode()) ){
81            // is connected
82            return true;
83            //    };
84          };
85        };
86      };
87    //    //
88    if ( dbc->GetErrorCode() != 2013 && dbc->GetErrorCode() != 2006 ){    if ( true ) {
     // is connected  
     return true;  
   } else {  
89      //      //
90      printf(" WARNING: Lost connection to DB! try to recover... \n");      printf(" WARNING: Lost connection to DB! try to recover... \n");
91      //      //
92      TString host = fHost->Data();      TString host = fHost->Data();
93      TString user = fUser->Data();      TString user = fUser->Data();
94      TString psw = fPsw->Data();      TString psw = fPsw->Data();
95        dbc->Close();
96      delete dbc;      delete dbc;
97      dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data());      dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data());
98      //      //
# Line 84  Bool_t GL_TABLES::IsConnected(TSQLServer Line 100  Bool_t GL_TABLES::IsConnected(TSQLServer
100      myquery << "show databases;";      myquery << "show databases;";
101      dbc->Query(myquery.str().c_str());      dbc->Query(myquery.str().c_str());
102      fNquery++;      fNquery++;
103      //      //    if ( dbc->GetErrorCode() != 2013 && dbc->GetErrorCode() != 2006 ){
104      if ( dbc->GetErrorCode() != 2013 && dbc->GetErrorCode() != 2006 ){      if ( !(dbc->GetErrorCode()) ){
105        //        //
106        printf(" ...connection recovered, I can continue! \n");        printf(" ...connection recovered, I can continue! \n");
107        //        //
# Line 156  GL_RUN::GL_RUN() { Line 172  GL_RUN::GL_RUN() {
172  }  }
173    
174    
175  void GL_RUN::Clear() {  void GL_RUN::Clear(Option_t *t) {
176    ID                         = 0;    ID                         = 0;
177    ID_RUN_FRAG                = 0;    ID_RUN_FRAG                = 0;
178    ID_ROOT_L0                 = 0;    ID_ROOT_L0                 = 0;
# Line 231  GL_CALO_CALIB::GL_CALO_CALIB(){ Line 247  GL_CALO_CALIB::GL_CALO_CALIB(){
247    FROM_TIME = 0;    FROM_TIME = 0;
248    TO_TIME   = 0;    TO_TIME   = 0;
249    SECTION   = 0;    SECTION   = 0;
250      OBT = 0;
251      PKT = 0;
252      BOOT_NUMBER                = 0;
253      VALIDATION                 = 0;
254    }
255    
256    GL_CALOPULSE_CALIB::GL_CALOPULSE_CALIB(){
257      ID        = 0;
258      ID_ROOT_L0  = 0;
259      EV_ROOT = 0;
260      FROM_TIME = 0;
261      TO_TIME   = 0;
262      SECTION   = 0;
263      PULSED_STRIP = 0;
264      PULSE_AMPLITUDE = 0;
265      OBT = 0;
266      PKT = 0;
267      BOOT_NUMBER                = 0;
268      VALIDATION                 = 0;
269  }  }
270    
271  GL_S4_CALIB::GL_S4_CALIB(){  GL_S4_CALIB::GL_S4_CALIB(){
# Line 239  GL_S4_CALIB::GL_S4_CALIB(){ Line 274  GL_S4_CALIB::GL_S4_CALIB(){
274    EV_ROOT = 0;    EV_ROOT = 0;
275    FROM_TIME = 0;    FROM_TIME = 0;
276    TO_TIME   = 0;    TO_TIME   = 0;
277    PARAM_FIT0 = 0.;    OBT = 0;
278    PARAM_FIT1 = 0.;    PKT = 0;
279      BOOT_NUMBER                = 0;
280  }  }
281    
282  GL_TIMESYNC::GL_TIMESYNC(){  GL_TIMESYNC::GL_TIMESYNC(){
283    obtfirst = 0;    obtfirst = 0;
284    pktfirst = 0;    pktfirst = 0;
285    toffset  = 0;    ID_RESURS_OFFSET  = 0;
286    //  ID       = 0;    ID       = 0;
287    //  ID_RAW   = 0;    ID_RAW   = 0;
288    OBT0     = 0;    OBT0     = 0;
289    TIMESYNC = 0;    TIMESYNC = 0;
290    TYPE     = 0;    TYPE     = 0;
# Line 1171  Int_t GL_TRK_CALIB::Query_GL_TRK_CALIB(U Line 1207  Int_t GL_TRK_CALIB::Query_GL_TRK_CALIB(U
1207    myquery.str("");    myquery.str("");
1208    myquery << "select ID,ID_ROOT_L0,EV_ROOT_CALIBTRK1,EV_ROOT_CALIBTRK2,FROM_TIME,TO_TIME,OBT1,OBT2,PKT1,PKT2,BOOT_NUMBER,VALIDATION from GL_TRK_CALIB where FROM_TIME <= "<< time;    myquery << "select ID,ID_ROOT_L0,EV_ROOT_CALIBTRK1,EV_ROOT_CALIBTRK2,FROM_TIME,TO_TIME,OBT1,OBT2,PKT1,PKT2,BOOT_NUMBER,VALIDATION from GL_TRK_CALIB where FROM_TIME <= "<< time;
1209  //  myquery << " AND VALIDATION=1 ORDER BY FROM_TIME DESC LIMIT 1;";      // RIVEDERE LA VALIDAZIONE!!!  //  myquery << " AND VALIDATION=1 ORDER BY FROM_TIME DESC LIMIT 1;";      // RIVEDERE LA VALIDAZIONE!!!
1210      myquery << " and EV_ROOT_CALIBTRK1>=0 and EV_ROOT_CALIBTRK2>=0 "; // EM! SE MANCA UN PACCHETTO DEI DUE IL PROCESSAMENTO CRASHA... DA RIVEDERE LA VALIDAZIONE      
1211    myquery << " ORDER BY FROM_TIME DESC LIMIT 1;";          myquery << " ORDER BY FROM_TIME DESC LIMIT 1;";      
1212    //  myquery << " ORDER BY FROM_TIME DESC LIMIT 1;";          //  myquery << " ORDER BY FROM_TIME DESC LIMIT 1;";      
1213    if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57;      if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57;  
# Line 1243  Int_t GL_CALO_CALIB::Query_GL_CALO_CALIB Line 1280  Int_t GL_CALO_CALIB::Query_GL_CALO_CALIB
1280    //    //
1281    uptime = (UInt_t)atoll(Row->GetField(2));    uptime = (UInt_t)atoll(Row->GetField(2));
1282    //    //
1283      UInt_t myfromtime = (UInt_t)atoll(Row->GetField(1));
1284      UInt_t mytotime = (UInt_t)atoll(Row->GetField(2));
1285      //
1286    // if it is corrupted validation is 0 and we have no results from the query...    // if it is corrupted validation is 0 and we have no results from the query...
1287    //    //
1288    if( atoi(Row->GetField(4)) == 0 ){ // if validation = 0    if( atoi(Row->GetField(4)) == 0 ){ // if validation = 0
# Line 1264  Int_t GL_CALO_CALIB::Query_GL_CALO_CALIB Line 1304  Int_t GL_CALO_CALIB::Query_GL_CALO_CALIB
1304      //      //
1305      Row = pResult->Next();      Row = pResult->Next();
1306      //      //
1307        myfromtime = (UInt_t)atoll(Row->GetField(1));
1308        //
1309      };
1310      //
1311      // if the selected calibration is too old (more than 5 orbits old) try to take the closest not corrupted one
1312      //
1313      if ( (time-myfromtime)>28500 ){
1314        //
1315        myquery.str("");
1316        myquery << "select ID_ROOT_L0, FROM_TIME, TO_TIME, EV_ROOT from GL_CALO_CALIB where SECTION=" << section;
1317        myquery << " and VALIDATION=1 ORDER BY ABS(" << time << "-FROM_TIME) asc limit 1;";
1318        if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57;
1319        this->GetGLTABLES()->AddQ();
1320        pResult = dbc->Query(myquery.str().c_str());
1321        //    printf(" mysquery is %s\n",myquery.str().c_str());
1322        //
1323        // if no results yet quit with error
1324        //
1325        if( !pResult->GetRowCount() ) return (-54);
1326        //
1327        Row = pResult->Next();
1328        //
1329    };    };
1330    //    //
1331    // store infos and exit    // store infos and exit
# Line 1271  Int_t GL_CALO_CALIB::Query_GL_CALO_CALIB Line 1333  Int_t GL_CALO_CALIB::Query_GL_CALO_CALIB
1333    if( Row == NULL ) return (-54);    if( Row == NULL ) return (-54);
1334    for( t = 0; t < pResult->GetFieldCount(); t++){    for( t = 0; t < pResult->GetFieldCount(); t++){
1335      if (t==0) ID_ROOT_L0  = (UInt_t)atoll(Row->GetField(t));      if (t==0) ID_ROOT_L0  = (UInt_t)atoll(Row->GetField(t));
1336        if (t==1) FROM_TIME = myfromtime;
1337        if (t==2) TO_TIME   = mytotime;          
1338        if (t==3) EV_ROOT = (UInt_t)atoll(Row->GetField(t));
1339      };
1340      pResult->Delete();
1341      return 0;
1342    };
1343    
1344    
1345    // ****************************************************
1346    /**
1347     * Function to query the GL_CALOPULSE_CALIB table of the DB.
1348     *
1349     * \param  run starting time
1350     * \return struct of type GL_CALOPULSE_CALIB_data, which stores the query result
1351     */
1352    Int_t GL_CALOPULSE_CALIB::Query_GL_CALOPULSE_CALIB(UInt_t time, UInt_t section, UInt_t pampli, TSQLServer *dbc){
1353      // MySQL variables
1354      TSQLResult *pResult;
1355      TSQLRow *Row;
1356      int t;
1357      stringstream myquery;
1358      //
1359      // select the correct calibration i.e. the closest to our time
1360      //
1361      myquery.str("");
1362      myquery << "select ID_ROOT_L0, FROM_TIME, TO_TIME, EV_ROOT from GL_CALOPULSE_CALIB where SECTION=" << section;
1363      myquery << " and PULSE_AMPLITUDE=" << pampli;
1364      myquery << " and VALIDATION=1 and (PULSED_STRIP IS NULL OR PULSED_STRIP<100) ORDER BY ABS(" << time << "-FROM_TIME) asc limit 1;";
1365      //  printf(" myq is %s \n",myquery.str().c_str());
1366      //
1367      if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57;  
1368      this->GetGLTABLES()->AddQ();
1369      pResult = dbc->Query(myquery.str().c_str());
1370      //
1371      if( !pResult ) return(-54);
1372      //
1373      Row = pResult->Next();
1374      //
1375      if( !Row ) return (-54);
1376      //
1377      // store infos and exit
1378      //
1379      for( t = 0; t < pResult->GetFieldCount(); t++){
1380        //    printf(" field %i is %s \n",t,Row->GetField(t));
1381        if (t==0) ID_ROOT_L0  = (UInt_t)atoll(Row->GetField(t));
1382      if (t==1) FROM_TIME = (UInt_t)atoll(Row->GetField(t));      if (t==1) FROM_TIME = (UInt_t)atoll(Row->GetField(t));
1383      if (t==2) TO_TIME   = (UInt_t)atoll(Row->GetField(t));                  if (t==2) TO_TIME   = (UInt_t)atoll(Row->GetField(t));            
1384      if (t==3) EV_ROOT = (UInt_t)atoll(Row->GetField(t));      if (t==3) EV_ROOT = (UInt_t)atoll(Row->GetField(t));
# Line 1278  Int_t GL_CALO_CALIB::Query_GL_CALO_CALIB Line 1386  Int_t GL_CALO_CALIB::Query_GL_CALO_CALIB
1386    pResult->Delete();    pResult->Delete();
1387    return 0;    return 0;
1388  };  };
1389    
1390    
1391  // ****************************************************  // ****************************************************
1392  /**  /**
1393   * Function to query the GL_S4_CALIB table of the DB.   * Function to query the GL_S4_CALIB table of the DB.
# Line 1294  Int_t GL_S4_CALIB::Query_GL_S4_CALIB(UIn Line 1404  Int_t GL_S4_CALIB::Query_GL_S4_CALIB(UIn
1404    stringstream myquery;    stringstream myquery;
1405    // ----------------    // ----------------
1406    myquery.str("");    myquery.str("");
1407    myquery << "select * from GL_S4_CALIB where FROM_TIME <= "<< time;    myquery << "select ID,ID_ROOT_L0,EV_ROOT,FROM_TIME,TO_TIME from GL_S4_CALIB where FROM_TIME <= "<< time;
1408    myquery << " ORDER BY FROM_TIME DESC LIMIT 1;";          myquery << " ORDER BY FROM_TIME DESC LIMIT 1;";      
1409    //  myquery << " ORDER BY FROM_TIME DESC LIMIT 1;";          //  myquery << " ORDER BY FROM_TIME DESC LIMIT 1;";      
1410    if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57;      if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57;  
# Line 1306  Int_t GL_S4_CALIB::Query_GL_S4_CALIB(UIn Line 1416  Int_t GL_S4_CALIB::Query_GL_S4_CALIB(UIn
1416        if( Row == NULL ) break;        if( Row == NULL ) break;
1417        for( t = 0; t < pResult->GetFieldCount(); t++){        for( t = 0; t < pResult->GetFieldCount(); t++){
1418          if (t==0) ID               = (UInt_t)atoll(Row->GetField(t));          if (t==0) ID               = (UInt_t)atoll(Row->GetField(t));
1419            if (t==1) ID_ROOT_L0  = (UInt_t)atoll(Row->GetField(t));          if (t==1) ID_ROOT_L0  = (UInt_t)atoll(Row->GetField(t));
1420            if (t==2) EV_ROOT    = (UInt_t)atoll(Row->GetField(t));          if (t==2) EV_ROOT    = (UInt_t)atoll(Row->GetField(t));
1421            if (t==3) FROM_TIME = (UInt_t)atoll(Row->GetField(t));          if (t==3) FROM_TIME = (UInt_t)atoll(Row->GetField(t));
1422            if (t==4) TO_TIME   = (UInt_t)atoll(Row->GetField(t));          if (t==4) TO_TIME   = (UInt_t)atoll(Row->GetField(t));
           if (t==5) PARAM_FIT0   = atof(Row->GetField(t));  
           if (t==6) PARAM_FIT1   = atof(Row->GetField(t));  
1423        };        };
1424    };    };
1425    delete pResult;        delete pResult;    
# Line 1467  GL_TIMESYNC::GL_TIMESYNC(UInt_t id, TStr Line 1575  GL_TIMESYNC::GL_TIMESYNC(UInt_t id, TStr
1575    //    //
1576    //    //
1577    stringstream oss;    stringstream oss;
1578      TString frn = rname.str().c_str();
1579      frn = frn.ReplaceAll(".root",5,".pam",4);
1580    oss.str("");    oss.str("");
1581    oss << "SELECT YEAR(OFFSET_DATE),MONTH(OFFSET_DATE),DAY(OFFSET_DATE),HOUR(OFFSET_DATE),MINUTE(OFFSET_DATE),SECOND(OFFSET_DATE) FROM GL_RESURS_OFFSET WHERE SPECIAL_FILE='"    oss << "SELECT YEAR(OFFSET_DATE),MONTH(OFFSET_DATE),DAY(OFFSET_DATE),HOUR(OFFSET_DATE),MINUTE(OFFSET_DATE),SECOND(OFFSET_DATE) FROM GL_RESURS_OFFSET WHERE SPECIAL_FILE='"
1582        << rname.str().c_str() << "';";        << frn.Data() << "';";
1583    if ( !this->GetGLTABLES()->IsConnected(dbc) ) return;      if ( !this->GetGLTABLES()->IsConnected(dbc) ) return;  
1584    this->GetGLTABLES()->AddQ();    this->GetGLTABLES()->AddQ();
1585    pResult = dbc->Query(oss.str().c_str());    pResult = dbc->Query(oss.str().c_str());
# Line 1478  GL_TIMESYNC::GL_TIMESYNC(UInt_t id, TStr Line 1588  GL_TIMESYNC::GL_TIMESYNC(UInt_t id, TStr
1588    TString name=rname.str().c_str();    TString name=rname.str().c_str();
1589    UInt_t dworbit = 0;    UInt_t dworbit = 0;
1590    Int_t nlength = name.Length();    Int_t nlength = name.Length();
   if ( nlength < 5 ) return;  
   TString dwo = 0;  
   for (Int_t i = 0; i<5; i++){  
     dwo.Append(name[i],1);  
   };  
   if ( dwo.IsDigit() ){  
     dworbit = (UInt_t)dwo.Atoi();  
   } else {  
     dwo="";  
     for (Int_t i = 8; i<13; i++){  
       dwo.Append(name[i],1);  
     };      
     if ( dwo.IsDigit() ){  
       dworbit = (UInt_t)dwo.Atoi();  
     } else {  
       dworbit = 1;  
     };  
   };  
1591    //    //
1592      // Is not a special file
1593    //    //
1594    if ( !Row ){    if ( !Row ){
1595        delete pResult;      
1596        //
1597        // New code, we have one more column on GL_TIMESYNC so we can trust that one for the Resurs offset
1598        //
1599      oss.str("");      oss.str("");
1600      oss << "SELECT YEAR(OFFSET_DATE),MONTH(OFFSET_DATE),DAY(OFFSET_DATE),HOUR(OFFSET_DATE),MINUTE(OFFSET_DATE),SECOND(OFFSET_DATE) FROM GL_RESURS_OFFSET WHERE FROM_ORBIT< "      oss << "SELECT ID_RESURS_OFFSET from GL_TIMESYNC where ID_RAW=" << idraw <<";";
         << dworbit << " order by FROM_ORBIT desc limit 1;";  
1601      if ( !this->GetGLTABLES()->IsConnected(dbc) ) return;        if ( !this->GetGLTABLES()->IsConnected(dbc) ) return;  
1602      this->GetGLTABLES()->AddQ();      this->GetGLTABLES()->AddQ();
1603      pResult = dbc->Query(oss.str().c_str());      pResult = dbc->Query(oss.str().c_str());
1604      Row = pResult->Next();      Bool_t fndit = false;
1605      if ( !Row ){      if ( pResult ){
1606        printf(" ERROR FROM GLTables! cannot determine Resurs offset \n");        Row = pResult->Next();
1607        return;        if ( Row ){
1608            oss.str("");
1609            oss << "SELECT YEAR(OFFSET_DATE),MONTH(OFFSET_DATE),DAY(OFFSET_DATE),HOUR(OFFSET_DATE),MINUTE(OFFSET_DATE),SECOND(OFFSET_DATE) FROM GL_RESURS_OFFSET WHERE ID="
1610                << Row->GetField(0) << ";";
1611            if ( !this->GetGLTABLES()->IsConnected(dbc) ) return;  
1612            this->GetGLTABLES()->AddQ();
1613            pResult = dbc->Query(oss.str().c_str());
1614            if ( pResult ){
1615              Row = pResult->Next();
1616              if ( Row ){
1617                //      printf(" GREAT! the DB structure is the new one! \n");
1618                fndit = true;
1619                dworbit = 1;
1620              };
1621            };
1622          };
1623        };
1624        if ( !fndit ){
1625          delete pResult;      
1626          //
1627          printf(" OK, you got an error because this is the old database\n Using backward compability code, hence you can continue safetly \n");
1628          //
1629          // Old code, we must trust the filename
1630          //
1631          if ( nlength < 5 ) return;
1632          TString dwo = 0;
1633          for (Int_t i = 0; i<5; i++){
1634            dwo.Append(name[i],1);
1635          };
1636          if ( dwo.IsDigit() ){
1637            dworbit = (UInt_t)dwo.Atoi();
1638          } else {
1639            dwo="";
1640            for (Int_t i = 8; i<13; i++){
1641              dwo.Append(name[i],1);
1642            };    
1643            if ( dwo.IsDigit() ){
1644              dworbit = (UInt_t)dwo.Atoi();
1645            } else {
1646              dworbit = 1;
1647            };
1648          };    
1649          //
1650          oss.str("");
1651          oss << "SELECT YEAR(OFFSET_DATE),MONTH(OFFSET_DATE),DAY(OFFSET_DATE),HOUR(OFFSET_DATE),MINUTE(OFFSET_DATE),SECOND(OFFSET_DATE) FROM GL_RESURS_OFFSET WHERE FROM_ORBIT< "
1652              << dworbit << " order by FROM_ORBIT desc limit 1;";
1653          if ( !this->GetGLTABLES()->IsConnected(dbc) ) return;  
1654          this->GetGLTABLES()->AddQ();
1655          pResult = dbc->Query(oss.str().c_str());
1656          Row = pResult->Next();
1657          if ( !Row ){
1658            printf(" ERROR FROM GLTables! cannot determine Resurs offset \n");
1659            return;
1660          };
1661      };      };
1662    };    };
1663    //    //
# Line 1556  UInt_t GL_TIMESYNC::DBabsTime(UInt_t OBT Line 1705  UInt_t GL_TIMESYNC::DBabsTime(UInt_t OBT
1705   */   */
1706  UInt_t GL_TIMESYNC::ResursTime(UInt_t OBT){    UInt_t GL_TIMESYNC::ResursTime(UInt_t OBT){  
1707    //    //
1708    return(((UInt_t)((Int_t)(this->DBobt(OBT)-this->DBobt(OBT0))/1000)+TIMESYNC));    return(((UInt_t)((Int_t)(this->DBobt(OBT)-this->DBobt(OBT0)/1000))+TIMESYNC));
1709    //    //
1710  };  };
1711    
# Line 1583  Long64_t GL_TIMESYNC::DBpkt(UInt_t pkt_n Line 1732  Long64_t GL_TIMESYNC::DBpkt(UInt_t pkt_n
1732   */   */
1733  Long64_t GL_TIMESYNC::DBobt(UInt_t obt){    Long64_t GL_TIMESYNC::DBobt(UInt_t obt){  
1734    //    //
1735    if ( obt < (obtfirst/2) && obtfirst > (numeric_limits<UInt_t>::max()/2) ) return((Long64_t)(obt+numeric_limits<UInt_t>::max()));    if ( obt < (obtfirst/2) && obtfirst > (numeric_limits<UInt_t>::max()/2) ){
1736        return((Long64_t)obt+(Long64_t)numeric_limits<UInt_t>::max());
1737      };
1738    //    //
1739    if ( obt > (obtfirst*2) && obt > (numeric_limits<UInt_t>::max()/2) ){    if ( obt > (obtfirst*2) && obt > (numeric_limits<UInt_t>::max()/2) ){
1740      return((Long64_t)obt-(Long64_t)numeric_limits<UInt_t>::max());      return((Long64_t)obt-(Long64_t)numeric_limits<UInt_t>::max());
# Line 1805  Int_t GL_TLE::DoQuery(TString myquery, T Line 1956  Int_t GL_TLE::DoQuery(TString myquery, T
1956    TSQLRow *row;    TSQLRow *row;
1957    
1958    // Set the right time_zone (otherwise horrible things will occur! :)    // Set the right time_zone (otherwise horrible things will occur! :)
1959      if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57;  
1960    dbc->Query("SET time_zone = '+0:00'");    dbc->Query("SET time_zone = '+0:00'");
1961    
1962    // Do the query    // Do the query
   if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57;    
1963    this->GetGLTABLES()->AddQ();    this->GetGLTABLES()->AddQ();
1964    result = dbc->Query(myquery.Data());    result = dbc->Query(myquery.Data());
1965    if(! result->GetRowCount() ) {    if(! result->GetRowCount() ) {

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.39

  ViewVC Help
Powered by ViewVC 1.1.23