Gasfile issue during running

thanks dear for your time and this much explanation. thank you very much. yes i’m sure i’m working from almost one year on the interface for my research and i have to do it.
i’ll try all on this pattern thank you.

by doing changes these errors are coming… can you tell me what is the issue now?

i have made changes by changing argon and co2 in detectr construction.cc and garfieldphysics.cc. here is the changes code according to the instructions.

C2H2F4 is a G4Material, not a G4Element.

see i have made changes again it it is G4Material but still error.

Why did you change the lines like

G4Element* H = nistManager->FindOrBuildElement("H", isotopes);

to

G4Material* H = nistManager->FindOrBuildElement("H", isotopes)

??? Please undo these changes, and also remove the two lines

G4Material* C2H2F4_100 = new G4Material(...);
C2H2F4_100->AddMaterial(...);

PS: again, please include your code as text not as pictures in the message.

ok dear sorry i’ll place text next time…

// Lead material defined using NIST Manager
G4NistManager* nistManager = G4NistManager::Instance();

nistManager->FindOrBuildMaterial("G4_Pb");
nistManager->FindOrBuildMaterial("G4_Cu");
nistManager->FindOrBuildMaterial("G4_Al");
nistManager->FindOrBuildMaterial("G4_Au");
nistManager->FindOrBuildMaterial("G4_W");

nistManager->FindOrBuildMaterial("G4_AIR");

G4Element* H = nistManager->FindOrBuildElement("H", isotopes);
G4Element* C = nistManager->FindOrBuildElement("C", isotopes);
G4Element* F = nistManager->FindOrBuildElement("F", isotopes);

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


density = 1.413 * CLHEP::g / CLHEP::cm3;
G4Material* Kapton = new G4Material(name = "Kapton", density, ncomponents =
		4);
Kapton->AddElement(O, 5);
Kapton->AddElement(C, 22);
Kapton->AddElement(N, 2);
Kapton->AddElement(H, 10);

// Print materials
G4cout << *(G4Material::GetMaterialTable()) << G4endl;

}

//…oooOO0OOooo…oooOO0OOooo…oooOO0OOooo…oooOO0OOooo…

