|
||||
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 DD4HEP_DDG4_GEANT4PARTICLEDUMPACTION_H 0014 #define DD4HEP_DDG4_GEANT4PARTICLEDUMPACTION_H 0015 0016 // Framework include files 0017 #include <DDG4/Geant4EventAction.h> 0018 0019 // Forward declarations 0020 class G4VHitsCollection; 0021 0022 /// Namespace for the AIDA detector description toolkit 0023 namespace dd4hep { 0024 0025 /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit 0026 namespace sim { 0027 0028 // Forward declarations 0029 class Geant4ParticleMap; 0030 0031 /// Class to measure the energy of escaping tracks 0032 /** Class to measure the energy of escaping tracks of a detector using Geant 4 0033 * Measure escaping energy.... 0034 * 0035 * \author M.Frank 0036 * \version 1.0 0037 * \ingroup DD4HEP_SIMULATION 0038 */ 0039 class Geant4ParticleDumpAction : public Geant4EventAction { 0040 public: 0041 /// Standard constructor 0042 Geant4ParticleDumpAction(Geant4Context* context, const std::string& nam); 0043 /// Default destructor 0044 virtual ~Geant4ParticleDumpAction(); 0045 /// Geant4EventAction interface: Begin-of-event callback 0046 virtual void begin(const G4Event* event) override; 0047 /// Geant4EventAction interface: End-of-event callback 0048 virtual void end(const G4Event* event) override; 0049 }; 0050 0051 } // End namespace sim 0052 } // End namespace dd4hep 0053 0054 #endif /* DD4HEP_DDG4_GEANT4PARTICLEDUMPACTION_H */ 0055 0056 //==================================================================== 0057 // AIDA Detector description implementation 0058 //-------------------------------------------------------------------- 0059 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) 0060 // All rights reserved. 0061 // 0062 // For the licensing terms see $DD4hepINSTALL/LICENSE. 0063 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS. 0064 // 0065 // Author : M.Frank 0066 // 0067 //==================================================================== 0068 0069 // Framework include files 0070 #include <DD4hep/InstanceCount.h> 0071 #include <DDG4/Geant4DataDump.h> 0072 #include <DDG4/Geant4HitCollection.h> 0073 0074 // Geant 4 includes 0075 #include <G4HCofThisEvent.hh> 0076 #include <G4Event.hh> 0077 0078 using namespace dd4hep::sim; 0079 0080 /// Standard constructor 0081 Geant4ParticleDumpAction::Geant4ParticleDumpAction(Geant4Context* ctxt, const std::string& nam) 0082 : Geant4EventAction(ctxt, nam) 0083 { 0084 m_needsControl = true; 0085 InstanceCount::increment(this); 0086 } 0087 0088 /// Default destructor 0089 Geant4ParticleDumpAction::~Geant4ParticleDumpAction() { 0090 InstanceCount::decrement(this); 0091 } 0092 0093 /// Geant4EventAction interface: Begin-of-event callback 0094 void Geant4ParticleDumpAction::begin(const G4Event* /* event */) { 0095 } 0096 0097 /// Geant4EventAction interface: End-of-event callback 0098 void Geant4ParticleDumpAction::end(const G4Event* event) { 0099 Geant4ParticleMap* parts = context()->event().extension<Geant4ParticleMap>(); 0100 if ( parts ) { 0101 Geant4DataDump dump(name()); 0102 dump.print(ALWAYS,parts); 0103 return; 0104 } 0105 warning("+++ [Event:%d] No particle map available!",event->GetEventID()); 0106 } 0107 0108 #include <DDG4/Factories.h> 0109 DECLARE_GEANT4ACTION(Geant4ParticleDumpAction)
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |