ATLAS Offline Software
Loading...
Searching...
No Matches
LArOFFCRawChannelBuilder Class Reference

#include <LArOFFCRawChannelBuilder.h>

Inheritance diagram for LArOFFCRawChannelBuilder:

Public Member Functions

StatusCode initialize () override
StatusCode execute (const EventContext &ctx) const override
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual unsigned int cardinality () const override
 Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
virtual void setFilterPassed (bool state, const EventContext &ctx) const
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

std::vector< double > convolvePulse (const ILArShape::ShapeRef_t &shape, const ILArOFC::OFCRef_t &ofc) const
double computeOFFC (const std::vector< short > &samples, int firstSample, const ILArOFC::OFCRef_t &ofc, const ILArShape::ShapeRef_t &shape, double pedestal) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadHandleKey< LArDigitContainerm_digitKey
SG::WriteHandleKey< LArRawChannelContainerm_rawChannelKey
SG::ReadCondHandleKey< ILArPedestalm_pedestalKey
SG::ReadCondHandleKey< LArADC2MeVm_adc2MeVKey
SG::ReadCondHandleKey< ILArOFCm_ofcKey
SG::ReadCondHandleKey< ILArShapem_shapeKey
SG::ReadCondHandleKey< LArOnOffIdMappingm_cablingKey
SG::ReadCondHandleKey< LArDSPThresholdsCompletem_run1DSPThresholdsKey
SG::ReadCondHandleKey< AthenaAttributeListm_run2DSPThresholdsKey
Gaudi::Property< float > m_eCutFortQ
Gaudi::Property< bool > m_absECutFortQ
Gaudi::Property< bool > m_useShapeDer
Gaudi::Property< bool > m_useDBFortQ
Gaudi::Property< int > m_firstSample
Gaudi::Property< double > m_belowThreshold
 The OFFC algorithm extends the standard optimal filtering by identifying in-time pulses and subtracting their expected contribution from future samples.
Gaudi::Property< int > m_belowTillReset
 Number of consecutive below-threshold samples required before the forward-subtraction cache is reset.
Gaudi::Property< int > m_nPulse
 Maximum number of overlapping pulses that can be tracked simultaneously.
Gaudi::Property< double > m_Q3cut
 Quality cut used for pulse acceptance.
Gaudi::Property< double > m_filterThreshold
 Minimum filtered amplitude required to consider a sample as a pulse peak.
const LArOnlineIDm_onlineId = nullptr
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 26 of file LArOFFCRawChannelBuilder.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Member Function Documentation

◆ cardinality()

unsigned int AthCommonReentrantAlgorithm< Gaudi::Algorithm >::cardinality ( ) const
overridevirtualinherited

Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.

Override this to return 0 for reentrant algorithms.

Definition at line 75 of file AthCommonReentrantAlgorithm.cxx.

64{
65 return 0;
66}

◆ computeOFFC()

double LArOFFCRawChannelBuilder::computeOFFC ( const std::vector< short > & samples,
int firstSample,
const ILArOFC::OFCRef_t & ofc,
const ILArShape::ShapeRef_t & shape,
double pedestal ) const
private

Definition at line 51 of file LArOFFCRawChannelBuilder.cxx.

