|
ATLAS Offline Software
|
Go to the documentation of this file.
17 #include "Identifier/Identifier.h"
30 #include "CLHEP/Random/RandomEngine.h"
40 const std::string&
name,
41 const IInterface*
parent) :
76 return StatusCode::FAILURE;
93 return StatusCode::SUCCESS;
97 class SiDigitizationSurfaceChargeInserter
103 : m_sielement(sielement),
104 m_chargedDiodes(chargedDiodes) {
114 void SiDigitizationSurfaceChargeInserter::operator ()
117 SiCellId diode{m_sielement->cellIdOfPosition(scharge.position())};
119 if (diode.isValid()) {
121 m_chargedDiodes->add(diode, scharge.charge());
139 return StatusCode::SUCCESS;
151 return StatusCode::SUCCESS;
167 return StatusCode::SUCCESS;
180 return StatusCode::SUCCESS;
185 return StatusCode::FAILURE;
190 CLHEP::HepRandomEngine *rndmEngine = rngWrapper->
getEngine(ctx);
209 return StatusCode::SUCCESS;
229 m_thpcsi = std::make_unique<TimedHitCollection<SiHit>>();
231 return StatusCode::SUCCESS;
243 CLHEP::HepRandomEngine *rndmEngine = rngWrapper->
getEngine(ctx);
258 return StatusCode::SUCCESS;
280 ATH_MSG_DEBUG(
"in digitize elements with hits: ec - layer - eta - phi "
285 <<
" processing hit number " << hitcount);
292 assert(idHash < processedElements->
size());
293 (*processedElements)[idHash] =
true;
297 if (not chargedDiodes.
empty()) {
299 if (
sc.isSuccess()) {
301 addSDO(&chargedDiodes, simDataCollMap);
305 chargedDiodes.
clear();
315 if (elements==
nullptr) {
323 for (
unsigned int i{0};
i < processedElements->size();
i++) {
324 if (not (*processedElements)[
i]) {
326 if (not idHash.is_valid()) {
332 ATH_MSG_DEBUG(
"In digitize of untouched elements: layer - phi - eta "
336 <<
"size: " << processedElements->size());
344 if (not chargedDiodes.
empty()) {
346 if (
sc.isSuccess()) {
348 addSDO(&chargedDiodes, simDataCollMap);
352 chargedDiodes.
clear();
360 if (
nullptr == thpcsi) {
376 int barrel{firstHit->getBarrelEndcap()};
378 firstHit->getLayerDisk(),
379 firstHit->getPhiModule(),
380 firstHit->getEtaModule(),
381 firstHit->getSide())};
387 if (elements==
nullptr) {
395 if (sielement ==
nullptr) {
396 ATH_MSG_DEBUG(
"Barrel=" <<
barrel <<
" layer=" << firstHit->getLayerDisk() <<
" Eta=" << firstHit->getEtaModule() <<
" Phi=" << firstHit->getPhiModule() <<
" Side=" << firstHit->getSide());
397 ATH_MSG_ERROR(
"detector manager could not find element with id = " <<
id);
408 if (std::abs(phit->meanTime()) < 10000. *
CLHEP::ns) {
410 phit->getLayerDisk(),
411 phit->getPhiModule(),
412 phit->getEtaModule(),
415 SiDigitizationSurfaceChargeInserter inserter(sielement, chargedDiodes);
430 int processorNumber{0};
433 proc->process(*chargedDiodes, rndmEngine);
443 ATH_MSG_VERBOSE(
"SCT_DigitizationTool::processBunchXing() " << bunchXing);
448 return StatusCode::SUCCESS;
451 return StatusCode::SUCCESS;
458 TimedHitCollList hitCollList;
461 bSubEvents, eSubEvents).isSuccess())) and
462 hitCollList.empty()) {
464 return StatusCode::FAILURE;
472 std::unique_ptr<SiHitCollection> hitCollPtr{std::make_unique<SiHitCollection>(*iColl->second)};
474 ATH_MSG_DEBUG(
"SiHitCollection found with " << hitCollPtr->size() <<
477 <<
" index: " << timeIndex.index()
478 <<
" type: " << timeIndex.type());
479 m_thpcsi->insert(timeIndex, hitCollPtr.get());
483 return StatusCode::SUCCESS;
507 std::ostringstream
ost;
509 ost <<
"Digitized unprocessed elements: layer - phi - eta - side "
514 <<
" unprocessed hit number: " << ++
m_msgNo <<
'\n';
530 std::unique_ptr<SCT_RDO_Collection> RDOColl{
createRDO(chDiodeCollection)};
538 if ((*rdoContainer)->addCollection(RDOColl.release(), identifyHash).isFailure()) {
539 ATH_MSG_FATAL(
"SCT RDO collection could not be added to container!");
540 return StatusCode::FAILURE;
545 return StatusCode::SUCCESS;
554 std::unique_ptr<SCT_RDO_Collection> p_rdocoll;
560 p_rdocoll = std::make_unique<SCT_RDO_Collection>(idHash_de);
561 }
catch (
const std::bad_alloc&) {
562 ATH_MSG_FATAL(
"Could not create a new SCT_RDORawDataCollection !");
570 for (; i_chargedDiode != i_chargedDiode_end; ++i_chargedDiode) {
571 unsigned int flagmask{
static_cast<unsigned int>((*i_chargedDiode).second.flag() & 0xFE)};
578 int strip{roCell.strip()};
579 if (
strip > 0xffff) {
581 ATH_MSG_FATAL(
"Strip number too big for SCT1 raw data format.");
586 const unsigned int strip_rdo{
static_cast<unsigned int>((
strip & 0xFFFF) << 16)};
591 unsigned int size_rdo{
static_cast<unsigned int>(
size & 0xFFFF)};
598 for (; it2 != i_chargedDiode_end; ++it2) {
600 if (cluscounter >=
size) {
603 if (it2->second.flag() & 0xDE) {
604 int tmp{cluscounter};
605 while ((it2 != i_chargedDiode_end) and (cluscounter <
size - 1) and (it2->second.flag() & 0xDE)) {
609 if ((it2 != collection->
end()) and !(it2->second.flag() & 0xDE)) {
614 size_rdo =
tmp & 0xFFFF;
619 unsigned int SCT_Word{strip_rdo | size_rdo};
630 static const std::vector<int> dummyvector;
631 for (; i_chargedDiode != i_chargedDiode_end; ++i_chargedDiode) {
632 unsigned int flagmask{
static_cast<unsigned int>((*i_chargedDiode).second.flag() & 0xFE)};
638 int strip{roCell.strip()};
645 int strip2D{sctDesign.strip(
strip)};
660 if (cluscounter >=
size) {
661 ATH_MSG_WARNING(
"Cluster size reached while neighbouring strips still defined.");
664 if (diode->flag() & 0xDE) {
665 int tmp{cluscounter};
666 while ((cluscounter <
size - 1) and (diode->flag() & 0xDE)) {
667 diode = diode->nextInCluster();
670 if (diode and !(diode->flag() & 0xDE)) {
677 diode = diode->nextInCluster();
681 int stripIn11bits{
strip & 0x7ff};
682 if (stripIn11bits !=
strip) {
683 ATH_MSG_DEBUG(
"Strip number " <<
strip <<
" doesn't fit into 11 bits - will be truncated");
686 unsigned int SCT_Word{
static_cast<unsigned int>(groupSize | (stripIn11bits << 11) | (tbin << 22) | (ERRORS << 25))};
709 if (!hitCollection.
isValid()) {
710 ATH_MSG_ERROR(
"Could not get SCT SiHitCollection container " << hitCollection.
name() <<
" from store " << hitCollection.
store());
711 return StatusCode::FAILURE;
715 m_thpcsi = std::make_unique<TimedHitCollection<SiHit>>(1);
717 ATH_MSG_DEBUG(
"SiHitCollection found with " << hitCollection->
size() <<
" hits");
719 return StatusCode::SUCCESS;
722 TimedHitCollList hitCollList;
726 return StatusCode::FAILURE;
748 m_thpcsi->insert(iColl->first, p_collection);
749 ATH_MSG_DEBUG(
"SiTrackerHitCollection found with " << p_collection->size() <<
" hits");
751 return StatusCode::SUCCESS;
759 std::vector<InDetSimData::Deposit> deposits;
761 const auto collectionid = collection->
identify();
770 const list_t& charges{(*i_chargedDiode).second.totalCharge().chargeComposition()};
772 bool real_particle_hit{
false};
774 const list_t::const_iterator EndOfChargeList{charges.end()};
775 for (list_t::const_iterator i_ListOfCharges{charges.begin()}; i_ListOfCharges != EndOfChargeList; ++i_ListOfCharges) {
780 if (!real_particle_hit) {
791 real_particle_hit =
true;
795 std::vector<InDetSimData::Deposit>::reverse_iterator theDeposit{deposits.rend()};
796 std::vector<InDetSimData::Deposit>::reverse_iterator depositsR_end{deposits.rend()};
797 std::vector<InDetSimData::Deposit>::reverse_iterator i_Deposit{deposits.rbegin()};
798 for (; i_Deposit != depositsR_end; ++i_Deposit) {
799 if ((*i_Deposit).first == trkLink) {
800 theDeposit = i_Deposit;
806 if (theDeposit != depositsR_end) {
807 (*theDeposit).second += i_ListOfCharges->charge();
809 deposits.emplace_back(trkLink, i_ListOfCharges->charge());
816 const int strip{roCell.strip()};
817 const int row2D{sctDesign.row(
strip)};
819 (*simDataCollMap)->try_emplace(id_readout, std::move(deposits),(*i_chargedDiode).second.flag());
def retrieve(aClass, aKey=None)
JetConstituentVector::iterator iterator
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
This is an Identifier helper class for the SCT subdetector. This class is a factory for creating comp...
void setIdentifier(Identifier id)
const_pointer_type cptr()
Dereference the pointer.
virtual IdentifierHash identifyHash() const override final
const std::string & name() const
Return the StoreGate ID for the referenced object.
SiChargedDiodeIterator end()
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
int phi_module(const Identifier &id) const
#define ATH_MSG_VERBOSE(x)
bool ignoreTruthLink(const T &p, bool vetoPileUp)
Helper function for SDO creation in PileUpTools.
std::vector< SiCharge > list_t
bool nextDetectorElement(const_iterator &b, const_iterator &e)
sets an iterator range with the hits of current detector element returns a bool when done
SiChargedDiodeIterator begin()
SiChargedDiodeMap::iterator SiChargedDiodeIterator
std::list< value_t > type
type of the collection of timed data object
virtual int row(int stripId1Dim) const
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
a link optimized in size for a GenParticle in a McEventCollection
const_pointer_type retrieve()
std::string msg(const InDetDD::SiDetectorElement *element)
DigitizeNonHitElementsDebugPrinter(const SCT_ID *detID)
void setDetectorElement(const InDetDD::SolidStateDetectorElementBase *SiElement)
virtual void operator()(const SiSurfaceCharge &scharge)=0
::StatusCode StatusCode
StatusCode definition for legacy code.
std::string store() const
Return the name of the store holding the object we are proxying.
static int GetTimeBin(SiChargedDiode &chDiode)
IdentifierHash wafer_hash(const Identifier &wafer_id) const
wafer hash from id - optimized
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
static void ClusterUsed(SiChargedDiode &chDiode, bool flag)
size_type wafer_hash_max(void) const
A wrapper class for event-slot-local random engines.
int layer_disk(const Identifier &id) const
value_type push_back(value_type pElem)
Add an element to the end of the collection.
StatusCode initialize(bool used=true)
std::size_t numberOfSiHits(const xAOD::TrackParticle *tp)
return the number of Si hits in the track particle
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
static int GetStripNum(SiChargedDiode &chDiode)
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
#define ATH_MSG_WARNING(x)
int eta_module(const Identifier &id) const
int side(const Identifier &id) const
static void SetStripNum(SiChargedDiode &chDiode, int nstrip, MsgStream *log=nullptr)
SiChargedDiode * nextInCluster()
Handle class for reading from StoreGate.
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module, int side) const
For a single side of module.
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
a struct encapsulating the identifier of a pile-up event
const SiDetectorElement * getDetectorElement(const IdentifierHash &hash) const
bool no_truth_link(const T &p)
Method to establish if a if the object is linked to something which was never saved to the HepMC Trut...
virtual Identifier identify() const override final
identifier of this detector element (inline)
const InDetDD::DetectorDesign & design() const
virtual Identifier identify() const override final
Identifier strip_id(int barrel_ec, int layer_disk, int phi_module, int eta_module, int side, int strip) const
For an individual strip.