16 ISvcLocator *pSvcLocator) :
59 return StatusCode::SUCCESS;
65 ATH_CHECK(StripClusterContainer.isValid());
76 measToTruth = measToTruthHandle.
ptr();
82 ATH_CHECK(xaod.
record(std::make_unique<xAOD::TrackMeasurementValidationContainer>(),
83 std::make_unique<xAOD::TrackMeasurementValidationAuxContainer>()));
105 std::vector<bool> keepClusterCollection {};
110 for (std::size_t i(0); i<stripClusters->
size(); ++i) {
111 if (not keepClusterCollection[i])
continue;
117 measurements->
back()->index() );
119 decorator_measurement_link(*cluster) = std::move(mlink);
126 ATH_MSG_FATAL(
"Invalid strip detector element for hash " << hashId );
127 return StatusCode::FAILURE;
132 std::vector< std::uint64_t > rdoIdentifierList;
133 rdoIdentifierList.reserve(rdoList.size());
134 for( Identifier::value_type hitIdentifierValue : rdoList ){
135 rdoIdentifierList.push_back( hitIdentifierValue );
154 decor_detectorElementID(*measurement) = hashId;
155 decor_waferID(*measurement) = waferId.
get_compact();
157 decor_layer(*measurement) =
m_stripHelper->layer_disk(waferId);
159 decor_sizeZ(*measurement) = 0;
161 decor_eta_module(*measurement) =
m_stripHelper->eta_module(waferId);
162 decor_phi_module(*measurement) =
m_stripHelper->phi_module(waferId);
163 decor_omegax(*measurement) = 0;
164 decor_omegay(*measurement) = 0;
165 decor_LorentzShift(*measurement) = 0;
166 decor_centroid_xphi(*measurement) = 0;
167 decor_centroid_xeta(*measurement) = 0;
177 std::size_t measurementIndex = 0;
178 for (std::size_t i(0); i<stripClusters->
size(); ++i) {
179 if (not keepClusterCollection[i])
continue;
186 return StatusCode::FAILURE;
189 if (cluster->index() >= measToTruth->size()) {
190 ATH_MSG_ERROR(
"PRD index "<< cluster->index() <<
" not present in the measurement to truth vector with size " << measToTruth->size());
191 return StatusCode::FAILURE;
194 auto tps = measToTruth->at(cluster->index());
196 std::vector<unsigned int> tp_indices;
197 std::vector<unsigned int> tp_barcodes;
198 for (
auto tp : tps) {
199 tp_indices.push_back(tp->index());
203 decor_truth_indices(*measurement) = std::move(tp_indices);
204 decor_truth_barcode(*measurement) = std::move(tp_barcodes);
209 ATH_MSG_DEBUG(
" recorded StripPrepData objects: size " << measurements->
size() );
210 return StatusCode::SUCCESS;
215 std::vector<bool>& labels)
const
219 labels.resize(clusters.size(),
true);
220 return StatusCode::SUCCESS;
222 labels.resize(clusters.size(),
false);
233 std::optional<ActsTrk::TrackContainer::ConstTrackProxy> optional_track =
getActsTrack(*trackParticle);
234 if ( not optional_track.has_value() ) {
235 ATH_MSG_ERROR(
"Invalid track link for particle " << trackParticle->index());
236 return StatusCode::FAILURE;
238 ActsTrk::TrackContainer::ConstTrackProxy track = optional_track.value();
241 track.container().trackStateContainer()
242 .visitBackwards(track.tipIndex(),
244 (
const typename ActsTrk::TrackContainer::ConstTrackStateProxy& state)
246 auto flags = state.typeFlags();
247 if (not flags.hasMeasurement()) return;
249 auto sl = state.getUncalibratedSourceLink().template get<ATLASUncalibSourceLink>();
250 if (sl == nullptr) return;
252 const xAOD::UncalibratedMeasurement &cluster = getUncalibratedMeasurement(sl);
253 if (cluster.type() != xAOD::UncalibMeasType::StripClusterType) return;
254 labels.at(cluster.index()) = true;
259 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
ATLAS-specific HepMC functions.
Handle class for reading a decoration on an object.
Property holding a SG store/key/clid from which a ReadHandle is made.
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_stripDetEleCollKey
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_phi_module
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_SiWidth
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_layer
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_eta_module
virtual StatusCode execute(const EventContext &ctx) const override
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_centroid_xeta
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_detectorElementID
SG::ReadHandleKey< xAOD::StripClusterContainer > m_clustercontainer_key
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_side
StripClusterTruthDecoratorAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadHandleKeyArray< xAOD::TrackParticleContainer > m_trackParticlesKey
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_waferID
SG::WriteHandleKey< xAOD::TrackMeasurementValidationContainer > m_write_xaod_key
Gaudi::Property< bool > m_keepOnlyOnTrackMeasurements
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_sizePhi
SG::WriteDecorHandleKey< xAOD::StripClusterContainer > m_trackMeasurement_link
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_LorentzShift
Gaudi::Property< bool > m_useTruthInfo
const SCT_ID * m_stripHelper
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_sizeZ
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_omegay
virtual StatusCode initialize() override
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_centroid_xphi
StatusCode labelMeasurementToKeep(const EventContext &ctx, const xAOD::StripClusterContainer &clusters, std::vector< bool > &labels) const
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_omegax
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_bec
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_truth_barcodes
SG::ReadHandleKey< MeasurementToTruthParticleAssociation > m_associationMap_key
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_truth_indices
const ServiceHandle< StoreGateSvc > & detStore() const
An algorithm that can be simultaneously executed in multiple threads.
const T * back() const
Access the last element in the collection as an rvalue.
const T * at(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.
size_type size() const noexcept
Returns the number of elements in the collection.
ElementLink implementation for ROOT usage.
bool isValid() const
Check if the element can be found.
value_type get_compact() const
Get the compact id.
Class to hold the SiDetectorElement objects to be put in the detector store.
const SiDetectorElement * getDetectorElement(const IdentifierHash &hash) const
Class to hold geometrical description of a silicon detector element.
Helper class to provide constant type-safe access to aux data.
const_pointer_type cptr()
Property holding a SG store/key/clid from which a ReadHandle is made.
const_pointer_type ptr()
Dereference the pointer.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
Handle class for adding a decoration to an object.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
ConstVectorMap< 3 > globalPosition() const
Returns the global position of the strip cluster.
SG::ConstAccessor< SG::JaggedVecElt< Identifier::value_type > >::element_type rdoList() const
Returns the list of identifiers of the channels building the cluster.
int channelsInPhi() const
Returns the dimensions of the cluster in numbers of channels in phi (x), respectively.
void setRdoIdentifierList(const std::vector< uint64_t > &rdoIdentifierList)
Sets the list of RDO identifiers.
uint64_t identifier() const
void setLocalPositionError(float localXError, float localYError, float localXYCorrelation)
Sets the local position error.
void setLocalPosition(float localX, float localY)
Sets the local position.
void setIdentifier(uint64_t identifier)
Sets the identifier.
void setGlobalPosition(float globalX, float globalY, float globalZ)
Sets the global position.
ConstMatrixMap< N > localCovariance() const
Returns the local covariance of the measurement.
DetectorIDHashType identifierHash() const
Returns the IdentifierHash of the measurement (corresponds to the detector element IdentifierHash).
DetectorIdentType identifier() const
Returns the full Identifier of the measurement.
ConstVectorMap< N > localPosition() const
Returns the local position of the measurement.
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
std::optional< ActsTrk::TrackContainer::ConstTrackProxy > getActsTrack(const xAOD::TrackParticle &trkPart)
Return the proxy to the Acts track from which the track particle was made frome.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
TrackMeasurementValidation_v1 TrackMeasurementValidation
Reference the current persistent version:
StripCluster_v1 StripCluster
Define the version of the strip cluster class.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
long unsigned int DetectorIdentType
StripClusterContainer_v1 StripClusterContainer
Define the version of the strip cluster container.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
TrackMeasurementValidationContainer_v1 TrackMeasurementValidationContainer
Definition of the current "TrackMeasurementValidation container version".
unsigned int DetectorIDHashType
@ detector ID element hash