/[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.33 by mocchiut, Mon Apr 30 08:31:28 2007 UTC revision 1.38 by mocchiut, Mon Apr 30 10:22:45 2007 UTC
# Line 400  Int_t PamelaDBOperations::SetUpperLimits Line 400  Int_t PamelaDBOperations::SetUpperLimits
400    upperobt = OBT(obtlast);    upperobt = OBT(obtlast);
401    upperentry = nevent-1;    upperentry = nevent-1;
402    //    //
403    if ( IsDebug() ) printf(" First entries are: OBT %i pkt_num %i \n",obtfirst,pktfirst);    if ( IsDebug() ) printf(" First entries are: OBT %u pkt_num %u \n",obtfirst,pktfirst);
404    //    //
405    if ( IsDebug() ) printf(" Last entries are: OBT %lld pkt_num %lld entry %i\n",upperobt,upperpkt,upperentry);    if ( IsDebug() ) printf(" Last entries are: OBT %lld pkt_num %lld entry %i\n",upperobt,upperpkt,upperentry);
406    //    //
407    if ( (PKT(pktlast) < PKT(pktfirst) && OBT(obtlast) > OBT(obtfirst)) || (PKT(pktlast) > PKT(pktfirst) && OBT(obtlast) < OBT(obtfirst)) ) return(1);    if ( (PKT(pktlast) < PKT(pktfirst) && OBT(obtlast) > OBT(obtfirst)) || (PKT(pktlast) > PKT(pktfirst) && OBT(obtlast) < OBT(obtfirst)) ) return(32);
408    //    //
409    if ( !nevent ) return(2);    if ( !nevent ) return(64);
410    //    //
411    if ( nevent < 2 ) return(4);    if ( nevent < 2 ) return(128);
412    if ( nevent < jump ) jump = 1;    if ( nevent < jump ) jump = 1;
413    //  if ( nevent < jump ) jump = int(nevent/10);    //  if ( nevent < jump ) jump = int(nevent/10);
414    //  if ( !jump ) jump = 1;    //  if ( !jump ) jump = 1;
# Line 447  Int_t PamelaDBOperations::SetUpperLimits Line 447  Int_t PamelaDBOperations::SetUpperLimits
447          if ( t_pktlast < upperpkt && t_obtlast < upperobt && t_pktlast < upperpkt2 && t_obtlast < upperobt2 ){          if ( t_pktlast < upperpkt && t_obtlast < upperobt && t_pktlast < upperpkt2 && t_obtlast < upperobt2 ){
448            zomp = i + jump + 1;            zomp = i + jump + 1;
449            if ( zomp > nevent-2 ) zomp = nevent - 2;            if ( zomp > nevent-2 ) zomp = nevent - 2;
450            if ( IsDebug() ) printf(" .-. jump %i zomp %i upperpkt %lld pktlast %i upperobt %lld obtlast %u last entry is %i \n",jump,zomp,upperpkt,pktlast,upperobt,obtlast,i);            if ( IsDebug() ) printf(" .-. jump %i zomp %i upperpkt %lld pktlast %u upperobt %lld obtlast %u last entry is %i \n",jump,zomp,upperpkt,pktlast,upperobt,obtlast,i);
451            break;            break;
452          };          };
453          //          //
# Line 1035  Int_t PamelaDBOperations::insertPamelaGL Line 1035  Int_t PamelaDBOperations::insertPamelaGL
1035    TSQLResult *result = 0;    TSQLResult *result = 0;
1036    TSQLRow *row = 0;    TSQLRow *row = 0;
1037    UInt_t t0 = 0;    UInt_t t0 = 0;
1038      Int_t signal = 0;
1039      //
1040      signal = this->SetUpperLimits();
1041    //    //
1042    stringstream   oss;    stringstream   oss;
1043    //      //  
# Line 1087  Int_t PamelaDBOperations::insertPamelaGL Line 1090  Int_t PamelaDBOperations::insertPamelaGL
1090    };    };
1091    //    //
1092    TTree *T = 0;    TTree *T = 0;
   Int_t signal = 0;  
