![]() |
|
|||
File indexing completed on 2025-02-23 09:21:18
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // 0027 /// \file field/field04/src/F04Materials.cc 0028 /// \brief Implementation of the F04Materials class 0029 // 0030 0031 #include "F04Materials.hh" 0032 0033 #include "G4SystemOfUnits.hh" 0034 0035 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0036 0037 F04Materials::F04Materials() 0038 { 0039 fNistMan = G4NistManager::Instance(); 0040 0041 fNistMan->SetVerbose(2); 0042 0043 CreateMaterials(); 0044 } 0045 0046 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0047 0048 F04Materials::~F04Materials() 0049 { 0050 delete fVacuum; 0051 delete fAir; 0052 delete fSci; 0053 delete fBeO; 0054 } 0055 0056 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0057 0058 F04Materials* F04Materials::fInstance = nullptr; 0059 0060 F04Materials* F04Materials::GetInstance() 0061 { 0062 if (fInstance == nullptr) { 0063 fInstance = new F04Materials(); 0064 } 0065 return fInstance; 0066 } 0067 0068 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0069 0070 G4Material* F04Materials::GetMaterial(const G4String material) 0071 { 0072 G4Material* mat = fNistMan->FindOrBuildMaterial(material); 0073 0074 if (!mat) mat = G4Material::GetMaterial(material); 0075 if (!mat) { 0076 G4cout << material << "Not Found, Please Retry" << G4endl; 0077 } 0078 0079 return mat; 0080 } 0081 0082 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0083 0084 void F04Materials::CreateMaterials() 0085 { 0086 G4double density; 0087 std::vector<G4int> natoms; 0088 std::vector<G4double> fractionMass; 0089 std::vector<G4String> elements; 0090 0091 // Materials Definitions 0092 // ===================== 0093 0094 // Define Vacuum 0095 0096 fVacuum = fNistMan->FindOrBuildMaterial("G4_Galactic"); 0097 0098 // Define Air 0099 0100 fAir = fNistMan->FindOrBuildMaterial("G4_AIR"); 0101 0102 // Define BeO 0103 0104 fBeO = fNistMan->FindOrBuildMaterial("G4_BERYLLIUM_OXIDE"); 0105 0106 // Define Scintillator 0107 0108 elements.push_back("C"); 0109 natoms.push_back(9); 0110 elements.push_back("H"); 0111 natoms.push_back(10); 0112 0113 density = 1.032 * g / cm3; 0114 ; 0115 0116 fSci = fNistMan->ConstructNewMaterial("Scintillator", elements, natoms, density); 0117 0118 elements.clear(); 0119 natoms.clear(); 0120 0121 G4cout << G4endl << "The materials defined are: " << G4endl << G4endl; 0122 0123 G4cout << *(G4Material::GetMaterialTable()) << G4endl; 0124 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |