13 #include "Geant4/G4Event.hh" 28 std::cout <<
"Primary:: GenParticles*******************Size: " << allGens.size() <<
'\n';
29 for (
auto const& h : allGens) {
31 std::cout <<
"Primary:: GenParticlesCollection*******************Size: " << gens.size() <<
'\n';
33 std::cout <<
" genpart.pdgId(): " << genpart.pdgId()
34 <<
"\n position: " << genpart.position() <<
"\nmomentum: " << genpart.momentum()
35 <<
"\nenergy: " << genpart.momentum().e() <<
'\n';
40 genpart.momentum().e(),
49 G4ThreeVector
const& pos,
52 G4ThreeVector
const& mom)
54 auto vertex =
new G4PrimaryVertex{pos, time};
55 vertex->SetPrimary(
new G4PrimaryParticle{pdgId, mom.x(), mom.y(), mom.z(), energy});
56 event->AddPrimaryVertex(
vertex);
PrimaryEventActionService(fhicl::ParameterSet const &)
void generatePrimaries(G4Event *anEvent) override
std::vector< GenParticle > GenParticleCollection
decltype(auto) get(T &&obj)
ADL-aware version of std::to_string.
void addG4Particle(G4Event *event, int pdgId, const G4ThreeVector &pos, double time, double energy, const G4ThreeVector &mom)
Event finding and building.
std::vector< Handle< PROD > > getMany(SelectorBase const &selector=MatchAllSelector{}) const