22 for (
const ActsTrk::TrackContainer::ConstTrackProxy tp : tracksContainer)
24 std::deque<std::unique_ptr<FpgaActsTrack::Measurement>> t_TrackMeasurements;
25 const Acts::BoundVector& parameters = tp.parameters();
26 tracksContainer.trackStateContainer().visitBackwards(tp.tipIndex(), [&t_TrackMeasurements](
const typename ActsTrk::TrackStateBackend::ConstTrackStateProxy& state) ->
void
28 if (state.hasUncalibratedSourceLink()) {
29 const xAOD::UncalibratedMeasurement* measurement = ActsTrk::detail::xAODUncalibMeasCalibrator::unpack(state.getUncalibratedSourceLink());
30 if (measurement->type() == xAOD::UncalibMeasType::PixelClusterType) {
31 const xAOD::PixelCluster* pixelCluster = static_cast<const xAOD::PixelCluster*>(measurement);
32 t_TrackMeasurements.emplace_front(std::make_unique<FpgaActsTrack::Measurement>(FpgaActsTrack::Measurement{
33 pixelCluster->identifier(),
35 { pixelCluster->globalPosition().x(),
36 pixelCluster->globalPosition().y(),
37 pixelCluster->globalPosition().z() },
38 state.typeFlags().test(Acts::TrackStateFlag::HasMeasurement),
39 state.typeFlags().test(Acts::TrackStateFlag::IsOutlier),
40 state.typeFlags().test(Acts::TrackStateFlag::IsHole),
41 state.typeFlags().test(Acts::TrackStateFlag::HasMaterial),
42 state.typeFlags().test(Acts::TrackStateFlag::IsSharedHit) }));
44 else if (measurement->type() == xAOD::UncalibMeasType::StripClusterType) {
45 const xAOD::StripCluster* stripCluster = static_cast<const xAOD::StripCluster*>(measurement);
46 t_TrackMeasurements.emplace_front(std::make_unique<FpgaActsTrack::Measurement>(FpgaActsTrack::Measurement{
47 stripCluster->identifier(),
49 { stripCluster->globalPosition().x(),
50 stripCluster->globalPosition().y(),
51 stripCluster->globalPosition().z()},
52 state.typeFlags().test(Acts::TrackStateFlag::HasMeasurement),
53 state.typeFlags().test(Acts::TrackStateFlag::IsOutlier),
54 state.typeFlags().test(Acts::TrackStateFlag::IsHole),
55 state.typeFlags().test(Acts::TrackStateFlag::HasMaterial),
56 state.typeFlags().test(Acts::TrackStateFlag::IsSharedHit) }));
61 t_actsTracks.emplace_back(std::make_unique<FpgaActsTrack>(
FpgaActsTrack{ parameters, std::move(t_TrackMeasurements), tp.chi2(), tp.nDoF() }));
71 std::ostringstream printoutTable;
72 unsigned int t_trackCoutner = 0, t_measCounter = 0;
73 printoutTable <<
"\n|-------------------------------------------------------------------------------------------------------------------------------|\n";
74 for (
const auto& track : tracks)
77 printoutTable <<
"| # | QopT | Eta | Phi | d0 | z0 | chi2 | ndof |\n"
78 <<
"|-------------------------------------------------------------------------------------------------------------------------------|\n"
79 << std::format(
"| {:>5} | {:>16.10f} | {:>15.10f} | {:>15.10f} | {:>16.10f} | {:>16.10f} | {:>12.10f} | {:>8} |\n",
81 track->parameters[Acts::eBoundQOverP] / std::sin(track->parameters[Acts::eBoundTheta]),
82 -std::log(std::tan(track->parameters[Acts::eBoundTheta] / 2.0)),
83 track->parameters[Acts::eBoundPhi],
84 track->parameters[Acts::eBoundLoc0],
85 track->parameters[Acts::eBoundLoc1],
90 printoutTable <<
"| |_______________________________________________________________________________________________________________________|\n"
91 <<
"| | ## | type | x | y | z | outlier | meas | hole | Identifier |\n"
92 <<
"| |-----------------------------------------------------------------------------------------------------------------------|\n";
93 for (
const auto& measurement : track->trackMeasurements)
96 printoutTable << std::format(
"| | {:>4} | {} | {:>16.5f} | {:>16.5f} | {:>16.5f} | {:>7} | {:>5} | {:6>5} | {:>18} |\n",
98 measurement->type.c_str(),
99 measurement->coordinates.x,
100 measurement->coordinates.y,
101 measurement->coordinates.z,
102 measurement->outlierFlag,
103 measurement->measurementFlag,
104 measurement->holeFlag,
105 measurement->identifier);
107 printoutTable <<
"|-------------------------------------------------------------------------------------------------------------------------------|\n";
110 return printoutTable.str();
115 const std::map<std::string, std::map<Acts::TrackStateFlag, std::vector<uint32_t>> >& tracksForAllEvents)
const
117 std::ostringstream printoutTable;
118 printoutTable <<
"Printing out ACTS statistics";
119 printoutTable <<
"\n|---------------------------------------------------------------------------------------|"
120 <<
"\n| Collection Name | Outliers (avg) | Measurements (avg) | Holes (avg) |"
121 <<
"\n|---------------------------------------------------------------------------------------|";
122 for (
const auto& collection : tracksForAllEvents)
124 printoutTable << std::format(
"\n| {:>33} | {:>14.2f} | {:>18.2f} | {:>11.2f} |",
126 collection.second.at(Acts::TrackStateFlag::IsOutlier).size() ?
127 std::accumulate(collection.second.at(Acts::TrackStateFlag::IsOutlier).begin(),
128 collection.second.at(Acts::TrackStateFlag::IsOutlier).end(), 0.0)
129 / collection.second.at(Acts::TrackStateFlag::IsOutlier).size() : 0,
131 collection.second.at(Acts::TrackStateFlag::HasMeasurement).size() ? std::accumulate(collection.second.at(Acts::TrackStateFlag::HasMeasurement).begin(), collection.second.at(Acts::TrackStateFlag::HasMeasurement).end(), 0.0) / collection.second.at(Acts::TrackStateFlag::HasMeasurement).size() : 0,
133 collection.second.at(Acts::TrackStateFlag::IsHole).size() ? std::accumulate(collection.second.at(Acts::TrackStateFlag::IsHole).begin(), collection.second.at(Acts::TrackStateFlag::IsHole).end(), 0.0) / collection.second.at(Acts::TrackStateFlag::IsHole).size() : 0);
135 printoutTable <<
"\n|---------------------------------------------------------------------------------------|";
136 return printoutTable.str();