Geant4  10.01
F04Materials.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: F04Materials.cc 68021 2013-03-13 13:36:07Z gcosmo $
27 //
30 //
31 
32 #include "F04Materials.hh"
33 #include "G4SystemOfUnits.hh"
34 
35 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
36 
38 {
40 
41  fNistMan->SetVerbose(2);
42 
44 }
45 
46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47 
49 {
50  delete fVacuum;
51  delete fAir;
52  delete fSci;
53  delete fBeO;
54 }
55 
56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
57 
59 
61 {
62  if (fInstance == 0)
63  {
64  fInstance = new F04Materials();
65  }
66  return fInstance;
67 }
68 
69 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
70 
72 {
73  G4Material* mat = fNistMan->FindOrBuildMaterial(material);
74 
75  if (!mat) mat = G4Material::GetMaterial(material);
76  if (!mat) {G4cout << material << "Not Found, Please Retry"<< G4endl;}
77 
78  return mat;
79 }
80 
81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
82 
84 {
86  std::vector<G4int> natoms;
87  std::vector<G4double> fractionMass;
88  std::vector<G4String> elements;
89 
90  // Materials Definitions
91  // =====================
92 
93  // Define Vacuum
94 
95  fVacuum = fNistMan->FindOrBuildMaterial("G4_Galactic");
96 
97  // Define Air
98 
99  fAir = fNistMan->FindOrBuildMaterial("G4_AIR");
100 
101  // Define BeO
102 
103  fBeO = fNistMan->FindOrBuildMaterial("G4_BERYLLIUM_OXIDE");
104 
105  // Define Scintillator
106 
107  elements.push_back("C"); natoms.push_back(9);
108  elements.push_back("H"); natoms.push_back(10);
109 
110  density = 1.032*g/cm3;;
111 
112  fSci = fNistMan->
113  ConstructNewMaterial("Scintillator", elements, natoms, density);
114 
115  elements.clear();
116  natoms.clear();
117 
118  G4cout << G4endl << "The materials defined are: " << G4endl << G4endl;
119 
120  G4cout << *(G4Material::GetMaterialTable()) << G4endl;
121 }
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
Definition of the F04Materials class.
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:603
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:588
virtual ~F04Materials()
Definition: F04Materials.cc:48
G4Material * GetMaterial(G4String)
Definition: F04Materials.cc:71
static G4NistManager * Instance()
G4NistManager * fNistMan
Definition: F04Materials.hh:59
G4double density
Definition: TRTMaterials.hh:39
static F04Materials * fInstance
Definition: F04Materials.hh:57
G4GLOB_DLL std::ostream G4cout
void SetVerbose(G4int)
G4Material * fAir
Definition: F04Materials.hh:62
static const double cm3
Definition: G4SIunits.hh:108
G4Material * fSci
Definition: F04Materials.hh:63
static F04Materials * GetInstance()
Definition: F04Materials.cc:60
G4Material * fVacuum
Definition: F04Materials.hh:61
static const double g
Definition: G4SIunits.hh:162
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void CreateMaterials()
Definition: F04Materials.cc:83
G4Material * fBeO
Definition: F04Materials.hh:64