G4OCCT 0.1.0
Geant4 interface to Open CASCADE Technology (OCCT) geometry definitions
Loading...
Searching...
No Matches
G4OCCTActionInitialization.cc
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later
2// Copyright (C) 2026 G4OCCT Contributors
3
6
9#include "G4OCCTRunAction.hh"
12
13#include <G4ParticleGun.hh>
14#include <G4ParticleTable.hh>
15#include <G4SystemOfUnits.hh>
16#include <G4VUserPrimaryGeneratorAction.hh>
17
18namespace {
19
21class DefaultPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction {
22public:
23 DefaultPrimaryGeneratorAction() : fGun(std::make_unique<G4ParticleGun>(1)) {
24 auto* proton = G4ParticleTable::GetParticleTable()->FindParticle("proton");
25 fGun->SetParticleDefinition(proton);
26 fGun->SetParticleEnergy(1.0 * GeV);
27 fGun->SetParticleMomentumDirection(G4ThreeVector(0, 0, 1));
28 fGun->SetParticlePosition(G4ThreeVector(0, 0, 0));
29 }
30
31 void GeneratePrimaries(G4Event* event) override { fGun->GeneratePrimaryVertex(event); }
32
33private:
34 std::unique_ptr<G4ParticleGun> fGun;
35};
36
37} // namespace
38
40 SetUserAction(new G4OCCTRunAction(&fConfig));
41}
42
44 SetUserAction(new DefaultPrimaryGeneratorAction);
45
46 auto* runAction = new G4OCCTRunAction(&fConfig);
47 SetUserAction(runAction);
48
49 auto* eventAction = new G4OCCTEventAction(runAction);
50 SetUserAction(eventAction);
51
52 auto* trackingAction = new G4OCCTTrackingAction(eventAction, runAction);
53 SetUserAction(trackingAction);
54
55 SetUserAction(new G4OCCTSteppingAction(eventAction, trackingAction, runAction));
56}
Minimal user action initialisation for the g4occt executable.
Event action that accumulates per-event totals and fills the events ntuple.
Run action that manages CSV output via G4AnalysisManager.
Stepping action that fills the per-step ntuple.
Tracking action that fills the per-track ntuple.
Event action that accumulates per-event quantities.
Run action that opens and closes a G4AnalysisManager CSV output file.
Stepping action that records one row per G4Step into the "steps" ntuple.
Tracking action that records one row per G4Track into the "tracks" ntuple.