115 {
118
119 Acts::VectorTrackContainer tback;
120 Acts::VectorMultiTrajectory tsBack;
122
123
124 Acts::VectorTrackContainer trackBackend;
125 Acts::VectorMultiTrajectory trackStateBackend;
127
128
129 const InDet::BeamSpotData* beamSpotData{};
131
132
133 Acts::Vector3 beamPos( beamSpotData->
beamPos().x() * Acts::UnitConstants::mm,
134 beamSpotData->
beamPos().y() * Acts::UnitConstants::mm,
135 0 );
136
137
138 std::shared_ptr<Acts::PerigeeSurface> perigeeSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(beamPos);
139
140 const Acts::GeometryContext tgContext{
m_ctxProvider.getGeometryContext(context)};
141 const Acts::MagneticFieldContext mfContext{
m_ctxProvider.getMagneticFieldContext(context)};
142 const Acts::CalibrationContext calContext{
m_ctxProvider.getCalibrationContext(context)};
143
145
147 ATH_MSG_DEBUG(
"Measurements (pixels only) size: " << pixelClustersHandle->size());
148
149 detail::TrackFindingMeasurements measurements(1ul );
151 std::optional<detail::MeasurementIndex> measurementIndex;
152
154 measurementIndex.emplace(1ul);
155 measurementIndex->addMeasurements(*pixelClustersHandle);
156 }
157
158 using DefaultTrackStateCreator = Acts::TrackStateCreator<ActsTrk::detail::UncalibSourceLinkAccessor::Iterator,detail::RecoTrackContainer>;
159
161 DefaultTrackStateCreator::SourceLinkAccessor slAccessorDelegate;
163
164 Acts::PropagatorPlainOptions plainOptions(tgContext, mfContext);
165 plainOptions.maxSteps = 1000;
166 plainOptions.direction=
m_propagateForward ? Acts::Direction::Forward() : Acts::Direction::Backward();
167
168
169
171 mfContext,
172 calContext,
174 plainOptions,
175 perigeeSurface.get());
176
177 options.targetSurface = perigeeSurface.get();
178
179 auto calibrator = detail::OnTrackCalibrator<detail::RecoTrackStateContainer>(
180 context,
185
187 defaultTrackStateCreator.sourceLinkAccessor = slAccessorDelegate;
188 defaultTrackStateCreator.calibrator.template connect<&detail::OnTrackCalibrator<detail::RecoTrackStateContainer>::calibrate>(&calibrator);
189
191 &DefaultTrackStateCreator
192 ::createTrackStates>(&defaultTrackStateCreator);
193
196 for ( auto truthParticle: *truthHandle ) {
197 ATH_MSG_DEBUG(
"truth: eta: " << truthParticle->eta() <<
" phi: " << truthParticle->phi() <<
" pt: " << truthParticle->pt());
198 }
199 }
200
201 ATH_MSG_DEBUG(
"Size of proto tracks collection " << protoTracksHandle->size());
202 for (const ActsTrk::ProtoTrack& protoTrack : *protoTracksHandle) {
203 if(protoTrack.measurements.empty()) continue;
204
205 const Acts::Surface* refSurface = surfAcc.get(protoTrack.measurements[0]);
206
207 auto res =
m_actsFitter->fit(protoTrack.measurements, *protoTrack.parameters,
208 tgContext, mfContext, calContext, refSurface);
210 if (
res->size() == 0 )
continue;
211 ATH_MSG_DEBUG(
".......Done fit of track with "<< protoTrack.measurements.size() <<
" measurements");
212 const auto trackProxy =
res->getTrack(0);
213 if (not trackProxy.hasReferenceSurface()) {
214 ATH_MSG_INFO(
"There is not reference surface for this track");
215 continue;
216 }
217
218 Acts::BoundTrackParameters parametersAtRefSurface( trackProxy.referenceSurface().getSharedPtr(),
219 trackProxy.parameters(),
220 trackProxy.covariance(),
221 trackProxy.particleHypothesis());
222
223
224
225 ATH_MSG_DEBUG(
"proto track: eta: " << -1 *
log(
tan( parametersAtRefSurface.theta() * 0.5)) <<
" phi: " << parametersAtRefSurface.phi() <<
" pt:" << abs(1./protoTrack.parameters->qOverP() *
sin(protoTrack.parameters->theta())));
226 ATH_MSG_DEBUG(
"Extending proto track of " << protoTrack.measurements.size() <<
" measurements");
228 tracksContainerTemp);
229
230
231 ATH_MSG_DEBUG(
"Built " << tracksContainerTemp.size() <<
" tracks from it");
232 for (detail::RecoTrackContainer::TrackProxy tempTrackProxy : tracksContainerTemp) {
233 auto destTrackProxy = trackContainer.makeTrack();
234 ATH_MSG_DEBUG(
"Reco MTJ size " << trackStateBackend.size() );
235 for ( size_t stateIndex=0; stateIndex < trackStateBackend.size(); ++stateIndex) {
236 auto state = trackStateBackend.getTrackState(stateIndex);
238 }
239 ATH_MSG_DEBUG(
"Track has: " << tempTrackProxy.nMeasurements() <<
" measurements ");
240 ATH_MSG_DEBUG(
"track: eta: " << -1 *
log(
tan( tempTrackProxy.theta() * 0.5)) <<
" phi: " << tempTrackProxy.phi() <<
" pt:" << abs(1./tempTrackProxy.qOverP() *
sin(protoTrack.parameters->theta())));
241
242 destTrackProxy.copyFrom(tempTrackProxy);
243 }
244 }
245
246
247
248
249 Acts::ConstVectorTrackContainer ctback( std::move(tback) );
250 Acts::ConstVectorMultiTrajectory ctsBack( std::move(tsBack) );
251 std::unique_ptr< ActsTrk::TrackContainer > ctrackContainer = std::make_unique< ActsTrk::TrackContainer >( std::move(ctback), std::move(ctsBack) );
252
255
256 return StatusCode::SUCCESS;
257 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_INFO(x,...)
std::pair< std::vector< unsigned int >, bool > res
ToolHandle< ActsTrk::TrackStatePrinterTool > m_trackStatePrinter
ToolHandle< ActsTrk::IPixelOnTrackCalibratorTool< detail::RecoTrackStateContainer > > m_pixelCalibTool
SG::ReadHandleKey< xAOD::PixelClusterContainer > m_pixelClusters
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc
SG::WriteHandleKey< ActsTrk::TrackContainer > m_trackContainerKey
SG::ReadHandleKey< ActsTrk::ProtoTrackCollection > m_protoTrackCollectionKey
Acts::CombinatorialKalmanFilterOptions< detail::RecoTrackContainer > CKFOptions
std::unique_ptr< detail::CKF_config > m_ckfConfig
ContextUtility m_ctxProvider
Utility to fetch the geometry, magnetic field and calibration context in the event.
ToolHandle< ActsTrk::IFitterTool > m_actsFitter
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticlesKey
ToolHandle< ActsTrk::IHGTDOnTrackCalibratorTool< detail::RecoTrackStateContainer > > m_hgtdCalibTool
Gaudi::Property< bool > m_propagateForward
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
ToolHandle< ActsTrk::IStripOnTrackCalibratorTool< detail::RecoTrackStateContainer > > m_stripCalibTool
std::pair< Iterator, Iterator > range(const Acts::Surface &surface) const
const Amg::Vector3D & beamPos() const noexcept
virtual bool isValid() override final
Can the handle be successfully dereferenced?
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
GenUncalibSourceLinkAccessor< MeasurementRangeList > UncalibSourceLinkAccessor
Acts::TrackContainer< Acts::VectorTrackContainer, Acts::VectorMultiTrajectory > RecoTrackContainer
Acts::TrackStateCreator< ActsTrk::detail::UncalibSourceLinkAccessor::Iterator, detail::RecoTrackContainer > DefaultTrackStateCreator
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())