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

Diff of /chewbacca/YodaProfiler/src/PamelaDBOperations.cpp

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

revision 1.31 by mocchiut, Wed Dec 30 10:46:35 2009 UTC revision 1.35 by mocchiut, Wed Apr 10 08:54:28 2013 UTC
# Line 1730  Int_t PamelaDBOperations::insertPamelaGL Line 1730  Int_t PamelaDBOperations::insertPamelaGL
1730      TYPE = 0;      TYPE = 0;
1731      TSYNC = 0;      TSYNC = 0;
1732      //      //
1733      Double_t minimum = 0.;      //    Double_t minimum = 0.;
1734      Double_t maximum = 0.;      // Double_t maximum = 0.;
1735      Double_t minimum2 = 0.;      //Double_t minimum2 = 0.;
1736      Double_t maximum2 = 0.;      Double_t maximum2 = 0.;
1737      //      //
1738      //      //
# Line 1740  Int_t PamelaDBOperations::insertPamelaGL Line 1740  Int_t PamelaDBOperations::insertPamelaGL
1740      pamela::McmdRecord *mcrc = 0;      pamela::McmdRecord *mcrc = 0;
1741      TArrayC *mcmddata = 0;      TArrayC *mcmddata = 0;
1742      //      //
1743      minimum = numeric_limits<Double_t>::max();      //    minimum = numeric_limits<Double_t>::max();
1744      maximum = numeric_limits<Double_t>::min();      //    maximum = numeric_limits<Double_t>::min();
1745      minimum2 = numeric_limits<Double_t>::max();      //    minimum2 = numeric_limits<Double_t>::max();
1746      maximum2 = numeric_limits<Double_t>::min();      maximum2 = numeric_limits<Double_t>::min();
1747      //      //
1748      T = (TTree*)file->Get("Mcmd");      T = (TTree*)file->Get("Mcmd");
# Line 2270  Int_t PamelaDBOperations::insertPamelaRU Line 2270  Int_t PamelaDBOperations::insertPamelaRU
2270    //    //
2271    // no runtrailers in the file!    // no runtrailers in the file!
2272    //    //
2273    if ( !rtev ){    if ( IsDebug() ) printf(" Start rtev %i rhev %i nrtev %i nrhev %i \n",rtev,rhev,nrtev,nrhev);
2274      if ( !rhev ){    if ( !rtev || (chewbacca && !nrtev) ){
2275        if ( IsDebug() ) printf(" No runtrailers \n");
2276        if ( !rhev || (chewbacca && !nrhev) ){
2277        if ( IsDebug() ) printf(" No runheaders nor runtrailers!! \n");        if ( IsDebug() ) printf(" No runheaders nor runtrailers!! \n");
2278        if ( !(upperentry-chminentry) ){        if ( !(upperentry-chminentry) ){
2279          if ( IsDebug() ) printf(" No physics events nor runs in the file \n"); // di nuovo potrebbe esserci un runtrailer senza eventi (riempimento MM)          if ( IsDebug() ) printf(" No physics events nor runs in the file \n"); // di nuovo potrebbe esserci un runtrailer senza eventi (riempimento MM)
# Line 2308  Int_t PamelaDBOperations::insertPamelaRU Line 2310  Int_t PamelaDBOperations::insertPamelaRU
2310      //      //
2311    } else {    } else {
2312      //      //
2313        if ( IsDebug() ) printf(" We have runtrailers \n");
2314      Int_t conptt = -1;      Int_t conptt = -1;
2315      for (Int_t ptt=0; ptt<rtev; ptt++){      for (Int_t ptt=0; ptt<rtev; ptt++){
2316        //        //
# Line 3595  Bool_t PamelaDBOperations::IsRunConsiste Line 3598  Bool_t PamelaDBOperations::IsRunConsiste
3598    //      //  
3599    EventCounter *code=0;    EventCounter *code=0;
3600    //    //
3601    UInt_t nevent = 0;    //  UInt_t nevent = 0;
3602    UInt_t checkfirst = 0;    UInt_t checkfirst = 0;
3603    UInt_t checklast = 0;    UInt_t checklast = 0;
3604    UInt_t firstentry = 0;    UInt_t firstentry = 0;
# Line 3617  Bool_t PamelaDBOperations::IsRunConsiste Line 3620  Bool_t PamelaDBOperations::IsRunConsiste
3620    EventHeader *eh = 0;    EventHeader *eh = 0;
3621    PscuHeader *ph = 0;    PscuHeader *ph = 0;
3622    T->SetBranchAddress("Header", &eh);    T->SetBranchAddress("Header", &eh);
3623    nevent = T->GetEntries();    //  nevent = T->GetEntries();
3624    //    //
3625    //    //
3626    if ( firstev == lastev+1 || lastev == firstev ) { // no events inside the run!    if ( firstev == lastev+1 || lastev == firstev ) { // no events inside the run!
# Line 4138  void PamelaDBOperations::HandleSuspiciou Line 4141  void PamelaDBOperations::HandleSuspiciou
4141    EventCounter *code=0;    EventCounter *code=0;
4142    UInt_t firstev = 0;    UInt_t firstev = 0;
4143    UInt_t lastev = 0;    UInt_t lastev = 0;
4144    UInt_t nevent = 0;    //  UInt_t nevent = 0;
4145    UInt_t checkfirst = 0;    UInt_t checkfirst = 0;
4146    UInt_t checklast = 0;    UInt_t checklast = 0;
4147    UInt_t firstentry = 0;    UInt_t firstentry = 0;
# Line 4163  void PamelaDBOperations::HandleSuspiciou Line 4166  void PamelaDBOperations::HandleSuspiciou
4166    EventHeader *eh = 0;    EventHeader *eh = 0;
4167    PscuHeader *ph = 0;    PscuHeader *ph = 0;
4168    T->SetBranchAddress("Header", &eh);    T->SetBranchAddress("Header", &eh);
4169    nevent = T->GetEntries();    //  nevent = T->GetEntries();
4170    //    //
4171    codt = eht->GetCounter();    codt = eht->GetCounter();
4172    codh = ehh->GetCounter();    codh = ehh->GetCounter();
# Line 5446  Int_t PamelaDBOperations::insertTRK_CALI Line 5449  Int_t PamelaDBOperations::insertTRK_CALI
5449    
5450          if ( IsDebug() ) cout << endl << ">>>> TRY TO RECOVER TRACKER CALIBRATIONS <<<<"<<endl;          if ( IsDebug() ) cout << endl << ">>>> TRY TO RECOVER TRACKER CALIBRATIONS <<<<"<<endl;
5451    
5452          TSQLResult *result = 0;          TSQLResult *rresult = 0; // 10RED bug, result is re-used inside result looop...
5453            TSQLResult *result = 0; // 10RED bug, result is re-used inside result looop...
5454          TSQLRow    *row    = 0;          TSQLRow    *row    = 0;
5455          //          //
5456          stringstream oss;          stringstream oss;
# Line 5476  Int_t PamelaDBOperations::insertTRK_CALI Line 5480  Int_t PamelaDBOperations::insertTRK_CALI
5480          oss << " ORDER BY ID DESC LIMIT "<<ncalib<<"; ";                  oss << " ORDER BY ID DESC LIMIT "<<ncalib<<"; ";        
5481          if ( IsDebug() ) cout << oss.str().c_str() << endl;          if ( IsDebug() ) cout << oss.str().c_str() << endl;
5482    
5483          result = conn->Query(oss.str().c_str());          rresult = conn->Query(oss.str().c_str());
5484          if ( !result ) throw -4;;          if ( !result ) throw -4;;
5485          if ( IsDebug() ) cout <<"Rows: "<<result->GetRowCount()<<endl;          if ( IsDebug() ) cout <<"Rows: "<<result->GetRowCount()<<endl;
5486                    
# Line 5485  Int_t PamelaDBOperations::insertTRK_CALI Line 5489  Int_t PamelaDBOperations::insertTRK_CALI
5489          // -----------------------------------          // -----------------------------------
5490          UInt_t nn=0;          UInt_t nn=0;
5491          do {          do {
5492              row = result->Next();              row = rresult->Next();
5493              if(!row)break;              if(!row)break;
5494                            
5495              UInt_t id       = (UInt_t)atoll(row->GetField(0));              UInt_t id       = (UInt_t)atoll(row->GetField(0));
# Line 5524  Int_t PamelaDBOperations::insertTRK_CALI Line 5528  Int_t PamelaDBOperations::insertTRK_CALI
5528              TString path       = "";              TString path       = "";
5529              TString name       = "";              TString name       = "";
5530              TString raw        = "";              TString raw        = "";
5531              UInt_t obt0        = 0;              //      UInt_t obt0        = 0;
5532              UInt_t timesync    = 0;              //      UInt_t timesync    = 0;
5533              UInt_t boot_number = 0;              //      UInt_t boot_number = 0;
5534              bool   FOUND       = false;              bool   FOUND       = false;
5535    
5536              if ( IsDebug() ) cout << "------------------------------------------------------------" <<endl;              if ( IsDebug() ) cout << "------------------------------------------------------------" <<endl;
# Line 5599  Int_t PamelaDBOperations::insertTRK_CALI Line 5603  Int_t PamelaDBOperations::insertTRK_CALI
5603                      path       = (TString)row2->GetField(0);                      path       = (TString)row2->GetField(0);
5604                      name       = (TString)row2->GetField(1);                      name       = (TString)row2->GetField(1);
5605                      raw        = (TString)row2->GetField(5);                      raw        = (TString)row2->GetField(5);
5606                      obt0        = (UInt_t)atoll(row2->GetField(2));                      //              obt0        = (UInt_t)atoll(row2->GetField(2));
5607                      timesync    = (UInt_t)atoll(row2->GetField(3));                      //              timesync    = (UInt_t)atoll(row2->GetField(3));
5608                      boot_number = (UInt_t)atoll(row2->GetField(4));                      //              boot_number = (UInt_t)atoll(row2->GetField(4));
5609                                    
5610                      if ( IsDebug() ) cout << "- - - - - - - - - - -" <<endl;                      if ( IsDebug() ) cout << "- - - - - - - - - - -" <<endl;
5611  //                  cout << path <<endl;  //                  cout << path <<endl;
# Line 5665  Int_t PamelaDBOperations::insertTRK_CALI Line 5669  Int_t PamelaDBOperations::insertTRK_CALI
5669                      if(FOUND)break;                      if(FOUND)break;
5670    
5671                  }while(1);//endl loop over root table entries                  }while(1);//endl loop over root table entries
5672                    
5673                    delete result2; // 10RED potential memory leak
5674                  if(FOUND)break;                  if(FOUND)break;
5675    
5676              }//end loop over tables              }//end loop over tables
# Line 5819  Int_t PamelaDBOperations::insertTRK_CALI Line 5824  Int_t PamelaDBOperations::insertTRK_CALI
5824          }while(1);//end loop over calibrations          }while(1);//end loop over calibrations
5825                    
5826                    
5827          if( result )delete result;          if( rresult )delete rresult; // 10RED bug
5828          if( row    )delete row;          if( row    )delete row;
5829                    
5830                    
# Line 6120  Int_t PamelaDBOperations::CleanGL_RUN_FR Line 6125  Int_t PamelaDBOperations::CleanGL_RUN_FR
6125      memset(myid,0,500*sizeof(UInt_t));      memset(myid,0,500*sizeof(UInt_t));
6126      //      //
6127      oss.str("");      oss.str("");
6128      oss << "SELECT ID,RUNTRAILER_TIME,RUNTRAILER_PKT,BOOT_NUMBER FROM GL_RUN_FRAGMENTS WHERE INSERT_TIME <= '" << clean_time->AsSQLString() << "'order BY RUNHEADER_TIME asc;";      oss << "SELECT ID,RUNTRAILER_TIME,RUNTRAILER_PKT,BOOT_NUMBER FROM GL_RUN_FRAGMENTS WHERE INSERT_TIME <= '" << clean_time->AsSQLString() << "' order BY RUNHEADER_TIME asc;";
6129      if ( IsDebug() ) printf(" Select from GL_RUN_FRAGMENTS runs older than %s : query is \n %s \n",clean_time->AsSQLString(),oss.str().c_str());      if ( IsDebug() ) printf(" Select from GL_RUN_FRAGMENTS runs older than %s : query is \n %s \n",clean_time->AsSQLString(),oss.str().c_str());
6130      nresult = conn->Query(oss.str().c_str());      nresult = conn->Query(oss.str().c_str());
6131      //      //

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.35

  ViewVC Help
Powered by ViewVC 1.1.23