ATLAS Offline Software
Loading...
Searching...
No Matches
LArPileUpTool.h
Go to the documentation of this file.
1//Dear emacs, this is -*-c++-*-
2/*
3 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4*/
5
6#ifndef LARDIGITIZATION_LARPILEUPTOOL_H
7#define LARDIGITIZATION_LARPILEUPTOOL_H
8// +======================================================================+
9// + +
10// + Author : G.Unal +
11// + move LAr digitization framework to use PileUpTool +
12// + +
13// +======================================================================+
14//
15// ....... include
16//
17
19
21
24
26
29
30#include "GaudiKernel/ServiceHandle.h"
31#include "GaudiKernel/ToolHandle.h"
32#include "Gaudi/Property.h"
38
44
46
47class StoreGateSvc;
48class ITriggerTime;
49class LArOnlineID;
50class LArEM_ID;
51class LArHEC_ID;
52class LArFCAL_ID;
53class CaloCell_ID;
54class LArDigit;
55
56namespace CLHEP {
57 class HepRandomEngine;
58}
59
61{
62//
63// >>>>>>>> public method
64//
65 public:
66
67 LArPileUpTool(const std::string& type,
68 const std::string& name,
69 const IInterface* parent);
70
72
73 virtual StatusCode initialize() override final;
74
75 virtual StatusCode prepareEvent(const EventContext& ctx, unsigned int nInputEvents) override final;
76
77 virtual StatusCode processBunchXing(int bunchXing,
78 SubEventIterator bSubEvents,
79 SubEventIterator eSubEvents) override final;
80
81
82 //non-const version, (for backward compatiblity), calls teh const version
83 virtual StatusCode processAllSubEvents(const EventContext& ctx) override final;
84
85
86 //const method, reentrant
87 StatusCode processAllSubEvents(const EventContext& ctx) const;
88
98
99 StatusCode fillMapFromHit(const EventContext& ctx,float tbunch,bool isSignal, perEventData_t& data) const;
100
101 StatusCode fillMapFromHit(SubEventIterator iEvt, float bunchTime, bool isSignal, perEventData_t& data) const;
102
103
104 StatusCode AddHit(const Identifier cellId, const float energy, const float time, const bool iSignal, perEventData_t& data) const;
105
106
107 void cross_talk(const IdentifierHash& idHash,
108 const Identifier& cellId,
109 const float& energy,
110 std::vector<IdentifierHash>& neighbourList,
111 std::vector<float>& energyList,
112 const LArXTalkWeightGlobal& weights) const;
113
114 bool fillMapfromSum(float bunchTime, perEventData_t& data) const;
115
116//
117// >>>>>>>> private data parts
118//
119 ServiceHandle<PileUpMergeSvc> m_mergeSvc{this, "PileUpMergeSvc", "PileUpMergeSvc", ""};
120
121
122 SG::WriteHandleKey<LArHitEMap> m_hitMapKey{this,"LArHitEMapKey","LArHitEMap"};
123 SG::WriteHandleKey<LArHitEMap> m_hitMapKey_DigiHSTruth{this,"LArHitEMap_DigiHSTruthKey","LArHitEMap_DigiHSTruth"};
124
125 Gaudi::Property<bool> m_onlyUseContainerName{this, "OnlyUseContainerName", true, "Don't use the ReadHandleKey directly. Just extract the container name from it."};
126 StringArrayProperty m_inputKeys{this, "InputHitContainers", {"LArHitEMB", "LArHitEMEC", "LArHitHEC", "LArHitFCAL"},
127 "Name of input hit vectors (default=[LArHitEMB, LArHitEMEC, LArHitHEC, LArHitFCAL])" };
128 SG::ReadHandleKeyArray<LArHitContainer> m_hitContainerKeys{this, "InputHitContainerKeys", {}, "Do not set manually!"};
129 SG::ReadHandleKeyArray<LArHitFloatContainer> m_hitFloatContainerKeys{this, "InputHitFloatContainerKeys", {}, "Do not set manually!"};
131 "Name of input digit container"}; // input digit container name
132 SG::ReadHandleKey<CosTrigTime> m_timeKey{this,"CosTimeKey","CosTrigTime"};
133 std::vector <std::string> m_hitContainerNames; // hit container name list
134
135 SG::ReadHandleKey<McEventCollection> m_mcEventColl{this, "McEventCollectionKey", "TruthEvent", "McEventCollection"};
136
137//
138// ........ Algorithm properties
139//
140 Gaudi::Property<bool> m_NoiseOnOff{this, "NoiseOnOff", true,
141 "put electronic noise (default=true)"}; // noise (in all sub-detectors) is on if true
142 Gaudi::Property<bool> m_PileUp{this, "PileUp", false,
143 "Pileup mode (default=false)"}; // pile up or not
144
145// Switches (true by default) on Noise for each sub-detector (can be combined)
146 Gaudi::Property<bool> m_NoiseInEMB {this, "NoiseInEMB", true,
147 "put noise in EMB (default=true)"}; // noise in Barrel is off if false
148 Gaudi::Property<bool> m_NoiseInEMEC{this, "NoiseInEMEC", true,
149 "put noise in EMEC (default=true)"}; // noise in EndCap is off if false
150 Gaudi::Property<bool> m_NoiseInHEC{this, "NoiseInHEC", true,
151 "put noise in HEC (default=true)"}; // noise in HEC is off if false
152 Gaudi::Property<bool> m_NoiseInFCAL{this, "NoiseInFCAL", true,
153 "put noise in FCAL (default=true)"}; // noise in FCAL is off if false
154 //put false if you want cancel the noise in one or several sub-detectors
155 Gaudi::Property<bool> m_CrossTalk{this, "CrossTalk", true,
156 "Simulate cross-talk (default=true)"}; // flag for Cross Talk
157 Gaudi::Property<bool> m_CrossTalkStripMiddle{this, "CrossTalkStripMiddle", true,
158 "Add strip/middle cross talk (if crosstalk is true) (default=true)"}; // flag for strip-middle cross talk (if m_CrooTalk is true)
159 Gaudi::Property<bool> m_CrossTalk2Strip{this, "CrossTalk2Strip", true,
160 "Add 2nd strip cross talk (if crosstalk is true) (default=true)"}; // flag for 2nd neighbor cross-talk
161 Gaudi::Property<bool> m_CrossTalkMiddle{this, "CrossTalkMiddle", true,
162 "Add middle to middle cross talk for barrel(if crosstalk is true) (default=true)"}; // flag for middle to middle cross-talk
163 Gaudi::Property<float> m_scaleStripXtalk{this, "scaleStripXtalk", 1.,
164 "Scale factor for strip xtalk"}; // scale factor for strip to strip cross-talk
165 Gaudi::Property<float> m_scaleStripMiddle{this, "scaleStripMiddle", 1.,
166 "Scale factor for strip-middle xtalk"}; // scale factor for strip-middle cross-talk
167 Gaudi::Property<float> m_scaleMiddleXtalk{this, "scaleMiddleXtalk", 1.,
168 "Scale factor for middle xtalk"}; // scale factor for middle-middle cross-talk
169 // Windows mode
170 Gaudi::Property<bool> m_Windows{this, "Windows", false,
171 "Window mode (produce digits only around true e/photon) (default=false)"};
172 Gaudi::Property<float> m_WindowsEtaSize{this, "WindowsEtaSize", 0.4,
173 "Eta size of window (default=0.4)"};
174 Gaudi::Property<float> m_WindowsPhiSize{this, "WindowsPhiSize", 0.5,
175 "Phi size of window (default=0.5)"};
176 Gaudi::Property<float> m_WindowsPtCut{this, "WindowsPtCut", 5000.,
177 "Pt cut on e/photons for window mode (Default=5GeV)"};
178 //
179 Gaudi::Property<double> m_EnergyThresh{this, "EnergyThresh", -99.,
180 "Hit energy threshold (default=-99)"}; // Zero suppression energy threshold
181
182 Gaudi::Property<bool> m_rndmEvtRun{this, "UseRndmEvtRun", false,
183 "Use Run and Event number to seed rndm number (default=false)"}; // use run,event number for random number seeding
184 Gaudi::Property<bool> m_useTriggerTime{this, "UseTriggerTime", false,
185 "Use Trigger tool (for commissioning) (default=false)"};
186 Gaudi::Property<bool> m_RndmEvtOverlay{this, "RndmEvtOverlay", false,
187 "Pileup and/or noise added by overlaying random events (default=false)"}; // Pileup and noise added by overlaying random events
188 Gaudi::Property<bool> m_isMcOverlay{this, "isMcOverlay", false,
189 "Is input Overlay from MC or data (default=false, from data)"}; // true if input RDO for overlay are from MC, false if from data
190
191 Gaudi::Property<bool> m_useMBTime{this, "UseMBTime", false,
192 "use detailed hit time from MB events in addition to bunch crossing time for pileup (default=false)"};
193 Gaudi::Property<bool> m_recordMap{this, "RecordMap", true,
194 "Record LArHitEMap in detector store for use by LArL1Sim (default=true)"};
195 Gaudi::Property<bool> m_useLArHitFloat{this, "useLArFloat", true,
196 "Use simplified transient LArHit (default=false)"};
197 Gaudi::Property<bool> m_pedestalNoise{this, "PedestalNoise", false,
198 "Use noise from Pedestal structure instead of LArNoise (default=false)"};
199 Gaudi::Property<bool> m_addPhase{this, "AddPhase", false,
200 "Add random phase (default = false)"};
201 Gaudi::Property<float> m_phaseMin{this, "PhaseMin", 0.,
202 "Minimum time to add (default=0)"};
203 Gaudi::Property<float> m_phaseMax{this, "PhaseMax", 25.0,
204 "Maximum time to add (default=25)"};
205 Gaudi::Property<bool> m_ignoreTime{this, "IgnoreTime", false,
206 "Set all hit time to 0, for debugging (default = false)"};
207 Gaudi::Property<bool> m_roundingNoNoise{this, "RoundingNoNoise", true,
208 "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
209
210 SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"};
211
212 SG::ReadCondHandleKey<LArXTalkWeightGlobal> m_xtalkKey{this,"LArXTalkWeightGlobal","LArXTalkWeightGlobal","SG Key of XTalk vector of object"};
213
214
215 SG::ReadCondHandleKey<CaloDetDescrManager> m_caloMgrKey{this,"CaloDetDescrManager", "CaloDetDescrManager"};
216
217
223
224 Gaudi::Property<bool> m_skipNoHit{this, "SkipNoHit", false,
225 "Skip events with no LAr hits (default=false)"};
226
227 ServiceHandle<IAthRNGSvc> m_rndmGenSvc{this, "RndmSvc", "AthRNGSvc", ""};
228
229 Gaudi::Property<std::string> m_randomStreamName{this, "RandomStreamName", "LArDigitization", ""};
230
231 Gaudi::Property<uint32_t> m_randomSeedOffset{this, "RandomSeedOffset", 2, ""}; //
232
233 Gaudi::Property<bool> m_useLegacyRandomSeeds{this, "UseLegacyRandomSeeds", false,
234 "Use MC16-style random number seeding"};
235
236 Gaudi::Property<bool> m_doDigiTruth{this, "DoDigiTruthReconstruction", false,
237 "Also create information about reconstructed digits for HS hits"};
238
239
240 //Backward compatiblity: Keep per-event data as class-member
242
243};
244
245#endif
Definition of CaloDetDescrManager.
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
std::vector< xAOD::EventInfo::SubEvent >::const_iterator SubEventIterator
Definition IPileUpTool.h:22
the preferred mechanism to access information from the different event stores in a pileup job.
helper base class IPileUpTool::toProcess().
Property holding a SG store/key/clid from which a WriteHandle is made.
Handle class for recording to StoreGate.
Helper class for offline cell identifiers.
Definition CaloCell_ID.h:34
interface to a tool that returns the time offset of the current trigger.
This is a "hash" representation of an Identifier.
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
Gaudi::Property< bool > m_NoiseOnOff
Gaudi::Property< bool > m_useLArHitFloat
Gaudi::Property< bool > m_CrossTalkMiddle
Gaudi::Property< float > m_scaleStripMiddle
Gaudi::Property< bool > m_useMBTime
Gaudi::Property< float > m_WindowsPhiSize
Gaudi::Property< bool > m_skipNoHit
Gaudi::Property< bool > m_CrossTalk2Strip
const CaloCell_ID * m_calocell_id
virtual StatusCode initialize() override final
const LArFCAL_ID * m_larfcal_id
std::vector< std::string > m_hitContainerNames
Gaudi::Property< bool > m_ignoreTime
Gaudi::Property< float > m_phaseMin
SG::ReadHandleKey< CosTrigTime > m_timeKey
SG::WriteHandleKey< LArHitEMap > m_hitMapKey_DigiHSTruth
Gaudi::Property< bool > m_isMcOverlay
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Gaudi::Property< bool > m_recordMap
Gaudi::Property< bool > m_NoiseInEMB
Gaudi::Property< bool > m_CrossTalkStripMiddle
Gaudi::Property< bool > m_NoiseInEMEC
Gaudi::Property< float > m_WindowsEtaSize
Gaudi::Property< bool > m_doDigiTruth
bool fillMapfromSum(float bunchTime, perEventData_t &data) const
SG::ReadHandleKeyArray< LArHitFloatContainer > m_hitFloatContainerKeys
Gaudi::Property< bool > m_NoiseInFCAL
Gaudi::Property< float > m_scaleStripXtalk
Gaudi::Property< float > m_WindowsPtCut
Gaudi::Property< bool > m_RndmEvtOverlay
LArPileUpTool(const std::string &type, const std::string &name, const IInterface *parent)
SG::ReadHandleKey< LArDigitContainer > m_inputDigitContainerKey
StringArrayProperty m_inputKeys
Gaudi::Property< float > m_phaseMax
StatusCode fillMapFromHit(const EventContext &ctx, float tbunch, bool isSignal, perEventData_t &data) const
SG::ReadHandleKey< McEventCollection > m_mcEventColl
ServiceHandle< PileUpMergeSvc > m_mergeSvc
Gaudi::Property< bool > m_addPhase
virtual StatusCode processAllSubEvents(const EventContext &ctx) override final
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Gaudi::Property< bool > m_pedestalNoise
Gaudi::Property< uint32_t > m_randomSeedOffset
virtual StatusCode prepareEvent(const EventContext &ctx, unsigned int nInputEvents) override final
Gaudi::Property< double > m_EnergyThresh
Gaudi::Property< bool > m_useLegacyRandomSeeds
Gaudi::Property< bool > m_rndmEvtRun
const LArOnlineID * m_laronline_id
SG::ReadCondHandleKey< LArXTalkWeightGlobal > m_xtalkKey
StatusCode AddHit(const Identifier cellId, const float energy, const float time, const bool iSignal, perEventData_t &data) const
void cross_talk(const IdentifierHash &idHash, const Identifier &cellId, const float &energy, std::vector< IdentifierHash > &neighbourList, std::vector< float > &energyList, const LArXTalkWeightGlobal &weights) const
Gaudi::Property< bool > m_onlyUseContainerName
Gaudi::Property< bool > m_useTriggerTime
const LArEM_ID * m_larem_id
Gaudi::Property< bool > m_PileUp
SG::WriteHandleKey< LArHitEMap > m_hitMapKey
Gaudi::Property< bool > m_NoiseInHEC
Gaudi::Property< float > m_scaleMiddleXtalk
const LArHEC_ID * m_larhec_id
SG::ReadHandleKeyArray< LArHitContainer > m_hitContainerKeys
Gaudi::Property< bool > m_roundingNoNoise
ServiceHandle< IAthRNGSvc > m_rndmGenSvc
virtual StatusCode processBunchXing(int bunchXing, SubEventIterator bSubEvents, SubEventIterator eSubEvents) override final
perEventData_t m_data
Gaudi::Property< bool > m_Windows
Gaudi::Property< bool > m_CrossTalk
Gaudi::Property< std::string > m_randomStreamName
PileUpToolBase(const std::string &type, const std::string &name, const IInterface *parent)
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.
HandleKeyArray< ReadHandle< T >, ReadHandleKey< T >, Gaudi::DataHandle::Reader > ReadHandleKeyArray
std::vector< float > m_energySum
std::vector< float > m_energySum_DigiHSTruth
const LArXTalkWeightGlobal * m_weights
#define private