00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id: G4tgrMaterialFactory.hh 69803 2013-05-15 15:24:50Z gcosmo $ 00028 // 00029 // 00030 // class G4tgrMaterialFactory 00031 // 00032 // Class description: 00033 // 00034 // Singleton class to manage the building of transient materials. 00035 00036 // History: 00037 // - Created. P.Arce, CIEMAT (November 2007) 00038 // ------------------------------------------------------------------------- 00039 00040 #ifndef G4tgrMaterialFactory_h 00041 #define G4tgrMaterialFactory_h 00042 00043 #include "globals.hh" 00044 00045 #include <map> 00046 00047 #include "G4tgrIsotope.hh" 00048 #include "G4tgrElementSimple.hh" 00049 #include "G4tgrElementFromIsotopes.hh" 00050 #include "G4tgrMaterial.hh" 00051 #include "G4tgrMaterialSimple.hh" 00052 #include "G4tgrMaterialMixture.hh" 00053 00054 typedef std::map< G4String, G4tgrIsotope* > G4mstgrisot; 00055 typedef std::map< G4String, G4tgrElement* > G4mstgrelem; 00056 typedef std::map< G4String, G4tgrMaterial* > G4mstgrmate; 00057 00058 class G4tgrMaterialFactory 00059 { 00060 public: // with decription 00061 00062 ~G4tgrMaterialFactory(); 00063 00064 static G4tgrMaterialFactory* GetInstance(); 00065 // Get only instance (it it does not exist, create it) 00066 00067 G4tgrIsotope* AddIsotope( const std::vector<G4String>& wl ); 00068 // Build a G4tgrIsotope 00069 00070 G4tgrElementSimple* AddElementSimple( const std::vector<G4String>& wl ); 00071 // Build a G4tgrElementSimple 00072 G4tgrElementFromIsotopes* AddElementFromIsotopes( const std::vector<G4String>& wl ); 00073 // Build a G4tgrElementFromIsotopes 00074 00075 G4tgrMaterialSimple* AddMaterialSimple( const std::vector<G4String>& wl ); 00076 // Build a G4tgrMaterialSimple and add it to the Materials list 00077 00078 G4tgrMaterialMixture* AddMaterialMixture( const std::vector<G4String>& wl, const G4String& mixtType ); 00079 // Build a G4tgrMaterialByWeight or G4tgrMaterialByNoAtoms 00080 // or G4tgrMaterialByVolume and add it to the Materials list 00081 00082 G4tgrIsotope* FindIsotope(const G4String& name) const; 00083 // Look for a G4tgrIsotope and if not found return 0 00084 00085 G4tgrElement* FindElement(const G4String& name) const; 00086 // Look for an G4tgrElement and if not found return 0 00087 00088 G4tgrMaterial* FindMaterial(const G4String& name) const; 00089 // Look for an G4tgrMaterial and if not found return 0 00090 00091 void DumpIsotopeList() const; 00092 // Dump detailed list of isotopes 00093 void DumpElementList() const; 00094 // Dump detailed list of elements 00095 void DumpMaterialList() const; 00096 // Dump detailed list of materials 00097 00098 public: // without description 00099 00100 const G4mstgrisot& GetIsotopeList() const {return theG4tgrIsotopes; } 00101 const G4mstgrelem& GetElementList() const {return theG4tgrElements; } 00102 const G4mstgrmate& GetMaterialList() const {return theG4tgrMaterials;} 00103 00104 private: 00105 00106 G4tgrMaterialFactory(); 00107 // Constructor 00108 00109 void ErrorAlreadyExists(const G4String& object, 00110 const std::vector<G4String>& wl, 00111 const G4bool bNoRepeating = true ); 00112 private: 00113 00114 static G4tgrMaterialFactory* theInstance; 00115 00116 G4mstgrisot theG4tgrIsotopes; 00117 // List of all G4tgrIsotopes created 00118 G4mstgrelem theG4tgrElements; 00119 // List of all G4tgrElements created 00120 G4mstgrmate theG4tgrMaterials; 00121 // List of all G4tgrMaterials created 00122 }; 00123 00124 #endif