55 {
56 // OFFC parameters (configured via job options)
57 // belowThreshold : ADC threshold to detect quiet regions
58 // belowTillReset : consecutive quiet samples before cache reset
59 // npulse : max number of overlapping pulses tracked
60 // Q3cut : shape-consistency cut for pulse acceptance
61 // filterThreshold : minimum filtered amplitude to seed a pulse
62
63 const int nSamples = samples.size();
64 const int ofcLen = ofc.size();
65
66 // Pedestal subtraction
67 std::vector<double> samp_no_ped(nSamples);
68 for (int i = 0; i < nSamples; ++i)
69 samp_no_ped[i] = samples[i] - pedestal;
70
71 std::vector<double> filtered(nSamples, 0.0);
72 std::vector<double> reco(nSamples, 0.0);
73
74 // Precompute convolved pulse
75 std::vector<double> convPulse = convolvePulse(shape, ofc);
76 const int convSize = convPulse.size();
77 std::vector<double> cache(convSize, 0.0);
78
79 // Index of pulse maximum in reference shape
80 auto it = std::ranges::max_element(shape);
81 int shapemax = std::distance(shape.begin(), it);
82
83 // Determine how many pulses stored
84 std::vector<int> context(m_nPulse, 0);
85 int belowCounter = 0;
86
87 const int loopEnd = std::max(0, nSamples - ofcLen);
88
89 for (int i = 0; i < loopEnd; ++i) {
90
91 // Reset correction cache after extended quiet region
92 if (std::abs(samp_no_ped[i]) < m_belowThreshold) {
93 if (++belowCounter == m_belowTillReset) {
94 belowCounter = 0;
95 std::fill(cache.begin(), cache.end(), 0.0);
96 }
97 } else {
98 belowCounter = 0;
99 }
100
101 // Standard OF filtering
102 for (int j = 0; j < ofcLen; ++j)
103 filtered[i] += samp_no_ped[i + j] * ofc[j];
104
105 if (i > 4) {
106 // Apply forward correction
107 reco[i - 1] = filtered[i - 1] + cache[2];
108 const double A = reco[i - 1];
109
110 // Local maximum + amplitude cut
111 if (A > m_filterThreshold && filtered[i - 1] > filtered[i - 2] &&
112 filtered[i - 1] > filtered[i]) {
113
114 // Shape-consistency (Q3) test
115 auto shapeVal = [&](int k) {
116 return (k >= 0 && k < (int)shape.size()) ? shape[k] : 0.0;
117 };
118
119 double Q3 = 0.0;
120 Q3 += std::abs(filtered[i - 2] - A * shapeVal(shapemax - 1));
121 Q3 += std::abs(filtered[i - 1] - A * shapeVal(shapemax));
122 Q3 += std::abs(filtered[i] - A * shapeVal(shapemax + 1));
123 Q3 += std::abs(filtered[i - 3] - A * shapeVal(shapemax - 2));
124
125 // Accept pulse and subtract its forward correction
126 if (Q3 < m_Q3cut) {
127 for (int& c : context) {
128 if (c == 0) {
129 for (int k = 0; k < convSize; ++k)
130 cache[k] -= convPulse[k] * A;
131 c = convSize;
132 break;
133 }
134 }
135 }
136 }
137 }
138
139 // Advance correction cache in time
140 std::rotate(cache.begin(), cache.begin() + 1, cache.end());
141 cache.back() = 0.0;
142
143 for (int& c : context)
144 if (c > 0)
145 --c;
146 }
147
148 // Return reconstructed amplitude at requested sample
149 return reco[firstSample + 1];
150}
Gaudi::Property< double > m_belowThreshold
The OFFC algorithm extends the standard optimal filtering by identifying in-time pulses and subtracti...
Gaudi::Property< int > m_nPulse
Maximum number of overlapping pulses that can be tracked simultaneously.
std::vector< double > convolvePulse(const ILArShape::ShapeRef_t &shape, const ILArOFC::OFCRef_t &ofc) const
Gaudi::Property< double > m_filterThreshold
Minimum filtered amplitude required to consider a sample as a pulse peak.
Gaudi::Property< double > m_Q3cut
Quality cut used for pulse acceptance.
Gaudi::Property< int > m_belowTillReset
Number of consecutive below-threshold samples required before the forward-subtraction cache is reset.
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)
void rotate(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > mid, typename DataModel_detail::iterator< DVL > end)
Specialization of rotate for DataVector/List.

◆ convolvePulse()

std::vector< double > LArOFFCRawChannelBuilder::convolvePulse ( const ILArShape::ShapeRef_t & shape,
const ILArOFC::OFCRef_t & ofc ) const
private

Definition at line 24 of file LArOFFCRawChannelBuilder.cxx.

25 {
26 // Convolve pulse shape with time-reversed OFC to build forward-correction
27 // template
28
29 const int shapeSize = shape.size();
30 const int ofcSize = ofc.size();
31
32 std::vector<double> ofcRev(ofcSize);
33 for (int i = 0; i < ofcSize; ++i)
34 ofcRev[i] = ofc[ofcSize - 1 - i];
35
36 const int fullLen = shapeSize + ofcSize - 1;
37 std::vector<double> fullConv(fullLen, 0.0);
38
39 for (int i = 0; i < shapeSize; ++i)
40 for (int j = 0; j < ofcSize; ++j)
41 fullConv[i + j] += shape[i] * ofcRev[j];
42
43 // Drop early samples to align correction with trigger window
44 const int startIndex = 2;
45 if (startIndex >= fullLen)
46 return {};
47
48 return std::vector<double>(fullConv.begin() + startIndex, fullConv.end());
49}

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode LArOFFCRawChannelBuilder::execute ( const EventContext & ctx) const
override

