15 ISvcLocator *pSvcLocator)
30 return StatusCode::SUCCESS;
42 ATH_CHECK( pixelMsosHandle.
record(std::make_unique<xAOD::TrackStateValidationContainer>(),
43 std::make_unique<xAOD::TrackStateValidationAuxContainer>()) );
47 ATH_CHECK( stripMsosHandle.
record(std::make_unique<xAOD::TrackStateValidationContainer>(),
48 std::make_unique<xAOD::TrackStateValidationAuxContainer>()) );
52 std::vector< ElementLink< xAOD::TrackStateValidationContainer > > > decorator_msos_link(
m_trackMsosLink, ctx );
59 std::optional<ActsTrk::TrackContainer::ConstTrackProxy> optional_track =
getActsTrack(*trackParticle);
60 if ( not optional_track.has_value() ) {
61 ATH_MSG_ERROR(
"Invalid track link for particle " << trackParticle->index());
62 return StatusCode::FAILURE;
64 ActsTrk::TrackContainer::ConstTrackProxy track = optional_track.value();
66 std::vector< typename ActsTrk::TrackContainer::ConstTrackStateProxy > tsos {};
67 tsos.reserve( track.nTrackStates() );
71 track.container().trackStateContainer()
72 .visitBackwards(track.tipIndex(),
74 (
const typename ActsTrk::TrackContainer::ConstTrackStateProxy& state)
76 auto flags = state.typeFlags();
77 if (not flags.isMeasurement() and
78 not flags.isOutlier() and
79 not flags.isHole()) return;
80 tsos.push_back( state );
83 std::vector< ElementLink< xAOD::TrackStateValidationContainer > > msos {};
84 msos.reserve( tsos.size() );
86 for (
const typename ActsTrk::TrackContainer::ConstTrackStateProxy& state : tsos) {
87 const Acts::Surface& surface = state.referenceSurface();
104 << surface.geometryId().volume()
106 <<
"; state is not written to the standard Pixel/Strip MSOS containers");
112 decorator_msos_link(*trackParticle) = std::move(msos);
115 return StatusCode::SUCCESS;
126 msosLinks.push_back( std::move(elink) );
130 auto flags = state.typeFlags();
131 if (not flags.isHole() ) {
136 if (not decorator_measurement_link.
isAvailable(cluster)) {
137 ATH_MSG_ERROR(
"xAOD Cluster does not have a link to TrackMeasurementValidation element");
138 return StatusCode::FAILURE;
140 const auto& el = decorator_measurement_link(cluster);
145 measurement->index() );
149 if (flags.isHole()) {
151 }
else if (flags.isOutlier()) {
157 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
Handle class for reading a decoration on an object.
Handle class for adding a decoration to an object.
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackParticlesKey
Gaudi::Property< bool > m_isITk
ActsTrackStateOnSurfaceDecoratorAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadDecorHandleKey< xAOD::TrackParticleContainer > m_decorator_actsTracks
xAOD::UncalibMeasType getDetectorType(std::uint64_t volumeId) const
SG::WriteHandleKey< xAOD::TrackStateValidationContainer > m_pixelMsosKey
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_trackMsosLink
virtual StatusCode execute(const EventContext &ctx) const override
virtual StatusCode initialize() override
SG::WriteHandleKey< xAOD::TrackStateValidationContainer > m_stripMsosKey
StatusCode storeTrackState(const typename ActsTrk::TrackContainer::ConstTrackStateProxy &state, std::vector< ElementLink< xAOD::TrackStateValidationContainer > > &msosLinks, xAOD::TrackStateValidationContainer &msosContainer) 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.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
ElementLink implementation for ROOT usage.
bool isValid() const
Check if the element can be found.
Helper class to provide constant type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
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.
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
@ Hole
A hole on the track - this is defined in the following way.
void setDetType(char detType)
Sets the detector type.
void setType(int type)
Sets the type (measurement, outlier, hole).
void setTrackMeasurementValidationLink(ElementLink< xAOD::TrackMeasurementValidationContainer > trackMeasurementValidationLink)
sets the link to the TrackMeasurementValidationContainer
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
const xAOD::UncalibratedMeasurement & getUncalibratedMeasurement(const ATLASUncalibSourceLink &source_link)
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:
TrackStateValidationContainer_v1 TrackStateValidationContainer
Definition of the current "TrackStateValidation container version".
TrackStateValidation_v1 TrackStateValidation
Reference the current persistent version:
TrackParticle_v1 TrackParticle
Reference the current persistent version:
UncalibMeasType
Define the type of the uncalibrated measurement.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
TrackMeasurementValidationContainer_v1 TrackMeasurementValidationContainer
Definition of the current "TrackMeasurementValidation container version".
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.