12#include "Identifier/Identifier.h"
24 const std::string& name,
25 const IInterface* parent)
32 ATH_MSG_DEBUG(
"Retrieved MuonDetectorManager from DetectorStore.");
42 return StatusCode::FAILURE;
51 return StatusCode::FAILURE;
78 m_digitizer->setLevel(
static_cast<MSG::Level
>(msgLevel()));
83 return StatusCode::SUCCESS;
92 return StatusCode::SUCCESS;
99 ATH_MSG_DEBUG(
"TgcDigitizationTool::processBunchXing() " << bunchXing);
103 TimedHitCollList hitCollList;
107 bunchXing, bSubEvents, eSubEvents)
109 hitCollList.empty()) {
111 return StatusCode::FAILURE;
114 <<
" TGCSimHitCollection with key "
118 TimedHitCollList::iterator iColl(hitCollList.begin());
119 TimedHitCollList::iterator endColl(hitCollList.end());
122 for (; iColl != endColl; ++iColl) {
131 << timeIndex.
time() <<
" index: " << timeIndex.
index()
132 <<
" type: " << timeIndex.
type());
134 m_thpcTGC->insert(timeIndex, hitCollPtr);
138 return StatusCode::SUCCESS;
150 std::list<TGCSimHitCollection*>::iterator TGCHitColl =
152 std::list<TGCSimHitCollection*>::iterator TGCHitCollEnd =
154 while (TGCHitColl != TGCHitCollEnd) {
155 delete (*TGCHitColl);
160 return StatusCode::SUCCESS;
174 return StatusCode::SUCCESS;
184 return StatusCode::SUCCESS;
194 using TimedHitCollList =
202 if (!hitCollection.
isValid()) {
204 << hitCollection.
name() <<
" from store "
205 << hitCollection.
store());
206 return StatusCode::FAILURE;
212 ATH_MSG_DEBUG(
"TGCSimHitCollection found with " << hitCollection->size()
215 return StatusCode::SUCCESS;
219 TimedHitCollList hitCollList;
224 return StatusCode::FAILURE;
226 if (hitCollList.empty()) {
228 return StatusCode::FAILURE;
231 <<
" TGCSimHitCollections with key "
239 TimedHitCollList::iterator iColl = hitCollList.begin();
240 TimedHitCollList::iterator endColl = hitCollList.end();
241 while (iColl != endColl) {
243 m_thpcTGC->insert(iColl->first, p_collection);
245 << p_collection->
size()
249 return StatusCode::SUCCESS;
255 rngWrapper->
setSeed(name(), ctx);
256 CLHEP::HepRandomEngine* rndmEngine = rngWrapper->
getEngine(ctx);
262 std::make_unique<TgcDigitContainer>(
m_idHelper->module_hash_max())));
268 ATH_CHECK(sdoContainer.
record(std::make_unique<MuonSimDataCollection>()));
280 ASDpos = readHandle_ASDpos.
cptr();
283 "ASD Position parameters /TGC/DIGIT/ASDPOS must be available for "
284 "TGC_Digitization. Check the configuration!");
290 TOffset = readHandle_TimeOffset.
cptr();
293 "Timing Offset parameters /TGC/DIGIT/TOFFSET must be available for "
294 "TGC_Digitization. Check the configuration!");
300 Crosstalk = readHandle_Crosstalk.
cptr();
303 "/TGC/DIGIT/XTALK is not provided. Probabilities of TGC channel "
304 "crosstalk will be zero.");
307 std::vector<std::unique_ptr<TgcDigitCollection> > collections;
310 while (
m_thpcTGC->nextDetectorElement(i, e)) {
311 ATH_MSG_DEBUG(
"TgcDigitizationTool::digitizeCore next element");
317 double globalHitTime =
hitTime(phit);
318 double tof = phit->globalTime();
320 &hit, globalHitTime, ASDpos, TOffset, Crosstalk, rndmEngine);
326 for (it_digiHits = digiHits->
begin();
327 it_digiHits != digiHits->
end(); ++it_digiHits) {
337 Identifier newDigiId = (*it_digiHits)->identify();
338 uint16_t newBcTag = (*it_digiHits)->bcTag();
344 if (
m_idHelper->get_hash(elemId, coll_hash, &tgcContext)) {
346 "Unable to get TGC hash id from TGC Digit collection "
347 <<
"context begin_index = " << tgcContext.
begin_index()
348 <<
" context end_index = " << tgcContext.
end_index()
349 <<
" the identifier is ");
354 auto newDigit = std::make_unique<TgcDigit>(newDigiId, newBcTag);
357 bool duplicate =
false;
358 if (coll_hash >= collections.size()) {
359 collections.resize(coll_hash + 1);
361 digitCollection = collections[coll_hash].
get();
362 if (
nullptr == digitCollection) {
363 collections[coll_hash] =
364 std::make_unique<TgcDigitCollection>(elemId, coll_hash);
365 digitCollection = collections[coll_hash].
get();
368 <<
" BC tag = " << newBcTag
369 <<
" Coll. key = " << coll_hash);
370 digitCollection->
push_back(std::move(newDigit));
374 for (it_tgcDigit = digitCollection->
begin();
375 it_tgcDigit != digitCollection->
end(); ++it_tgcDigit) {
376 if (newDigiId == (*it_tgcDigit)->identify() &&
377 newBcTag == (*it_tgcDigit)->bcTag()) {
383 <<
" BC tag = " << newBcTag);
389 digitCollection->
push_back(std::move(newDigit));
392 <<
" BC tag = " << newBcTag);
397 static const double invalid_pos = -99999.;
414 std::vector<MuonSimData::Deposit> deposits;
415 deposits.emplace_back(
421 sdoContainer->insert(std::make_pair(newDigiId,
simData));
429 for (
size_t coll_hash = 0; coll_hash < collections.size(); ++coll_hash) {
430 if (collections[coll_hash]) {
432 collections[coll_hash].release(), coll_hash));
436 return StatusCode::SUCCESS;
float hitTime(const AFP_SIDSimHit &hit)
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
Helpers for checking error return status codes and reporting errors.
AtlasHitsVector< TGCSimHit > TGCSimHitCollection
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.
DataModel_detail::const_iterator< DataVector > const_iterator
const T * get(size_type n) const
Access an element, as an rvalue.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
static HepMcParticleLink getRedirectedLink(const HepMcParticleLink &particleLink, uint32_t eventIndex, const EventContext &ctx)
Return a HepMcParticleLink pointing at the same particle, but in a different GenEvent.
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
size_type begin_index() const
size_type end_index() const
This is a "hash" representation of an Identifier.
void show() const
Print out in hex form.
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
const Amg::Transform3D & localToGlobalTransf(const Identifier &id) const
Returns the local -> global transformation x-axis: Parallel to the wires (strips) if the Identifier b...
const_pointer_type cptr()
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.
const Amg::Vector3D & localPosition() const
static const TgcHitIdHelper * GetHelper()
TimedVector::const_iterator const_iterator
a smart pointer to a hit that also provides access to the extended timing info of the host event.
unsigned short eventId() const
the index of the component event in PileUpEventInfo.
Eigen::Matrix< double, 3, 1 > Vector3D
bool ignoreTruthLink(const T &p, bool vetoPileUp)
Helper function for SDO creation in PileUpTools.
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