44 :
WriterT(config.inputClusters,
"RootPlanarClusterWriter", level),
48 throw std::invalid_argument(
"Missing simulated hits input collection");
54 throw std::invalid_argument(
"Missing tree name");
57 throw std::invalid_argument(
"Missing tracking geometry");
62 throw std::ios_base::failure(
"Could not open '" +
m_cfg.
filePath);
67 throw std::bad_alloc();
98 if (m_outputFile !=
nullptr) {
99 m_outputFile->Close();
106 m_outputTree->Write();
107 m_outputFile->Close();
109 ACTS_INFO(
"Wrote clusters to tree '" <<
m_cfg.treeName <<
"' in '"
110 <<
m_cfg.filePath <<
"'");
120 const auto& simHits = m_inputSimHits(ctx);
123 std::lock_guard<std::mutex> lock(m_writeMutex);
128 for (
auto [moduleGeoId, moduleClusters] :
groupByModule(clusters)) {
130 m_cfg.trackingGeometry->findSurface(moduleGeoId);
131 if (surfacePtr ==
nullptr) {
132 ACTS_ERROR(
"Could not find surface for " << moduleGeoId);
133 return ProcessCode::ABORT;
138 m_volumeID = moduleGeoId.volume();
139 m_layerID = moduleGeoId.layer();
140 m_surfaceID = moduleGeoId.sensitive();
142 for (
const auto&
entry : moduleClusters) {
163 auto detectorElement =
166 for (
auto& cell : cells) {
168 m_cell_IDx.push_back(cell.channel0);
169 m_cell_IDy.push_back(cell.channel1);
170 m_cell_data.push_back(cell.data);
172 if ((detectorElement !=
nullptr) &&
173 detectorElement->digitizationModule()) {
176 digitationModule->segmentation();
178 auto cellLocalPosition = segmentation.
cellPosition(cell);
179 m_cell_lx.push_back(cellLocalPosition.x());
180 m_cell_ly.push_back(cellLocalPosition.y());
186 for (
auto idx : sl.indices()) {
187 auto it = simHits.nth(
idx);
188 if (
it == simHits.end()) {
189 ACTS_FATAL(
"Simulation hit with index " <<
idx <<
" does not exist");
190 return ProcessCode::ABORT;
192 const auto& simHit = *
it;
198 if (not lpResult.ok()) {
199 ACTS_FATAL(
"Global to local transformation did not succeed.");
200 return ProcessCode::ABORT;
202 lPosition = lpResult.value();
204 m_t_gx.push_back(simHit.position().x());
205 m_t_gy.push_back(simHit.position().y());
206 m_t_gz.push_back(simHit.position().z());
207 m_t_gt.push_back(simHit.time());
208 m_t_lx.push_back(lPosition.x());
209 m_t_ly.push_back(lPosition.y());
210 m_t_barcode.push_back(simHit.particleId().value());
213 m_outputTree->Fill();