660 |
UInt_t tjump = 50000; |
UInt_t tjump = 50000; |
661 |
//UInt_t tjump = 100; |
//UInt_t tjump = 100; |
662 |
while ( tjump > 0 ){ |
while ( tjump > 0 ){ |
663 |
pktlast = numeric_limits<UInt_t>::max(); |
// pktlast = numeric_limits<UInt_t>::max(); |
664 |
while ( pktlast > chpktmax && (Int_t)(nevent-1-it) >= 0 ){ |
pktlast = chpktmax + 1; |
665 |
|
while ( PKT(pktlast) > PKT(chpktmax) && (Int_t)(nevent-1-it) >= 0 ){ |
666 |
if ( (Int_t)(nevent-1-it) >= 0 ){ |
if ( (Int_t)(nevent-1-it) >= 0 ){ |
667 |
T->GetEntry(nevent-1-it); |
T->GetEntry(nevent-1-it); |
668 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
670 |
} else { |
} else { |
671 |
pktlast = chpktmax + 1; |
pktlast = chpktmax + 1; |
672 |
}; |
}; |
673 |
if ( (!(it%1000) || abs((int)pktlast - (int)chpktmax)<1000 ) && debug ) printf(" look for up %i %i %i nevent %u (nevent-1-it) %i \n",it,pktlast,chpktmax,nevent,(Int_t)(nevent-1-it)); |
if ( (!(it%1000) || abs((int)(PKT(pktlast) - PKT(chpktmax)))<1000 ) && debug ) printf(" look for up %i %i %i nevent %u (nevent-1-it) %i \n",it,pktlast,chpktmax,nevent,(Int_t)(nevent-1-it)); |
674 |
it += tjump; |
it += tjump; |
675 |
}; |
}; |
676 |
if ( tjump > 1 ) it -= 2*tjump; |
if ( tjump > 1 ) it -= 2*tjump; |
694 |
tjump = 50000; |
tjump = 50000; |
695 |
//tjump = 100; |
//tjump = 100; |
696 |
while ( tjump > 0 ){ |
while ( tjump > 0 ){ |
697 |
pktlast = 0; |
// pktlast = 0; |
698 |
while ( pktlast < chpktmin && it < (Int_t)nevent ){ |
pktlast = chpktmin - 1; |
699 |
|
if ( debug ) printf("LLlook for down %i %i %llu %llu \n",it,pktlast,PKT(pktlast),PKT(chpktmin)); |
700 |
|
while ( PKT(pktlast) < PKT(chpktmin) && it < (Int_t)nevent ){ |
701 |
if ( it < (Int_t)nevent ){ |
if ( it < (Int_t)nevent ){ |
702 |
T->GetEntry(it); |
T->GetEntry(it); |
703 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
2317 |
// |
// |
2318 |
this->HandleRunFragments(true,true,chminentry,(evbefh)); |
this->HandleRunFragments(true,true,chminentry,(evbefh)); |
2319 |
// |
// |
2320 |
|
// what about pth=ptht-1 |
2321 |
}; |
}; |
2322 |
}; |
}; |
2323 |
// |
// |
2380 |
// if ( ptt+1 == rtev){ |
// if ( ptt+1 == rtev){ |
2381 |
if ( conptt+1 == nrtev ){ |
if ( conptt+1 == nrtev ){ |
2382 |
// if ( conptt+1 == (nrtev+nrtbef )){ |
// if ( conptt+1 == (nrtev+nrtbef )){ |
2383 |
|
if ( IsDebug() ) printf(" >>>>>>>>>>> %i %u %i %u \n",ptht,rhev,nrtev,conptt); |
2384 |
ptht++; |
ptht++; |
2385 |
if ( ptht < rhev ){ |
if ( ptht < rhev ){ |
2386 |
rh->GetEntry(ptht); |
rh->GetEntry(ptht); |
2387 |
|
//pth++; |
2388 |
|
//if ( pth < rhev ){ |
2389 |
|
//rh->GetEntry(pth); |
2390 |
phh = ehh->GetPscuHeader(); |
phh = ehh->GetPscuHeader(); |
2391 |
pkth = phh->GetCounter(); |
pkth = phh->GetCounter(); |
2392 |
obth = phh->GetOrbitalTime(); |
obth = phh->GetOrbitalTime(); |
2411 |
if ( IsDebug() ) printf(" Piece of run at the end of the file with NO RUNHEADER! evbeft %u upperentry-1 %u \n",(UInt_t)evbeft,upperentry-1); |
if ( IsDebug() ) printf(" Piece of run at the end of the file with NO RUNHEADER! evbeft %u upperentry-1 %u \n",(UInt_t)evbeft,upperentry-1); |
2412 |
// |
// |
2413 |
if ( (ptt-1) < 0 ) throw -15; // should never arrive here! |
if ( (ptt-1) < 0 ) throw -15; // should never arrive here! |
2414 |
rt->GetEntry(ptt-1); |
// rt->GetEntry(ptt-1); |
2415 |
|
rt->GetEntry(rtev-1); |
2416 |
cod = eht->GetCounter(); |
cod = eht->GetCounter(); |
2417 |
tcod = (UInt_t)cod->Get(pctp->Physics); |
tcod = (UInt_t)cod->Get(pctp->Physics)+1; |
2418 |
evbefh = TMath::Max(chminentry,tcod); |
evbefh = TMath::Max(chminentry,tcod); |
2419 |
// evbefh = cod->Get(pctp->Physics); |
// evbefh = cod->Get(pctp->Physics); |
2420 |
rt->GetEntry(ptt); |
rt->GetEntry(ptt); |
3248 |
// |
// |
3249 |
} else { |
} else { |
3250 |
// |
// |
3251 |
if ( IsDebug() ) printf(" There are no-phyics packets inside the run!\n"); |
if ( IsDebug() ) printf(" There are no-physics packets inside the run!\n"); |
3252 |
// |
// |
3253 |
// HERE WE MUST HANDLE THAT RUNS AND GO BACK |
// HERE WE MUST HANDLE THAT RUNS AND GO BACK |
3254 |
// |
// |
3258 |
UInt_t check = 0; |
UInt_t check = 0; |
3259 |
UInt_t lastevtemp = lastev; |
UInt_t lastevtemp = lastev; |
3260 |
UInt_t firstevno = firstev; |
UInt_t firstevno = firstev; |
3261 |
|
UInt_t rhchko=0; |
3262 |
|
UInt_t rhchk=0; |
3263 |
// |
// |
3264 |
for (UInt_t i=firstev; i<=lastev; i++){ |
for (UInt_t i=firstev; i<=lastev; i++){ |
3265 |
// |
// |
3268 |
// |
// |
3269 |
check = 0; |
check = 0; |
3270 |
// |
// |
3271 |
|
|
3272 |
|
// if we have a runheader set lastev then exit |
3273 |
|
// |
3274 |
for(Iter = packetsNames.begin(); Iter != packetsNames.end(); Iter++){ |
for(Iter = packetsNames.begin(); Iter != packetsNames.end(); Iter++){ |
3275 |
if ( strcmp(*Iter,"Physics") ) check += code->Get(GetPacketType(*Iter)); |
if ( strcmp(*Iter,"Physics") ) check += code->Get(GetPacketType(*Iter)); |
3276 |
}; |
}; |
3277 |
|
// check here if we have a runheader |
3278 |
|
rhchko = rhchk; |
3279 |
|
rhchk = code->Get(GetPacketType("RunHeader")); |
3280 |
// |
// |
3281 |
if ( checkfirst < check || i == lastev ){ |
if ( checkfirst < check || i == lastev ){ |
3282 |
// |
// |
3693 |
// |
// |
3694 |
}; |
}; |
3695 |
// |
// |
3696 |
|
if ( i > firstev ){ |
3697 |
|
if ( rhchko != rhchk ){ |
3698 |
|
if ( IsDebug() ) printf("oh oh... we have a runheader! stop here and handle later the remaining piece\n"); |
3699 |
|
lastev = i; |
3700 |
|
return(false); |
3701 |
|
}; |
3702 |
|
}; |
3703 |
|
// |
3704 |
if ( check == checklast && i != lastev ){ |
if ( check == checklast && i != lastev ){ |
3705 |
lastevtemp = i - 1; |
lastevtemp = i - 1; |
3706 |
i = lastev - 1; |
i = lastev - 1; |
6518 |
stringstream myquery; |
stringstream myquery; |
6519 |
// |
// |
6520 |
myquery.str(""); |
myquery.str(""); |
6521 |
myquery << " SELECT ID, ID_RAW FROM GL_ROOT where NAME='"<<remfile.Data() <<"';"; |
myquery << " SELECT ID,ID_RAW,ID_TIMESYNC FROM GL_ROOT where NAME='"<<remfile.Data() <<"';"; |
6522 |
// |
// |
6523 |
pResult = conn->Query(myquery.str().c_str()); |
pResult = conn->Query(myquery.str().c_str()); |
6524 |
// |
// |
6534 |
// |
// |
6535 |
this->SetID_ROOT((UInt_t)atoll(Row->GetField(0))); |
this->SetID_ROOT((UInt_t)atoll(Row->GetField(0))); |
6536 |
this->SetID_RAW((UInt_t)atoll(Row->GetField(1))); |
this->SetID_RAW((UInt_t)atoll(Row->GetField(1))); |
6537 |
|
UInt_t idtsy=(UInt_t)atoll(Row->GetField(2)); |
6538 |
// |
// |
6539 |
this->ValidationOFF(); |
this->ValidationOFF(); |
6540 |
// |
// |
6542 |
// |
// |
6543 |
this->RemoveRUNS(); |
this->RemoveRUNS(); |
6544 |
// |
// |
6545 |
this->RemoveFILES(); |
this->RemoveFILES(idtsy); |
6546 |
// |
// |
6547 |
this->SetID_ROOT(0); |
this->SetID_ROOT(0); |
6548 |
this->SetID_RAW(0); |
this->SetID_RAW(0); |
6762 |
* Rearrange calibration tables |
* Rearrange calibration tables |
6763 |
* |
* |
6764 |
**/ |
**/ |
6765 |
void PamelaDBOperations::RemoveFILES(){ |
void PamelaDBOperations::RemoveFILES(UInt_t idtsy){ |
6766 |
stringstream myquery; |
stringstream myquery; |
6767 |
// |
// |
6768 |
myquery.str(""); |
myquery.str(""); |
6772 |
// |
// |
6773 |
conn->Query(myquery.str().c_str()); |
conn->Query(myquery.str().c_str()); |
6774 |
// |
// |
6775 |
|
myquery.str(""); |
6776 |
|
myquery << " DELETE FROM GL_ROOT WHERE ID=" <<this->GetID_ROOT() <<";"; |
6777 |
|
// |
6778 |
|
if ( IsDebug() ) printf(" query is \n %s \n",myquery.str().c_str()); |
6779 |
|
// |
6780 |
|
conn->Query(myquery.str().c_str()); // |
6781 |
|
// |
6782 |
|
if ( !chewbacca ){ |
6783 |
|
myquery.str(""); |
6784 |
|
myquery << " DELETE FROM GL_TIMESYNC WHERE ID=" << idtsy <<";"; |
6785 |
|
// |
6786 |
|
if ( IsDebug() ) printf(" query is \n %s \n",myquery.str().c_str()); |
6787 |
|
// |
6788 |
|
conn->Query(myquery.str().c_str()); |
6789 |
|
}; |
6790 |
|
// |
6791 |
}; |
}; |
6792 |
|
|
6793 |
/** |
/** |