PlasmaMLPALLAS
Loading...
Searching...
No Matches
PlasmaMLPALLASPrimaryGeneratorAction.hh
Go to the documentation of this file.
1#ifndef PlasmaMLPALLASPrimaryGeneratorAction_h
2#define PlasmaMLPALLASPrimaryGeneratorAction_h 1
3
16#include "G4VUserPrimaryGeneratorAction.hh"
19#include "G4ParticleGun.hh"
20#include "G4GeneralParticleSource.hh"
23
24// Forward declarations
25class G4ParticleGun;
26class G4Event;
27
28class PlasmaMLPALLASPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
29{
30public:
37 PlasmaMLPALLASPrimaryGeneratorAction(size_t N, size_t numThreads, bool pMT);
38
43
48 void GeneratePrimaries(G4Event *anEvent) override;
49
54
57 double GetML_Xoff() const { return OnnxParameters::Instance().GetXoff(); }
58 double GetML_A0() const { return OnnxParameters::Instance().GetA0(); }
59 double GetML_CN2() const { return OnnxParameters::Instance().GetCN2(); }
60 double GetML_Pressure() const { return OnnxParameters::Instance().GetPressure(); }
62
65 double GetEkin() const { return Ekin; }
66 double GetdEkin() const { return dEkin * 100.; }
67 double GetQ() const { return Q * 1e12; }
68 double GetEPSB() const { return epsb * 1e6; }
70
71private:
72 PlasmaMLPALLASPrimaryGeneratorMessenger* fPrimaryGeneratorMessenger = nullptr;
74 std::unique_ptr<PlasmaMLPALLASOnnxInference> onnxInference;
75 G4ParticleGun* particleGun = nullptr;
76 G4GeneralParticleSource* particleSource = nullptr;
77 G4ParticleDefinition* particleDefinition = nullptr;
84 static void ShowProgress(double progress, std::chrono::high_resolution_clock::time_point startTime);
85
86 size_t NEventsGenerated = 0;
87 size_t currentEvent = 0;
88 size_t numThreads = 0;
89 bool flag_MT = false;
90 int threadID = 0;
91 int eventID = 0;
92 int nEvent = 0;
93 std::chrono::duration<double> elapsedTime;
94 bool isStartTimeInitialized = false;
95 std::chrono::high_resolution_clock::time_point startTime;
96 double progressRemaining = 0.;
97 double averageTimePerProgress = 0.;
98 double estimatedRemainingTime = 0.;
100 // Beam physical parameters
101 double Ekin = 1.;
102 double dEkin = 1.;
103 double Q = 1.;
104 double epsb = 1.;
106 // ONNX session
107 std::unique_ptr<Ort::Session> fSession;
108 const OrtMemoryInfo* fMemory_info = nullptr;
109 std::vector<const char*> fInput_node_names = {"input"};
110 std::vector<const char*> fOutput_node_names = {"output"};
111};
112
113#endif
double GetPressure() const
Definition PlasmaMLPALLASOnnxParameters.hh:79
double GetXoff() const
Definition PlasmaMLPALLASOnnxParameters.hh:67
double GetCN2() const
Definition PlasmaMLPALLASOnnxParameters.hh:75
static OnnxParameters & Instance()
Access the singleton instance.
Definition PlasmaMLPALLASOnnxParameters.hh:23
double GetA0() const
Definition PlasmaMLPALLASOnnxParameters.hh:71
Defines the primary generator action for the simulation.
Definition PlasmaMLPALLASPrimaryGeneratorAction.hh:29
double GetML_Xoff() const
Definition PlasmaMLPALLASPrimaryGeneratorAction.hh:57
double GetEPSB() const
Definition PlasmaMLPALLASPrimaryGeneratorAction.hh:68
double GetdEkin() const
Definition PlasmaMLPALLASPrimaryGeneratorAction.hh:66
void UpdateParticleDefinition()
Update the particle definition based on current parameters.
Definition PlasmaMLPALLASPrimaryGeneratorAction.cc:73
double GetML_CN2() const
Definition PlasmaMLPALLASPrimaryGeneratorAction.hh:59
double GetML_Pressure() const
Definition PlasmaMLPALLASPrimaryGeneratorAction.hh:60
double GetML_A0() const
Definition PlasmaMLPALLASPrimaryGeneratorAction.hh:58
~PlasmaMLPALLASPrimaryGeneratorAction()
Destructor.
Definition PlasmaMLPALLASPrimaryGeneratorAction.cc:67
double GetEkin() const
Definition PlasmaMLPALLASPrimaryGeneratorAction.hh:65
double GetQ() const
Definition PlasmaMLPALLASPrimaryGeneratorAction.hh:67
void GeneratePrimaries(G4Event *anEvent) override
Generate primary particles for the event.
Definition PlasmaMLPALLASPrimaryGeneratorAction.cc:133
Provides UI commands to configure the primary generator.
Definition PlasmaMLPALLASPrimaryGeneratorMessenger.hh:32