19 #include <edm4hep/MCParticle.h>
20 #include <edm4hep/SimTrackerHit.h>
21 #include <podio/Frame.h>
23 namespace ActsExamples {
27 :
WriterT(config.inputSimHits,
"CsvSimHitWriter", level),
29 m_writer(config.outputPath) {
33 throw std::invalid_argument(
"Missing simulated hits input collection");
37 throw std::invalid_argument(
"Missing output particle name");
41 throw std::invalid_argument(
"Missing output sim tracker hit name");
58 std::unordered_map<ActsFatras::Barcode, edm4hep::MutableMCParticle>
61 edm4hep::MCParticleCollection mcParticles;
62 edm4hep::SimTrackerHitCollection simTrackerHitCollection;
68 auto p = mcParticles->create();
74 auto it = particleMap.find(particleId);
75 if (
it == particleMap.end()) {
76 throw std::runtime_error(
"Particle not found in map");
82 for (
const auto& simHit : simHits) {
83 auto simTrackerHit = simTrackerHitCollection->create();
85 simHit, simTrackerHit, particleMapper,
92 m_writer.writeFrame(frame,
"events");