/[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.26 by mocchiut, Wed Nov 25 09:39:50 2009 UTC revision 1.29 by mocchiut, Wed Dec 23 07:19:32 2009 UTC
# Line 183  void PamelaDBOperations::OpenL0File(TStr Line 183  void PamelaDBOperations::OpenL0File(TStr
183            chboot = (UInt_t)atoll(row2->GetField(5));            chboot = (UInt_t)atoll(row2->GetField(5));
184            //            //
185            if ( !chboot ){            if ( !chboot ){
186                if ( debug ) printf(" mmm... no BOOT number determined by chewbacca, try to find it looking at DB \n");
187                //
188                // new feature: check in ROOT_TABLE (timewise) the previous and the next BOOT number != 0 , if it is the same we know this one!
189                // if it is different roll back to the old behaviour
190                //
191              qu.str("");              qu.str("");
192              //      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 REAL_TIME_INIT>"<< row2->GetField(10) <<" order by REAL_TIME_INIT asc limit 1;";
             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]  
193              if ( debug ) printf(" chewbacca: query is %s \n",qu.str().c_str());              if ( debug ) printf(" chewbacca: query is %s \n",qu.str().c_str());
194                UInt_t chbootA = 0;
195                UInt_t chbootB = 1;
196              result3 = conn->Query(qu.str().c_str());              result3 = conn->Query(qu.str().c_str());
197              if ( result3 ){              if ( result3 ){
198                row3 = result3->Next();                row3 = result3->Next();
199                if ( row3 && result3->GetRowCount() == 1 ){                if ( row3 ){
200                  chboot = (UInt_t)atoll(row3->GetField(0));                  chbootA = (UInt_t)atoll(row3->GetField(0));
201                  if ( debug ) printf(" Found boot_number = %u \n",chboot);                  if ( debug ) printf(" Found boot_number A = %u \n",chbootA);
202                } else {                };
203                  if ( debug ) printf(" AGH CANNOT DETERMINE THE BOOT NUMBER... \n");              };
204                  throw -29;              delete result3;
205                qu.str("");
206                qu << "SELECT BOOT_NUMBER from ROOT_TABLE where BOOT_NUMBER!=0 AND REAL_TIME_INIT<"<< row2->GetField(10) <<" order by REAL_TIME_INIT desc limit 1;";
207                if ( debug ) printf(" chewbacca: query is %s \n",qu.str().c_str());
208                result3 = conn->Query(qu.str().c_str());
209                if ( result3 ){
210                  row3 = result3->Next();
211                  if ( row3 ){
212                    chbootB = (UInt_t)atoll(row3->GetField(0));
213                    if ( debug ) printf(" Found boot_number B = %u \n",chbootB);
214                  };
215                };
216                if ( chbootA == chbootB ){
217                  chboot = chbootA;
218                  if ( debug ) printf(" Found boot_number! it is %u \n",chboot);
219                } else {        
220                  qu.str("");
221                  //            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;";
222                  //            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]
223                  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]
224                  if ( debug ) printf(" chewbacca: query is %s \n",qu.str().c_str());
225                  result3 = conn->Query(qu.str().c_str());
226                  if ( result3 ){
227                    row3 = result3->Next();
228                    if ( row3 && result3->GetRowCount() == 1 ){
229                      chboot = (UInt_t)atoll(row3->GetField(0));
230                      if ( debug ) printf(" Found boot_number = %u \n",chboot);
231                    } else {
232                      if ( debug ) printf(" AGH CANNOT DETERMINE THE BOOT NUMBER... \n");
233                      throw -29;
234                    };
235                };                };
236              };              };
237            };            };
# Line 4258  Int_t PamelaDBOperations::insertCALO_CAL Line 4294  Int_t PamelaDBOperations::insertCALO_CAL
4294          // 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.]          // 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.]
4295          //          //
4296          totped = 0.;          totped = 0.;
4297            Int_t ns = 0;
4298            if ( section == 2 ) ns = 3;
4299            if ( section == 3 ) ns = 1;
4300            if ( section == 1 ) ns = 2;
4301          for (UInt_t ss=0; ss<96; ss++){          for (UInt_t ss=0; ss<96; ss++){
4302            totped += calibCalPed->calped[section][0][ss];            totped += fabs(calibCalPed->calped[ns][0][ss]);
4303          }          }
4304          if ( totped < 1. ){          if ( totped < 1. ){
4305            if ( IsDebug() ) printf(" Section %i totped %f -  No calibration data! Calorimeter power problems? \n",section,totped);            if ( IsDebug() ) printf(" Section %i totped %f -  No calibration data! Calorimeter power problems? \n",section,totped);
# Line 4448  Int_t PamelaDBOperations::insertCALOPULS Line 4488  Int_t PamelaDBOperations::insertCALOPULS
4488            // 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.]            // 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.]
4489            //            //
4490            totpul = 0.;            totpul = 0.;
4491              Int_t ns = 0;
4492              if ( section == 2 ) ns = 3;
4493              if ( section == 3 ) ns = 1;
4494              if ( section == 1 ) ns = 2;
4495            for (UInt_t ss=0; ss<96; ss++){            for (UInt_t ss=0; ss<96; ss++){
4496              totpul += cp1->calpuls[section][0][ss];              totpul += cp1->calpuls[ns][0][ss];
4497            }            }
4498            if ( totpul >= 3145632. ){            if ( totpul >= 3145632. ){
4499              if ( IsDebug() ) printf(" PULSE1 Section %i totpul %f -  No calibration data! Calorimeter power problems? \n",section,totpul);              if ( IsDebug() ) printf(" PULSE1 Section %i totpul %f -  No calibration data! Calorimeter power problems? \n",section,totpul);
# Line 4617  Int_t PamelaDBOperations::insertCALOPULS Line 4661  Int_t PamelaDBOperations::insertCALOPULS
4661            // 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.]            // 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.]
4662            //            //
4663            totpul = 0.;            totpul = 0.;
4664              Int_t ns = 0;
4665              if ( section == 2 ) ns = 3;
4666              if ( section == 3 ) ns = 1;
4667              if ( section == 1 ) ns = 2;
4668            for (UInt_t ss=0; ss<96; ss++){            for (UInt_t ss=0; ss<96; ss++){
4669              totpul += cp2->calpuls[section][0][ss];              totpul += cp2->calpuls[ns][0][ss];
4670            }            }
4671            if ( totpul >= 3145632. ){            if ( totpul >= 3145632. ){
4672              if ( IsDebug() ) printf(" PULSE2 Section %i totpul %f -  No calibration data! Calorimeter power problems? \n",section,totpul);              if ( IsDebug() ) printf(" PULSE2 Section %i totpul %f -  No calibration data! Calorimeter power problems? \n",section,totpul);

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.29

  ViewVC Help
Powered by ViewVC 1.1.23