Back to home page

EIC code displayed by LXR

 
 

    


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

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 // G4PhysicsListHelper
0027 //
0028 // Class description:
0029 //
0030 // Helper class for physics lists, to register processes according
0031 // to the ordering parameter table. This class is a singleton.
0032 
0033 // Author: H.Kurashige, 29 April 2011
0034 // --------------------------------------------------------------------
0035 #ifndef G4PhysicsListHelper_hh
0036 #define G4PhysicsListHelper_hh 1
0037 
0038 #include "G4ParticleDefinition.hh"
0039 #include "G4ParticleTable.hh"
0040 #include "G4PhysicsListOrderingParameter.hh"
0041 #include "G4ThreadLocalSingleton.hh"
0042 #include "G4ios.hh"
0043 #include "globals.hh"
0044 
0045 #include <vector>
0046 
0047 class G4VProcess;
0048 
0049 class G4PhysicsListHelper
0050 {
0051     friend class G4ThreadLocalSingleton<G4PhysicsListHelper>;
0052 
0053   public:
0054     // Returns the pointer to the physics list helper
0055     static G4PhysicsListHelper* GetPhysicsListHelper();
0056 
0057     // Registers a process to the particle type according to the ordering
0058     // parameter table. Returns 'true' if process is successfully registered.
0059     G4bool RegisterProcess(G4VProcess* process, G4ParticleDefinition* particle);
0060 
0061     // User must invoke this method in his ConstructProcess() implementation
0062     // in order to enable particle transportation.
0063     void AddTransportation();
0064 
0065     // Set flag for using G4CoupledTransportation.
0066     void UseCoupledTransportation(G4bool vl = true);
0067 
0068     // Change the thresholds for killing looping tracks in transportation.
0069     void UseHighLooperThresholds() { theLooperThresholds = 2; }
0070     void UseLowLooperThresholds() { theLooperThresholds = 0; }
0071 
0072     // Check consistencies of list of particles.
0073     void CheckParticleList() const;
0074 
0075     // Dump OrdingParameterTable.
0076     void DumpOrdingParameterTable(G4int subType = -1) const;
0077 
0078     G4PhysicsListOrderingParameter GetOrdingParameter(G4int subType) const;
0079 
0080     // set/get controle flag for output message
0081     //  0: Silent
0082     //  1: Warning message
0083     //  2: More
0084     void SetVerboseLevel(G4int value);
0085     G4int GetVerboseLevel() const;
0086 
0087   private:
0088     // Hidden constructor and destructor.
0089     G4PhysicsListHelper();
0090     ~G4PhysicsListHelper();
0091 
0092     void ReadOrdingParameterTable();
0093     void ReadInDefaultOrderingParameter();
0094 
0095   private:
0096     using G4OrdParamTable = std::vector<G4PhysicsListOrderingParameter>;
0097 
0098     static G4ThreadLocal G4PhysicsListHelper* pPLHelper;
0099 
0100     // The particle table has the complete List of existing particle types.
0101     G4ParticleTable* theParticleTable = nullptr;
0102     G4ParticleTable::G4PTblDicIterator* aParticleIterator = nullptr;
0103 
0104     G4bool useCoupledTransportation = false;
0105     G4int theLooperThresholds = 1;  //  0 = Low,  1 = default, 2 = high
0106     G4VProcess* theTransportationProcess = nullptr;
0107 
0108     G4int verboseLevel = 1;
0109 
0110     G4OrdParamTable* theTable = nullptr;
0111     G4int sizeOfTable = 0;
0112     G4String ordParamFileName = "";
0113 };
0114 
0115 // Inline methods implementations
0116 
0117 inline void G4PhysicsListHelper::UseCoupledTransportation(G4bool vl)
0118 {
0119   useCoupledTransportation = vl;
0120 }
0121 
0122 inline void G4PhysicsListHelper::SetVerboseLevel(G4int value)
0123 {
0124   verboseLevel = value;
0125 }
0126 
0127 inline G4int G4PhysicsListHelper::GetVerboseLevel() const
0128 {
0129   return verboseLevel;
0130 }
0131 
0132 #endif