32 throw std::invalid_argument(
"Missing file path");
35 throw std::invalid_argument(
"Missing tree name");
41 throw std::ios_base::failure(
"Could not open '" +
m_cfg.
filePath +
"'");
46 throw std::bad_alloc();
75 if (m_outputFile !=
nullptr) {
76 m_outputFile->Close();
82 m_outputTree->Write();
83 m_outputFile->Close();
85 ACTS_INFO(
"Wrote particles to tree '" <<
m_cfg.treeName <<
"' in '"
86 <<
m_cfg.filePath <<
"'");
94 std::lock_guard<std::mutex> lock(m_writeMutex);
97 for (
const auto&
particle : particles) {
98 m_particleId.push_back(
particle.particleId().value());
99 m_particleType.push_back(
particle.pdg());
100 m_process.push_back(static_cast<uint32_t>(
particle.process()));
102 m_vx.push_back(Acts::clampValue<float>(
particle.fourPosition().x() /
104 m_vy.push_back(Acts::clampValue<float>(
particle.fourPosition().y() /
106 m_vz.push_back(Acts::clampValue<float>(
particle.fourPosition().z() /
108 m_vt.push_back(Acts::clampValue<float>(
particle.fourPosition().w() /
112 m_p.push_back(Acts::clampValue<float>(
p));
113 m_px.push_back(Acts::clampValue<float>(
p *
particle.direction().x()));
114 m_py.push_back(Acts::clampValue<float>(
p *
particle.direction().y()));
115 m_pz.push_back(Acts::clampValue<float>(
p *
particle.direction().z()));
122 m_eta.push_back(Acts::clampValue<float>(
124 m_phi.push_back(Acts::clampValue<float>(
126 m_pt.push_back(Acts::clampValue<float>(
129 m_vertexPrimary.push_back(
particle.particleId().vertexPrimary());
130 m_vertexSecondary.push_back(
particle.particleId().vertexSecondary());
131 m_particle.push_back(
particle.particleId().particle());
132 m_generation.push_back(
particle.particleId().generation());
133 m_subParticle.push_back(
particle.particleId().subParticle());
136 m_outputTree->Fill();
138 m_particleId.clear();
139 m_particleType.clear();
154 m_vertexPrimary.clear();
155 m_vertexSecondary.clear();
157 m_generation.clear();
158 m_subParticle.clear();