Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 //
28 //
29 //
30 #include "F04Materials.hh"
31 #include "G4SystemOfUnits.hh"
32 
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 
35 F04Materials::F04Materials()
36 {
37  fNistMan = G4NistManager::Instance();
38 
39  fNistMan->SetVerbose(2);
40 
41  CreateMaterials();
42 }
43 
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
45 
47 {
48  delete fVacuum;
49  delete fAir;
50  delete fSci;
51  delete fBeO;
52 }
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55 
56 F04Materials* F04Materials::fInstance = 0;
57 
59 {
60  if (fInstance == 0)
61  {
62  fInstance = new F04Materials();
63  }
64  return fInstance;
65 }
66 
67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
68 
70 {
71  G4Material* mat = fNistMan->FindOrBuildMaterial(material);
72 
73  if (!mat) mat = G4Material::GetMaterial(material);
74  if (!mat) {G4cout << material << "Not Found, Please Retry"<< G4endl;}
75 
76  return mat;
77 }
78 
79 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
80 
81 void F04Materials::CreateMaterials()
82 {
84  std::vector<G4int> natoms;
85  std::vector<G4double> fractionMass;
86  std::vector<G4String> elements;
87 
88  // Materials Definitions
89  // =====================
90 
91  // Define Vacuum
92 
93  fVacuum = fNistMan->FindOrBuildMaterial("G4_Galactic");
94 
95  // Define Air
96 
97  fAir = fNistMan->FindOrBuildMaterial("G4_AIR");
98 
99  // Define BeO
100 
101  fBeO = fNistMan->FindOrBuildMaterial("G4_BERYLLIUM_OXIDE");
102 
103  // Define Scintillator
104 
105  elements.push_back("C"); natoms.push_back(9);
106  elements.push_back("H"); natoms.push_back(10);
107 
108  density = 1.032*g/cm3;;
109 
110  fSci = fNistMan->
111  ConstructNewMaterial("Scintillator", elements, natoms, density);
112 
113  elements.clear();
114  natoms.clear();
115 
116  G4cout << G4endl << "The materials defined are: " << G4endl << G4endl;
117 
118  G4cout << *(G4Material::GetMaterialTable()) << G4endl;
119 }