8#include "Acts/Surfaces/Surface.hpp"
9#include "Acts/Surfaces/PerigeeSurface.hpp"
36 const auto *actsElement =
dynamic_cast<const ActsDetectorElement *
>(surface.surfacePlacement());
72 return StatusCode::SUCCESS;
85 std::unique_ptr<::TrackCollection> trackCollection = std::make_unique<::TrackCollection>();
93 return StatusCode::SUCCESS;
97 const Acts::GeometryContext &tgContext,
102 for (
const typename ActsTrk::TrackContainer::ConstTrackProxy track : tracks)
104 const auto lastMeasurementIndex = track.tipIndex();
105 auto finalTrajectory = std::make_unique<Trk::TrackStates>();
107 int numberOfDeadPixel = 0;
108 int numberOfDeadSCT = 0;
110 Acts::ParticleHypothesis hypothesis = track.particleHypothesis();
112 std::vector<std::unique_ptr<const Acts::BoundTrackParameters>> actsSmoothedParam;
113 tracks.trackStateContainer().visitBackwards(
114 lastMeasurementIndex,
115 [
this, &tgContext, &track, &finalTrajectory, &actsSmoothedParam, &numberOfDeadPixel, &numberOfDeadSCT](
const typename ActsTrk::TrackStateBackend::ConstTrackStateProxy &state) ->
void
118 if (!state.hasReferenceSurface() || !state.referenceSurface().surfacePlacement())
123 auto flag = state.typeFlags();
124 std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern;
125 std::unique_ptr<Trk::TrackParameters> parm;
130 const Acts::BoundTrackParameters actsParam = track.createParametersFromState(state);
142 if (detElem->isPixel())
146 else if (detElem->isSCT())
161 else if (flag.isOutlier())
163 const Acts::BoundTrackParameters actsParam = track.createParametersFromState(state);
170 const Acts::BoundTrackParameters actsParam = track.createParametersFromState(state);
173 actsSmoothedParam.push_back(std::make_unique<const Acts::BoundTrackParameters>(Acts::BoundTrackParameters(actsParam)));
178 std::unique_ptr<Trk::MeasurementBase> measState, measState2;
181 if (state.hasUncalibratedSourceLink())
185 assert( sl !=
nullptr);
193 ATH_MSG_DEBUG(
"Successfully used ATLASUncalibratedSourceLink");
195 }
catch (
const std::bad_any_cast& ){
196 ATH_MSG_DEBUG(
"Not an ATLASUncalibSourceLink, trying ATLASSourceLink");
198 assert( sl !=
nullptr );
199 measState.reset(sl->clone());
205 double nDoF = state.calibratedSize();
208 std::unique_ptr<Trk::TrackParameters> parm2 = parm->uniqueClone();
210 std::move(measState2),
216 finalTrajectory->insert(finalTrajectory->begin(), perState);
219 std::move(measState),
225 finalTrajectory->insert(finalTrajectory->begin(), perState);
230 const Acts::BoundTrackParameters actsPer(track.referenceSurface().getSharedPtr(),
234 std::unique_ptr<Trk::TrackParameters> per =
m_ATLASConverterTool->actsTrackParametersToTrkParameters(actsPer, tgContext);
235 std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern;
241 finalTrajectory->insert(finalTrajectory->begin(), perState);
248 auto newtrack = std::make_unique<Trk::Track>(newInfo, std::move(finalTrajectory),
nullptr);
250 if (!newtrack->trackSummary())
252 newtrack->setTrackSummary(std::make_unique<Trk::TrackSummary>());
260 tracksContainer.
push_back(std::move(newtrack));
263 return StatusCode::SUCCESS;
276 if (not pixcl or not pixelLinkAcc.
isAvailable(*pixcl))
278 ATH_MSG_DEBUG(
"no pixelClusterLink for cluster associated to measurement");
282 auto pix = *pixelLinkAcc(*pixcl);
291 ATH_MSG_DEBUG(
"create InDet::PixelClusterOnTrack without correction");
292 return std::make_unique<InDet::PixelClusterOnTrack>(
pix,
296 pix->globalPosition(),
306 if (not stripcl or not stripLinkAcc.
isAvailable(*stripcl))
308 ATH_MSG_WARNING(
"no sctClusterLink for clusters associated to measurement");
312 auto sct = *stripLinkAcc(*stripcl);
321 ATH_MSG_DEBUG(
"create InDet::SCT_ClusterOnTrack without correction");
322 return std::make_unique<InDet::SCT_ClusterOnTrack>(sct,
326 sct->globalPosition(),
336 if(
sc==StatusCode::FAILURE){
346 if(
sc==StatusCode::FAILURE){
353 return std::unique_ptr<Trk::MeasurementBase>(
m_muonClusterCreator->correct(*prd, parm, Gaudi::Hive::currentContext()));
357 return std::unique_ptr<Trk::MeasurementBase>(
m_muonClusterCreator->correct(*rpc, parm, Gaudi::Hive::currentContext()));
363 if(
sc==StatusCode::FAILURE){
370 return std::unique_ptr<Trk::MeasurementBase>(
m_muonClusterCreator->correct(*prd, parm, Gaudi::Hive::currentContext()));
374 return std::unique_ptr<Trk::MeasurementBase>(
m_muonClusterCreator->correct(*tgc, parm, Gaudi::Hive::currentContext()));
380 if(
sc==StatusCode::FAILURE){
385 return std::unique_ptr<Trk::MeasurementBase>(
m_muonClusterCreator->correct(*mm, parm, Gaudi::Hive::currentContext()));
390 if(
sc==StatusCode::FAILURE){
397 return std::unique_ptr<Trk::MeasurementBase>(
m_muonClusterCreator->correct(*prd, parm, Gaudi::Hive::currentContext()));
401 return std::unique_ptr<Trk::MeasurementBase>(
m_muonClusterCreator->correct(*prd, parm, Gaudi::Hive::currentContext()));
406 ATH_MSG_WARNING(
"xAOD::UncalibratedMeasurement is neither xAOD::PixelCluster, xAOD::StripCluster, nor muons");
410 ATH_MSG_DEBUG(
"use Trk::RIO_OnTrackCreator::correct to create corrected Trk::RIO_OnTrack");
412 assert(rio !=
nullptr);
413 return std::unique_ptr<Trk::MeasurementBase>(
m_RotCreatorTool->correct(*rio, parm, Gaudi::Hive::currentContext()));
416 template <
class PrdType>
420 ATH_MSG_WARNING(
"Cannot fetch a prep data object as the container given for "<<
429 for (
const PrdType* prd : *coll) {
430 if (prd->identify() == prdId){
static const InDetDD::SiDetectorElement * actsToDetElem(const Acts::Surface &surface)
#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
SG::ReadHandleKey< Muon::sTgcPrepDataContainer > m_keyStgc
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
std::unique_ptr< Trk::MeasurementBase > makeRIO_OnTrack(const xAOD::UncalibratedMeasurement &uncalibMeas, const Trk::TrackParameters &parm, bool getSecMeas) const
SG::WriteHandleKey<::TrackCollection > m_tracksKey
const PrdType * fetchPrd(const Identifier &prdId, const Muon::MuonPrepDataContainerT< PrdType > *prdContainer) const
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
SG::ReadHandleKey< Muon::MdtPrepDataContainer > m_keyMdt
SG::ReadHandleKey< Muon::RpcPrepDataContainer > m_keyRpc
SG::ReadHandleKey< Muon::TgcPrepDataContainer > m_keyTgc
ToolHandle< Muon::IMuonClusterOnTrackCreator > m_muonClusterCreator
SG::ReadHandleKey< Muon::MMPrepDataContainer > m_keyMm
PublicToolHandle< ActsTrk::ITrackingGeometryTool > m_trackingGeometryTool
value_type push_back(value_type pElem)
Add an element to the end of the collection.
virtual const T * indexFindPtr(IdentifierHash hashId) const override final
return pointer on the found entry or null if out of range using hashed index - fast version,...
Class to hold geometrical description of a silicon detector element.
virtual IdentifierHash identifyHash() const override final
identifier hash (inline)
Class to represent MM measurements.
Class to represent measurements from the Monitored Drift Tubes.
Template to hold collections of MuonPrepRawData objects.
Class to represent RPC measurements.
Class to represent TGC measurements.
Class to represent sTgc measurements.
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 unsigned int numDimensions() const =0
Returns the number of dimensions of the measurement.
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.
MuonPrepDataContainerT< RpcPrepData > RpcPrepDataContainer
MuonPrepDataContainer< MuonPrepDataCollection< PrdType > > MuonPrepDataContainerT
MuonPrepDataContainerT< TgcPrepData > TgcPrepDataContainer
MuonPrepDataContainerT< MdtPrepData > MdtPrepDataContainer
MuonPrepDataContainerT< sTgcPrepData > sTgcPrepDataContainer
MuonPrepDataContainerT< MMPrepData > MMPrepDataContainer
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
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.
const Identifier & identify(const UncalibratedMeasurement *meas)
Returns the associated identifier from the muon measurement.
CombinedMuonStrip_v1 CombinedMuonStrip
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.