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 |
|
|
1360 |
// |
// |
1361 |
// 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)); |
1362 |
// |
// |
1363 |
if ( obt < (pobtfirst/2) && pobtfirst > (numeric_limits<UInt_t>::max()/2) ){ |
if ( obt < ((Long64_t)pobtfirst/2) && pobtfirst > (numeric_limits<UInt_t>::max()/2) ){ |
1364 |
// 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()); |
1365 |
return((Long64_t)obt+(Long64_t)numeric_limits<UInt_t>::max()); |
return((Long64_t)obt+(Long64_t)numeric_limits<UInt_t>::max()); |
1366 |
}; |
}; |
6090 |
// 2) get the OBT of the last validated run |
// 2) get the OBT of the last validated run |
6091 |
// -------------------------------------------------------------- |
// -------------------------------------------------------------- |
6092 |
oss.str(""); |
oss.str(""); |
6093 |
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 |
6094 |
|
oss << " SELECT * FROM GL_RUN WHERE VALIDATION>0 AND RUNHEADER_TIME<="<< t_start |
6095 |
<<" ORDER BY RUNHEADER_TIME DESC LIMIT 1;"; |
<<" ORDER BY RUNHEADER_TIME DESC LIMIT 1;"; |
6096 |
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()); |
6097 |
result = conn->Query(oss.str().c_str()); |
result = conn->Query(oss.str().c_str()); |
6234 |
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 |
6235 |
|
|
6236 |
if( !CHECK && this_run->VALIDATION ){ |
if( !CHECK && this_run->VALIDATION ){ |
6237 |
for (Int_t irun = 0; irun < nseq; irun++)assignVALIDATION(sequence[irun],true); |
// for (Int_t irun = 0; irun < nseq; irun++)assignVALIDATION(sequence[irun],true); |
6238 |
|
for (Int_t irun = 0; irun < nseq; irun++)assignVALIDATION(sequence[irun],this_run->VALIDATION); |
6239 |
nseq=0; |
nseq=0; |
6240 |
} |
} |
6241 |
|
|
6256 |
if( CHECK ){ |
if( CHECK ){ |
6257 |
// check if calibration exists |
// check if calibration exists |
6258 |
if ( IsDebug() )printf("DT %i ===> CHECK Missing calibration\n",interval); |
if ( IsDebug() )printf("DT %i ===> CHECK Missing calibration\n",interval); |
6259 |
Bool_t MISSING = MissingTRK_CALIB(t1,t2); |
// Bool_t MISSING = MissingTRK_CALIB(t1,t2); |
6260 |
for (Int_t irun = 0; irun < nseq; irun++)assignVALIDATION(sequence[irun],!MISSING); |
UInt_t MISSING = MissingTRK_CALIB(t1,t2); |
6261 |
|
UInt_t val = 0; |
6262 |
|
if ( MISSING == 1 ) val = 0; |
6263 |
|
if ( MISSING == 0 ) val = 1; |
6264 |
|
if ( MISSING == 2 ) val = 2; |
6265 |
|
for (Int_t irun = 0; irun < nseq; irun++)assignVALIDATION(sequence[irun],val); |
6266 |
nseq=0; |
nseq=0; |
6267 |
}; |
}; |
6268 |
//-------------- |
//-------------- |
6292 |
* @param t2 To absolute time |
* @param t2 To absolute time |
6293 |
* @return true if there might be a missing calibration |
* @return true if there might be a missing calibration |
6294 |
*/ |
*/ |
6295 |
Bool_t PamelaDBOperations::MissingTRK_CALIB(UInt_t t1,UInt_t t2){ |
//Bool_t PamelaDBOperations::MissingTRK_CALIB(UInt_t t1,UInt_t t2){ |
6296 |
|
UInt_t PamelaDBOperations::MissingTRK_CALIB(UInt_t t1,UInt_t t2){ |
6297 |
|
|
6298 |
GL_TRK_CALIB* trkcalib = new GL_TRK_CALIB(); |
GL_TRK_CALIB* trkcalib = new GL_TRK_CALIB(); |
6299 |
|
|
6300 |
// get the closest calibration before the run start (t2) |
// get the closest calibration before the run start (t2) |
6301 |
if ( trkcalib->Query_GL_TRK_CALIB(t2, conn) )return(true); //>>> missing |
// if ( trkcalib->Query_GL_TRK_CALIB(t2, conn) )return(true); //>>> missing |
6302 |
|
if ( trkcalib->Query_GL_TRK_CALIB(t2, conn) )return(1); //>>> missing |
6303 |
|
|
6304 |
if ( trkcalib->TO_TIME < t2 ) return(true); //>>> missing |
// if ( trkcalib->TO_TIME < t2 ) return(true); //>>> missing |
6305 |
|
if ( trkcalib->TO_TIME < t2 ) return(1); //>>> missing |
6306 |
|
|
6307 |
//============================================================== |
//============================================================== |
6308 |
// Check is done first on the basis of time between calibration, |
// Check is done first on the basis of time between calibration, |
6319 |
//============================================================== |
//============================================================== |
6320 |
Bool_t DOWNLOAD = false; |
Bool_t DOWNLOAD = false; |
6321 |
// check if the calib was skipped becouse of download .... DA FARE!! |
// check if the calib was skipped becouse of download .... DA FARE!! |
6322 |
if(DOWNLOAD)return(false); |
// if(DOWNLOAD)return(false); |
6323 |
|
if(DOWNLOAD)return(0); |
6324 |
|
|
6325 |
return(true); //>>> missing |
// return(true); //>>> missing |
6326 |
|
return(1); //>>> missing |
6327 |
|
|
6328 |
}; |
}; |
6329 |
|
|
6333 |
//============================================================== |
//============================================================== |
6334 |
// the long time interval bewteen runs might be due to download |
// the long time interval bewteen runs might be due to download |
6335 |
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); |
6336 |
return(false); |
if ( trkcalib->VALIDATION ) return(0); |
6337 |
|
if ( IsDebug() )printf("Calibration is not validated... :-/ ==> OK but with VALIDATION=2! \n"); |
6338 |
|
return(2); |
6339 |
|
|
6340 |
}; |
}; |
6341 |
/** |
/** |
6344 |
* @param validation true/false |
* @param validation true/false |
6345 |
*/ |
*/ |
6346 |
Int_t PamelaDBOperations::assignVALIDATION(UInt_t idrun, Bool_t validation){ |
Int_t PamelaDBOperations::assignVALIDATION(UInt_t idrun, Bool_t validation){ |
6347 |
|
return(this->assignVALIDATION(idrun,(UInt_t)validation)); |
6348 |
|
} |
6349 |
|
|
6350 |
|
Int_t PamelaDBOperations::assignVALIDATION(UInt_t idrun, UInt_t validation){ |
6351 |
TSQLResult *result = 0; |
TSQLResult *result = 0; |
6352 |
stringstream oss; |
stringstream oss; |
6353 |
oss.str(""); |
oss.str(""); |