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.
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.
Creating liquid argon.
G4double density = 1.390*g/cm3;
G4double 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.
Creating water by defining its molecular components.
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.
Creating air by defining the fractional mass of its components.
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.
Defining air and water from the internal Geant4 database.
G4NistManager* man = G4NistManager::Instance();
G4Material* H2O = man->FindOrBuildMaterial("G4_WATER");
G4Material* Air = man->FindOrBuildMaterial("G4_AIR");
Print Material Information
Printing information about materials.
G4cout << H2O; \\ print a given material
G4cout << *(G4Material::GetMaterialTable()); \\ print the list of materials
In examples/novice/N03/N03DetectorConstruction.cc, you
will find examples of all possible ways to build a material.