23 :
WriterT(cfg.inputParticles,
"RootParticleWriter", lvl), m_cfg(cfg) {
26 throw std::invalid_argument(
"Missing file path");
29 throw std::invalid_argument(
"Missing tree name");
35 throw std::ios_base::failure(
"Could not open '" +
m_cfg.
filePath +
"'");
40 throw std::bad_alloc();
69 m_outputFile->Close();
76 m_outputTree->Write();
77 ACTS_INFO(
"Wrote particles to tree '" << m_cfg.treeName <<
"' in '"
78 << m_cfg.filePath <<
"'");
85 if (not m_outputFile) {
87 return ProcessCode::ABORT;
91 std::lock_guard<std::mutex> lock(m_writeMutex);
94 for (
const auto&
particle : particles) {
95 m_particleId =
particle.particleId().value();
97 m_process =
static_cast<decltype(m_process)
>(
particle.process());
116 m_vertexPrimary =
particle.particleId().vertexPrimary();
117 m_vertexSecondary =
particle.particleId().vertexSecondary();
118 m_particle =
particle.particleId().particle();
119 m_generation =
particle.particleId().generation();
120 m_subParticle =
particle.particleId().subParticle();
121 m_outputTree->Fill();