Definition at line 187 of file LArOFFCRawChannelBuilder.cxx.

187 {
188
189 ATH_MSG_VERBOSE("Executing LArOFFCRawChannelBuilder::execute");
190
191 // Get event inputs from read handles:
192 const LArDigitContainer* inputContainer{};
193 ATH_CHECK(SG::get(inputContainer, m_digitKey, ctx));
194
195 // Write output via write handle
196 auto outputContainer = std::make_unique<LArRawChannelContainer>();
197
198 // Get Conditions input
199 const ILArPedestal* peds{};
200 ATH_CHECK(SG::get(peds, m_pedestalKey, ctx));
201
202 const LArADC2MeV* adc2MeVs{};
203 ATH_CHECK(SG::get(adc2MeVs, m_adc2MeVKey, ctx));
204
205 const ILArOFC* ofcs{nullptr};
206 ATH_CHECK(SG::get(ofcs, m_ofcKey, ctx));
207
208 const ILArShape* shapes{};
209 ATH_CHECK(SG::get(shapes, m_shapeKey, ctx));
210
211 const LArOnOffIdMapping* cabling{};
212 ATH_CHECK(SG::get(cabling, m_cablingKey, ctx));
213
214 std::unique_ptr<LArDSPThresholdsFlat> run2DSPThresh;
215 const LArDSPThresholdsComplete* run1DSPThresh = nullptr;
216 ATH_CHECK(SG::get(run1DSPThresh, m_run1DSPThresholdsKey, ctx));
217 if (m_useDBFortQ) {
218 if (!m_run2DSPThresholdsKey.empty()) {
219 SG::ReadCondHandle<AthenaAttributeList> dspThrshAttr(
221 run2DSPThresh = std::make_unique<LArDSPThresholdsFlat>(*dspThrshAttr);
222 if (ATH_UNLIKELY(!run2DSPThresh->good())) {
224 "Failed to initialize LArDSPThresholdFlat from attribute list "
225 "loaded from "
226 << m_run2DSPThresholdsKey.key() << ". Aborting.");
227 return StatusCode::FAILURE;
228 }
229 } else if (!m_run1DSPThresholdsKey.empty()) {
230 SG::ReadCondHandle<LArDSPThresholdsComplete> dspThresh(
232 run1DSPThresh = dspThresh.cptr();
233 } else {
234 ATH_MSG_ERROR("No DSP threshold configured.");
235 return StatusCode::FAILURE;
236 }
237 }
238
239 // Loop over digits:
240 for (const LArDigit* digit : *inputContainer) {
241
242 size_t firstSample = m_firstSample;
243
244 const HWIdentifier id = digit->hardwareID();
245
246 const bool connected = cabling->isOnlineConnected(id);
247
248 const std::vector<short>& samples = digit->samples();
249 const int gain = digit->gain();
250 const float p = peds->pedestal(id, gain);
251
252 // The following autos will resolve either into vectors or vector-proxies
253 const auto& ofca = ofcs->OFC_a(id, gain);
254 const auto& adc2mev = adc2MeVs->ADC2MEV(id, gain);
255 const size_t nOFC = ofca.size();
256
257 // Sanity check on input conditions data:
258 // ensure that the size of the samples vector is compatible with ofc_a size
259 // when preceeding samples are saved
260 const size_t nSamples = samples.size() - firstSample;
261 if (nSamples < nOFC) {
262 ATH_MSG_ERROR("effective sample size: "
263 << nSamples << ", must be >= OFC_a size: " << ofca.size());
264 return StatusCode::FAILURE;
265 }
266
268 if (!connected)
269 continue; // No conditions for disconencted channel, who cares?
270 ATH_MSG_ERROR("No valid pedestal for connected channel "
271 << m_onlineId->channel_name(id) << " gain " << gain);
272 return StatusCode::FAILURE;
273 }
274
275 if (ATH_UNLIKELY(adc2mev.size() < 2)) {
276 if (!connected)
277 continue; // No conditions for disconencted channel, who cares?
278 ATH_MSG_ERROR("No valid ADC2MeV for connected channel "
279 << m_onlineId->channel_name(id) << " gain " << gain);
280 return StatusCode::FAILURE;
281 }
282
283 // Apply OFFC to get amplitude
284 // Evaluate sums in double-precision to get consistent results
285 // across platforms.
286
287 bool saturated = false;
288 // Check saturation AND discount pedestal
289 std::vector<double> samp_no_ped(nOFC, 0.0);
290 for (size_t i = 0; i < nOFC; ++i) {
291 if (samples[i + firstSample] == 4096 || samples[i + firstSample] == 0)
292 saturated = true;
293 samp_no_ped[i] = samples[i + firstSample] - p;
294 }
295
296 uint16_t iquaShort = 0;
297 float tau = 0;
298
299 uint16_t prov = 0xa5; // Means all constants from DB
300 if (saturated)
301 prov |= 0x0400;
302
303 float ecut(0.);
304 if (m_useDBFortQ) {
305 if (run2DSPThresh) {
306 ecut = run2DSPThresh->tQThr(id);
307 } else if (run1DSPThresh) {
308 ecut = run1DSPThresh->tQThr(id);
309 } else {
310 ATH_MSG_ERROR("DSP threshold problem");
311 return StatusCode::FAILURE;
312 }
313 } else {
314 ecut = m_eCutFortQ;
315 }
316
317 const auto& fullShape = shapes->Shape(id, gain);
318
319 double A = computeOFFC(samples, firstSample, ofca, fullShape, p);
320
321 const float E = adc2mev[0] + A * adc2mev[1];
322
323 const float E1 = m_absECutFortQ.value() ? std::fabs(E) : E;
324
325 if (E1 > ecut) {
326 ATH_MSG_VERBOSE("Channel " << m_onlineId->channel_name(id) << " gain "
327 << gain
328 << " above threshold for tQ computation");
329 prov |= 0x2000; // fill bit in provenance that time+quality information
330 // are available
331
332 // Get time by applying OFC-b coefficients:
333 const auto& ofcb = ofcs->OFC_b(id, gain);
334 double At = 0;
335 for (size_t i = 0; i < nOFC; ++i) {
336 At += static_cast<double>(samp_no_ped[i]) * ofcb[i];
337 }
338
339 // At = m_offcTool->compute(samples, firstSample, ofcb, fullShape,
340 // ecutadc, p);
341 // Divide A*t/A to get time
342 tau = (std::fabs(A) > 0.1) ? At / A : 0.0;
343
344 // Get Q-factor
345 // fixing HEC to move +1 in case of 4 samples and firstSample 0 (copied
346 // from old LArRawChannelBuilder)
347 const size_t nSamples = samples.size();
348 if (fullShape.size() > nSamples && nSamples == 4 && m_firstSample == 0) {
349 if (m_onlineId->isHECchannel(id)) {
350 firstSample = 1;
351 }
352 }
353
354 if (ATH_UNLIKELY(fullShape.size() < nOFC + firstSample)) {
355 if (!connected)
356 continue; // No conditions for disconnected channel, who cares?
357 ATH_MSG_ERROR("No valid shape for channel "
358 << m_onlineId->channel_name(id) << " gain " << gain);
359 ATH_MSG_ERROR("Got size " << fullShape.size() << ", expected at least "
360 << nSamples + firstSample);
361 return StatusCode::FAILURE;
362 }
363
364 std::span<const float> shape(fullShape.data() + firstSample, fullShape.size() - firstSample);
365
366 double q = 0;
367 if (m_useShapeDer) {
368 const auto& fullshapeDer = shapes->ShapeDer(id, gain);
369 if (ATH_UNLIKELY(fullshapeDer.size() < nOFC + firstSample)) {
370 ATH_MSG_ERROR("No valid shape derivative for channel "
371 << m_onlineId->channel_name(id) << " gain " << gain);
372 ATH_MSG_ERROR("Got size " << fullshapeDer.size()
373 << ", expected at least "
374 << nOFC + firstSample);
375 return StatusCode::FAILURE;
376 }
377
378 std::span<const float> shapeDer(fullshapeDer.data() + firstSample, fullshapeDer.size() - firstSample);
379
380
381 for (size_t i = 0; i < nOFC; ++i) {
382 q += std::pow((A * (shape[i] - tau * shapeDer[i]) - (samp_no_ped[i])),
383 2);
384 }
385 } // end if useShapeDer
386 else {
387 // Q-factor w/o shape derivative
388 for (size_t i = 0; i < nOFC; ++i) {
389 q += std::pow((A * shape[i] - (samp_no_ped[i])), 2);
390 }
391 }
392
393 int iqua = std::min(static_cast<int>(q), 0xFFFF);
394
395 iquaShort = static_cast<uint16_t>(iqua & 0xFFFF);
396
397 tau -= ofcs->timeOffset(id, gain);
398 tau *= (Gaudi::Units::nanosecond /
399 Gaudi::Units::picosecond); // Convert time to ps
400 } // end if above cut
401
402 outputContainer->emplace_back(id, static_cast<int>(std::floor(E + 0.5)),
403 static_cast<int>(std::floor(tau + 0.5)),
404 iquaShort, prov, (CaloGain::CaloGain)gain);
405 }
406
407 SG::WriteHandle<LArRawChannelContainer> outputHandle(m_rawChannelKey, ctx);
408 ATH_CHECK(outputHandle.record(std::move(outputContainer)));
409
410 return StatusCode::SUCCESS;
411}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_UNLIKELY(x)
virtual OFCRef_t OFC_b(const HWIdentifier &id, int gain, int tbin=0) const =0
virtual OFCRef_t OFC_a(const HWIdentifier &id, int gain, int tbin=0) const =0
access to OFCs by online ID, gain, and tbin (!=0 for testbeam)
virtual float timeOffset(const HWIdentifier &CellID, int gain) const =0
virtual float pedestal(const HWIdentifier &id, int gain) const =0
virtual ShapeRef_t Shape(const HWIdentifier &id, int gain, int tbin=0, int mode=0) const =0
virtual ShapeRef_t ShapeDer(const HWIdentifier &id, int gain, int tbin=0, int mode=0) const =0
const LArVectorProxy ADC2MEV(const HWIdentifier &id, int gain) const
Definition LArADC2MeV.h:32
float tQThr(const HWIdentifier chid) const
SG::WriteHandleKey< LArRawChannelContainer > m_rawChannelKey
Gaudi::Property< bool > m_useDBFortQ
double computeOFFC(const std::vector< short > &samples, int firstSample, const ILArOFC::OFCRef_t &ofc, const ILArShape::ShapeRef_t &shape, double pedestal) const
SG::ReadCondHandleKey< ILArShape > m_shapeKey
Gaudi::Property< bool > m_absECutFortQ
SG::ReadCondHandleKey< LArADC2MeV > m_adc2MeVKey
Gaudi::Property< int > m_firstSample
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
SG::ReadCondHandleKey< ILArPedestal > m_pedestalKey
Gaudi::Property< float > m_eCutFortQ
SG::ReadHandleKey< LArDigitContainer > m_digitKey
SG::ReadCondHandleKey< ILArOFC > m_ofcKey
Gaudi::Property< bool > m_useShapeDer
SG::ReadCondHandleKey< AthenaAttributeList > m_run2DSPThresholdsKey
SG::ReadCondHandleKey< LArDSPThresholdsComplete > m_run1DSPThresholdsKey
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
setScaleOne setStatusOne saturated
setWord1 uint16_t

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthCommonReentrantAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 94 of file AthCommonReentrantAlgorithm.cxx.

