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

Diff of /YodaProfiler/src/PamelaDBOperations.cpp

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

revision 1.12 by mocchiut, Tue Oct 17 15:20:04 2006 UTC revision 1.13 by mocchiut, Fri Oct 20 11:11:12 2006 UTC
# Line 81  PamelaDBOperations::PamelaDBOperations(T Line 81  PamelaDBOperations::PamelaDBOperations(T
81    INSERT_ROOT = !filerootname.IsNull();    INSERT_ROOT = !filerootname.IsNull();
82    if( INSERT_ROOT ){    if( INSERT_ROOT ){
83      this->SetRootName(filerootname);      this->SetRootName(filerootname);
84        this->SetOrbitNo();
85      file = TFile::Open(this->GetRootName().Data());      file = TFile::Open(this->GetRootName().Data());
86    };    };
87    //    //
# Line 126  void PamelaDBOperations::CheckValidate(L Line 127  void PamelaDBOperations::CheckValidate(L
127   * @param password     password for the SQL connection.   * @param password     password for the SQL connection.
128   */   */
129  void PamelaDBOperations::SetConnection(TString host, TString user, TString password){  void PamelaDBOperations::SetConnection(TString host, TString user, TString password){
130      if ( IsDebug() ) printf(" Connecting using host = %s user = %s password = %s \n",host.Data(),user.Data(),password.Data());
131    conn = TSQLServer::Connect(host.Data(),user.Data(),password.Data());    conn = TSQLServer::Connect(host.Data(),user.Data(),password.Data());
132  };  };
133    
# Line 194  void PamelaDBOperations::SetRootName(TSt Line 196  void PamelaDBOperations::SetRootName(TSt
196  };  };
197    
198  /**  /**
199     * Store the downlink orbit number from filename.
200     */
201    void PamelaDBOperations::SetOrbitNo(){
202      dworbit = 0;
203      TString name = this->GetRootFile();
204      Int_t nlength = name.Length();
205      if ( nlength < 5 ) return;
206      TString dwo = 0;
207      for (Int_t i = 0; i<5; i++){
208        dwo.Append(name[i],1);
209      };
210      if ( dwo.IsDigit() ){
211        dworbit = (UInt_t)dwo.Atoi();
212      } else {
213        dwo="";
214        for (Int_t i = 8; i<13; i++){
215          dwo.Append(name[i],1);
216        };    
217        if ( dwo.IsDigit() ) dworbit = (UInt_t)dwo.Atoi();
218      };
219      if ( IsDebug() ) printf(" Downlink orbit is %i (dwo = %s) \n",dworbit,dwo.Data());
220      return;
221    };
222    
223    
224    
225    /**
226   * Store the NOBOOT flag.   * Store the NOBOOT flag.
227   * @param noboot    true/false.   * @param noboot    true/false.
228   */   */
# Line 265  Int_t PamelaDBOperations::SetUpperLimits Line 294  Int_t PamelaDBOperations::SetUpperLimits
294    UInt_t jump = 50000; // was 5000    UInt_t jump = 50000; // was 5000
295    EventCounter *code=0;    EventCounter *code=0;
296    //    //
297      UInt_t deltapkt = 5000;
298      ULong64_t deltaobt = 50000;
299      //
300    //   pcksList packetsNames;    //   pcksList packetsNames;
301    //   pcksList::iterator Iter;    //   pcksList::iterator Iter;
302    //   getPacketsNames(packetsNames);    //   getPacketsNames(packetsNames);
# Line 311  Int_t PamelaDBOperations::SetUpperLimits Line 343  Int_t PamelaDBOperations::SetUpperLimits
343    //    //
344    if ( nevent < 2 ) return(4);    if ( nevent < 2 ) return(4);
345    //    //
346    if ( PKT(pktlast) < PKT(pktfirst) && OBT(obtlast) < OBT(obtfirst) ){    if ( (PKT(pktlast) < PKT(pktfirst) && OBT(obtlast) < OBT(obtfirst)) || (labs(PKT(pktlast)-PKT(pktfirst))<deltapkt && labs(OBT(obtlast)-OBT(obtfirst))<deltaobt) ){
347        //
348      // go back      // go back
349      zomp = nevent - 2;      zomp = nevent - 2;
350      //      //
# Line 593  Int_t PamelaDBOperations::SetUpperLimits Line 626  Int_t PamelaDBOperations::SetUpperLimits
626    return(0);    return(0);
627  }  }
628    
629    /**
630     *
631     * Trick to have unique RUN ID numbers even when runs are deleted and mysql deamon restarted.
632     * Entries in the _RUNID_GEN table are never deleted.
633     *
634     **/
635    UInt_t PamelaDBOperations::AssignRunID(){
636      //
637      TSQLResult *result = 0;
638      TSQLRow *row = 0;
639      UInt_t runid = 0;
640      //
641      stringstream   oss;
642      //  
643      oss.str("");
644      oss << "INSERT INTO _RUNID_GEN VALUES (NULL);";
645      result = conn->Query(oss.str().c_str());
646      if ( !result ) throw -10;
647      oss.str("");
648      oss << "SELECT ID FROM _RUNID_GEN ORDER BY ID DESC LIMIT 1;";
649      result = conn->Query(oss.str().c_str());
650      if ( !result ) throw -10;
651      //
652      row = result->Next();
653      //
654      if ( !row ) throw -28;
655      //
656      runid = (UInt_t)atoll(row->GetField(0));
657      //
658      return(runid);
659    };
660    
661  //  //
662  // GETTERS  // GETTERS
663  //  //
# Line 690  void PamelaDBOperations::CheckConnection Line 755  void PamelaDBOperations::CheckConnection
755    if( !conn ) throw -1;    if( !conn ) throw -1;
756    bool connect = conn->IsConnected();    bool connect = conn->IsConnected();
757    if( !connect ) throw -1;    if( !connect ) throw -1;
758      if ( !dworbit ) throw -27;
759  };  };
760    
761  /**  /**
# Line 869  Int_t PamelaDBOperations::insertPamelaGL Line 935  Int_t PamelaDBOperations::insertPamelaGL
935    if ( this->GetID_RAW() == 0 )  throw -11;    if ( this->GetID_RAW() == 0 )  throw -11;
936    //    //
937    oss.str("");    oss.str("");
938    oss << "SELECT OFFSET_DATE FROM GL_RESURS_OFFSET WHERE FROM_ID_RAW<= "    oss << "SELECT OFFSET_DATE FROM GL_RESURS_OFFSET WHERE SPECIAL_FILE='"
939        << id << " AND TO_ID_RAW >= "        << this->GetRawFile().Data() << "';";
       << id << ";";  
940    if ( IsDebug() ) printf(" %s \n",oss.str().c_str());    if ( IsDebug() ) printf(" %s \n",oss.str().c_str());
941    result = conn->Query(oss.str().c_str());    result = conn->Query(oss.str().c_str());
942    if ( !result ) throw -10;    if ( !result ) throw -10;
943    row = result->Next();    row = result->Next();
944    if ( !row ) throw -10;    //
945      if ( !row ){
946        oss.str("");
947        oss << "SELECT OFFSET_DATE FROM GL_RESURS_OFFSET WHERE FROM_ORBIT< "
948            << dworbit << " order by FROM_ORBIT desc limit 1;";
949        if ( IsDebug() ) printf(" %s \n",oss.str().c_str());
950        result = conn->Query(oss.str().c_str());
951        if ( !result ) throw -10;
952        row = result->Next();
953        if ( !row ) throw -10;
954      };
955    //    //
956    t0 = (UInt_t)TDatime(row->GetField(0)).Convert();    t0 = (UInt_t)TDatime(row->GetField(0)).Convert();
957    /*    /*
# Line 1556  void PamelaDBOperations::HandleRun(){   Line 1631  void PamelaDBOperations::HandleRun(){  
1631      //      //
1632      this->FillClass();      this->FillClass();
1633      //      //
1634      if ( !IsRunAlreadyInserted() ) glrun->Fill_GL_RUN(conn);      if ( !IsRunAlreadyInserted() ){
1635          glrun->SetID(this->AssignRunID());
1636          glrun->SetID_RUN_FRAG(0);
1637          glrun->Fill_GL_RUN(conn);
1638        };
1639    } else {    } else {
1640      //      //
1641      if ( IsDebug() ) printf(" oh no! the distance between runheader and runtrailer seems wrong: check %llu pktt %llu \n",chkpkt,pktt);      if ( IsDebug() ) printf(" oh no! the distance between runheader and runtrailer seems wrong: check %llu pktt %llu \n",chkpkt,pktt);
# Line 1728  void PamelaDBOperations::HandleRunFragme Line 1807  void PamelaDBOperations::HandleRunFragme
1807        };        };
1808        if ( IsDebug() ) printf(" Check overlapping events done: %i %i %llu %llu firstev is %i\n",apkt,bpkt,aobt,bobt,firstev);        if ( IsDebug() ) printf(" Check overlapping events done: %i %i %llu %llu firstev is %i\n",apkt,bpkt,aobt,bobt,firstev);
1809        //        //
       glrun1->SetID(0);  
1810        glrun1->SetPKT_COUNTER(glrun->GetPKT_COUNTER());        glrun1->SetPKT_COUNTER(glrun->GetPKT_COUNTER());
1811        glrun1->SetPKT_READY_COUNTER(glrun->GetPKT_READY_COUNTER());        glrun1->SetPKT_READY_COUNTER(glrun->GetPKT_READY_COUNTER());
1812        glrun1->SetRUNTRAILER_TIME(glrun->GetRUNTRAILER_TIME());        glrun1->SetRUNTRAILER_TIME(glrun->GetRUNTRAILER_TIME());
# Line 1756  void PamelaDBOperations::HandleRunFragme Line 1834  void PamelaDBOperations::HandleRunFragme
1834        //        //
1835        if ( !IsRunAlreadyInserted() ){        if ( !IsRunAlreadyInserted() ){
1836          //          //
1837            glrun->SetID(this->AssignRunID());
1838            glrun->SetID_RUN_FRAG(glrun1->GetID());
1839          glrun->Fill_GL_RUN(conn);          glrun->Fill_GL_RUN(conn);
1840          //          //
1841          // get id number          // get id number
1842          //          //
1843          oss.str("");  //      oss.str("");
1844          oss << " SELECT ID FROM GL_RUN WHERE BOOT_NUMBER="<<this->GetBOOTnumber()<<" AND "  //      oss << " SELECT ID FROM GL_RUN WHERE BOOT_NUMBER="<<this->GetBOOTnumber()<<" AND "
1845              << " RUNHEADER_OBT="<<glrun->GetRUNHEADER_OBT()<<" AND "  //          << " RUNHEADER_OBT="<<glrun->GetRUNHEADER_OBT()<<" AND "
1846              << " RUNTRAILER_OBT="<<glrun->GetRUNTRAILER_OBT()<<";";  //          << " RUNTRAILER_OBT="<<glrun->GetRUNTRAILER_OBT()<<";";
1847          //  //      //
1848          if ( IsDebug() ) printf(" search for idrun0 , query is : \n%s\n",oss.str().c_str());  //      if ( IsDebug() ) printf(" search for idrun0 , query is : \n%s\n",oss.str().c_str());
1849          //  //      //
1850          result =  conn->Query(oss.str().c_str());  //      result =  conn->Query(oss.str().c_str());
1851          if ( !result ) throw -4;  //      if ( !result ) throw -4;
1852          row = result->Next();  //      row = result->Next();
1853          //  //      //
1854          UInt_t idrun0 = 0;  //      UInt_t idrun0 = 0;
1855          if ( !row ){  //      if ( !row ){
1856            throw -10;  //        throw -10;
1857          } else {  //      } else {
1858            idrun0 = (UInt_t)atoll(row->GetField(0));  //        idrun0 = (UInt_t)atoll(row->GetField(0));
1859          };  //      };
         //  
         glrun1->SetID_RUN_FRAG(idrun0);  
1860          //          //
1861            //      glrun1->SetID_RUN_FRAG(idrun0);
1862            glrun1->SetID_RUN_FRAG(glrun->GetID());
1863          glrun1->Fill_GL_RUN(conn);          glrun1->Fill_GL_RUN(conn);
1864          //          //
1865          oss.str("");  //      oss.str("");
1866          oss << " SELECT ID FROM GL_RUN WHERE ID_RUN_FRAG="<<idrun0<<" ;";  //      oss << " SELECT ID FROM GL_RUN WHERE ID_RUN_FRAG="<<idrun0<<" ;";
1867          //  //      //
1868          if ( IsDebug() ) printf(" search for idrun1 , query is : \n%s\n",oss.str().c_str());  //      if ( IsDebug() ) printf(" search for idrun1 , query is : \n%s\n",oss.str().c_str());
1869          //  //      //
1870          result =  conn->Query(oss.str().c_str());  //      result =  conn->Query(oss.str().c_str());
1871          if ( !result ) throw -4;  //      if ( !result ) throw -4;
1872          row = result->Next();  //      row = result->Next();
1873          //  //      //
1874          UInt_t idrun1 = 0;  //      UInt_t idrun1 = 0;
1875          if ( !row ){  //      if ( !row ){
1876            throw -10;  //        throw -10;
1877          } else {  //      } else {
1878            idrun1 = (UInt_t)atoll(row->GetField(0));  //        idrun1 = (UInt_t)atoll(row->GetField(0));
1879          };  //      };
1880          //  //      //
1881          oss.str("");  //      oss.str("");
1882          oss << " UPDATE GL_RUN SET ID_RUN_FRAG="<<idrun1<<" WHERE ID="<<idrun0<<" ;";  //      oss << " UPDATE GL_RUN SET ID_RUN_FRAG="<<idrun1<<" WHERE ID="<<idrun0<<" ;";
1883          //  //      //
1884          result =  conn->Query(oss.str().c_str());  //      result =  conn->Query(oss.str().c_str());
1885          if ( !result ) throw -4;  //      if ( !result ) throw -4;
1886          //          //
1887        };        };
1888        //        //
# Line 1952  void PamelaDBOperations::HandleRunFragme Line 2032  void PamelaDBOperations::HandleRunFragme
2032        glrun->SetRUNTRAILER_OBT(glrun1->GetRUNTRAILER_OBT());        glrun->SetRUNTRAILER_OBT(glrun1->GetRUNTRAILER_OBT());
2033        glrun->SetRUNTRAILER_PKT(glrun1->GetRUNTRAILER_PKT());        glrun->SetRUNTRAILER_PKT(glrun1->GetRUNTRAILER_PKT());
2034        //        //
       glrun1->SetID(0);  
2035        glrun1->SetRUNHEADER_TIME(glrun->GetRUNHEADER_TIME());        glrun1->SetRUNHEADER_TIME(glrun->GetRUNHEADER_TIME());
2036        glrun1->SetRUNHEADER_OBT(glrun->GetRUNHEADER_OBT());        glrun1->SetRUNHEADER_OBT(glrun->GetRUNHEADER_OBT());
2037        glrun1->SetRUNHEADER_PKT(glrun->GetRUNHEADER_PKT());        glrun1->SetRUNHEADER_PKT(glrun->GetRUNHEADER_PKT());
# Line 1972  void PamelaDBOperations::HandleRunFragme Line 2051  void PamelaDBOperations::HandleRunFragme
2051        //        //
2052        if ( !IsRunAlreadyInserted() ){        if ( !IsRunAlreadyInserted() ){
2053          //          //
2054            glrun->SetID(this->AssignRunID());
2055            //
2056            glrun->SetID_RUN_FRAG(glrun1->GetID());
2057          glrun->Fill_GL_RUN(conn);          glrun->Fill_GL_RUN(conn);
2058          //          //
2059          // get id number          // get id number
2060          //          //
2061          oss.str("");  //      oss.str("");
2062          oss << " SELECT ID FROM GL_RUN WHERE BOOT_NUMBER="<<this->GetBOOTnumber()<<" AND "  //      oss << " SELECT ID FROM GL_RUN WHERE BOOT_NUMBER="<<this->GetBOOTnumber()<<" AND "
2063              << " RUNHEADER_OBT="<<glrun->GetRUNHEADER_OBT()<<" AND "  //          << " RUNHEADER_OBT="<<glrun->GetRUNHEADER_OBT()<<" AND "
2064              << " RUNTRAILER_OBT="<<glrun->GetRUNTRAILER_OBT()<<";";  //          << " RUNTRAILER_OBT="<<glrun->GetRUNTRAILER_OBT()<<";";
2065          //  //      //
2066          if ( IsDebug() ) printf(" search for idrun0 , query is : \n%s\n",oss.str().c_str());  //      if ( IsDebug() ) printf(" search for idrun0 , query is : \n%s\n",oss.str().c_str());
2067          //  //      //
2068          result =  conn->Query(oss.str().c_str());  //      result =  conn->Query(oss.str().c_str());
2069          if ( !result ) throw -4;  //      if ( !result ) throw -4;
2070          row = result->Next();  //      row = result->Next();
2071          //  //      //
2072          UInt_t idrun0 = 0;  //      UInt_t idrun0 = 0;
2073          if ( !row ){  //      if ( !row ){
2074            throw -10;  //        throw -10;
2075          } else {  //      } else {
2076            idrun0 = (UInt_t)atoll(row->GetField(0));  //        idrun0 = (UInt_t)atoll(row->GetField(0));
2077          };  //      };
2078          //  //      //
2079          glrun1->SetID_RUN_FRAG(idrun0);  //      glrun1->SetID_RUN_FRAG(idrun0);
2080          //  //
2081            glrun1->SetID_RUN_FRAG(glrun->GetID());
2082          glrun1->Fill_GL_RUN(conn);          glrun1->Fill_GL_RUN(conn);
2083          //          //
2084          oss.str("");  //      oss.str("");
2085          oss << " SELECT ID FROM GL_RUN WHERE ID_RUN_FRAG="<<idrun0<<" ;";  //      oss << " SELECT ID FROM GL_RUN WHERE ID_RUN_FRAG="<<idrun0<<" ;";
2086          //  //      //
2087          if ( IsDebug() ) printf(" search for idrun1 , query is : \n%s\n",oss.str().c_str());  //      if ( IsDebug() ) printf(" search for idrun1 , query is : \n%s\n",oss.str().c_str());
2088          //  //      //
2089          result =  conn->Query(oss.str().c_str());  //      result =  conn->Query(oss.str().c_str());
2090          if ( !result ) throw -4;  //      if ( !result ) throw -4;
2091          row = result->Next();  //      row = result->Next();
2092          //  //      //
2093          UInt_t idrun1 = 0;  //      UInt_t idrun1 = 0;
2094          if ( !row ){  //      if ( !row ){
2095            throw -10;  //        throw -10;
2096          } else {  //      } else {
2097            idrun1 = (UInt_t)atoll(row->GetField(0));  //        idrun1 = (UInt_t)atoll(row->GetField(0));
2098          };  //      };
2099          //  //      //
2100          oss.str("");  //      oss.str("");
2101          oss << " UPDATE GL_RUN SET ID_RUN_FRAG="<<idrun1<<" WHERE ID="<<idrun0<<" ;";  //      oss << " UPDATE GL_RUN SET ID_RUN_FRAG="<<idrun1<<" WHERE ID="<<idrun0<<" ;";
2102          //  //      //
2103          result =  conn->Query(oss.str().c_str());  //      result =  conn->Query(oss.str().c_str());
2104          if ( !result ) throw -4;  //      if ( !result ) throw -4;
2105          //          //
2106        };        };
2107        //        //
# Line 2102  void PamelaDBOperations::HandleRunFragme Line 2185  void PamelaDBOperations::HandleRunFragme
2185          if ( IsDebug() ) printf(" The run is new \n");          if ( IsDebug() ) printf(" The run is new \n");
2186          if ( IsDebug() ) printf(" -> fill the GL_RUNFRAGMENTS table \n");          if ( IsDebug() ) printf(" -> fill the GL_RUNFRAGMENTS table \n");
2187          //          //
2188            glrun->SetID(this->AssignRunID());
2189            glrun->SetID_RUN_FRAG(0);
2190          glrun->Fill_GL_RUN_FRAGMENTS(conn);          glrun->Fill_GL_RUN_FRAGMENTS(conn);
2191          //          //
2192        } else {        } else {
# Line 2134  void PamelaDBOperations::HandleMissingHo Line 2219  void PamelaDBOperations::HandleMissingHo
2219      //      //
2220      this->FillClass(mishead,mistrail,firstev,lastev);      this->FillClass(mishead,mistrail,firstev,lastev);
2221      //      //
2222      if ( !IsRunAlreadyInserted() ) glrun->Fill_GL_RUN(conn);          if ( !IsRunAlreadyInserted() ){
2223          glrun->SetID(this->AssignRunID());
2224          glrun->SetID_RUN_FRAG(0);
2225          glrun->Fill_GL_RUN(conn);    
2226        };
2227      //      //
2228    };    };
2229    //    //
# Line 2301  Bool_t PamelaDBOperations::IsRunConsiste Line 2390  Bool_t PamelaDBOperations::IsRunConsiste
2390            //                  //      
2391            this->SetCommonGLRUN(firstTime,lastTime);            this->SetCommonGLRUN(firstTime,lastTime);
2392            //            //
2393            if ( !IsRunAlreadyInserted() ) glrun->Fill_GL_RUN(conn);                  if ( !IsRunAlreadyInserted() ){
2394                glrun->SetID(this->AssignRunID());
2395                glrun->SetID_RUN_FRAG(0);
2396                glrun->Fill_GL_RUN(conn);      
2397              };
2398            //            //
2399            firstevno = lastentry + 1;            firstevno = lastentry + 1;
2400            //            //
# Line 2377  void PamelaDBOperations::HandleSuspiciou Line 2470  void PamelaDBOperations::HandleSuspiciou
2470      if ( IsDebug() ) printf(" Checking but no events in the run! \n");      if ( IsDebug() ) printf(" Checking but no events in the run! \n");
2471      //      //
2472      this->FillClass();      this->FillClass();
2473      if ( !IsRunAlreadyInserted() ) glrun->Fill_GL_RUN(conn);          if ( !IsRunAlreadyInserted() ){
2474          glrun->SetID(this->AssignRunID());
2475          glrun->SetID_RUN_FRAG(0);
2476          glrun->Fill_GL_RUN(conn);    
2477        };
2478      //      //
2479    } else {    } else {
2480      //      //
# Line 2405  void PamelaDBOperations::HandleSuspiciou Line 2502  void PamelaDBOperations::HandleSuspiciou
2502        if ( IsDebug() ) printf(" No packets but physics inside the run, I will consider it as good\n");        if ( IsDebug() ) printf(" No packets but physics inside the run, I will consider it as good\n");
2503        //        //
2504        this->FillClass();        this->FillClass();
2505        if ( !IsRunAlreadyInserted() ) glrun->Fill_GL_RUN(conn);                if ( !IsRunAlreadyInserted() ){
2506            glrun->SetID(this->AssignRunID());
2507            glrun->SetID_RUN_FRAG(0);
2508            glrun->Fill_GL_RUN(conn);        
2509          };
2510        //        //
2511      } else {      } else {
2512        //        //
# Line 2503  void PamelaDBOperations::HandleSuspiciou Line 2604  void PamelaDBOperations::HandleSuspiciou
2604            //                  //      
2605            this->SetCommonGLRUN(firstTime,lastTime);            this->SetCommonGLRUN(firstTime,lastTime);
2606            //            //
2607            if ( !IsRunAlreadyInserted() ) glrun->Fill_GL_RUN(conn);                  if ( !IsRunAlreadyInserted() ){
2608                glrun->SetID(this->AssignRunID());
2609                glrun->SetID_RUN_FRAG(0);
2610                glrun->Fill_GL_RUN(conn);      
2611              };
2612            //            //
2613            if ( i == lastev && checkfirst < check ){ // if the last event gives a wrong check...            if ( i == lastev && checkfirst < check ){ // if the last event gives a wrong check...
2614              //              //
# Line 2538  void PamelaDBOperations::HandleSuspiciou Line 2643  void PamelaDBOperations::HandleSuspiciou
2643              //                  //    
2644              this->SetCommonGLRUN(firstTime,lastTime);              this->SetCommonGLRUN(firstTime,lastTime);
2645              //              //
2646              if ( !IsRunAlreadyInserted() ) glrun->Fill_GL_RUN(conn);                    if ( !IsRunAlreadyInserted() ){
2647                  glrun->SetID(this->AssignRunID());
2648                  glrun->SetID_RUN_FRAG(0);
2649                  glrun->Fill_GL_RUN(conn);      
2650                };
2651            };            };
2652            //            //
2653            firstevno = lastentry + 1;            firstevno = lastentry + 1;
# Line 3281  Int_t PamelaDBOperations::CleanGL_RUN_FR Line 3390  Int_t PamelaDBOperations::CleanGL_RUN_FR
3390          if ( IsDebug() ) printf(" The run is new \n");          if ( IsDebug() ) printf(" The run is new \n");
3391          if ( IsDebug() ) printf(" -> fill the DB \n");                if ( IsDebug() ) printf(" -> fill the DB \n");      
3392          //          //
3393          glrun->SetID(0);          //      glrun->SetID(this->AssignRunID()); we use the old run number!
3394            glrun->SetID_RUN_FRAG(glrun->GetID());
3395          glrun->Fill_GL_RUN(conn);            glrun->Fill_GL_RUN(conn);  
3396          //          //
3397          oss.str("");  //      oss.str("");
3398          oss << " SELECT ID FROM GL_RUN WHERE "  //      oss << " SELECT ID FROM GL_RUN WHERE "
3399              << " BOOT_NUMBER=" << glrun->GetBOOT_NUMBER() << " AND "  //          << " BOOT_NUMBER=" << glrun->GetBOOT_NUMBER() << " AND "
3400              << " RUNHEADER_PKT=" << (UInt_t)glrun->GetRUNHEADER_PKT() << " AND "  //          << " RUNHEADER_PKT=" << (UInt_t)glrun->GetRUNHEADER_PKT() << " AND "
3401              << " RUNTRAILER_PKT=" << (UInt_t)glrun->GetRUNTRAILER_PKT() << " AND "  //          << " RUNTRAILER_PKT=" << (UInt_t)glrun->GetRUNTRAILER_PKT() << " AND "
3402              << " RUNHEADER_OBT=" << (UInt_t)glrun->GetRUNHEADER_OBT() << " AND "  //          << " RUNHEADER_OBT=" << (UInt_t)glrun->GetRUNHEADER_OBT() << " AND "
3403              << " RUNTRAILER_OBT=" << (UInt_t)glrun->GetRUNTRAILER_OBT() << "; ";  //          << " RUNTRAILER_OBT=" << (UInt_t)glrun->GetRUNTRAILER_OBT() << "; ";
3404          //  //      //
3405          if ( IsDebug() ) printf(" Look for the ID of the inserted run: query is \n %s \n",oss.str().c_str());  //      if ( IsDebug() ) printf(" Look for the ID of the inserted run: query is \n %s \n",oss.str().c_str());
3406          result2 = conn->Query(oss.str().c_str());  //      result2 = conn->Query(oss.str().c_str());
3407          //  //      //
3408          if ( !result2 ) throw -4;  //      if ( !result2 ) throw -4;
3409          //  //      //
3410          row2 = result2->Next();  //      row2 = result2->Next();
3411          //  //      //
3412          if ( !row2 ) throw -25;  //      if ( !row2 ) throw -25;
3413          //  //      //
3414          oss.str("");  //      oss.str("");
3415          oss << " UPDATE GL_RUN SET ID_RUN_FRAG = " << row2->GetField(0) << " WHERE ID = " << row2->GetField(0);  //      oss << " UPDATE GL_RUN SET ID_RUN_FRAG = " << row2->GetField(0) << " WHERE ID = " << row2->GetField(0);
3416          if ( IsDebug() ) printf(" Update the ID_RUN_FRAG of the inserted run: query is \n %s \n",oss.str().c_str());  //      if ( IsDebug() ) printf(" Update the ID_RUN_FRAG of the inserted run: query is \n %s \n",oss.str().c_str());
3417          result2 = conn->Query(oss.str().c_str());  //      result2 = conn->Query(oss.str().c_str());
3418          //  //      //
3419          if ( !result2 ) throw -4;  //      if ( !result2 ) throw -4;
3420          //          //
3421          moved++;          moved++;
3422          //          //

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

  ViewVC Help
Powered by ViewVC 1.1.23