Home | News | Documentation | Download

Gasfile issue during running

@hschindl i was working on it and producing different gas files. now u want to produce another gas file by using example gasfile in garfield. but it is giving an error and not running see. as i have put name and parameter in generate.cc. can you help what is issue?

dear another thing i’m replacing the gas file in the example geant4garfieldinterface in the file detectorconstruction.cc but its not compiling what is issue here i want you to help me in this regard too. please waiting for your answwer.

The parameters of the function SetComposition are (in this order)

  • name of the first component in the mixture (string),
  • fraction of the first component in the mixture (double),
  • name of the second component (string),
  • fraction of the second component (double),
  • and so on (up to six components).
    So, in your case:
gas.SetComposition("C2H4F2", 70., "C4H10", 30.);

Hard to say without seeing your code, but it looks like C2F4H2 is a G4Element object while it should be a G4Material (first error) and you are using an object (Ar) that doesn’t exist.

1 Like

oook dear i’ll show you more so you can explain if there is something else.

here the detector construction.cc with in the geant4garfieldinterface example of garfield. and i have tried to change and then error comes in make command which i have asked you previous day. i have made changes but why is errors?

in this above pic you can see i have put the changes with c2f4h2 100% and with its gas file but still issues in make command.

C2F4H2 is not an element, so I guess the line

nistManager->findOrBuildElement("C2F4H2", isotopes);

won’t work. I think you have to build a C2F4H2 G4Material the same way you do it for CO2.

Another issue, as I mentioned in my previous reply, is in the line

ArCO2_93_7->AddElement(Ar, fractionmass = 0.93);

It causes an error because there is no object called Ar in your function. This line (and the one before/after) is probably a left over from the original code (which did use Ar/CO2).

By the way, it would be great if (in the future) you could post your code as text instead of a picture.

ok dear i’ll check then let you know. thanks a lot.

ahmer@ahmer-Dell-Precision-M3800 ~ cd Desktop ahmer@ahmer-Dell-Precision-M3800 ~/Desktop cd garfeidl
bash: cd: garfeidl: No such file or directory
ahmer@ahmer-Dell-Precision-M3800 ~/Desktop cd garfield ahmer@ahmer-Dell-Precision-M3800 ~/Desktop/garfield cd Examples/GasFile
ahmer@ahmer-Dell-Precision-M3800 ~/Desktop/garfield/Examples/GasFile ls ar_80_co2_20_0T.gas ar_80_co2_20_2T.gas CMakeLists.txt generate.C merge.C read.C ahmer@ahmer-Dell-Precision-M3800 ~/Desktop/garfield/Examples/GasFile mkdir build
ahmer@ahmer-Dell-Precision-M3800 ~/Desktop/garfield/Examples/GasFile cd build ahmer@ahmer-Dell-Precision-M3800 ~/Desktop/garfield/Examples/GasFile/build source /home/ahmer/Desktop/Geant4/geant4.10.06.p01-install/bin/geant4.sh
ahmer@ahmer-Dell-Precision-M3800 ~/Desktop/garfield/Examples/GasFile/build source /home/ahmer/Desktop/root/test_build/bin/thisroot.sh ahmer@ahmer-Dell-Precision-M3800 ~/Desktop/garfield/Examples/GasFile/build source /home/ahmer/Desktop/garfield/build/setup.sh
ahmer@ahmer-Dell-Precision-M3800 ~/Desktop/garfield/Examples/GasFile/build cmake .. -- The C compiler identification is GNU 5.4.0 -- The CXX compiler identification is GNU 5.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc - works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ - works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /home/ahmer/Desktop/garfield/Examples/GasFile/build ahmer@ahmer-Dell-Precision-M3800 ~/Desktop/garfield/Examples/GasFile/build make -j8
Scanning dependencies of target read
Scanning dependencies of target generate
[ 25%] Building CXX object CMakeFiles/generate.dir/generate.C.o
[ 50%] Building CXX object CMakeFiles/read.dir/read.C.o
[ 75%] Linking CXX executable generate
[100%] Linking CXX executable read
[100%] Built target generate
[100%] Built target read
ahmer@ahmer-Dell-Precision-M3800 ~/Desktop/garfield/Examples/GasFile/build ls ar_80_co2_20_0T.gas ar_80_co2_20_2T.gas CMakeCache.txt CMakeFiles cmake_install.cmake generate Makefile read ahmer@ahmer-Dell-Precision-M3800 ~/Desktop/garfield/Examples/GasFile/build ./generate
Database path: /home/ahmer/Desktop/garfield/Heed/heed++/database
Gas G4_FREON-12 is not recognized.
Error setting the composition. No valid components.
MediumMagboltz::GenerateGasTable: Found 0 excitations and 0 ionisations.
MediumMagboltz::GenerateGasTable: E = 100 V/cm, B = 0 T, angle: 1.5708 rad


