135 unsigned int thisrun=ctx.eventID().run_number();
142 return StatusCode::SUCCESS;
147 StatusCode
sc =
evtStore()->retrieve(tdcRawCont,
"TDCRawCont");
148 if (
sc.isFailure()) {
149 ATH_MSG_ERROR (
"TBObjectReco: Retrieval of TDCRawCont failed" );
153 return StatusCode::SUCCESS;
156 std::vector<float> tdcQuality;
157 std::vector<float> tdcdTtoWAC;
158 tdcQuality.resize(
m_nTDC);
159 tdcdTtoWAC.resize(
m_nTDC);
160 for (
int k = 0; k <
m_nTDC; k++) {
169 int tdcFoundAndOK = 0;
170 for (
const TBTDCRaw* tdcRaw : *tdcRawCont) {
171 std::string tdcName = tdcRaw->getDetectorName();
173 for (; tdcIndex <
m_nTDC; tdcIndex++) {
180 m_tdcRaw[tdcIndex] = tdcRaw->getTDC();
182 if (
m_tdcRaw[tdcIndex] <= 0 || tdcRaw->isOverflow() || tdcRaw->isUnderThreshold()) {
186 if (tdcRaw->isOverflow())
188 if (tdcRaw->isUnderThreshold())
189 ATH_MSG_DEBUG (
"Bad TDC" << tdcIndex <<
" is underthreshold" );
199 float dTotdcMax = fabs(
m_tdcRaw[tdcIndex] - tdcMax);
201 float dtemp = (dTotdcMin < dTotdcMax) ? dTotdcMin : dTotdcMax;
202 tdcQuality[tdcIndex] = (dtemp < dTotdcwac) ? dtemp : dTotdcwac;
206 (
"TDC" << tdcIndex <<
" value = " <<
m_tdcRaw[tdcIndex]
208 <<
": to tdcMin = " << dTotdcMin
209 <<
"; to tdcMax = " << dTotdcMax
210 <<
"; to tdcwac = " << dTotdcwac
211 <<
"; final = " << tdcQuality[tdcIndex] );
217 (
"TDC" << tdcIndex <<
" value = " <<
m_tdcRaw[tdcIndex]
218 <<
"; reconstructed phase = " <<
m_phaseReco[tdcIndex]/ns <<
" ns"
222 if (tdcFound ==
m_nTDC) break ;
226 if (tdcFound == 0 || tdcFoundAndOK == 0) {
230 StatusCode checkOut =
evtStore()->retrieve(theEventInfo,
"TBEventInfo");
231 if ( checkOut.isFailure() )
233 ATH_MSG_ERROR (
"cannot retrieve TBEventInfo from StoreGate" );
235 return StatusCode::SUCCESS;
246 float tdc_to_wac = 100.;
249 if (
sc.isFailure( )) {
252 return StatusCode::SUCCESS;
254 return StatusCode::SUCCESS;
264 return StatusCode::SUCCESS;
268 ATH_MSG_WARNING (
"not all the requested TDCs were found in StoreGate" );
275 int tdcBestIndex = 0;
277 for (
int k = 0; k <
m_nTDC; k++) {
278 if (tdcQuality[k] > QMax) {
279 QMax = tdcQuality[k];
286 (
"best quality for TDC" << tdcBestIndex
287 <<
", with reconstructed phase = " << bestPhase/ns <<
" ns" );
291 int timeSampleShift = (int)floor(bestPhase/
m_delta);
292 if (timeSampleShift != 0) {
294 (
"TBPhaseRec time sample shift non zero: " << timeSampleShift );
298 float phase = bestPhase - timeSampleShift*
m_delta;
302 if (phaseInd < 0 || phaseInd >
m_timeBins - 1) {
304 (
"Phase " << phase/ns <<
" ns "
305 <<
"has phase index " << phaseInd
306 <<
" outside of the bounds [0," <<
m_timeBins-1 <<
"]" );
310 return StatusCode::SUCCESS;
316 (
"Phase " << phase/ns <<
" ns "
317 <<
"has TDC-WAC " << tdcdTtoWAC[tdcBestIndex]
318 <<
" inside the guard region [0," <<
m_guardValue <<
"]" );
322 return StatusCode::SUCCESS;
326 (
"Phase = " << phase/ns <<
" ns; "
327 <<
"phase index = " << phaseInd );
331 TBPhase* theTBPhase =
new TBPhase(phase, phaseInd, tdcdTtoWAC[tdcBestIndex] );
334 if (
sc.isFailure( )) {
337 return StatusCode::SUCCESS;
340 return StatusCode::SUCCESS;