/[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.32 by mocchiut, Mon Apr 30 08:19:36 2007 UTC revision 1.42 by mocchiut, Mon Apr 30 15:57:06 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 867  Long64_t PamelaDBOperations::PKT(UInt_t Line 867  Long64_t PamelaDBOperations::PKT(UInt_t
867      return((Long64_t)pkt_num+16777215LL);      return((Long64_t)pkt_num+16777215LL);
868    };    };
869    //    //
870    if ( pkt_num > (Long64_t)ppktfirst*2 && pkt_num > (16777214/2) ){    if ( pkt_num > ((Long64_t)ppktfirst*2) && pkt_num > (16777214/2) ){
871      if ( IsDebug() ) printf(" rise down pktnum %lld \n",(Long64_t)pkt_num-16777215LL);      if ( IsDebug() ) printf(" rise down pktnum %lld \n",(Long64_t)pkt_num-16777215LL);
872      return((Long64_t)pkt_num-16777215LL);      return((Long64_t)pkt_num-16777215LL);
873    };    };
# Line 882  Long64_t PamelaDBOperations::PKT(UInt_t Line 882  Long64_t PamelaDBOperations::PKT(UInt_t
882   */   */
883  Long64_t PamelaDBOperations::OBT(UInt_t obt){    Long64_t PamelaDBOperations::OBT(UInt_t obt){  
884    //    //
885    if ( IsDebug() ) printf(" obt conversion: ob 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));
886    //    //
887    if ( obt < (pobtfirst/2) && pobtfirst > (numeric_limits<UInt_t>::max()/2) ){    if ( obt < (pobtfirst/2) && pobtfirst > (numeric_limits<UInt_t>::max()/2) ){
888      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+numeric_limits<UInt_t>::max()));
889      return((Long64_t)(obt+numeric_limits<UInt_t>::max()));      return((Long64_t)(obt+numeric_limits<UInt_t>::max()));
890    };    };
891    //    //
892    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) ){
893        if ( IsDebug() ) printf(" pobtfirst*2 %lld \n",((Long64_t)pobtfirst*2));
894      if ( IsDebug() ) printf(" rise down pktnum %lld \n", (Long64_t)obt-(Long64_t)numeric_limits<UInt_t>::max());      if ( IsDebug() ) printf(" rise down pktnum %lld \n", (Long64_t)obt-(Long64_t)numeric_limits<UInt_t>::max());
895      return((Long64_t)obt-(Long64_t)numeric_limits<UInt_t>::max());      return((Long64_t)obt-(Long64_t)numeric_limits<UInt_t>::max());
896    };    };
# Line 1034  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 1086  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 1495  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 1513  Int_t PamelaDBOperations::insertPamelaRU Line 1516  Int_t PamelaDBOperations::insertPamelaRU
1516    rt->SetBranchAddress("RunTrailer", &runt);    rt->SetBranchAddress("RunTrailer", &runt);
1517    rt->SetBranchAddress("Header", &eht);    rt->SetBranchAddress("Header", &eht);
1518    //    //
1519      TTree *T = (TTree*)file->Get("Physics");
1520      if ( !T || T->IsZombie() ) throw -16;
1521      EventHeader *eh = 0;
1522      T->SetBranchAddress("Header", &eh);
1523      //
1524      if ( !(rh->GetEntries()) && !(rt->GetEntries()) && !(T->GetEntries()) ) return(16);
1525      //
1526    UInt_t obtt = 0;    UInt_t obtt = 0;
1527    UInt_t obth = 0;    UInt_t obth = 0;
1528    UInt_t pktt = 0;    UInt_t pktt = 0;
# Line 1546  Int_t PamelaDBOperations::insertPamelaRU Line 1556  Int_t PamelaDBOperations::insertPamelaRU
1556        //        //
1557        if ( !ptt &&  !(ptht+1) ){        if ( !ptt &&  !(ptht+1) ){
1558          //          //
1559          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);
1560          //          //
1561          this->HandleRunFragments(true,false,0,(evbeft-1));          this->HandleRunFragments(true,false,0,(evbeft-1));
1562          //          //
1563          //          //
1564        } else if ( pth == ptht ){        } else if ( pth == ptht ){
1565          //          //
1566          if ( IsDebug() ) printf(" Missing header %i %i %i\n",ptht,pth,ptt);          if ( IsDebug() ) printf(" Missing header %u %u %u\n",ptht,pth,ptt);
1567          //          //
1568          if ( (ptt-1) < 0 ) throw -15; // should never arrive here!          if ( (ptt-1) < 0 ) throw -15; // should never arrive here!
1569          rt->GetEntry(ptt-1);          rt->GetEntry(ptt-1);
# Line 1562  Int_t PamelaDBOperations::insertPamelaRU Line 1572  Int_t PamelaDBOperations::insertPamelaRU
1572          rt->GetEntry(ptt);          rt->GetEntry(ptt);
1573          pht = eht->GetPscuHeader();          pht = eht->GetPscuHeader();
1574          //          //
1575          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);
1576          if ( IsDebug() ) printf(" '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''  %i %i %i \n",pkth,obth,obtt);          if ( IsDebug() ) printf(" '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''  %u %u %u \n",pkth,obth,obtt);
1577          //          //
1578          this->HandleMissingHoT(true,false,evbefh,evbeft-1);          this->HandleMissingHoT(true,false,evbefh,evbeft-1);
1579          //          //
1580        } else {        } else {
1581          //          //
1582          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);
1583          //          //
1584          rh->GetEntry(ptht);          rh->GetEntry(ptht);
1585          phh = ehh->GetPscuHeader();          phh = ehh->GetPscuHeader();
# Line 1577  Int_t PamelaDBOperations::insertPamelaRU Line 1587  Int_t PamelaDBOperations::insertPamelaRU
1587          obth = phh->GetOrbitalTime();          obth = phh->GetOrbitalTime();
1588          cod = ehh->GetCounter();          cod = ehh->GetCounter();
1589          evbefh = cod->Get(pctp->Physics);          evbefh = cod->Get(pctp->Physics);
1590          if ( IsDebug() ) printf(" ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' %i %i %i \n",pkth,obth,obtt);          if ( IsDebug() ) printf(" ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' %u %u %u \n",pkth,obth,obtt);
1591          //          //
1592          // handle this run          // handle this run
1593          //          //
# Line 1587  Int_t PamelaDBOperations::insertPamelaRU Line 1597  Int_t PamelaDBOperations::insertPamelaRU
1597          //          //
1598          if ( PKT(pkth)>PKT(pktfirst) && OBT(obth)>OBT(obtfirst) && !ptt ){          if ( PKT(pkth)>PKT(pktfirst) && OBT(obth)>OBT(obtfirst) && !ptt ){
1599            //            //
1600            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 evbefh = %u \n",evbefh);        
           //  
           this->HandleRunFragments(true,true,0,(evbefh-1));  
1601            //            //
1602              if ( evbefh == 0 ) {
1603                //
1604                signal = 8;
1605                if ( IsDebug() ) printf(" Not supported yet: run with no events, no runtrailer, no runheader \n");
1606                //
1607              } else {
1608                //
1609                this->HandleRunFragments(true,true,0,(evbefh-1));
1610                //
1611              };
1612          };          };
1613          //          //
1614          //          //
1615          if ( (ptht - pth) > 1 ){          if ( (ptht - pth) > 1 ){
1616            //            //
1617            if ( IsDebug() ) printf(" Missing runtrailers! \n");            if ( IsDebug() ) printf(" Missing runtrailers! \n");
1618            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);
1619            // is not the consecutive header            // is not the consecutive header
1620            while ( pth != ptht ){                      while ( pth != ptht ){          
1621              //              //
# Line 1618  Int_t PamelaDBOperations::insertPamelaRU Line 1636  Int_t PamelaDBOperations::insertPamelaRU
1636              obth = phh->GetOrbitalTime();              obth = phh->GetOrbitalTime();
1637              evbefh = cod->Get(pctp->Physics);              evbefh = cod->Get(pctp->Physics);
1638              //              //
1639              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);
1640              if ( IsDebug() ) printf(" ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' %i %i %i \n",pkth,obth,obtt);              if ( IsDebug() ) printf(" ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' %u %u %u \n",pkth,obth,obtt);
1641              //              //
1642              this->HandleMissingHoT(false,true,evbefh,evbeft-1);              this->HandleMissingHoT(false,true,evbefh,evbeft-1);
1643              //              //
# Line 1628  Int_t PamelaDBOperations::insertPamelaRU Line 1646  Int_t PamelaDBOperations::insertPamelaRU
1646          } else if ( !(ptht - pth) ){          } else if ( !(ptht - pth) ){
1647            //            //
1648            if ( IsDebug() ) printf(" Missing runheader! \n");            if ( IsDebug() ) printf(" Missing runheader! \n");
1649            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);
1650            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");
1651            //            //
1652          } else {          } else {
# Line 1649  Int_t PamelaDBOperations::insertPamelaRU Line 1667  Int_t PamelaDBOperations::insertPamelaRU
1667            obth = phh->GetOrbitalTime();            obth = phh->GetOrbitalTime();
1668            cod = ehh->GetCounter();            cod = ehh->GetCounter();
1669            evbefh = cod->Get(pctp->Physics);            evbefh = cod->Get(pctp->Physics);
1670            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);
1671            if ( IsDebug() ) printf(" ''''''''''''''''''''''''''''''' %i %i %i \n",ptht,pth,ptt);            if ( IsDebug() ) printf(" ''''''''''''''''''''''''''''''' %u %u %u \n",ptht,pth,ptt);
1672            if ( IsDebug() ) printf(" ''''''''''''''''''''''''''''''' %i \n",rhev);            if ( IsDebug() ) printf(" ''''''''''''''''''''''''''''''' %u \n",rhev);
1673            //            //
1674            this->HandleRunFragments(false,true,evbefh,upperentry);            this->HandleRunFragments(false,true,evbefh,upperentry);
1675          } else {          } else {
# Line 2051  void PamelaDBOperations::HandleRunFragme Line 2069  void PamelaDBOperations::HandleRunFragme
2069        ULong64_t aobt = OBT(glrun1->GetRUNTRAILER_OBT());        ULong64_t aobt = OBT(glrun1->GetRUNTRAILER_OBT());
2070        UInt_t bpkt = PKT(glrun->GetRUNHEADER_PKT());        UInt_t bpkt = PKT(glrun->GetRUNHEADER_PKT());
2071        ULong64_t bobt = OBT(glrun->GetRUNHEADER_OBT());        ULong64_t bobt = OBT(glrun->GetRUNHEADER_OBT());
2072        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);
2073        TTree *T= 0;        TTree *T= 0;
2074        T = (TTree*)file->Get("Physics");        T = (TTree*)file->Get("Physics");
2075        if ( !T || T->IsZombie() ) throw -16;        if ( !T || T->IsZombie() ) throw -16;
# Line 2065  void PamelaDBOperations::HandleRunFragme Line 2083  void PamelaDBOperations::HandleRunFragme
2083          bobt = OBT(ph->GetOrbitalTime());                bobt = OBT(ph->GetOrbitalTime());      
2084          firstev++;          firstev++;
2085        };        };
2086        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);
2087        //        //
2088        glrun1->SetPKT_COUNTER(glrun->GetPKT_COUNTER());        glrun1->SetPKT_COUNTER(glrun->GetPKT_COUNTER());
2089        glrun1->SetPKT_READY_COUNTER(glrun->GetPKT_READY_COUNTER());        glrun1->SetPKT_READY_COUNTER(glrun->GetPKT_READY_COUNTER());
# Line 2248  void PamelaDBOperations::HandleRunFragme Line 2266  void PamelaDBOperations::HandleRunFragme
2266        ULong64_t aobt = OBT(glrun->GetRUNTRAILER_OBT());        ULong64_t aobt = OBT(glrun->GetRUNTRAILER_OBT());
2267        UInt_t bpkt = PKT(glrun1->GetRUNHEADER_PKT());        UInt_t bpkt = PKT(glrun1->GetRUNHEADER_PKT());
2268        ULong64_t bobt = OBT(glrun1->GetRUNHEADER_OBT());        ULong64_t bobt = OBT(glrun1->GetRUNHEADER_OBT());
2269        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);
2270        TTree *T= 0;        TTree *T= 0;
2271        T = (TTree*)file->Get("Physics");        T = (TTree*)file->Get("Physics");
2272        if ( !T || T->IsZombie() ) throw -16;        if ( !T || T->IsZombie() ) throw -16;
# Line 2262  void PamelaDBOperations::HandleRunFragme Line 2280  void PamelaDBOperations::HandleRunFragme
2280          aobt = OBT(ph->GetOrbitalTime());                aobt = OBT(ph->GetOrbitalTime());      
2281          lastev--;          lastev--;
2282        };        };
2283        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);
2284        //        //
2285        glrun->SetEV_TO(lastev);        glrun->SetEV_TO(lastev);
2286        glrun->SetNEVENTS(lastev-firstev+1);        glrun->SetNEVENTS(lastev-firstev+1);
# Line 2869  Int_t PamelaDBOperations::insertCALO_CAL Line 2887  Int_t PamelaDBOperations::insertCALO_CAL
2887          fromtime = this->GetAbsTime(ph->GetOrbitalTime());            fromtime = this->GetAbsTime(ph->GetOrbitalTime());  
2888          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) ){
2889            //            //
2890            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);
2891            //            //
2892            // check if the calibration has already been inserted            // check if the calibration has already been inserted
2893            //            //
# Line 2914  Int_t PamelaDBOperations::insertCALO_CAL Line 2932  Int_t PamelaDBOperations::insertCALO_CAL
2932                //                //
2933                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);
2934                if ( fromtime < 1150871000 ){ //1150866904                if ( fromtime < 1150871000 ){ //1150866904
2935                  if ( IsDebug() ) printf(" First PAMELA flight calibration at time %i \n",fromtime);                  if ( IsDebug() ) printf(" First PAMELA flight calibration at time %u \n",fromtime);
2936                  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
2937                };                };
2938                //                //
# Line 2976  Int_t PamelaDBOperations::insertCALO_CAL Line 2994  Int_t PamelaDBOperations::insertCALO_CAL
2994            //            //
2995          } else {          } else {
2996            //            //
2997            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);
2998            //            //
2999          };                };      
3000          //                //      
# Line 3194  Int_t PamelaDBOperations::insertTRK_CALI Line 3212  Int_t PamelaDBOperations::insertTRK_CALI
3212      //      //
3213      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) ){
3214        //        //
3215        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);
3216        //              //      
3217        valid = ValidateTrkCalib( caltrk1, eh1 );        valid = ValidateTrkCalib( caltrk1, eh1 );
3218        if ( IsDebug() ) cout << " pkt1 validation --> "<<valid<<endl;        if ( IsDebug() ) cout << " pkt1 validation --> "<<valid<<endl;
# Line 3237  Int_t PamelaDBOperations::insertTRK_CALI Line 3255  Int_t PamelaDBOperations::insertTRK_CALI
3255          //          //
3256        };        };
3257        //        //
3258        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);
3259        //        //
3260        // The calibration is good        // The calibration is good
3261        //        //
3262        if ( this->PKT(pkt2) == this->PKT(pkt1)+1 ){        if ( this->PKT(pkt2) == this->PKT(pkt1)+1 ){
3263          //          //
3264          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);
3265          //          //
3266          UInt_t valid2 = ValidateTrkCalib( caltrk2, eh2 );          UInt_t valid2 = ValidateTrkCalib( caltrk2, eh2 );
3267          if ( IsDebug() ) cout << " pkt2 validation --> "<<valid2<<endl;          if ( IsDebug() ) cout << " pkt2 validation --> "<<valid2<<endl;
# Line 3257  Int_t PamelaDBOperations::insertTRK_CALI Line 3275  Int_t PamelaDBOperations::insertTRK_CALI
3275          //          //
3276          if ( t2 != pret2+1 ){          if ( t2 != pret2+1 ){
3277            //            //
3278            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);
3279            //            //
3280            while ( t2 > pret2+1 ){            while ( t2 > pret2+1 ){
3281              //              //
# Line 3286  Int_t PamelaDBOperations::insertTRK_CALI Line 3304  Int_t PamelaDBOperations::insertTRK_CALI
3304          //          //
3305          // Check for missing calibtrk2          // Check for missing calibtrk2
3306          //          //
3307          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);
3308          t2 = pret2;          t2 = pret2;
3309          //          //
3310          // handle missing calib2          // handle missing calib2
# Line 3300  Int_t PamelaDBOperations::insertTRK_CALI Line 3318  Int_t PamelaDBOperations::insertTRK_CALI
3318        //        //
3319      } else {      } else {
3320        //        //
3321        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);
3322        //        //
3323      };      };
3324      //          //    
# Line 3325  Int_t PamelaDBOperations::insertTRK_CALI Line 3343  Int_t PamelaDBOperations::insertTRK_CALI
3343      valid = 0;      valid = 0;
3344      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) ){
3345        //        //
3346        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);
3347        //        //
3348        this->HandleTRK_CALIB(false,true);        this->HandleTRK_CALIB(false,true);
3349        //        //
# Line 3379  Int_t PamelaDBOperations::insertS4_CALIB Line 3397  Int_t PamelaDBOperations::insertS4_CALIB
3397      fromtime = this->GetAbsTime(ph->GetOrbitalTime());        fromtime = this->GetAbsTime(ph->GetOrbitalTime());  
3398      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) ){
3399        //        //
3400        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);
3401        //        //
3402        // check if the calibration has already been inserted        // check if the calibration has already been inserted
3403        //        //
# Line 3422  Int_t PamelaDBOperations::insertS4_CALIB Line 3440  Int_t PamelaDBOperations::insertS4_CALIB
3440            //            //
3441            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");
3442            if ( fromtime < 1150871000 ){              if ( fromtime < 1150871000 ){  
3443              if ( IsDebug() ) printf(" First PAMELA flight calibration at time %i \n",fromtime);              if ( IsDebug() ) printf(" First PAMELA flight calibration at time %u \n",fromtime);
3444              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
3445            };            };
3446            //            //
# Line 3481  Int_t PamelaDBOperations::insertS4_CALIB Line 3499  Int_t PamelaDBOperations::insertS4_CALIB
3499        //        //
3500      } else {      } else {
3501        //        //
3502        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);
3503        //        //
3504      };            };      
3505      //            //      
# Line 3692  Int_t PamelaDBOperations::ValidateRuns(T Line 3710  Int_t PamelaDBOperations::ValidateRuns(T
3710        row = result->Next();        row = result->Next();
3711        t_stop = (UInt_t)atoll(row->GetField(4));        t_stop = (UInt_t)atoll(row->GetField(4));
3712      };      };
3713      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);
3714      // --------------------------------------------------------------      // --------------------------------------------------------------
3715      // now retrieves runs to be validated      // now retrieves runs to be validated
3716      // --------------------------------------------------------------      // --------------------------------------------------------------
# Line 3863  Int_t PamelaDBOperations::ValidateRuns(T Line 3881  Int_t PamelaDBOperations::ValidateRuns(T
3881                    }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);
3882            };            };
3883                        
3884            if ( IsDebug() ) printf("%i Run %i \n",nrow,this_run->ID);            if ( IsDebug() ) printf("%i Run %u \n",nrow,this_run->ID);
3885            nrow++;            nrow++;
3886                        
3887    };    };
# Line 3892  Bool_t PamelaDBOperations::MissingTRK_CA Line 3910  Bool_t PamelaDBOperations::MissingTRK_CA
3910          // which should be equal to the time between ascending-nodes.          // which should be equal to the time between ascending-nodes.
3911          //==============================================================          //==============================================================
3912          if ( t2 - trkcalib->FROM_TIME > 5700) {          if ( t2 - trkcalib->FROM_TIME > 5700) {
3913                  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);
3914          //==============================================================          //==============================================================
3915          // there might be a missing calibration, due to:          // there might be a missing calibration, due to:
3916          // - MM full          // - MM full
# Line 3913  Bool_t PamelaDBOperations::MissingTRK_CA Line 3931  Bool_t PamelaDBOperations::MissingTRK_CA
3931          // it is enough to say that there are no missing calibrations          // it is enough to say that there are no missing calibrations
3932          //==============================================================          //==============================================================
3933          // the long time interval bewteen runs might be due to download          // the long time interval bewteen runs might be due to download
3934          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);
3935          return(false);          return(false);
3936                    
3937  };  };
# Line 4229  void PamelaDBOperations::ValidationOFF() Line 4247  void PamelaDBOperations::ValidationOFF()
4247        };        };
4248      };      };
4249    };    };
4250    if ( IsDebug() ) printf(" %i runs have been unvalidated \n",unv);    if ( IsDebug() ) printf(" %u runs have been unvalidated \n",unv);
4251  };  };
4252    
4253  /**  /**
# Line 4260  void PamelaDBOperations::RemoveRUNS(){ Line 4278  void PamelaDBOperations::RemoveRUNS(){
4278      if ( IsDebug() ) printf(" Deleting run from GL_RUN table \n");          if ( IsDebug() ) printf(" Deleting run from GL_RUN table \n");    
4279      while ( Row ){      while ( Row ){
4280        delrun->DeleteRun(conn,(UInt_t)atoll(Row->GetField(0)),"GL_RUN");        delrun->DeleteRun(conn,(UInt_t)atoll(Row->GetField(0)),"GL_RUN");
4281        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)));
4282        drun++;        drun++;
4283        Row = pResult->Next();            Row = pResult->Next();    
4284      };      };
# Line 4281  void PamelaDBOperations::RemoveRUNS(){ Line 4299  void PamelaDBOperations::RemoveRUNS(){
4299    } else {    } else {
4300      if ( IsDebug() ) printf(" Deleting run fragments from GL_RUN table \n");          if ( IsDebug() ) printf(" Deleting run fragments from GL_RUN table \n");    
4301      while ( Row ){      while ( Row ){
4302        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)));
4303        delrun->RestoreRun(conn,(UInt_t)atoll(Row->GetField(1)),"GL_RUN_FRAGMENTS");        delrun->RestoreRun(conn,(UInt_t)atoll(Row->GetField(1)),"GL_RUN_FRAGMENTS");
4304        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)));
4305        delrun->DeleteRun(conn,(UInt_t)atoll(Row->GetField(1)),"GL_RUN");        delrun->DeleteRun(conn,(UInt_t)atoll(Row->GetField(1)),"GL_RUN");
4306        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)) ){
4307          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)));
4308          delrun->DeleteRun(conn,(UInt_t)atoll(Row->GetField(0)),"GL_RUN");          delrun->DeleteRun(conn,(UInt_t)atoll(Row->GetField(0)),"GL_RUN");
4309        };        };
4310        drun++;        drun++;
# Line 4312  void PamelaDBOperations::RemoveRUNS(){ Line 4330  void PamelaDBOperations::RemoveRUNS(){
4330    } else {    } else {
4331      if ( IsDebug() ) printf(" Deleting run fragments from GL_RUN_TRASH table \n");          if ( IsDebug() ) printf(" Deleting run fragments from GL_RUN_TRASH table \n");    
4332      while ( Row ){      while ( Row ){
4333        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)));
4334        myquery.str("");        myquery.str("");
4335        myquery << " DELETE FROM GL_RUN_TRASH where ID_TRASH=" << Row->GetField(0) <<";";              myquery << " DELETE FROM GL_RUN_TRASH where ID_TRASH=" << Row->GetField(0) <<";";      
4336        conn->Query(myquery.str().c_str());        conn->Query(myquery.str().c_str());
# Line 4321  void PamelaDBOperations::RemoveRUNS(){ Line 4339  void PamelaDBOperations::RemoveRUNS(){
4339      };      };
4340    };    };
4341    //      //  
4342    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);    
4343    //    //
4344    //    //
4345    //    //
# Line 4339  void PamelaDBOperations::RemoveRUNS(){ Line 4357  void PamelaDBOperations::RemoveRUNS(){
4357    } else {    } else {
4358      if ( IsDebug() ) printf(" Deleting run fragments from GL_RUN_FRAGMENTS table \n");          if ( IsDebug() ) printf(" Deleting run fragments from GL_RUN_FRAGMENTS table \n");    
4359      while ( Row ){      while ( Row ){
4360        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)));
4361        myquery.str("");        myquery.str("");
4362        myquery << " DELETE FROM GL_RUN_FRAGMENTS where ID=" << Row->GetField(0) <<";";        myquery << " DELETE FROM GL_RUN_FRAGMENTS where ID=" << Row->GetField(0) <<";";
4363        conn->Query(myquery.str().c_str());        conn->Query(myquery.str().c_str());
# Line 4348  void PamelaDBOperations::RemoveRUNS(){ Line 4366  void PamelaDBOperations::RemoveRUNS(){
4366      };      };
4367    };    };
4368    //      //  
4369    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);    
4370    //    //
4371    //    //
4372    //    //
# Line 4679  UInt_t PamelaDBOperations::Check(){ Line 4697  UInt_t PamelaDBOperations::Check(){
4697      //    if ( (thisrht < prevrtt || thisrtt < prevrht || thisrht > thisrtt) && (thisrht != prevrht) ){      //    if ( (thisrht < prevrtt || thisrtt < prevrht || thisrht > thisrtt) && (thisrht != prevrht) ){
4698      if ( (thisrht < prevrtt) && (thisrht != prevrht) ){      if ( (thisrht < prevrtt) && (thisrht != prevrht) ){
4699        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);
4700        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);
4701        TString prevf = "";        TString prevf = "";
4702        TString thisf = "";        TString thisf = "";
4703        oss.str("");        oss.str("");
# Line 4700  UInt_t PamelaDBOperations::Check(){ Line 4718  UInt_t PamelaDBOperations::Check(){
4718      //      //
4719      if ( (thisrtt < prevrht) && (thisrht != prevrht) ){      if ( (thisrtt < prevrht) && (thisrht != prevrht) ){
4720        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);
4721        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);
4722        TString prevf = "";        TString prevf = "";
4723        TString thisf = "";        TString thisf = "";
4724        oss.str("");        oss.str("");
# Line 4721  UInt_t PamelaDBOperations::Check(){ Line 4739  UInt_t PamelaDBOperations::Check(){
4739      //      //
4740      if ( (thisrht > thisrtt) && (thisrht != prevrht) ){      if ( (thisrht > thisrtt) && (thisrht != prevrht) ){
4741        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);
4742        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);
4743        TString prevf = "";        TString prevf = "";
4744        TString thisf = "";        TString thisf = "";
4745        oss.str("");        oss.str("");

Legend:
Removed from v.1.32  
changed lines
  Added in v.1.42

  ViewVC Help
Powered by ViewVC 1.1.23