| 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(""); |