G4VPhysicalVolume* GarfieldDetectorConstruction::DefineVolumes() {
// Geometry parameters
G4double worldSizeXYZ = 1000 * mm;
G4double absorberThicknessZ = 10. * mm;
G4double absorberThicknessXY = 100. * mm;
G4double wireRadius = 0.025 * mm;
G4double tubeRadius = 15 * mm;
G4double tubeHalfLength = 100 * mm;
G4double tubeThickness = 500 * um;

// Get materials
G4Material* defaultMaterial = G4Material::GetMaterial("G4_AIR");
fAbsorberMaterial = G4Material::GetMaterial("G4_Pb");

G4Material* gasMaterial = G4Material::GetMaterial("C2H2F4_100");
G4Material* cathodeMaterial = G4Material::GetMaterial("G4_Al");
G4Material* wireMaterial = G4Material::GetMaterial("G4_W");

these are errors now.

/home/ahmer/Desktop/garfield/Examples/Geant4GarfieldInterface/src/GarfieldDetectorConstruction.cc: In member function ‘void GarfieldDetectorConstruction::DefineMaterials()’:
/home/ahmer/Desktop/garfield/Examples/Geant4GarfieldInterface/src/GarfieldDetectorConstruction.cc:115:21: error: ‘O’ was not declared in this scope
Kapton->AddElement(O, 5);
^
/home/ahmer/Desktop/garfield/Examples/Geant4GarfieldInterface/src/GarfieldDetectorConstruction.cc:117:21: error: ‘N’ was not declared in this scope
Kapton->AddElement(N, 2);
^
/home/ahmer/Desktop/garfield/Examples/Geant4GarfieldInterface/src/GarfieldDetectorConstruction.cc:88:20: warning: unused variable ‘fractionmass’ [-Wunused-variable]
G4double density, fractionmass;
^
[ 90%] Building CXX object CMakeFiles/exampleGeant4Interface.dir/src/GarfieldSteppingAction.cc.o
CMakeFiles/exampleGeant4Interface.dir/build.make:95: recipe for target ‘CMakeFiles/exampleGeant4Interface.dir/src/GarfieldDetectorConstruction.cc.o’ failed
make[2]: *** [CMakeFiles/exampleGeant4Interface.dir/src/GarfieldDetectorConstruction.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs…
CMakeFiles/Makefile2:95: recipe for target ‘CMakeFiles/exampleGeant4Interface.dir/all’ failed
make[1]: *** [CMakeFiles/exampleGeant4Interface.dir/all] Error 2
Makefile:103: recipe for target ‘all’ failed
make: *** [all] Error 2

As you can see from the error message, the objects N, O used in Kapton->AddElement don’t exist. You’ll need to add two lines:

G4Element* N = nistManager->FindOrBuildElement("N", isotopes);
G4Element* O = nistManager->FindOrBuildElement("O", isotopes);

ok dear thanks a lot i’ll do it and let you know.

dear these lines i have added and it worked see i moved little furthur. but the program still showing C2H2F4 doesn’t exist. can you tell what is going on here and what is issue.

[ 81%] Building CXX object CMakeFiles/exampleGeant4Interface.dir/src/GarfieldRunAction.cc.o
/home/ahmer/Desktop/garfield/Examples/Geant4GarfieldInterface/src/GarfieldDetectorConstruction.cc: In member function ‘void GarfieldDetectorConstruction::DefineMaterials()’:
/home/ahmer/Desktop/garfield/Examples/Geant4GarfieldInterface/src/GarfieldDetectorConstruction.cc:88:20: warning: unused variable ‘fractionmass’ [-Wunused-variable]
G4double density, fractionmass;
^
[ 90%] Building CXX object CMakeFiles/exampleGeant4Interface.dir/src/GarfieldSteppingAction.cc.o
[100%] Linking CXX executable exampleGeant4Interface
[100%] Built target exampleGeant4Interface
ahmer@ahmer-Dell-Precision-M3800 ~/Desktop/garfield/Examples/Geant4GarfieldInterface/build ls ar_70_co2_30_1000mbar.gas CMakeFiles exampleGeant4Interface icons.mac Makefile run.mac CMakeCache.txt cmake_install.cmake gui.mac init_vis.mac physics.mac vis.mac ahmer@ahmer-Dell-Precision-M3800 ~/Desktop/garfield/Examples/Geant4GarfieldInterface/build ./exampleGeant4Interface -m ./run.mac
Heed:
Database path: /home/ahmer/Desktop/garfield/Heed/heed++/database
RandomEngineRoot::Seed:
Seed: 1


Geant4 version Name: geant4-10-06-patch-01 (14-February-2020)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
: NIM A 835 (2016), 186-225
WWW : http://geant4.org/


<<< Geant4 Physics List simulation engine: QGSP_BERT_HP

RegisterPhysics: G4EmStandard
RegisterPhysics: G4GammaLeptoNuclearPhys
RegisterPhysics: Decay
RegisterPhysics: G4RadioactiveDecay
RegisterPhysics: hElasticWEL_CHIPS_HP
RegisterPhysics: hInelastic QGSP_BERT_HP
RegisterPhysics: stopping
RegisterPhysics: ionInelasticFTFP_BIC
Using Root
Visualization Manager instantiating with verbosity “warnings (3)”…
Visualization Manager initialising…
Registering graphics systems…

You have successfully registered the following graphics systems.
Current available graphics systems are:
ASCIITree (ATree)
DAWNFILE (DAWNFILE)
G4HepRep (HepRepXML)
G4HepRepFile (HepRepFile)
RayTracer (RayTracer)
VRML1FILE (VRML1FILE)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)
OpenGLImmediateQt (OGLIQt, OGLI)
OpenGLStoredQt (OGLSQt, OGL, OGLS)
OpenGLImmediateX (OGLIX, OGLIQt_FALLBACK)
OpenGLStoredX (OGLSX, OGLSQt_FALLBACK)
RayTracerX (RayTracerX)

Registering model factories…

You have successfully registered the following model factories.
Registered model factories:
generic
drawByAttribute
drawByCharge
drawByOriginVolume
drawByParticleID
drawByEncounteredVolume

Registered filter factories:
attributeFilter
chargeFilter
originVolumeFilter
particleFilter
encounteredVolumeFilter

You have successfully registered the following user vis actions.
Run Duration User Vis Actions: none
End of Event User Vis Actions: none
End of Run User Vis Actions: none

Some /vis commands (optionally) take a string to specify colour.
“/vis/list” to see available colours.
PAI is applicable for G4Particle e- between 0 MeV and 1e+08 MeV
PAI is applicable for G4Particle e+ between 0 MeV and 1e+08 MeV
PAI is applicable for G4Particle mi- between 0 MeV and 1e+08 MeV
PAI is applicable for G4Particle mu+ between 0 MeV and 1e+08 MeV
PAI is applicable for G4Particle proton between 0 MeV and 1e+08 MeV
PAI is applicable for G4Particle pi+ between 0 MeV and 1e+08 MeV
PAI is applicable for G4Particle pi- between 0 MeV and 1e+08 MeV
PAI is applicable for G4Particle alpha between 0 MeV and 1e+08 MeV
PAI is applicable for G4Particle He3 between 0 MeV and 1e+08 MeV
PAI is applicable for G4Particle GenericIon- between 0 MeV and 1e+08 MeV
Garfield model (Heed) is applicable for G4Particle gamma between 1e-06 MeV and 1e+08 MeV
Garfield model (Heed) is applicable for G4Particle e- between 1e-06 MeV and 0.001 MeV

***** Table : Nb of materials = 8 *****

Material: G4_Pb density: 11.350 g/cm3 RadL: 5.613 mm Nucl.Int.Length: 18.248 cm
Imean: 823.000 eV temperature: 293.15 K pressure: 1.00 atm

—> Element: Pb (Pb) Z = 82.0 N = 207 A = 207.217 g/mole
—> Isotope: Pb204 Z = 82 N = 204 A = 203.97 g/mole abundance: 1.400 %
—> Isotope: Pb206 Z = 82 N = 206 A = 205.97 g/mole abundance: 24.100 %
—> Isotope: Pb207 Z = 82 N = 207 A = 206.98 g/mole abundance: 22.100 %
—> Isotope: Pb208 Z = 82 N = 208 A = 207.98 g/mole abundance: 52.400 %
ElmMassFraction: 100.00 % ElmAbundance 100.00 %

Material: G4_Cu density: 8.960 g/cm3 RadL: 1.436 cm Nucl.Int.Length: 15.588 cm
Imean: 322.000 eV temperature: 293.15 K pressure: 1.00 atm

—> Element: Cu (Cu) Z = 29.0 N = 64 A = 63.546 g/mole
—> Isotope: Cu63 Z = 29 N = 63 A = 62.93 g/mole abundance: 69.170 %
—> Isotope: Cu65 Z = 29 N = 65 A = 64.93 g/mole abundance: 30.830 %
ElmMassFraction: 100.00 % ElmAbundance 100.00 %

Material: G4_Al density: 2.699 g/cm3 RadL: 8.896 cm Nucl.Int.Length: 38.894 cm
Imean: 166.000 eV temperature: 293.15 K pressure: 1.00 atm

—> Element: Al (Al) Z = 13.0 N = 27 A = 26.982 g/mole
—> Isotope: Al27 Z = 13 N = 27 A = 26.98 g/mole abundance: 100.000 %
ElmMassFraction: 100.00 % ElmAbundance 100.00 %

Material: G4_Au density: 19.320 g/cm3 RadL: 3.344 mm Nucl.Int.Length: 10.540 cm
Imean: 790.000 eV temperature: 293.15 K pressure: 1.00 atm

—> Element: Au (Au) Z = 79.0 N = 197 A = 196.967 g/mole
—> Isotope: Au197 Z = 79 N = 197 A = 196.97 g/mole abundance: 100.000 %
ElmMassFraction: 100.00 % ElmAbundance 100.00 %

Material: G4_W density: 19.300 g/cm3 RadL: 3.504 mm Nucl.Int.Length: 10.312 cm
Imean: 727.000 eV temperature: 293.15 K pressure: 1.00 atm

—> Element: W (W) Z = 74.0 N = 184 A = 183.842 g/mole
—> Isotope: W180 Z = 74 N = 180 A = 179.95 g/mole abundance: 0.120 %
—> Isotope: W182 Z = 74 N = 182 A = 181.95 g/mole abundance: 26.500 %
—> Isotope: W183 Z = 74 N = 183 A = 182.95 g/mole abundance: 14.310 %
—> Isotope: W184 Z = 74 N = 184 A = 183.95 g/mole abundance: 30.640 %
—> Isotope: W186 Z = 74 N = 186 A = 185.95 g/mole abundance: 28.430 %
ElmMassFraction: 100.00 % ElmAbundance 100.00 %

Material: G4_AIR density: 1.205 mg/cm3 RadL: 303.921 m Nucl.Int.Length: 710.095 m
Imean: 85.700 eV temperature: 293.15 K pressure: 1.00 atm

—> Element: C © Z = 6.0 N = 12 A = 12.011 g/mole
—> Isotope: C12 Z = 6 N = 12 A = 12.00 g/mole abundance: 98.930 %
—> Isotope: C13 Z = 6 N = 13 A = 13.00 g/mole abundance: 1.070 %
ElmMassFraction: 0.01 % ElmAbundance 0.02 %

—> Element: N (N) Z = 7.0 N = 14 A = 14.007 g/mole
—> Isotope: N14 Z = 7 N = 14 A = 14.00 g/mole abundance: 99.632 %
—> Isotope: N15 Z = 7 N = 15 A = 15.00 g/mole abundance: 0.368 %
ElmMassFraction: 75.53 % ElmAbundance 78.44 %

—> Element: O (O) Z = 8.0 N = 16 A = 15.999 g/mole
—> Isotope: O16 Z = 8 N = 16 A = 15.99 g/mole abundance: 99.757 %
—> Isotope: O17 Z = 8 N = 17 A = 17.00 g/mole abundance: 0.038 %
—> Isotope: O18 Z = 8 N = 18 A = 18.00 g/mole abundance: 0.205 %
ElmMassFraction: 23.18 % ElmAbundance 21.07 %

—> Element: Ar (Ar) Z = 18.0 N = 40 A = 39.948 g/mole
—> Isotope: Ar36 Z = 18 N = 36 A = 35.97 g/mole abundance: 0.337 %
—> Isotope: Ar38 Z = 18 N = 38 A = 37.96 g/mole abundance: 0.063 %
—> Isotope: Ar40 Z = 18 N = 40 A = 39.96 g/mole abundance: 99.600 %
ElmMassFraction: 1.28 % ElmAbundance 0.47 %

Material: C2H2F4 density: 2.686 mg/cm3 RadL: 130.884 m Nucl.Int.Length: 324.391 m
Imean: 98.417 eV temperature: 293.15 K pressure: 1.00 atm

—> Element: C © Z = 6.0 N = 12 A = 12.011 g/mole
—> Isotope: C12 Z = 6 N = 12 A = 12.00 g/mole abundance: 98.930 %
—> Isotope: C13 Z = 6 N = 13 A = 13.00 g/mole abundance: 1.070 %
ElmMassFraction: 23.54 % ElmAbundance 25.00 %

—> Element: H (H) Z = 1.0 N = 1 A = 1.008 g/mole
—> Isotope: H1 Z = 1 N = 1 A = 1.01 g/mole abundance: 99.989 %
—> Isotope: H2 Z = 1 N = 2 A = 2.01 g/mole abundance: 0.011 %
ElmMassFraction: 1.98 % ElmAbundance 25.00 %

—> Element: F (F) Z = 9.0 N = 19 A = 18.998 g/mole
—> Isotope: F19 Z = 9 N = 19 A = 19.00 g/mole abundance: 100.000 %
ElmMassFraction: 74.48 % ElmAbundance 50.00 %

Material: Kapton density: 1.413 g/cm3 RadL: 28.716 cm Nucl.Int.Length: 56.093 cm
Imean: 77.821 eV temperature: 293.15 K pressure: 1.00 atm

—> Element: O (O) Z = 8.0 N = 16 A = 15.999 g/mole
—> Isotope: O16 Z = 8 N = 16 A = 15.99 g/mole abundance: 99.757 %
—> Isotope: O17 Z = 8 N = 17 A = 17.00 g/mole abundance: 0.038 %
—> Isotope: O18 Z = 8 N = 18 A = 18.00 g/mole abundance: 0.205 %
ElmMassFraction: 20.92 % ElmAbundance 12.82 %

—> Element: C © Z = 6.0 N = 12 A = 12.011 g/mole
—> Isotope: C12 Z = 6 N = 12 A = 12.00 g/mole abundance: 98.930 %
—> Isotope: C13 Z = 6 N = 13 A = 13.00 g/mole abundance: 1.070 %
ElmMassFraction: 69.11 % ElmAbundance 56.41 %

—> Element: N (N) Z = 7.0 N = 14 A = 14.007 g/mole
—> Isotope: N14 Z = 7 N = 14 A = 14.00 g/mole abundance: 99.632 %
—> Isotope: N15 Z = 7 N = 15 A = 15.00 g/mole abundance: 0.368 %
ElmMassFraction: 7.33 % ElmAbundance 5.13 %

—> Element: H (H) Z = 1.0 N = 1 A = 1.008 g/mole
—> Isotope: H1 Z = 1 N = 1 A = 1.01 g/mole abundance: 99.989 %
—> Isotope: H2 Z = 1 N = 2 A = 2.01 g/mole abundance: 0.011 %
ElmMassFraction: 2.64 % ElmAbundance 25.64 %

G4Material::GetMaterial() WARNING: The material: C2H2F4_100 does not exist in the table. Return NULL pointer.

-------- EEEE ------- G4Exception-START -------- EEEE -------
*** G4Exception : exampleGarfield
issued by : GarfieldDetectorConstruction::DefineVolumes()
Cannot retrieve materials already defined.
*** Fatal Exception *** core dump ***
**** Track information is not available at this moment
**** Step information is not available at this moment

-------- EEEE -------- G4Exception-END --------- EEEE -------

*** G4Exception: Aborting execution ***
Aborted (core dumped)
ahmer@ahmer-Dell-Precision-M3800 ~/Desktop/garfield/Examples/Geant4GarfieldInterface/build $

Replace C2H2F4_100 by C2H2F4 in the function DefineVolumes.

1 Like

its at least working thanks a lot for your help and time. i’m observing and waiting to let the program complete all the working. but there are some errors coming which program is unable to complete. can you tell me why is something like this.

TrackHeed::UpdateBoundingBox:
Center of bounding box:
x: 0 cm
y: 0 cm
z: 0 cm
AvalancheMC::GetVelocity: Error calculating electron velocity at (1.285840, 0.304535, -0.002155).
AvalancheMC::DriftLine: Abandoning the calculation.
AvalancheMC::GetVelocity: Error calculating electron velocity at (1.285845, 0.304515, -0.002171).
AvalancheMC::DriftLine: Abandoning the calculation.
AvalancheMC::GetVelocity: Error calculating electron velocity at (1.285848, 0.304505, -0.002180).
AvalancheMC::DriftLine: Abandoning the calculation.
AvalancheMC::GetVelocity: Error calculating electron velocity at (1.285854, 0.304486, -0.002195).
AvalancheMC::DriftLine: Abandoning the calculation.
AvalancheMC::GetVelocity: Error calculating electron velocity at (1.285854, 0.304485, -0.002196).
AvalancheMC::DriftLine: Abandoning the calculation.

in its upper part it is also showing saomething like this. file cannot open. did he pic the gas file or our tetrafluoroethane still not loaded?

Checking overlaps for volume Absorber (G4Box) … OK!
Checking overlaps for volume Tube (G4Tubs) … OK!
Checking overlaps for volume Gas (G4Tubs) … OK!
Checking overlaps for volume Wire (G4Tubs) … OK!
MediumMagboltz::SetComposition:
C2H2F4
MediumMagboltz::Mixer:
4000 linear energy steps between 0 and 40 eV.
C2H2F4 2010
mass: 102.031 amu
ionisation threshold: 14.48 eV
9 inelastic terms (1 excitations, 3 superelastic, 5 other)
MediumMagboltz::Mixer:
Lowest ionisation threshold in the mixture: 14.48 eV (C2H2F4)
MediumMagboltz::Mixer:
Energy [eV] Collision Rate [ns-1]
2.50 4472.69
7.50 7048.15
12.50 9176.58
17.50 10118.63
22.50 8927.37
27.50 9649.72
32.50 10007.88
37.50 10610.23
MediumMagboltz::Mixer:
Photon collision rates could not be calculated.
MediumMagboltz::Mixer: Resetting transfer probabilities.
Global: 0
Component 0: 0
Component 1: 0
Component 2: 0
Component 3: 0
Component 4: 0
Component 5: 0
MediumMagboltz::EnablePenningTransfer:
Warning: present gas table has no ionisation rates.
Ignore this message if you are using microscopic tracking only.
MediumMagboltz::EnablePenningTransfer:
Penning transfer parameters for 1 excitation levels set to:
r = 0.57
lambda = 0 cm
MediumMagboltz::LoadGasFile:
Cannot open file TETRAFLUOROETHANE.gas.
G4GDML: Writing ‘garfieldGeometry.gdml’…
G4GDML: Writing definitions…
G4GDML: Writing materials…
G4GDML: Writing solids…
G4GDML: Writing structure…
G4GDML: Writing setup…
G4GDML: Writing surfaces…
G4GDML: Writing ‘garfieldGeometry.gdml’ done !
/home/ahmer/Desktop/Geant4/geant4.10.06.p01-install/share/Geant4-10.6.1/data/G4NDL4.6
@@@ G4ParticleHPInelastic instantiated for particle neutron data directory variable is G4NEUTRONHPDATA pointing to /home/ahmer/Desktop/Geant4/geant4.10.06.p01-install/share/Geant4-10.6.1/data/G4NDL4.6/Inelastic

That is indeed the problem. Did you generate a gas file called TETRAFLUOROETHANE.gas and is it located in your working directory?

yes if you remember i asked you about that i want to generate the gas file and want to put it in the geant4garfieldinterface example. and i have generated that file and it is now with in the geant4garfieldinterface file but outside of the build directory in which i’m working for running the example.
see here in pic. 2nd last file tetraflurorethane. and first file build which i have copied for sourcing,cmake,make etc.

Ok, then copy the file to your build directory.

1 Like

ok dear

this time after copyting that file in the build directory some different error occures. and it aborted all program.

G4VisManager: Using G4TrajectoryDrawByCharge as fallback trajectory model.
See commands in /vis/modeling/trajectories/ for other options.

Run 0 starts.

… open Root analysis file : Garfield.root - done
→ Event 0 starts.
Sensor::SetArea:
-1.451 < x [cm] < 1.451
-1.451 < y [cm] < 1.451
-10 < z [cm] < 10
TrackHeed::UpdateBoundingBox:
Bounding box dimensions:
x: 2.902 cm
y: 2.902 cm
z: 20 cm
TrackHeed::UpdateBoundingBox:
Center of bounding box:
x: 0 cm
y: 0 cm
z: 0 cm
TrackHeed::Initialise:
Cluster density: 224.297 cm-1
Stopping power (restricted): 18.0398 keV/cm
Stopping power (incl. tail): 21.1444 keV/cm
W value: 31.244 eV
Fano factor: 0.19
Min. ionization potential: 11.52 eV
terminate called after throwing an instance of ‘std::bad_alloc’
what(): std::bad_alloc
Aborted (core dumped)