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$ 00028 // 00029 // 00030 // ------------------------------------------------------------ 00031 // GEANT 4 class header file 00032 // 00033 // Class Description: 00034 // This class is a subclass of G4VUserPhysicsList. 00035 // The user should register his/her physics constructors 00036 // by using 00037 // G4VModularPhysicsList::RegsiterPhysics() 00038 // to construt particles and processes. 00039 // 00040 // Only one physics constructor can be registered for each "physics_type". 00041 // Physics constructors with same "physics_type" can be replaced by 00042 // G4VModularPhysicsList::ReplacePhysics() method 00043 // 00044 // ------------------------------------------------------------ 00045 // History 00046 // - first version 12 Nov 2000 by H.Kurashige 00047 // - Add ReplacePhysics 14 Mar 2011 by H.Kurashige 00048 // 00049 // ------------------------------------------------------------ 00050 #ifndef G4VModularPhysicsList_h 00051 #define G4VModularPhysicsList_h 1 00052 00053 #include "globals.hh" 00054 #include "G4ios.hh" 00055 #include <vector> 00056 00057 #include "G4VUserPhysicsList.hh" 00058 #include "G4VPhysicsConstructor.hh" 00059 00060 class G4VModularPhysicsList: public virtual G4VUserPhysicsList 00061 { 00062 public: 00063 G4VModularPhysicsList(); 00064 virtual ~G4VModularPhysicsList(); 00065 00066 protected: 00067 // hide copy constructor and assignment operator 00068 G4VModularPhysicsList(const G4VModularPhysicsList&); 00069 G4VModularPhysicsList & operator=(const G4VModularPhysicsList&); 00070 00071 public: // with description 00072 // This method will be invoked in the Construct() method. 00073 // each particle type will be instantiated 00074 virtual void ConstructParticle(); 00075 00076 // This method will be invoked in the Construct() method. 00077 // each physics process will be instantiated and 00078 // registered to the process manager of each particle type 00079 virtual void ConstructProcess(); 00080 00081 public: // with description 00082 // Register Physics Constructor 00083 void RegisterPhysics(G4VPhysicsConstructor* ); 00084 00085 const G4VPhysicsConstructor* GetPhysics(G4int index) const; 00086 const G4VPhysicsConstructor* GetPhysics(const G4String& name) const; 00087 const G4VPhysicsConstructor* GetPhysicsWithType(G4int physics_type) const; 00088 00089 // Replace Physics Constructor 00090 // The existing physics constructor with same physics_type as one of 00091 // the given physics constructor is replaced 00092 // (existing physics will be deleted) 00093 // If any corresponding physics constructor is found, 00094 // the given physics constructor is just added 00095 void ReplacePhysics(G4VPhysicsConstructor* ); 00096 00097 // Remove Physics Constructor from the list 00098 void RemovePhysics(G4VPhysicsConstructor* ); 00099 void RemovePhysics(G4int type); 00100 void RemovePhysics(const G4String& name); 00101 00103 public: // with description 00104 void SetVerboseLevel(G4int value); 00105 G4int GetVerboseLevel() const; 00106 // set/get controle flag for output message 00107 // 0: Silent 00108 // 1: Warning message 00109 // 2: More 00110 // given verbose level is set to all physics constructors 00111 00112 protected: // with description 00113 // vector of pointers to G4VPhysicsConstructor 00114 typedef std::vector<G4VPhysicsConstructor*> G4PhysConstVector; 00115 G4PhysConstVector* physicsVector; 00116 G4int verboseLevel; 00117 }; 00118 00119 00120 00121 inline 00122 G4int G4VModularPhysicsList::GetVerboseLevel() const 00123 { 00124 return verboseLevel; 00125 } 00126 00127 00128 #endif