Source_energy and beam as a source

Hello,
I have a question regarding the parameter source energy. When we have this implementation in the configuration file:


[DepositionGeant4]
particle_code = 22
source_energy = 1000GeV
source_type = "beam"
number_of_particles = 2
flat_beam = true
beam_size = 1mm
source_position = 10.075mm 7.14mm -30mm
beam_direction = 0 0 1

it means that the beam will have 1000 GeV energy? So the two particles together will have this energy?

And is basically different (regarding the energy) than when we have this macro in the configuration file?:

/gps/particle gamma
/gps/pos/type Point 
/gps/pos/centre 10.075 7.64 -30 mm 
/gps/ene/mono 1000 GeV 
/gps/direction 0 0 1 


/gps/source/add 1
/gps/particle gamma
/gps/pos/type Point 
/gps/pos/centre 10.075 5.14 -30 mm 
/gps/ene/mono 1000 GeV 
/gps/direction 0 0 1 
/gps/source/multiplevertex 1

Where in this case we have each photon 1000 GeV each?

Thank you very much in advance for the prompt answer. :slight_smile:

Good morning @Peni123 ,

the source energy defines the mean kinetic energy of the generated particles, so since you did not define an energy spread, all photons will have an energy of exactly 1000GeV.

Cheers
Paul

Hello Paul,

Thank you a lot for your answer! :slight_smile:
But how I define the source_energy_spread in order to have two photons each one of them 1 TeV?
I cannot find an example of this parameter nor in git or in the manual.

Kind regards

Now I’m not sure whether we understand each other correctly :slight_smile:

With the configuration you have, both photons will have an energy of 1 TeV each. That’s what you want, right?
My comment was just that if you would set the source_energy_spread to a non-zero number, this would mean that the photons can have an energy slightly varying around 1 TeV, but you can ignore that.

Cheers
Paul

Haha yes sorry @pschutze. Thank you for your answers.
So you are saying basically that when I run a simulation with this configuration file:

[DepositionGeant4]
particle_code = 22
source_energy = 1000GeV
source_type = "beam"
number_of_particles = 2
flat_beam = true
beam_size = 1mm
source_position = 10.075mm 7.14mm -30mm
beam_direction = 0 0 1
physics_list = 
max_step_length = 10um 
range_cut = 5um

corresponds in each one of the photons to be 1TeV each and it should be the same with this configuration file:

[DepositionGeant4]
number_of_particles = 2
source_type = "macro"
file_name = "run.mac"
physics_list = 
max_step_length = 10um 
range_cut = 5um

(and macro

/gps/particle gamma
/gps/pos/type Point 
/gps/pos/centre 10.075 7.64 -30 mm 
/gps/ene/mono 1000 GeV 
/gps/direction 0 0 1 


/gps/source/add 1
/gps/particle gamma
/gps/pos/type Point 
/gps/pos/centre 10.075 5.14 -30 mm 
/gps/ene/mono 1000 GeV 
/gps/direction 0 0 1 
/gps/source/multiplevertex 1

)?
Because based on a small analysis I do after in the second way I get much more charge, like there are two photons and in the first it looks like there is one, in most of the times. Do you know why this is happening?
The parameter number_of_particles = 2 in the first way, you always shoot in all events 2 particles? Or in some events one and in some others two? Because in the second with the multiplevertex as I understood it I shoot each time in each event two.
(The position in the macro I changed it though the many tests, to compare it with the other and the result was reasonable, each time)
Thank you :slight_smile:

Hi @Peni123 ,

not quite. I can confirm that the first configuration (despite the physics list being empty) provides what you need. For debugging, I simulated one event and enabled the TextWriter module. This yielded the following output:

--- <global> ---

--- Printing MCTrack information for track (0x7f90d4748330) ----------------------
Particle type (PDG ID):      22
Production process:        none (G4 process type: -1)
Production in G4Volume:   World
Initial position:         -0.351755 mm |  0.118196 mm |       -30 mm
Final position:           -0.351755 mm |  0.118196 mm |        33 mm
Initial kinetic energy:       1e+06 MeV | Final kinetic energy:         1e+06 MeV   
Initial total energy:         1e+06 MeV | Final total energy:           1e+06 MeV   
Linked parent: <nullptr>
----------------------------------------------------------------------------------


--- Printing MCTrack information for track (0x7f90d4748408) ----------------------
Particle type (PDG ID):      22
Production process:        none (G4 process type: -1)
Production in G4Volume:   World
Initial position:         0.0856531 mm | -0.569553 mm |       -30 mm
Final position:           0.0856531 mm | -0.569553 mm |        33 mm
Initial kinetic energy:       1e+06 MeV | Final kinetic energy:         1e+06 MeV   
Initial total energy:         1e+06 MeV | Final total energy:           1e+06 MeV   
Linked parent: <nullptr>
----------------------------------------------------------------------------------

