/[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.23 by mocchiut, Mon Dec 4 09:49:34 2006 UTC revision 1.25 by mocchiut, Tue Jan 23 17:04:12 2007 UTC
# Line 273  Bool_t PamelaDBOperations::SetID_RAW(){ Line 273  Bool_t PamelaDBOperations::SetID_RAW(){
273    oss << "SELECT ID FROM GL_RAW WHERE "    oss << "SELECT ID FROM GL_RAW WHERE "
274        << " PATH = '" << this->GetRawPath().Data() << "' AND "        << " PATH = '" << this->GetRawPath().Data() << "' AND "
275        << " NAME = '" << this->GetRawFile().Data() << "' ";        << " NAME = '" << this->GetRawFile().Data() << "' ";
276    
277    result = conn->Query(oss.str().c_str());    result = conn->Query(oss.str().c_str());
278    if ( result == NULL ) throw -4;    if ( result == NULL ) throw -4;
279    row = result->Next();    row = result->Next();
# Line 4424  void PamelaDBOperations::RemoveCALIBS(){ Line 4425  void PamelaDBOperations::RemoveCALIBS(){
4425      //      //
4426    };    };
4427  };  };
4428    
4429  /**  /**
4430   *   *
4431   * Rearrange calibration tables   * Rearrange calibration tables
# Line 4541  UInt_t PamelaDBOperations::ValidateTrkCa Line 4543  UInt_t PamelaDBOperations::ValidateTrkCa
4543       return 1; // :-)       return 1; // :-)
4544    
4545  }  }
4546    
4547    /**
4548     *
4549     * Check the DB (only for overlapping runs at the moment)
4550     *
4551     **/
4552    UInt_t PamelaDBOperations::Check(){
4553      //
4554      UInt_t test = 0;
4555      //
4556      UInt_t thisrht = 0;
4557      UInt_t thisrtt = 0;
4558      UInt_t thisid = 0;
4559      UInt_t prevrht = 0;
4560      UInt_t prevrtt = 0;
4561      UInt_t previd = 0;
4562      //
4563      UInt_t prevl0id = 0;
4564      UInt_t thisl0id = 0;
4565      //
4566      stringstream oss;
4567      TSQLResult *result = 0;
4568      TSQLRow    *row    = 0;
4569      TSQLResult *result2 = 0;
4570      TSQLRow    *row2    = 0;
4571      oss.str("");
4572      oss << "SELECT ID,ID_ROOT_L0,RUNHEADER_TIME,RUNTRAILER_TIME FROM GL_RUN order by RUNHEADER_TIME asc;";
4573      //  oss << "SELECT ID,RUNHEADER_TIME,RUNTRAILER_TIME FROM GL_RUN where ID>10170 and ID<10190 order by RUNHEADER_TIME asc;";
4574      result = conn->Query(oss.str().c_str());
4575      //
4576      if ( !result ) throw -4;;
4577      //
4578      row = result->Next();
4579      //
4580      while ( row ){
4581        thisid = (UInt_t)atoll(row->GetField(0));
4582        thisl0id = (UInt_t)atoll(row->GetField(1));
4583        thisrht = (UInt_t)atoll(row->GetField(2));
4584        thisrtt = (UInt_t)atoll(row->GetField(3));
4585        //
4586        //    if ( thisrht < prevrtt || thisrtt < prevrht || thisrht > thisrtt && !(!prevrht && !prevrtt &&!previd) ){
4587        //    if ( (thisrht < prevrtt || thisrtt < prevrht || thisrht > thisrtt) && (thisrht != prevrht) ){
4588        if ( (thisrht < prevrtt) && (thisrht != prevrht) ){
4589          if ( IsDebug() ) printf(" IDprev %u ID %u    prevrht %u prevrtt %u  thisrht %u thisrtt %u \n",previd,thisid,prevrht,prevrtt,thisrht,thisrtt);
4590          printf(" CHECK n.1 TIME SCREW of %i s AROUND RUNs %u and %u \n",(thisrht-prevrtt),previd,thisid);
4591          TString prevf = "";
4592          TString thisf = "";
4593          oss.str("");
4594          oss << "SELECT NAME FROM GL_ROOT where ID=" << (UInt_t)prevl0id <<";";
4595          result2 = conn->Query(oss.str().c_str());
4596          if ( !result2 ) throw -4;;
4597          row2 = result2->Next();
4598          prevf = (TString)row2->GetField(0);
4599          oss.str("");
4600          oss << "SELECT NAME FROM GL_ROOT where ID=" << (UInt_t)thisl0id <<";";
4601          result2 = conn->Query(oss.str().c_str());
4602          if ( !result2 ) throw -4;;
4603          row2 = result2->Next();
4604          thisf = (TString)row2->GetField(0);
4605          if ( IsDebug() ) printf(" ==> files %s and %s \n",prevf.Data(),thisf.Data());
4606          test = 1;
4607        };
4608        //
4609        if ( (thisrtt < prevrht) && (thisrht != prevrht) ){
4610          if ( IsDebug() ) printf(" IDprev %u ID %u    prevrht %u prevrtt %u  thisrht %u thisrtt %u \n",previd,thisid,prevrht,prevrtt,thisrht,thisrtt);
4611          printf(" CHECK n.2 TIME SCREW of %i s AROUND RUNs %u and %u \n",(thisrtt-prevrht),previd,thisid);
4612          TString prevf = "";
4613          TString thisf = "";
4614          oss.str("");
4615          oss << "SELECT NAME FROM GL_ROOT where ID=" << (UInt_t)prevl0id <<";";
4616          result2 = conn->Query(oss.str().c_str());
4617          if ( !result2 ) throw -4;;
4618          row2 = result2->Next();
4619          prevf = (TString)row2->GetField(0);
4620          oss.str("");
4621          oss << "SELECT NAME FROM GL_ROOT where ID=" << (UInt_t)thisl0id <<";";
4622          result2 = conn->Query(oss.str().c_str());
4623          if ( !result2 ) throw -4;;
4624          row2 = result2->Next();
4625          thisf = (TString)row2->GetField(0);
4626          if ( IsDebug() ) printf(" ==> files %s and %s \n",prevf.Data(),thisf.Data());
4627          test = 1;
4628        };
4629        //
4630        if ( (thisrht > thisrtt) && (thisrht != prevrht) ){
4631          if ( IsDebug() ) printf(" IDprev %u ID %u    prevrht %u prevrtt %u  thisrht %u thisrtt %u \n",previd,thisid,prevrht,prevrtt,thisrht,thisrtt);
4632          printf(" CHECK n.3 TIME SCREW of %i s AROUND RUNs %u and %u \n",(thisrht-thisrtt),previd,thisid);
4633          TString prevf = "";
4634          TString thisf = "";
4635          oss.str("");
4636          oss << "SELECT NAME FROM GL_ROOT where ID=" << (UInt_t)prevl0id <<";";
4637          result2 = conn->Query(oss.str().c_str());
4638          if ( !result2 ) throw -4;;
4639          row2 = result2->Next();
4640          prevf = (TString)row2->GetField(0);
4641          oss.str("");
4642          oss << "SELECT NAME FROM GL_ROOT where ID=" << (UInt_t)thisl0id <<";";
4643          result2 = conn->Query(oss.str().c_str());
4644          if ( !result2 ) throw -4;;
4645          row2 = result2->Next();
4646          thisf = (TString)row2->GetField(0);
4647          if ( IsDebug() ) printf(" ==> files %s and %s \n",prevf.Data(),thisf.Data());
4648          test = 1;
4649        };
4650    
4651        //
4652        prevrht = thisrht;
4653        prevrtt = thisrtt;
4654        previd = thisid;
4655        prevl0id = thisl0id;
4656        row = result->Next();
4657      };
4658      //
4659      return(test);
4660      //
4661    };

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.25

  ViewVC Help
Powered by ViewVC 1.1.23