112 {
115
116 Acts::VectorTrackContainer tback;
117 Acts::VectorMultiTrajectory tsBack;
119
120
121 Acts::VectorTrackContainer trackBackend;
122 Acts::VectorMultiTrajectory trackStateBackend;
124
125
126 const InDet::BeamSpotData* beamSpotData{};
128
129
130 Acts::Vector3 beamPos( beamSpotData->
beamPos().x() * Acts::UnitConstants::mm,
131 beamSpotData->
beamPos().y() * Acts::UnitConstants::mm,
132 0 );
133
134
135 std::shared_ptr<Acts::PerigeeSurface> perigeeSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(beamPos);
136
137 const Acts::GeometryContext tgContext{
m_ctxProvider.getGeometryContext(context)};
138 const Acts::MagneticFieldContext mfContext{
m_ctxProvider.getMagneticFieldContext(context)};
139 const Acts::CalibrationContext calContext{
m_ctxProvider.getCalibrationContext(context)};
140
142
144 ATH_MSG_DEBUG(
"Measurements (pixels only) size: " << pixelClustersHandle->size());
145
146 detail::TrackFindingMeasurements measurements(1ul );
148 std::optional<detail::MeasurementIndex> measurementIndex;
149
151 measurementIndex.emplace(1ul);
152 measurementIndex->addMeasurements(*pixelClustersHandle);
153 }
154
155 using DefaultTrackStateCreator = Acts::TrackStateCreator<ActsTrk::detail::UncalibSourceLinkAccessor::Iterator,detail::RecoTrackContainer>;
156
158 DefaultTrackStateCreator::SourceLinkAccessor slAccessorDelegate;
160
161 Acts::PropagatorPlainOptions plainOptions(tgContext, mfContext);
162 plainOptions.maxSteps = 1000;
163 plainOptions.direction=
m_propagateForward ? Acts::Direction::Forward() : Acts::Direction::Backward();
164
165
166
168 mfContext,
169 calContext,
171 plainOptions,
172 perigeeSurface.get());
173
174 options.targetSurface = perigeeSurface.get();
175
176 auto calibrator = detail::OnTrackCalibrator<detail::RecoTrackStateContainer>(
177 context,
182
184 defaultTrackStateCreator.sourceLinkAccessor = slAccessorDelegate;
185 defaultTrackStateCreator.calibrator.template connect<&detail::OnTrackCalibrator<detail::RecoTrackStateContainer>::calibrate>(&calibrator);
186
188 &DefaultTrackStateCreator
189 ::createTrackStates>(&defaultTrackStateCreator);
190
193 for ( auto truthParticle: *truthHandle ) {
194 ATH_MSG_DEBUG(
"truth: eta: " << truthParticle->eta() <<
" phi: " << truthParticle->phi() <<
" pt: " << truthParticle->pt());
195 }
196 }
197
198 ATH_MSG_DEBUG(
"Size of proto tracks collection " << protoTracksHandle->size());
199 for (const ActsTrk::ProtoTrack& protoTrack : *protoTracksHandle) {
200 if(protoTrack.measurements.empty()) continue;
201
202 const Acts::Surface* refSurface = surfAcc.get(protoTrack.measurements[0]);
203
204 auto res =
m_actsFitter->fit(protoTrack.measurements, *protoTrack.parameters,
205 tgContext, mfContext, calContext, refSurface);
207 if (
res->size() == 0 )
continue;
208 ATH_MSG_DEBUG(
".......Done fit of track with "<< protoTrack.measurements.size() <<
" measurements");
209 const auto trackProxy =
res->getTrack(0);
210 if (not trackProxy.hasReferenceSurface()) {
211 ATH_MSG_INFO(
"There is not reference surface for this track");
212 continue;
213 }
214
215 Acts::BoundTrackParameters parametersAtRefSurface( trackProxy.referenceSurface().getSharedPtr(),
216 trackProxy.parameters(),
217 trackProxy.covariance(),
218 trackProxy.particleHypothesis());
219
220
221
222 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())));
223 ATH_MSG_DEBUG(
"Extending proto track of " << protoTrack.measurements.size() <<
" measurements");
225 tracksContainerTemp);
226
227
228 ATH_MSG_DEBUG(
"Built " << tracksContainerTemp.size() <<
" tracks from it");
229 for (detail::RecoTrackContainer::TrackProxy tempTrackProxy : tracksContainerTemp) {
230 auto destTrackProxy = trackContainer.makeTrack();
231 ATH_MSG_DEBUG(
"Reco MTJ size " << trackStateBackend.size() );
232 for ( size_t stateIndex=0; stateIndex < trackStateBackend.size(); ++stateIndex) {
233 auto state = trackStateBackend.getTrackState(stateIndex);
235 }
236 ATH_MSG_DEBUG(
"Track has: " << tempTrackProxy.nMeasurements() <<
" measurements ");
237 ATH_MSG_DEBUG(
"track: eta: " << -1 *
log(
tan( tempTrackProxy.theta() * 0.5)) <<
" phi: " << tempTrackProxy.phi() <<
" pt:" << abs(1./tempTrackProxy.qOverP() *
sin(protoTrack.parameters->theta())));
238
239 destTrackProxy.copyFrom(tempTrackProxy);
240 }
241 }
242
243
244
245
246 Acts::ConstVectorTrackContainer ctback( std::move(tback) );
247 Acts::ConstVectorMultiTrajectory ctsBack( std::move(tsBack) );
248 std::unique_ptr< ActsTrk::TrackContainer > ctrackContainer = std::make_unique< ActsTrk::TrackContainer >( std::move(ctback), std::move(ctsBack) );
249
252
253 return StatusCode::SUCCESS;
254 }
#define ATH_CHECK
Evaluate an expression and check for errors.
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())