20#ifndef XAOD_STANDALONE
21 declareInterface<IZdcAnalysisTool>(
this);
40 if (auxSuffix !=
"") auxSuffix =
"_" + auxSuffix;
80 return StatusCode::SUCCESS;
96 int side,
int channel,
97 const std::vector<unsigned short>&
data,
98 unsigned int startSample,
unsigned int endSample)
100 ATH_MSG_DEBUG(
"Processing LIS data for side " << side <<
", channel " << channel);
103 int maxADCsub = -999;
104 unsigned int maxSample = 0;
112 if (startSample >=
data.size() || endSample >=
data.size()) {
113 ATH_MSG_WARNING(
"Start or end sample number greater than number of samples");
123 preFADC /= nBaseline;
126 for (
unsigned int sample = startSample; sample <= endSample; sample++) {
127 int FADCsub =
static_cast<int>(
data[sample]) -
static_cast<int>(std::round(preFADC));
132 if (FADCsub > maxADCsub) {
137 avgTime += time * FADCsub;
147 ATH_MSG_DEBUG(
" Presample: " << preFADC <<
", ADCSum: " << ADCSum
148 <<
", MaxADC: " << maxADCsub <<
", MaxSample: " << maxSample
149 <<
", AvgTime: " << avgTime);
155 ATH_MSG_DEBUG(
"Processing LIS module: side=" << module.zdcSide()
156 <<
", module=" << module.zdcModule()
157 <<
", channel=" << module.zdcChannel());
159 int LISModuleGain = 0;
161 if(module.zdcChannel() > 3){
181 const std::vector<uint16_t> &waveform = gainDataAccessor(module);
182 if (waveform.empty()) {
195 ATH_MSG_DEBUG(
"LISAnalysisTool::recoZdcModules processing event");
199 return StatusCode::FAILURE;
202 if (moduleContainer.
empty()) {
203 return StatusCode::SUCCESS;
209 return StatusCode::FAILURE;
214 ATH_MSG_WARNING(
"LIS decoding error found - abandoning LISAnalysisTool!");
215 return StatusCode::SUCCESS;
223 bool haveZdcEventInfo =
false;
225 unsigned int bcid = 0;
229 for (
auto modSum : moduleSumContainer) {
233 if (modSum->zdcSide() == 0) {
238 eventType = eventTypeHandle(*modSum);
239 haveZdcEventInfo =
true;
240 moduleSumEventInfo_ptr = modSum;
244 if (!haveZdcEventInfo) {
245 ATH_MSG_ERROR(
"Zdc event data not available (moduleSum with side = 0)");
246 return StatusCode::FAILURE;
250 const std::vector<uint16_t>& rodBCID = rodBCIDHandle(*moduleSumEventInfo_ptr);
251 if (!rodBCID.empty()) {
256 bcid = eventInfo->bcid();
279 return StatusCode::SUCCESS;
282 ATH_MSG_DEBUG(
"Event with BCID = " << bcid <<
" has LED type " << evtLEDType);
297 for (
const auto* zdcModule : moduleContainer) {
303 ATH_MSG_DEBUG(
"Writing aux decors to LIS module: side=" << zdcModule->zdcSide()
304 <<
", channel=" << zdcModule->zdcChannel());
307 presampleHandle(*zdcModule) = results.getPresampleADC();
308 adcSumHandle(*zdcModule) = results.getADCSum();
309 maxADCHandle(*zdcModule) = results.getMaxADC();
310 maxSampleHandle(*zdcModule) = results.getMaxSample();
311 avgTimeHandle(*zdcModule) = results.getAvgTime();
319 LEDTypeHandle(*moduleSumEventInfo_ptr) = evtLEDType;
324 return StatusCode::SUCCESS;
330 return StatusCode::FAILURE;
343 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
Helper class to provide constant type-safe access to aux data.
char data[hepevt_bytes_allocation_ATLAS]
Define enumerations for event-level ZDC data.
ServiceHandle< StoreGateSvc > & evtStore()
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const noexcept
Returns true if the collection is empty.
Helper class to provide constant type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
Handle class for reading a decoration on an object.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Handle class for adding a decoration to an object.
@ ForwardDet
The forward detectors.
ZdcModuleContainer_v1 ZdcModuleContainer