| 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; |
| 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 |
// |
// |
| 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 |
}; |
}; |
| 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 |
}; |
}; |
| 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 |
// |
// |
| 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; |
| 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 |
// |
// |
| 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; |
| 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); |
| 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(); |
| 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 |
// |
// |
| 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 |
// |
// |
| 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 |
// |
// |
| 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 { |
| 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 { |
| 1717 |
// ( runhead_time <= _our_runhead_time && runtrail_time >= _our_runtrail_time) && |
// ( runhead_time <= _our_runhead_time && runtrail_time >= _our_runtrail_time) && |
| 1718 |
// ( runhead_obt <= _our_runheadobt || runhead_pkt <= _our_runheadpkt ) && |
// ( runhead_obt <= _our_runheadobt || runhead_pkt <= _our_runheadpkt ) && |
| 1719 |
// ( runtrail_obt <= _our_runtrailobt || runtrail_pkt <= _our_runtrailpkt ) ) |
// ( runtrail_obt <= _our_runtrailobt || runtrail_pkt <= _our_runtrailpkt ) ) |
| 1720 |
|
// || |
| 1721 |
|
// ( runhead_time = _our_runhead_time && runtrail_time = _our_runtrail_time && nevents > 100 ) |
| 1722 |
// ) |
// ) |
| 1723 |
// |
// |
| 1724 |
oss << " SELECT ID,NEVENTS,TRK_CALIB_USED,PKT_COUNTER FROM GL_RUN WHERE " |
oss << " SELECT ID,NEVENTS,TRK_CALIB_USED,PKT_COUNTER FROM GL_RUN WHERE " |
| 1734 |
<< " RUNHEADER_OBT<=" << glrun->GetRUNHEADER_OBT() << " OR " |
<< " RUNHEADER_OBT<=" << glrun->GetRUNHEADER_OBT() << " OR " |
| 1735 |
<< " RUNHEADER_PKT<=" << glrun->GetRUNHEADER_PKT() << ") AND (" |
<< " RUNHEADER_PKT<=" << glrun->GetRUNHEADER_PKT() << ") AND (" |
| 1736 |
<< " RUNTRAILER_OBT>=" << glrun->GetRUNTRAILER_OBT() << " OR " |
<< " RUNTRAILER_OBT>=" << glrun->GetRUNTRAILER_OBT() << " OR " |
| 1737 |
<< " RUNTRAILER_PKT>=" << glrun->GetRUNTRAILER_PKT() << ") ));"; |
<< " RUNTRAILER_PKT>=" << glrun->GetRUNTRAILER_PKT() << ") OR " |
| 1738 |
|
<< " (RUNHEADER_TIME=" << (UInt_t)glrun->GetRUNHEADER_TIME() << " AND " // these two lines in a certain way disable the patch below... |
| 1739 |
|
<< " RUNTRAILER_TIME=" << (UInt_t)glrun->GetRUNTRAILER_TIME() <<" AND NEVENTS>100)" // |
| 1740 |
|
<< " ));"; |
| 1741 |
// |
// |
| 1742 |
if ( IsDebug() ) printf(" check if run has been inserted: query is \n %s \n",oss.str().c_str()); |
if ( IsDebug() ) printf(" check if run has been inserted: query is \n %s \n",oss.str().c_str()); |
| 1743 |
result = conn->Query(oss.str().c_str()); |
result = conn->Query(oss.str().c_str()); |
| 1759 |
// |
// |
| 1760 |
// the run has already been inserted |
// the run has already been inserted |
| 1761 |
// |
// |
| 1762 |
// return(true); //<<<<<<<<<<<<<<<<<<<<<<<< patch follows, uncomment here |
if ( signal && IsDebug() ) printf(" The run has already been inserted \n"); |
| 1763 |
|
return(true); //<<<<<<<<<<<<<<<<<<<<<<<< patch follows, uncomment here |
| 1764 |
// |
// |
| 1765 |
// PATCH! |
// PATCH! |
| 1766 |
// we keep the processing run if (in order of growing importance) 1) we have the runtrailer while the old run doesn't have it 2) we have the runheader |
// we keep the processing run if (in order of growing importance) 1) we have the runtrailer while the old run doesn't have it 2) we have the runheader |
| 2075 |
ULong64_t aobt = OBT(glrun1->GetRUNTRAILER_OBT()); |
ULong64_t aobt = OBT(glrun1->GetRUNTRAILER_OBT()); |
| 2076 |
UInt_t bpkt = PKT(glrun->GetRUNHEADER_PKT()); |
UInt_t bpkt = PKT(glrun->GetRUNHEADER_PKT()); |
| 2077 |
ULong64_t bobt = OBT(glrun->GetRUNHEADER_OBT()); |
ULong64_t bobt = OBT(glrun->GetRUNHEADER_OBT()); |
| 2078 |
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); |
| 2079 |
TTree *T= 0; |
TTree *T= 0; |
| 2080 |
T = (TTree*)file->Get("Physics"); |
T = (TTree*)file->Get("Physics"); |
| 2081 |
if ( !T || T->IsZombie() ) throw -16; |
if ( !T || T->IsZombie() ) throw -16; |
| 2089 |
bobt = OBT(ph->GetOrbitalTime()); |
bobt = OBT(ph->GetOrbitalTime()); |
| 2090 |
firstev++; |
firstev++; |
| 2091 |
}; |
}; |
| 2092 |
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); |
| 2093 |
// |
// |
| 2094 |
glrun1->SetPKT_COUNTER(glrun->GetPKT_COUNTER()); |
glrun1->SetPKT_COUNTER(glrun->GetPKT_COUNTER()); |
| 2095 |
glrun1->SetPKT_READY_COUNTER(glrun->GetPKT_READY_COUNTER()); |
glrun1->SetPKT_READY_COUNTER(glrun->GetPKT_READY_COUNTER()); |
| 2272 |
ULong64_t aobt = OBT(glrun->GetRUNTRAILER_OBT()); |
ULong64_t aobt = OBT(glrun->GetRUNTRAILER_OBT()); |
| 2273 |
UInt_t bpkt = PKT(glrun1->GetRUNHEADER_PKT()); |
UInt_t bpkt = PKT(glrun1->GetRUNHEADER_PKT()); |
| 2274 |
ULong64_t bobt = OBT(glrun1->GetRUNHEADER_OBT()); |
ULong64_t bobt = OBT(glrun1->GetRUNHEADER_OBT()); |
| 2275 |
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); |
| 2276 |
TTree *T= 0; |
TTree *T= 0; |
| 2277 |
T = (TTree*)file->Get("Physics"); |
T = (TTree*)file->Get("Physics"); |
| 2278 |
if ( !T || T->IsZombie() ) throw -16; |
if ( !T || T->IsZombie() ) throw -16; |
| 2286 |
aobt = OBT(ph->GetOrbitalTime()); |
aobt = OBT(ph->GetOrbitalTime()); |
| 2287 |
lastev--; |
lastev--; |
| 2288 |
}; |
}; |
| 2289 |
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); |
| 2290 |
// |
// |
| 2291 |
glrun->SetEV_TO(lastev); |
glrun->SetEV_TO(lastev); |
| 2292 |
glrun->SetNEVENTS(lastev-firstev+1); |
glrun->SetNEVENTS(lastev-firstev+1); |
| 2893 |
fromtime = this->GetAbsTime(ph->GetOrbitalTime()); |
fromtime = this->GetAbsTime(ph->GetOrbitalTime()); |
| 2894 |
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) ){ |
| 2895 |
// |
// |
| 2896 |
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); |
| 2897 |
// |
// |
| 2898 |
// check if the calibration has already been inserted |
// check if the calibration has already been inserted |
| 2899 |
// |
// |
| 2938 |
// |
// |
| 2939 |
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); |
| 2940 |
if ( fromtime < 1150871000 ){ //1150866904 |
if ( fromtime < 1150871000 ){ //1150866904 |
| 2941 |
if ( IsDebug() ) printf(" First PAMELA flight calibration at time %i \n",fromtime); |
if ( IsDebug() ) printf(" First PAMELA flight calibration at time %u \n",fromtime); |
| 2942 |
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 |
| 2943 |
}; |
}; |
| 2944 |
// |
// |
| 3000 |
// |
// |
| 3001 |
} else { |
} else { |
| 3002 |
// |
// |
| 3003 |
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); |
| 3004 |
// |
// |
| 3005 |
}; |
}; |
| 3006 |
// |
// |
| 3218 |
// |
// |
| 3219 |
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) ){ |
| 3220 |
// |
// |
| 3221 |
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); |
| 3222 |
// |
// |
| 3223 |
valid = ValidateTrkCalib( caltrk1, eh1 ); |
valid = ValidateTrkCalib( caltrk1, eh1 ); |
| 3224 |
if ( IsDebug() ) cout << " pkt1 validation --> "<<valid<<endl; |
if ( IsDebug() ) cout << " pkt1 validation --> "<<valid<<endl; |
| 3261 |
// |
// |
| 3262 |
}; |
}; |
| 3263 |
// |
// |
| 3264 |
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); |
| 3265 |
// |
// |
| 3266 |
// The calibration is good |
// The calibration is good |
| 3267 |
// |
// |
| 3268 |
if ( this->PKT(pkt2) == this->PKT(pkt1)+1 ){ |
if ( this->PKT(pkt2) == this->PKT(pkt1)+1 ){ |
| 3269 |
// |
// |
| 3270 |
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); |
| 3271 |
// |
// |
| 3272 |
UInt_t valid2 = ValidateTrkCalib( caltrk2, eh2 ); |
UInt_t valid2 = ValidateTrkCalib( caltrk2, eh2 ); |
| 3273 |
if ( IsDebug() ) cout << " pkt2 validation --> "<<valid2<<endl; |
if ( IsDebug() ) cout << " pkt2 validation --> "<<valid2<<endl; |
| 3281 |
// |
// |
| 3282 |
if ( t2 != pret2+1 ){ |
if ( t2 != pret2+1 ){ |
| 3283 |
// |
// |
| 3284 |
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); |
| 3285 |
// |
// |
| 3286 |
while ( t2 > pret2+1 ){ |
while ( t2 > pret2+1 ){ |
| 3287 |
// |
// |
| 3310 |
// |
// |
| 3311 |
// Check for missing calibtrk2 |
// Check for missing calibtrk2 |
| 3312 |
// |
// |
| 3313 |
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); |
| 3314 |
t2 = pret2; |
t2 = pret2; |
| 3315 |
// |
// |
| 3316 |
// handle missing calib2 |
// handle missing calib2 |
| 3324 |
// |
// |
| 3325 |
} else { |
} else { |
| 3326 |
// |
// |
| 3327 |
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); |
| 3328 |
// |
// |
| 3329 |
}; |
}; |
| 3330 |
// |
// |
| 3349 |
valid = 0; |
valid = 0; |
| 3350 |
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) ){ |
| 3351 |
// |
// |
| 3352 |
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); |
| 3353 |
// |
// |
| 3354 |
this->HandleTRK_CALIB(false,true); |
this->HandleTRK_CALIB(false,true); |
| 3355 |
// |
// |
| 3403 |
fromtime = this->GetAbsTime(ph->GetOrbitalTime()); |
fromtime = this->GetAbsTime(ph->GetOrbitalTime()); |
| 3404 |
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) ){ |
| 3405 |
// |
// |
| 3406 |
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); |
| 3407 |
// |
// |
| 3408 |
// check if the calibration has already been inserted |
// check if the calibration has already been inserted |
| 3409 |
// |
// |
| 3446 |
// |
// |
| 3447 |
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"); |
| 3448 |
if ( fromtime < 1150871000 ){ |
if ( fromtime < 1150871000 ){ |
| 3449 |
if ( IsDebug() ) printf(" First PAMELA flight calibration at time %i \n",fromtime); |
if ( IsDebug() ) printf(" First PAMELA flight calibration at time %u \n",fromtime); |
| 3450 |
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 |
| 3451 |
}; |
}; |
| 3452 |
// |
// |
| 3505 |
// |
// |
| 3506 |
} else { |
} else { |
| 3507 |
// |
// |
| 3508 |
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); |
| 3509 |
// |
// |
| 3510 |
}; |
}; |
| 3511 |
// |
// |
| 3716 |
row = result->Next(); |
row = result->Next(); |
| 3717 |
t_stop = (UInt_t)atoll(row->GetField(4)); |
t_stop = (UInt_t)atoll(row->GetField(4)); |
| 3718 |
}; |
}; |
| 3719 |
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); |
| 3720 |
// -------------------------------------------------------------- |
// -------------------------------------------------------------- |
| 3721 |
// now retrieves runs to be validated |
// now retrieves runs to be validated |
| 3722 |
// -------------------------------------------------------------- |
// -------------------------------------------------------------- |
| 3887 |
}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); |
| 3888 |
}; |
}; |
| 3889 |
|
|
| 3890 |
if ( IsDebug() ) printf("%i Run %i \n",nrow,this_run->ID); |
if ( IsDebug() ) printf("%i Run %u \n",nrow,this_run->ID); |
| 3891 |
nrow++; |
nrow++; |
| 3892 |
|
|
| 3893 |
}; |
}; |
| 3916 |
// which should be equal to the time between ascending-nodes. |
// which should be equal to the time between ascending-nodes. |
| 3917 |
//============================================================== |
//============================================================== |
| 3918 |
if ( t2 - trkcalib->FROM_TIME > 5700) { |
if ( t2 - trkcalib->FROM_TIME > 5700) { |
| 3919 |
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); |
| 3920 |
//============================================================== |
//============================================================== |
| 3921 |
// there might be a missing calibration, due to: |
// there might be a missing calibration, due to: |
| 3922 |
// - MM full |
// - MM full |
| 3937 |
// it is enough to say that there are no missing calibrations |
// it is enough to say that there are no missing calibrations |
| 3938 |
//============================================================== |
//============================================================== |
| 3939 |
// the long time interval bewteen runs might be due to download |
// the long time interval bewteen runs might be due to download |
| 3940 |
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); |
| 3941 |
return(false); |
return(false); |
| 3942 |
|
|
| 3943 |
}; |
}; |
| 4253 |
}; |
}; |
| 4254 |
}; |
}; |
| 4255 |
}; |
}; |
| 4256 |
if ( IsDebug() ) printf(" %i runs have been unvalidated \n",unv); |
if ( IsDebug() ) printf(" %u runs have been unvalidated \n",unv); |
| 4257 |
}; |
}; |
| 4258 |
|
|
| 4259 |
/** |
/** |
| 4284 |
if ( IsDebug() ) printf(" Deleting run from GL_RUN table \n"); |
if ( IsDebug() ) printf(" Deleting run from GL_RUN table \n"); |
| 4285 |
while ( Row ){ |
while ( Row ){ |
| 4286 |
delrun->DeleteRun(conn,(UInt_t)atoll(Row->GetField(0)),"GL_RUN"); |
delrun->DeleteRun(conn,(UInt_t)atoll(Row->GetField(0)),"GL_RUN"); |
| 4287 |
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))); |
| 4288 |
drun++; |
drun++; |
| 4289 |
Row = pResult->Next(); |
Row = pResult->Next(); |
| 4290 |
}; |
}; |
| 4305 |
} else { |
} else { |
| 4306 |
if ( IsDebug() ) printf(" Deleting run fragments from GL_RUN table \n"); |
if ( IsDebug() ) printf(" Deleting run fragments from GL_RUN table \n"); |
| 4307 |
while ( Row ){ |
while ( Row ){ |
| 4308 |
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))); |
| 4309 |
delrun->RestoreRun(conn,(UInt_t)atoll(Row->GetField(1)),"GL_RUN_FRAGMENTS"); |
delrun->RestoreRun(conn,(UInt_t)atoll(Row->GetField(1)),"GL_RUN_FRAGMENTS"); |
| 4310 |
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))); |
| 4311 |
delrun->DeleteRun(conn,(UInt_t)atoll(Row->GetField(1)),"GL_RUN"); |
delrun->DeleteRun(conn,(UInt_t)atoll(Row->GetField(1)),"GL_RUN"); |
| 4312 |
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)) ){ |
| 4313 |
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))); |
| 4314 |
delrun->DeleteRun(conn,(UInt_t)atoll(Row->GetField(0)),"GL_RUN"); |
delrun->DeleteRun(conn,(UInt_t)atoll(Row->GetField(0)),"GL_RUN"); |
| 4315 |
}; |
}; |
| 4316 |
drun++; |
drun++; |
| 4336 |
} else { |
} else { |
| 4337 |
if ( IsDebug() ) printf(" Deleting run fragments from GL_RUN_TRASH table \n"); |
if ( IsDebug() ) printf(" Deleting run fragments from GL_RUN_TRASH table \n"); |
| 4338 |
while ( Row ){ |
while ( Row ){ |
| 4339 |
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))); |
| 4340 |
myquery.str(""); |
myquery.str(""); |
| 4341 |
myquery << " DELETE FROM GL_RUN_TRASH where ID_TRASH=" << Row->GetField(0) <<";"; |
myquery << " DELETE FROM GL_RUN_TRASH where ID_TRASH=" << Row->GetField(0) <<";"; |
| 4342 |
conn->Query(myquery.str().c_str()); |
conn->Query(myquery.str().c_str()); |
| 4345 |
}; |
}; |
| 4346 |
}; |
}; |
| 4347 |
// |
// |
| 4348 |
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); |
| 4349 |
// |
// |
| 4350 |
// |
// |
| 4351 |
// |
// |
| 4363 |
} else { |
} else { |
| 4364 |
if ( IsDebug() ) printf(" Deleting run fragments from GL_RUN_FRAGMENTS table \n"); |
if ( IsDebug() ) printf(" Deleting run fragments from GL_RUN_FRAGMENTS table \n"); |
| 4365 |
while ( Row ){ |
while ( Row ){ |
| 4366 |
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))); |
| 4367 |
myquery.str(""); |
myquery.str(""); |
| 4368 |
myquery << " DELETE FROM GL_RUN_FRAGMENTS where ID=" << Row->GetField(0) <<";"; |
myquery << " DELETE FROM GL_RUN_FRAGMENTS where ID=" << Row->GetField(0) <<";"; |
| 4369 |
conn->Query(myquery.str().c_str()); |
conn->Query(myquery.str().c_str()); |
| 4372 |
}; |
}; |
| 4373 |
}; |
}; |
| 4374 |
// |
// |
| 4375 |
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); |
| 4376 |
// |
// |
| 4377 |
// |
// |
| 4378 |
// |
// |
| 4684 |
TSQLRow *row = 0; |
TSQLRow *row = 0; |
| 4685 |
TSQLResult *result2 = 0; |
TSQLResult *result2 = 0; |
| 4686 |
TSQLRow *row2 = 0; |
TSQLRow *row2 = 0; |
| 4687 |
|
TSQLResult *result3 = 0; |
| 4688 |
|
TSQLRow *row3 = 0; |
| 4689 |
oss.str(""); |
oss.str(""); |
| 4690 |
oss << "SELECT ID,ID_ROOT_L0,RUNHEADER_TIME,RUNTRAILER_TIME FROM GL_RUN order by RUNHEADER_TIME asc;"; |
oss << "SELECT ID,ID_ROOT_L0,RUNHEADER_TIME,RUNTRAILER_TIME,NEVENTS FROM GL_RUN order by RUNHEADER_TIME asc;"; |
| 4691 |
// oss << "SELECT ID,RUNHEADER_TIME,RUNTRAILER_TIME FROM GL_RUN where ID>10170 and ID<10190 order by RUNHEADER_TIME asc;"; |
// oss << "SELECT ID,RUNHEADER_TIME,RUNTRAILER_TIME FROM GL_RUN where ID>10170 and ID<10190 order by RUNHEADER_TIME asc;"; |
| 4692 |
result = conn->Query(oss.str().c_str()); |
result = conn->Query(oss.str().c_str()); |
| 4693 |
// |
// |
| 4701 |
thisrht = (UInt_t)atoll(row->GetField(2)); |
thisrht = (UInt_t)atoll(row->GetField(2)); |
| 4702 |
thisrtt = (UInt_t)atoll(row->GetField(3)); |
thisrtt = (UInt_t)atoll(row->GetField(3)); |
| 4703 |
// |
// |
| 4704 |
|
if ( (UInt_t)atoll(row->GetField(4)) > 1 ){ |
| 4705 |
|
// |
| 4706 |
|
// |
| 4707 |
|
// |
| 4708 |
|
oss.str(""); |
| 4709 |
|
oss << "SELECT ID,ID_ROOT_L0,RUNHEADER_TIME,RUNTRAILER_TIME FROM GL_RUN WHERE ID!=" |
| 4710 |
|
<< thisid << " AND RUNHEADER_TIME=" |
| 4711 |
|
<< thisrht << " AND RUNTRAILER_TIME!=" |
| 4712 |
|
<< thisrtt << " AND NEVENTS!=0 AND NEVENTS!=1 order by RUNHEADER_TIME asc;"; |
| 4713 |
|
result3 = conn->Query(oss.str().c_str()); |
| 4714 |
|
if ( IsDebug() ) printf(" query is %s \n",oss.str().c_str()); |
| 4715 |
|
if ( result3 ){ |
| 4716 |
|
row3 = result3->Next(); |
| 4717 |
|
// |
| 4718 |
|
while ( row3 ){ |
| 4719 |
|
// |
| 4720 |
|
// 2 runs with same runheader |
| 4721 |
|
// |
| 4722 |
|
printf(" CHECK n.4 RUNs %u and %u HAVE SAME RUNHEADER \n",thisid,(UInt_t)atoll(row3->GetField(0))); |
| 4723 |
|
row3 = result3->Next(); |
| 4724 |
|
}; |
| 4725 |
|
}; |
| 4726 |
|
// |
| 4727 |
|
oss.str(""); |
| 4728 |
|
oss << "SELECT ID,ID_ROOT_L0,RUNHEADER_TIME,RUNTRAILER_TIME FROM GL_RUN WHERE ID!=" |
| 4729 |
|
<< thisid << " AND RUNHEADER_TIME!=" |
| 4730 |
|
<< thisrht << " AND RUNTRAILER_TIME=" |
| 4731 |
|
<< thisrtt << " AND NEVENTS!=0 AND NEVENTS!=1 order by RUNHEADER_TIME asc;"; |
| 4732 |
|
result3 = conn->Query(oss.str().c_str()); |
| 4733 |
|
if ( IsDebug() ) printf(" query is %s \n",oss.str().c_str()); |
| 4734 |
|
if ( result3 ){ |
| 4735 |
|
row3 = result3->Next(); |
| 4736 |
|
// |
| 4737 |
|
while ( row3 ){ |
| 4738 |
|
// |
| 4739 |
|
// 2 runs with same runtrailer |
| 4740 |
|
// |
| 4741 |
|
printf(" CHECK n.5 RUNs %u and %u HAVE SAME RUNTRAILER \n",thisid,(UInt_t)atoll(row3->GetField(0))); |
| 4742 |
|
row3 = result3->Next(); |
| 4743 |
|
}; |
| 4744 |
|
}; |
| 4745 |
|
// |
| 4746 |
|
oss.str(""); |
| 4747 |
|
oss << "SELECT ID,ID_ROOT_L0,RUNHEADER_TIME,RUNTRAILER_TIME FROM GL_RUN WHERE ID!=" |
| 4748 |
|
<< thisid << " AND RUNHEADER_TIME>" |
| 4749 |
|
<< thisrht << " AND RUNTRAILER_TIME<" |
| 4750 |
|
<< thisrtt << " order by RUNHEADER_TIME asc;"; |
| 4751 |
|
result3 = conn->Query(oss.str().c_str()); |
| 4752 |
|
if ( result3 ){ |
| 4753 |
|
row3 = result3->Next(); |
| 4754 |
|
// |
| 4755 |
|
while ( row3 ){ |
| 4756 |
|
// |
| 4757 |
|
// run contained in the checked one |
| 4758 |
|
// |
| 4759 |
|
printf(" CHECK n.6 RUN %u CONTAINS RUN %u \n",thisid,(UInt_t)atoll(row3->GetField(0))); |
| 4760 |
|
row3 = result3->Next(); |
| 4761 |
|
}; |
| 4762 |
|
}; |
| 4763 |
|
// |
| 4764 |
|
oss.str(""); |
| 4765 |
|
oss << "SELECT ID,ID_ROOT_L0,RUNHEADER_TIME,RUNTRAILER_TIME FROM GL_RUN WHERE ID!=" |
| 4766 |
|
<< thisid << " AND RUNHEADER_TIME=" |
| 4767 |
|
<< thisrht << " AND RUNTRAILER_TIME=" |
| 4768 |
|
<< thisrtt << " AND ID_RUN_FRAG!=" |
| 4769 |
|
<< thisid << " order by RUNHEADER_TIME asc;"; |
| 4770 |
|
result3 = conn->Query(oss.str().c_str()); |
| 4771 |
|
if ( result3 ){ |
| 4772 |
|
row3 = result3->Next(); |
| 4773 |
|
// |
| 4774 |
|
while ( row3 ){ |
| 4775 |
|
// |
| 4776 |
|
// duplicated run |
| 4777 |
|
// |
| 4778 |
|
printf(" CHECK n.7 RUNs %u and %u HAVE SAME RUNTRAILER AND RUNHEADER (ARE THE SAME?) \n",thisid,(UInt_t)atoll(row3->GetField(0))); |
| 4779 |
|
row3 = result3->Next(); |
| 4780 |
|
}; |
| 4781 |
|
}; |
| 4782 |
|
}; |
| 4783 |
|
// |
| 4784 |
// if ( thisrht < prevrtt || thisrtt < prevrht || thisrht > thisrtt && !(!prevrht && !prevrtt &&!previd) ){ |
// if ( thisrht < prevrtt || thisrtt < prevrht || thisrht > thisrtt && !(!prevrht && !prevrtt &&!previd) ){ |
| 4785 |
// if ( (thisrht < prevrtt || thisrtt < prevrht || thisrht > thisrtt) && (thisrht != prevrht) ){ |
// if ( (thisrht < prevrtt || thisrtt < prevrht || thisrht > thisrtt) && (thisrht != prevrht) ){ |
| 4786 |
if ( (thisrht < prevrtt) && (thisrht != prevrht) ){ |
if ( (thisrht < prevrtt) && (thisrht != prevrht) ){ |
| 4812 |
oss.str(""); |
oss.str(""); |
| 4813 |
oss << "SELECT NAME FROM GL_ROOT where ID=" << (UInt_t)prevl0id <<";"; |
oss << "SELECT NAME FROM GL_ROOT where ID=" << (UInt_t)prevl0id <<";"; |
| 4814 |
result2 = conn->Query(oss.str().c_str()); |
result2 = conn->Query(oss.str().c_str()); |
| 4815 |
if ( !result2 ) throw -4;; |
if ( !result2 ) throw -4; |
| 4816 |
row2 = result2->Next(); |
row2 = result2->Next(); |
| 4817 |
prevf = (TString)row2->GetField(0); |
prevf = (TString)row2->GetField(0); |
| 4818 |
oss.str(""); |
oss.str(""); |