25                  ISvcLocator* pSvcLocator) :
 
   29   , m_TBPhaseKey(
"TBPhase")
 
   30   , m_neverReturnFailure(false)
 
   59   float default_tdc2time = 0.050*
ns;
 
   60   float default_tdcwac   = 0.;
 
   61   float default_tdcMin   = 0.;
 
   66     return StatusCode::FAILURE ;
 
   78       ATH_MSG_FATAL ( 
"Nunber of TDCs not equal to nunber of tdc2time constants" );
 
   79       return StatusCode::FAILURE ;
 
   92       ATH_MSG_FATAL ( 
"Nunber of TDCs not equal to nuunber of wac constants" );
 
   93       return StatusCode::FAILURE ;
 
  106       ATH_MSG_FATAL ( 
"Nunber of TDCs not equal to nuunber of tdcMin constants" );
 
  107       return StatusCode::FAILURE ;
 
  112     ( 
"TTCClockPeriod = " << 
m_delta/
ns << 
" ns" );
 
  127   return StatusCode::SUCCESS ;
 
  133   const EventContext& ctx = Gaudi::Hive::currentContext();
 
  136   unsigned int thisrun=ctx.eventID().run_number();
 
  142         setFilterPassed(
false);
 
  143         return StatusCode::SUCCESS;
 
  149   if (
sc.isFailure()) {
 
  150     ATH_MSG_ERROR ( 
"TBObjectReco: Retrieval of TDCRawCont failed" );
 
  152        setFilterPassed(
false);
 
  154     return StatusCode::SUCCESS;
 
  157   std::vector<float> tdcQuality;
 
  158   std::vector<float> tdcdTtoWAC;
 
  159   tdcQuality.resize(
m_nTDC);
 
  160   tdcdTtoWAC.resize(
m_nTDC);
 
  170   int tdcFoundAndOK = 0;
 
  171   for (
const TBTDCRaw* tdcRaw : *tdcRawCont) {
 
  172     std::string tdcName = tdcRaw->getDetectorName();
 
  174     for (; tdcIndex < 
m_nTDC; tdcIndex++) {
 
  181       m_tdcRaw[tdcIndex] = tdcRaw->getTDC();
 
  183       if (
m_tdcRaw[tdcIndex] <= 0 || tdcRaw->isOverflow() || tdcRaw->isUnderThreshold()) {
 
  187         if (tdcRaw->isOverflow()) 
 
  189         if (tdcRaw->isUnderThreshold()) 
 
  190           ATH_MSG_DEBUG ( 
"Bad TDC" << tdcIndex << 
" is underthreshold" );
 
  200         float dTotdcMax = fabs(
m_tdcRaw[tdcIndex] - tdcMax);
 
  202         float dtemp = (dTotdcMin < dTotdcMax) ? dTotdcMin : dTotdcMax;
 
  203         tdcQuality[tdcIndex] = (dtemp < dTotdcwac) ? dtemp : dTotdcwac;
 
  207           ( 
"TDC" << tdcIndex << 
" value = " << 
m_tdcRaw[tdcIndex]
 
  209             << 
": to tdcMin = " << dTotdcMin
 
  210             << 
"; to tdcMax = " << dTotdcMax
 
  211             << 
"; to tdcwac = " << dTotdcwac
 
  212             << 
"; final = " << tdcQuality[tdcIndex] );
 
  218           ( 
"TDC" << tdcIndex << 
" value = " << 
m_tdcRaw[tdcIndex]
 
  219             << 
"; reconstructed phase = " << 
m_phaseReco[tdcIndex]/
ns << 
" ns" 
  223       if (tdcFound == 
m_nTDC) break ; 
 
  227   if (tdcFound == 0 || tdcFoundAndOK == 0) {
 
  232     if ( checkOut.isFailure() )
 
  234     ATH_MSG_ERROR ( 
"cannot retrieve TBEventInfo from StoreGate" );
 
  235         setFilterPassed(
false);
 
  236     return StatusCode::SUCCESS;
 
  247       float tdc_to_wac = 100.;
 
  250       if (
sc.isFailure( )) {
 
  252         setFilterPassed(
false); 
 
  253         return StatusCode::SUCCESS;
 
  255       return StatusCode::SUCCESS;
 
  263        setFilterPassed(
false);
 
  265     return StatusCode::SUCCESS;
 
  269       ATH_MSG_WARNING ( 
"not all the requested TDCs were found in StoreGate" );
 
  276   int tdcBestIndex = 0;
 
  279     if (tdcQuality[
k] > QMax) {
 
  280       QMax = tdcQuality[
k];
 
  287     ( 
"best quality for TDC" << tdcBestIndex
 
  288       << 
", with reconstructed phase = " << bestPhase/
ns << 
" ns" );
 
  292   int timeSampleShift = (
int)floor(bestPhase/
m_delta);
 
  293   if (timeSampleShift != 0) {
 
  295       ( 
"TBPhaseRec time sample shift non zero: " << timeSampleShift );
 
  303   if (phaseInd < 0 || phaseInd > 
m_timeBins - 1) {
 
  305       ( 
"Phase " << 
phase/
ns << 
" ns " 
  306         << 
"has phase index " << phaseInd 
 
  307         << 
" outside of the bounds [0," << 
m_timeBins-1 << 
"]" );
 
  309        setFilterPassed(
false);
 
  311     return StatusCode::SUCCESS;
 
  317       ( 
"Phase " << 
phase/
ns << 
" ns " 
  318         << 
"has TDC-WAC " << tdcdTtoWAC[tdcBestIndex]
 
  319         << 
" inside the guard region [0," << 
m_guardValue  << 
"]" );
 
  321        setFilterPassed(
false);
 
  323     return StatusCode::SUCCESS;
 
  327     ( 
"Phase = " << 
phase/
ns << 
" ns; " 
  328       << 
"phase index = " << phaseInd );
 
  335   if (
sc.isFailure( )) {
 
  337     setFilterPassed(
false);  
 
  338     return StatusCode::SUCCESS;
 
  341   return StatusCode::SUCCESS;
 
  346   return StatusCode::SUCCESS;
 
  382   std::ifstream calibfile;
 
  384   if (!calibfile.good()) {
 
  386     return StatusCode::FAILURE;
 
  407   while ( !calibfile.eof() ) {
 
  418      pos = calibfile.tellg();
 
  419      for(
int j=0; j<tdcnumber+1; j++) calibfile.ignore(5000,
'\n'); 
 
  425      pos = calibfile.tellg(); 
 
  430   calibfile.seekg(
pos);
 
  432   ATH_MSG_INFO ( 
"TDC calibration constants obtained from run " << prevrunnumber );
 
  436     ATH_MSG_WARNING ( 
"TDC calibration constants could not be optimal... ");
 
  439   for(
int j=0;j<tdcnumber;j++) {
 
  453   return StatusCode::SUCCESS;