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

#include <PixelClusterSiHitDecoratorAlg.h>

Inheritance diagram for ActsTrk::PixelClusterSiHitDecoratorAlg:
Collaboration diagram for ActsTrk::PixelClusterSiHitDecoratorAlg:

Public Member Functions

 PixelClusterSiHitDecoratorAlg (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~PixelClusterSiHitDecoratorAlg ()=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 std::vector< std::vector< int > > &sdoTracks) 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_pixelDetEleCollKey {this, "PixelDetEleCollKey", "ITkPixelDetectorElementCollection"}
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"}
Gaudi::Property< bool > m_useSiHitsGeometryMatching {this, "UseSiHitsGeometryMatching", true}
const PixelIDm_PixelHelper {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 PixelClusterSiHitDecoratorAlg.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

◆ PixelClusterSiHitDecoratorAlg()

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

Definition at line 15 of file PixelClusterSiHitDecoratorAlg.cxx.

17 : AthReentrantAlgorithm(name, pSvcLocator)
18 {}

◆ ~PixelClusterSiHitDecoratorAlg()

virtual ActsTrk::PixelClusterSiHitDecoratorAlg::~PixelClusterSiHitDecoratorAlg ( )
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::PixelClusterSiHitDecoratorAlg::execute ( const EventContext & ctx) const
overridevirtual

Definition at line 57 of file PixelClusterSiHitDecoratorAlg.cxx.

58 {
59 ATH_MSG_DEBUG( "Executing " << name() << " ..." );
60
61 ATH_MSG_DEBUG( "Retrieving TrackMeasurementValidationContainer with key: " << m_inputMeasurementsKey.key() );
62 SG::ReadHandle< xAOD::TrackMeasurementValidationContainer > measurementHandle = SG::makeHandle( m_inputMeasurementsKey, ctx );
63 ATH_CHECK( measurementHandle.isValid() );
64 const xAOD::TrackMeasurementValidationContainer* measurements = measurementHandle.cptr();
65
66 ATH_MSG_DEBUG( "Retrieving InDetSimDataCollection with key: " << m_SDOcontainer_key.key() );
67 SG::ReadHandle< InDetSimDataCollection > sdoHandle = SG::makeHandle( m_SDOcontainer_key, ctx );
68 ATH_CHECK( sdoHandle.isValid() );
69 const InDetSimDataCollection* sdos = sdoHandle.cptr();
70
71 ATH_MSG_DEBUG("Retrieving SiHitCollection with key: " << m_siHitsKey.key());
72 SG::ReadHandle< SiHitCollection > siHitsHandle = SG::makeHandle( m_siHitsKey, ctx );
73 ATH_CHECK(siHitsHandle.isValid());
74 const SiHitCollection* siHits = siHitsHandle.cptr();
75
76 SG::ReadCondHandle< InDetDD::SiDetectorElementCollection > pixelDetEleHandle = SG::makeHandle( m_pixelDetEleCollKey, ctx );
77 ATH_CHECK(pixelDetEleHandle.isValid());
78 const InDetDD::SiDetectorElementCollection* pixElements = pixelDetEleHandle.cptr();
79
80 // Detector decorator
81 SG::ReadDecorHandle<xAOD::TrackMeasurementValidationContainer, std::uint64_t> decor_detectorElementID ( m_measurement_detectorElementID, ctx );
82 ATH_CHECK( decor_detectorElementID.isValid() );
83
84 // SDO decorators
85 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector<int> > decor_sdo_words( m_sdo_words, ctx );
86 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector< std::vector<int> > > decor_sdo_depositsBarcode( m_sdo_depositsBarcode, ctx );
87 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector< std::vector<float> > > decor_sdo_depositsEnergy( m_sdo_depositsEnergy, ctx );
88
89 // SiHit decorators
90 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector<float> > decor_sihit_energyDeposit( m_sihit_energyDeposit_decor_key, ctx );
91 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector<float> > decor_sihit_meanTime( m_sihit_meanTime_decor_key, ctx );
92 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector<int> > decor_sihit_barcode( m_sihit_barcode_decor_key, ctx );
93 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector<int> > decor_sihit_pdgid( m_sihit_pdgid_decor_key, ctx );
94
95 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector<float> > decor_sihit_startPosX( m_sihit_startPosX_decor_key, ctx );
96 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector<float> > decor_sihit_startPosY( m_sihit_startPosY_decor_key, ctx );
97 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector<float> > decor_sihit_startPosZ( m_sihit_startPosZ_decor_key, ctx );
98
99 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector<float> > decor_sihit_endPosX( m_sihit_endPosX_decor_key, ctx );
100 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector<float> > decor_sihit_endPosY( m_sihit_endPosY_decor_key, ctx );
101 SG::WriteDecorHandle< xAOD::TrackMeasurementValidationContainer, std::vector<float> > decor_sihit_endPosZ( m_sihit_endPosZ_decor_key, ctx );
102
103 // organize the si hits in such a way we group them together by idhash
104 std::vector< std::vector< const SiHit* > > siHitsCollections(m_PixelHelper->wafer_hash_max());
105 for (const SiHit& siHit: *siHits) {
106 if (!siHit.isPixel()) {
107 ATH_MSG_ERROR("Si Hit in Pixel collection is not Pixel!!!");
108 return StatusCode::FAILURE;
109 }
110
111 Identifier wafer_id(m_PixelHelper->wafer_id(siHit.getBarrelEndcap(),
112 siHit.getLayerDisk(),
113 siHit.getPhiModule(),
114 siHit.getEtaModule()));
115 IdentifierHash wafer_hash(m_PixelHelper->wafer_hash(wafer_id));
116
117 if (wafer_hash >= m_PixelHelper->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 ContainerAccessor<xAOD::TrackMeasurementValidation, IdentifierHash, 1>
126 pixelAccessor ( *measurements,
127 [&decor_detectorElementID] (const xAOD::TrackMeasurementValidation& cl) -> IdentifierHash { return decor_detectorElementID(cl); },
128 pixElements->size());
129
130 // run on id hashes
131 const auto& allIdHashes = pixelAccessor.allIdentifiers();
132 for (const auto& hashId : allIdHashes) {
133 const InDetDD::SiDetectorElement *element = pixElements->getDetectorElement(hashId);
134 if ( not element ) {
135 ATH_MSG_FATAL( "Invalid pixel detector element for hash " << hashId);
136 return StatusCode::FAILURE;
137 }
138
139 auto [startRange, stopRange] = pixelAccessor.rangesForIdentifierDirect(hashId).front();
140 const std::vector< const SiHit* >& siHitsWithCurrentHash = siHitsCollections.at(hashId);
141
142 for (auto itr = startRange; itr != stopRange; ++itr) {
143 const xAOD::TrackMeasurementValidation* measurement = *itr;
144
145 const std::vector< std::uint64_t > rdoIdentifierList = measurement->rdoIdentifierList();
146 // convert to RDOs
147 std::vector< Identifier > rdos( rdoIdentifierList.size() );
148 for (std::size_t i(0); i < rdoIdentifierList.size(); ++i) {
149 rdos[i].set_literal( rdoIdentifierList[i] );
150 }
151
152 auto [word, depositsUniqueID, depositsEnergy] = ActsTrk::detail::getSDOInformation(rdos, *sdos);
153 std::vector<SiHit> compatibleSiHits = findAllHitsCompatibleWithCluster(rdos, *element, siHitsWithCurrentHash, depositsUniqueID);
154
155 auto [energyDeposit, meanTime, uniqueID, pdgid,
156 startPosX, startPosY, startPosZ,
157 endPosX, endPosY, endPosZ] = ActsTrk::detail::getSiHitInformation(*element, compatibleSiHits);
158
159 // attach SDO decorations
160 decor_sdo_words(*measurement) = std::move(word);
161 decor_sdo_depositsBarcode(*measurement) = std::move(depositsUniqueID);
162 decor_sdo_depositsEnergy(*measurement) = std::move(depositsEnergy);
163
164 // attach SiHit decorations
165 decor_sihit_energyDeposit(*measurement) = std::move(energyDeposit);
166 decor_sihit_meanTime(*measurement) = std::move(meanTime);
167 decor_sihit_barcode(*measurement) = std::move(uniqueID);
168 decor_sihit_pdgid(*measurement) = std::move(pdgid);
169
170 decor_sihit_startPosX(*measurement) = std::move(startPosX);
171 decor_sihit_startPosY(*measurement) = std::move(startPosY);
172 decor_sihit_startPosZ(*measurement) = std::move(startPosZ);
173
174 decor_sihit_endPosX(*measurement) = std::move(endPosX);
175 decor_sihit_endPosY(*measurement) = std::move(endPosY);
176 decor_sihit_endPosZ(*measurement) = std::move(endPosZ);
177 } // loop on clusters
178 } // loop on hash ids
179
180 return StatusCode::SUCCESS;
181 }
#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_meanTime_decor_key
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sihit_barcode_decor_key
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sihit_startPosY_decor_key
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sihit_endPosY_decor_key
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sihit_startPosZ_decor_key
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sihit_energyDeposit_decor_key
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sdo_depositsEnergy
SG::ReadHandleKey< SiHitCollection > m_siHitsKey
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sihit_pdgid_decor_key
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sihit_endPosX_decor_key
SG::ReadHandleKey< InDetSimDataCollection > m_SDOcontainer_key
SG::ReadDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_detectorElementID
std::vector< SiHit > findAllHitsCompatibleWithCluster(const std::vector< Identifier > &rdos, const InDetDD::SiDetectorElement &element, const std::vector< const SiHit * > &sihits, const std::vector< std::vector< int > > &sdoTracks) const
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sihit_endPosZ_decor_key
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sdo_words
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
SG::ReadHandleKey< xAOD::TrackMeasurementValidationContainer > m_inputMeasurementsKey
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sihit_startPosX_decor_key
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_sdo_depositsBarcode
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::PixelClusterSiHitDecoratorAlg::findAllHitsCompatibleWithCluster ( const std::vector< Identifier > & rdos,
const InDetDD::SiDetectorElement & element,
const std::vector< const SiHit * > & sihits,
const std::vector< std::vector< int > > & sdoTracks ) const
private

Definition at line 184 of file PixelClusterSiHitDecoratorAlg.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
196 HepGeom::Point3D<double> averagePosition = 0.5 * (siHit->localStartPosition() + siHit->localEndPosition());
197 Amg::Vector2D pos = element.hitLocalToLocal( averagePosition.z(), averagePosition.y() );
198 InDetDD::SiCellId diode = element.cellIdOfPosition(pos);
199
200 for( const Identifier& hitIdentifier : rdos ) {
201 ATH_MSG_DEBUG("Truth Phi " << diode.phiIndex() << " Cluster Phi " << m_PixelHelper->phi_index( hitIdentifier ) );
202 ATH_MSG_DEBUG("Truth Eta " << diode.etaIndex() << " Cluster Eta " << m_PixelHelper->eta_index( hitIdentifier ) );
203 if( std::abs( static_cast<int>(diode.etaIndex()) - m_PixelHelper->eta_index( hitIdentifier ) ) <= 1 and
204 std::abs( static_cast<int>(diode.phiIndex()) - m_PixelHelper->phi_index( hitIdentifier ) ) <= 1 ) {
205 multiMatchingHits.push_back(siHit);
206 break;
207 }
208 } // list on rdos
209
210 } else { // not m_useSiHitsGeometryMatching
211 auto siHitUniqueID = HepMC::uniqueID(siHit->particleLink());
212 for ( const std::vector<int>& uniqueIDSDOColl : sdoTracks ) {
213 if (std::find(uniqueIDSDOColl.begin(), uniqueIDSDOColl.end(), siHitUniqueID) == uniqueIDSDOColl.end()) continue;
214 multiMatchingHits.push_back(siHit);
215 break;
216 }
217 }
218
219 } // loop on si hits
220
221 // Now we will now make 1 SiHit for each true particle if the SiHits "touch" other
222 std::vector<const SiHit* >::iterator siHitIter = multiMatchingHits.begin();
223 std::vector<const SiHit* >::iterator siHitIter2 = multiMatchingHits.begin();
224 for ( ; siHitIter != multiMatchingHits.end(); ++siHitIter) {
225 const SiHit* lowestXPos = *siHitIter;
226 const SiHit* highestXPos = *siHitIter;
227
228 // We will merge these hits
229 std::vector<const SiHit* > ajoiningHits;
230 ajoiningHits.push_back( *siHitIter );
231
232 siHitIter2 = siHitIter + 1;
233 while ( siHitIter2 != multiMatchingHits.end() ) {
234 // Need to come from the same truth particle
235 if ( not HepMC::is_same_particle((*siHitIter)->particleLink(),
236 (*siHitIter2)->particleLink()) ) {
237 ++siHitIter2;
238 continue;
239 }
240
241 // Check to see if the SiHits are compatible with each other.
242 if (std::abs((highestXPos->localEndPosition().x()-(*siHitIter2)->localStartPosition().x()))<0.00005 &&
243 std::abs((highestXPos->localEndPosition().y()-(*siHitIter2)->localStartPosition().y()))<0.00005 &&
244 std::abs((highestXPos->localEndPosition().z()-(*siHitIter2)->localStartPosition().z()))<0.00005 ) {
245 highestXPos = *siHitIter2;
246 ajoiningHits.push_back( *siHitIter2 );
247 // Dont use hit more than once
248 // @TODO could invalidate siHitIter
249 siHitIter2 = multiMatchingHits.erase( siHitIter2 );
250 } else if (std::abs((lowestXPos->localStartPosition().x()-(*siHitIter2)->localEndPosition().x()))<0.00005 &&
251 std::abs((lowestXPos->localStartPosition().y()-(*siHitIter2)->localEndPosition().y()))<0.00005 &&
252 std::abs((lowestXPos->localStartPosition().z()-(*siHitIter2)->localEndPosition().z()))<0.00005) {
253 lowestXPos = *siHitIter2;
254 ajoiningHits.push_back( *siHitIter2 );
255 // Dont use hit more than once
256 // @TODO could invalidate siHitIter
257 siHitIter2 = multiMatchingHits.erase( siHitIter2 );
258 } else {
259 ++siHitIter2;
260 }
261 } // while loop
262
263 if ( ajoiningHits.empty() ) {
264 ATH_MSG_WARNING("This should really never happen");
265 continue;
266 }else if ( ajoiningHits.size() == 1 ) {
267 // Copy Si Hit ready to return
268 matchingHits.push_back( *ajoiningHits[0] );
269 continue;
270 } else {
271 // Build new SiHit and merge information together.
272 ATH_MSG_DEBUG("Merging " << ajoiningHits.size() << " SiHits together." );
273
274 float energyDep {0.f};
275 float time {0.f};
276 for( const auto& siHit : ajoiningHits ){
277 energyDep += siHit->energyLoss();
278 time += siHit->meanTime();
279 }
280 time /= ajoiningHits.size();
281
282 matchingHits.emplace_back(lowestXPos->localStartPosition(),
283 highestXPos->localEndPosition(),
284 energyDep,
285 time,
286 (*siHitIter)->particleLink(),
287 0, // 0 for pixel 1 for strip
288 (*siHitIter)->getBarrelEndcap(),
289 (*siHitIter)->getLayerDisk(),
290 (*siHitIter)->getEtaModule(),
291 (*siHitIter)->getPhiModule(),
292 (*siHitIter)->getSide() );
293
294 ATH_MSG_DEBUG("Finished Merging " << ajoiningHits.size() << " SiHits together." );
295 }
296 } // loop on multi matching hits
297
298 return matchingHits;
299 }
#define ATH_MSG_WARNING(x)
int phiIndex() const
Get phi index. Equivalent to strip().
Definition SiCellId.h:122
int etaIndex() const
Get eta index.
Definition SiCellId.h:114
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::PixelClusterSiHitDecoratorAlg::initialize ( )
overridevirtual