You can see that we have two particles of 1 TeV. In my case, they are not absorbed in the sensor, that’s why the final energy is also 1 TeV, but don’t worry about that.

Now, when running the macro, the parameter number_of_particles might be misleading, because it will actually run the macro number_of_particles times :-/ This means that you will end up with four particles, demonstrated here:

--- <global> ---

--- Printing MCTrack information for track (0x7ff39c748c70) ----------------------
Particle type (PDG ID):      22
Production process:        none (G4 process type: -1)
Production in G4Volume:   World
Initial position:             0.075 mm |      0.14 mm |       -30 mm
Final position:               0.075 mm |      0.14 mm |        33 mm
Initial kinetic energy:       1e+06 MeV | Final kinetic energy:         1e+06 MeV   
Initial total energy:         1e+06 MeV | Final total energy:           1e+06 MeV   
Linked parent: <nullptr>
----------------------------------------------------------------------------------


--- Printing MCTrack information for track (0x7ff39c748d48) ----------------------
Particle type (PDG ID):      22
Production process:        none (G4 process type: -1)
Production in G4Volume:   World
Initial position:             0.075 mm |      2.64 mm |       -30 mm
Final position:               0.075 mm |      2.64 mm |        33 mm
Initial kinetic energy:       1e+06 MeV | Final kinetic energy:         1e+06 MeV   
Initial total energy:         1e+06 MeV | Final total energy:           1e+06 MeV   
Linked parent: <nullptr>
----------------------------------------------------------------------------------


--- Printing MCTrack information for track (0x7ff39c748e20) ----------------------
Particle type (PDG ID):      22
Production process:        none (G4 process type: -1)
Production in G4Volume:   World
Initial position:             0.075 mm |      0.14 mm |       -30 mm
Final position:               0.075 mm |      0.14 mm |        33 mm
Initial kinetic energy:       1e+06 MeV | Final kinetic energy:         1e+06 MeV   
Initial total energy:         1e+06 MeV | Final total energy:           1e+06 MeV   
Linked parent: <nullptr>
----------------------------------------------------------------------------------


--- Printing MCTrack information for track (0x7ff39c748ef8) ----------------------
Particle type (PDG ID):      22
Production process:        none (G4 process type: -1)
Production in G4Volume:   World
Initial position:             0.075 mm |      2.64 mm |       -30 mm
Final position:               0.075 mm |      2.64 mm |        33 mm
Initial kinetic energy:       1e+06 MeV | Final kinetic energy:         1e+06 MeV   
Initial total energy:         1e+06 MeV | Final total energy:           1e+06 MeV   
Linked parent: <nullptr>
----------------------------------------------------------------------------------

That’s why the charge is probably quite different.

Let me know whether this fixes the issue or whether new issues arise :slight_smile:

Cheers
Paul

Dear @pschutze ,

Thank you a lot for your response, I am very happy that I realized, why this was happening.
So to be clear ( :sweat_smile:), these two are the same configurations:

Conf1:

particle_code = 22
source_energy = 1000GeV
source_type = "beam"
number_of_particles = 2
flat_beam = true
beam_size = 1mm
source_position = 10.075mm 7.14mm -30mm
beam_direction = 0 0 1
physics_list = FTFP_BERT_ATL
max_step_length = 10um 
range_cut = 5um

Conf2:

number_of_particles = 1
source_type = "macro"
file_name = "run.mac"
physics_list = FTFP_BERT_ATL
max_step_length = 10um 
range_cut = 5um

-------------

/gps/particle gamma
/gps/pos/type Point 
/gps/pos/centre 10.075 7.64 -30 mm 
/gps/ene/mono 1000 GeV 
/gps/direction 0 0 1 


/gps/source/add 1
/gps/particle gamma
/gps/pos/type Point 
/gps/pos/centre 10.075 5.14 -30 mm 
/gps/ene/mono 1000 GeV 
/gps/direction 0 0 1 
/gps/source/multiplevertex 1


?

Thanks a lot :smiley:

Hi @Peni123

this should be equivalent, yes. I’m not very familiar with the commands /gps/source/add and /gps/source/multiplevertex, but the test I did here looks promising.

Only the physics_list = is causing troubles (it should actually fail), so please comment this out or fill it with a value.

Please verify nevertheless whether the results make sense to you.
A good way to check what is going on is to switch on VisualizationGeant4, which shows the setup and particles quite nicely. (The screenshot of course represents an example sensor as I don’t have your design).

Cheers
Paul

1 Like

Dear @pschutze ,

Yes I did all kind of tests and I confirm that now all my results are reasonable.
Cool for the visualization.

Thank you a lot one more time :smiley: