|
||||
File indexing completed on 2025-01-18 09:55:23
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_GEANT4FASTSIMSHOWERMODEL_H 0014 #define DDG4_GEANT4FASTSIMSHOWERMODEL_H 0015 0016 // Framework include files 0017 #include <DDG4/Geant4DetectorConstruction.h> 0018 0019 // Geant4 include files 0020 #include <G4FastSimulationPhysics.hh> 0021 0022 // C/C++ include files 0023 #include <set> 0024 #include <vector> 0025 #include <memory> 0026 0027 /// Forward declarations 0028 class G4FastStep; 0029 class G4FastTrack; 0030 class G4ParticleDefinition; 0031 class G4VFastSimulationModel; 0032 0033 /// Namespace for the AIDA detector description toolkit 0034 namespace dd4hep { 0035 0036 /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit 0037 namespace sim { 0038 0039 /// Forard declarations 0040 class Geant4ShowerModelWrapper; 0041 0042 /// Geant4 wrapper for the Geant4 fast simulation shower model 0043 /** 0044 * Geant4 wrapper for the Geant4 fast simulation shower model 0045 * 0046 * \author M.Frank 0047 * \version 1.0 0048 * \ingroup DD4HEP_SIMULATION 0049 */ 0050 class Geant4FastSimShowerModel : public Geant4DetectorConstruction { 0051 protected: 0052 // typedef std::vector<std::pair<std::string, double> > ParticleConfig; 0053 typedef std::map<const G4ParticleDefinition*, double> ParticleCut; 0054 typedef std::map<std::string, std::string> ParticleConfig; 0055 typedef Geant4ShowerModelWrapper* Wrapper; 0056 0057 /// Property: Region name to which this parametrization should be applied 0058 std::string m_regionName { "Region-name-not-specified"}; 0059 /// Property: Particle names for which this parametrization is applicable 0060 std::vector<std::string> m_applicablePartNames { }; 0061 /// Property: Parametrisation control: Enable/disable fast simulation 0062 bool m_enable { false }; 0063 /// Property: Defines step length 0064 double m_stepX0 { 0.1 }; 0065 /// Property: Set minimum kinetic energy to trigger parametrisation 0066 ParticleConfig m_eMin { }; 0067 /// Property: Set maximum kinetic energy to trigger parametrisation 0068 ParticleConfig m_eMax { }; 0069 /// Property: Set maximum kinetic energy for particles to be killed 0070 ParticleConfig m_eKill { }; 0071 /// Property: Set minimal kinetic energy for particles to trigger the model 0072 ParticleConfig m_eTriggerNames { }; 0073 0074 /// Particle definitions for which this parametrization is applicable 0075 std::set<const G4ParticleDefinition*> m_applicableParticles { }; 0076 /// Particle cut to trigger model simulation indexed by G4ParticleDefinition 0077 ParticleCut m_eTriggerCut { }; 0078 /// Reference to the G4 fast simulation model 0079 G4VFastSimulationModel* m_model { nullptr }; 0080 /// Reference to the shower model 0081 Wrapper m_wrapper { nullptr }; 0082 0083 protected: 0084 /// Define standard assignments and constructors 0085 DDG4_DEFINE_ACTION_CONSTRUCTORS(Geant4FastSimShowerModel); 0086 0087 /// Get parametrization material 0088 G4Material* getMaterial(const std::string& name) const; 0089 /// Access particle definition from string 0090 G4ParticleDefinition* getParticleDefinition(const std::string& name) const; 0091 /// Access the region from the detector description by name 0092 G4Region* getRegion(const std::string& nam) const; 0093 /// Add shower model to region's fast simulation manager 0094 void addShowerModel(G4Region* region); 0095 /// Kill primary particle when creating the shower 0096 void killParticle(G4FastStep& step, double deposit, double step_length = 0e0); 0097 0098 public: 0099 /// Standard constructor 0100 Geant4FastSimShowerModel(Geant4Context* context, const std::string& nam); 0101 0102 /// Default destructor 0103 virtual ~Geant4FastSimShowerModel(); 0104 0105 /// Geometry construction callback. Called at "Construct()" 0106 virtual void constructGeo(Geant4DetectorConstructionContext* ctxt); 0107 /// Electromagnetic field construction callback. Called at "ConstructSDandField()" 0108 virtual void constructField(Geant4DetectorConstructionContext* ctxt); 0109 /// Sensitive detector construction callback. Called at "ConstructSDandField()" 0110 virtual void constructSensitives(Geant4DetectorConstructionContext* ctxt); 0111 0112 /// User callback to determine if the model is applicable for the particle type 0113 virtual bool check_applicability(const G4ParticleDefinition& particle); 0114 /// User callback to determine if the shower creation should be triggered 0115 virtual bool check_trigger(const G4FastTrack& track); 0116 /// User callback to model the particle/energy shower 0117 virtual void modelShower(const G4FastTrack& track, G4FastStep& step); 0118 }; 0119 0120 0121 /// Geant4 wrapper for the Geant4 fast simulation shower model 0122 /** 0123 * Geant4 wrapper for the Geant4 fast simulation shower model 0124 * 0125 * \author M.Frank 0126 * \version 1.0 0127 * \ingroup DD4HEP_SIMULATION 0128 */ 0129 template <typename CONCRETE_MODEL> 0130 class Geant4FSShowerModel : public Geant4FastSimShowerModel { 0131 0132 public: 0133 /// Local parameter buffer to specialize caches, properties etc. 0134 CONCRETE_MODEL locals; 0135 0136 public: 0137 /// Standard constructor 0138 Geant4FSShowerModel(Geant4Context* context, const std::string& nam); 0139 0140 /// Default destructor 0141 virtual ~Geant4FSShowerModel(); 0142 0143 /// Declare optional properties from embedded structure 0144 void initialize(); 0145 0146 /// Geometry construction callback. Called at "Construct()" 0147 virtual void constructGeo(Geant4DetectorConstructionContext* ctxt) override; 0148 0149 /// Electromagnetic field construction callback. Called at "ConstructSDandField()" 0150 virtual void constructField(Geant4DetectorConstructionContext* ctxt) override; 0151 0152 /// Sensitive detector construction callback. Called at "ConstructSDandField()" 0153 virtual void constructSensitives(Geant4DetectorConstructionContext* ctxt) override; 0154 0155 /// User callback to determine if the model is applicable for the particle type 0156 /** Default implementation checks if the particle is registered in 'ApplicableParticles' 0157 */ 0158 virtual bool check_applicability(const G4ParticleDefinition& particle) override; 0159 0160 /// User callback to determine if the shower creation should be triggered 0161 /** Default implementation checks if for all particles registered in 'Etrigger' 0162 * the kinetic energy is bigger than the value. 0163 */ 0164 virtual bool check_trigger(const G4FastTrack& track) override; 0165 0166 /// User callback to model the particle/energy shower 0167 virtual void modelShower(const G4FastTrack& track, G4FastStep& step) override; 0168 }; 0169 } /* End namespace sim */ 0170 } /* End namespace dd4hep */ 0171 #endif // DDG4_GEANT4FASTSIMSHOWERMODEL_H
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |