122 {
124
125 SG::ReadCondHandle<InDetDD::SiDetectorElementCollection> pixelDetEleHandle(
m_pixelDetEleCollKey, ctx);
126 const InDetDD::SiDetectorElementCollection* elements(*pixelDetEleHandle);
127 if (not pixelDetEleHandle.isValid() or elements == nullptr) {
129 return StatusCode::FAILURE;
130 }
131
132 std::unique_ptr<SiChargedDiodeCollection> chargedDiodes = std::make_unique<SiChargedDiodeCollection>();
133 std::vector<std::pair<double, double> > trfHitRecord;
134 std::vector<double> initialConditions;
135
136 std::vector<bool> processedElements;
137 processedElements.resize(
m_detID->wafer_hash_max(),
false);
138
139
140 ATHRNG::RNGWrapper* rngWrapper =
m_rndmSvc->getEngine(
this);
142 CLHEP::HepRandomEngine* rndmEngine = rngWrapper->
getEngine(ctx);
143
145
147
149 assert(event_data.m_timedHits);
150 while (event_data.m_timedHits->nextDetectorElement(firstHit, lastHit)) {
151
153 Identifier
id =
m_detID->wafer_id((*firstHit)->getBarrelEndcap(),
154 (*firstHit)->getLayerDisk(),
155 (*firstHit)->getPhiModule(), (*firstHit)->getEtaModule());
156 IdentifierHash wafer_hash =
m_detID->wafer_hash(
id);
157
158
159 const InDetDD::SiDetectorElement* sielement = elements->getDetectorElement(wafer_hash);
160
161 if (sielement == nullptr) {
163 " Barrel=" << (*firstHit)->getBarrelEndcap() << " Layer=" << (*firstHit)->getLayerDisk() << " Eta=" <<
164 (*firstHit)->getEtaModule() << " Phi=" << (*firstHit)->getPhiModule());
165 ATH_MSG_ERROR(
"detector manager could not find element with id = " <<
id);
166 break;
167 }
168
169
170 chargedDiodes->setDetectorElement(sielement);
171 const InDetDD::PixelModuleDesign* p_design =
static_cast<const InDetDD::PixelModuleDesign*
>(&(sielement->
design()));
172
174
177
178 if (std::abs((*phit)->meanTime()) < 10000.0 * CLHEP::ns) {
180 m_detID->wafer_hash(
m_detID->wafer_id((*phit)->getBarrelEndcap(), (*phit)->getLayerDisk(),
181 (*phit)->getPhiModule(), (*phit)->getEtaModule())));
182
183
185
186
188 rndmEngine, ctx));
189
190
191 for (
unsigned int itool = 0; itool <
m_chargeTool.size(); itool++) {
193 if (
m_chargeTool[itool]->induceCharge(*phit, *chargedDiodes, *sielement, *p_design, trfHitRecord,
194 initialConditions, rndmEngine, ctx) == StatusCode::FAILURE) {
195 break;
196 }
197 }
198 initialConditions.clear();
199 trfHitRecord.clear();
201 }
202 }
203
205 ATH_MSG_DEBUG(
"in digitize elements with hits: ec - layer - eta - phi " <<
206 m_detID->barrel_ec(chargedDiodes->identify()) <<
" - " <<
m_detID->layer_disk(
207 chargedDiodes->identify()) <<
" - " <<
m_detID->eta_module(
208 chargedDiodes->identify()) <<
" - " <<
m_detID->phi_module(chargedDiodes->identify()));
209
210 IdentifierHash idHash = chargedDiodes->identifyHash();
211
212 assert(idHash < processedElements.size());
213 processedElements[idHash] = true;
214
216
220 for (
unsigned int itool = 0; itool <
m_fesimTool.size(); itool++) {
222 m_fesimTool[itool]->process(ctx, *chargedDiodes, *RDOColl, rndmEngine);
223 }
224 assert(event_data.m_rdoContainer.isValid());
226
228 addSDO(chargedDiodes.get(), event_data);
229 chargedDiodes->clear();
230 }
231 event_data.m_timedHits.reset();
233
235
239 for (
unsigned int i = 0;
i < processedElements.size();
i++) {
240 if (!processedElements[i]) {
241 IdentifierHash idHash =
i;
243 ATH_MSG_ERROR(
"PixelDetector element id hash is invalid = " << i);
244 }
245
246 const InDetDD::SiDetectorElement* element = elements->getDetectorElement(idHash);
247 if (element) {
248 ATH_MSG_DEBUG(
"In digitize of untouched elements: layer - phi - eta " <<
251 element->
identify()) <<
" - " <<
"size: " << processedElements.size());
252
253 chargedDiodes->setDetectorElement(element);
255
256
259 for (
unsigned int itool = 0; itool <
m_fesimTool.size(); itool++) {
261 m_fesimTool[itool]->process(ctx, *chargedDiodes, *RDOColl, rndmEngine);
262 }
263 assert( event_data.m_rdoContainer.isValid());
265
267 addSDO(chargedDiodes.get(),event_data);
268 chargedDiodes->clear();
269 }
270 }
271 }
272 }
274
275 return StatusCode::SUCCESS;
276}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
InDetRawDataCollection< PixelRDORawData > PixelRDO_Collection
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
constexpr bool is_valid() const
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
virtual Identifier identify() const override final
identifier of this detector element (inline)
virtual IdentifierHash identifyHash() const override final
void setIdentifier(Identifier id)
TimedVector::const_iterator const_iterator