/[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.45 by mocchiut, Tue Jun 5 07:01:26 2007 UTC revision 1.46 by mocchiut, Thu Aug 30 15:04:44 2007 UTC
# Line 1717  Bool_t PamelaDBOperations::IsRunAlreadyI Line 1717  Bool_t PamelaDBOperations::IsRunAlreadyI
1717    //                                  ( runhead_time <= _our_runhead_time &&  runtrail_time >= _our_runtrail_time) &&    //                                  ( runhead_time <= _our_runhead_time &&  runtrail_time >= _our_runtrail_time) &&
1718    //                                  ( runhead_obt <= _our_runheadobt || runhead_pkt <= _our_runheadpkt ) &&    //                                  ( runhead_obt <= _our_runheadobt || runhead_pkt <= _our_runheadpkt ) &&
1719    //                                  ( runtrail_obt <= _our_runtrailobt || runtrail_pkt <= _our_runtrailpkt ) )    //                                  ( runtrail_obt <= _our_runtrailobt || runtrail_pkt <= _our_runtrailpkt ) )
1720      //                                  ||
1721      //                                  ( runhead_time = _our_runhead_time &&  runtrail_time = _our_runtrail_time && nevents > 100 )
1722    //                                  )    //                                  )
1723    //    //
1724    oss << " SELECT ID,NEVENTS,TRK_CALIB_USED,PKT_COUNTER FROM GL_RUN WHERE "    oss << " SELECT ID,NEVENTS,TRK_CALIB_USED,PKT_COUNTER FROM GL_RUN WHERE "
# Line 1732  Bool_t PamelaDBOperations::IsRunAlreadyI Line 1734  Bool_t PamelaDBOperations::IsRunAlreadyI
1734        << " RUNHEADER_OBT<=" << glrun->GetRUNHEADER_OBT() << " OR "        << " RUNHEADER_OBT<=" << glrun->GetRUNHEADER_OBT() << " OR "
1735        << " RUNHEADER_PKT<=" << glrun->GetRUNHEADER_PKT() << ") AND ("        << " RUNHEADER_PKT<=" << glrun->GetRUNHEADER_PKT() << ") AND ("
1736        << " RUNTRAILER_OBT>=" << glrun->GetRUNTRAILER_OBT() << " OR "        << " RUNTRAILER_OBT>=" << glrun->GetRUNTRAILER_OBT() << " OR "
1737        << " RUNTRAILER_PKT>=" << glrun->GetRUNTRAILER_PKT() << ") ));";        << " RUNTRAILER_PKT>=" << glrun->GetRUNTRAILER_PKT() << ") OR "
1738          << " (RUNHEADER_TIME=" << (UInt_t)glrun->GetRUNHEADER_TIME() << " AND "                //  these two lines in a certain way disable the patch below...
1739          << " RUNTRAILER_TIME=" << (UInt_t)glrun->GetRUNTRAILER_TIME() <<" AND NEVENTS>100)"    //
1740          << " ));";
1741    //    //
1742    if ( IsDebug() ) printf(" check if run has been inserted: query is \n %s \n",oss.str().c_str());    if ( IsDebug() ) printf(" check if run has been inserted: query is \n %s \n",oss.str().c_str());
1743    result = conn->Query(oss.str().c_str());    result = conn->Query(oss.str().c_str());
# Line 1754  Bool_t PamelaDBOperations::IsRunAlreadyI Line 1759  Bool_t PamelaDBOperations::IsRunAlreadyI
1759      //      //
1760      // the run has already been inserted      // the run has already been inserted
1761      //      //
1762      //    return(true);  //<<<<<<<<<<<<<<<<<<<<<<<< patch follows, uncomment here      if ( signal && IsDebug() ) printf(" The run has already been inserted \n");    
1763        return(true);  //<<<<<<<<<<<<<<<<<<<<<<<< patch follows, uncomment here
1764      //      //
1765      // PATCH!      // PATCH!
1766      // we keep the processing run if (in order of growing importance) 1) we have the runtrailer while the old run doesn't have it 2) we have the runheader      // we keep the processing run if (in order of growing importance) 1) we have the runtrailer while the old run doesn't have it 2) we have the runheader
# Line 4678  UInt_t PamelaDBOperations::Check(){ Line 4684  UInt_t PamelaDBOperations::Check(){
4684    TSQLRow    *row    = 0;    TSQLRow    *row    = 0;
4685    TSQLResult *result2 = 0;    TSQLResult *result2 = 0;
4686    TSQLRow    *row2    = 0;    TSQLRow    *row2    = 0;
4687      TSQLResult *result3 = 0;
4688      TSQLRow    *row3    = 0;
4689    oss.str("");    oss.str("");
4690    oss << "SELECT ID,ID_ROOT_L0,RUNHEADER_TIME,RUNTRAILER_TIME FROM GL_RUN order by RUNHEADER_TIME asc;";    oss << "SELECT ID,ID_ROOT_L0,RUNHEADER_TIME,RUNTRAILER_TIME,NEVENTS FROM GL_RUN order by RUNHEADER_TIME asc;";
4691    //  oss << "SELECT ID,RUNHEADER_TIME,RUNTRAILER_TIME FROM GL_RUN where ID>10170 and ID<10190 order by RUNHEADER_TIME asc;";    //  oss << "SELECT ID,RUNHEADER_TIME,RUNTRAILER_TIME FROM GL_RUN where ID>10170 and ID<10190 order by RUNHEADER_TIME asc;";
4692    result = conn->Query(oss.str().c_str());    result = conn->Query(oss.str().c_str());
4693    //    //
# Line 4693  UInt_t PamelaDBOperations::Check(){ Line 4701  UInt_t PamelaDBOperations::Check(){
4701      thisrht = (UInt_t)atoll(row->GetField(2));      thisrht = (UInt_t)atoll(row->GetField(2));
4702      thisrtt = (UInt_t)atoll(row->GetField(3));      thisrtt = (UInt_t)atoll(row->GetField(3));
4703      //      //
4704        if ( (UInt_t)atoll(row->GetField(4)) > 1 ){
4705          //
4706          //
4707          //
4708          oss.str("");
4709          oss << "SELECT ID,ID_ROOT_L0,RUNHEADER_TIME,RUNTRAILER_TIME FROM GL_RUN WHERE ID!="
4710              << thisid << " AND RUNHEADER_TIME="
4711              << thisrht << " AND RUNTRAILER_TIME!="
4712              << thisrtt << " AND NEVENTS!=0 AND NEVENTS!=1 order by RUNHEADER_TIME asc;";
4713          result3 = conn->Query(oss.str().c_str());
4714          if ( IsDebug() ) printf(" query is %s \n",oss.str().c_str());
4715          if ( result3 ){
4716            row3 = result3->Next();
4717            //
4718            while ( row3 ){
4719              //
4720              // 2 runs with same runheader
4721              //
4722              printf(" CHECK n.4 RUNs %u and %u HAVE SAME RUNHEADER \n",thisid,(UInt_t)atoll(row3->GetField(0)));    
4723              row3 = result3->Next();
4724            };
4725          };
4726          //
4727          oss.str("");
4728          oss << "SELECT ID,ID_ROOT_L0,RUNHEADER_TIME,RUNTRAILER_TIME FROM GL_RUN WHERE ID!="
4729              << thisid << " AND RUNHEADER_TIME!="
4730              << thisrht << " AND RUNTRAILER_TIME="
4731              << thisrtt << " AND NEVENTS!=0 AND NEVENTS!=1 order by RUNHEADER_TIME asc;";
4732          result3 = conn->Query(oss.str().c_str());
4733          if ( IsDebug() ) printf(" query is %s \n",oss.str().c_str());
4734          if ( result3 ){
4735            row3 = result3->Next();
4736            //
4737            while ( row3 ){
4738              //
4739              // 2 runs with same runtrailer
4740              //
4741              printf(" CHECK n.5 RUNs %u and %u HAVE SAME RUNTRAILER \n",thisid,(UInt_t)atoll(row3->GetField(0)));
4742              row3 = result3->Next();
4743            };
4744          };
4745          //
4746          oss.str("");
4747          oss << "SELECT ID,ID_ROOT_L0,RUNHEADER_TIME,RUNTRAILER_TIME FROM GL_RUN WHERE ID!="
4748              << thisid << " AND RUNHEADER_TIME>"
4749              << thisrht << " AND RUNTRAILER_TIME<"
4750              << thisrtt << " order by RUNHEADER_TIME asc;";
4751          result3 = conn->Query(oss.str().c_str());
4752          if ( result3 ){
4753            row3 = result3->Next();
4754            //
4755            while ( row3 ){
4756              //
4757              // run contained in the checked one
4758              //
4759              printf(" CHECK n.6 RUN %u CONTAINS RUN %u  \n",thisid,(UInt_t)atoll(row3->GetField(0)));
4760              row3 = result3->Next();
4761            };
4762          };
4763          //
4764          oss.str("");
4765          oss << "SELECT ID,ID_ROOT_L0,RUNHEADER_TIME,RUNTRAILER_TIME FROM GL_RUN WHERE ID!="
4766              << thisid << " AND RUNHEADER_TIME="
4767              << thisrht << " AND RUNTRAILER_TIME="
4768              << thisrtt << " AND ID_RUN_FRAG!="
4769              << thisid << " order by RUNHEADER_TIME asc;";
4770          result3 = conn->Query(oss.str().c_str());
4771          if ( result3 ){
4772            row3 = result3->Next();
4773            //
4774            while ( row3 ){
4775              //
4776              // duplicated run
4777              //
4778              printf(" CHECK n.7 RUNs %u and %u HAVE SAME RUNTRAILER AND RUNHEADER (ARE THE SAME?) \n",thisid,(UInt_t)atoll(row3->GetField(0)));
4779              row3 = result3->Next();
4780            };
4781          };
4782        };
4783        //
4784      //    if ( thisrht < prevrtt || thisrtt < prevrht || thisrht > thisrtt && !(!prevrht && !prevrtt &&!previd) ){      //    if ( thisrht < prevrtt || thisrtt < prevrht || thisrht > thisrtt && !(!prevrht && !prevrtt &&!previd) ){
4785      //    if ( (thisrht < prevrtt || thisrtt < prevrht || thisrht > thisrtt) && (thisrht != prevrht) ){      //    if ( (thisrht < prevrtt || thisrtt < prevrht || thisrht > thisrtt) && (thisrht != prevrht) ){
4786      if ( (thisrht < prevrtt) && (thisrht != prevrht) ){      if ( (thisrht < prevrtt) && (thisrht != prevrht) ){
# Line 4724  UInt_t PamelaDBOperations::Check(){ Line 4812  UInt_t PamelaDBOperations::Check(){
4812        oss.str("");        oss.str("");
4813        oss << "SELECT NAME FROM GL_ROOT where ID=" << (UInt_t)prevl0id <<";";        oss << "SELECT NAME FROM GL_ROOT where ID=" << (UInt_t)prevl0id <<";";
4814        result2 = conn->Query(oss.str().c_str());        result2 = conn->Query(oss.str().c_str());
4815        if ( !result2 ) throw -4;;        if ( !result2 ) throw -4;
4816        row2 = result2->Next();        row2 = result2->Next();
4817        prevf = (TString)row2->GetField(0);        prevf = (TString)row2->GetField(0);
4818        oss.str("");        oss.str("");

Legend:
Removed from v.1.45  
changed lines
  Added in v.1.46

  ViewVC Help
Powered by ViewVC 1.1.23