90{
91 // If we didn't find any symlinks to add, just return the collection
92 // from the base class. Otherwise, return the extended collection.
93 if (!m_extendedExtraObjects.empty()) {
95 }
97}
An algorithm that can be simultaneously executed in multiple threads.

◆ filterPassed()

virtual bool AthCommonReentrantAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Definition at line 96 of file AthCommonReentrantAlgorithm.h.

96 {
97 return execState( ctx ).filterPassed();
98 }
virtual bool filterPassed(const EventContext &ctx) const

◆ initialize()

StatusCode LArOFFCRawChannelBuilder::initialize ( )
override

Definition at line 152 of file LArOFFCRawChannelBuilder.cxx.

152 {
153 ATH_CHECK(m_digitKey.initialize());
154 ATH_CHECK(m_rawChannelKey.initialize());
155 ATH_CHECK(m_pedestalKey.initialize());
156 ATH_CHECK(m_adc2MeVKey.initialize());
157 ATH_CHECK(m_ofcKey.initialize());
158 ATH_CHECK(m_shapeKey.initialize());
159 ATH_CHECK(m_cablingKey.initialize());
162
163 if (m_useDBFortQ) {
164 if (m_run1DSPThresholdsKey.empty() && m_run2DSPThresholdsKey.empty()) {
166 "useDB requested but neither Run1... nor Run2... initialized.");
167 return StatusCode::FAILURE;
168 }
169 }
170
171 ATH_CHECK(detStore()->retrieve(m_onlineId, "LArOnlineID"));
172
173 if (m_firstSample < 5) {
174 ATH_MSG_ERROR("firstSample must be >= 5 to allow for OFFC processing");
175 return StatusCode::FAILURE;
176 }
177
178 const std::string cutmsg = m_absECutFortQ.value() ? " fabs(E) < " : " E < ";
179 ATH_MSG_INFO("Energy cut for time and quality computation: "
180 << cutmsg << " taken from COOL folder "
181 << m_run1DSPThresholdsKey.key() << " (run1) "
182 << m_run2DSPThresholdsKey.key() << " (run2) ");
183
184 return StatusCode::SUCCESS;
185}
#define ATH_MSG_INFO(x)
const ServiceHandle< StoreGateSvc > & detStore() const
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isClonable()

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setFilterPassed()

