How to Specify Materials in the Detector¶
General Considerations¶
In nature, general materials (chemical compounds, mixtures) are made of elements, and elements are made of isotopes. Therefore, these are the three main classes designed in Geant4. Each of these classes has a table as a static data member, which is for keeping track of the instances created of the respective classes. All three objects automatically register themselves into the corresponding table on construction, and should never be deleted in user code.
The G4Element
class describes the properties of the atoms:
atomic number,
number of nucleons,
atomic mass,
shell energy,
as well as quantities such as cross sections per atom, etc.
The G4Material
class describes the macroscopic properties of matter:
density,
state,
temperature,
pressure,
as well as macroscopic quantities like radiation length, mean free path, dE/dx, etc.
The G4Material
class is the one which is visible to the rest of the
toolkit, and is used by the tracking, the geometry, and the physics. It
contains all the information relative to the eventual elements and
isotopes of which it is made, at the same time hiding the implementation
details.
Define a Simple Material¶
In the example below, liquid argon is created, by specifying its name, density, mass per mole, and atomic number.
G4double z, a, density;
density = 1.390*g/cm3;
a = 39.95*g/mole;
G4Material* lAr = new G4Material(name="liquidArgon", z=18., a, density);
The pointer to the material, lAr, will be used to specify the matter of which a given logical volume is made:
G4LogicalVolume* myLbox = new G4LogicalVolume(aBox,lAr,"Lbox",0,0,0);
Define a Molecule¶
In the example below, the water, H2O, is built from its components, by specifying the number of atoms in the molecule.
G4double z, a, density;
G4String name, symbol;
G4int ncomponents, natoms;
a = 1.01*g/mole;
G4Element* elH = new G4Element(name="Hydrogen",symbol="H" , z= 1., a);
a = 16.00*g/mole;
G4Element* elO = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a);
density = 1.000*g/cm3;
G4Material* H2O = new G4Material(name="Water",density,ncomponents=2);
H2O->AddElement(elH, natoms=2);
H2O->AddElement(elO, natoms=1);
Define a Mixture by Fractional Mass¶
In the example below, air is built from nitrogen and oxygen, by giving the fractional mass of each component.
G4double z, a, fractionmass, density;
G4String name, symbol;
G4int ncomponents;
a = 14.01*g/mole;
G4Element* elN = new G4Element(name="Nitrogen",symbol="N" , z= 7., a);
a = 16.00*g/mole;
G4Element* elO = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a);
density = 1.290*mg/cm3;
G4Material* Air = new G4Material(name="Air ",density,ncomponents=2);
Air->AddElement(elN, fractionmass=70*perCent);
Air->AddElement(elO, fractionmass=30*perCent);
Define a Material from the Geant4 Material Database¶
In the example below, air and water are accessed via the Geant4 material database.
G4NistManager* man = G4NistManager::Instance();
G4Material* H2O = man->FindOrBuildMaterial("G4_WATER");
G4Material* Air = man->FindOrBuildMaterial("G4_AIR");
Define a Material from the Base Material¶
It is possible to build new material on base of an existing “base” material. This feature is useful for electromagnetic physics allowing to peak up for the derived material all correction data and precomputed tables of stopping powers and cross sections of the base material. In the example below, two methods how to create water with unusual density are shown.
G4double density;
density = 1.05*mg/cm3;
G4Material* water1 = new G4Material("Water_1.05",density,"G4_WATER");
density = 1.03*mg/cm3;
G4NistManager* man = G4NistManager::Instance();
G4Material* water2 = man->BuildMaterialWithNewDensity("Water_1.03","G4_WATER",density);
Print Material Information¶
G4cout << H2O; \\ print a given material
G4cout << *(G4Material::GetMaterialTable()); \\ print the list of materials
In Geant4 examples you all possible ways to build a material.
Access to Geant4 material database¶
/material/nist/printElement Fe \\ print element by name
/material/nist/printElementZ 13 \\ print element by atomic number
/material/nist/listMaterials type \\ print materials type = [simple | compound | hep | all]
/material/g4/printElement elmName \\ print instantiated element by name
/material/g4/printMaterial matName \\ print instantiated material by name
In Geant4 examples you with find all possible ways to build a material.