14 const std::string&
name, ISvcLocator* pSvcLocator)
35 ATH_MSG_ERROR(
"Use either track finder or track reader, not both.");
36 return StatusCode::FAILURE;
53 ATH_MSG_INFO(
"Applying the following cuts during GNN-based track reconstruction: ");
62 ATH_MSG_INFO(
"Applying the following eta dependant track cuts after GNN-based track reconstruction: ");
81 return StatusCode::SUCCESS;
87 ATH_CHECK(outputTracks.record(std::make_unique<TrackCollection>()));
100 std::vector<std::vector<uint32_t> >
TT;
101 std::vector<std::vector<uint32_t> > clusterTracks;
110 ATH_MSG_ERROR(
"Both GNNTrackFinder and GNNTrackReader are not set");
111 return StatusCode::FAILURE;
118 int trackCounter = -1;
119 std::vector<int> status_codes;
121 for (
auto& trackIndices :
TT) {
131 getClusters (clusterTracks, allClusters, trackCounter)
143 if (not fitSuccess) {
147 if (passTrackCut <= 0) {
148 outputTracks->push_back(
track.release());
151 status_codes.push_back(passTrackCut);
157 <<
std::count(status_codes.begin(), status_codes.end(), 0)
158 <<
" tracks remains after applying track cuts");
160 ATH_MSG_INFO(
"Event " <<
eventNumber <<
" has " << status_codes.size() <<
" tracks found, all tracks are kept");
163 return StatusCode::SUCCESS;
175 double pt = origPerigee->pT();
177 double eta = std::abs(origPerigee->eta());
179 double d0 = std::abs(origPerigee->parameters()[
Trk::d0]);
181 double z0 = std::abs(origPerigee->parameters()[
Trk::z0]);
188 int nClusters = nPixels +
nStrips;
195 if (nClusters < m_etaDependentCutsSvc->getMinSiHitsAtEta(eta))
199 if (nPixels < m_etaDependentCutsSvc->getMinPixelHitsAtEta(eta))
203 if (pt < m_etaDependentCutsSvc->getMinPtAtEta(eta))
222 const EventContext& ctx,
227 int npixsp(0), nstrip(0), n_overlap(0);
241 <<
" pixel space points, " << nstrip
242 <<
" strips space points" << n_overlap
243 <<
" overlapping spacepoints" <<
spacePoints.size()
250 const EventContext& ctx,
254 if (not containerKey.
empty()){
258 if (container.isValid()){
260 auto spc = container->begin();
261 auto spce = container->end();
262 for(; spc != spce; ++spc){
264 auto sp = spCollection->
begin();
265 auto spe = spCollection->
end();
266 for(; sp != spe; ++sp) {
278 const EventContext& ctx,
284 if (not containerKey.
empty()){
288 if (collection.isValid()){
299 const EventContext& ctx,
302 std::vector<const Trk::PrepRawData*> allClusters;
314 if (!strip_container.
isValid()) {
319 auto pixcollection = pixcontainer->begin();
320 auto pixcollectionEnd = pixcontainer->end();
321 for (; pixcollection != pixcollectionEnd; ++pixcollection) {
322 if ((*pixcollection)->empty()) {
326 auto const* clusterCollection = (*pixcollection);
327 auto thisCluster = clusterCollection->begin();
328 auto clusterEnd = clusterCollection->end();
329 for (; thisCluster != clusterEnd; ++thisCluster) {
331 allClusters.push_back(
cl);
335 auto strip_collection = strip_container->begin();
336 auto strip_collectionEnd = strip_container->end();
337 for (; strip_collection != strip_collectionEnd; ++strip_collection) {
338 if ((*strip_collection)->empty()) {
342 auto const* clusterCollection = (*strip_collection);
343 auto thisCluster = clusterCollection->begin();
344 auto clusterEnd = clusterCollection->end();
345 for (; thisCluster != clusterEnd; ++thisCluster) {
347 allClusters.push_back(
cl);
359 const std::vector<uint32_t>& trackIndices,
360 const std::vector<const Trk::SpacePoint*>& allSpacePoints
363 std::vector<const Trk::SpacePoint*> trackCandidate;
364 trackCandidate.reserve(trackIndices.size());
366 std::vector<std::pair<double, const Trk::SpacePoint*> > distanceSortedSPs;
370 for (
auto&
id : trackIndices) {
372 if (
id > allSpacePoints.size()) {
374 <<
id <<
" out of range: " << allSpacePoints.size());
382 distanceSortedSPs.push_back(
392 std::sort(distanceSortedSPs.begin(), distanceSortedSPs.end());
395 for (
size_t i = 0;
i < distanceSortedSPs.size();
i++) {
396 trackCandidate.push_back(distanceSortedSPs[
i].
second);
399 return trackCandidate;
403 const std::vector<const Trk::SpacePoint*>&
spacePoints
405 std::vector<const Trk::PrepRawData*>
clusters;
407 clusters.push_back(sp->clusterList().first);
408 if (sp->clusterList().second !=
nullptr) {
409 clusters.push_back(sp->clusterList().second);
416 const std::vector<std::vector<uint32_t>>& clusterTracks,
417 const std::vector<const Trk::PrepRawData*>& allClusters,
420 std::vector<uint32_t> clusterIndices = clusterTracks[
trackNumber];
421 std::vector<const Trk::PrepRawData*>
clusters;
422 clusters.reserve(clusterIndices.size());
423 for (
uint32_t id : clusterIndices) {
424 if (
id > allClusters.size()) {
428 clusters.push_back(allClusters[
id]);
467 const EventContext& ctx,
469 std::vector<const Trk::PrepRawData*>&
clusters,
482 <<
" space points, " <<
clusters.size()
483 <<
" clusters, " << nPIX <<
" pixel clusters, "
484 <<
nStrip <<
" strip clusters");
488 ATH_MSG_DEBUG(
"Track " << trackCounter <<
" does not pass prefit cuts, skipping");
489 return std::make_tuple(
false, 999,
nullptr);
494 if (trkParameters ==
nullptr) {
496 return std::make_tuple(
false, 999,
nullptr);
501 if (
track ==
nullptr ||
track->perigeeParameters() ==
nullptr) {
503 <<
" fails the chi2 fit, skipping");
504 return std::make_tuple(
false, 999,
nullptr);
510 <<
"with pt = " <<
track->perigeeParameters()->pT()
511 <<
" has pT too low, skipping track!");
512 return std::make_tuple(
false, 999,
nullptr);
516 if (std::abs(
track->perigeeParameters()->eta()) >
m_etamax) {
518 << std::abs(
track->perigeeParameters()->eta())
519 <<
" has eta too high, skipping track!");
520 return std::make_tuple(
false, 999,
nullptr);
529 return std::make_tuple(
true, passTrackCut, std::move(
track));
534 const EventContext& ctx,
535 std::vector<const Trk::PrepRawData*>
clusters,
543 bool keepOnTrying =
true;
544 std::unique_ptr<Trk::Track>
track;
545 while (keepOnTrying) {
548 if (
track ==
nullptr ||
track->perigeeParameters() ==
nullptr) {
551 keepOnTrying =
false;
554 keepOnTrying =
false;
558 if (
track ==
nullptr ||
track->perigeeParameters() ==
nullptr) {
560 <<
" fails the first chi2 fit, skipping");
567 <<
" fails the first chi2 fit, skipping");
574 while (keepOnTrying) {
578 if (
track ==
nullptr ||
track->trackSummary() ==
nullptr ||
track->outliersOnTrack()->size()>=3) {
592 <<
" fails the second chi2 fit, skipping");
602 MsgStream& InDet::operator <<
611 std::ostream& InDet::operator <<
634 out<<
"| Location of output tracks | "
636 out<<
"|----------------------------------------------------------------"
637 <<
"----------------------------------------------------|"