Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // G4PhysicsListHelper 27 // 28 // Class description: 29 // 30 // Helper class for physics lists, to register processes according 31 // to the ordering parameter table. This class is a singleton. 32 33 // Author: H.Kurashige, 29 April 2011 34 // -------------------------------------------------------------------- 35 #ifndef G4PhysicsListHelper_hh 36 #define G4PhysicsListHelper_hh 1 37 38 #include "G4ParticleDefinition.hh" 39 #include "G4ParticleTable.hh" 40 #include "G4PhysicsListOrderingParameter.hh" 41 #include "G4ThreadLocalSingleton.hh" 42 #include "G4ios.hh" 43 #include "globals.hh" 44 45 #include <vector> 46 47 class G4VProcess; 48 49 class G4PhysicsListHelper 50 { 51 friend class G4ThreadLocalSingleton<G4PhysicsListHelper>; 52 53 public: 54 // Returns the pointer to the physics list helper 55 static G4PhysicsListHelper* GetPhysicsListHelper(); 56 57 // Registers a process to the particle type according to the ordering 58 // parameter table. Returns 'true' if process is successfully registered. 59 G4bool RegisterProcess(G4VProcess* process, G4ParticleDefinition* particle); 60 61 // User must invoke this method in his ConstructProcess() implementation 62 // in order to enable particle transportation. 63 void AddTransportation(); 64 65 // Set flag for using G4CoupledTransportation. 66 void UseCoupledTransportation(G4bool vl = true); 67 68 // Change the thresholds for killing looping tracks in transportation. 69 void UseHighLooperThresholds() { theLooperThresholds = 2; } 70 void UseLowLooperThresholds() { theLooperThresholds = 0; } 71 72 // Check consistencies of list of particles. 73 void CheckParticleList() const; 74 75 // Dump OrdingParameterTable. 76 void DumpOrdingParameterTable(G4int subType = -1) const; 77 78 G4PhysicsListOrderingParameter GetOrdingParameter(G4int subType) const; 79 80 // set/get controle flag for output message 81 // 0: Silent 82 // 1: Warning message 83 // 2: More 84 void SetVerboseLevel(G4int value); 85 G4int GetVerboseLevel() const; 86 87 private: 88 // Hidden constructor and destructor. 89 G4PhysicsListHelper(); 90 ~G4PhysicsListHelper(); 91 92 void ReadOrdingParameterTable(); 93 void ReadInDefaultOrderingParameter(); 94 95 private: 96 using G4OrdParamTable = std::vector<G4PhysicsListOrderingParameter>; 97 98 static G4ThreadLocal G4PhysicsListHelper* pPLHelper; 99 100 // The particle table has the complete List of existing particle types. 101 G4ParticleTable* theParticleTable = nullptr; 102 G4ParticleTable::G4PTblDicIterator* aParticleIterator = nullptr; 103 104 G4bool useCoupledTransportation = false; 105 G4int theLooperThresholds = 1; // 0 = Low, 1 = default, 2 = high 106 G4VProcess* theTransportationProcess = nullptr; 107 108 G4int verboseLevel = 1; 109 110 G4OrdParamTable* theTable = nullptr; 111 G4int sizeOfTable = 0; 112 G4String ordParamFileName = ""; 113 }; 114 115 // Inline methods implementations 116 117 inline void G4PhysicsListHelper::UseCoupledTransportation(G4bool vl) 118 { 119 useCoupledTransportation = vl; 120 } 121 122 inline void G4PhysicsListHelper::SetVerboseLevel(G4int value) 123 { 124 verboseLevel = value; 125 } 126 127 inline G4int G4PhysicsListHelper::GetVerboseLevel() const 128 { 129 return verboseLevel; 130 } 131 132 #endif 133