7#include "CLHEP/Random/RandomEngine.h"
16 const std::string& name,
17 const IInterface* pIID) :
42 return StatusCode::FAILURE;
52 return StatusCode::SUCCESS;
59 return StatusCode::SUCCESS;
78 "Could not get Pixel SiHitCollection container " << hitCollection.
name() <<
" from store " <<
79 hitCollection.
store());
80 return StatusCode::FAILURE;
87 ATH_MSG_DEBUG(
"SiHitCollection found with " << hitCollection->size() <<
" hits");
89 TimedHitCollList hitCollList;
90 unsigned int numberOfSiHits(0);
94 for (
auto & iColl : hitCollList) {
108 ATH_MSG_DEBUG(
"SiTrackerHitCollection found with" << p_collection->
size() <<
" hits");
115 return StatusCode::SUCCESS;
126 if (not pixelDetEleHandle.
isValid() or elements ==
nullptr) {
128 return StatusCode::FAILURE;
131 std::unique_ptr<SiChargedDiodeCollection> chargedDiodes = std::make_unique<SiChargedDiodeCollection>();
132 std::vector<std::pair<double, double> > trfHitRecord;
133 std::vector<double> initialConditions;
135 std::vector<bool> processedElements;
136 processedElements.resize(
m_detID->wafer_hash_max(),
false);
140 rngWrapper->
setSeed(name(), ctx);
141 CLHEP::HepRandomEngine* rndmEngine = rngWrapper->
getEngine(ctx);
153 (*firstHit)->getLayerDisk(),
154 (*firstHit)->getPhiModule(), (*firstHit)->getEtaModule());
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);
169 chargedDiodes->setDetectorElement(sielement);
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())));
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) {
197 initialConditions.clear();
198 trfHitRecord.clear();
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()));
211 assert(idHash < processedElements.size());
212 processedElements[idHash] =
true;
219 for (
unsigned int itool = 0; itool <
m_fesimTool.size(); itool++) {
221 m_fesimTool[itool]->process(*chargedDiodes, *RDOColl, rndmEngine);
227 addSDO(chargedDiodes.get(), event_data);
228 chargedDiodes->clear();
238 for (
unsigned int i = 0; i < processedElements.size(); i++) {
239 if (!processedElements[i]) {
242 ATH_MSG_ERROR(
"PixelDetector element id hash is invalid = " << i);
247 ATH_MSG_DEBUG(
"In digitize of untouched elements: layer - phi - eta " <<
250 element->
identify()) <<
" - " <<
"size: " << processedElements.size());
252 chargedDiodes->setDetectorElement(element);
258 for (
unsigned int itool = 0; itool <
m_fesimTool.size(); itool++) {
260 m_fesimTool[itool]->process(*chargedDiodes, *RDOColl, rndmEngine);
266 addSDO(chargedDiodes.get(),event_data);
267 chargedDiodes->clear();
274 return StatusCode::SUCCESS;
285 std::vector<InDetSimData::Deposit> deposits;
293 const list_t& charges = (*i_chargedDiode).second.totalCharge().chargeComposition();
295 bool real_particle_hit =
false;
297 list_t::const_iterator EndOfChargeList = charges.end();
298 for (list_t::const_iterator i_ListOfCharges = charges.begin(); i_ListOfCharges != EndOfChargeList;
304 if (!real_particle_hit) {
305 real_particle_hit = trkLink.
isValid();
308 std::vector<InDetSimData::Deposit>::reverse_iterator theDeposit = deposits.rend();
309 std::vector<InDetSimData::Deposit>::reverse_iterator depositsR_end = deposits.rend();
310 std::vector<InDetSimData::Deposit>::reverse_iterator i_Deposit = deposits.rbegin();
311 for (; i_Deposit != depositsR_end; ++i_Deposit) {
312 if ((*i_Deposit).first == trkLink) {
313 theDeposit = i_Deposit;
319 if (theDeposit != depositsR_end) (*theDeposit).second += i_ListOfCharges->charge();
321 deposits.emplace_back(trkLink, i_ListOfCharges->charge());
328 std::move(deposits), (*i_chargedDiode).second.flag());
349 event_data.
m_timedHits = std::make_unique<TimedHitCollection<SiHit> >();
352 return StatusCode::SUCCESS;
370 return StatusCode::SUCCESS;
378 ATH_MSG_VERBOSE(
"PixelDigitizationTool::processBunchXing() " << bunchXing);
383 return StatusCode::SUCCESS;
386 return StatusCode::SUCCESS;
393 TimedHitCollList hitCollList;
396 bSubEvents, eSubEvents).isSuccess()) &&
397 hitCollList.empty()) {
399 return StatusCode::FAILURE;
404 TimedHitCollList::iterator iColl(hitCollList.begin());
405 TimedHitCollList::iterator endColl(hitCollList.end());
407 for (; iColl != endColl; ++iColl) {
412 "time index info. time: " << timeIndex.
time() <<
" index: " << timeIndex.
index() <<
" type: " <<
418 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.
bool is_valid() const
Check if id is in a valid state.
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)
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