ATLAS Offline Software
Loading...
Searching...
No Matches
ActsTrk::StripClusterSiHitDecoratorAlg Class Reference

#include <StripClusterSiHitDecoratorAlg.h>

Inheritance diagram for ActsTrk::StripClusterSiHitDecoratorAlg:
Collaboration diagram for ActsTrk::StripClusterSiHitDecoratorAlg:

Public Member Functions

 StripClusterSiHitDecoratorAlg (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~StripClusterSiHitDecoratorAlg ()=default
virtual StatusCode initialize () override
virtual StatusCode execute (const EventContext &ctx) const override
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual unsigned int cardinality () const override
 Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
virtual void setFilterPassed (bool state, const EventContext &ctx) const
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

std::vector< SiHitfindAllHitsCompatibleWithCluster (const std::vector< Identifier > &rdos, const InDetDD::SiDetectorElement &element, const std::vector< const SiHit * > &sihits) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadHandleKey< xAOD::TrackMeasurementValidationContainerm_inputMeasurementsKey {this, "Measurements", ""}
SG::ReadHandleKey< InDetSimDataCollectionm_SDOcontainer_key {this, "SDOs", ""}
SG::ReadHandleKey< SiHitCollectionm_siHitsKey {this, "SiHits", ""}
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollectionm_stripDetEleCollKey {this, "StripDetEleCollKey", "ITkStripDetectorElementCollection"}
SG::ReadDecorHandleKey< xAOD::TrackMeasurementValidationContainerm_measurement_detectorElementID {this, "MeasurementDetectorElementID", m_inputMeasurementsKey, "detectorElementID"}
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainerm_sdo_words {this, "SdoWords", m_inputMeasurementsKey, "sdo_words"}
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainerm_sdo_depositsBarcode {this, "SdoDepositsBarcode", m_inputMeasurementsKey, "sdo_depositsBarcode"}
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainerm_sdo_depositsEnergy {this, "SdoDepositsEnergy", m_inputMeasurementsKey, "sdo_depositsEnergy"}
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainerm_sihit_energyDeposit_decor_key {this, "SiHitEnergyDeposit", m_inputMeasurementsKey, "sihit_energyDeposit"}
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainerm_sihit_meanTime_decor_key {this, "SiHitMeanTime", m_inputMeasurementsKey, "sihit_meanTime"}
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainerm_sihit_barcode_decor_key {this, "SiHitBarcode", m_inputMeasurementsKey, "sihit_barcode"}
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainerm_sihit_pdgid_decor_key {this, "SiHitPdgId", m_inputMeasurementsKey, "sihit_pdgid"}
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainerm_sihit_startPosX_decor_key {this, "SiHitStartPosX", m_inputMeasurementsKey, "sihit_startPosX"}
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainerm_sihit_startPosY_decor_key {this, "SiHitStartPosY", m_inputMeasurementsKey, "sihit_startPosY"}
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainerm_sihit_startPosZ_decor_key {this, "SiHitStartPosZ", m_inputMeasurementsKey, "sihit_startPosZ"}
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainerm_sihit_endPosX_decor_key {this, "SiHitStopPosX", m_inputMeasurementsKey, "sihit_endPosX"}
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainerm_sihit_endPosY_decor_key {this, "SiHitStopPosY", m_inputMeasurementsKey, "sihit_endPosY"}
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainerm_sihit_endPosZ_decor_key {this, "SiHitStopPosZ", m_inputMeasurementsKey, "sihit_endPosZ"}
const SCT_IDm_StripHelper {nullptr}
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 20 of file StripClusterSiHitDecoratorAlg.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ StripClusterSiHitDecoratorAlg()

ActsTrk::StripClusterSiHitDecoratorAlg::StripClusterSiHitDecoratorAlg ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 15 of file StripClusterSiHitDecoratorAlg.cxx.

17 : AthReentrantAlgorithm(name, pSvcLocator)
18 {}

◆ ~StripClusterSiHitDecoratorAlg()

virtual ActsTrk::StripClusterSiHitDecoratorAlg::~StripClusterSiHitDecoratorAlg ( )
virtualdefault

Member Function Documentation

◆ cardinality()

unsigned int AthCommonReentrantAlgorithm< Gaudi::Algorithm >::cardinality ( ) const
overridevirtualinherited

Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.

Override this to return 0 for reentrant algorithms.

Definition at line 75 of file AthCommonReentrantAlgorithm.cxx.

64{
65 return 0;
66}

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode ActsTrk::StripClusterSiHitDecoratorAlg::execute ( const EventContext & ctx) const
overridevirtual

Definition at line 56 of file StripClusterSiHitDecoratorAlg.cxx.

57 {
58 ATH_MSG_DEBUG( "Executing " << name() << " ..." );
59
60 ATH_MSG_DEBUG( "Retrieving TrackMeasurementValidationContainer with key: " << m_inputMeasurementsKey.key() );
61 SG::ReadHandle< xAOD::TrackMeasurementValidationContainer > measurementHandle = SG::makeHandle( m_inputMeasurementsKey, ctx );
62 ATH_CHECK( measurementHandle.isValid() );
63 const xAOD::TrackMeasurementValidationContainer* measurements = measurementHandle.cptr();
64
65 ATH_MSG_DEBUG( "Retrieving InDetSimDataCollection with key: " << m_SDOcontainer_key.key() );
66 SG::ReadHandle< InDetSimDataCollection > sdoHandle = SG::makeHandle( m_SDOcontainer_key, ctx );
67 ATH_CHECK( sdoHandle.isValid() );
68 const InDetSimDataCollection* sdos = sdoHandle.cptr();
69
70 ATH_MSG_DEBUG("Retrieving SiHitCollection with key: " << m_siHitsKey.key());
71 SG::ReadHandle< SiHitCollection > siHitsHandle = SG::makeHandle( m_siHitsKey, ctx );
72 ATH_CHECK(siHitsHandle.isValid());
73 const SiHitCollection* siHits = siHitsHandle.cptr();
74
75 SG::ReadCondHandle< InDetDD::SiDetectorElementCollection > stripDetEleHandle = SG::makeHandle( m_stripDetEleCollKey, ctx );
76 ATH_CHECK(stripDetEleHandle.isValid());
77 const InDetDD::SiDetectorElementCollection* stripElements = stripDetEleHandle.cptr();
78
79 // Detector decorator
80 SG::ReadDecorHandle<xAOD::TrackMeasurementValidationContainer, std::uint64_t> decor_detectorElementID ( m_measurement_detectorElementID, ctx );
81 ATH_CHECK( decor_detectorElementID.isValid() );
82
83 // SDO decorators
84 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector<int> > decor_sdo_words( m_sdo_words, ctx );
85 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector< std::vector<int> > > decor_sdo_depositsBarcode( m_sdo_depositsBarcode, ctx );
86 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector< std::vector<float> > > decor_sdo_depositsEnergy( m_sdo_depositsEnergy, ctx );
87
88 // SiHit decorators
89 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector<float> > decor_sihit_energyDeposit( m_sihit_energyDeposit_decor_key, ctx );
90 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector<float> > decor_sihit_meanTime( m_sihit_meanTime_decor_key, ctx );
91 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector<int> > decor_sihit_barcode( m_sihit_barcode_decor_key, ctx );
92 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector<int> > decor_sihit_pdgid( m_sihit_pdgid_decor_key, ctx );
93
94 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector<float> > decor_sihit_startPosX( m_sihit_startPosX_decor_key, ctx );
95 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector<float> > decor_sihit_startPosY( m_sihit_startPosY_decor_key, ctx );
96 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector<float> > decor_sihit_startPosZ( m_sihit_startPosZ_decor_key, ctx );
97
98 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector<float> > decor_sihit_endPosX( m_sihit_endPosX_decor_key, ctx );
99 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector<float> > decor_sihit_endPosY( m_sihit_endPosY_decor_key, ctx );
100 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector<float> > decor_sihit_endPosZ( m_sihit_endPosZ_decor_key, ctx );
101
102 // organize the si hits in such a way we group them together by idhash
103 std::vector< std::vector< const SiHit* > > siHitsCollections(m_StripHelper->wafer_hash_max());
104 for (const SiHit& siHit: *siHits) {
105 if ( not siHit.isSCT() ) {
106 ATH_MSG_ERROR("Si Hit in Strip collection is not Strip!!!");
107 return StatusCode::FAILURE;
108 }
109
110 Identifier wafer_id(m_StripHelper->wafer_id(siHit.getBarrelEndcap(),
111 siHit.getLayerDisk(),
112 siHit.getPhiModule(),
113 siHit.getEtaModule(),
114 siHit.getSide()));
115 IdentifierHash wafer_hash(m_StripHelper->wafer_hash(wafer_id));
116
117 if (wafer_hash >= m_StripHelper->wafer_hash_max()) {
118 ATH_MSG_ERROR("There is a problem with Si Hit collection.");
119 ATH_MSG_ERROR("Wafer hash is too big");
120 return StatusCode::FAILURE;
121 }
122 siHitsCollections[wafer_hash].push_back(&siHit);
123 } // loop on si hits
124
125
126 ContainerAccessor<xAOD::TrackMeasurementValidation, IdentifierHash, 1>
127 stripAccessor ( *measurements,
128 [&decor_detectorElementID] (const xAOD::TrackMeasurementValidation& cl) -> IdentifierHash { return decor_detectorElementID(cl); },
129 stripElements->size());
130
131 // run on id hashes
132 const auto& allIdHashes = stripAccessor.allIdentifiers();
133 for (const auto& hashId : allIdHashes) {
134 const InDetDD::SiDetectorElement *element = stripElements->getDetectorElement(hashId);
135 if ( not element ) {
136 ATH_MSG_FATAL( "Invalid strip detector element for hash " << hashId);
137 return StatusCode::FAILURE;
138 }
139
140 auto [startRange, stopRange] = stripAccessor.rangesForIdentifierDirect(hashId).front();
141 const std::vector< const SiHit* >& siHitsWithCurrentHash = siHitsCollections.at(hashId);
142
143 for (auto itr = startRange; itr != stopRange; ++itr) {
144 const xAOD::TrackMeasurementValidation* measurement = *itr;
145
146 const std::vector< std::uint64_t > rdoIdentifierList = measurement->rdoIdentifierList();
147 // convert to RDOs
148 std::vector< Identifier > rdos( rdoIdentifierList.size() );
149 for (std::size_t i(0); i < rdoIdentifierList.size(); ++i) {
150 rdos[i].set_literal( rdoIdentifierList[i] );
151 }
152
153 auto [word, depositsUniqueID, depositsEnergy] = ActsTrk::detail::getSDOInformation(rdos, *sdos);
154 std::vector<SiHit> compatibleSiHits = findAllHitsCompatibleWithCluster(rdos, *element, siHitsWithCurrentHash);
155
156 auto [energyDeposit, meanTime, uniqueID, pdgid,
157 startPosX, startPosY, startPosZ,
158 endPosX, endPosY, endPosZ] = ActsTrk::detail::getSiHitInformation(*element, compatibleSiHits);
159
160 // attach SDO decorations
161 decor_sdo_words(*measurement) = std::move(word);
162 decor_sdo_depositsBarcode(*measurement) = std::move(depositsUniqueID);
163 decor_sdo_depositsEnergy(*measurement) = std::move(depositsEnergy);
164
165 // attach SiHit decorations
166 decor_sihit_energyDeposit(*measurement) = std::move(energyDeposit);
167 decor_sihit_meanTime(*measurement) = std::move(meanTime);
168 decor_sihit_barcode(*measurement) = std::move(uniqueID);
169 decor_sihit_pdgid(*measurement) = std::move(pdgid);
170
171 decor_sihit_startPosX(*measurement) = std::move(startPosX);
172 decor_sihit_startPosY(*measurement) = std::move(startPosY);
173 decor_sihit_startPosZ(*measurement) = std::move(startPosZ);
174
175 decor_sihit_endPosX(*measurement) = std::move(endPosX);
176 decor_sihit_endPosY(*measurement) = std::move(endPosY);
177 decor_sihit_endPosZ(*measurement) = std::move(endPosZ);
178 } // loop on clusters
179 } // loop on hash ids
180
181 return StatusCode::SUCCESS;
182 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_DEBUG(x)
AtlasHitsVector< SiHit > SiHitCollection
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sihit_startPosY_decor_key
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sihit_pdgid_decor_key
std::vector< SiHit > findAllHitsCompatibleWithCluster(const std::vector< Identifier > &rdos, const InDetDD::SiDetectorElement &element, const std::vector< const SiHit * > &sihits) const
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sihit_endPosX_decor_key
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sihit_meanTime_decor_key
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sdo_depositsEnergy
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sdo_depositsBarcode
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sihit_endPosY_decor_key
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sihit_startPosX_decor_key
SG::ReadHandleKey< SiHitCollection > m_siHitsKey
SG::ReadDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_detectorElementID
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sihit_energyDeposit_decor_key
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sdo_words
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sihit_startPosZ_decor_key
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sihit_endPosZ_decor_key
SG::ReadHandleKey< xAOD::TrackMeasurementValidationContainer > m_inputMeasurementsKey
SG::ReadHandleKey< InDetSimDataCollection > m_SDOcontainer_key
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sihit_barcode_decor_key
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_stripDetEleCollKey
size_type size() const noexcept
Returns the number of elements in the collection.
const SiDetectorElement * getDetectorElement(const IdentifierHash &hash) const
const_pointer_type cptr()
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
const std::vector< uint64_t > & rdoIdentifierList() const
Returns the list of RDO identifiers.
std::tuple< std::vector< float >, std::vector< float >, std::vector< int >, std::vector< int >, std::vector< float >, std::vector< float >, std::vector< float >, std::vector< float >, std::vector< float >, std::vector< float > > getSiHitInformation(const InDetDD::SiDetectorElement &element, const std::vector< SiHit > &matchingHits)
std::tuple< std::vector< int >, std::vector< std::vector< int > >, std::vector< std::vector< float > > > getSDOInformation(const std::vector< Identifier > &rdoList, const InDetSimDataCollection &sdoCollection)
int uniqueID(const T &p)
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
@ energyDeposit
TrackMeasurementValidation_v1 TrackMeasurementValidation
Reference the current persistent version:
TrackMeasurementValidationContainer_v1 TrackMeasurementValidationContainer
Definition of the current "TrackMeasurementValidation container version".

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthCommonReentrantAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 94 of file AthCommonReentrantAlgorithm.cxx.

90{
91 // If we didn't find any symlinks to add, just return the collection
92 // from the base class. Otherwise, return the extended collection.
93 if (!m_extendedExtraObjects.empty()) {
95 }
97}
An algorithm that can be simultaneously executed in multiple threads.

◆ filterPassed()

virtual bool AthCommonReentrantAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Definition at line 96 of file AthCommonReentrantAlgorithm.h.

96 {
97 return execState( ctx ).filterPassed();
98 }
virtual bool filterPassed(const EventContext &ctx) const

◆ findAllHitsCompatibleWithCluster()

std::vector< SiHit > ActsTrk::StripClusterSiHitDecoratorAlg::findAllHitsCompatibleWithCluster ( const std::vector< Identifier > & rdos,
const InDetDD::SiDetectorElement & element,
const std::vector< const SiHit * > & sihits ) const
private

Definition at line 185 of file StripClusterSiHitDecoratorAlg.cxx.

188 {
189 std::vector<SiHit> matchingHits {};
190 std::vector<const SiHit*> multiMatchingHits {};
191
192 for (const SiHit* siHit: siHits) {
193 // Now we have all hits in the module that match lets check to see if they match the cluster
194 // Must be within +/- 1 hits of any hit in the cluster to be included
195 HepGeom::Point3D<double> averagePosition = 0.5 * (siHit->localStartPosition() + siHit->localEndPosition());
196 Amg::Vector2D pos = element.hitLocalToLocal(averagePosition.z(), averagePosition.y());
197 InDetDD::SiCellId diode = element.cellIdOfPosition(pos);
198
199 for (const auto& hitIdentifier: rdos) {
200 ATH_MSG_DEBUG("Truth Strip " << diode.phiIndex() << " Cluster Strip " << m_StripHelper->strip(hitIdentifier));
201
202 if (std::abs( static_cast<int>(diode.phiIndex()) - m_StripHelper->strip(hitIdentifier) ) <= 1) {
203 multiMatchingHits.push_back(siHit);
204 break;
205 }
206 }
207 } // loop on si hits
208
209 // Now we will now make 1 SiHit for each true particle if the SiHits "touch" other
210 std::vector<const SiHit* >::iterator siHitIter = multiMatchingHits.begin();
211 std::vector<const SiHit* >::iterator siHitIter2 = multiMatchingHits.begin();
212 for ( ; siHitIter != multiMatchingHits.end(); ++siHitIter) {
213 const SiHit* lowestXPos = *siHitIter;
214 const SiHit* highestXPos = *siHitIter;
215
216 // We will merge these hits
217 std::vector<const SiHit* > ajoiningHits;
218 ajoiningHits.push_back( *siHitIter );
219
220 siHitIter2 = siHitIter + 1;
221 while ( siHitIter2 != multiMatchingHits.end() ) {
222 // Need to come from the same truth particle
223 if ( not HepMC::is_same_particle((*siHitIter)->particleLink(),
224 (*siHitIter2)->particleLink()) ) {
225 ++siHitIter2;
226 continue;
227 }
228
229 // Check to see if the SiHits are compatible with each other.
230 if (std::abs((highestXPos->localEndPosition().x()-(*siHitIter2)->localStartPosition().x()))<0.00005 &&
231 std::abs((highestXPos->localEndPosition().y()-(*siHitIter2)->localStartPosition().y()))<0.00005 &&
232 std::abs((highestXPos->localEndPosition().z()-(*siHitIter2)->localStartPosition().z()))<0.00005 ) {
233 highestXPos = *siHitIter2;
234 ajoiningHits.push_back( *siHitIter2 );
235 // Dont use hit more than once
236 // @TODO could invalidate siHitIter
237 siHitIter2 = multiMatchingHits.erase( siHitIter2 );
238 } else if (std::abs((lowestXPos->localStartPosition().x()-(*siHitIter2)->localEndPosition().x()))<0.00005 &&
239 std::abs((lowestXPos->localStartPosition().y()-(*siHitIter2)->localEndPosition().y()))<0.00005 &&
240 std::abs((lowestXPos->localStartPosition().z()-(*siHitIter2)->localEndPosition().z()))<0.00005) {
241 lowestXPos = *siHitIter2;
242 ajoiningHits.push_back( *siHitIter2 );
243 // Dont use hit more than once
244 // @TODO could invalidate siHitIter
245 siHitIter2 = multiMatchingHits.erase( siHitIter2 );
246 } else {
247 ++siHitIter2;
248 }
249 } // while loop
250
251 if ( ajoiningHits.empty() ) {
252 ATH_MSG_WARNING("This should really never happen");
253 continue;
254 } else if ( ajoiningHits.size() == 1 ) {
255 // Copy Si Hit ready to return
256 matchingHits.push_back( *ajoiningHits[0] );
257 continue;
258 } else {
259 // Build new SiHit and merge information together.
260 ATH_MSG_DEBUG("Merging " << ajoiningHits.size() << " SiHits together." );
261
262 float energyDep {0.f};
263 float time {0.f};
264 for( const auto& siHit : ajoiningHits ){
265 energyDep += siHit->energyLoss();
266 time += siHit->meanTime();
267 }
268 time /= ajoiningHits.size();
269
270 matchingHits.emplace_back(lowestXPos->localStartPosition(),
271 highestXPos->localEndPosition(),
272 energyDep,
273 time,
274 (*siHitIter)->particleLink(),
275 1, // 0 for pixel 1 for strip
276 (*siHitIter)->getBarrelEndcap(),
277 (*siHitIter)->getLayerDisk(),
278 (*siHitIter)->getEtaModule(),
279 (*siHitIter)->getPhiModule(),
280 (*siHitIter)->getSide() );
281
282 ATH_MSG_DEBUG("Finished Merging " << ajoiningHits.size() << " SiHits together." );
283 }
284 } // loop on multi matching hits
285
286 return matchingHits;
287 }
#define ATH_MSG_WARNING(x)
int phiIndex() const
Get phi index. Equivalent to strip().
Definition SiCellId.h:122
SiCellId cellIdOfPosition(const Amg::Vector2D &localPos) const
As in previous method but returns SiCellId.
Amg::Vector2D hitLocalToLocal(double xEta, double xPhi) const
Simulation/Hit local frame to reconstruction local frame.
HepGeom::Point3D< double > localStartPosition() const
Definition SiHit.cxx:146
HepGeom::Point3D< double > localEndPosition() const
Definition SiHit.cxx:153
Eigen::Matrix< double, 2, 1 > Vector2D
time(flags, cells_name, *args, **kw)
bool is_same_particle(const T1 &p1, const T2 &p2)
Method to establish if two particles in the GenEvent actually represent the same particle.

◆ initialize()

StatusCode ActsTrk::StripClusterSiHitDecoratorAlg::initialize ( )
overridevirtual

Definition at line 20 of file StripClusterSiHitDecoratorAlg.cxx.

21 {
22 ATH_MSG_DEBUG( "Initializing " << name() << " ..." );
23
24 ATH_CHECK( m_inputMeasurementsKey.initialize() );
25 ATH_CHECK( m_SDOcontainer_key.initialize() );
26 ATH_CHECK( m_stripDetEleCollKey.initialize() );
27 ATH_CHECK( m_siHitsKey.initialize() );
28
29 // Detector decorator
31
32 // SDO decorations
33 ATH_CHECK( m_sdo_words.initialize() );
34 ATH_CHECK( m_sdo_depositsBarcode.initialize() );
35 ATH_CHECK( m_sdo_depositsEnergy.initialize() );
36
37 // SiHit decorations
41 ATH_CHECK( m_sihit_pdgid_decor_key.initialize() );
42
46
50
52
53 return StatusCode::SUCCESS;
54 }
const ServiceHandle< StoreGateSvc > & detStore() const
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isClonable()

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setFilterPassed()

virtual void AthCommonReentrantAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Definition at line 100 of file AthCommonReentrantAlgorithm.h.

100 {
102 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const

◆ sysExecute()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Definition at line 85 of file AthCommonReentrantAlgorithm.cxx.

77{
78 return BaseAlg::sysExecute (ctx);
79}

◆ sysInitialize()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in HypoBase, and InputMakerBase.

Definition at line 61 of file AthCommonReentrantAlgorithm.cxx.

107 {
109
110 if (sc.isFailure()) {
111 return sc;
112 }
113
114 ServiceHandle<ICondSvc> cs("CondSvc",name());
115 for (auto h : outputHandles()) {
116 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
117 // do this inside the loop so we don't create the CondSvc until needed
118 if ( cs.retrieve().isFailure() ) {
119 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
120 return StatusCode::SUCCESS;
121 }
122 if (cs->regHandle(this,*h).isFailure()) {
124 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
125 << " with CondSvc");
126 }
127 }
128 }
129 return sc;
130}
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonReentrantAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 114 of file AthCommonReentrantAlgorithm.h.

◆ m_inputMeasurementsKey

SG::ReadHandleKey< xAOD::TrackMeasurementValidationContainer > ActsTrk::StripClusterSiHitDecoratorAlg::m_inputMeasurementsKey {this, "Measurements", ""}
private

Definition at line 36 of file StripClusterSiHitDecoratorAlg.h.

36{this, "Measurements", ""};

◆ m_measurement_detectorElementID

SG::ReadDecorHandleKey<xAOD::TrackMeasurementValidationContainer> ActsTrk::StripClusterSiHitDecoratorAlg::m_measurement_detectorElementID {this, "MeasurementDetectorElementID", m_inputMeasurementsKey, "detectorElementID"}
private

Definition at line 42 of file StripClusterSiHitDecoratorAlg.h.

42{this, "MeasurementDetectorElementID", m_inputMeasurementsKey, "detectorElementID"};

◆ m_sdo_depositsBarcode

SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > ActsTrk::StripClusterSiHitDecoratorAlg::m_sdo_depositsBarcode {this, "SdoDepositsBarcode", m_inputMeasurementsKey, "sdo_depositsBarcode"}
private

Definition at line 46 of file StripClusterSiHitDecoratorAlg.h.

46{this, "SdoDepositsBarcode", m_inputMeasurementsKey, "sdo_depositsBarcode"};

◆ m_sdo_depositsEnergy

SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > ActsTrk::StripClusterSiHitDecoratorAlg::m_sdo_depositsEnergy {this, "SdoDepositsEnergy", m_inputMeasurementsKey, "sdo_depositsEnergy"}
private

Definition at line 47 of file StripClusterSiHitDecoratorAlg.h.

47{this, "SdoDepositsEnergy", m_inputMeasurementsKey, "sdo_depositsEnergy"};

◆ m_sdo_words

SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > ActsTrk::StripClusterSiHitDecoratorAlg::m_sdo_words {this, "SdoWords", m_inputMeasurementsKey, "sdo_words"}
private

Definition at line 45 of file StripClusterSiHitDecoratorAlg.h.

45{this, "SdoWords", m_inputMeasurementsKey, "sdo_words"};

◆ m_SDOcontainer_key

SG::ReadHandleKey< InDetSimDataCollection > ActsTrk::StripClusterSiHitDecoratorAlg::m_SDOcontainer_key {this, "SDOs", ""}
private

Definition at line 37 of file StripClusterSiHitDecoratorAlg.h.

37{this, "SDOs", ""};

◆ m_sihit_barcode_decor_key

SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > ActsTrk::StripClusterSiHitDecoratorAlg::m_sihit_barcode_decor_key {this, "SiHitBarcode", m_inputMeasurementsKey, "sihit_barcode"}
private

Definition at line 52 of file StripClusterSiHitDecoratorAlg.h.

52{this, "SiHitBarcode", m_inputMeasurementsKey, "sihit_barcode"};

◆ m_sihit_endPosX_decor_key

SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > ActsTrk::StripClusterSiHitDecoratorAlg::m_sihit_endPosX_decor_key {this, "SiHitStopPosX", m_inputMeasurementsKey, "sihit_endPosX"}
private

Definition at line 59 of file StripClusterSiHitDecoratorAlg.h.

59{this, "SiHitStopPosX", m_inputMeasurementsKey, "sihit_endPosX"};

◆ m_sihit_endPosY_decor_key

SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > ActsTrk::StripClusterSiHitDecoratorAlg::m_sihit_endPosY_decor_key {this, "SiHitStopPosY", m_inputMeasurementsKey, "sihit_endPosY"}
private

Definition at line 60 of file StripClusterSiHitDecoratorAlg.h.

60{this, "SiHitStopPosY", m_inputMeasurementsKey, "sihit_endPosY"};

◆ m_sihit_endPosZ_decor_key

SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > ActsTrk::StripClusterSiHitDecoratorAlg::m_sihit_endPosZ_decor_key {this, "SiHitStopPosZ", m_inputMeasurementsKey, "sihit_endPosZ"}
private

Definition at line 61 of file StripClusterSiHitDecoratorAlg.h.

61{this, "SiHitStopPosZ", m_inputMeasurementsKey, "sihit_endPosZ"};

◆ m_sihit_energyDeposit_decor_key

SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > ActsTrk::StripClusterSiHitDecoratorAlg::m_sihit_energyDeposit_decor_key {this, "SiHitEnergyDeposit", m_inputMeasurementsKey, "sihit_energyDeposit"}
private

Definition at line 50 of file StripClusterSiHitDecoratorAlg.h.

50{this, "SiHitEnergyDeposit", m_inputMeasurementsKey, "sihit_energyDeposit"};

◆ m_sihit_meanTime_decor_key

SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > ActsTrk::StripClusterSiHitDecoratorAlg::m_sihit_meanTime_decor_key {this, "SiHitMeanTime", m_inputMeasurementsKey, "sihit_meanTime"}
private

Definition at line 51 of file StripClusterSiHitDecoratorAlg.h.

51{this, "SiHitMeanTime", m_inputMeasurementsKey, "sihit_meanTime"};

◆ m_sihit_pdgid_decor_key

SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > ActsTrk::StripClusterSiHitDecoratorAlg::m_sihit_pdgid_decor_key {this, "SiHitPdgId", m_inputMeasurementsKey, "sihit_pdgid"}
private

Definition at line 53 of file StripClusterSiHitDecoratorAlg.h.

53{this, "SiHitPdgId", m_inputMeasurementsKey, "sihit_pdgid"};

◆ m_sihit_startPosX_decor_key

SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > ActsTrk::StripClusterSiHitDecoratorAlg::m_sihit_startPosX_decor_key {this, "SiHitStartPosX", m_inputMeasurementsKey, "sihit_startPosX"}
private

Definition at line 55 of file StripClusterSiHitDecoratorAlg.h.

55{this, "SiHitStartPosX", m_inputMeasurementsKey, "sihit_startPosX"};

◆ m_sihit_startPosY_decor_key

SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > ActsTrk::StripClusterSiHitDecoratorAlg::m_sihit_startPosY_decor_key {this, "SiHitStartPosY", m_inputMeasurementsKey, "sihit_startPosY"}
private

Definition at line 56 of file StripClusterSiHitDecoratorAlg.h.

56{this, "SiHitStartPosY", m_inputMeasurementsKey, "sihit_startPosY"};

◆ m_sihit_startPosZ_decor_key

SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > ActsTrk::StripClusterSiHitDecoratorAlg::m_sihit_startPosZ_decor_key {this, "SiHitStartPosZ", m_inputMeasurementsKey, "sihit_startPosZ"}
private

Definition at line 57 of file StripClusterSiHitDecoratorAlg.h.

57{this, "SiHitStartPosZ", m_inputMeasurementsKey, "sihit_startPosZ"};

◆ m_siHitsKey

SG::ReadHandleKey< SiHitCollection > ActsTrk::StripClusterSiHitDecoratorAlg::m_siHitsKey {this, "SiHits", ""}
private

Definition at line 38 of file StripClusterSiHitDecoratorAlg.h.

38{this, "SiHits", ""};

◆ m_stripDetEleCollKey

SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> ActsTrk::StripClusterSiHitDecoratorAlg::m_stripDetEleCollKey {this, "StripDetEleCollKey", "ITkStripDetectorElementCollection"}
private

Definition at line 39 of file StripClusterSiHitDecoratorAlg.h.

39{this, "StripDetEleCollKey", "ITkStripDetectorElementCollection"};

◆ m_StripHelper

const SCT_ID* ActsTrk::StripClusterSiHitDecoratorAlg::m_StripHelper {nullptr}
private

Definition at line 63 of file StripClusterSiHitDecoratorAlg.h.

63{nullptr};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: