ATLAS Offline Software
Loading...
Searching...
No Matches
LArHitEMapToDigitAlg.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef LARDIGITIZATION_LARHITEMPATTODIGITALG_H
6#define LARDIGITIZATION_LARHITEMPATTODIGITALG_H
7// +======================================================================+
8// + +
9// + Author ........: Denis O. Damazio +
10// + Institut ......: BNL +
11// + Creation date .: 16/02/2022 +
12// + +
13// +======================================================================+
14//
15// ....... include
16//
17
19
20
23
38#include <boost/container/static_vector.hpp>
39
40// services
42
44
45#include <vector>
46#include <array>
47#include <string>
48#include <utility> //for std::pair
49#include <cstdint> //for uint32_t
50
51namespace CLHEP {
52 class HepRandomEngine;
53}
54class StoreGateSvc;
55class ITriggerTime;
56class LArOnlineID;
57class LArEM_ID;
58class LArHEC_ID;
59class LArFCAL_ID;
60class CaloCell_ID;
61
62
64{
65public:
66 // delegate Constructor
67 using AthReentrantAlgorithm::AthReentrantAlgorithm;
68
69 // initialize all condition keys
70 virtual StatusCode initialize();
71 // Just do it
72 virtual StatusCode execute(const EventContext& context) const;
73
74protected:
75 static constexpr int s_MaxNSamples = 32;
77 using staticVecDouble_t = boost::container::static_vector<double,s_MaxNSamples> ;
78 using staticVecFloat_t = boost::container::static_vector<float,s_MaxNSamples> ;
79
80 // access to many conditions
81 template<class T> const T* pointerFromKey(const EventContext& context, const SG::ReadCondHandleKey<T>& key) const;
82
83 StatusCode MakeDigit(const EventContext& ctx,
84 const Identifier& cellId,
85 const HWIdentifier& ch_id,
86 LArDigit*& Digit,
87 DataPool<LArDigit>& dataItemsPool,
88 LArDigit*& Digit_DigiHSTruth,
89 const std::vector<std::pair<float, float> >* TimeE,
90 const LArDigit* rndm_digit,
91 CLHEP::HepRandomEngine* engine,
92 const std::vector<std::pair<float, float> >* TimeE_DigiHSTruth,
93 const LArADC2MeV* adc2MeVs,
94 const ILArfSampl* fSampl,
95 const ILArPedestal* pedestal,
96 const ILArNoise* noise,
97 const LArAutoCorrNoise* autoCorrNoise,
98 const LArBadChannelCont* bcCont,
99 const ILArShape* shape) const;
100
101 StatusCode ConvertHits2Samples(const Identifier & cellId, HWIdentifier ch_id, CaloGain::CaloGain igain,
102 const std::vector<std::pair<float,float> > *TimeE, staticVecDouble_t& sampleList,
103 const ILArShape* shape) const;
104
105
106 CaloGain::CaloGain chooseGain(const staticVecDouble_t& samples,const HWIdentifier id, const CaloNum iCalo, const ILArPedestal* ped, const LArADC2MeV* ramp, const float SF) const;
107
108 // Keys to many conditions
109 SG::ReadCondHandleKey<ILArNoise> m_noiseKey{this,"NoiseKey","LArNoiseSym","SG Key of ILArNoise object"};
110 SG::ReadCondHandleKey<ILArfSampl> m_fSamplKey{this,"fSamplKey","LArfSamplSym","SG Key of LArfSampl object"};
111 SG::ReadCondHandleKey<ILArOFC> m_OFCKey{this, "OFCKey", "LArOFC", "SG Key of OFC conditions object"};
112 SG::ReadCondHandleKey<ILArPedestal> m_pedestalKey{this,"PedestalKey","LArPedestal","SG Key of LArPedestal object"};
113 SG::ReadCondHandleKey<ILArShape> m_shapeKey{this,"ShapeKey","LArShapeSym","SG Key of LArShape object"};
114 SG::ReadCondHandleKey<LArADC2MeV> m_adc2mevKey{this,"ADC2MeVKey","LArADC2MeV","SG Key of ADC2MeV conditions object"};
115 SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"};
116 const LArOnOffIdMapping* m_cabling{}; //Set in perpareEvent, used also in mergeEvent
117
118 SG::ReadCondHandleKey<LArAutoCorrNoise> m_autoCorrNoiseKey{this,"AutoCorrNoiseKey","LArAutoCorrNoise","SG Key of AutoCorrNoise conditions object"};
119
120 SG::ReadCondHandleKey<LArBadChannelCont> m_bcContKey {this, "BadChanKey", "LArBadChannel", "SG key for LArBadChan object"};
121 SG::ReadCondHandleKey<LArBadFebCont> m_badFebKey{this, "BadFebKey", "LArBadFeb", "Key of BadFeb object in ConditionsStore"};
122 Gaudi::Property<std::vector<std::string> > m_problemsToMask{this,"ProblemsToMask",{},"Bad-Channel categories to mask entirly"};
124
125 SG::ReadCondHandleKey<CaloDetDescrManager> m_caloMgrKey{this,"CaloDetDescrManager", "CaloDetDescrManager"};
126
127 // keys to inputs
128 SG::ReadHandleKey<LArHitEMap> m_hitMapKey{this,"LArHitEMapKey","LArHitEMap"};
129 SG::ReadHandleKey<LArHitEMap> m_hitMapKey_DigiHSTruth{this,"LArHitEMap_DigiHSTruthKey","LArHitEMap_DigiHSTruth"};
131 "Name of input digit container"}; // input digit container name
132 // keys to output
133 SG::WriteHandleKey<LArDigitContainer> m_DigitContainerName{this, "DigitContainer", "LArDigitContainer_MC",
134 "Name of output digit container"}; // output digit container name list
136 "LArDigitContainer_DigiHSTruth", "Name of output signal digit container"}; // output digit container name list
137 Gaudi::Property<std::string> m_randomStreamName{this, "RandomStreamName", "LArDigitization", ""};
138
139 // services needed
140 ServiceHandle<IAthRNGSvc> m_rndmGenSvc{this, "RndmSvc", "AthRNGSvc", ""};
141 Gaudi::Property<uint32_t> m_randomSeedOffset{this, "RandomSeedOffset", 2, ""}; //
142 Gaudi::Property<bool> m_useLegacyRandomSeeds{this, "UseLegacyRandomSeeds", false,
143 "Use MC16-style random number seeding"};
144
145
146 std::array<Gaudi::Property<double>,4> m_LowGainThresh {{
147 {this,"LowGainThreshEM",3900,"ADC counts in medium gain"},
148 {this,"LowGainThreshHEC",2500,"ADC counts in medium gain"},
149 {this,"LowGainThreshFCAL",2000,"ADC counts in medium gain"},
150 {this,"LowGainThreshEMECIW",3900,"ADC counts in medium gain"}
151 }};
152
153
154 std::array<Gaudi::Property<double>,4> m_HighGainThresh {{
155 {this,"HighGainThreshEM",1300,"ADC counts in medium gain"},
156 {this,"HighGainThreshHEC",0,"ADC counts in medium gain"},
157 {this,"HighGainThreshFCAL",1100,"ADC counts in medium gain"},
158 {this,"HighGainThreshEMECIW",1300,"ADC counts in medium gain"}
159 }};
160
161
162 //std::array<Gaudi::Property<std::pair<CaloGain::CaloGain, CaloGain::CaloGain> >,4> m_gainRange {{
163 std::array<Gaudi::Property<std::pair<int,int> >,4> m_gainRange {{
164 {this,"GainRangeEM",{CaloGain::LARHIGHGAIN,CaloGain::LARLOWGAIN},"Range of gains"},
165 {this,"GainRangeHEC",{CaloGain::LARMEDIUMGAIN,CaloGain::LARLOWGAIN},"Range of gains"},
166 {this,"GainRangeFCAL",{CaloGain::LARHIGHGAIN,CaloGain::LARLOWGAIN},"Range of gains"},
167 {this,"GainRangeEMECIW",{CaloGain::LARHIGHGAIN,CaloGain::LARLOWGAIN},"Range of gains"},
168 }};
169
170 Gaudi::Property<unsigned> m_maxADC{this,"maxADC",4096,"Maxium ADC value +1 (for overflow)"};
171
172 // Some properties for digits production
173 Gaudi::Property<int> m_NSamples{this, "Nsamples", 5,
174 "Number of ADC samples (default=5)"}; // number of samples in Digit
175 Gaudi::Property<bool> m_NoiseOnOff{this, "NoiseOnOff", true,
176 "put electronic noise (default=true)"}; // noise (in all sub-detectors) is on if true
177 Gaudi::Property<int> m_firstSample{this, "firstSample", 0,
178 "First sample to use for the shape for in-time signal"}; // first sample to use for pulse shape for in time energy deposit (use a negative value to include preceeding digits)
179 Gaudi::Property<bool> m_usePhase{this, "UsePhase", false,
180 "use 1ns binned pulse shape (default=false)"}; // use tbin phase to get shape (default = false for Atlas)
181 Gaudi::Property<bool> m_RndmEvtOverlay{this, "RndmEvtOverlay", false,
182 "Pileup and/or noise added by overlaying random events (default=false)"}; // Pileup and noise added by overlaying random events
183 Gaudi::Property<bool> m_isMcOverlay{this, "isMcOverlay", false,
184 "Is input Overlay from MC or data (default=false, from data)"}; // true if input RDO for overlay are from MC, false if from data
185 Gaudi::Property<bool> m_doDigiTruth{this, "DoDigiTruthReconstruction", false,
186 "Also create information about reconstructed digits for HS hits"};
187 // Switches (true by default) on Noise for each sub-detector (can be combined)
188 Gaudi::Property<bool> m_NoiseInEMB {this, "NoiseInEMB", true,
189 "put noise in EMB (default=true)"}; // noise in Barrel is off if false
190 Gaudi::Property<bool> m_NoiseInEMEC{this, "NoiseInEMEC", true,
191 "put noise in EMEC (default=true)"}; // noise in EndCap is off if false
192 Gaudi::Property<bool> m_NoiseInHEC{this, "NoiseInHEC", true,
193 "put noise in HEC (default=true)"}; // noise in HEC is off if false
194 Gaudi::Property<bool> m_NoiseInFCAL{this, "NoiseInFCAL", true,
195 "put noise in FCAL (default=true)"}; // noise in FCAL is off if false
196 Gaudi::Property<bool> m_pedestalNoise{this, "PedestalNoise", false,
197 "Use noise from Pedestal structure instead of LArNoise (default=false)"};
198 Gaudi::Property<bool> m_roundingNoNoise{this, "RoundingNoNoise", true,
199 "if true add random number [0:1[ in no noise case before rounding ADC to integer, if false add only 0.5 average"}; // flag used in NoNoise case: if true add random number [0;1[ in ADC count, if false add only average of 0.5
200 Gaudi::Property<bool> m_Windows{this, "Windows", false,
201 "Window mode (produce digits only around true e/photon) (default=false)"};
202 Gaudi::Property<float> m_WindowsEtaSize{this, "WindowsEtaSize", 0.4,
203 "Eta size of window (default=0.4)"};
204 Gaudi::Property<float> m_WindowsPhiSize{this, "WindowsPhiSize", 0.5,
205 "Phi size of window (default=0.5)"};
206 Gaudi::Property<float> m_WindowsPtCut{this, "WindowsPtCut", 5000.,
207 "Pt cut on e/photons for window mode (Default=5GeV)"};
208
209
215
216};
217
218template<class T>
219const T* LArHitEMapToDigitAlg::pointerFromKey(const EventContext& context, const SG::ReadCondHandleKey<T>& key) const {
220 SG::ReadCondHandle<T> aHandle(key, context);
221 const T* object = *aHandle;
222 if (object == nullptr) ATH_MSG_ERROR("Object could not be fetched with key " << aHandle.key() );
223 return object;
224}
225
226#endif
227
#define ATH_MSG_ERROR(x)
Definition of CaloDetDescrManager.
LArBadXCont< LArBadChannel > LArBadChannelCont
Property holding a SG store/key/clid from which a WriteHandle is made.
An algorithm that can be simultaneously executed in multiple threads.
Helper class for offline cell identifiers.
Definition CaloCell_ID.h:34
a typed memory pool that saves time spent allocation small object.
Definition DataPool.h:63
interface to a tool that returns the time offset of the current trigger.
Liquid Argon digit base class.
Definition LArDigit.h:25
Helper class for LArEM offline identifiers.
Definition LArEM_ID.h:111
Helper class for LArFCAL offline identifiers.
Definition LArFCAL_ID.h:49
Helper class for LArHEC offline identifiers.
Definition LArHEC_ID.h:76
const LArOnOffIdMapping * m_cabling
Gaudi::Property< bool > m_usePhase
Gaudi::Property< bool > m_isMcOverlay
const LArHEC_ID * m_larhec_id
Gaudi::Property< std::vector< std::string > > m_problemsToMask
static constexpr int s_MaxNSamples
Gaudi::Property< bool > m_NoiseInEMEC
Gaudi::Property< bool > m_doDigiTruth
SG::ReadHandleKey< LArHitEMap > m_hitMapKey
SG::ReadCondHandleKey< LArADC2MeV > m_adc2mevKey
StatusCode ConvertHits2Samples(const Identifier &cellId, HWIdentifier ch_id, CaloGain::CaloGain igain, const std::vector< std::pair< float, float > > *TimeE, staticVecDouble_t &sampleList, const ILArShape *shape) const
const CaloCell_ID * m_calocell_id
Gaudi::Property< float > m_WindowsPhiSize
Gaudi::Property< bool > m_pedestalNoise
Gaudi::Property< bool > m_roundingNoNoise
SG::ReadHandleKey< LArHitEMap > m_hitMapKey_DigiHSTruth
StatusCode MakeDigit(const EventContext &ctx, const Identifier &cellId, const HWIdentifier &ch_id, LArDigit *&Digit, DataPool< LArDigit > &dataItemsPool, LArDigit *&Digit_DigiHSTruth, const std::vector< std::pair< float, float > > *TimeE, const LArDigit *rndm_digit, CLHEP::HepRandomEngine *engine, const std::vector< std::pair< float, float > > *TimeE_DigiHSTruth, const LArADC2MeV *adc2MeVs, const ILArfSampl *fSampl, const ILArPedestal *pedestal, const ILArNoise *noise, const LArAutoCorrNoise *autoCorrNoise, const LArBadChannelCont *bcCont, const ILArShape *shape) const
std::array< Gaudi::Property< std::pair< int, int > >, 4 > m_gainRange
virtual StatusCode execute(const EventContext &context) const
SG::ReadHandleKey< LArDigitContainer > m_inputDigitContainerKey
Gaudi::Property< uint32_t > m_randomSeedOffset
Gaudi::Property< bool > m_NoiseInEMB
SG::ReadCondHandleKey< LArBadChannelCont > m_bcContKey
Gaudi::Property< int > m_firstSample
SG::WriteHandleKey< LArDigitContainer > m_DigitContainerName_DigiHSTruth
const LArOnlineID * m_laronline_id
Gaudi::Property< bool > m_NoiseInHEC
boost::container::static_vector< double, s_MaxNSamples > staticVecDouble_t
Gaudi::Property< bool > m_useLegacyRandomSeeds
const LArFCAL_ID * m_larfcal_id
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
std::array< Gaudi::Property< double >, 4 > m_LowGainThresh
virtual StatusCode initialize()
Gaudi::Property< float > m_WindowsPtCut
SG::ReadCondHandleKey< ILArPedestal > m_pedestalKey
SG::ReadCondHandleKey< ILArNoise > m_noiseKey
CaloGain::CaloGain chooseGain(const staticVecDouble_t &samples, const HWIdentifier id, const CaloNum iCalo, const ILArPedestal *ped, const LArADC2MeV *ramp, const float SF) const
Gaudi::Property< float > m_WindowsEtaSize
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Gaudi::Property< bool > m_Windows
Gaudi::Property< bool > m_NoiseOnOff
std::array< Gaudi::Property< double >, 4 > m_HighGainThresh
boost::container::static_vector< float, s_MaxNSamples > staticVecFloat_t
Gaudi::Property< bool > m_RndmEvtOverlay
Gaudi::Property< int > m_NSamples
SG::ReadCondHandleKey< ILArOFC > m_OFCKey
ServiceHandle< IAthRNGSvc > m_rndmGenSvc
SG::ReadCondHandleKey< LArAutoCorrNoise > m_autoCorrNoiseKey
const T * pointerFromKey(const EventContext &context, const SG::ReadCondHandleKey< T > &key) const
Gaudi::Property< bool > m_NoiseInFCAL
SG::ReadCondHandleKey< LArBadFebCont > m_badFebKey
SG::ReadCondHandleKey< ILArfSampl > m_fSamplKey
Gaudi::Property< unsigned > m_maxADC
SG::WriteHandleKey< LArDigitContainer > m_DigitContainerName
SG::ReadCondHandleKey< ILArShape > m_shapeKey
Gaudi::Property< std::string > m_randomStreamName
const std::string & key() const
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.
The Athena Transient Store API.
@ LARMEDIUMGAIN
Definition CaloGain.h:18
@ LARLOWGAIN
Definition CaloGain.h:18
@ LARHIGHGAIN
Definition CaloGain.h:18