Hello, i am a new geant4 user and i have some questions: what is the difference between run action and event action? If i want for example to compute the total number of particles that touched my detector, which class should i use? The one with run action or event action? I think the run action is the right choice, but im not very sure.
Also, why do i need to create a sensitive detector? Only to be able to tell geant4 where to give me the informations im asking for at run action / event action?
Please, any help is welcomed. I will have to make a simulation for my workplace and i want to learn about it quickly. The simulation will consist in calculating the HPGe detector efficicency for gamma rays.
Hi @georgepata, I will answer your question with my knowledge
- The RunAction class will manage each run. That means you can implement something for a run. The RunAction class had 2 methods BeginOfRunAction() and EndOfRunAction() that are called at begin and end of a run. So you can extract some information from a run. For example, I usually use the RunAction class to get simulation time by getting time at BeginOfRunAction() and EndOfRunAction().
The EventAction is a class to extract information from each event. A run is a collection of events. The number of events will be set by using the beamOn() method. It also had 2 methods BeginOfEventAction() and EndOfEventAction() that will be called at begin and end of each event. So that can help you to extract useful information from each event.
If you want to count how many particles reached your detector, I think you should process each event (one event will have how many particles reached the detector). Finally, I will sum up the total count number from each event in RunAction and print your results at EndOfRunAction() class.
- Actually, there are many ways to get information from certain volumes. One of the ways is the SensitiveDetctor method. That means when you register a volume as a sensitive detector each interaction of particles inside the volume will be recorded. You must process the information that got from the volume to get the final result that you want. There are different ways, for example, scoring based on commands method, user action class method (use SteppingAction, EventAction, RunAction, …), …
- I also simulated an HPGe detector before, maybe I can help you to construct your simulation.
Thank you so much for this clever answer
Can you please give me your email address so that i can contact you if i have other questions?