/[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.23 by mocchiut, Tue Jan 13 13:38:15 2009 UTC revision 1.28 by mocchiut, Mon Dec 14 13:20:37 2009 UTC
# Line 185  void PamelaDBOperations::OpenL0File(TStr Line 185  void PamelaDBOperations::OpenL0File(TStr
185            if ( !chboot ){            if ( !chboot ){
186              qu.str("");              qu.str("");
187              //      qu << "SELECT BOOT_NUMBER from ROOT_TABLE where BOOT_NUMBER!=0 AND ABS(LAST_TIME_SYNC_INFO-"<< chlastts <<")<10000 AND ABS(REAL_TIME_INIT-"<< row2->GetField(10) <<")<7200 group by BOOT_NUMBER order by BOOT_NUMBER asc;";              //      qu << "SELECT BOOT_NUMBER from ROOT_TABLE where BOOT_NUMBER!=0 AND ABS(LAST_TIME_SYNC_INFO-"<< chlastts <<")<10000 AND ABS(REAL_TIME_INIT-"<< row2->GetField(10) <<")<7200 group by BOOT_NUMBER order by BOOT_NUMBER asc;";
188              qu << "SELECT BOOT_NUMBER from ROOT_TABLE where BOOT_NUMBER!=0 AND ABS(LAST_TIME_SYNC_INFO-"<< chlastts <<")<40000 AND ABS(REAL_TIME_INIT-"<< row2->GetField(10) <<")<40000 group by BOOT_NUMBER order by BOOT_NUMBER asc;"; // relax conditions... 090112 [8RED: error -29]              //      qu << "SELECT BOOT_NUMBER from ROOT_TABLE where BOOT_NUMBER!=0 AND ABS(LAST_TIME_SYNC_INFO-"<< chlastts <<")<40000 AND ABS(REAL_TIME_INIT-"<< row2->GetField(10) <<")<40000 group by BOOT_NUMBER order by BOOT_NUMBER asc;"; // relax conditions... 090112 [8RED: error -29]
189                qu << "SELECT BOOT_NUMBER from ROOT_TABLE where BOOT_NUMBER!=0 AND ABS(LAST_TIME_SYNC_INFO-"<< chlastts <<")<50000 AND ABS(REAL_TIME_INIT-"<< row2->GetField(10) <<")<50000 group by BOOT_NUMBER order by BOOT_NUMBER asc;"; // even more relaxed conditions... 091214 [9REDtest3: error -29]
190              if ( debug ) printf(" chewbacca: query is %s \n",qu.str().c_str());              if ( debug ) printf(" chewbacca: query is %s \n",qu.str().c_str());
191              result3 = conn->Query(qu.str().c_str());              result3 = conn->Query(qu.str().c_str());
192              if ( result3 ){              if ( result3 ){
# Line 427  void PamelaDBOperations::SetOrbitNo(UInt Line 428  void PamelaDBOperations::SetOrbitNo(UInt
428        if ( IsDebug() ) printf(" Agh problems determining the orbit number! name = %s \n",name.Data());        if ( IsDebug() ) printf(" Agh problems determining the orbit number! name = %s \n",name.Data());
429        return;        return;
430      };      };
431      TString dwo = 0;      TString dwo = "";
432      for (Int_t i = 0; i<5; i++){      for (Int_t i = 0; i<5; i++){
433        dwo.Append(name[i],1);        dwo.Append(name[i],1);
434      };      };
# Line 857  Int_t PamelaDBOperations::SetUpperLimits Line 858  Int_t PamelaDBOperations::SetUpperLimits
858    //  if ( nevent < jump ) jump = int(nevent/10);    //  if ( nevent < jump ) jump = int(nevent/10);
859    //  if ( !jump ) jump = 1;    //  if ( !jump ) jump = 1;
860    //    //
861    if ( (PKT(pktlast) < PKT(pktfirst) && OBT(obtlast) < OBT(obtfirst)) || (labs(PKT(pktlast)-PKT(pktfirst))<deltapkt && labs(OBT(obtlast)-OBT(obtfirst))<deltaobt) && nevent > deltapkt ){  
862      if ( ((PKT(pktlast) < PKT(pktfirst) && OBT(obtlast) < OBT(obtfirst)) || (labs(PKT(pktlast)-PKT(pktfirst))<deltapkt && labs(OBT(obtlast)-OBT(obtfirst))<deltaobt)) && nevent > deltapkt ){
863      //      //
864      if ( IsDebug() ) printf(" starting jump %i \n",jump);      if ( IsDebug() ) printf(" starting jump %i \n",jump);
865      //    if ( IsDebug() ) printf(" (PKT(pktlast) < PKT(pktfirst) && OBT(obtlast) > OBT(obtfirst)) %llu < %llu && %llu > %llu \n     OR \n     (PKT(pktlast) > PKT(pktfirst) && OBT(obtlast) < OBT(obtfirst)) %llu > %llu && %llu < %llu \n",PKT(pktlast),PKT(pktfirst),OBT(obtlast),OBT(obtfirst),PKT(pktlast),PKT(pktfirst),OBT(obtlast),OBT(obtfirst));      //    if ( IsDebug() ) printf(" (PKT(pktlast) < PKT(pktfirst) && OBT(obtlast) > OBT(obtfirst)) %llu < %llu && %llu > %llu \n     OR \n     (PKT(pktlast) > PKT(pktfirst) && OBT(obtlast) < OBT(obtfirst)) %llu > %llu && %llu < %llu \n",PKT(pktlast),PKT(pktfirst),OBT(obtlast),OBT(obtfirst),PKT(pktlast),PKT(pktfirst),OBT(obtlast),OBT(obtfirst));
# Line 4235  Int_t PamelaDBOperations::insertCALO_CAL Line 4237  Int_t PamelaDBOperations::insertCALO_CAL
4237    UInt_t totime = 0;    UInt_t totime = 0;
4238    UInt_t obt = 0;    UInt_t obt = 0;
4239    UInt_t pkt = 0;    UInt_t pkt = 0;
4240      Float_t totped = 0.;
4241    //    //
4242    tr = (TTree*)file->Get("CalibCalPed");    tr = (TTree*)file->Get("CalibCalPed");
4243    if ( !tr || tr->IsZombie() ) throw -21;    if ( !tr || tr->IsZombie() ) throw -21;
# Line 4252  Int_t PamelaDBOperations::insertCALO_CAL Line 4255  Int_t PamelaDBOperations::insertCALO_CAL
4255        if ( calibCalPed->cstwerr[section] ){        if ( calibCalPed->cstwerr[section] ){
4256          valid = 1;          valid = 1;
4257          if ( calibCalPed->cperror[section] ) valid = 0;          if ( calibCalPed->cperror[section] ) valid = 0;
4258            //
4259            // check pedestal values for one plane, if all zeros calibration is not valid (calorimeter power problems) [8th data reduction bug, fixed on 25/11/2009 by E.M.]
4260            //
4261            totped = 0.;
4262            Int_t ns = 0;
4263            if ( section == 2 ) ns = 3;
4264            if ( section == 3 ) ns = 1;
4265            if ( section == 1 ) ns = 2;
4266            for (UInt_t ss=0; ss<96; ss++){
4267              totped += fabs(calibCalPed->calped[ns][0][ss]);
4268            }
4269            if ( totped < 1. ){
4270              if ( IsDebug() ) printf(" Section %i totped %f -  No calibration data! Calorimeter power problems? \n",section,totped);
4271              valid = 0;
4272            };
4273            //
4274          ph = eh->GetPscuHeader();          ph = eh->GetPscuHeader();
4275          obt = ph->GetOrbitalTime();            obt = ph->GetOrbitalTime();  
4276          pkt = ph->GetCounter();            pkt = ph->GetCounter();  
# Line 4419  Int_t PamelaDBOperations::insertCALOPULS Line 4438  Int_t PamelaDBOperations::insertCALOPULS
4438    tr->SetBranchAddress("Header", &eh);    tr->SetBranchAddress("Header", &eh);
4439    nevents = tr->GetEntries();    nevents = tr->GetEntries();
4440    //    //
4441      Float_t totpul = 0.;
4442      //
4443    if ( nevents > 0 ){    if ( nevents > 0 ){
4444      //      //
4445      for (UInt_t i=0; i < nevents; i++){      for (UInt_t i=0; i < nevents; i++){
# Line 4428  Int_t PamelaDBOperations::insertCALOPULS Line 4449  Int_t PamelaDBOperations::insertCALOPULS
4449          if ( cp1->pstwerr[section] && cp1->unpackError == 0 ){          if ( cp1->pstwerr[section] && cp1->unpackError == 0 ){
4450            valid = 1;            valid = 1;
4451            if ( cp1->pperror[section] ) valid = 0;            if ( cp1->pperror[section] ) valid = 0;
4452              //
4453              // check pulse values for one plane, if all zeros calibration is not valid (calorimeter power problems) [8th data reduction bug, fixed on 25/11/2009 by E.M.]
4454              //
4455              totpul = 0.;
4456              Int_t ns = 0;
4457              if ( section == 2 ) ns = 3;
4458              if ( section == 3 ) ns = 1;
4459              if ( section == 1 ) ns = 2;
4460              for (UInt_t ss=0; ss<96; ss++){
4461                totpul += cp1->calpuls[ns][0][ss];
4462              }
4463              if ( totpul >= 3145632. ){
4464                if ( IsDebug() ) printf(" PULSE1 Section %i totpul %f -  No calibration data! Calorimeter power problems? \n",section,totpul);
4465                valid = 0;
4466              };
4467              //
4468            ph = eh->GetPscuHeader();            ph = eh->GetPscuHeader();
4469            obt = ph->GetOrbitalTime();              obt = ph->GetOrbitalTime();  
4470            pkt = ph->GetCounter();              pkt = ph->GetCounter();  
# Line 4585  Int_t PamelaDBOperations::insertCALOPULS Line 4622  Int_t PamelaDBOperations::insertCALOPULS
4622          if ( cp2->pstwerr[section] && cp2->unpackError == 0 ){          if ( cp2->pstwerr[section] && cp2->unpackError == 0 ){
4623            valid = 1;            valid = 1;
4624            if ( cp2->pperror[section] ) valid = 0;            if ( cp2->pperror[section] ) valid = 0;
4625              //
4626              // check pulse values for one plane, if all zeros calibration is not valid (calorimeter power problems) [8th data reduction bug, fixed on 25/11/2009 by E.M.]
4627              //
4628              totpul = 0.;
4629              Int_t ns = 0;
4630              if ( section == 2 ) ns = 3;
4631              if ( section == 3 ) ns = 1;
4632              if ( section == 1 ) ns = 2;
4633              for (UInt_t ss=0; ss<96; ss++){
4634                totpul += cp2->calpuls[ns][0][ss];
4635              }
4636              if ( totpul >= 3145632. ){
4637                if ( IsDebug() ) printf(" PULSE2 Section %i totpul %f -  No calibration data! Calorimeter power problems? \n",section,totpul);
4638                valid = 0;
4639              };
4640              //
4641            ph = eh->GetPscuHeader();            ph = eh->GetPscuHeader();
4642            obt = ph->GetOrbitalTime();              obt = ph->GetOrbitalTime();  
4643            pkt = ph->GetCounter();              pkt = ph->GetCounter();  

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

  ViewVC Help
Powered by ViewVC 1.1.23