68 Acts::VectorTrackContainer updatedTrackBackend;
69 Acts::VectorMultiTrajectory updatedTrackStateBackend;
70 Acts::TrackContainer<Acts::VectorTrackContainer,
71 Acts::VectorMultiTrajectory,
72 Acts::detail::ValueHolder> updatedTracksContainer( std::move(updatedTrackBackend),
73 std::move(updatedTrackStateBackend) );
76 updatedTracksContainer.ensureDynamicColumns(trackContainer);
78 updatedTracksContainer.addColumn<
unsigned int>(
"nInnermostPixelLayerHits");
79 updatedTracksContainer.addColumn<
unsigned int>(
"nSCTDoubleHoles");
80 updatedTracksContainer.addColumn<
unsigned int>(
"nContribPixelLayers");
82 for (
auto track : trackContainer) {
83 auto iTrack = track.index();
84 auto destProxy = updatedTracksContainer.getTrack(updatedTracksContainer.addTrack());
85 destProxy.copyFrom(trackContainer.getTrack(iTrack));
88 std::vector<unsigned int> pixelBarrelLayerIDs = {9, 16};
90 unsigned int innermostPixelVolumeID = 9;
91 unsigned int innermostPixelLayerID = 2;
93 for (
auto track : updatedTracksContainer) {
94 bool doubleFlag =
false;
96 int nInnermostPixelLayerHits = 0;
97 int nContribPixelLayers = 0;
99 std::vector<unsigned int> contribPixelLayers = {};
101 for (
const auto ts : track.trackStatesReversed()) {
102 if (!
ts.hasReferenceSurface()) {
106 if (
ts.typeFlags().test(Acts::TrackStateFlag::MeasurementFlag)) {
110 auto iVolume =
ts.referenceSurface().geometryId().volume();
111 auto iLayer =
ts.referenceSurface().geometryId().layer();
113 if (iVolume == innermostPixelVolumeID) {
114 if (iLayer == innermostPixelLayerID) {
115 nInnermostPixelLayerHits++;
119 unsigned int remappedLayer =
remapLayer(iVolume, iLayer);
120 if (remappedLayer != 0) {
121 contribPixelLayers.push_back(remappedLayer);
125 std::set<unsigned int> uniqueSet(contribPixelLayers.begin(),
126 contribPixelLayers.end());
127 nContribPixelLayers = uniqueSet.size();
130 auto iTypeFlags =
ts.typeFlags();
131 if (!iTypeFlags.test(Acts::TrackStateFlag::HoleFlag)) {
134 if (iTypeFlags.test(Acts::TrackStateFlag::HoleFlag)) {
144 track.template component<unsigned int>(Acts::hashString(
145 "nInnermostPixelLayerHits")) = nInnermostPixelLayerHits;
146 track.template component<unsigned int>(
147 Acts::hashString(
"nSCTDoubleHoles")) = nDoubleHoles;
148 track.template component<unsigned int>(
149 Acts::hashString(
"nContribPixelLayers")) = nContribPixelLayers;
152 return updatedTracksContainer;
159 std::vector<double> factorDblHoles;
161 const int maxDblHoles = 3;
162 const double goodDblHoles[maxDblHoles + 1] = {1., 0.03, 0.007, 0.0003};
163 const double fakeDblHoles[maxDblHoles + 1] = {1., 0.09, 0.09, 0.008};
165 for (
int i = 0; i <= maxDblHoles; ++i) {
166 factorDblHoles.push_back(goodDblHoles[i] / fakeDblHoles[i]);
169 Acts::HashedString hash_nMeasSubDet = Acts::hashString(
"nSCTDoubleHoles");
170 if (track.container().hasColumn(hash_nMeasSubDet)) {
171 iDblHoles = track.component<
unsigned int>(hash_nMeasSubDet);
173 if (iDblHoles > -1 && maxDblHoles > 0) {
174 if (iDblHoles > maxDblHoles) {
175 score /= (iDblHoles - maxDblHoles + 1);
176 iDblHoles = maxDblHoles;
178 score *= factorDblHoles[iDblHoles];
187 const int maxB_LayerHitsITk = 8;
188 auto maxB_LayerHits = maxB_LayerHitsITk;
189 const double blayModi[maxB_LayerHitsITk + 1] = {0.25, 4.0, 4.5, 5.0, 5.5,
192 std::vector<double> factorB_LayerHits;
194 for (
int i = 0; i <= maxB_LayerHits; ++i)
195 factorB_LayerHits.push_back(blayModi[i]);
196 Acts::HashedString hash_nMeasSubDet =
197 Acts::hashString(
"nInnermostPixelLayerHits");
198 if (track.container().hasColumn(hash_nMeasSubDet)) {
199 bLayerHits = track.component<
unsigned int>(hash_nMeasSubDet);
204 if (bLayerHits > -1 && maxB_LayerHits > 0) {
205 if (bLayerHits > maxB_LayerHits) {
206 score *= (bLayerHits - maxB_LayerHits + 1);
207 bLayerHits = maxB_LayerHits;
209 score *= factorB_LayerHits[bLayerHits];
217 const int maxPixLay = 16;
218 double maxScore = 30.0;
219 double minScore = 5.00;
224 std::vector<double> factorPixLay;
226 double step[2] = {(maxScore - minScore) / (maxBarrel - minBarrel),
227 (maxScore - minScore) / (maxPixLay - minEnd)};
229 for (
int i = 0; i <= maxPixLay; i++) {
231 factorPixLay.push_back(0.01 + (i * 0.33));
233 factorPixLay.push_back(minScore + ((i - minEnd) * step[1]));
238 Acts::HashedString hash_nMeasSubDet = Acts::hashString(
"nContribPixelLayers");
239 if (track.container().hasColumn(hash_nMeasSubDet)) {
240 iPixLay = track.component<
unsigned int>(hash_nMeasSubDet);
245 if (iPixLay > -1 && maxPixLay > 0) {
246 if (iPixLay > maxPixLay) {
247 score *= (iPixLay - maxPixLay + 1);
250 score *= factorPixLay[iPixLay];
258 const int maxHits = 26;
259 double maxScore = 40.0;
260 double minScore = 5.00;
265 int iHits = track.nMeasurements();
267 std::vector<double> factorHits;
269 double step[2] = {(maxScore - minScore) / (maxBarrel - minBarrel),
270 (maxScore - minScore) / (maxHits - minEnd)};
272 for (
int i = 0; i <= maxHits; i++) {
274 factorHits.push_back(0.01 + (i * 1.0 / minEnd));
276 factorHits.push_back(minScore + ((i - minEnd) * step[1]));
278 if (iHits > -1 && maxHits > 0) {
279 if (iHits > maxHits) {
280 score *= (iHits - maxHits + 1);
283 score *= factorHits[iHits];
289 auto eta = Acts::VectorHelpers::eta(track.momentum());
290 auto parm = track.parameters();
292 std::vector<double> etaBins = {-4.0, -2.6, -2.0, 0.0, 2.0, 2.6, 4.0};
293 std::vector<double> maxD0 = {10.0, 2.0, 2.0, 2.0, 2.0, 10.0};
294 std::vector<double> maxZ0 = {200, 200, 200, 200, 200, 200};
295 std::vector<unsigned int> maxDoubleHoles = {2, 2, 2, 2, 2, 2};
296 std::vector<unsigned int> minSiClusters = {9, 8, 4, 4, 8, 9};
300 auto it = std::upper_bound(etaBins.begin(), etaBins.end(),
eta);
301 if (it == etaBins.begin() || it == etaBins.end()) {
304 std::size_t etaBin = std::distance(etaBins.begin(), it) - 1;
306 if (std::abs(
eta) > maxEta) {
310 if (std::abs(parm[Acts::BoundIndices::eBoundLoc1]) > maxZ0[etaBin]) {
314 if (std::abs(parm[Acts::BoundIndices::eBoundLoc0]) > maxD0[etaBin]) {
318 unsigned int numSiClusters = track.nMeasurements();
320 if (numSiClusters < minSiClusters[etaBin]) {
324 unsigned int numSCTDoubleHoles = 0;
325 Acts::HashedString hash_nMeasSubDet = Acts::hashString(
"nSCTDoubleHoles");
326 if (track.container().hasColumn(hash_nMeasSubDet)) {
327 numSCTDoubleHoles = track.component<
unsigned int>(hash_nMeasSubDet);
330 if (numSCTDoubleHoles > maxDoubleHoles[etaBin]) {