10 #include "Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.hpp"
11 #include "Acts/Definitions/Units.hpp"
12 #include "Acts/EventData/VectorMultiTrajectory.hpp"
13 #include "Acts/EventData/VectorTrackContainer.hpp"
14 #include "Acts/Utilities/HashedString.hpp"
15 #include "Acts/Utilities/Logger.hpp"
25 #include "GaudiKernel/ServiceHandle.h"
26 #include "GaudiKernel/ToolHandle.h"
29 namespace ScoreBasedSolverCutsImpl {
35 updatedTracks.ensureDynamicColumns(trackContainer);
37 updatedTracks.addColumn<
unsigned int>(
"nInnermostPixelLayerHits");
38 updatedTracks.addColumn<
unsigned int>(
"nSCTDoubleHoles");
39 updatedTracks.addColumn<
unsigned int>(
"nContribPixelLayers");
41 for (
auto track : trackContainer) {
42 auto iTrack =
track.index();
43 auto destProxy = updatedTracks.getTrack(updatedTracks.addTrack());
44 destProxy.copyFrom(trackContainer.getTrack(iTrack));
47 unsigned int pixelVoulmeIds[] = {8, 9, 10, 13, 14, 15, 16, 17, 18, 19, 20};
49 for (
auto track : updatedTracks) {
50 bool doubleFlag =
false;
52 int nInnermostPixelLayerHits = 0;
53 int nContribPixelLayers = 0;
54 for (
const auto &
ts :
track.trackStatesReversed()) {
55 if (!
ts.hasReferenceSurface()) {
60 auto iVolume =
ts.referenceSurface().geometryId().volume();
62 nInnermostPixelLayerHits++;
65 iVolume) !=
std::end(pixelVoulmeIds)) {
66 nContribPixelLayers++;
71 auto iTypeFlags =
ts.typeFlags();
72 if (!iTypeFlags.test(Acts::TrackStateFlag::HoleFlag)) {
75 if (iTypeFlags.test(Acts::TrackStateFlag::HoleFlag)) {
84 track.template component<unsigned int>(Acts::hashString(
85 "nInnermostPixelLayerHits")) = nInnermostPixelLayerHits;
86 track.template component<unsigned int>(
87 Acts::hashString(
"nSCTDoubleHoles")) = nDoubleHoles;
88 track.template component<unsigned int>(
89 Acts::hashString(
"nContribPixelLayers")) = nContribPixelLayers;
98 int n_doubleHoles = 0;
99 int max_doubleHoles = 2;
100 Acts::HashedString hash_nMeasSubDet =
101 Acts::hashString(
"nSCTDoubleHoles");
102 if (
track.container().hasColumn(hash_nMeasSubDet)) {
103 n_doubleHoles =
track.component<
unsigned int>(hash_nMeasSubDet);
107 if (n_doubleHoles > max_doubleHoles) {
116 const int maxB_LayerHitsITk = 8;
117 auto maxB_LayerHits = maxB_LayerHitsITk;
118 const double blayModi[maxB_LayerHitsITk + 1] = {0.25, 4.0, 4.5, 5.0, 5.5,
121 std::vector<double> factorB_LayerHits;
123 for (
int i = 0;
i <= maxB_LayerHits; ++
i)
124 factorB_LayerHits.push_back(blayModi[
i]);
125 Acts::HashedString hash_nMeasSubDet =
126 Acts::hashString(
"nInnermostPixelLayerHits");
127 if (
track.container().hasColumn(hash_nMeasSubDet)) {
128 bLayerHits =
track.component<
unsigned int>(hash_nMeasSubDet);
133 if (bLayerHits > -1 && maxB_LayerHits > 0) {
134 if (bLayerHits > maxB_LayerHits) {
135 score *= (bLayerHits - maxB_LayerHits + 1);
136 bLayerHits = maxB_LayerHits;
138 score *= factorB_LayerHits[bLayerHits];
145 const int maxPixelLayITk = 16;
146 auto maxPixLay = maxPixelLayITk;
147 double maxScore = 30.0;
148 double minScore = 5.00;
153 double step[2] = {(maxScore - minScore) / (maxBarrel - minBarrel),
154 (maxScore - minScore) / (maxPixelLayITk - minEnd)};
156 std::vector<double> factorPixLay;
157 for (
int i = 0;
i <= maxPixelLayITk;
i++) {
159 factorPixLay.push_back(0.01 + (
i * 0.33));
161 factorPixLay.push_back(minScore + ((
i - minEnd) *
step[1]));
165 Acts::HashedString hash_nMeasSubDet =
166 Acts::hashString(
"nContribPixelLayers");
167 if (
track.container().hasColumn(hash_nMeasSubDet)) {
168 iPixLay =
track.component<
unsigned int>(hash_nMeasSubDet);
173 if (iPixLay > -1 && maxPixLay > 0) {
174 if (iPixLay > maxPixLay) {
175 score *= (iPixLay - maxPixLay + 1);
178 score *= factorPixLay[iPixLay];
186 auto parm =
track.parameters();
188 double maxEta = etaDependentCutsSvc->getMaxEta();
193 double maxZ0 = etaDependentCutsSvc->getMaxZImpactAtEta(
trackEta);
194 if (std::abs(parm[Acts::BoundIndices::eBoundLoc1]) > maxZ0) {
198 double maxD0 = etaDependentCutsSvc->getMaxPrimaryImpactAtEta(
trackEta);
200 if (std::abs(parm[Acts::BoundIndices::eBoundLoc0]) > maxD0) {
211 Acts::ScoreBasedAmbiguityResolution::TrackStateTypes &trackStateType) {
212 bool ispatternTrack =
false;
213 Acts::HashedString hash_nMeasSubDet = Acts::hashString(
"ispatternTrack");
214 if (
track.container().hasColumn(hash_nMeasSubDet)) {
215 ispatternTrack =
track.component<
unsigned int>(hash_nMeasSubDet);
217 if (
ts.typeFlags().test(Acts::TrackStateFlag::OutlierFlag) &&
220 Acts::ScoreBasedAmbiguityResolution::TrackStateTypes::RejectedHit;
221 }
else if (
ts.typeFlags().test(Acts::TrackStateFlag::OutlierFlag) &&
225 Acts::ScoreBasedAmbiguityResolution::TrackStateTypes::Outlier;