New passive materials

Dear all,
is it possible to define new passive materials, like styrofoam?
Thanks and regards,
Marco Bomben

1 Like

Hi Marco,

sure, you can define any material you find useful, Geant4 offers a good interface for this.

In Allpix Squared, the available materials are defined starting here. Materials that are defined within G4 can be imported via e.g.


, definitions of other compound materials for which you know the composition you can find below, such as here:

// Create Epoxy material
auto* Epoxy = new G4Material("Epoxy", 1.3 * CLHEP::g / CLHEP::cm3, 3);
Epoxy->AddElement(H, 44);
Epoxy->AddElement(C, 15);
Epoxy->AddElement(O, 7);
materials_["epoxy"] = Epoxy;

with the G4 commands described here. It would be cool if you could create a merge request with the new materials you define as they could be useful for other users as well. Simply put the material name in the as well and this should be a straight forward one.


Hello Paul, all,
thanks a lot for the explanation!
I am trying to push my branch but it is not working:
fatal: unable to access '': The requested URL returned error: 403
I have looked to the gitlab webpage but I cannot find the new merge request button.
Am I missing something?

Thanks and regards,
Marco Bomben

Hi @mbomben

the easiest way would be to fork the repository into your account via the “fork” button:

and then to push it there. You can add a second git remote to your local version via:

git remote add marco
git push marco your_branch

From there you should then also see the “create new merge request” button!


Thank you Simon!
I have created the MR for adding polystyrene.
I have noted a possible typo in the

   // Create paper material (cellulose C6H10O5)
    auto* Paper = new G4Material("Paper", 0.8 * CLHEP::g / CLHEP::cm3, 3);
    Paper->AddElement(C, 6);
    Paper->AddElement(O, 10);
    Paper->AddElement(H, 5);
    materials_["paper"] = Paper;

I think that the lines for Oxygen and Hydrogen have been swapped; according to the chemical formula I was expecting:

    Paper->AddElement(O, 5);
    Paper->AddElement(H, 10);

I can fix this via a new MR if needed.

Hi @mbomben

you are of course right, this seems to be a swap! Please feel free to fix this in the same MR! :slight_smile:


Hi @simonspa ,
ok. How do I make changes to an existing MR, please?

Hi @mbomben

you can add another commit to the same branch and push the changes. The MR will automatically be updated and contains everything that is in the respective branch.

I have applied the formatting fix already to your code yesterday and have merged everything - so for the celulose fix it would be a new MR.


Hi @simonspa ,
thanks I will proceed then with another MR.
I have another question: what should I do now to use polystyrene? Is there a compiled version of master that I can use, please?
Thanks and regards,
Marco Bomben

Hi @mbomben

the latest master version is deployed during the night to


from where you can use it directly when you’re on LXPLUS or any other machine with CVMFS. This version has your polystyrene in.

A regular released version will be available later this week as v1.6.2.