virtual void AthCommonReentrantAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Definition at line 100 of file AthCommonReentrantAlgorithm.h.

100 {
102 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const

◆ sysExecute()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Definition at line 85 of file AthCommonReentrantAlgorithm.cxx.

77{
78 return BaseAlg::sysExecute (ctx);
79}

◆ sysInitialize()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in HypoBase, and InputMakerBase.

Definition at line 61 of file AthCommonReentrantAlgorithm.cxx.

107 {
109
110 if (sc.isFailure()) {
111 return sc;
112 }
113
114 ServiceHandle<ICondSvc> cs("CondSvc",name());
115 for (auto h : outputHandles()) {
116 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
117 // do this inside the loop so we don't create the CondSvc until needed
118 if ( cs.retrieve().isFailure() ) {
119 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
120 return StatusCode::SUCCESS;
121 }
122 if (cs->regHandle(this,*h).isFailure()) {
124 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
125 << " with CondSvc");
126 }
127 }
128 }
129 return sc;
130}
#define ATH_MSG_WARNING(x)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }

Member Data Documentation

◆ m_absECutFortQ

Gaudi::Property<bool> LArOFFCRawChannelBuilder::m_absECutFortQ
private
Initial value:
{
this, "absECut", true, "Cut on fabs(E) for Q and t computation"}