Definition at line 20 of file PixelClusterSiHitDecoratorAlg.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_pixelDetEleCollKey.initialize() );
27 ATH_CHECK( m_siHitsKey.initialize() );
28
29 // Detector decoration
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
51 ATH_CHECK( detStore()->retrieve(m_PixelHelper, "PixelID") );
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::PixelClusterSiHitDecoratorAlg::m_inputMeasurementsKey {this, "Measurements", ""}
private

Definition at line 37 of file PixelClusterSiHitDecoratorAlg.h.

37{this, "Measurements", ""};

◆ m_measurement_detectorElementID

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

Definition at line 43 of file PixelClusterSiHitDecoratorAlg.h.

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

◆ m_pixelDetEleCollKey

SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> ActsTrk::PixelClusterSiHitDecoratorAlg::m_pixelDetEleCollKey {this, "PixelDetEleCollKey", "ITkPixelDetectorElementCollection"}
private

Definition at line 40 of file PixelClusterSiHitDecoratorAlg.h.

40{this, "PixelDetEleCollKey", "ITkPixelDetectorElementCollection"};

◆ m_PixelHelper

const PixelID* ActsTrk::PixelClusterSiHitDecoratorAlg::m_PixelHelper {nullptr}
private

Definition at line 66 of file PixelClusterSiHitDecoratorAlg.h.

