9 const std::string&
name,
const IInterface* ifc)
14 return StatusCode::SUCCESS;
20 for (
const ActsTrk::TrackContainer::ConstTrackProxy
tp : tracksContainer)
22 std::deque<std::unique_ptr<FpgaActsTrack::Measurement>> t_TrackMeasurements;
24 tracksContainer.trackStateContainer().visitBackwards(
tp.tipIndex(), [&t_TrackMeasurements](
const typename ActsTrk::TrackStateBackend::ConstTrackStateProxy& state) ->
void
26 if (state.hasUncalibratedSourceLink()) {
28 std::reference_wrapper<const xAOD::UncalibratedMeasurement> measurementRef =
29 std::cref(ActsTrk::getUncalibratedMeasurement(state.getUncalibratedSourceLink().get<ActsTrk::ATLASUncalibSourceLink>()));
30 const xAOD::UncalibratedMeasurement& measurement = measurementRef.get();
31 assert(static_cast<unsigned int>(measurement.type() < xAOD::UncalibMeasType::nTypes));
33 if (measurement.type() == xAOD::UncalibMeasType::PixelClusterType) {
34 const xAOD::PixelCluster* pixelCluster = static_cast<const xAOD::PixelCluster*>(&measurement);
35 t_TrackMeasurements.emplace_front(std::make_unique<FpgaActsTrack::Measurement>(FpgaActsTrack::Measurement{
36 pixelCluster->identifier(),
38 { pixelCluster->globalPosition().x(),
39 pixelCluster->globalPosition().y(),
40 pixelCluster->globalPosition().z() },
41 state.typeFlags().test(Acts::TrackStateFlag::MeasurementFlag),
42 state.typeFlags().test(Acts::TrackStateFlag::OutlierFlag),
43 state.typeFlags().test(Acts::TrackStateFlag::HoleFlag),
44 state.typeFlags().test(Acts::TrackStateFlag::MaterialFlag),
45 state.typeFlags().test(Acts::TrackStateFlag::SharedHitFlag) }));
47 else if (measurement.type() == xAOD::UncalibMeasType::StripClusterType) {
48 const xAOD::StripCluster* stripCluster = static_cast<const xAOD::StripCluster*>(&measurement);
49 t_TrackMeasurements.emplace_front(std::make_unique<FpgaActsTrack::Measurement>(FpgaActsTrack::Measurement{
50 stripCluster->identifier(),
52 { stripCluster->globalPosition().x(),
53 stripCluster->globalPosition().y(),
54 stripCluster->globalPosition().z()},
55 state.typeFlags().test(Acts::TrackStateFlag::MeasurementFlag),
56 state.typeFlags().test(Acts::TrackStateFlag::OutlierFlag),
57 state.typeFlags().test(Acts::TrackStateFlag::HoleFlag),
58 state.typeFlags().test(Acts::TrackStateFlag::MaterialFlag),
59 state.typeFlags().test(Acts::TrackStateFlag::SharedHitFlag) }));
63 catch (const std::bad_any_cast&) {
67 t_actsTracks.emplace_back(std::make_unique<FpgaActsTrack>(
FpgaActsTrack{
parameters, std::move(t_TrackMeasurements) }));
77 std::ostringstream printoutTable;
78 unsigned int t_trackCoutner = 0, t_measCounter = 0;
79 printoutTable <<
"\n|----------------------------------------------------------------------------------------------------|\n";
80 for (
const auto&
track : tracks)
83 printoutTable <<
"| # | QopT | Theta | Phi | d0 | z0 |\n"
84 <<
"|----------------------------------------------------------------------------------------------------|\n"
85 <<
std::format(
"| {:>5} | {:>16.10f} | {:>15.10f} | {:>15.10f} | {:>16.10f} | {:>16.10f} |\n",
87 track->parameters[Acts::eBoundQOverP] / 1000.,
88 track->parameters[Acts::eBoundTheta],
89 track->parameters[Acts::eBoundPhi],
90 track->parameters[Acts::eBoundLoc0],
91 track->parameters[Acts::eBoundLoc1]);
93 printoutTable <<
"| |____________________________________________________________________________________________|\n"
94 <<
"| | ## | type | x | y | z | outlier | meas | hole | Identifier |\n"
95 <<
"| |--------------------------------------------------------------------------------------------|\n";
96 for (
const auto& measurement :
track->trackMeasurements)
99 printoutTable <<
std::format(
"| | {:>2} | {} | {:>8.3f} | {:>8.3f} | {:>8.3f} | {:>7} | {:>5} | {:6>5} | {:>18} |\n",
101 measurement->type.c_str(),
102 measurement->coordinates.x,
103 measurement->coordinates.y,
104 measurement->coordinates.z,
105 measurement->outlierFlag,
106 measurement->measurementFlag,
107 measurement->holeFlag,
108 measurement->identifier);
110 printoutTable <<
"|----------------------------------------------------------------------------------------------------|\n";
113 return printoutTable.str();
118 const std::map<std::string, std::map<
uint32_t, std::vector<uint32_t>> >& tracksForAllEvents)
const
120 std::ostringstream printoutTable;
121 printoutTable <<
"Printing out ACTS statistics";
122 printoutTable <<
"\n|---------------------------------------------------------------------------------------|"
123 <<
"\n| Collection Name | Outliers (avg) | Measurements (avg) | Holes (avg) |"
124 <<
"\n|---------------------------------------------------------------------------------------|";
125 for (
const auto& collection : tracksForAllEvents)
127 printoutTable <<
std::format(
"\n| {:>33} | {:>14.2f} | {:>18.2f} | {:>11.2f} |",
129 collection.second.at(Acts::TrackStateFlag::OutlierFlag).size() ?
130 std::accumulate(collection.second.at(Acts::TrackStateFlag::OutlierFlag).begin(),
131 collection.second.at(Acts::TrackStateFlag::OutlierFlag).end(), 0.0)
132 / collection.second.at(Acts::TrackStateFlag::OutlierFlag).size() : 0,
134 collection.second.at(Acts::TrackStateFlag::MeasurementFlag).size() ?
std::accumulate(collection.second.at(Acts::TrackStateFlag::MeasurementFlag).begin(), collection.second.at(Acts::TrackStateFlag::MeasurementFlag).end(), 0.0) / collection.second.at(Acts::TrackStateFlag::MeasurementFlag).size() : 0,
136 collection.second.at(Acts::TrackStateFlag::HoleFlag).size() ?
std::accumulate(collection.second.at(Acts::TrackStateFlag::HoleFlag).begin(), collection.second.at(Acts::TrackStateFlag::HoleFlag).end(), 0.0) / collection.second.at(Acts::TrackStateFlag::HoleFlag).size() : 0);
138 printoutTable <<
"\n|---------------------------------------------------------------------------------------|";
139 return printoutTable.str();