Home | News | Documentation | Download

Interface of geant4 and garfield

@hschindl
hi, i have installed the garfield and run its example geant4garfieldinterface. and also produced some graphs from the geant4 example TestEm5.
but now i want to interface and want to use the output of geant4 in the garfield as input. how to do that? please need your help.!

waiting for your answer dear…

It looks like a very similar question was asked and answered in this forum:

Hello,
apologies for the late reply. You can find an discussion of different options for interfacing Geant4 and Garfield++ on the Garfield++ website. Which one to use depends very much on your application and what results you would like to obtain from your simulation.

I saw that you also sent an email on the same topic, so let’s perhaps follow this up by email…

thanks dear yes i have seen the garfield forum. and it was helpful. i got some hint. but i want to reproduce the graphs of this paper which i have uploaded here.

it cannot be uploaded the file is too big i’ll send you through email.

did you recieve my mail with the paper of which i want to regenrate the plots?
if not can you provide me another mailing of your’s because on this mailing address the size of file is bigger and its rejecting.

No, I didn’t get your mail. Can you upload it to a file-sharing platform (Dropbbox, Google Drive, etc.)? But why is the file so big if it’s only a plot?

haha… dear its a paper of which i want to re-generate the plots. here is its link please.
https://indico.cern.ch/event/667256/contributions/2731974/

That is exactly the example described on the Garfield++ website:

https://garfieldpp.web.cern.ch/garfieldpp/examples/geant4-interface/

that means through the TestEm8 i have to do this.? and definitely i need your help in this regard, and will ask you please.

@heinrich.schindler@cern.ch i’m stuck. i don’t know how to start. kindly help me i’m already very late dear.

@hschindl Note that currently, the official “Garfield++ → Geant4 interface” web page contains links to nonexistent web pages and two examples “.zip” files “at the bottom of the page”.

1 Like

Thanks a lot! Should be fixed now…

Hi,
sorry, I’m not particularly familiar with the Geant4/Garfield++ example myself and I must admit I’ve not looked into it for a while. I just gave it a go to run the macro provided on

which is the example referred to on the Garfield++ website and in the presentation you sent.
For me it seems to work fine, in that it runs over a handful of events and produces a ROOT output file with a tree and histograms of deposited energy, avalanche size and other variables scored in the simulation.
Does this macro/program not work for you? At which point do you get stuck?

@hschindl Now, both links to “examples” point to the same source code. However, I cannot find any detailed description of how to (properly) modify it to switch the version (and the original “.zip” files, different for each of them, are missing, so one cannot check it).

Yes, that’s true. I need to ask the author of the example about that…

thanks dear.

sorry i answering this much late. yes @hschindl @Wile_E_Coyote saying right in its post. as i have seen the presentation i only come to know i have to prepare the TestEm8 of electromagnetic example of Geant4. but what further how to produce plots or change gas mixture and how to produce graphs from it using root. that what i didn’t understand @hschindl !

Hi,
the example on the repository uses a geometry consisting of a lead absorber block and a drift tube. As explained on the website, there are different options for simulating ionization in the drift tube. By default, the example will use the Geant4 PAIPhot model but let Garfield++ (Heed) handle the resulting electrons with less than 1 keV energy. I believe you can change these settings in physics.mac.

On the “Garfield” side of the interface, the gas mixture is defined in the function InitializePhysics of the class GarfieldPhysics.
The Geant4 geometry description is done in GarfieldDetectorConstruction::DefineVolumes.
If you want to change the gas composition, you will need to do it in both places to be consistent.

The histograms and ntuples to be filled are created in the class GarfieldRunAction and they are filled in GarfieldEventAction::EndOfEventAction. They are saved to a .root file which for a quick inspection you can open with the ROOT browser.

Can you provide a bit more details on what exactly you would like to simulate? Maybe there is an easier solution…

2 Likes