|
||||
File indexing completed on 2025-01-18 09:55:25
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 0014 /** \addtogroup Geant4Action 0015 * 0016 @{ 0017 \package Geant4UserParticleHandler 0018 * \brief Geant4ParticleHandler user extension action called by the particle handler. 0019 * 0020 * 0021 @} 0022 */ 0023 0024 0025 #ifndef DDG4_GEANT4USERPARTICLEHANDLER_H 0026 #define DDG4_GEANT4USERPARTICLEHANDLER_H 0027 0028 // Framework include files 0029 #include <DDG4/Geant4Data.h> 0030 #include <DDG4/Geant4Action.h> 0031 0032 // Forward declarations 0033 class G4Step; 0034 class G4Track; 0035 class G4Event; 0036 class G4SteppingManager; 0037 0038 0039 /// Namespace for the AIDA detector description toolkit 0040 namespace dd4hep { 0041 0042 /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit 0043 namespace sim { 0044 0045 // Forward declarations 0046 class Geant4Particle; 0047 class Geant4ParticleHandler; 0048 0049 /// Geant4ParticleHandler user extension action called by the particle handler. 0050 /** 0051 * Collect optional MC particle information and attach it to the particle object 0052 * Clients may inherit from this class and override the approriate methods 0053 * to add additional information in form of a DataExtension object to the Particle. 0054 * 0055 * The default implementation is always empty! 0056 * 0057 * @author M.Frank 0058 * @version 1.0 0059 */ 0060 class Geant4UserParticleHandler : public Geant4Action { 0061 public: 0062 typedef Geant4Particle Particle; 0063 0064 protected: 0065 /// Property: Energy cut below which particles are not collected, but assigned to the parent 0066 double m_kinEnergyCut; 0067 0068 public: 0069 /// Standard constructor 0070 Geant4UserParticleHandler(Geant4Context* context, const std::string& nam); 0071 /// Default destructor 0072 virtual ~Geant4UserParticleHandler(); 0073 /// Event generation action callback 0074 virtual void generate(G4Event* event, Geant4ParticleHandler* handler); 0075 /// Pre-event action callback 0076 virtual void begin(const G4Event* event); 0077 /// Post-event action callback 0078 virtual void end(const G4Event* event); 0079 0080 /// User stepping callback 0081 /** Allow the user to intercept particle handling in the pre track action. 0082 * The default implementation is empty. 0083 * 0084 * Note: The particle passed is a temporary and will be copied if kept. 0085 */ 0086 virtual void step(const G4Step* step, G4SteppingManager* mgr, Particle& particle); 0087 0088 /// Pre-track action callback. 0089 /** Allow the user to intercept particle handling in the pre track action. 0090 * e.g. attach relevant user information. 0091 * The default implementation is empty. 0092 * 0093 * Note: The particle passed is a temporary and will be copied if kept. 0094 */ 0095 virtual void begin(const G4Track* track, Particle& particle); 0096 0097 /// Post-track action callback 0098 /** Allow the user to force the particle handling in the post track action 0099 * set the reason mask to NULL in order to drop the particle. 0100 * The parent's reasoning mask will be or'ed with the particle's mask 0101 * to preserve the MC truth for the hit creation. 0102 * The default implementation is empty. 0103 * 0104 * Note: The particle passed is a temporary and will be copied if kept. 0105 */ 0106 virtual void end(const G4Track* track, Particle& particle); 0107 0108 /// Callback to be answered if the particle MUST be kept during recombination step 0109 /** Allow the user to force the particle handling either by 0110 * or the reason mask with G4PARTICLE_KEEP_USER or 0111 * to set the reason mask to NULL in order to drop it. 0112 * The default implementation is empty. 0113 * 0114 * If the reason mask entry is set to G4PARTICLE_FORCE_KILL 0115 * or is set to NULL, the particle is ALWAYS removed 0116 * 0117 * The default implementation calls 0118 * Geant4ParticleHandler::defaultKeepParticle(particle) 0119 * Please have a look therein if it suffices your needs! 0120 * 0121 * Note: This may override all other decisions! 0122 * Default implementation is empty. 0123 * 0124 */ 0125 virtual bool keepParticle(Particle& particle); 0126 0127 /// Callback when parent should be combined 0128 /** Called before a particle is removed from the final record. 0129 * Relevant particle properties of the parent may be updated. 0130 * The default implementation is empty. 0131 */ 0132 virtual void combine(Particle& to_be_deleted, Particle& remaining_parent); 0133 }; 0134 } // End namespace sim 0135 } // End namespace dd4hep 0136 0137 #endif // DDG4_GEANT4USERPARTICLEHANDLER_H
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |