Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:56

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 //
0028 //
0029 // -------------------------------------------------------------------
0030 //
0031 // GEANT4 Class header file
0032 //
0033 //
0034 // File name:    G4PhysListRegistry
0035 //
0036 // Author  R. Hatcher  2014-10-15
0037 //
0038 // Modifications:  based on G4PhysicsConstructorRegistry
0039 //
0040 //
0041 // Class Description
0042 // This is a singleton keeping pointers to all physics lists
0043 // Class Description - End
0044 
0045 #ifndef G4PhysListRegistry_hh
0046 #define G4PhysListRegistry_hh 1
0047 
0048 #include <vector>
0049 #include <map>
0050 #include "globals.hh"
0051 
0052 
0053 class G4VModularPhysicsList;
0054 class G4VBasePhysListStamper;
0055 
0056 class G4PhysListRegistry
0057 {
0058 public:
0059 
0060   static G4PhysListRegistry* Instance();
0061   // access
0062 
0063   ~G4PhysListRegistry();
0064 
0065   void AddFactory(G4String name, G4VBasePhysListStamper*);
0066   void AddPhysicsExtension(G4String name, G4String procname);
0067   // mapping from extension name to actual physics contructor process name
0068 
0069   G4VModularPhysicsList* GetModularPhysicsList(const G4String& name);
0070   G4VModularPhysicsList* GetModularPhysicsListFromEnv();
0071 
0072   G4bool IsReferencePhysList(G4String nam) const;
0073 
0074   const std::vector<G4String>&  AvailablePhysLists() const;
0075   const std::vector<G4String>&  AvailablePhysicsExtensions() const;
0076   const std::vector<G4String>&  AvailablePhysListsEM() const;
0077 
0078   void PrintAvailablePhysLists() const;
0079 
0080   G4bool DeconstructPhysListName(const G4String& name, G4String& plBase,
0081                                  std::vector<G4String>& physExt,
0082                                  std::vector<G4int>& replace,
0083                                  G4int verbose=0) const;
0084 
0085   G4bool FindLongestMatch(const G4String& workName,
0086                           const G4String& searchName,
0087                           const std::vector<G4String>& validNames,
0088                           G4String& bestMatch,
0089                           G4int verbose=0) const;
0090 
0091   inline void  SetVerbose(G4int val) { verbose = val; }
0092   inline G4int GetVerbose() const { return verbose; }
0093 
0094   inline void  SetUnknownFatal(G4int val) { unknownFatal = val; }
0095   inline G4int GetUnknownFatal() const { return unknownFatal; }
0096 
0097          void      SetUserDefaultPhysList(const G4String& name="");
0098   inline G4String  GetUserDefaultPhysList() const { return userDefault; }
0099   // set a prefered list in case where $PHYSLIST isn't defined
0100   // if not set (or called with "") this falls back to system default
0101 
0102   inline G4String  GetSystemDefaultPhysList() const { return systemDefault; }
0103 
0104 private:
0105 
0106   G4PhysListRegistry();
0107 
0108   static G4ThreadLocal G4PhysListRegistry* theInstance;
0109 
0110   std::map <G4String, G4VBasePhysListStamper*> factories;
0111   std::map <G4String, G4String> physicsExtensions;
0112 
0113   G4int    verbose;
0114   G4int    unknownFatal;  /// throw an exception if unsatisfiable?
0115   G4String userDefault;   /// use this if $PHYSLIST isn't set
0116   G4String systemDefault; /// use this if user hasn't set userDefault
0117                           /// or attempts to set the userDefault=""
0118 
0119   // Make these mutable and update them on each request because the map might
0120   // have been updated by the addition of new entries
0121   // The only reason to have them at all is that that original interface
0122   // returned a const reference and so we can't pass back a local object
0123   // created upon the call of the method
0124   mutable std::vector<G4String> availBasePhysLists;
0125   mutable std::vector<G4String> availExtensions;
0126 
0127 };
0128 
0129 #endif