13 ATH_CHECK(m_xAODPixelClusterContainerKeys.initialize());
14 ATH_CHECK(m_xAODStripClusterContainerKeys.initialize());
15 ATH_CHECK(m_xAODSpacePointContainerKeys.initialize());
16 ATH_CHECK(m_FPGARoadsKey.initialize(!m_isDataPrep));
17 ATH_CHECK(m_FPGAProtoTrackCollection.initialize(!m_isDataPrep));
18 ATH_CHECK(m_FPGATracksKey.initialize(!m_isDataPrep));
20 return StatusCode::SUCCESS;
26 std::vector<SG::ReadHandle<xAOD::PixelClusterContainer>> xAODPixelClusterContainers = m_xAODPixelClusterContainerKeys.makeHandles(ctx);
29 if (!clusterContainer.isValid()) {
31 return StatusCode::FAILURE;
33 processxAODClusters<xAOD::PixelCluster>(clusterContainer);
36 std::vector<SG::ReadHandle<xAOD::StripClusterContainer>> xAODStripClusterContainers = m_xAODStripClusterContainerKeys.makeHandles(ctx);
39 if (!clusterContainer.isValid()) {
41 return StatusCode::FAILURE;
43 processxAODClusters<xAOD::StripCluster>(clusterContainer);
46 std::vector<SG::ReadHandle<xAOD::SpacePointContainer>> xAODSpacePointContainers = m_xAODSpacePointContainerKeys.makeHandles(ctx);
49 if (!spContainer.isValid()) {
52 else {processxAODSpacePoints(spContainer);}
54 if (!m_isDataPrep.value()) {
57 if (!FPGATrackSimRoads.
isValid()) {
58 ATH_MSG_ERROR(
"Could not find FPGA Roads Collection with key " << FPGATrackSimRoads.
key());
59 return StatusCode::FAILURE;
61 processFPGARoads(FPGATrackSimRoads);
65 if (!FPGATrackSimTracks.
isValid()) {
66 ATH_MSG_ERROR(
"Could not find FPGA Track Collection with key " << FPGATrackSimTracks.
key());
67 return StatusCode::FAILURE;
69 processFPGATracks(FPGATrackSimTracks);
73 if (!FPGATrackSimProtoTracks.
isValid()) {
74 ATH_MSG_ERROR(
"Could not find FPGA Prototrack Collection with key " << FPGATrackSimProtoTracks.
key());
75 return StatusCode::FAILURE;
77 processFPGAPrototracks(FPGATrackSimProtoTracks);
79 return StatusCode::SUCCESS;
86 if (!m_isDataPrep.value()) {
88 std::string summaryTableFPGATracks =
"\n"
89 "Number of measurements for FPGA Tracks\n"
90 "|-----------------------------------|\n"
91 "| | min | max | Avg |\n"
92 "|-----------------------------------|\n";
94 if (not m_pixelClustersPerFPGATrack.empty()) {
95 summaryTableFPGATracks +=
std::format(
"| Pixels | {:>4} | {:>4} | {:>10.2f} |\n",
96 *std::min_element(m_pixelClustersPerFPGATrack.begin(), m_pixelClustersPerFPGATrack.end()),
97 *std::max_element(m_pixelClustersPerFPGATrack.begin(), m_pixelClustersPerFPGATrack.end()),
98 std::accumulate(m_pixelClustersPerFPGATrack.begin(), m_pixelClustersPerFPGATrack.end(), 0.0) / m_pixelClustersPerFPGATrack.size());
100 else summaryTableFPGATracks +=
std::format(
"| Pixels | ---- | ---- | inf |\n");
102 if (not m_stripClustersPerFPGATrack.empty()) {
103 summaryTableFPGATracks +=
std::format(
"| Strips | {:>4} | {:>4} | {:>10.2f} |\n",
104 *std::min_element(m_stripClustersPerFPGATrack.begin(), m_stripClustersPerFPGATrack.end()),
105 *std::max_element(m_stripClustersPerFPGATrack.begin(), m_stripClustersPerFPGATrack.end()),
106 std::accumulate(m_stripClustersPerFPGATrack.begin(), m_stripClustersPerFPGATrack.end(), 0.0) / m_stripClustersPerFPGATrack.size());
108 else summaryTableFPGATracks +=
std::format(
"| Strips | ---- | ---- | inf |\n");
110 summaryTableFPGATracks +=
"|-----------------------------------|";
115 std::string summaryTableFPGAPrototracks =
std::format(
"\n"
116 "Number of measurements for FPGA Prototracks\n"
117 "|-----------------------------------|\n"
118 "| | min | max | Avg |\n"
119 "|-----------------------------------|\n");
121 if (not m_pixelClustersPerPrototrack.empty()) {
122 summaryTableFPGAPrototracks +=
std::format(
"| Pixels | {:>4} | {:>4} | {:>10.2f} |\n",
123 *std::min_element(m_pixelClustersPerPrototrack.begin(), m_pixelClustersPerPrototrack.end()),
124 *std::max_element(m_pixelClustersPerPrototrack.begin(), m_pixelClustersPerPrototrack.end()),
125 std::accumulate(m_pixelClustersPerPrototrack.begin(), m_pixelClustersPerPrototrack.end(), 0.0) / m_pixelClustersPerPrototrack.size());
127 else summaryTableFPGAPrototracks +=
std::format(
"| Pixels | ---- | ---- | inf |\n");
129 if (not m_stripClustersPerPrototrack.empty()) {
130 summaryTableFPGAPrototracks +=
std::format(
"| Strips | {:>4} | {:>4} | {:>10.2f} |\n",
131 *std::min_element(m_stripClustersPerPrototrack.begin(), m_stripClustersPerPrototrack.end()),
132 *std::max_element(m_stripClustersPerPrototrack.begin(), m_stripClustersPerPrototrack.end()),
133 std::accumulate(m_stripClustersPerPrototrack.begin(), m_stripClustersPerPrototrack.end(), 0.0) / m_stripClustersPerPrototrack.size());
135 else summaryTableFPGAPrototracks +=
std::format(
"| Strips | ---- | ---- | inf |\n");
137 summaryTableFPGAPrototracks +=
"|-----------------------------------|";
141 return StatusCode::SUCCESS;
144 template <
class XAOD_CLUSTER>
147 if (m_printoutForEveryEvent) printxAODClusters(clusterContainer);
150 template <
class XAOD_CLUSTER>
153 std::string mainTable =
"\n"
154 "|=========================================================================================|\n"
155 "| # | Global coordinates | Hash ID | Identifier |\n"
156 "| | x | y | z | | |\n"
157 "|-----------------------------------------------------------------------------------------|\n";
159 for (
const auto& cluster : *clusterContainer)
162 mainTable +=
std::format(
"| {:>6} | {:>12} | {:>12} | {:>12} | {:>12} | {:>18} |\n",
164 cluster->globalPosition().x(),
165 cluster->globalPosition().y(),
166 cluster->globalPosition().z(),
167 cluster->identifierHash(),
168 cluster->identifier());
170 mainTable +=
"|=========================================================================================|";
171 ATH_MSG_INFO(
"Printout of xAOD clusters coming from " << clusterContainer.key() << mainTable );
177 if (m_printoutForEveryEvent) printxAODSpacePoints(spContainer);
182 std::string mainTable =
"\n"
183 "|============================================================================|\n"
184 "| # | Global coordinates | element ID list |\n"
185 "| | x | y | z | |\n"
186 "|----------------------------------------------------------------------------|\n";
188 for (
const auto& sp : *spContainer)
191 mainTable +=
std::format(
"| {:>6} | {:>12} | {:>12} | {:>12} | {:>9}, {:>9} |\n",
193 sp->globalPosition().x(),
194 sp->globalPosition().y(),
195 sp->globalPosition().z(),
196 sp->elementIdList()[0],
197 sp->elementIdList().size() == 2 ? sp->elementIdList()[1] : 0);
199 mainTable +=
"|=========================================================================================|";
200 ATH_MSG_INFO(
"Printout of xAOD space points coming from " << spContainer.key() << mainTable );
206 if (m_printoutForEveryEvent) printFPGARoads(FPGARoads);
211 std::string mainTable =
"\n"
212 "|--------------------------------------------------------------------------------------------------|\n"
213 "| # | SubRegion | xBin | yBin | X | Y | RoadID |\n"
214 "|--------------------------------------------------------------------------------------------------|\n";
216 unsigned int roadCounter = 0, hitCounter = 0;
220 mainTable +=
std::format(
"| {:>6} | {:>11} | {:>10} | {:>10} | {:>12} | {:>12} | {:>12} |\n",
229 "| __________________________________________________________________________________________|\n"
230 "| | layer | ## | type | Global coordinates | isReal |\n"
231 "| | | | | x | y | z | |\n"
232 "| |.........................................................................................|\n";
233 for (
unsigned int i = 0;
i < road.getNLayers(); ++
i)
236 const std::vector <std::shared_ptr<const FPGATrackSimHit>>&
hits = road.getHits(
i);
237 for (
auto const& hit :
hits)
240 mainTable +=
std::format(
"| | {:>9} | {:>6} | {:>8} | {:>13} | {:>13} | {:>13} | {:>7} |\n",
241 (hit->isMapped() ? hit->getLayer() : 9999),
243 (hit->isPixel() ?
"Pixel" : hit->isStrip() ?
"Strip" :
"FAILED"),
250 mainTable +=
"|--------------------------------------------------------------------------------------------------|\n";
252 ATH_MSG_INFO(
"List of FPGA roads for " << FPGARoads.key() << mainTable);
258 for (
auto const&
track : *FPGATracks)
260 const std::vector <FPGATrackSimHit>&
hits =
track.getFPGATrackSimHits();
261 uint32_t pixelHits = 0, stripHits = 0;
264 if (hit.isPixel()) ++pixelHits;
265 if (hit.isStrip()) ++stripHits;
267 m_pixelClustersPerFPGATrack.push_back(pixelHits);
268 m_stripClustersPerFPGATrack.push_back(stripHits);
270 if (m_printoutForEveryEvent) printFPGATracks(FPGATracks);
276 std::string maintable =
"\n|--------------------------------------------------------------------------------------------------|\n";
277 unsigned int trackCounter = 0;
278 for (
auto const&
track : *FPGATracks)
281 maintable +=
"| # | Eta | Phi | D0 | Z0 | QOverPt | chi2/ndf |\n"
282 "|--------------------------------------------------------------------------------------------------|\n";
284 maintable +=
std::format(
"| {:>6} | {:>12.8f} | {:>12.8f} | {:>12.8f} | {:>12.5f} | {:>12.9f} | {:>12.8f} |\n",
291 track.getChi2ndof());
293 maintable +=
"|__________________________________________________________________________________________________|\n"
294 "| | ## | type | layer | Global coordinates | isReal | HashID |\n"
295 "| | | | | x | y | z | | |\n"
296 "| |.........................................................................................|\n";
297 const std::vector <FPGATrackSimHit>&
hits =
track.getFPGATrackSimHits();
298 unsigned int hitCounter = 0;
299 for (
auto const& hit :
hits)
302 maintable +=
std::format(
"| | {:>6} | {:>8} | {:>5} | {:>9.3f} | {:>9.3f} | {:>9.3f} | {:>6} | {:>14} |\n",
304 (hit.isPixel() ?
"Pixel" : hit.isStrip() ?
"Strip" :
"FAILED"),
310 hit.getIdentifierHash());
312 maintable +=
"|--------------------------------------------------------------------------------------------------|\n";
314 ATH_MSG_INFO(
"List of FPGA tracks for " << FPGATracks.key() << maintable);
319 unsigned int nPixelMeasurements, nStripMeasurements;
320 for (
auto const& prototrack : *FPGAPrototracks)
322 nPixelMeasurements = 0, nStripMeasurements = 0;
323 const std::vector<ActsTrk::ATLASUncalibSourceLink>* measurements = &prototrack.measurements;
330 m_pixelClustersPerPrototrack.push_back(nPixelMeasurements);
331 m_stripClustersPerPrototrack.push_back(nStripMeasurements);
334 if (m_printoutForEveryEvent) printFPGAPrototracks(FPGAPrototracks);
339 std::string mainTable =
"\n";
340 if(not (*FPGAPrototracks).empty()) mainTable +=
"|---------------------------------------------------------------------------------------------|\n";
342 unsigned int prototrackCounter = 0;
343 for (
auto const& prototrack : *FPGAPrototracks)
346 const Acts::BoundTrackParameters& initialParameters = *prototrack.parameters;
347 const Acts::BoundVector&
parameters = initialParameters.parameters();
349 "| # | QopT | Theta | Phi | d0 | z0 |\n"
350 "|---------------------------------------------------------------------------------------------|\n";
351 mainTable +=
std::format(
"| {:>6} | {:>14.10f} | {:>14.10f} | {:>14.10f} | {:>14.10f} | {:>14.10f} |\n",
359 const std::vector<ActsTrk::ATLASUncalibSourceLink>* measurements = &prototrack.measurements;
360 unsigned int measurementCounter = 0;
361 if (measurements->size())
364 "| _____________________________________________________________________________________|\n"
365 "| | | type | Global coordinates | HashID | Identifier |\n"
366 "| | ## | | x | y | z | | |\n"
367 "| | |...........................................................................|\n";
372 ++measurementCounter;
376 mainTable +=
std::format(
"| | {:>6} | Pixel | {:>8.3f} | {:>8.3f} | {:>8.3f} | {:>7} | {:>19} |\n",
386 mainTable +=
std::format(
"| | {:>6} | Strip | {:>8.3f} | {:>8.3f} | {:>8.3f} | {:>7} | {:>19} |\n",
395 mainTable +=
"|---------------------------------------------------------------------------------------------|\n";
397 ATH_MSG_INFO(
"Printing out prototracks coming from " << FPGAPrototracks.key() << mainTable);