1093    //    //
1094    UInt_t nevent = 0;    UInt_t nevent = 0;
1095    UInt_t recEntries = 0;    UInt_t recEntries = 0;
# Line 1496  Int_t PamelaDBOperations::insertPamelaRU Line 1498  Int_t PamelaDBOperations::insertPamelaRU
1498    stringstream oss;    stringstream oss;
1499    oss.str("");    oss.str("");
1500    //    //
1501    signal = this->SetUpperLimits();    //  signal = this->SetUpperLimits();
1502    //    //
1503    // loop on runheader and runtrailer events    // loop on runheader and runtrailer events
1504    //    //
# Line 1547  Int_t PamelaDBOperations::insertPamelaRU Line 1549  Int_t PamelaDBOperations::insertPamelaRU
1549        //        //
1550        if ( !ptt &&  !(ptht+1) ){        if ( !ptt &&  !(ptht+1) ){
1551          //          //
1552          if ( IsDebug() ) printf(" Piece of run at the beginning of the file %i %i %i \n",ptht,pth,ptt);          if ( IsDebug() ) printf(" Piece of run at the beginning of the file %u %u %u \n",ptht,pth,ptt);
1553          //          //
1554          this->HandleRunFragments(true,false,0,(evbeft-1));          this->HandleRunFragments(true,false,0,(evbeft-1));
1555          //          //
1556          //          //
1557        } else if ( pth == ptht ){        } else if ( pth == ptht ){
1558          //          //
1559          if ( IsDebug() ) printf(" Missing header %i %i %i\n",ptht,pth,ptt);          if ( IsDebug() ) printf(" Missing header %u %u %u\n",ptht,pth,ptt);
1560          //          //
1561          if ( (ptt-1) < 0 ) throw -15; // should never arrive here!          if ( (ptt-1) < 0 ) throw -15; // should never arrive here!
1562          rt->GetEntry(ptt-1);          rt->GetEntry(ptt-1);
# Line 1563  Int_t PamelaDBOperations::insertPamelaRU Line 1565  Int_t PamelaDBOperations::insertPamelaRU
1565          rt->GetEntry(ptt);          rt->GetEntry(ptt);
1566          pht = eht->GetPscuHeader();          pht = eht->GetPscuHeader();
1567          //          //
1568          if ( IsDebug() ) printf(" Try to find the beginning of a run which has only the runtrailer   %i %i %i \n",ptht,pth,ptt);          if ( IsDebug() ) printf(" Try to find the beginning of a run which has only the runtrailer   %u %u %u \n",ptht,pth,ptt);
1569          if ( IsDebug() ) printf(" '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''  %i %i %i \n",pkth,obth,obtt);          if ( IsDebug() ) printf(" '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''  %u %u %u \n",pkth,obth,obtt);
1570          //          //
1571          this->HandleMissingHoT(true,false,evbefh,evbeft-1);          this->HandleMissingHoT(true,false,evbefh,evbeft-1);
1572          //          //
1573        } else {        } else {
1574          //          //
1575          if ( IsDebug() ) printf(" Could be a good run, we have a runheader followed by a runtrailer %i %i %i\n",ptht,pth,ptt);          if ( IsDebug() ) printf(" Could be a good run, we have a runheader followed by a runtrailer %u %u %u\n",ptht,pth,ptt);
1576          //          //
1577          rh->GetEntry(ptht);          rh->GetEntry(ptht);
1578          phh = ehh->GetPscuHeader();          phh = ehh->GetPscuHeader();
# Line 1578  Int_t PamelaDBOperations::insertPamelaRU Line 1580  Int_t PamelaDBOperations::insertPamelaRU
1580          obth = phh->GetOrbitalTime();          obth = phh->GetOrbitalTime();
1581          cod = ehh->GetCounter();          cod = ehh->GetCounter();
1582          evbefh = cod->Get(pctp->Physics);          evbefh = cod->Get(pctp->Physics);
1583          if ( IsDebug() ) printf(" ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' %i %i %i \n",pkth,obth,obtt);          if ( IsDebug() ) printf(" ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' %u %u %u \n",pkth,obth,obtt);
1584          //          //
1585          // handle this run          // handle this run
1586          //          //
# Line 1590  Int_t PamelaDBOperations::insertPamelaRU Line 1592  Int_t PamelaDBOperations::insertPamelaRU
1592            //            //
1593            if ( IsDebug() ) printf(" Piece of run at the beginning of the file WITH NO RUNTRAILER \n");            if ( IsDebug() ) printf(" Piece of run at the beginning of the file WITH NO RUNTRAILER \n");
1594            //            //
1595            this->HandleRunFragments(true,true,0,(evbefh-1));            if ( (evbefh-1) == 1999 ) {
1596            //              //
1597                signal = 8;
1598                if ( IsDebug() ) printf(" Not supported yet: run with no events, no runtrailer, no runheader \n");
1599                //
1600              } else {
1601                //
1602                //      this->HandleRunFragments(true,true,0,(evbefh-1));
1603                this->HandleRunFragments(true,true,-1,(evbefh-1));
1604                //
1605              };
1606          };          };
1607          //          //
1608          //          //
1609          if ( (ptht - pth) > 1 ){          if ( (ptht - pth) > 1 ){
1610            //            //
1611            if ( IsDebug() ) printf(" Missing runtrailers! \n");            if ( IsDebug() ) printf(" Missing runtrailers! \n");
1612            if ( IsDebug() ) printf(" Attention there is a jump in the runheader counter %i %i %i \n",ptht,pth,ptt);            if ( IsDebug() ) printf(" Attention there is a jump in the runheader counter %u %u %u \n",ptht,pth,ptt);
1613            // is not the consecutive header            // is not the consecutive header
1614            while ( pth != ptht ){                      while ( pth != ptht ){          
1615              //              //
# Line 1619  Int_t PamelaDBOperations::insertPamelaRU Line 1630  Int_t PamelaDBOperations::insertPamelaRU
1630              obth = phh->GetOrbitalTime();              obth = phh->GetOrbitalTime();
1631              evbefh = cod->Get(pctp->Physics);              evbefh = cod->Get(pctp->Physics);
1632              //              //
1633              if ( IsDebug() ) printf(" Try to find the end of a run which has only the runheader   %i %i %i \n",ptht,pth,ptt);              if ( IsDebug() ) printf(" Try to find the end of a run which has only the runheader   %u %u %u \n",ptht,pth,ptt);
1634              if ( IsDebug() ) printf(" ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' %i %i %i \n",pkth,obth,obtt);              if ( IsDebug() ) printf(" ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' %u %u %u \n",pkth,obth,obtt);
1635              //              //
1636              this->HandleMissingHoT(false,true,evbefh,evbeft-1);              this->HandleMissingHoT(false,true,evbefh,evbeft-1);
1637              //              //
# Line 1629  Int_t PamelaDBOperations::insertPamelaRU Line 1640  Int_t PamelaDBOperations::insertPamelaRU
1640          } else if ( !(ptht - pth) ){          } else if ( !(ptht - pth) ){
1641            //            //
1642            if ( IsDebug() ) printf(" Missing runheader! \n");            if ( IsDebug() ) printf(" Missing runheader! \n");
1643            if ( IsDebug() ) printf(" Attention! the runheader counter did not changed %i %i %i \n",ptht,pth,ptt);            if ( IsDebug() ) printf(" Attention! the runheader counter did not changed %u %u %u \n",ptht,pth,ptt);
1644            if ( IsDebug() ) printf(" The run should have already been handled by HandleRun() \n");            if ( IsDebug() ) printf(" The run should have already been handled by HandleRun() \n");
1645            //            //
1646          } else {          } else {
# Line 1650  Int_t PamelaDBOperations::insertPamelaRU Line 1661  Int_t PamelaDBOperations::insertPamelaRU
1661            obth = phh->GetOrbitalTime();            obth = phh->GetOrbitalTime();
1662            cod = ehh->GetCounter();            cod = ehh->GetCounter();
1663            evbefh = cod->Get(pctp->Physics);            evbefh = cod->Get(pctp->Physics);
1664            if ( IsDebug() ) printf(" Piece of run at the end of file %i %i %i \n",pkth,obth,obtt);            if ( IsDebug() ) printf(" Piece of run at the end of file %u %u %u \n",pkth,obth,obtt);
1665            if ( IsDebug() ) printf(" ''''''''''''''''''''''''''''''' %i %i %i \n",ptht,pth,ptt);            if ( IsDebug() ) printf(" ''''''''''''''''''''''''''''''' %u %u %u \n",ptht,pth,ptt);
1666            if ( IsDebug() ) printf(" ''''''''''''''''''''''''''''''' %i \n",rhev);            if ( IsDebug() ) printf(" ''''''''''''''''''''''''''''''' %u \n",rhev);
1667            //            //
1668            this->HandleRunFragments(false,true,evbefh,upperentry);            this->HandleRunFragments(false,true,evbefh,upperentry);
1669          } else {          } else {
# Line 2052  void PamelaDBOperations::HandleRunFragme Line 2063  void PamelaDBOperations::HandleRunFragme
2063        ULong64_t aobt = OBT(glrun1->GetRUNTRAILER_OBT());        ULong64_t aobt = OBT(glrun1->GetRUNTRAILER_OBT());
2064        UInt_t bpkt = PKT(glrun->GetRUNHEADER_PKT());        UInt_t bpkt = PKT(glrun->GetRUNHEADER_PKT());
2065        ULong64_t bobt = OBT(glrun->GetRUNHEADER_OBT());        ULong64_t bobt = OBT(glrun->GetRUNHEADER_OBT());
2066        if ( IsDebug() ) printf(" Check overlapping events: %i %i %llu %llu firstev is %i\n",apkt,bpkt,aobt,bobt,firstev);        if ( IsDebug() ) printf(" Check overlapping events: %u %u %llu %llu firstev is %i\n",apkt,bpkt,aobt,bobt,firstev);
2067        TTree *T= 0;        TTree *T= 0;
2068        T = (TTree*)file->Get("Physics");        T = (TTree*)file->Get("Physics");
2069        if ( !T || T->IsZombie() ) throw -16;        if ( !T || T->IsZombie() ) throw -16;
# Line 2066  void PamelaDBOperations::HandleRunFragme Line 2077  void PamelaDBOperations::HandleRunFragme
2077          bobt = OBT(ph->GetOrbitalTime());                bobt = OBT(ph->GetOrbitalTime());      
2078          firstev++;          firstev++;
2079        };        };
2080        if ( IsDebug() ) printf(" Check overlapping events done: %i %i %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);
2081        //        //
2082        glrun1->SetPKT_COUNTER(glrun->GetPKT_COUNTER());        glrun1->SetPKT_COUNTER(glrun->GetPKT_COUNTER());
2083        glrun1->SetPKT_READY_COUNTER(glrun->GetPKT_READY_COUNTER());        glrun1->SetPKT_READY_COUNTER(glrun->GetPKT_READY_COUNTER());
# Line 2249  void PamelaDBOperations::HandleRunFragme Line 2260  void PamelaDBOperations::HandleRunFragme
2260        ULong64_t aobt = OBT(glrun->GetRUNTRAILER_OBT());        ULong64_t aobt = OBT(glrun->GetRUNTRAILER_OBT());
2261        UInt_t bpkt = PKT(glrun1->GetRUNHEADER_PKT());        UInt_t bpkt = PKT(glrun1->GetRUNHEADER_PKT());
2262        ULong64_t bobt = OBT(glrun1->GetRUNHEADER_OBT());        ULong64_t bobt = OBT(glrun1->GetRUNHEADER_OBT());
2263        if ( IsDebug() ) printf(" Check overlapping events: %i %i %llu %llu lastev is %i\n",apkt,bpkt,aobt,bobt,lastev);        if ( IsDebug() ) printf(" Check overlapping events: %u %u %llu %llu lastev is %i\n",apkt,bpkt,aobt,bobt,lastev);
2264        TTree *T= 0;        TTree *T= 0;
2265        T = (TTree*)file->Get("Physics");        T = (TTree*)file->Get("Physics");
2266        if ( !T || T->IsZombie() ) throw -16;        if ( !T || T->IsZombie() ) throw -16;
# Line 2263  void PamelaDBOperations::HandleRunFragme Line 2274  void PamelaDBOperations::HandleRunFragme
2274          aobt = OBT(ph->GetOrbitalTime());                aobt = OBT(ph->GetOrbitalTime());      
2275          lastev--;          lastev--;
2276        };        };
2277        if ( IsDebug() ) printf(" Check overlapping events done: %i %i %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);
2278        //        //
2279        glrun->SetEV_TO(lastev);        glrun->SetEV_TO(lastev);
2280        glrun->SetNEVENTS(lastev-firstev+1);        glrun->SetNEVENTS(lastev-firstev+1);
# Line 2870  Int_t PamelaDBOperations::insertCALO_CAL Line 2881  Int_t PamelaDBOperations::insertCALO_CAL
2881          fromtime = this->GetAbsTime(ph->GetOrbitalTime());            fromtime = this->GetAbsTime(ph->GetOrbitalTime());  
2882          if ( this->PKT(pkt) >= this->PKT(pktfirst) && this->OBT(obt) >= this->OBT(obtfirst) ){          if ( this->PKT(pkt) >= this->PKT(pktfirst) && this->OBT(obt) >= this->OBT(obtfirst) ){
2883            //            //
2884            if ( IsDebug() ) printf(" Calo calibration for section %i at time %i obt %i pkt %i \n",section,fromtime,obt,pkt);            if ( IsDebug() ) printf(" Calo calibration for section %i at time %u obt %u pkt %u \n",section,fromtime,obt,pkt);
2885            //            //
2886            // check if the calibration has already been inserted            // check if the calibration has already been inserted
2887            //            //
# Line 2915  Int_t PamelaDBOperations::insertCALO_CAL Line 2926  Int_t PamelaDBOperations::insertCALO_CAL
2926                //                //
2927                if ( IsDebug() ) printf(" Calibration with fromtime lower than others to be inserted in the DB for section %i \n",section);                if ( IsDebug() ) printf(" Calibration with fromtime lower than others to be inserted in the DB for section %i \n",section);
2928                if ( fromtime < 1150871000 ){ //1150866904                if ( fromtime < 1150871000 ){ //1150866904
2929                  if ( IsDebug() ) printf(" First PAMELA flight calibration at time %i \n",fromtime);                  if ( IsDebug() ) printf(" First PAMELA flight calibration at time %u \n",fromtime);
2930                  fromtime = 0;// the first flight calibration was taken at about  1156429100 s, this line allow to analyze first runs in raw mode                  fromtime = 0;// the first flight calibration was taken at about  1156429100 s, this line allow to analyze first runs in raw mode
2931                };                };
2932                //                //
# Line 2977  Int_t PamelaDBOperations::insertCALO_CAL Line 2988  Int_t PamelaDBOperations::insertCALO_CAL
2988            //            //
2989          } else {          } else {
2990            //            //
2991            if ( IsDebug() ) printf(" Repeated calo calibration for section %i at time %i obt %i pkt %i \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);
2992            //            //
2993          };                };      
2994          //                //      
# Line 3195  Int_t PamelaDBOperations::insertTRK_CALI Line 3206  Int_t PamelaDBOperations::insertTRK_CALI
3206      //      //
3207      if ( this->PKT(pkt1) >= this->PKT(pktfirst) && this->OBT(obt1) >= this->OBT(obtfirst) ){      if ( this->PKT(pkt1) >= this->PKT(pktfirst) && this->OBT(obt1) >= this->OBT(obtfirst) ){
3208        //        //
3209        if ( IsDebug() ) printf(" Trk calibration1 at time %i obt %i pkt %i \n",fromtime,obt1,pkt1);        if ( IsDebug() ) printf(" Trk calibration1 at time %u obt %u pkt %u \n",fromtime,obt1,pkt1);
3210        //              //      
3211        valid = ValidateTrkCalib( caltrk1, eh1 );        valid = ValidateTrkCalib( caltrk1, eh1 );
3212        if ( IsDebug() ) cout << " pkt1 validation --> "<<valid<<endl;        if ( IsDebug() ) cout << " pkt1 validation --> "<<valid<<endl;
# Line 3238  Int_t PamelaDBOperations::insertTRK_CALI Line 3249  Int_t PamelaDBOperations::insertTRK_CALI
3249          //          //
3250        };        };
3251        //        //
3252        if ( IsDebug() ) printf(" Found trk calibration2 at obt %i pkt %i t2 is %i \n",obt2,pkt2,t2);        if ( IsDebug() ) printf(" Found trk calibration2 at obt %u pkt %u t2 is %u \n",obt2,pkt2,t2);
3253        //        //
3254        // The calibration is good        // The calibration is good
3255        //        //
3256        if ( this->PKT(pkt2) == this->PKT(pkt1)+1 ){        if ( this->PKT(pkt2) == this->PKT(pkt1)+1 ){
3257          //          //
3258          if ( IsDebug() ) printf(" The trk calibration2 at obt %i pkt %i t2 is %i is good \n",obt2,pkt2,t2);          if ( IsDebug() ) printf(" The trk calibration2 at obt %u pkt %u t2 is %u is good \n",obt2,pkt2,t2);
3259          //          //
3260          UInt_t valid2 = ValidateTrkCalib( caltrk2, eh2 );          UInt_t valid2 = ValidateTrkCalib( caltrk2, eh2 );
3261          if ( IsDebug() ) cout << " pkt2 validation --> "<<valid2<<endl;          if ( IsDebug() ) cout << " pkt2 validation --> "<<valid2<<endl;
# Line 3258  Int_t PamelaDBOperations::insertTRK_CALI Line 3269  Int_t PamelaDBOperations::insertTRK_CALI
3269          //          //
3270          if ( t2 != pret2+1 ){          if ( t2 != pret2+1 ){
3271            //            //
3272            if ( IsDebug() ) printf(" Missing the trk calibration1! Next one at obt %i pkt %i t2 is %i pret2 is %i \n",obt2,pkt2,t2,pret2);            if ( IsDebug() ) printf(" Missing the trk calibration1! Next one at obt %u pkt %u t2 is %u pret2 is %u \n",obt2,pkt2,t2,pret2);
3273            //            //
3274            while ( t2 > pret2+1 ){            while ( t2 > pret2+1 ){
3275              //              //
# Line 3287  Int_t PamelaDBOperations::insertTRK_CALI Line 3298  Int_t PamelaDBOperations::insertTRK_CALI
3298          //          //
3299          // Check for missing calibtrk2          // Check for missing calibtrk2
3300          //          //
3301          if ( IsDebug() ) printf(" Missing the trk calibration2! Next one at obt %i pkt %i t2 is %i\n",obt2,pkt2,t2);          if ( IsDebug() ) printf(" Missing the trk calibration2! Next one at obt %u pkt %u t2 is %u\n",obt2,pkt2,t2);
3302          t2 = pret2;          t2 = pret2;
3303          //          //
3304          // handle missing calib2          // handle missing calib2
# Line 3301  Int_t PamelaDBOperations::insertTRK_CALI Line 3312  Int_t PamelaDBOperations::insertTRK_CALI
3312        //        //
3313      } else {      } else {
3314        //        //
3315        if ( IsDebug() ) printf(" Repetead trk calibration1 at time %i obt %i pkt %i \n",fromtime,obt1,pkt1);        if ( IsDebug() ) printf(" Repetead trk calibration1 at time %u obt %u pkt %u \n",fromtime,obt1,pkt1);
3316        //        //
3317      };      };
3318      //          //    
# Line 3326  Int_t PamelaDBOperations::insertTRK_CALI Line 3337  Int_t PamelaDBOperations::insertTRK_CALI
3337      valid = 0;      valid = 0;
3338      if ( this->PKT(pkt2) > this->PKT(pktfirst) || this->OBT(obt2) > this->OBT(obtfirst) ){      if ( this->PKT(pkt2) > this->PKT(pktfirst) || this->OBT(obt2) > this->OBT(obtfirst) ){
3339        //        //
3340        if ( IsDebug() ) printf(" Missing the trk calibration1! Next one at obt %i pkt %i t2 is %i\n",obt2,pkt2,t2);        if ( IsDebug() ) printf(" Missing the trk calibration1! Next one at obt %u pkt %u t2 is %u\n",obt2,pkt2,t2);
3341        //        //
3342        this->HandleTRK_CALIB(false,true);        this->HandleTRK_CALIB(false,true);
3343        //        //
# Line 3380  Int_t PamelaDBOperations::insertS4_CALIB Line 3391  Int_t PamelaDBOperations::insertS4_CALIB
3391      fromtime = this->GetAbsTime(ph->GetOrbitalTime());        fromtime = this->GetAbsTime(ph->GetOrbitalTime());  
3392      if ( this->PKT(pkt) >= this->PKT(pktfirst) && this->OBT(obt) >= this->OBT(obtfirst) ){      if ( this->PKT(pkt) >= this->PKT(pktfirst) && this->OBT(obt) >= this->OBT(obtfirst) ){
3393        //        //
3394        if ( IsDebug() ) printf(" S4 calibration at time %i obt %i pkt %i \n",fromtime,obt,pkt);        if ( IsDebug() ) printf(" S4 calibration at time %u obt %u pkt %u \n",fromtime,obt,pkt);
3395        //        //
3396        // check if the calibration has already been inserted        // check if the calibration has already been inserted
3397        //        //
# Line 3423  Int_t PamelaDBOperations::insertS4_CALIB Line 3434  Int_t PamelaDBOperations::insertS4_CALIB
3434            //            //
3435            if ( IsDebug() ) printf(" Calibration with fromtime lower than others to be inserted in the DB \n");            if ( IsDebug() ) printf(" Calibration with fromtime lower than others to be inserted in the DB \n");
3436            if ( fromtime < 1150871000 ){              if ( fromtime < 1150871000 ){  
3437              if ( IsDebug() ) printf(" First PAMELA flight calibration at time %i \n",fromtime);              if ( IsDebug() ) printf(" First PAMELA flight calibration at time %u \n",fromtime);
3438              fromtime = 0;// the first flight calibration was taken at about  1156429100 s, this line allow to analyze first runs in raw mode              fromtime = 0;// the first flight calibration was taken at about  1156429100 s, this line allow to analyze first runs in raw mode
3439            };            };
3440            //            //
# Line 3482  Int_t PamelaDBOperations::insertS4_CALIB Line 3493  Int_t PamelaDBOperations::insertS4_CALIB
3493        //        //
3494      } else {      } else {
3495        //        //
3496        if ( IsDebug() ) printf(" Repetead S4 calibration at time %i obt %i pkt %i \n",fromtime,obt,pkt);        if ( IsDebug() ) printf(" Repeated S4 calibration at time %u obt %u pkt %u \n",fromtime,obt,pkt);
3497        //        //
3498      };            };      
3499      //            //      
# Line 3693  Int_t PamelaDBOperations::ValidateRuns(T Line 3704  Int_t PamelaDBOperations::ValidateRuns(T
3704        row = result->Next();        row = result->Next();
3705        t_stop = (UInt_t)atoll(row->GetField(4));        t_stop = (UInt_t)atoll(row->GetField(4));
3706      };      };
3707      if ( IsDebug() ) printf("Validation interval: from time %i - to time %i \n\n",t_stop,t_start);      if ( IsDebug() ) printf("Validation interval: from time %u - to time %u \n\n",t_stop,t_start);
3708      // --------------------------------------------------------------      // --------------------------------------------------------------
3709      // now retrieves runs to be validated      // now retrieves runs to be validated
3710      // --------------------------------------------------------------      // --------------------------------------------------------------
# Line 3864  Int_t PamelaDBOperations::ValidateRuns(T Line 3875  Int_t PamelaDBOperations::ValidateRuns(T
3875                    }else printf("ValidateRuns ***WARNING*** : run sequence exceed assumed size (%i) \n",nseq_max);                    }else printf("ValidateRuns ***WARNING*** : run sequence exceed assumed size (%i) \n",nseq_max);
3876            };            };
3877                        
3878            if ( IsDebug() ) printf("%i Run %i \n",nrow,this_run->ID);            if ( IsDebug() ) printf("%i Run %u \n",nrow,this_run->ID);
3879            nrow++;            nrow++;
3880                        
3881    };    };
# Line 3893  Bool_t PamelaDBOperations::MissingTRK_CA Line 3904  Bool_t PamelaDBOperations::MissingTRK_CA
3904          // which should be equal to the time between ascending-nodes.          // which should be equal to the time between ascending-nodes.
3905          //==============================================================          //==============================================================
3906          if ( t2 - trkcalib->FROM_TIME > 5700) {          if ( t2 - trkcalib->FROM_TIME > 5700) {
3907                  if ( IsDebug() )printf("Long time between calib and run start %i :-( ==> there might be a missing calib \n",t2 - trkcalib->FROM_TIME);                  if ( IsDebug() )printf("Long time between calib and run start %u :-( ==> there might be a missing calib \n",t2 - trkcalib->FROM_TIME);
3908          //==============================================================          //==============================================================
3909          // there might be a missing calibration, due to:          // there might be a missing calibration, due to:
3910          // - MM full          // - MM full
# Line 3914  Bool_t PamelaDBOperations::MissingTRK_CA Line 3925  Bool_t PamelaDBOperations::MissingTRK_CA
3925          // it is enough to say that there are no missing calibrations          // it is enough to say that there are no missing calibrations
3926          //==============================================================          //==============================================================
3927          // the long time interval bewteen runs might be due to download          // the long time interval bewteen runs might be due to download
3928          if ( IsDebug() )printf("Short time between calib and run start %i :-) ==> OK! \n",t2 - trkcalib->FROM_TIME);          if ( IsDebug() )printf("Short time between calib and run start %u :-) ==> OK! \n",t2 - trkcalib->FROM_TIME);
3929          return(false);          return(false);
3930                    
3931  };  };
# Line 4230  void PamelaDBOperations::ValidationOFF() Line 4241  void PamelaDBOperations::ValidationOFF()
4241        };        };
4242      };      };
4243    };    };
4244    if ( IsDebug() ) printf(" %i runs have been unvalidated \n",unv);    if ( IsDebug() ) printf(" %u runs have been unvalidated \n",unv);
4245  };  };
4246    
4247  /**  /**
# Line 4261  void PamelaDBOperations::RemoveRUNS(){ Line 4272  void PamelaDBOperations::RemoveRUNS(){
4272      if ( IsDebug() ) printf(" Deleting run from GL_RUN table \n");          if ( IsDebug() ) printf(" Deleting run from GL_RUN table \n");    
4273      while ( Row ){      while ( Row ){
4274        delrun->DeleteRun(conn,(UInt_t)atoll(Row->GetField(0)),"GL_RUN");        delrun->DeleteRun(conn,(UInt_t)atoll(Row->GetField(0)),"GL_RUN");
4275        if ( IsDebug() ) printf(" del run %i \n",(UInt_t)atoll(Row->GetField(0)));        if ( IsDebug() ) printf(" del run %u \n",(UInt_t)atoll(Row->GetField(0)));
4276        drun++;        drun++;
4277        Row = pResult->Next();            Row = pResult->Next();    
4278      };      };
# Line 4282  void PamelaDBOperations::RemoveRUNS(){ Line 4293  void PamelaDBOperations::RemoveRUNS(){
4293    } else {    } else {
4294      if ( IsDebug() ) printf(" Deleting run fragments from GL_RUN table \n");          if ( IsDebug() ) printf(" Deleting run fragments from GL_RUN table \n");    
4295      while ( Row ){      while ( Row ){
4296        if ( IsDebug() ) printf(" restore run %i \n",(UInt_t)atoll(Row->GetField(1)));        if ( IsDebug() ) printf(" restore run %u \n",(UInt_t)atoll(Row->GetField(1)));
4297        delrun->RestoreRun(conn,(UInt_t)atoll(Row->GetField(1)),"GL_RUN_FRAGMENTS");        delrun->RestoreRun(conn,(UInt_t)atoll(Row->GetField(1)),"GL_RUN_FRAGMENTS");
4298        if ( IsDebug() ) printf(" del run %i \n",(UInt_t)atoll(Row->GetField(1)));        if ( IsDebug() ) printf(" del run %u \n",(UInt_t)atoll(Row->GetField(1)));
4299        delrun->DeleteRun(conn,(UInt_t)atoll(Row->GetField(1)),"GL_RUN");        delrun->DeleteRun(conn,(UInt_t)atoll(Row->GetField(1)),"GL_RUN");
4300        if ( (UInt_t)atoll(Row->GetField(1)) != (UInt_t)atoll(Row->GetField(0)) ){        if ( (UInt_t)atoll(Row->GetField(1)) != (UInt_t)atoll(Row->GetField(0)) ){
4301          if ( IsDebug() ) printf(" del run %i \n",(UInt_t)atoll(Row->GetField(0)));          if ( IsDebug() ) printf(" del run %u \n",(UInt_t)atoll(Row->GetField(0)));
4302          delrun->DeleteRun(conn,(UInt_t)atoll(Row->GetField(0)),"GL_RUN");          delrun->DeleteRun(conn,(UInt_t)atoll(Row->GetField(0)),"GL_RUN");
4303        };        };
4304        drun++;        drun++;
# Line 4313  void PamelaDBOperations::RemoveRUNS(){ Line 4324  void PamelaDBOperations::RemoveRUNS(){
4324    } else {    } else {
4325      if ( IsDebug() ) printf(" Deleting run fragments from GL_RUN_TRASH table \n");          if ( IsDebug() ) printf(" Deleting run fragments from GL_RUN_TRASH table \n");    
4326      while ( Row ){      while ( Row ){
4327        if ( IsDebug() ) printf(" del run idtrash %i \n",(UInt_t)atoll(Row->GetField(0)));        if ( IsDebug() ) printf(" del run idtrash %u \n",(UInt_t)atoll(Row->GetField(0)));
4328        myquery.str("");        myquery.str("");
4329        myquery << " DELETE FROM GL_RUN_TRASH where ID_TRASH=" << Row->GetField(0) <<";";              myquery << " DELETE FROM GL_RUN_TRASH where ID_TRASH=" << Row->GetField(0) <<";";      
4330        conn->Query(myquery.str().c_str());        conn->Query(myquery.str().c_str());
# Line 4322  void PamelaDBOperations::RemoveRUNS(){ Line 4333  void PamelaDBOperations::RemoveRUNS(){
4333      };      };
4334    };    };
4335    //      //  
4336    if ( IsDebug() ) printf(" Deleted %i run(s) from GL_RUN_TRASH table \n",drun);        if ( IsDebug() ) printf(" Deleted %u run(s) from GL_RUN_TRASH table \n",drun);    
4337    //    //
4338    //    //
4339    //    //
# Line 4340  void PamelaDBOperations::RemoveRUNS(){ Line 4351  void PamelaDBOperations::RemoveRUNS(){
4351    } else {    } else {
4352      if ( IsDebug() ) printf(" Deleting run fragments from GL_RUN_FRAGMENTS table \n");          if ( IsDebug() ) printf(" Deleting run fragments from GL_RUN_FRAGMENTS table \n");    
4353      while ( Row ){      while ( Row ){
4354        if ( IsDebug() ) printf(" del run %i \n",(UInt_t)atoll(Row->GetField(0)));        if ( IsDebug() ) printf(" del run %u \n",(UInt_t)atoll(Row->GetField(0)));
4355        myquery.str("");        myquery.str("");
4356        myquery << " DELETE FROM GL_RUN_FRAGMENTS where ID=" << Row->GetField(0) <<";";        myquery << " DELETE FROM GL_RUN_FRAGMENTS where ID=" << Row->GetField(0) <<";";
4357        conn->Query(myquery.str().c_str());        conn->Query(myquery.str().c_str());
# Line 4349  void PamelaDBOperations::RemoveRUNS(){ Line 4360  void PamelaDBOperations::RemoveRUNS(){
4360      };      };
4361    };    };
4362    //      //  
4363    if ( IsDebug() ) printf(" Deleted %i run(s) from GL_RUN_FRAGMENTS table \n",drun);        if ( IsDebug() ) printf(" Deleted %u run(s) from GL_RUN_FRAGMENTS table \n",drun);    
4364    //    //
4365    //    //
4366    //    //
# Line 4680  UInt_t PamelaDBOperations::Check(){ Line 4691  UInt_t PamelaDBOperations::Check(){
4691      //    if ( (thisrht < prevrtt || thisrtt < prevrht || thisrht > thisrtt) && (thisrht != prevrht) ){      //    if ( (thisrht < prevrtt || thisrtt < prevrht || thisrht > thisrtt) && (thisrht != prevrht) ){
4692      if ( (thisrht < prevrtt) && (thisrht != prevrht) ){      if ( (thisrht < prevrtt) && (thisrht != prevrht) ){
4693        if ( IsDebug() ) printf(" IDprev %u ID %u    prevrht %u prevrtt %u  thisrht %u thisrtt %u \n",previd,thisid,prevrht,prevrtt,thisrht,thisrtt);        if ( IsDebug() ) printf(" IDprev %u ID %u    prevrht %u prevrtt %u  thisrht %u thisrtt %u \n",previd,thisid,prevrht,prevrtt,thisrht,thisrtt);
4694        printf(" CHECK n.1 TIME SCREW of %i s AROUND RUNs %u and %u \n",(thisrht-prevrtt),previd,thisid);        printf(" CHECK n.1 TIME SCREW of %u s AROUND RUNs %u and %u \n",(thisrht-prevrtt),previd,thisid);
4695        TString prevf = "";        TString prevf = "";
4696        TString thisf = "";        TString thisf = "";
4697        oss.str("");        oss.str("");
# Line 4701  UInt_t PamelaDBOperations::Check(){ Line 4712  UInt_t PamelaDBOperations::Check(){
4712      //      //
4713      if ( (thisrtt < prevrht) && (thisrht != prevrht) ){      if ( (thisrtt < prevrht) && (thisrht != prevrht) ){
4714        if ( IsDebug() ) printf(" IDprev %u ID %u    prevrht %u prevrtt %u  thisrht %u thisrtt %u \n",previd,thisid,prevrht,prevrtt,thisrht,thisrtt);        if ( IsDebug() ) printf(" IDprev %u ID %u    prevrht %u prevrtt %u  thisrht %u thisrtt %u \n",previd,thisid,prevrht,prevrtt,thisrht,thisrtt);
4715        printf(" CHECK n.2 TIME SCREW of %i s AROUND RUNs %u and %u \n",(thisrtt-prevrht),previd,thisid);        printf(" CHECK n.2 TIME SCREW of %u s AROUND RUNs %u and %u \n",(thisrtt-prevrht),previd,thisid);
4716        TString prevf = "";        TString prevf = "";
4717        TString thisf = "";        TString thisf = "";
4718        oss.str("");        oss.str("");
# Line 4722  UInt_t PamelaDBOperations::Check(){ Line 4733  UInt_t PamelaDBOperations::Check(){
4733      //      //
4734      if ( (thisrht > thisrtt) && (thisrht != prevrht) ){      if ( (thisrht > thisrtt) && (thisrht != prevrht) ){
4735        if ( IsDebug() ) printf(" IDprev %u ID %u    prevrht %u prevrtt %u  thisrht %u thisrtt %u \n",previd,thisid,prevrht,prevrtt,thisrht,thisrtt);        if ( IsDebug() ) printf(" IDprev %u ID %u    prevrht %u prevrtt %u  thisrht %u thisrtt %u \n",previd,thisid,prevrht,prevrtt,thisrht,thisrtt);
4736        printf(" CHECK n.3 TIME SCREW of %i s AROUND RUNs %u and %u \n",(thisrht-thisrtt),previd,thisid);        printf(" CHECK n.3 TIME SCREW of %u s AROUND RUNs %u and %u \n",(thisrht-thisrtt),previd,thisid);
4737        TString prevf = "";        TString prevf = "";
4738        TString thisf = "";        TString thisf = "";
4739        oss.str("");        oss.str("");

Legend:
Removed from v.1.33  
changed lines
  Added in v.1.38

  ViewVC Help
Powered by ViewVC 1.1.23