|
||||
File indexing completed on 2025-01-18 09:14:20
0001 //========================================================================== 0002 // AIDA Detector description implementation 0003 //-------------------------------------------------------------------------- 0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) 0005 // All rights reserved. 0006 // 0007 // For the licensing terms see $DD4hepINSTALL/LICENSE. 0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS. 0009 // 0010 // Author : M.Frank 0011 // 0012 //========================================================================== 0013 #ifndef DDG4_GEANT4FASTPHYSICS_H 0014 #define DDG4_GEANT4FASTPHYSICS_H 0015 0016 // Framework include files 0017 #include <DDG4/Geant4Action.h> 0018 #include <DDG4/Geant4PhysicsList.h> 0019 0020 // Geant4 include files 0021 #include <G4VModularPhysicsList.hh> 0022 class G4FastSimulationPhysics; 0023 0024 // C/C++ include files 0025 #include <vector> 0026 0027 /// Namespace for the AIDA detector description toolkit 0028 namespace dd4hep { 0029 0030 /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit 0031 namespace sim { 0032 0033 /// Wrapper for G4FastSimulationPhysics with properties 0034 /** 0035 * Wrapper for G4FastSimulationPhysics with properties. 0036 * The properties supposedly are used to fully configure the object 0037 * in 'ConstructProcess'. 0038 * 0039 * \author M.Frank 0040 * 0041 * \version 1.0 0042 * \ingroup DD4HEP_SIMULATION 0043 */ 0044 class Geant4FastPhysics : public Geant4PhysicsList { 0045 protected: 0046 /// Define standard assignments and constructors 0047 DDG4_DEFINE_ACTION_CONSTRUCTORS(Geant4FastPhysics); 0048 0049 /// Vector of particle names for which fast simulation is enabled 0050 std::vector<std::string> m_enabledParticles; 0051 /// Property to set verbosity flag on G4FastSimulationPhysics 0052 bool m_verbose { false }; 0053 0054 /// Reference to fast physics object 0055 G4FastSimulationPhysics* m_fastPhysics { nullptr }; 0056 0057 public: 0058 /// Standard constructor 0059 Geant4FastPhysics(Geant4Context* context, const std::string& nam); 0060 0061 /// Default destructor 0062 virtual ~Geant4FastPhysics() = default; 0063 0064 /// constructPhysics callback 0065 virtual void constructPhysics(G4VModularPhysicsList* physics) override; 0066 }; 0067 } /* End namespace sim */ 0068 } /* End namespace dd4hep */ 0069 #endif // DDG4_GEANT4FASTPHYSICS_H 0070 0071 //========================================================================== 0072 // AIDA Detector description implementation 0073 //-------------------------------------------------------------------------- 0074 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) 0075 // All rights reserved. 0076 // 0077 // For the licensing terms see $DD4hepINSTALL/LICENSE. 0078 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS. 0079 // 0080 // Author : M.Frank 0081 // 0082 //========================================================================== 0083 0084 /// Framework include files 0085 // #include <DDG4/Geant4FastPhysics.h> 0086 0087 // Geant4 include files 0088 #include <G4FastSimulationPhysics.hh> 0089 0090 using namespace dd4hep::sim; 0091 0092 /// Standard constructor 0093 Geant4FastPhysics::Geant4FastPhysics(Geant4Context* ctxt, const std::string& nam) 0094 : Geant4PhysicsList(ctxt, nam) 0095 { 0096 declareProperty("EnabledParticles", m_enabledParticles); 0097 declareProperty("BeVerbose", m_verbose); 0098 } 0099 0100 /// constructPhysics callback 0101 void Geant4FastPhysics::constructPhysics(G4VModularPhysicsList* physics) { 0102 /// Create and configure the fast simulation object according to properties 0103 m_fastPhysics = new G4FastSimulationPhysics(this->name()); 0104 if ( this->m_verbose ) m_fastPhysics->BeVerbose(); 0105 0106 /// attach the particles the fast simulation object should act on 0107 for( const auto& part_name : m_enabledParticles ) { 0108 this->info("Enable fast simulation for particle type: %s", part_name.c_str()); 0109 m_fastPhysics->ActivateFastSimulation(part_name); 0110 } 0111 /// -- Register this fastSimulationPhysics to the physicsList, 0112 /// -- when the physics list will be called by the run manager 0113 /// -- (will happen at initialization of the run manager) 0114 /// -- for physics process construction, the fast simulation 0115 /// -- configuration will be applied as well. 0116 physics->RegisterPhysics(m_fastPhysics); 0117 this->info("Constructed and initialized Geant4 Fast Physics [G4FastSimulationPhysics]."); 0118 } 0119 0120 #include <DDG4/Factories.h> 0121 DECLARE_GEANT4ACTION(Geant4FastPhysics)
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |