/[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.24 by mocchiut, Mon Dec 4 11:32:07 2006 UTC revision 1.27 by mocchiut, Mon Feb 12 13:32:18 2007 UTC
# Line 56  string getTleDatetime(cTle*); Line 56  string getTleDatetime(cTle*);
56   * @param debug        debug flag.   * @param debug        debug flag.
57   * @param tlefilename  ascii file with TLE 3 line elements.   * @param tlefilename  ascii file with TLE 3 line elements.
58   */   */
59  PamelaDBOperations::PamelaDBOperations(TString host, TString user, TString password, TString filerawname, TString filerootname, UInt_t boot, UInt_t tsync, UInt_t obt0, Bool_t debug, TString tlefilename){  PamelaDBOperations::PamelaDBOperations(TString host, TString user, TString password, TString filerawname, TString filerootname, UInt_t boot, UInt_t tsync, UInt_t obt0, Bool_t debug, TString tlefilename, UInt_t dwinput){
60    //    //
61    //    //
62    SetConnection(host,user,password);    SetConnection(host,user,password);
# Line 79  PamelaDBOperations::PamelaDBOperations(T Line 79  PamelaDBOperations::PamelaDBOperations(T
79    INSERT_ROOT = !filerootname.IsNull();    INSERT_ROOT = !filerootname.IsNull();
80    if( INSERT_ROOT ){    if( INSERT_ROOT ){
81      this->SetRootName(filerootname);      this->SetRootName(filerootname);
82      this->SetOrbitNo();      this->SetOrbitNo(dwinput);
83      file = TFile::Open(this->GetRootName().Data());      file = TFile::Open(this->GetRootName().Data());
84    } else {    } else {
85      this->SetRootName("");      this->SetRootName("");
# Line 215  void PamelaDBOperations::SetRootName(TSt Line 215  void PamelaDBOperations::SetRootName(TSt
215  /**  /**
216   * Store the downlink orbit number from filename.   * Store the downlink orbit number from filename.
217   */   */
218  void PamelaDBOperations::SetOrbitNo(){  void PamelaDBOperations::SetOrbitNo(UInt_t dwinput){
219    dworbit = 0;    dworbit = 0;
220      //
221      if ( dwinput ){
222        dworbit = dwinput;
223        if ( IsDebug() ) printf(" Downlink orbit given by hand: %i  \n",dworbit);
224        return;
225      };
226      //
227    TString name = this->GetRootFile();    TString name = this->GetRootFile();
228    Int_t nlength = name.Length();    Int_t nlength = name.Length();
229    if ( nlength < 5 ) return;    if ( nlength < 5 ) return;
# Line 273  Bool_t PamelaDBOperations::SetID_RAW(){ Line 280  Bool_t PamelaDBOperations::SetID_RAW(){
280    oss << "SELECT ID FROM GL_RAW WHERE "    oss << "SELECT ID FROM GL_RAW WHERE "
281        << " PATH = '" << this->GetRawPath().Data() << "' AND "        << " PATH = '" << this->GetRawPath().Data() << "' AND "
282        << " NAME = '" << this->GetRawFile().Data() << "' ";        << " NAME = '" << this->GetRawFile().Data() << "' ";
283    
284    result = conn->Query(oss.str().c_str());    result = conn->Query(oss.str().c_str());
285    if ( result == NULL ) throw -4;    if ( result == NULL ) throw -4;
286    row = result->Next();    row = result->Next();
# Line 360  Int_t PamelaDBOperations::SetUpperLimits Line 368  Int_t PamelaDBOperations::SetUpperLimits
368    if ( !nevent ) return(2);    if ( !nevent ) return(2);
369    //    //
370    if ( nevent < 2 ) return(4);    if ( nevent < 2 ) return(4);
371      if ( nevent < jump ) jump = 1;
372      //  if ( nevent < jump ) jump = int(nevent/10);
373      //  if ( !jump ) jump = 1;
374    //    //
375    if ( (PKT(pktlast) < PKT(pktfirst) && OBT(obtlast) < OBT(obtfirst)) || (labs(PKT(pktlast)-PKT(pktfirst))<deltapkt && labs(OBT(obtlast)-OBT(obtfirst))<deltaobt) ){    if ( (PKT(pktlast) < PKT(pktfirst) && OBT(obtlast) < OBT(obtfirst)) || (labs(PKT(pktlast)-PKT(pktfirst))<deltapkt && labs(OBT(obtlast)-OBT(obtfirst))<deltaobt) && nevent > deltapkt ){
376      //      //
377        if ( IsDebug() ) printf(" starting jump %i \n",jump);
378      // go back      // go back
379      zomp = nevent - 2;      zomp = nevent - 2;
380      //      //
# Line 438  Int_t PamelaDBOperations::SetUpperLimits Line 450  Int_t PamelaDBOperations::SetUpperLimits
450    Long64_t pkth = 0LL;    Long64_t pkth = 0LL;
451    Long64_t obth = 0LL;    Long64_t obth = 0LL;
452    //    //
453      if ( rhev || rtev ){
454    
455    
456    T->GetEntry(upperentry);    T->GetEntry(upperentry);
457    code = eh->GetCounter();    code = eh->GetCounter();
458    Int_t lasttrail = code->Get(pctp->RunTrailer);    Int_t lasttrail = code->Get(pctp->RunTrailer);
# Line 644  Int_t PamelaDBOperations::SetUpperLimits Line 659  Int_t PamelaDBOperations::SetUpperLimits
659    };    };
660    if ( IsDebug() ) printf(" rtev after %i  pt %lld upperp %lld ot %lld uppero %lld \n",rtev,pktt,upperpkt,obtt,upperobt);    if ( IsDebug() ) printf(" rtev after %i  pt %lld upperp %lld ot %lld uppero %lld \n",rtev,pktt,upperpkt,obtt,upperobt);
661    //    //
662    
663    
664      };
665      //
666    if ( IsDebug() ) printf(" Upper limits are: OBT %lld pkt_num %lld upper entry %i \n",upperobt,upperpkt,upperentry);    if ( IsDebug() ) printf(" Upper limits are: OBT %lld pkt_num %lld upper entry %i \n",upperobt,upperpkt,upperentry);
667    //    //
668    return(0);    return(0);
# Line 778  void PamelaDBOperations::CheckConnection Line 797  void PamelaDBOperations::CheckConnection
797    if( !conn ) throw -1;    if( !conn ) throw -1;
798    bool connect = conn->IsConnected();    bool connect = conn->IsConnected();
799    if( !connect ) throw -1;    if( !connect ) throw -1;
800      //
801      if ( IsDebug() ) printf("\n DB INFORMATIONS:\n SQL: %s Version: %s Host %s Port %i \n\n",conn->GetDBMS(),conn->ServerInfo(),conn->GetHost(),conn->GetPort());
802      //
803    if ( !dworbit && strcmp(this->GetRootName().Data(),"") ) throw -27;    if ( !dworbit && strcmp(this->GetRootName().Data(),"") ) throw -27;
804    //    //
805    // set DB timezone to UTC    // set DB timezone to UTC
# Line 789  void PamelaDBOperations::CheckConnection Line 811  void PamelaDBOperations::CheckConnection
811    TSQLResult *result = 0;    TSQLResult *result = 0;
812    result = conn->Query(oss.str().c_str());    result = conn->Query(oss.str().c_str());
813    if ( !result ) throw -10;    if ( !result ) throw -10;
814      oss.str("");
815      oss << "SET wait_timeout=173000;";
816      conn->Query(oss.str().c_str());
817    //    //
818  };  };
819    
# Line 1373  Int_t PamelaDBOperations::assignBOOT_NUM Line 1398  Int_t PamelaDBOperations::assignBOOT_NUM
1398    //    //
1399    Int_t sgn = 0;    Int_t sgn = 0;
1400    //    //
1401    if ( !found ){    if ( !found && !BOOTNO ){
1402      throw -29;      throw -29;
1403    } else {    } else {
1404      if ( afound ){      if ( afound ){

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.27

  ViewVC Help
Powered by ViewVC 1.1.23