8#include "Acts/Surfaces/Surface.hpp"
9#include "Acts/Surfaces/PerigeeSurface.hpp"
23 const auto *actsElement =
dynamic_cast<const ActsDetectorElement *
>(surface.associatedDetectorElement());
51 return StatusCode::SUCCESS;
64 std::unique_ptr<::TrackCollection> trackCollection = std::make_unique<::TrackCollection>();
73 return StatusCode::SUCCESS;
77 const Acts::GeometryContext &tgContext,
82 for (
const typename ActsTrk::TrackContainer::ConstTrackProxy track : tracks)
84 const auto lastMeasurementIndex = track.tipIndex();
85 auto finalTrajectory = std::make_unique<Trk::TrackStates>();
87 int numberOfDeadPixel = 0;
88 int numberOfDeadSCT = 0;
90 Acts::ParticleHypothesis hypothesis = track.particleHypothesis();
92 std::vector<std::unique_ptr<const Acts::BoundTrackParameters>> actsSmoothedParam;
93 tracks.trackStateContainer().visitBackwards(
95 [
this, &tgContext, &track, &finalTrajectory, &actsSmoothedParam, &numberOfDeadPixel, &numberOfDeadSCT](
const typename ActsTrk::TrackStateBackend::ConstTrackStateProxy &state) ->
void
98 if (!state.hasReferenceSurface() || !state.referenceSurface().associatedDetectorElement())
103 auto flag = state.typeFlags();
104 std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern;
105 std::unique_ptr<Trk::TrackParameters> parm;
108 if (flag.test(Acts::TrackStateFlag::HoleFlag))
110 const Acts::BoundTrackParameters actsParam = track.createParametersFromState(state);
117 auto *detElem = actsToDetElem(state.referenceSurface());
122 if (detElem->isPixel())
126 else if (detElem->isSCT())
140 else if (flag.test(Acts::TrackStateFlag::OutlierFlag))
142 const Acts::BoundTrackParameters actsParam = track.createParametersFromState(state);
149 const Acts::BoundTrackParameters actsParam = track.createParametersFromState(state);
152 actsSmoothedParam.push_back(std::make_unique<const Acts::BoundTrackParameters>(Acts::BoundTrackParameters(actsParam)));
157 std::unique_ptr<Trk::MeasurementBase> measState;
158 if (state.hasUncalibratedSourceLink())
162 assert( sl !=
nullptr);
165 ATH_MSG_DEBUG(
"Successfully used ATLASUncalibratedSourceLink");
166 }
catch (
const std::bad_any_cast& ){
167 ATH_MSG_DEBUG(
"Not an ATLASUncalibSourceLink, trying ATLASSourceLink");
169 assert( sl !=
nullptr );
170 measState.reset(sl->clone());
176 double nDoF = state.calibratedSize();
179 std::move(measState),
185 finalTrajectory->insert(finalTrajectory->begin(), perState);
189 const Acts::BoundTrackParameters actsPer(track.referenceSurface().getSharedPtr(),
194 std::unique_ptr<Trk::TrackParameters> per =
m_ATLASConverterTool->actsTrackParametersToTrkParameters(actsPer, tgContext);
195 std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern;
201 finalTrajectory->insert(finalTrajectory->begin(), perState);
207 auto newtrack = std::make_unique<Trk::Track>(newInfo, std::move(finalTrajectory),
nullptr);
209 if (!newtrack->trackSummary())
211 newtrack->setTrackSummary(std::make_unique<Trk::TrackSummary>());
220 tracksContainer.
push_back(std::move(newtrack));
223 return StatusCode::SUCCESS;
236 if (not pixcl or not pixelLinkAcc.
isAvailable(*pixcl))
238 ATH_MSG_DEBUG(
"no pixelClusterLink for cluster associated to measurement");
242 auto pix = *pixelLinkAcc(*pixcl);
251 ATH_MSG_DEBUG(
"create InDet::PixelClusterOnTrack without correction");
252 return std::make_unique<InDet::PixelClusterOnTrack>(
pix,
256 pix->globalPosition(),
266 if (not stripcl or not stripLinkAcc.
isAvailable(*stripcl))
268 ATH_MSG_WARNING(
"no sctClusterLink for clusters associated to measurement");
272 auto sct = *stripLinkAcc(*stripcl);
281 ATH_MSG_DEBUG(
"create InDet::SCT_ClusterOnTrack without correction");
282 return std::make_unique<InDet::SCT_ClusterOnTrack>(sct,
286 sct->globalPosition(),
293 ATH_MSG_WARNING(
"xAOD::UncalibratedMeasurement is neither xAOD::PixelCluster nor xAOD::StripCluster");
297 ATH_MSG_DEBUG(
"use Trk::RIO_OnTrackCreator::correct to create corrected Trk::RIO_OnTrack");
299 assert(rio !=
nullptr);
300 return std::unique_ptr<Trk::MeasurementBase>(
m_RotCreatorTool->correct(*rio, parm, Gaudi::Hive::currentContext()));
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
ToolHandle< Trk::IBoundaryCheckTool > m_boundaryCheckTool
ToolHandle< ActsTrk::IActsToTrkConverterTool > m_ATLASConverterTool
ToolHandle< Trk::IExtendedTrackSummaryTool > m_trkSummaryTool
StatusCode makeTracks(const EventContext &ctx, const Acts::GeometryContext &tgContext, const ActsTrk::TrackContainer &tracks, ::TrackCollection &tracksContainer) const
virtual StatusCode initialize() override
virtual StatusCode execute(const EventContext &ctx) const override
SG::ReadHandleKey< ActsTrk::TrackContainer > m_tracksContainerKey
ToolHandle< Trk::IRIO_OnTrackCreator > m_RotCreatorTool
SG::WriteHandleKey<::TrackCollection > m_tracksKey
std::unique_ptr< Trk::MeasurementBase > makeRIO_OnTrack(const xAOD::UncalibratedMeasurement &uncalibMeas, const Trk::TrackParameters &parm) const
PublicToolHandle< ActsTrk::ITrackingGeometryTool > m_trackingGeometryTool
value_type push_back(value_type pElem)
Add an element to the end of the collection.
Class to hold geometrical description of a silicon detector element.
virtual IdentifierHash identifyHash() const override final
identifier hash (inline)
SG::ConstAccessor< T, ALLOC > ConstAccessor
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.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
Contains information about the 'fitter' of this track.
@ KalmanFitter
tracks produced by the Kalman Fitter
void setPatternRecognitionInfo(const TrackPatternRecoInfo &patternReco)
Method setting the pattern recognition algorithm.
@ SiSPSeededFinder
Tracks from SiSPSeedFinder.
represents the track state (measurement, material, fit parameters and quality) at a surface.
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
@ Perigee
This represents a perigee, and so will contain a Perigee object only.
@ 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.
virtual xAOD::UncalibMeasType type() const =0
Returns the type of the measurement type as a simple enumeration.
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)
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
@ DeadElement
outside the element
ParametersBase< TrackParametersDim, Charged > TrackParameters
@ numberOfTRTHoles
number of TRT hits which pass the high threshold (only xenon counted) total number of TRT hits which ...
@ numberOfSCTHoles
number of Holes in both sides of a SCT module
@ numberOfSCTDeadSensors
number of TRT hits
@ numberOfPixelHoles
number of pixels which have a ganged ambiguity.
@ numberOfPixelDeadSensors
number of pixel hits with broad errors (width/sqrt(12))
StripCluster_v1 StripCluster
Define the version of the strip cluster class.
PixelCluster_v1 PixelCluster
Define the version of the pixel cluster class.
UncalibMeasType
Define the type of the uncalibrated measurement.
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.