Source from GPS macro

Dear Allpix2 developers,

Probably I’m wrong somewhere, but… I have simple g4 macro:

/gps/particle gamma
/gps/pos/type Volume
/gps/pos/shape Para
/gps/pos/centre 0. 0. -2. cm
/gps/pos/halfx 0.5 cm
/gps/pos/halfy 0.5 cm
/gps/pos/halfz 0.5 cm
/gps/pos/rot1 1. 0.57735 0.
/gps/pos/rot2 -0.57735 1. -0.66667
/gps/ang/type cos
/gps/ene/type Gauss
/gps/ene/mono 40. keV
/gps/ene/sigma 5. keV

It gives me the following errors:

"16:13:18.521|   (DEBUG) [I:DepositionGeant4] Applying Geant4 macro command: "/gps/particle gamma
) is not listed in the candidate List.meter value (gamma
"16:13:18.521|   (DEBUG) [I:DepositionGeant4] Applying Geant4 macro command: "/gps/pos/type Volume
) is not listed in the candidate List.meter value (Volume
"16:13:18.521|   (DEBUG) [I:DepositionGeant4] Applying Geant4 macro command: "/gps/pos/shape Para
) is not listed in the candidate List.meter value (Para
"16:13:18.521|   (DEBUG) [I:DepositionGeant4] Applying Geant4 macro command: "/gps/pos/centre 0. 0. -2. cm
|16:13:18.521| (WARNING) [Geant4] 
                                  -------- EEEE ------- G4Exception-START -------- EEEE -------
                                  *** G4Exception : InvalidUnit
                                        issued by : G4UnitDefinition::GetCategory()
' does not exist in the Units Table!e unit 'cm
                                  *** Fatal Exception *** core dump ***
|16:13:18.521| (WARNING) [Geant4]  **** Track information is not available at this moment
|16:13:18.521| (WARNING) [Geant4]  **** Step information is not available at this moment
|16:13:18.521| (WARNING) [Geant4] 
                                  -------- EEEE -------- G4Exception-END --------- EEEE -------
                                  
|16:13:18.521| (WARNING) [Geant4] 
|16:13:18.521| (WARNING) [Geant4] *** G4Exception: Aborting execution ***
|16:13:18.521|   (FATAL) [I:DepositionGeant4] Aborting!
Segmentation fault (core dumped)

Do you have any ideas?
I’m on v.2.1.0. Cfg of DepositionGeant4 module:

[DepositionGeant4]
physics_list = FTFP_BERT_EMZ
source_type = "macro"
file_name = "cube_source.g4mac"
number_of_particles = 1
max_step_length = 5um
fano_factor = 0.14
charge_creation_energy = 4.2eV
range_cut = 200um

Thank you and best regards,
Petr

Hi @psmolyan

I tried to reproduce your issue, but for me it works just fine:

|10:27:45.299|   (TRACE) [I:DepositionGeant4] Constructing particle source
|10:27:45.300|    (INFO) [I:DepositionGeant4] Using user macro for particle source.
|10:27:45.300|   (TRACE) [I:DepositionGeant4] Parsing macro file /home/simonspa/software/allpix-squared/conf/forum/237/cube_source.g4mac
|10:27:45.300|   (DEBUG) [I:DepositionGeant4] Applying Geant4 macro command: "/gps/particle gamma"
|10:27:45.300|   (DEBUG) [I:DepositionGeant4] Applying Geant4 macro command: "/gps/pos/type Volume"
|10:27:45.300|   (DEBUG) [I:DepositionGeant4] Applying Geant4 macro command: "/gps/pos/shape Para"
|10:27:45.300|   (DEBUG) [I:DepositionGeant4] Applying Geant4 macro command: "/gps/pos/centre 0. 0. -2. cm"
|10:27:45.300|   (DEBUG) [I:DepositionGeant4] Applying Geant4 macro command: "/gps/pos/halfx 0.5 cm"
|10:27:45.300|   (DEBUG) [I:DepositionGeant4] Applying Geant4 macro command: "/gps/pos/halfy 0.5 cm"
|10:27:45.300|   (DEBUG) [I:DepositionGeant4] Applying Geant4 macro command: "/gps/pos/halfz 0.5 cm"
|10:27:45.300|   (DEBUG) [I:DepositionGeant4] Applying Geant4 macro command: "/gps/pos/rot1 1. 0.57735 0."
|10:27:45.300|   (DEBUG) [I:DepositionGeant4] Applying Geant4 macro command: "/gps/pos/rot2 -0.57735 1. -0.66667"
|10:27:45.300|   (DEBUG) [I:DepositionGeant4] Applying Geant4 macro command: "/gps/ang/type cos"
|10:27:45.300|   (DEBUG) [I:DepositionGeant4] Applying Geant4 macro command: "/gps/ene/type Gauss"
|10:27:45.300|   (DEBUG) [I:DepositionGeant4] Applying Geant4 macro command: "/gps/ene/mono 40. keV"
|10:27:45.300|   (DEBUG) [I:DepositionGeant4] Applying Geant4 macro command: "/gps/ene/sigma 5. keV"

I also see the particles being generated:

What version of Geant4 are you using? What is the output of allpix --version?

All the best,
Simon

Hi @simonspa

That’s strange.

The output is following:

Allpix Squared version v2.1.0-tar
               built on 2021-12-10, 11:23:54 UTC
               using Boost.Random 1.69.0
                     ROOT 6.24/06
                     Geant4 1073

Best regards,
Petr

Hi @psmolyan

I just tested this by logging into lxplus and calling

$ source /cvmfs/clicdp.cern.ch/software/allpix-squared/2.1.0/x86_64-centos7-gcc11-opt/setup.sh
$ allpix -c config.conf

and it works flawlessly for me. I guess there is an issue with your Geant4 installation, and judging by the output it is something with the units, i.e. CLHEP? What were your compilation flags for Geant4?

Cheers,
Simon

Hi @simonspa

Compilation flags for G4 are here:

I will try on another machine.

Cheers,
Petr