10 #include <unordered_set>
16 ISvcLocator* pSvcLocator)
43 (!m_pixelDetElStatus.empty() && !VALIDATE_STATUS_ARRAY_ACTIVATED)}));
45 (!m_stripDetElStatus.empty() && !VALIDATE_STATUS_ARRAY_ACTIVATED)}));
51 ATH_MSG_ERROR(
"Use either track finder or track reader, not both.");
52 return StatusCode::FAILURE;
64 return StatusCode::SUCCESS;
80 ATH_CHECK(outputTracks.record(std::make_unique<TrackCollection>()));
86 std::vector<const Trk::SpacePoint*> spacePoints;
88 auto getSpacepointData =
90 if (not containerKey.empty()) {
94 if (container.isValid()) {
95 for (
auto spCollection : *container.cptr()) {
111 ATH_MSG_DEBUG(
"Found " << pixelClusters->size() <<
" pixel clusters");
112 ATH_MSG_DEBUG(
"Found " << stripClusters->size() <<
" strip clusters");
113 ATH_MSG_DEBUG(
"Found " << spacePoints.size() <<
" space points");
115 std::vector<std::vector<uint32_t>> gnnTrackCandidates;
121 ATH_MSG_ERROR(
"Both GNNTrackFinder and GNNTrackReader are not set");
122 return StatusCode::FAILURE;
125 ATH_MSG_DEBUG(
"Obtained " << gnnTrackCandidates.size() <<
" Tracks");
130 if (not
data.isInitialized())
134 data.inputseeds() = 0;
135 data.goodseeds() = 0;
136 data.inittracks() = 0;
137 data.findtracks() = 0;
142 data.setCosmicTrack(0);
143 data.setPixContainer(pixelClusters.cptr());
144 data.setSctContainer(stripClusters.cptr());
155 if (fieldCondObj ==
nullptr) {
157 "InDet::SiTrackMaker_xk::getTracks: Failed to retrieve "
158 "AtlasFieldCacheCondObj with key "
160 return StatusCode::FAILURE;
162 fieldCondObj->getInitializedCache(fieldCache);
164 int num_extended_tracks = 0;
166 for (
auto& trackIndices : gnnTrackCandidates) {
168 std::vector<const Trk::PrepRawData*>
clusters;
169 std::vector<const Trk::SpacePoint*> trackCandidate;
170 trackCandidate.reserve(trackIndices.size());
172 for (
auto&
id : trackIndices) {
174 if (
id > spacePoints.size()) {
180 trackCandidate.push_back(sp);
202 if (trkParameters ==
nullptr) {
210 bool outlier_removal =
false;
212 ctx,
clusters, *trkParameters, outlier_removal, matEffects);
213 if (
track !=
nullptr &&
track->perigeeParameters() !=
nullptr) {
217 outlier_removal, matEffects);
221 if (
track ==
nullptr)
224 bool is_extension_successful =
false;
228 std::vector<const InDetDD::SiDetectorElement*> trackRoad;
230 trackRoad, roadMakerData);
231 if (!trackRoad.empty()) {
232 std::vector<const InDet::SiDetElementBoundaryLink_xk*> DEL;
235 data.tools().setBremNoise(
false,
false);
236 data.tracks().erase(
data.tracks().begin(),
data.tracks().end());
237 data.statistic().fill(
false);
241 std::vector<const InDet::SiCluster*> Cl;
244 bool Q =
data.trajectory().initialize(
true,
true, pixelClusters.cptr(),
245 stripClusters.cptr(), Tp, Cl, DEL,
251 bool do_smooth =
true;
252 if (
data.trajectory().forwardExtension(do_smooth, itmax, ctx)) {
254 if (
data.trajectory().backwardSmoother(
false, ctx)) {
256 data.trajectory().sortStep();
259 info.setPatternRecognitionInfo(
265 std::make_unique<Trk::TrackStates>(
266 data.trajectory().convertToSimpleTrackStateOnSurface(ctx)),
267 data.trajectory().convertToFitQuality());
269 auto extended_track =
271 if (extended_track !=
nullptr &&
272 extended_track->trackSummary() !=
nullptr) {
273 num_extended_tracks++;
274 is_extension_successful =
true;
275 outputTracks->push_back(extended_track.release());
282 if (!is_extension_successful) {
285 if (
track !=
nullptr &&
track->trackSummary() !=
nullptr) {
286 outputTracks->push_back(
track.release());
291 data.tracks().erase(
data.tracks().begin(),
data.tracks().end());
293 << outputTracks->size() <<
" tracks stored, with "
294 << num_extended_tracks <<
" extended.");
295 return StatusCode::SUCCESS;
303 const std::vector<const Trk::SpacePoint*>& Sp,
304 std::vector<const InDet::SiCluster*>& Sc,
306 std::reference_wrapper<std::vector<const InDetDD::SiDetectorElement*>>>
308 Sc.reserve(Sp.size());
321 p =
s->clusterList().second;
333 endClusters = Sc.end();
338 DE->get().reserve(Sc.size());
340 for (; cluster != endClusters; ++cluster) {
344 nextCluster = cluster;
346 for (; nextCluster != endClusters; ++nextCluster) {
347 if (de == (*nextCluster)->detectorElement()) {
352 DE->get().push_back(de);
363 std::vector<const InDetDD::SiDetectorElement*>& DE,
364 std::vector<const InDet::SiDetElementBoundaryLink_xk*>& DEL,
365 const EventContext& ctx)
const {
371 boundaryPixel = *boundaryPixelHandle;
372 if (boundaryPixel ==
nullptr) {
378 boundaryStrip = *boundaryStripHandle;
379 if (boundaryStrip ==
nullptr) {
383 DEL.reserve(DE.size());
386 if (
d->isPixel() && boundaryPixel && id < boundaryPixel->
size())
387 DEL.push_back(&(*boundaryPixel)[
id]);
388 else if (
d->isSCT() && boundaryStrip && id < boundaryStrip->
size())
389 DEL.push_back(&(*boundaryStrip)[
id]);
402 if (fieldCondObj ==
nullptr) {
404 "InDet::SiCombinatorialTrackFinder_xk::initializeCombinatorialData: "
405 "Failed to retrieve AtlasFieldCacheCondObj with key " +
407 throw(std::runtime_error(
msg));
409 data.setFieldCondObj(fieldCondObj);
424 data.setPixelDetectorElementStatus(pixelDetElStatus.
cptr());
429 data.setSCTDetectorElementStatus(stripDetElStatus.
cptr());
433 data.setITkGeometry(
true);
435 data.setFastTracking(
false);
441 data.setCosmicTrack(0);
448 data.tools().setHolesClusters(
data.nholesmax(),
data.dholesmax(),
451 data.tools().setAssociation(0);
452 data.setSimpleTrack(
false);
459 data.tools().setXi2pTmin(
data.xi2max(),
data.xi2maxNoAdd(),
data.xi2maxlink(),
463 data.trajectory().setParameters();