121 {
123
124 SG::ReadCondHandle<InDetDD::SiDetectorElementCollection> pixelDetEleHandle(
m_pixelDetEleCollKey, ctx);
125 const InDetDD::SiDetectorElementCollection* elements(*pixelDetEleHandle);
126 if (not pixelDetEleHandle.isValid() or elements == nullptr) {
128 return StatusCode::FAILURE;
129 }
130
131 std::unique_ptr<SiChargedDiodeCollection> chargedDiodes = std::make_unique<SiChargedDiodeCollection>();
132 std::vector<std::pair<double, double> > trfHitRecord;
133 std::vector<double> initialConditions;
134
135 std::vector<bool> processedElements;
136 processedElements.resize(
m_detID->wafer_hash_max(),
false);
137
138
139 ATHRNG::RNGWrapper* rngWrapper =
m_rndmSvc->getEngine(
this);
141 CLHEP::HepRandomEngine* rndmEngine = rngWrapper->
getEngine(ctx);
142
144
146
148 assert(event_data.m_timedHits);
149 while (event_data.m_timedHits->nextDetectorElement(firstHit, lastHit)) {
150
152 Identifier
id =
m_detID->wafer_id((*firstHit)->getBarrelEndcap(),
153 (*firstHit)->getLayerDisk(),
154 (*firstHit)->getPhiModule(), (*firstHit)->getEtaModule());
155 IdentifierHash wafer_hash =
m_detID->wafer_hash(
id);
156
157
158 const InDetDD::SiDetectorElement* sielement = elements->getDetectorElement(wafer_hash);
159
160 if (sielement == nullptr) {
162 " Barrel=" << (*firstHit)->getBarrelEndcap() << " Layer=" << (*firstHit)->getLayerDisk() << " Eta=" <<
163 (*firstHit)->getEtaModule() << " Phi=" << (*firstHit)->getPhiModule());
164 ATH_MSG_ERROR(
"detector manager could not find element with id = " <<
id);
165 break;
166 }
167
168
169 chargedDiodes->setDetectorElement(sielement);
170 const InDetDD::PixelModuleDesign* p_design =
static_cast<const InDetDD::PixelModuleDesign*
>(&(sielement->
design()));
171
173
176
177 if (std::abs((*phit)->meanTime()) < 10000.0 * CLHEP::ns) {
179 m_detID->wafer_hash(
m_detID->wafer_id((*phit)->getBarrelEndcap(), (*phit)->getLayerDisk(),
180 (*phit)->getPhiModule(), (*phit)->getEtaModule())));
181
182
184
185
187 rndmEngine, ctx));
188
189
190 for (
unsigned int itool = 0; itool <
m_chargeTool.size(); itool++) {
192 if (
m_chargeTool[itool]->induceCharge(*phit, *chargedDiodes, *sielement, *p_design, trfHitRecord,
193 initialConditions, rndmEngine, ctx) == StatusCode::FAILURE) {
194 break;
195 }
196 }
197 initialConditions.clear();
198 trfHitRecord.clear();
200 }
201 }
202
204 ATH_MSG_DEBUG(
"in digitize elements with hits: ec - layer - eta - phi " <<
205 m_detID->barrel_ec(chargedDiodes->identify()) <<
" - " <<
m_detID->layer_disk(
206 chargedDiodes->identify()) <<
" - " <<
m_detID->eta_module(
207 chargedDiodes->identify()) <<
" - " <<
m_detID->phi_module(chargedDiodes->identify()));
208
209 IdentifierHash idHash = chargedDiodes->identifyHash();
210
211 assert(idHash < processedElements.size());
212 processedElements[idHash] = true;
213
215
219 for (
unsigned int itool = 0; itool <
m_fesimTool.size(); itool++) {
221 m_fesimTool[itool]->process(*chargedDiodes, *RDOColl, rndmEngine);
222 }
223 assert(event_data.m_rdoContainer.isValid());
225
227 addSDO(chargedDiodes.get(), event_data);
228 chargedDiodes->clear();
229 }
230 event_data.m_timedHits.reset();
232
234
238 for (
unsigned int i = 0;
i < processedElements.size();
i++) {
239 if (!processedElements[i]) {
240 IdentifierHash idHash =
i;
242 ATH_MSG_ERROR(
"PixelDetector element id hash is invalid = " << i);
243 }
244
245 const InDetDD::SiDetectorElement* element = elements->getDetectorElement(idHash);
246 if (element) {
247 ATH_MSG_DEBUG(
"In digitize of untouched elements: layer - phi - eta " <<
250 element->
identify()) <<
" - " <<
"size: " << processedElements.size());
251
252 chargedDiodes->setDetectorElement(element);
254
255
258 for (
unsigned int itool = 0; itool <
m_fesimTool.size(); itool++) {
260 m_fesimTool[itool]->process(*chargedDiodes, *RDOColl, rndmEngine);
261 }
262 assert( event_data.m_rdoContainer.isValid());
264
266 addSDO(chargedDiodes.get(),event_data);
267 chargedDiodes->clear();
268 }
269 }
270 }
271 }
273
274 return StatusCode::SUCCESS;
275}
#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.
bool is_valid() const
Check if id is in a valid state.
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