Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:10

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 // G4tgrMaterialFactory
0027 //
0028 // Class description:
0029 //
0030 // Singleton class to manage the building of transient materials.
0031 
0032 // Author: P.Arce, CIEMAT (November 2007)
0033 // --------------------------------------------------------------------
0034 #ifndef G4tgrMaterialFactory_hh
0035 #define G4tgrMaterialFactory_hh 1
0036 
0037 #include <map>
0038 
0039 #include "globals.hh"
0040 
0041 #include "G4tgrIsotope.hh"
0042 #include "G4tgrElementSimple.hh"
0043 #include "G4tgrElementFromIsotopes.hh"
0044 #include "G4tgrMaterial.hh"
0045 #include "G4tgrMaterialSimple.hh"
0046 #include "G4tgrMaterialMixture.hh"
0047 
0048 using G4mstgrisot = std::map<G4String, G4tgrIsotope*>;
0049 using G4mstgrelem = std::map<G4String, G4tgrElement*>;
0050 using G4mstgrmate = std::map<G4String, G4tgrMaterial*>;
0051 
0052 class G4tgrMaterialFactory
0053 {
0054   public:
0055 
0056     ~G4tgrMaterialFactory();
0057 
0058     static G4tgrMaterialFactory* GetInstance();
0059       // Get only instance (it it does not exist, create it)
0060 
0061     G4tgrIsotope* AddIsotope(const std::vector<G4String>& wl);
0062       // Build a G4tgrIsotope
0063 
0064     G4tgrElementSimple* AddElementSimple(const std::vector<G4String>& wl);
0065       // Build a G4tgrElementSimple
0066     G4tgrElementFromIsotopes*
0067     AddElementFromIsotopes(const std::vector<G4String>& wl);
0068       // Build a G4tgrElementFromIsotopes
0069 
0070     G4tgrMaterialSimple* AddMaterialSimple(const std::vector<G4String>& wl);
0071       // Build a G4tgrMaterialSimple and add it to the Materials list
0072 
0073     G4tgrMaterialMixture* AddMaterialMixture(const std::vector<G4String>& wl,
0074                                              const G4String& mixtType);
0075       // Build a G4tgrMaterialByWeight or G4tgrMaterialByNoAtoms
0076       // or G4tgrMaterialByVolume and add it to the Materials list
0077 
0078     G4tgrIsotope* FindIsotope(const G4String& name) const;
0079       // Look for a G4tgrIsotope and if not found return 0
0080 
0081     G4tgrElement* FindElement(const G4String& name) const;
0082       // Look for an G4tgrElement and if not found return 0
0083 
0084     G4tgrMaterial* FindMaterial(const G4String& name) const;
0085       // Look for an G4tgrMaterial and if not found return 0
0086 
0087     void DumpIsotopeList() const;
0088       // Dump detailed list of isotopes
0089     void DumpElementList() const;
0090       // Dump detailed list of elements
0091     void DumpMaterialList() const;
0092       // Dump detailed list of materials
0093 
0094     const G4mstgrisot& GetIsotopeList() const { return theG4tgrIsotopes; }
0095     const G4mstgrelem& GetElementList() const { return theG4tgrElements; }
0096     const G4mstgrmate& GetMaterialList() const { return theG4tgrMaterials; }
0097 
0098   private:
0099 
0100     G4tgrMaterialFactory();
0101       // Constructor
0102 
0103     void ErrorAlreadyExists(const G4String& object,
0104                             const std::vector<G4String>& wl,
0105                             const G4bool bNoRepeating = true);
0106 
0107   private:
0108 
0109     static G4ThreadLocal G4tgrMaterialFactory* theInstance;
0110 
0111     G4mstgrisot theG4tgrIsotopes;
0112       // List of all G4tgrIsotopes created
0113     G4mstgrelem theG4tgrElements;
0114       // List of all G4tgrElements created
0115     G4mstgrmate theG4tgrMaterials;
0116       // List of all G4tgrMaterials created
0117 };
0118 
0119 #endif