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 // Class Description: 00033 // This class is an virtual class for constructing 00034 // particles and processes. This class objects will be 00035 // registered to G4VPhysicsList. 00036 // 00037 // User must implement following four virtual methods 00038 // in his own concrete class derived from this class. 00039 // 00040 // all necessary particle type will be instantiated 00041 // virtual void ConstructParticle(); 00042 // 00043 // all physics processes will be instantiated and 00044 // registered to the process manager of each particle type 00045 // virtual void ConstructProcess(); 00046 // 00047 // Only one physics constructor can be registered to 00048 // Modular Physics List for each "physics_type". 00049 // Physics constructors with same "physics_type" can be 00050 // replaced by using the method of 00051 // G4VModularPhysicsList::ReplacePhysics() 00052 // 00053 // 00054 // ------------------------------------------- 00055 // History 00056 // first version 12 Nov. 2000 by H.Kurashige 00057 // Add physicsType 14 Mar. 2011 by H.Kurashige 00058 // Add RegisterProcess 1 May 2011 by H.Kurashige 00059 // ------------------------------------------------------------ 00060 #ifndef G4VPhysicsConstructor_h 00061 #define G4VPhysicsConstructor_h 1 00062 00063 #include "globals.hh" 00064 #include "G4ios.hh" 00065 #include "G4ParticleTable.hh" 00066 #include "G4PhysicsListHelper.hh" 00067 00068 class G4VPhysicsConstructor 00069 { 00070 public: // with description 00071 00072 G4VPhysicsConstructor(const G4String& =""); 00073 G4VPhysicsConstructor(const G4String& name, G4int physics_type); 00074 virtual ~G4VPhysicsConstructor(); 00075 00076 virtual void ConstructParticle()=0; 00077 // This method will be invoked in the Construct() method. 00078 // each particle type will be instantiated 00079 00080 virtual void ConstructProcess()=0; 00081 // This method will be invoked in the Construct() method. 00082 // each physics process will be instantiated and 00083 // registered to the process manager of each particle type 00084 00085 inline void SetPhysicsName(const G4String& =""); 00086 inline const G4String& GetPhysicsName() const; 00087 00088 inline void SetPhysicsType(G4int); 00089 inline G4int GetPhysicsType() const; 00090 00091 inline void SetVerboseLevel(G4int value); 00092 inline G4int GetVerboseLevel() const; 00093 // set/get controle flag for output message 00094 // 0: Silent 00095 // 1: Warning message 00096 // 2: More 00097 // verbose level is set equal to physics list when registered 00098 00099 protected: 00100 00101 inline G4bool RegisterProcess(G4VProcess* process, 00102 G4ParticleDefinition* particle); 00103 // Register a process to the particle type 00104 // according to the ordering parameter table 00105 // 'true' is returned if the process is registerd successfully 00106 00107 protected: 00108 G4int verboseLevel; 00109 G4String namePhysics; 00110 G4int typePhysics; 00111 00112 G4ParticleTable* theParticleTable; 00113 G4ParticleTable::G4PTblDicIterator* theParticleIterator; 00114 // the particle table has the complete List of existing particle types 00115 00116 G4PhysicsListHelper* thePLHelper; 00117 }; 00118 00119 // Inlined methods 00120 00121 inline void G4VPhysicsConstructor::SetVerboseLevel(G4int value) 00122 { 00123 verboseLevel = value; 00124 } 00125 00126 inline G4int G4VPhysicsConstructor::GetVerboseLevel() const 00127 { 00128 return verboseLevel; 00129 } 00130 00131 inline void G4VPhysicsConstructor::SetPhysicsName(const G4String& name) 00132 { 00133 namePhysics = name; 00134 } 00135 00136 inline const G4String& G4VPhysicsConstructor::GetPhysicsName() const 00137 { 00138 return namePhysics; 00139 } 00140 00141 inline void G4VPhysicsConstructor::SetPhysicsType(G4int val) 00142 { 00143 if (val>0) typePhysics = val; 00144 } 00145 00146 inline G4int G4VPhysicsConstructor::GetPhysicsType() const 00147 { 00148 return typePhysics; 00149 } 00150 00151 inline 00152 G4bool G4VPhysicsConstructor::RegisterProcess(G4VProcess* process, 00153 G4ParticleDefinition* particle) 00154 { 00155 return thePLHelper->RegisterProcess(process, particle); 00156 } 00157 #endif 00158 00159 00160 00161