ATLAS Offline Software
Loading...
Searching...
No Matches
LArOFFCRawChannelBuilder.h
Go to the documentation of this file.
1/* -*-c++-*- */
2/*
3 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
4*/
5
6#ifndef LARROD_LAROFFCRAWCHANNELBUILDER_H
7#define LARROD_LAROFFCRAWCHANNELBUILDER_H
8
22
23#include <atomic>
24#include <map>
25#include <mutex>
26#include <string>
27#include <vector>
28
29// Event classes
32class LArOnlineID;
33class CaloCell_ID;
34
36
37 public:
38 using AthReentrantAlgorithm::AthReentrantAlgorithm;
39
40 StatusCode initialize() override;
41 StatusCode execute(const EventContext& ctx) const override;
42 StatusCode finalize() override;
43
44 private:
45 // Event input
47 this, "LArDigitKey", "FREE", "SG Key of LArDigitContainer"};
48
49 // Event output
51 this, "LArRawChannelKey", "LArRawChannels",
52 "SG key of the output LArRawChannelContainer"};
53
54 // Conditions input
56 this, "PedestalKey", "LArPedestal",
57 "SG Key of Pedestal conditions object"};
59 this, "ADC2MeVKey", "LArADC2MeV", "SG Key of ADC2MeV conditions object"};
60 SG::ReadCondHandleKey<ILArOFC> m_ofcKey{this, "OFCKey", "LArOFC",
61 "SG Key of OFC conditions object"};
63 this, "ShapeKey", "LArShape", "SG Key of Shape conditions object"};
64
66 this, "CablingKey", "LArOnOffIdMap",
67 "SG Key of LArOnOffIdMapping object"};
69 this, "Run1DSPThresholdsKey", "",
70 "SG Key for thresholds to compute time and quality, run 1"};
72 this, "Run2DSPThresholdsKey", "",
73 "SG Key for thresholds to compute time and quality, run 2"};
74
75 // Other jobOptions
76 Gaudi::Property<float> m_eCutFortQ{this, "ECutFortQ", 256.0,
77 "Time and Quality will be computed only "
78 "for channels with E above this value"};
79 Gaudi::Property<bool> m_absECutFortQ{
80 this, "absECut", true, "Cut on fabs(E) for Q and t computation"};
81 Gaudi::Property<bool> m_useShapeDer{
82 this, "useShapeDer", true,
83 "Use shape derivative in Q-factor computation"};
84 Gaudi::Property<bool> m_useDBFortQ{this, "useDB", true,
85 "Use DB for cut on t,Q"};
86
90 Gaudi::Property<int> m_firstSample{
91 this, "firstSample", 0,
92 "Index of the digit sample the OFC window starts at"};
93
103
104 // OFFC algorithm configuration
108 Gaudi::Property<double> m_belowThreshold{
109 this, "BelowThreshold", 0,
110 "ADC threshold below which samples are treated as noise"};
111
115 Gaudi::Property<int> m_belowTillReset{
116 this, "BelowTillReset", 0,
117 "Number of consecutive noise samples before cache reset (<=0 disables)"};
118
122 Gaudi::Property<int> m_nPulse{
123 this, "NPulse", 0, "Maximum number of pulse corrections in flight"};
124
131 Gaudi::Property<double> m_Q3cut{
132 this, "Q3Cut", 0.1,
133 "Shape-consistency cut for pulse acceptance, on Q3/A"};
134
139 Gaudi::Property<double> m_Q3Offset{
140 this, "Q3Offset", 2.0,
141 "Absolute term of the Q3 cut in ADC, covering the noise floor"};
142
145 Gaudi::Property<double> m_filterThreshold{
146 this, "FilterThreshold", 0,
147 "Minimum corrected amplitude for pulse finding"};
148
149 // PER-LAYER CONFIGURATION. The scalars above remain the global fallback,
150 // so a job setting nothing new behaves as before. FilterThreshold is in
151 // ADC, a different energy in every layer -- the useful threshold sits near
152 // 3 sigma of local noise, 25 ADC in EMB/2 but 100 in EMEC-OW/1.
153 // Keys are "<REGION>/<LAYER>": EMB, EMEC-OW, EMEC-IW, HEC, FCAL, and the
154 // sampling (FCAL module).
155 Gaudi::Property<std::map<std::string, double>> m_filterThresholdByLayer{
156 this, "FilterThresholdByLayer", {},
157 "Per-layer FilterThreshold, keyed <REGION>/<LAYER>; unlisted layers "
158 "fall back to FilterThreshold"};
159 Gaudi::Property<std::map<std::string, double>> m_q3CutByLayer{
160 this, "Q3CutByLayer", {},
161 "Per-layer Q3Cut; unlisted layers fall back to Q3Cut"};
162 Gaudi::Property<std::map<std::string, double>> m_q3OffsetByLayer{
163 this, "Q3OffsetByLayer", {},
164 "Per-layer Q3Offset; unlisted layers fall back to Q3Offset"};
165 Gaudi::Property<std::map<std::string, int>> m_nPulseByLayer{
166 this, "NPulseByLayer", {},
167 "Per-layer NPulse; unlisted layers fall back to NPulse"};
168
172 Gaudi::Property<std::vector<std::string>> m_enabledLayers{
173 this, "EnabledLayers", {},
174 "Layers where the correction may fire; empty means all"};
175
177 struct LayerParams {
178 double q3Cut = 0.1;
179 double q3Offset = 2.0;
180 double filterThreshold = 0.0;
181 int nPulse = 0;
182 double belowThreshold = 0.0;
184 };
185
188 static constexpr size_t s_nSlots = 20;
189 std::vector<LayerParams> m_layerParams;
190
193 static size_t slotOf(int region, int layer);
195 static size_t slotOfKey(const std::string& key);
196 static std::string keyOfSlot(size_t slot);
197
200 mutable std::vector<uint8_t> m_slotByHash ATLAS_THREAD_SAFE;
201 mutable std::once_flag m_slotOnce ATLAS_THREAD_SAFE;
202 mutable StatusCode m_slotStatus ATLAS_THREAD_SAFE{StatusCode::SUCCESS};
203 StatusCode buildLayerMap(const EventContext& ctx) const;
204
205 // Identifier helpers
206 const LArOnlineID* m_onlineId = nullptr;
207 const CaloCell_ID* m_caloId = nullptr;
208
211 mutable std::atomic<unsigned long> m_nSubtracted{0};
212 mutable std::atomic<unsigned long> m_nDropped{0};
213
214 // --- Member functions ---
218 std::vector<double> pulseResponse(const ILArShape::ShapeRef_t& shape,
219 const ILArOFC::OFCRef_t& ofc) const;
220
221 double computeOFFC(const std::vector<short>& samples, int firstSample,
222 const ILArOFC::OFCRef_t& ofc,
223 const ILArShape::ShapeRef_t& shape, double pedestal,
224 const LayerParams& par) const;
225};
226
227#endif
A LArRawConditionsContainer holding thresholds used by the DSP.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
Define macros for attributes used to control the static checker.
An algorithm that can be simultaneously executed in multiple threads.
Helper class for offline cell identifiers.
Definition CaloCell_ID.h:34
LArVectorProxy OFCRef_t
This class defines the interface for accessing Optimal Filtering coefficients for each channel provid...
Definition ILArOFC.h:26
LArVectorProxy ShapeRef_t
This class defines the interface for accessing Shape (Nsample variable, Dt = 25 ns fixed) @stereotype...
Definition ILArShape.h:26
Container class for LArDigit.
Gaudi::Property< std::map< std::string, int > > m_nPulseByLayer
static constexpr size_t s_nSlots
Five regions x at most four samplings.
std::vector< double > pulseResponse(const ILArShape::ShapeRef_t &shape, const ILArOFC::OFCRef_t &ofc) const
Filter output for a unit-amplitude pulse, tabulated over every offset of the shape against the OFC wi...
SG::WriteHandleKey< LArRawChannelContainer > m_rawChannelKey
Gaudi::Property< bool > m_useDBFortQ
static std::string keyOfSlot(size_t slot)
SG::ReadCondHandleKey< ILArShape > m_shapeKey
Gaudi::Property< double > m_belowThreshold
The OFFC extends optimal filtering by finding pulses in the preceding samples and subtracting their e...
Gaudi::Property< bool > m_absECutFortQ
Gaudi::Property< int > m_nPulse
Maximum number of pulse corrections in flight at once.
SG::ReadCondHandleKey< LArADC2MeV > m_adc2MeVKey
std::vector< LayerParams > m_layerParams
std::vector< uint8_t > m_slotByHash ATLAS_THREAD_SAFE
online hash -> slot, built on the first event: it needs the cabling, which is conditions data with an...
Gaudi::Property< int > m_firstSample
Index of the digit sample the OFC window starts at, i.e.
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
double computeOFFC(const std::vector< short > &samples, int firstSample, const ILArOFC::OFCRef_t &ofc, const ILArShape::ShapeRef_t &shape, double pedestal, const LayerParams &par) const
Gaudi::Property< std::map< std::string, double > > m_q3OffsetByLayer
static size_t slotOf(int region, int layer)
Slot for a region code (0=EMB..4=FCAL) and sampling/module; s_nSlots if out of range.
SG::ReadCondHandleKey< ILArPedestal > m_pedestalKey
Gaudi::Property< float > m_eCutFortQ
SG::ReadHandleKey< LArDigitContainer > m_digitKey
StatusCode buildLayerMap(const EventContext &ctx) const
Gaudi::Property< double > m_filterThreshold
Minimum pile-up corrected amplitude required to accept a pulse peak.
static size_t slotOfKey(const std::string &key)
Parse "<REGION>/<LAYER>" into a slot. Returns s_nSlots if unparseable.
Gaudi::Property< double > m_Q3Offset
Absolute term of the Q3 cut, in ADC.
SG::ReadCondHandleKey< ILArOFC > m_ofcKey
Gaudi::Property< std::map< std::string, double > > m_q3CutByLayer
Gaudi::Property< double > m_Q3cut
Quality cut for pulse acceptance.
Gaudi::Property< bool > m_useShapeDer
std::atomic< unsigned long > m_nDropped
StatusCode execute(const EventContext &ctx) const override
SG::ReadCondHandleKey< AthenaAttributeList > m_run2DSPThresholdsKey
SG::ReadCondHandleKey< LArDSPThresholdsComplete > m_run1DSPThresholdsKey
Gaudi::Property< int > m_belowTillReset
Number of consecutive below-threshold samples after which the pending corrections are dropped,...
Gaudi::Property< std::vector< std::string > > m_enabledLayers
Layers the correction may run in; empty means all.
std::atomic< unsigned long > m_nSubtracted
Accepted pulses, and those NPulse left no room to subtract.
Gaudi::Property< std::map< std::string, double > > m_filterThresholdByLayer
Container for LArRawChannel (IDC using LArRawChannelCollection).
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
Resolved parameters for one layer.