Definition at line 69 of file LArOFFCRawChannelBuilder.h.

69 {
70 this, "absECut", true, "Cut on fabs(E) for Q and t computation"};

◆ m_adc2MeVKey

SG::ReadCondHandleKey<LArADC2MeV> LArOFFCRawChannelBuilder::m_adc2MeVKey
private
Initial value:
{
this, "ADC2MeVKey", "LArADC2MeV", "SG Key of ADC2MeV conditions object"}

Definition at line 48 of file LArOFFCRawChannelBuilder.h.

48 {
49 this, "ADC2MeVKey", "LArADC2MeV", "SG Key of ADC2MeV conditions object"};

◆ m_belowThreshold

Gaudi::Property<double> LArOFFCRawChannelBuilder::m_belowThreshold
private
Initial value:
{
this, "BelowThreshold", 0,
"ADC threshold below which samples are treated as noise"}

The OFFC algorithm extends the standard optimal filtering by identifying in-time pulses and subtracting their expected contribution from future samples.

This mitigates out-of-time pileup by iteratively removing pulse shapes that are consistent with the detector response.

The algorithm operates on pedestal-subtracted ADC samples and applies:

  • an optimal filter convolution,
  • a local-maximum pulse-finding criterion,
  • an optional shape-consistency (Q3) quality cut,
  • and a forward subtraction using the OFC–shape convolution.

