| 101 |
if (INSERT_RAW) SetRawName(filerawname); |
if (INSERT_RAW) SetRawName(filerawname); |
| 102 |
// |
// |
| 103 |
INSERT_ROOT = !filerootname.IsNull(); |
INSERT_ROOT = !filerootname.IsNull(); |
| 104 |
|
if ( INSERT_ROOT ) this->SetRootName(filerootname); |
| 105 |
this->SetOrbitNo(dwinput); |
this->SetOrbitNo(dwinput); |
| 106 |
// |
// |
| 107 |
this->SetID_RAW(0); |
this->SetID_RAW(0); |
| 190 |
throw -85; |
throw -85; |
| 191 |
}; |
}; |
| 192 |
filerootname = chpath + chfile;// + ".root"; |
filerootname = chpath + chfile;// + ".root"; |
|
if ( debug ) printf(" chewbacca: filename is %s \n",filerootname.Data()); |
|
| 193 |
}; |
}; |
| 194 |
this->SetRootName(filerootname); |
this->SetRootName(filerootname); |
|
file = TFile::Open(this->GetRootName().Data()); |
|
|
} else { |
|
|
this->SetRootName(""); |
|
| 195 |
}; |
}; |
| 196 |
|
if ( debug ) printf(" Filename is %s \n",filerootname.Data()); |
| 197 |
|
file = TFile::Open(this->GetRootName().Data()); |
| 198 |
|
// } else { |
| 199 |
|
// this->SetRootName(""); |
| 200 |
|
// this->SetRootName(filerootname); |
| 201 |
|
// }; |
| 202 |
} |
} |
| 203 |
|
|
| 204 |
// |
// |
| 398 |
return; |
return; |
| 399 |
}; |
}; |
| 400 |
// |
// |
| 401 |
TString name = this->GetRootFile(); |
if ( !chewbacca ){ |
| 402 |
Int_t nlength = name.Length(); |
TString name = this->GetRootFile(); |
| 403 |
if ( nlength < 5 ) return; |
Int_t nlength = name.Length(); |
| 404 |
TString dwo = 0; |
if ( nlength < 5 ){ |
| 405 |
for (Int_t i = 0; i<5; i++){ |
if ( IsDebug() ) printf(" Agh problems determining the orbit number! name = %s \n",name.Data()); |
| 406 |
dwo.Append(name[i],1); |
return; |
| 407 |
}; |
}; |
| 408 |
if ( dwo.IsDigit() ){ |
TString dwo = 0; |
| 409 |
dworbit = (UInt_t)dwo.Atoi(); |
for (Int_t i = 0; i<5; i++){ |
|
} else { |
|
|
dwo=""; |
|
|
for (Int_t i = 8; i<13; i++){ |
|
| 410 |
dwo.Append(name[i],1); |
dwo.Append(name[i],1); |
| 411 |
}; |
}; |
| 412 |
if ( dwo.IsDigit() ) dworbit = (UInt_t)dwo.Atoi(); |
if ( dwo.IsDigit() ){ |
| 413 |
|
dworbit = (UInt_t)dwo.Atoi(); |
| 414 |
|
} else { |
| 415 |
|
dwo=""; |
| 416 |
|
for (Int_t i = 8; i<13; i++){ |
| 417 |
|
dwo.Append(name[i],1); |
| 418 |
|
}; |
| 419 |
|
if ( dwo.IsDigit() ) dworbit = (UInt_t)dwo.Atoi(); |
| 420 |
|
}; |
| 421 |
|
if ( IsDebug() ) printf(" Downlink orbit is %i (dwo = %s) \n",dworbit,dwo.Data()); |
| 422 |
}; |
}; |
|
if ( IsDebug() ) printf(" Downlink orbit is %i (dwo = %s) \n",dworbit,dwo.Data()); |
|
| 423 |
return; |
return; |
| 424 |
}; |
}; |
| 425 |
|
|
| 1585 |
result = conn->Query(oss.str().c_str()); |
result = conn->Query(oss.str().c_str()); |
| 1586 |
if ( !result ) throw -10; |
if ( !result ) throw -10; |
| 1587 |
row = result->Next(); |
row = result->Next(); |
| 1588 |
|
if ( !row ) throw -92; |
| 1589 |
idresof = (UInt_t)atoll(row->GetField(0)); |
idresof = (UInt_t)atoll(row->GetField(0)); |
| 1590 |
existsts = true; |
existsts = true; |
| 1591 |
goto eout; |
goto eout; |
| 2391 |
// if ( conptt+1 == (nrtev+nrtbef )){ |
// if ( conptt+1 == (nrtev+nrtbef )){ |
| 2392 |
if ( IsDebug() ) printf(" >>>>>>>>>>> %i %u %i %u \n",ptht,rhev,nrtev,conptt); |
if ( IsDebug() ) printf(" >>>>>>>>>>> %i %u %i %u \n",ptht,rhev,nrtev,conptt); |
| 2393 |
ptht++; |
ptht++; |
| 2394 |
if ( ptht < rhev ){ |
if ( ptht < rhev ){ |
| 2395 |
rh->GetEntry(ptht); |
rh->GetEntry(ptht); |
| 2396 |
//pth++; |
//pth++; |
| 2397 |
//if ( pth < rhev ){ |
//if ( pth < rhev ){ |
| 2419 |
if ( (UInt_t)evbeft < upperentry-1 && upperentry>0 ){ |
if ( (UInt_t)evbeft < upperentry-1 && upperentry>0 ){ |
| 2420 |
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); |
| 2421 |
// |
// |
| 2422 |
if ( (ptt-1) < 0 ) throw -15; // should never arrive here! |
// if ( (ptt-1) < 0 ) throw -15; // should never arrive here! |
| 2423 |
|
if ( (rtev-1) < 0 || ptt < 0 ) throw -15; // should never arrive here! |
| 2424 |
// rt->GetEntry(ptt-1); |
// rt->GetEntry(ptt-1); |
| 2425 |
rt->GetEntry(rtev-1); |
rt->GetEntry(rtev-1); |
| 2426 |
cod = eht->GetCounter(); |
cod = eht->GetCounter(); |
| 6092 |
// 2) get the OBT of the last validated run |
// 2) get the OBT of the last validated run |
| 6093 |
// -------------------------------------------------------------- |
// -------------------------------------------------------------- |
| 6094 |
oss.str(""); |
oss.str(""); |
| 6095 |
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 |
| 6096 |
|
oss << " SELECT * FROM GL_RUN WHERE VALIDATION>0 AND RUNHEADER_TIME<="<< t_start |
| 6097 |
<<" ORDER BY RUNHEADER_TIME DESC LIMIT 1;"; |
<<" ORDER BY RUNHEADER_TIME DESC LIMIT 1;"; |
| 6098 |
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()); |
| 6099 |
result = conn->Query(oss.str().c_str()); |
result = conn->Query(oss.str().c_str()); |
| 6236 |
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 |
| 6237 |
|
|
| 6238 |
if( !CHECK && this_run->VALIDATION ){ |
if( !CHECK && this_run->VALIDATION ){ |
| 6239 |
for (Int_t irun = 0; irun < nseq; irun++)assignVALIDATION(sequence[irun],true); |
// for (Int_t irun = 0; irun < nseq; irun++)assignVALIDATION(sequence[irun],true); |
| 6240 |
|
for (Int_t irun = 0; irun < nseq; irun++)assignVALIDATION(sequence[irun],this_run->VALIDATION); |
| 6241 |
nseq=0; |
nseq=0; |
| 6242 |
} |
} |
| 6243 |
|
|
| 6258 |
if( CHECK ){ |
if( CHECK ){ |
| 6259 |
// check if calibration exists |
// check if calibration exists |
| 6260 |
if ( IsDebug() )printf("DT %i ===> CHECK Missing calibration\n",interval); |
if ( IsDebug() )printf("DT %i ===> CHECK Missing calibration\n",interval); |
| 6261 |
Bool_t MISSING = MissingTRK_CALIB(t1,t2); |
// Bool_t MISSING = MissingTRK_CALIB(t1,t2); |
| 6262 |
for (Int_t irun = 0; irun < nseq; irun++)assignVALIDATION(sequence[irun],!MISSING); |
UInt_t MISSING = MissingTRK_CALIB(t1,t2); |
| 6263 |
|
UInt_t val = 0; |
| 6264 |
|
if ( MISSING == 1 ) val = 0; |
| 6265 |
|
if ( MISSING == 0 ) val = 1; |
| 6266 |
|
if ( MISSING == 2 ) val = 2; |
| 6267 |
|
for (Int_t irun = 0; irun < nseq; irun++)assignVALIDATION(sequence[irun],val); |
| 6268 |
nseq=0; |
nseq=0; |
| 6269 |
}; |
}; |
| 6270 |
//-------------- |
//-------------- |
| 6294 |
* @param t2 To absolute time |
* @param t2 To absolute time |
| 6295 |
* @return true if there might be a missing calibration |
* @return true if there might be a missing calibration |
| 6296 |
*/ |
*/ |
| 6297 |
Bool_t PamelaDBOperations::MissingTRK_CALIB(UInt_t t1,UInt_t t2){ |
//Bool_t PamelaDBOperations::MissingTRK_CALIB(UInt_t t1,UInt_t t2){ |
| 6298 |
|
UInt_t PamelaDBOperations::MissingTRK_CALIB(UInt_t t1,UInt_t t2){ |
| 6299 |
|
|
| 6300 |
GL_TRK_CALIB* trkcalib = new GL_TRK_CALIB(); |
GL_TRK_CALIB* trkcalib = new GL_TRK_CALIB(); |
| 6301 |
|
|
| 6302 |
// get the closest calibration before the run start (t2) |
// get the closest calibration before the run start (t2) |
| 6303 |
if ( trkcalib->Query_GL_TRK_CALIB(t2, conn) )return(true); //>>> missing |
// if ( trkcalib->Query_GL_TRK_CALIB(t2, conn) )return(true); //>>> missing |
| 6304 |
|
if ( trkcalib->Query_GL_TRK_CALIB(t2, conn) )return(1); //>>> missing |
| 6305 |
|
|
| 6306 |
if ( trkcalib->TO_TIME < t2 ) return(true); //>>> missing |
// if ( trkcalib->TO_TIME < t2 ) return(true); //>>> missing |
| 6307 |
|
if ( trkcalib->TO_TIME < t2 ) return(1); //>>> missing |
| 6308 |
|
|
| 6309 |
//============================================================== |
//============================================================== |
| 6310 |
// Check is done first on the basis of time between calibration, |
// Check is done first on the basis of time between calibration, |
| 6321 |
//============================================================== |
//============================================================== |
| 6322 |
Bool_t DOWNLOAD = false; |
Bool_t DOWNLOAD = false; |
| 6323 |
// check if the calib was skipped becouse of download .... DA FARE!! |
// check if the calib was skipped becouse of download .... DA FARE!! |
| 6324 |
if(DOWNLOAD)return(false); |
// if(DOWNLOAD)return(false); |
| 6325 |
|
if(DOWNLOAD)return(0); |
| 6326 |
|
|
| 6327 |
return(true); //>>> missing |
// return(true); //>>> missing |
| 6328 |
|
return(1); //>>> missing |
| 6329 |
|
|
| 6330 |
}; |
}; |
| 6331 |
|
|
| 6335 |
//============================================================== |
//============================================================== |
| 6336 |
// the long time interval bewteen runs might be due to download |
// the long time interval bewteen runs might be due to download |
| 6337 |
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); |
| 6338 |
return(false); |
if ( trkcalib->VALIDATION ) return(0); |
| 6339 |
|
if ( IsDebug() )printf("Calibration is not validated... :-/ ==> OK but with VALIDATION=2! \n"); |
| 6340 |
|
return(2); |
| 6341 |
|
|
| 6342 |
}; |
}; |
| 6343 |
/** |
/** |
| 6346 |
* @param validation true/false |
* @param validation true/false |
| 6347 |
*/ |
*/ |
| 6348 |
Int_t PamelaDBOperations::assignVALIDATION(UInt_t idrun, Bool_t validation){ |
Int_t PamelaDBOperations::assignVALIDATION(UInt_t idrun, Bool_t validation){ |
| 6349 |
|
return(this->assignVALIDATION(idrun,(UInt_t)validation)); |
| 6350 |
|
} |
| 6351 |
|
|
| 6352 |
|
Int_t PamelaDBOperations::assignVALIDATION(UInt_t idrun, UInt_t validation){ |
| 6353 |
TSQLResult *result = 0; |
TSQLResult *result = 0; |
| 6354 |
stringstream oss; |
stringstream oss; |
| 6355 |
oss.str(""); |
oss.str(""); |