Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:59:14

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