Back to home page

EIC code displayed by LXR

 
 

    


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

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 // G4tgbMaterialMgr
0027 //
0028 // Class description:
0029 //
0030 // Singleton class to manage the building of transient materials,
0031 // as well as the construction of the corresponding G4Material's.
0032 
0033 // Author: P.Arce, CIEMAT (November 2007)
0034 // --------------------------------------------------------------------
0035 #ifndef G4tgbMaterialMgr_hh
0036 #define G4tgbMaterialMgr_hh 1
0037 
0038 #include "globals.hh"
0039 
0040 #include "G4tgbIsotope.hh"
0041 #include "G4tgbElement.hh"
0042 #include "G4tgbMaterial.hh"
0043 
0044 #include "G4tgrIsotope.hh"
0045 #include "G4tgrElement.hh"
0046 #include "G4tgrElement.hh"
0047 #include "G4tgrMaterial.hh"
0048 
0049 #include "G4Isotope.hh"
0050 #include "G4Element.hh"
0051 #include "G4Material.hh"
0052 
0053 using G4mstgbisot = std::map<G4String, G4tgbIsotope*>;
0054 using G4mstgbelem = std::map<G4String, G4tgbElement*>;
0055 using G4mstgbmate = std::map<G4String, G4tgbMaterial*>;
0056 using G4msg4isot = std::map<G4String, G4Isotope*>;
0057 using G4msg4elem = std::map<G4String, G4Element*>;
0058 using G4msg4mate = std::map<G4String, G4Material*>;
0059 
0060 class G4tgbMaterialMgr
0061 {
0062   public:
0063 
0064     ~G4tgbMaterialMgr();
0065 
0066     static G4tgbMaterialMgr* GetInstance();
0067       // Get only instance (it it does not exists, create it)
0068 
0069     void CopyIsotopes();
0070       // Copy the G4tgrIsotopes into G4tgbIsotopes
0071     void CopyElements();
0072       // Copy the G4tgrElements into G4tgbElements
0073     void CopyMaterials();
0074       // Copy the G4tgrMaterials into G4tgbMaterials
0075 
0076     G4Isotope* FindOrBuildG4Isotope(const G4String& name);
0077       // Look for a G4Isotope that has to exists
0078       // (if not found create it from the corresponding G4tgbIsotope)
0079     G4Isotope* FindBuiltG4Isotope(const G4String& name) const;
0080       // Look for a G4Isotope and if not found return nullptr
0081     G4tgbIsotope* FindG4tgbIsotope(const G4String& name,
0082                                    G4bool bMustExist = false) const;
0083       // Look for a G4Isotope and if not found return nullptr
0084 
0085     G4Element* FindOrBuildG4Element(const G4String& name,
0086                                     G4bool bMustExist = true);
0087       // Look for a G4Element that has to exists by default
0088       // (if not found create it from the corresponding G4tgbElement)
0089     G4Element* FindBuiltG4Element(const G4String& name) const;
0090       // Look for a G4Element and if not found return nullptr
0091     G4tgbElement* FindG4tgbElement(const G4String& name,
0092                                    G4bool bMustExist = false) const;
0093       // Look for a G4Element and if not found return nullptr
0094 
0095     G4Material* FindOrBuildG4Material(const G4String& name,
0096                                       G4bool bMustExist = true);
0097       // Look for a G4Material that has to exists by default
0098       // (if not found create it from the corresponding G4tgbMaterial)
0099     G4Material* FindBuiltG4Material(const G4String& name) const;
0100       // Look for a G4Material and if not found return nullptr
0101     G4tgbMaterial* FindG4tgbMaterial(const G4String& name,
0102                                      G4bool bMustExist = false) const;
0103       // Look for a G4tgbMaterial and if not found return nullptr
0104 
0105     const G4msg4isot GetG4IsotopeList() const { return theG4Isotopes; }
0106     const G4msg4elem GetG4ElementList() const { return theG4Elements; }
0107     const G4msg4mate GetG4MaterialList() const { return theG4Materials; }
0108 
0109   private:
0110 
0111     G4tgbMaterialMgr();
0112       // Private Constructor
0113 
0114   private:
0115 
0116     static G4ThreadLocal G4tgbMaterialMgr* theInstance;
0117 
0118     G4mstgbisot theG4tgbIsotopes;
0119       // List of all tgbIsotopes created
0120     G4mstgbelem theG4tgbElements;
0121       // List of all tgbElements created
0122     G4mstgbmate theG4tgbMaterials;
0123       // List of all G4tgbMaterials created
0124     G4msg4isot theG4Isotopes;
0125       // Container of all G4Isotopes created
0126     G4msg4elem theG4Elements;
0127       // Container of all G4Elements created
0128     G4msg4mate theG4Materials;
0129       // Container of all G4Materials created
0130 };
0131 
0132 #endif