The parameters below control noise suppression, pulse acceptance, and the handling of overlapping pulses. ADC threshold below which samples are considered noise. Consecutive samples below this threshold increment a counter used to decide when to reset the forward-subtraction cache.

Definition at line 100 of file LArOFFCRawChannelBuilder.h.

100 {
101 this, "BelowThreshold", 0,
102 "ADC threshold below which samples are treated as noise"};

◆ m_belowTillReset

Gaudi::Property<int> LArOFFCRawChannelBuilder::m_belowTillReset
private
Initial value:
{
this, "BelowTillReset", 0,
"Number of consecutive noise samples before cache reset"}

Number of consecutive below-threshold samples required before the forward-subtraction cache is reset.

This prevents stale pulse contributions from persisting indefinitely in quiet regions of the readout.

Definition at line 108 of file LArOFFCRawChannelBuilder.h.

108 {
109 this, "BelowTillReset", 0,
110 "Number of consecutive noise samples before cache reset"};

◆ m_cablingKey

SG::ReadCondHandleKey<LArOnOffIdMapping> LArOFFCRawChannelBuilder::m_cablingKey
private
Initial value:
{
this, "CablingKey", "LArOnOffIdMap",
"SG Key of LArOnOffIdMapping object"}

Definition at line 55 of file LArOFFCRawChannelBuilder.h.

55 {
56 this, "CablingKey", "LArOnOffIdMap",
57 "SG Key of LArOnOffIdMapping object"};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_digitKey

SG::ReadHandleKey<LArDigitContainer> LArOFFCRawChannelBuilder::m_digitKey
private
Initial value:
{
this, "LArDigitKey", "FREE", "SG Key of LArDigitContainer"}

Definition at line 36 of file LArOFFCRawChannelBuilder.h.

36 {
37 this, "LArDigitKey", "FREE", "SG Key of LArDigitContainer"};

◆ m_eCutFortQ

Gaudi::Property<float> LArOFFCRawChannelBuilder::m_eCutFortQ
private
Initial value:
{this, "ECutFortQ", 256.0,
"Time and Quality will be computed only "
"for channels with E above this value"}

Definition at line 66 of file LArOFFCRawChannelBuilder.h.

66 {this, "ECutFortQ", 256.0,
67 "Time and Quality will be computed only "
68 "for channels with E above this value"};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonReentrantAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 114 of file AthCommonReentrantAlgorithm.h.

◆ m_filterThreshold

Gaudi::Property<double> LArOFFCRawChannelBuilder::m_filterThreshold
private
Initial value:
{
this, "FilterThreshold", 0,
"Minimum filtered amplitude for pulse finding"}

Minimum filtered amplitude required to consider a sample as a pulse peak.

This suppresses spurious pulse finding due to noise fluctuations.

Definition at line 127 of file LArOFFCRawChannelBuilder.h.

127 {
128 this, "FilterThreshold", 0,
129 "Minimum filtered amplitude for pulse finding"};

◆ m_firstSample

Gaudi::Property<int> LArOFFCRawChannelBuilder::m_firstSample
private
Initial value:
{
this, "firstSample", 0,
"First of the 32 samples of the MC shape to be used"}

Definition at line 76 of file LArOFFCRawChannelBuilder.h.

76 {
77 this, "firstSample", 0,
78 "First of the 32 samples of the MC shape to be used"};

◆ m_nPulse

Gaudi::Property<int> LArOFFCRawChannelBuilder::m_nPulse
private
Initial value:
{
this, "NPulse", 0, "Maximum number of overlapping pulses to subtract"}

Maximum number of overlapping pulses that can be tracked simultaneously.

Each accepted pulse occupies a context slot for the duration of the OFC–shape convolution window.

Definition at line 115 of file LArOFFCRawChannelBuilder.h.

115 {
116 this, "NPulse", 0, "Maximum number of overlapping pulses to subtract"};

◆ m_ofcKey

SG::ReadCondHandleKey<ILArOFC> LArOFFCRawChannelBuilder::m_ofcKey
private
Initial value:
{this, "OFCKey", "LArOFC",
"SG Key of OFC conditions object"}

