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(); |
1352 |
// |
// |
1353 |
// 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)); |
// 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)); |
1354 |
// |
// |
1355 |
if ( obt < (pobtfirst/2) && pobtfirst > (numeric_limits<UInt_t>::max()/2) ){ |
if ( obt < ((Long64_t)pobtfirst/2) && pobtfirst > (numeric_limits<UInt_t>::max()/2) ){ |
1356 |
// if ( IsDebug() ) printf(" rise up obt %lld \n",(Long64_t)obt+(Long64_t)numeric_limits<UInt_t>::max()); |
// if ( IsDebug() ) printf(" rise up obt %lld \n",(Long64_t)obt+(Long64_t)numeric_limits<UInt_t>::max()); |
1357 |
return((Long64_t)obt+(Long64_t)numeric_limits<UInt_t>::max()); |
return((Long64_t)obt+(Long64_t)numeric_limits<UInt_t>::max()); |
1358 |
}; |
}; |
1941 |
glroot.PATH = "$PAM_L0"; |
glroot.PATH = "$PAM_L0"; |
1942 |
}; |
}; |
1943 |
}; |
}; |
1944 |
// glroot.NAME = GetRootFile(); |
glroot.NAME = GetRootFile(); |
1945 |
|
|
1946 |
if ( insertPamelaRootFile(&glroot) )return 1; |
if ( insertPamelaRootFile(&glroot) )return 1; |
1947 |
|
|
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; |
4917 |
// |
// |
4918 |
}; |
}; |
4919 |
// |
// |
4920 |
|
|
4921 |
|
if( !(MISSING_pkt1&MISSING_pkt2) ){ |
4922 |
|
this->HandleTRK_CALIB(!MISSING_pkt1,!MISSING_pkt2); |
4923 |
|
ncalib++; |
4924 |
|
if( MISSING_pkt1||MISSING_pkt2||!valid )try_to_recover=true; |
4925 |
|
} |
4926 |
|
|
4927 |
|
|
4928 |
} else { |
} else { |
4929 |
// |
// |
4930 |
if ( IsDebug() ) printf(" Trk calibration1 at time %u obt %u pkt %u OUTSIDE the considered time interval \n",fromtime,obt1,pkt1); |
if ( IsDebug() ) printf(" Trk calibration1 at time %u obt %u pkt %u OUTSIDE the considered time interval \n",fromtime,obt1,pkt1); |
4931 |
// if ( PEDANTIC ) throw -79; |
// if ( PEDANTIC ) throw -79; |
4932 |
// |
// |
4933 |
}; |
}; |
4934 |
// |
// |
4935 |
|
|
|
if( !(MISSING_pkt1&MISSING_pkt2) ){ |
|
|
this->HandleTRK_CALIB(!MISSING_pkt1,!MISSING_pkt2); |
|
|
ncalib++; |
|
|
if( MISSING_pkt1||MISSING_pkt2||!valid )try_to_recover=true; |
|
|
} |
|
|
|
|
4936 |
}; //end loop on pkt1 |
}; //end loop on pkt1 |
4937 |
|
|
4938 |
|
|
5157 |
// ------------------------------------------------------ |
// ------------------------------------------------------ |
5158 |
// ... retrieve the calibration packets. |
// ... retrieve the calibration packets. |
5159 |
// ------------------------------------------------------ |
// ------------------------------------------------------ |
5160 |
TFile *file = new TFile((TString)gSystem->ExpandPathName(path)+"/"+name); // EM, path could be symbolic and we must expand it |
if ( IsDebug() ) printf(" file is %s/%s \n",((TString)gSystem->ExpandPathName(path.Data())).Data(),name.Data()); |
5161 |
|
TFile *file = new TFile(((TString)gSystem->ExpandPathName(path.Data()))+"/"+name); // EM, path could be symbolic and we must expand it |
5162 |
if(!file)throw -100; |
if(!file)throw -100; |
5163 |
if(file->IsZombie())throw -100; |
if(file->IsZombie())throw -100; |
5164 |
// |
// |
6082 |
// 2) get the OBT of the last validated run |
// 2) get the OBT of the last validated run |
6083 |
// -------------------------------------------------------------- |
// -------------------------------------------------------------- |
6084 |
oss.str(""); |
oss.str(""); |
6085 |
oss << " SELECT * FROM GL_RUN WHERE VALIDATION=1 AND RUNHEADER_TIME<="<< t_start |
// oss << " SELECT * FROM GL_RUN WHERE VALIDATION=1 AND RUNHEADER_TIME<="<< t_start |
6086 |
|
oss << " SELECT * FROM GL_RUN WHERE VALIDATION>0 AND RUNHEADER_TIME<="<< t_start |
6087 |
<<" ORDER BY RUNHEADER_TIME DESC LIMIT 1;"; |
<<" ORDER BY RUNHEADER_TIME DESC LIMIT 1;"; |
6088 |
if ( IsDebug() ) printf(" Get stop validation-time: query is \n %s \n",oss.str().c_str()); |
if ( IsDebug() ) printf(" Get stop validation-time: query is \n %s \n",oss.str().c_str()); |
6089 |
result = conn->Query(oss.str().c_str()); |
result = conn->Query(oss.str().c_str()); |
6226 |
if( interval >= calibtime )CHECK = true; //more than calibtime s => there might be a calibration |
if( interval >= calibtime )CHECK = true; //more than calibtime s => there might be a calibration |
6227 |
|
|
6228 |
if( !CHECK && this_run->VALIDATION ){ |
if( !CHECK && this_run->VALIDATION ){ |
6229 |
for (Int_t irun = 0; irun < nseq; irun++)assignVALIDATION(sequence[irun],true); |
// for (Int_t irun = 0; irun < nseq; irun++)assignVALIDATION(sequence[irun],true); |
6230 |
|
for (Int_t irun = 0; irun < nseq; irun++)assignVALIDATION(sequence[irun],this_run->VALIDATION); |
6231 |
nseq=0; |
nseq=0; |
6232 |
} |
} |
6233 |
|
|
6248 |
if( CHECK ){ |
if( CHECK ){ |
6249 |
// check if calibration exists |
// check if calibration exists |
6250 |
if ( IsDebug() )printf("DT %i ===> CHECK Missing calibration\n",interval); |
if ( IsDebug() )printf("DT %i ===> CHECK Missing calibration\n",interval); |
6251 |
Bool_t MISSING = MissingTRK_CALIB(t1,t2); |
// Bool_t MISSING = MissingTRK_CALIB(t1,t2); |
6252 |
for (Int_t irun = 0; irun < nseq; irun++)assignVALIDATION(sequence[irun],!MISSING); |
UInt_t MISSING = MissingTRK_CALIB(t1,t2); |
6253 |
|
UInt_t val = 0; |
6254 |
|
if ( MISSING == 1 ) val = 0; |
6255 |
|
if ( MISSING == 0 ) val = 1; |
6256 |
|
if ( MISSING == 2 ) val = 2; |
6257 |
|
for (Int_t irun = 0; irun < nseq; irun++)assignVALIDATION(sequence[irun],val); |
6258 |
nseq=0; |
nseq=0; |
6259 |
}; |
}; |
6260 |
//-------------- |
//-------------- |
6284 |
* @param t2 To absolute time |
* @param t2 To absolute time |
6285 |
* @return true if there might be a missing calibration |
* @return true if there might be a missing calibration |
6286 |
*/ |
*/ |
6287 |
Bool_t PamelaDBOperations::MissingTRK_CALIB(UInt_t t1,UInt_t t2){ |
//Bool_t PamelaDBOperations::MissingTRK_CALIB(UInt_t t1,UInt_t t2){ |
6288 |
|
UInt_t PamelaDBOperations::MissingTRK_CALIB(UInt_t t1,UInt_t t2){ |
6289 |
|
|
6290 |
GL_TRK_CALIB* trkcalib = new GL_TRK_CALIB(); |
GL_TRK_CALIB* trkcalib = new GL_TRK_CALIB(); |
6291 |
|
|
6292 |
// get the closest calibration before the run start (t2) |
// get the closest calibration before the run start (t2) |
6293 |
if ( trkcalib->Query_GL_TRK_CALIB(t2, conn) )return(true); //>>> missing |
// if ( trkcalib->Query_GL_TRK_CALIB(t2, conn) )return(true); //>>> missing |
6294 |
|
if ( trkcalib->Query_GL_TRK_CALIB(t2, conn) )return(1); //>>> missing |
6295 |
|
|
6296 |
if ( trkcalib->TO_TIME < t2 ) return(true); //>>> missing |
// if ( trkcalib->TO_TIME < t2 ) return(true); //>>> missing |
6297 |
|
if ( trkcalib->TO_TIME < t2 ) return(1); //>>> missing |
6298 |
|
|
6299 |
//============================================================== |
//============================================================== |
6300 |
// Check is done first on the basis of time between calibration, |
// Check is done first on the basis of time between calibration, |
6311 |
//============================================================== |
//============================================================== |
6312 |
Bool_t DOWNLOAD = false; |
Bool_t DOWNLOAD = false; |
6313 |
// check if the calib was skipped becouse of download .... DA FARE!! |
// check if the calib was skipped becouse of download .... DA FARE!! |
6314 |
if(DOWNLOAD)return(false); |
// if(DOWNLOAD)return(false); |
6315 |
|
if(DOWNLOAD)return(0); |
6316 |
|
|
6317 |
return(true); //>>> missing |
// return(true); //>>> missing |
6318 |
|
return(1); //>>> missing |
6319 |
|
|
6320 |
}; |
}; |
6321 |
|
|
6325 |
//============================================================== |
//============================================================== |
6326 |
// the long time interval bewteen runs might be due to download |
// the long time interval bewteen runs might be due to download |
6327 |
if ( IsDebug() )printf("Short time between calib and run start %u :-) ==> OK! \n",t2 - trkcalib->FROM_TIME); |
if ( IsDebug() )printf("Short time between calib and run start %u :-) ==> OK! \n",t2 - trkcalib->FROM_TIME); |
6328 |
return(false); |
if ( trkcalib->VALIDATION ) return(0); |
6329 |
|
if ( IsDebug() )printf("Calibration is not validated... :-/ ==> OK but with VALIDATION=2! \n"); |
6330 |
|
return(2); |
6331 |
|
|
6332 |
}; |
}; |
6333 |
/** |
/** |
6336 |
* @param validation true/false |
* @param validation true/false |
6337 |
*/ |
*/ |
6338 |
Int_t PamelaDBOperations::assignVALIDATION(UInt_t idrun, Bool_t validation){ |
Int_t PamelaDBOperations::assignVALIDATION(UInt_t idrun, Bool_t validation){ |
6339 |
|
return(this->assignVALIDATION(idrun,(UInt_t)validation)); |
6340 |
|
} |
6341 |
|
|
6342 |
|
Int_t PamelaDBOperations::assignVALIDATION(UInt_t idrun, UInt_t validation){ |
6343 |
TSQLResult *result = 0; |
TSQLResult *result = 0; |
6344 |
stringstream oss; |
stringstream oss; |
6345 |
oss.str(""); |
oss.str(""); |
6536 |
stringstream myquery; |
stringstream myquery; |
6537 |
// |
// |
6538 |
myquery.str(""); |
myquery.str(""); |
6539 |
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() <<"';"; |
6540 |
// |
// |
6541 |
pResult = conn->Query(myquery.str().c_str()); |
pResult = conn->Query(myquery.str().c_str()); |
6542 |
// |
// |
6552 |
// |
// |
6553 |
this->SetID_ROOT((UInt_t)atoll(Row->GetField(0))); |
this->SetID_ROOT((UInt_t)atoll(Row->GetField(0))); |
6554 |
this->SetID_RAW((UInt_t)atoll(Row->GetField(1))); |
this->SetID_RAW((UInt_t)atoll(Row->GetField(1))); |
6555 |
|
UInt_t idtsy=(UInt_t)atoll(Row->GetField(2)); |
6556 |
// |
// |
6557 |
this->ValidationOFF(); |
this->ValidationOFF(); |
6558 |
// |
// |
6560 |
// |
// |
6561 |
this->RemoveRUNS(); |
this->RemoveRUNS(); |
6562 |
// |
// |
6563 |
this->RemoveFILES(); |
this->RemoveFILES(idtsy); |
6564 |
// |
// |
6565 |
this->SetID_ROOT(0); |
this->SetID_ROOT(0); |
6566 |
this->SetID_RAW(0); |
this->SetID_RAW(0); |
6780 |
* Rearrange calibration tables |
* Rearrange calibration tables |
6781 |
* |
* |
6782 |
**/ |
**/ |
6783 |
void PamelaDBOperations::RemoveFILES(){ |
void PamelaDBOperations::RemoveFILES(UInt_t idtsy){ |
6784 |
stringstream myquery; |
stringstream myquery; |
6785 |
// |
// |
6786 |
myquery.str(""); |
myquery.str(""); |
6790 |
// |
// |
6791 |
conn->Query(myquery.str().c_str()); |
conn->Query(myquery.str().c_str()); |
6792 |
// |
// |
6793 |
|
myquery.str(""); |
6794 |
|
myquery << " DELETE FROM GL_ROOT WHERE ID=" <<this->GetID_ROOT() <<";"; |
6795 |
|
// |
6796 |
|
if ( IsDebug() ) printf(" query is \n %s \n",myquery.str().c_str()); |
6797 |
|
// |
6798 |
|
conn->Query(myquery.str().c_str()); // |
6799 |
|
// |
6800 |
|
if ( !chewbacca ){ |
6801 |
|
myquery.str(""); |
6802 |
|
myquery << " DELETE FROM GL_TIMESYNC WHERE ID=" << idtsy <<";"; |
6803 |
|
// |
6804 |
|
if ( IsDebug() ) printf(" query is \n %s \n",myquery.str().c_str()); |
6805 |
|
// |
6806 |
|
conn->Query(myquery.str().c_str()); |
6807 |
|
}; |
6808 |
|
// |
6809 |
}; |
}; |
6810 |
|
|
6811 |
/** |
/** |
7155 |
|
|
7156 |
|
|
7157 |
} |
} |
|
// UInt_t PamelaDBOperations::ValidateTrkCalib( CalibTrk1Event* caltrk, EventHeader *eh ){ |
|
|
|
|
|
// if(!caltrk || !eh) return 0; |
|
|
|
|
|
// Int_t vorder[]={5,5,3,3,4,4,2,2,1,1,0,0}; |
|
|
// UInt_t timeaftercalib=120000; //2000; |
|
|
// // ---------- |
|
|
// // Check CRCs |
|
|
// // ---------- |
|
|
// for(Int_t ipkt=0; ipkt<6; ipkt++){ |
|
|
// if( caltrk->crc_hcal[ipkt] )return 0; // :-( |
|
|
// for(Int_t ilad=0; ilad<3; ilad++)if( caltrk->crc_cal[ipkt][ilad] )return 0; // :-( |
|
|
// } |
|
|
// // ----------------------- |
|
|
// // Check missing packets: |
|
|
// // ----------------------- |
|
|
// // Readout order: |
|
|
// // ------------------ |
|
|
// // DSP packet board |
|
|
// // ------------------ |
|
|
// // 12 0 1 |
|
|
// // 10 1 1 |
|
|
// // 8 2 1 |
|
|
// // 4 3 1 |
|
|
// // 6 4 1 |
|
|
// // 2 5 1 |
|
|
// // ------------------ |
|
|
// // 11 0 2 |
|
|
// // 9 1 2 |
|
|
// // 7 2 2 |
|
|
// // 3 3 2 |
|
|
// // 5 4 2 |
|
|
// // 1 5 2 |
|
|
// // ------------------ |
|
|
// // ------------------------------------------------- |
|
|
// // Check if it is first or second calibration packet |
|
|
// // ------------------------------------------------- |
|
|
// UInt_t build=0; |
|
|
// TString classname = caltrk->GetName(); |
|
|
// UInt_t base=0; |
|
|
// UInt_t mask=0; |
|
|
// if(classname.Contains("CalibTrk1Event")){ |
|
|
// base=12; |
|
|
// mask=0x03F000; |
|
|
// } |
|
|
// if(classname.Contains("CalibTrk2Event")){ |
|
|
// base=18; |
|
|
// mask=0xFC0000; |
|
|
// } |
|
|
// // ------------------------------------------------- |
|
|
// // Count number of packets and set build variable |
|
|
// // ------------------------------------------------- |
|
|
// Int_t npkts=0; |
|
|
// for(Int_t ipkt=0; ipkt<6; ipkt++){ |
|
|
// if(caltrk->DSPnumber[ipkt]>0 && caltrk->DSPnumber[ipkt]<=12){ |
|
|
// npkts++; |
|
|
// build = build | ( 1<<(base+vorder[caltrk->DSPnumber[ipkt]-1]) ); |
|
|
// } |
|
|
// } |
|
|
// // if( npkts==6 )return 1; // :-) |
|
|
|
|
|
// // cout << classname << " "<<eh->GetPscuHeader()->GetOrbitalTime()<<endl; |
|
|
|
|
|
// // ----------------------------------------------- |
|
|
// // If missing packets: check the acq configuration |
|
|
// // (some DSPs might be excluded from acquisition) |
|
|
// // ----------------------------------------------- |
|
|
|
|
|
// // ----------------------------------------------- |
|
|
// // retrieve the first run header after calib |
|
|
// // ----------------------------------------------- |
|
|
// PacketType *pctp; |
|
|
// EventCounter *cod; |
|
|
// cod = eh->GetCounter(); |
|
|
// Int_t irun = cod->Get(pctp->RunHeader); |
|
|
// TTree *rh=(TTree*)file->Get("RunHeader"); |
|
|
// if ( !rh || rh->IsZombie() ) throw -17; |
|
|
// if( rh->GetEntries() == irun ){ |
|
|
// if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) no runs after calib (1) -- cannot validate :-( "<<endl; |
|
|
// return 0; // :-( |
|
|
// } |
|
|
|
|
|
// RunHeaderEvent *run = 0; |
|
|
// EventHeader *hrun = 0; |
|
|
// rh->SetBranchAddress("RunHeader", &run); |
|
|
// rh->SetBranchAddress("Header", &hrun); |
|
|
// rh->GetEntry(irun); |
|
|
// // cout << classname << " "<<eh->GetPscuHeader()->GetOrbitalTime() << " Run " << hrun->GetPscuHeader()->GetOrbitalTime() <<endl; |
|
|
|
|
|
// if( OBT(hrun->GetPscuHeader()->GetOrbitalTime()) < OBT(eh->GetPscuHeader()->GetOrbitalTime())){ |
|
|
// if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) no runs after calib (2) -- cannot validate :-( "<<endl; |
|
|
// return 0; // :-( |
|
|
// } |
|
|
|
|
|
// if( !run->RM_ACQ_AFTER_CALIB ){ |
|
|
// if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) RM_ACQ_AFTER_CALIB=0 -- cannot validate :-( "<<endl; |
|
|
// return 0; // :-( |
|
|
// } |
|
|
|
|
|
// UInt_t dtime = OBT(hrun->GetPscuHeader()->GetOrbitalTime()) - OBT(eh->GetPscuHeader()->GetOrbitalTime()); |
|
|
// if( dtime > timeaftercalib ){ |
|
|
// if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) run after calib too far ( "<<dtime<<"ms ) -- cannot validate :-( "<<endl; |
|
|
// return 0; // :-( |
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
// if( (run->ACQ_BUILD_INFO & mask) != build ){ |
|
|
// if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) ACQ_BUILD_INFO= >>> "<<hex << (run->ACQ_BUILD_INFO&mask) << " != "<< build << dec<<endl; |
|
|
// return 0; // :-( |
|
|
// } |
|
|
// return 1; // :-) |
|
|
|
|
|
// } |
|
7158 |
|
|
7159 |
/** |
/** |
7160 |
* |
* |