131{
133 const EventContext& ctx = Gaudi::Hive::currentContext();
134
135
136 unsigned int thisrun=ctx.eventID().run_number();
137
138
142 setFilterPassed(false);
143 return StatusCode::SUCCESS;
144 }
145 }
146
147 TBTDCRawCont * tdcRawCont = nullptr;
149 if (
sc.isFailure()) {
150 ATH_MSG_ERROR (
"TBObjectReco: Retrieval of TDCRawCont failed" );
152 setFilterPassed(false);
153 }
154 return StatusCode::SUCCESS;
155 }
156
157 std::vector<float> tdcQuality;
158 std::vector<float> tdcdTtoWAC;
159 tdcQuality.resize(
m_nTDC);
160 tdcdTtoWAC.resize(
m_nTDC);
166 }
167
168
169 int tdcFound = 0;
170 int tdcFoundAndOK = 0;
171 for (const TBTDCRaw* tdcRaw : *tdcRawCont) {
172 std::string tdcName = tdcRaw->getDetectorName();
173 int tdcIndex = 0;
174 for (; tdcIndex <
m_nTDC; tdcIndex++) {
176 }
178 tdcFound++;
179
180
181 m_tdcRaw[tdcIndex] = tdcRaw->getTDC();
182
183 if (
m_tdcRaw[tdcIndex] <= 0 || tdcRaw->isOverflow() || tdcRaw->isUnderThreshold()) {
184
187 if (tdcRaw->isOverflow())
189 if (tdcRaw->isUnderThreshold())
190 ATH_MSG_DEBUG (
"Bad TDC" << tdcIndex <<
" is underthreshold" );
191 } else {
192
193 tdcFoundAndOK++;
194
195
196
197
200 float dTotdcMax = fabs(
m_tdcRaw[tdcIndex] - tdcMax);
202 float dtemp = (dTotdcMin < dTotdcMax) ? dTotdcMin : dTotdcMax;
203 tdcQuality[tdcIndex] = (dtemp < dTotdcwac) ? dtemp : dTotdcwac;
205
207 (
"TDC" << tdcIndex <<
" value = " <<
m_tdcRaw[tdcIndex]
208 << "; tdc quality"
209 << ": to tdcMin = " << dTotdcMin
210 << "; to tdcMax = " << dTotdcMax
211 << "; to tdcwac = " << dTotdcwac
212 << "; final = " << tdcQuality[tdcIndex] );
213
214
216
218 (
"TDC" << tdcIndex <<
" value = " <<
m_tdcRaw[tdcIndex]
219 <<
"; reconstructed phase = " <<
m_phaseReco[tdcIndex]/ns <<
" ns"
220 );
221 }
222
223 if (tdcFound ==
m_nTDC) break ;
224 }
225 }
226
227 if (tdcFound == 0 || tdcFoundAndOK == 0) {
228
229
230 const TBEventInfo* theEventInfo;
232 if ( checkOut.isFailure() )
233 {
234 ATH_MSG_ERROR (
"cannot retrieve TBEventInfo from StoreGate" );
235 setFilterPassed(false);
236 return StatusCode::SUCCESS;
237 }
238 else
239 {
241 }
244 if (evtType != 1) {
247 float tdc_to_wac = 100.;
248 TBPhase* theTBPhase = new TBPhase(phase, phaseInd, tdc_to_wac);
250 if (
sc.isFailure( )) {
252 setFilterPassed(false);
253 return StatusCode::SUCCESS;
254 }
255 return StatusCode::SUCCESS;
256 }
257 if (tdcFound == 0) {
259 } else {
261 }
263 setFilterPassed(false);
264 }
265 return StatusCode::SUCCESS;
266 }
269 ATH_MSG_WARNING (
"not all the requested TDCs were found in StoreGate" );
270 } else {
272 }
273 }
274
275
276 int tdcBestIndex = 0;
277 float QMax = 0.;
279 if (tdcQuality[k] > QMax) {
280 QMax = tdcQuality[
k];
282 }
283 }
285
287 ( "best quality for TDC" << tdcBestIndex
288 << ", with reconstructed phase = " << bestPhase/ns << " ns" );
289
290
291
292 int timeSampleShift = (
int)floor(bestPhase/
m_delta);
293 if (timeSampleShift != 0) {
295 ( "TBPhaseRec time sample shift non zero: " << timeSampleShift );
296 }
297
298
300
301
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);
310 }
311 return StatusCode::SUCCESS;
312 }
313
314
317 ( "Phase " << phase/ns << " ns "
318 << "has TDC-WAC " << tdcdTtoWAC[tdcBestIndex]
319 <<
" inside the guard region [0," <<
m_guardValue <<
"]" );
321 setFilterPassed(false);
322 }
323 return StatusCode::SUCCESS;
324 }
325
327 ( "Phase = " << phase/ns << " ns; "
328 << "phase index = " << phaseInd );
329
330
331
332 TBPhase* theTBPhase = new TBPhase(phase, phaseInd, tdcdTtoWAC[tdcBestIndex] );
333
335 if (
sc.isFailure( )) {
337 setFilterPassed(false);
338 return StatusCode::SUCCESS;
339 }
340
341 return StatusCode::SUCCESS;
342
343}
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
ServiceHandle< StoreGateSvc > & evtStore()
std::vector< float > m_phaseReco
float computePhase(int tdcIndex)
::StatusCode StatusCode
StatusCode definition for legacy code.