Definition at line 50 of file LArOFFCRawChannelBuilder.h.

50 {this, "OFCKey", "LArOFC",
51 "SG Key of OFC conditions object"};

◆ m_onlineId

const LArOnlineID* LArOFFCRawChannelBuilder::m_onlineId = nullptr
private

Definition at line 132 of file LArOFFCRawChannelBuilder.h.

◆ m_pedestalKey

SG::ReadCondHandleKey<ILArPedestal> LArOFFCRawChannelBuilder::m_pedestalKey
private
Initial value:
{
this, "PedestalKey", "LArPedestal",
"SG Key of Pedestal conditions object"}

Definition at line 45 of file LArOFFCRawChannelBuilder.h.

45 {
46 this, "PedestalKey", "LArPedestal",
47 "SG Key of Pedestal conditions object"};

◆ m_Q3cut

Gaudi::Property<double> LArOFFCRawChannelBuilder::m_Q3cut
private
Initial value:
{
this, "Q3Cut", 0, "Shape-consistency quality cut for pulse acceptance"}

Quality cut used for pulse acceptance.

Q3 is computed as the sum of absolute residuals between the filtered samples and the expected pulse shape around the peak. Pulses with Q3 below this threshold are accepted and subtracted.

Definition at line 122 of file LArOFFCRawChannelBuilder.h.

122 {
123 this, "Q3Cut", 0, "Shape-consistency quality cut for pulse acceptance"};

◆ m_rawChannelKey

SG::WriteHandleKey<LArRawChannelContainer> LArOFFCRawChannelBuilder::m_rawChannelKey
private
Initial value:
{
this, "LArRawChannelKey", "LArRawChannels",
"SG key of the output LArRawChannelContainer"}

Definition at line 40 of file LArOFFCRawChannelBuilder.h.

40 {
41 this, "LArRawChannelKey", "LArRawChannels",
42 "SG key of the output LArRawChannelContainer"};

◆ m_run1DSPThresholdsKey

SG::ReadCondHandleKey<LArDSPThresholdsComplete> LArOFFCRawChannelBuilder::m_run1DSPThresholdsKey
private
Initial value:
{
this, "Run1DSPThresholdsKey", "",
"SG Key for thresholds to compute time and quality, run 1"}

Definition at line 58 of file LArOFFCRawChannelBuilder.h.

58 {
59 this, "Run1DSPThresholdsKey", "",
60 "SG Key for thresholds to compute time and quality, run 1"};

◆ m_run2DSPThresholdsKey

SG::ReadCondHandleKey<AthenaAttributeList> LArOFFCRawChannelBuilder::m_run2DSPThresholdsKey
private
Initial value:
{
this, "Run2DSPThresholdsKey", "",
"SG Key for thresholds to compute time and quality, run 2"}

Definition at line 61 of file LArOFFCRawChannelBuilder.h.

61 {
62 this, "Run2DSPThresholdsKey", "",
63 "SG Key for thresholds to compute time and quality, run 2"};

◆ m_shapeKey

SG::ReadCondHandleKey<ILArShape> LArOFFCRawChannelBuilder::m_shapeKey
private
Initial value:
{
this, "ShapeKey", "LArShape", "SG Key of Shape conditions object"}

Definition at line 52 of file LArOFFCRawChannelBuilder.h.

52 {
53 this, "ShapeKey", "LArShape", "SG Key of Shape conditions object"};

◆ m_useDBFortQ

Gaudi::Property<bool> LArOFFCRawChannelBuilder::m_useDBFortQ
private
Initial value:
{this, "useDB", true,
"Use DB for cut on t,Q"}

Definition at line 74 of file LArOFFCRawChannelBuilder.h.

74 {this, "useDB", true,
75 "Use DB for cut on t,Q"};

◆ m_useShapeDer

Gaudi::Property<bool> LArOFFCRawChannelBuilder::m_useShapeDer
private
Initial value:
{
this, "useShapeDer", true,
"Use shape derivative in Q-factor computation"}

Definition at line 71 of file LArOFFCRawChannelBuilder.h.

71 {
72 this, "useShapeDer", true,
73 "Use shape derivative in Q-factor computation"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: