29 :
WriterT(cfg.inputClusters,
"RootPlanarClusterWriter", lvl),
31 m_outputFile(cfg.rootFile) {
34 throw std::invalid_argument(
"Missing simulated hits input collection");
37 throw std::invalid_argument(
"Missing tree name");
43 throw std::ios_base::failure(
"Could not open '" +
m_cfg.
filePath);
48 new TTree(
m_cfg.
treeName.c_str(),
"TTree from RootPlanarClusterWriter");
50 throw std::bad_alloc();
81 if (m_cfg.rootFile ==
nullptr) {
82 m_outputFile->Close();
89 m_outputTree->Write();
90 ACTS_INFO(
"Wrote particles to tree '" << m_cfg.treeName <<
"' in '"
91 << m_cfg.filePath <<
"'");
103 std::lock_guard<std::mutex> lock(m_writeMutex);
108 for (
const auto& entry : clusters) {
124 m_volumeID = geoId.
volume();
125 m_layerID = geoId.
layer();
138 clusterSurface.associatedDetectorElement());
139 for (
auto& cell : cells) {
141 m_cell_IDx.push_back(cell.channel0);
142 m_cell_IDy.push_back(cell.channel1);
143 m_cell_data.push_back(cell.data);
145 if (detectorElement && detectorElement->digitizationModule()) {
148 digitationModule->segmentation();
150 auto cellLocalPosition = segmentation.
cellPosition(cell);
151 m_cell_lx.push_back(cellLocalPosition.x());
152 m_cell_ly.push_back(cellLocalPosition.y());
158 auto it = simHits.nth(
idx);
159 if (
it == simHits.end()) {
160 ACTS_FATAL(
"Simulation hit with index " <<
idx <<
" does not exist");
161 return ProcessCode::ABORT;
163 const auto& simHit = *
it;
167 clusterSurface.globalToLocal(ctx.
geoContext, simHit.position(),
168 simHit.unitDirection(), lPosition);
170 m_t_gx.push_back(simHit.position().x());
171 m_t_gy.push_back(simHit.position().y());
172 m_t_gz.push_back(simHit.position().z());
173 m_t_gt.push_back(simHit.time());
174 m_t_lx.push_back(lPosition.x());
175 m_t_ly.push_back(lPosition.y());
176 m_t_barcode.push_back(simHit.particleId().value());
179 m_outputTree->Fill();