N= 1 NGAS= 0 FRAC= 0.000
N= 2 NGAS= 0 FRAC= 0.000
N= 3 NGAS= 0 FRAC= 0.000
N= 4 NGAS= 0 FRAC= 0.000
N= 5 NGAS= 0 FRAC= 0.000
N= 6 NGAS= 0 FRAC= 0.000
MediumMagboltz::RunMagboltz: Results:
Drift velocity along E: 0.00000000 cm/ns +/- 0.00%
Drift velocity along Bt: 0.00000000 cm/ns +/- 0.00%
Drift velocity along ExB: 0.00000000 cm/ns +/- 0.00%
Lorentz angle: 0.000 degree
Longitudinal diffusion: -nan cm1/2 +/- 0.00%
Transverse diffusion: -nan cm1/2 +/- 0.00%
Townsend coefficient: 0.0000 cm-1 +/- 0.00%
Attachment coefficient: 0.0000 cm-1 +/- 0.00%
MediumMagboltz::GenerateGasTable: E = 143.845 V/cm, B = 0 T, angle: 1.5708 rad

in this down pasted code i have tried to build the gas file for 100% freon.
but as mentioned name in the list of materials is G4_FREON-12 but the code is not picking it as you are seeing in the code the errors how to fix it?

G4_FREON-12 is not a valid identifier for C2H4F2. You can use one of the following:

  • "C2H2F4", "C2F4H2",
  • "FREON 134", "FREON 134A", "FREON-134", "FREON-134-A",
1 Like

ok dear i’ll try with others. but G4_FREON-12 was in the /material/nist/list material. i have checked then why is it not working?

and dear can you send me the material list so i can also check material and its proper font.? my email. ahmer.khan713@gmail.com

That means that Geant4 has a material with that name in its list of materials, but that is completely separate from Garfield++/Magboltz. To set the gas mixture to C2H4F2 in MediumMagboltz, you need to use one of the labels/names I mentioned in my previous message.

By the way, I suspect that G4_FREON-12 might correspond to Dichlorodifluoromethane - Wikipedia and not 1,1,1,2-Tetrafluoroethane - Wikipedia.

Do you mean a list of gases that are available in Magboltz?
See Appendix B of the Garfield++ user guide.

1 Like

OK dear thanks i’ll see that too.

in the above picture now i’m basically introduce my tetrafluoroethane gas file in the geant4garfieldinterface example. this picture is basically the picture of the detectorconstruction.cc src file. and also i have copied the generated file of c2h2f4 in the geant4garfieldinterface folder no other file is it right? kindly if you can tell me how to do it?

and also as i have to place the density, ionizing potential, and n-components? how to find that?

I’m not a Geant4 expert, but I think you could do something like this:

G4Element* H = nistManager->FindOrBuildelement("H", isotopes);
G4Element* C = nistManager->FindOrBuildelement("C", isotopes);
G4Element* F = nistManager->FindOrBuildelement("F", isotopes);
G4Material* C2H2F4 = new G4Material("C2H2F4", 
    density = ... * CLHEP::mg / CLHEP::cm3, ncomponents = 3, kStateGas);
 C2H2F4->AddElement(C, natoms = 2);
 C2H2F4->AddElement(H, natoms = 2);
 C2H2F4->AddElement(F, natoms = 4);

I don’t know the density off hand, so you’ll need to replace the three dots by the actual number.

Incidentally, I would recommend to tidy up the function DefineMaterials. You define materials (e. g. Ar/CO2 70:30, Ar/CO2 93:7) in this function which seem to be remnants of the original code and which I believe you don’t use.
Also note that this function defines only the materials on the Geant4 side of your program, it doesn’t do anything related to Garfield.

Regarding the density: you can assume that it is an ideal gas, so the number density at 0° C and atmospheric pressure is N = 2.6867774e19 cm-3.
To get the mass density you need to multiply this number by the atomic weight A of the molecule and the atomic mass unit.

I think I asked this question before, but are you sure you need to interface Geant4 and Garfield++ for your study and cannot simply use Garfield++ only?