/[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.53 by mocchiut, Fri Nov 30 13:17:34 2007 UTC revision 1.56 by mocchiut, Mon Mar 10 10:58:01 2008 UTC
# Line 169  void PamelaDBOperations::SetAutoBoot(Boo Line 169  void PamelaDBOperations::SetAutoBoot(Boo
169  };  };
170    
171  /**  /**
172     * Set the pedantic flag
173     *
174     */
175    void PamelaDBOperations::SetPedantic(Bool_t dbg){
176      PEDANTIC = dbg;
177    };
178    
179    /**
180   * Set the nofrag flag   * Set the nofrag flag
181   *   *
182   */   */
# Line 490  Int_t PamelaDBOperations::SetUpperLimits Line 498  Int_t PamelaDBOperations::SetUpperLimits
498    if ( (PKT(pktlast) < PKT(pktfirst) && OBT(obtlast) < OBT(obtfirst)) || (labs(PKT(pktlast)-PKT(pktfirst))<deltapkt && labs(OBT(obtlast)-OBT(obtfirst))<deltaobt) && nevent > deltapkt ){    if ( (PKT(pktlast) < PKT(pktfirst) && OBT(obtlast) < OBT(obtfirst)) || (labs(PKT(pktlast)-PKT(pktfirst))<deltapkt && labs(OBT(obtlast)-OBT(obtfirst))<deltaobt) && nevent > deltapkt ){
499      //      //
500      if ( IsDebug() ) printf(" starting jump %i \n",jump);      if ( IsDebug() ) printf(" starting jump %i \n",jump);
501        if ( PEDANTIC ) throw -66;
502      // go back      // go back
503      zomp = nevent - 2;      zomp = nevent - 2;
504      //      //
# Line 629  Int_t PamelaDBOperations::SetUpperLimits Line 638  Int_t PamelaDBOperations::SetUpperLimits
638        //    if ( IsDebug() ) printf(" k %i rhev before %i ph %u upperp %u oh %u uppero %u \n",k,rhev,pkth,spkth,obth,sobth);        //    if ( IsDebug() ) printf(" k %i rhev before %i ph %u upperp %u oh %u uppero %u \n",k,rhev,pkth,spkth,obth,sobth);
639        //        //
640        if ( pkth < spkth && obth < sobth ){        if ( pkth < spkth && obth < sobth ){
641            if ( PEDANTIC ) throw -66;
642          if ( IsDebug() ) printf(" RH PROBLEMS determining the event repetition at the end of the file lasthead %i  \n",rhev);          if ( IsDebug() ) printf(" RH PROBLEMS determining the event repetition at the end of the file lasthead %i  \n",rhev);
643          //          //
644          rhev = k-1;          rhev = k-1;
# Line 688  Int_t PamelaDBOperations::SetUpperLimits Line 698  Int_t PamelaDBOperations::SetUpperLimits
698        //    if ( IsDebug() ) printf(" k %i rtev beforev %i  pt %i upperp %i ot %llu uppero %llu \n",k,rtev,pktt,spktt,obtt,sobtt);        //    if ( IsDebug() ) printf(" k %i rtev beforev %i  pt %i upperp %i ot %llu uppero %llu \n",k,rtev,pktt,spktt,obtt,sobtt);
699        //        //
700        if ( pktt < spktt && obtt < sobtt ){        if ( pktt < spktt && obtt < sobtt ){
701            if ( PEDANTIC ) throw -66;
702          if ( IsDebug() ) printf(" RT PROBLEMS determining the event repetition at the end of the file lasttrail %i \n",rtev);          if ( IsDebug() ) printf(" RT PROBLEMS determining the event repetition at the end of the file lasttrail %i \n",rtev);
703          //          //
704          rtev = k-1;          rtev = k-1;
# Line 959  Long64_t PamelaDBOperations::OBT(UInt_t Line 970  Long64_t PamelaDBOperations::OBT(UInt_t
970    if ( IsDebug() ) printf(" obt conversion: obt is %u obtfirst is %u  (numeric_limits<UInt_t>::max()/2) is %u  \n",obt,pobtfirst,(UInt_t)(numeric_limits<UInt_t>::max()/2));    if ( IsDebug() ) printf(" obt conversion: obt is %u obtfirst is %u  (numeric_limits<UInt_t>::max()/2) is %u  \n",obt,pobtfirst,(UInt_t)(numeric_limits<UInt_t>::max()/2));
971    //    //
972    if ( obt < (pobtfirst/2) && pobtfirst > (numeric_limits<UInt_t>::max()/2) ){    if ( obt < (pobtfirst/2) && pobtfirst > (numeric_limits<UInt_t>::max()/2) ){
973      if ( IsDebug() ) printf(" rise up obt %lld \n",(Long64_t)(obt+numeric_limits<UInt_t>::max()));      if ( IsDebug() ) printf(" rise up obt %lld \n",(Long64_t)obt+(Long64_t)numeric_limits<UInt_t>::max());
974      return((Long64_t)(obt+numeric_limits<UInt_t>::max()));      return((Long64_t)obt+(Long64_t)numeric_limits<UInt_t>::max());
975    };    };
976    //    //
977    if ( obt > ((Long64_t)pobtfirst*2) && obt > (numeric_limits<UInt_t>::max()/2) ){    if ( obt > ((Long64_t)pobtfirst*2) && obt > (numeric_limits<UInt_t>::max()/2) ){
# Line 1163  Int_t PamelaDBOperations::insertPamelaGL Line 1174  Int_t PamelaDBOperations::insertPamelaGL
1174      tsync = (UInt_t)atoll(row->GetField(2));      tsync = (UInt_t)atoll(row->GetField(2));
1175      obt0 = (UInt_t)atoll(row->GetField(1));      obt0 = (UInt_t)atoll(row->GetField(1));
1176      //      //
1177        if ( PEDANTIC ) throw -67;
1178      return(1);      return(1);
1179    };    };
1180    //    //
# Line 1332  Int_t PamelaDBOperations::insertPamelaGL Line 1344  Int_t PamelaDBOperations::insertPamelaGL
1344    //    //
1345    if ( !existsts && obt0 ){ // insert timesync by hand    if ( !existsts && obt0 ){ // insert timesync by hand
1346      //      //
1347        if ( PEDANTIC ) throw -68;
1348      if ( IsDebug() ) printf(" No incl mcmd \n");      if ( IsDebug() ) printf(" No incl mcmd \n");
1349      signal = 30;      signal = 30;
1350      //      //
# Line 2038  void PamelaDBOperations::HandleRunFragme Line 2051  void PamelaDBOperations::HandleRunFragme
2051      //      //
2052    } else {    } else {
2053      if ( IsDebug() ) printf(" The run is already present in the fragment table \n");      if ( IsDebug() ) printf(" The run is already present in the fragment table \n");
2054        if ( PEDANTIC ) throw -69;
2055      return;      return;
2056    };    };
2057    //    //
# Line 2188  void PamelaDBOperations::HandleRunFragme Line 2202  void PamelaDBOperations::HandleRunFragme
2202          bpkt = PKT(ph->GetCounter());          bpkt = PKT(ph->GetCounter());
2203          bobt = OBT(ph->GetOrbitalTime());                bobt = OBT(ph->GetOrbitalTime());      
2204          firstev++;          firstev++;
2205            if ( PEDANTIC ) throw -71;
2206        };        };
2207        if ( IsDebug() ) printf(" Check overlapping events done: %u %u %llu %llu firstev is %i\n",apkt,bpkt,aobt,bobt,firstev);        if ( IsDebug() ) printf(" Check overlapping events done: %u %u %llu %llu firstev is %i\n",apkt,bpkt,aobt,bobt,firstev);
2208        //        //
# Line 2385  void PamelaDBOperations::HandleRunFragme Line 2400  void PamelaDBOperations::HandleRunFragme
2400          apkt = PKT(ph->GetCounter());          apkt = PKT(ph->GetCounter());
2401          aobt = OBT(ph->GetOrbitalTime());                aobt = OBT(ph->GetOrbitalTime());      
2402          lastev--;          lastev--;
2403            if ( PEDANTIC ) throw -72;
2404        };        };
2405        if ( IsDebug() ) printf(" Check overlapping events done: %u %u %llu %llu lastev is %i\n",apkt,bpkt,aobt,bobt,lastev);        if ( IsDebug() ) printf(" Check overlapping events done: %u %u %llu %llu lastev is %i\n",apkt,bpkt,aobt,bobt,lastev);
2406        //        //
# Line 2471  void PamelaDBOperations::HandleRunFragme Line 2487  void PamelaDBOperations::HandleRunFragme
2487      //      //
2488      if ( row ){      if ( row ){
2489        if ( IsDebug() ) printf(" The run is already present in the GL_RUN table \n");        if ( IsDebug() ) printf(" The run is already present in the GL_RUN table \n");
2490          if ( PEDANTIC ) throw -70;
2491      } else {      } else {
2492        if ( NoFrag() ){        if ( NoFrag() ){
2493          glrun->SetID_RUN_FRAG(glrun->GetID());          glrun->SetID_RUN_FRAG(glrun->GetID());
# Line 3014  Int_t PamelaDBOperations::insertCALO_CAL Line 3031  Int_t PamelaDBOperations::insertCALO_CAL
3031            if ( row ){            if ( row ){
3032              //              //
3033              if ( IsDebug() ) printf(" Calo calibration already inserted in the DB\n");              if ( IsDebug() ) printf(" Calo calibration already inserted in the DB\n");
3034                if ( PEDANTIC ) throw -73;
3035              //              //
3036            } else {            } else {
3037              //              //
# Line 3101  Int_t PamelaDBOperations::insertCALO_CAL Line 3119  Int_t PamelaDBOperations::insertCALO_CAL
3119          } else {          } else {
3120            //            //
3121            if ( IsDebug() ) printf(" Repeated calo calibration for section %i at time %u obt %u pkt %u \n",section,fromtime,obt,pkt);            if ( IsDebug() ) printf(" Repeated calo calibration for section %i at time %u obt %u pkt %u \n",section,fromtime,obt,pkt);
3122              if ( PEDANTIC ) throw -74;
3123            //            //
3124          };                };      
3125          //                //      
# Line 3189  Int_t PamelaDBOperations::insertCALOPULS Line 3208  Int_t PamelaDBOperations::insertCALOPULS
3208              if ( row ){              if ( row ){
3209                //                //
3210                if ( IsDebug() ) printf(" Calo pulse1 calibration already inserted in the DB\n");                if ( IsDebug() ) printf(" Calo pulse1 calibration already inserted in the DB\n");
3211                  if ( PEDANTIC ) throw -75;
3212                //                //
3213              } else {              } else {
3214                //                //
# Line 3279  Int_t PamelaDBOperations::insertCALOPULS Line 3299  Int_t PamelaDBOperations::insertCALOPULS
3299            } else {            } else {
3300              //              //
3301              if ( IsDebug() ) printf(" Repeated pulse1 calo calibration for section %i at time %u obt %u pkt %u \n",section,fromtime,obt,pkt);              if ( IsDebug() ) printf(" Repeated pulse1 calo calibration for section %i at time %u obt %u pkt %u \n",section,fromtime,obt,pkt);
3302                if ( PEDANTIC ) throw -76;
3303              //              //
3304            };                  };      
3305            //                  //      
# Line 3343  Int_t PamelaDBOperations::insertCALOPULS Line 3364  Int_t PamelaDBOperations::insertCALOPULS
3364              if ( row ){              if ( row ){
3365                //                //
3366                if ( IsDebug() ) printf(" Calo pulse2 calibration already inserted in the DB\n");                if ( IsDebug() ) printf(" Calo pulse2 calibration already inserted in the DB\n");
3367                  if ( PEDANTIC ) throw -77;
3368                //                //
3369              } else {              } else {
3370                //                //
# Line 3476  Int_t PamelaDBOperations::insertCALOPULS Line 3498  Int_t PamelaDBOperations::insertCALOPULS
3498            } else {            } else {
3499              //              //
3500              if ( IsDebug() ) printf(" Repeated pulse2 calo calibration for section %i at time %u obt %u pkt %u \n",section,fromtime,obt,pkt);              if ( IsDebug() ) printf(" Repeated pulse2 calo calibration for section %i at time %u obt %u pkt %u \n",section,fromtime,obt,pkt);
3501                if ( PEDANTIC ) throw -78;
3502              //              //
3503            };                  };      
3504            //                  //      
# Line 3536  void PamelaDBOperations::HandleTRK_CALIB Line 3559  void PamelaDBOperations::HandleTRK_CALIB
3559    if ( row ){    if ( row ){
3560      //      //
3561      if ( IsDebug() ) printf(" Trk calibration already inserted in the DB\n");      if ( IsDebug() ) printf(" Trk calibration already inserted in the DB\n");
3562        if ( PEDANTIC ) throw -80;
3563      //      //
3564    } else {    } else {
3565      //      //
# Line 3801  Int_t PamelaDBOperations::insertTRK_CALI Line 3825  Int_t PamelaDBOperations::insertTRK_CALI
3825      } else {      } else {
3826        //        //
3827        if ( IsDebug() ) printf(" Repetead trk calibration1 at time %u obt %u pkt %u \n",fromtime,obt1,pkt1);        if ( IsDebug() ) printf(" Repetead trk calibration1 at time %u obt %u pkt %u \n",fromtime,obt1,pkt1);
3828          if ( PEDANTIC ) throw -79;
3829        //        //
3830      };      };
3831      //          //    
# Line 3899  Int_t PamelaDBOperations::insertS4_CALIB Line 3924  Int_t PamelaDBOperations::insertS4_CALIB
3924        if ( row ){        if ( row ){
3925          //          //
3926          if ( IsDebug() ) printf(" S4 calibration already inserted in the DB\n");          if ( IsDebug() ) printf(" S4 calibration already inserted in the DB\n");
3927            if ( PEDANTIC ) throw -81;
3928          //          //
3929        } else {        } else {
3930          //          //
# Line 3982  Int_t PamelaDBOperations::insertS4_CALIB Line 4008  Int_t PamelaDBOperations::insertS4_CALIB
4008      } else {      } else {
4009        //        //
4010        if ( IsDebug() ) printf(" Repeated S4 calibration at time %u obt %u pkt %u \n",fromtime,obt,pkt);        if ( IsDebug() ) printf(" Repeated S4 calibration at time %u obt %u pkt %u \n",fromtime,obt,pkt);
4011          if ( PEDANTIC ) throw -82;
4012        //        //
4013      };            };      
4014      //            //      
# Line 4118  Int_t PamelaDBOperations::CleanGL_RUN_FR Line 4145  Int_t PamelaDBOperations::CleanGL_RUN_FR
4145          //          //
4146        } else {        } else {
4147          if ( IsDebug() ) printf(" The already exist in the GL_RUN table! \n");          if ( IsDebug() ) printf(" The already exist in the GL_RUN table! \n");
4148            if ( PEDANTIC ) throw -83;
4149        };        };
4150        if ( IsDebug() ) printf(" Delete run %s from the GL_RUN_FRAGMENTS table \n",row->GetField(0));              if ( IsDebug() ) printf(" Delete run %s from the GL_RUN_FRAGMENTS table \n",row->GetField(0));      
4151        //        //
# Line 5195  UInt_t PamelaDBOperations::ValidateTrkCa Line 5223  UInt_t PamelaDBOperations::ValidateTrkCa
5223   *   *
5224   **/   **/
5225  UInt_t PamelaDBOperations::Check(){  UInt_t PamelaDBOperations::Check(){
5226            return(this->Check(0,0));
5227    }
5228    
5229    UInt_t PamelaDBOperations::Check(UInt_t from, UInt_t to){
5230      //
5231            if ( IsDebug() ) printf(" from %u to %u \n",from,to);
5232    //    //
5233    UInt_t test = 0;    UInt_t test = 0;
5234    //    //
# Line 5233  UInt_t PamelaDBOperations::Check(){ Line 5267  UInt_t PamelaDBOperations::Check(){
5267      thisrht = (UInt_t)atoll(row->GetField(2));      thisrht = (UInt_t)atoll(row->GetField(2));
5268      thisrtt = (UInt_t)atoll(row->GetField(3));      thisrtt = (UInt_t)atoll(row->GetField(3));
5269      //      //
5270        if ( from > 0 && nid <= from ) goto ss;
5271        if ( to > 0 && nid >= to ) goto ss;
5272    //
5273      if ( (UInt_t)atoll(row->GetField(4)) > 1 ){      if ( (UInt_t)atoll(row->GetField(4)) > 1 ){
5274        //        //
5275        //        //
# Line 5263  UInt_t PamelaDBOperations::Check(){ Line 5300  UInt_t PamelaDBOperations::Check(){
5300              printf(" CHECK n.4 RUNs %u and %u HAVE SAME RUNHEADER \n",thisid,(UInt_t)atoll(row3->GetField(0)));                printf(" CHECK n.4 RUNs %u and %u HAVE SAME RUNHEADER \n",thisid,(UInt_t)atoll(row3->GetField(0)));  
5301              row3 = result3->Next();              row3 = result3->Next();
5302            };            };
5303    //      delete result3;
5304    
5305          };          };
5306          //          //
5307          oss.str("");          oss.str("");
# Line 5282  UInt_t PamelaDBOperations::Check(){ Line 5321  UInt_t PamelaDBOperations::Check(){
5321              printf(" CHECK n.5 RUNs %u and %u HAVE SAME RUNTRAILER \n",thisid,(UInt_t)atoll(row3->GetField(0)));              printf(" CHECK n.5 RUNs %u and %u HAVE SAME RUNTRAILER \n",thisid,(UInt_t)atoll(row3->GetField(0)));
5322              row3 = result3->Next();              row3 = result3->Next();
5323            };            };
5324    //      delete result3;
5325          };          };
5326          //          //
5327          oss.str("");          oss.str("");
# Line 5301  UInt_t PamelaDBOperations::Check(){ Line 5341  UInt_t PamelaDBOperations::Check(){
5341              printf(" CHECK n.7 RUNs %u and %u HAVE SAME RUNTRAILER AND RUNHEADER (ARE THE SAME?) \n",thisid,(UInt_t)atoll(row3->GetField(0)));              printf(" CHECK n.7 RUNs %u and %u HAVE SAME RUNTRAILER AND RUNHEADER (ARE THE SAME?) \n",thisid,(UInt_t)atoll(row3->GetField(0)));
5342              row3 = result3->Next();              row3 = result3->Next();
5343            };            };
5344     //     delete result3;
5345    
5346          };          };
5347        };        };
5348        //        //
# Line 5320  UInt_t PamelaDBOperations::Check(){ Line 5362  UInt_t PamelaDBOperations::Check(){
5362            printf(" CHECK n.6 RUN %u CONTAINS RUN %u  \n",thisid,(UInt_t)atoll(row3->GetField(0)));            printf(" CHECK n.6 RUN %u CONTAINS RUN %u  \n",thisid,(UInt_t)atoll(row3->GetField(0)));
5363            row3 = result3->Next();            row3 = result3->Next();
5364          };          };
5365    //      delete result3;
5366        };        };
5367        //        //
5368      };      };
# Line 5345  UInt_t PamelaDBOperations::Check(){ Line 5388  UInt_t PamelaDBOperations::Check(){
5388        thisf = (TString)row2->GetField(0);        thisf = (TString)row2->GetField(0);
5389        if ( IsDebug() ) printf(" ==> files %s and %s \n",prevf.Data(),thisf.Data());        if ( IsDebug() ) printf(" ==> files %s and %s \n",prevf.Data(),thisf.Data());
5390        test = 1;        test = 1;
5391    //      delete result2;
5392      };      };
5393      //      //
5394      if ( (thisrtt < prevrht) && (thisrht != prevrht) ){      if ( (thisrtt < prevrht) && (thisrht != prevrht) ){
# Line 5366  UInt_t PamelaDBOperations::Check(){ Line 5410  UInt_t PamelaDBOperations::Check(){
5410        thisf = (TString)row2->GetField(0);        thisf = (TString)row2->GetField(0);
5411        if ( IsDebug() ) printf(" ==> files %s and %s \n",prevf.Data(),thisf.Data());        if ( IsDebug() ) printf(" ==> files %s and %s \n",prevf.Data(),thisf.Data());
5412        test = 1;        test = 1;
5413    //      delete result2;
5414      };      };
5415      //      //
5416      if ( (thisrht > thisrtt) && (thisrht != prevrht) ){      if ( (thisrht > thisrtt) && (thisrht != prevrht) ){
# Line 5387  UInt_t PamelaDBOperations::Check(){ Line 5432  UInt_t PamelaDBOperations::Check(){
5432        thisf = (TString)row2->GetField(0);        thisf = (TString)row2->GetField(0);
5433        if ( IsDebug() ) printf(" ==> files %s and %s \n",prevf.Data(),thisf.Data());        if ( IsDebug() ) printf(" ==> files %s and %s \n",prevf.Data(),thisf.Data());
5434        test = 1;        test = 1;
5435    //      delete result2;
5436      };      };
5437    ss:
5438      //      //
5439      prevrht = thisrht;      prevrht = thisrht;
5440      prevrtt = thisrtt;      prevrtt = thisrtt;
5441      previd = thisid;      previd = thisid;
5442      prevl0id = thisl0id;      prevl0id = thisl0id;
5443      row = result->Next();      row = result->Next();
5444    //    if ( result2 ) delete result2;
5445    //    if ( result3 ) delete result3;
5446    };    };
5447    //    //
5448    return(test);    return(test);

Legend:
Removed from v.1.53  
changed lines
  Added in v.1.56

  ViewVC Help
Powered by ViewVC 1.1.23