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