7#include "CLHEP/Random/RandomEngine.h"
17 const std::string& name,
18 const IInterface* pIID) :
43 return StatusCode::FAILURE;
53 return StatusCode::SUCCESS;
60 return StatusCode::SUCCESS;
79 "Could not get Pixel SiHitCollection container " << hitCollection.
name() <<
" from store " <<
80 hitCollection.
store());
81 return StatusCode::FAILURE;
88 ATH_MSG_DEBUG(
"SiHitCollection found with " << hitCollection->size() <<
" hits");
90 TimedHitCollList hitCollList;
91 unsigned int numberOfSiHits(0);
95 for (
auto & iColl : hitCollList) {
109 ATH_MSG_DEBUG(
"SiTrackerHitCollection found with" << p_collection->
size() <<
" hits");
116 return StatusCode::SUCCESS;
127 if (not pixelDetEleHandle.
isValid() or elements ==
nullptr) {
129 return StatusCode::FAILURE;
132 std::unique_ptr<SiChargedDiodeCollection> chargedDiodes = std::make_unique<SiChargedDiodeCollection>();
133 std::vector<std::pair<double, double> > trfHitRecord;
134 std::vector<double> initialConditions;
136 std::vector<bool> processedElements;
137 processedElements.resize(
m_detID->wafer_hash_max(),
false);
141 rngWrapper->
setSeed(name(), ctx);
142 CLHEP::HepRandomEngine* rndmEngine = rngWrapper->
getEngine(ctx);
154 (*firstHit)->getLayerDisk(),
155 (*firstHit)->getPhiModule(), (*firstHit)->getEtaModule());
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);
170 chargedDiodes->setDetectorElement(sielement);
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())));
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) {
198 initialConditions.clear();
199 trfHitRecord.clear();
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()));
212 assert(idHash < processedElements.size());
213 processedElements[idHash] =
true;
220 for (
unsigned int itool = 0; itool <
m_fesimTool.size(); itool++) {
222 m_fesimTool[itool]->process(ctx, *chargedDiodes, *RDOColl, rndmEngine);
228 addSDO(chargedDiodes.get(), event_data);
229 chargedDiodes->clear();
239 for (
unsigned int i = 0; i < processedElements.size(); i++) {
240 if (!processedElements[i]) {
243 ATH_MSG_ERROR(
"PixelDetector element id hash is invalid = " << i);
248 ATH_MSG_DEBUG(
"In digitize of untouched elements: layer - phi - eta " <<
251 element->
identify()) <<
" - " <<
"size: " << processedElements.size());
253 chargedDiodes->setDetectorElement(element);
259 for (
unsigned int itool = 0; itool <
m_fesimTool.size(); itool++) {
261 m_fesimTool[itool]->process(ctx, *chargedDiodes, *RDOColl, rndmEngine);
267 addSDO(chargedDiodes.get(),event_data);
268 chargedDiodes->clear();
275 return StatusCode::SUCCESS;
286 std::vector<InDetSimData::Deposit> deposits;
294 const list_t& charges = (*i_chargedDiode).second.totalCharge().chargeComposition();
296 bool real_particle_hit =
false;
298 list_t::const_iterator EndOfChargeList = charges.end();
299 for (list_t::const_iterator i_ListOfCharges = charges.begin(); i_ListOfCharges != EndOfChargeList;
305 if (!real_particle_hit) {
306 real_particle_hit = trkLink.
isValid();
309 const auto theDeposit = std::find_if( deposits.rbegin(), deposits.rend(),
311 return deposit.first == trkLink;
314 if (theDeposit != deposits.rend()) {
315 theDeposit->second += i_ListOfCharges->charge();
317 deposits.emplace_back(trkLink, i_ListOfCharges->charge());
324 std::move(deposits), (*i_chargedDiode).second.flag());
345 event_data.
m_timedHits = std::make_unique<TimedHitCollection<SiHit> >();
348 return StatusCode::SUCCESS;
366 return StatusCode::SUCCESS;
374 ATH_MSG_VERBOSE(
"PixelDigitizationTool::processBunchXing() " << bunchXing);
379 return StatusCode::SUCCESS;
382 return StatusCode::SUCCESS;
389 TimedHitCollList hitCollList;
392 bSubEvents, eSubEvents).isSuccess()) &&
393 hitCollList.empty()) {
395 return StatusCode::FAILURE;
400 TimedHitCollList::iterator iColl(hitCollList.begin());
401 TimedHitCollList::iterator endColl(hitCollList.end());
403 for (; iColl != endColl; ++iColl) {
408 "time index info. time: " << timeIndex.
time() <<
" index: " << timeIndex.
index() <<
" type: " <<
414 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
This is an Identifier helper class for the Pixel subdetector.
InDetRawDataCollection< PixelRDORawData > PixelRDO_Collection
SiChargedDiodeMap::iterator SiChargedDiodeIterator
AtlasHitsVector< SiHit > SiHitCollection
A wrapper class for event-slot-local random engines.
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.
a link optimized in size for a GenParticle in a McEventCollection
bool isValid() const
Validity check.
This is a "hash" representation of an Identifier.
constexpr bool is_valid() const
Class used to describe the design of a module (diode segmentation and readout scheme).
Class to hold the SiDetectorElement objects to be put in the detector store.
const SiDetectorElement * getDetectorElement(const IdentifierHash &hash) const
Class to hold geometrical description of a silicon detector element.
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)
std::pair< HepMcParticleLink, float > Deposit
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
std::string store() const
Return the name of the store holding the object we are proxying.
const std::string & name() const
Return the StoreGate ID for the referenced object.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SiChargedDiodeIterator begin()
SiChargedDiodeIterator end()
Identifier getId(const InDetDD::SiCellId &id) const
std::vector< SiCharge > list_t
void reserve(unsigned int numberOfHits)
reserve a timed vector numberOfHits in size.
bool nextDetectorElement(const_iterator &b, const_iterator &e)
sets an iterator range with the hits of current detector element returns a bool when done
TimedVector::const_iterator const_iterator
void insert(const PileUpTimeEventIndex &timeEventIndex, const AtlasHitsVector< HIT > *inputCollection)
bool ignoreTruthLink(const T &p, bool vetoPileUp)
Helper function for SDO creation in PileUpTools.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
std::list< value_t > type
type of the collection of timed data object
a struct encapsulating the identifier of a pile-up event
index_type index() const
the index of the component event in PileUpEventInfo
PileUpType type() const
the pileup type - minbias, cavern, beam halo, signal?
time_type time() const
bunch xing time in ns