66{nullptr};

◆ m_sdo_depositsBarcode

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

Definition at line 47 of file PixelClusterSiHitDecoratorAlg.h.

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

◆ m_sdo_depositsEnergy

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

Definition at line 48 of file PixelClusterSiHitDecoratorAlg.h.

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

◆ m_sdo_words

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

Definition at line 46 of file PixelClusterSiHitDecoratorAlg.h.

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

◆ m_SDOcontainer_key

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

Definition at line 38 of file PixelClusterSiHitDecoratorAlg.h.

38{this, "SDOs", ""};

◆ m_sihit_barcode_decor_key

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

Definition at line 53 of file PixelClusterSiHitDecoratorAlg.h.

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

◆ m_sihit_endPosX_decor_key

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

Definition at line 60 of file PixelClusterSiHitDecoratorAlg.h.

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

◆ m_sihit_endPosY_decor_key

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

Definition at line 61 of file PixelClusterSiHitDecoratorAlg.h.

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

◆ m_sihit_endPosZ_decor_key

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

Definition at line 62 of file PixelClusterSiHitDecoratorAlg.h.

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

◆ m_sihit_energyDeposit_decor_key

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

Definition at line 51 of file PixelClusterSiHitDecoratorAlg.h.

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

◆ m_sihit_meanTime_decor_key

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

Definition at line 52 of file PixelClusterSiHitDecoratorAlg.h.

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

◆ m_sihit_pdgid_decor_key

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

Definition at line 54 of file PixelClusterSiHitDecoratorAlg.h.

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

◆ m_sihit_startPosX_decor_key

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

Definition at line 56 of file PixelClusterSiHitDecoratorAlg.h.

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

◆ m_sihit_startPosY_decor_key

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

Definition at line 57 of file PixelClusterSiHitDecoratorAlg.h.

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

◆ m_sihit_startPosZ_decor_key

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

Definition at line 58 of file PixelClusterSiHitDecoratorAlg.h.

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

◆ m_siHitsKey

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

Definition at line 39 of file PixelClusterSiHitDecoratorAlg.h.

39{this, "SiHits", ""};

◆ m_useSiHitsGeometryMatching

Gaudi::Property<bool> ActsTrk::PixelClusterSiHitDecoratorAlg::m_useSiHitsGeometryMatching {this, "UseSiHitsGeometryMatching", true}
private

Definition at line 64 of file PixelClusterSiHitDecoratorAlg.h.

64{this, "UseSiHitsGeometryMatching", true};

◆ 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: