DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Geant4ParticlePrint.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 
14 #ifndef DDG4_GEANT4PARTICLEPRINT_H
15 #define DDG4_GEANT4PARTICLEPRINT_H
16 
17 // Framework include files
18 #include <DDG4/Geant4EventAction.h>
20 #include <DDG4/Geant4Particle.h>
21 
22 // Forward declarations
23 class G4Event;
24 
26 namespace dd4hep {
27 
29  namespace sim {
30 
32 
39  public:
43  protected:
49  bool m_printEnd;
54 
55  void printParticle(const std::string& prefix, const G4Event* e, Geant4ParticleHandle p) const;
57  void printParticles(const G4Event* e, const ParticleMap& particles) const;
59  void printParticleTree(const G4Event* e, const ParticleMap& particles, int level, Geant4ParticleHandle p) const;
61  void printParticleTree(const G4Event* e, const ParticleMap& particles) const;
63  void makePrintout(const G4Event* e) const;
64 
65 
66  public:
68  Geant4ParticlePrint(Geant4Context* context, const std::string& nam);
70  virtual ~Geant4ParticlePrint();
72  virtual void begin(const G4Event* event) override;
74  virtual void end(const G4Event* event) override;
76  virtual void operator()(G4Event* event);
77 
78  };
79  } // End namespace sim
80 } // End namespace dd4hep
81 
82 #endif // DDG4_GEANT4PARTICLEPRINT_H
dd4hep::sim::Geant4ParticlePrint
Geant4Action to print MC particle information.
Definition: Geant4ParticlePrint.h:38
dd4hep::sim::Geant4ParticlePrint::~Geant4ParticlePrint
virtual ~Geant4ParticlePrint()
Default destructor.
Definition: Geant4ParticlePrint.cpp:44
dd4hep::sim::Geant4ParticlePrint::m_printBegin
bool m_printBegin
Property: Flag to indicate output type at begin of event.
Definition: Geant4ParticlePrint.h:47
dd4hep::sim::Geant4ParticlePrint::m_printHits
bool m_printHits
Property: Flag to indicate output of hit data in tree.
Definition: Geant4ParticlePrint.h:53
dd4hep::sim::Geant4ParticlePrint::ParticleMap
Geant4ParticleMap::ParticleMap ParticleMap
Definition: Geant4ParticlePrint.h:41
Geant4EventAction.h
dd4hep::sim::Geant4ParticlePrint::TrackEquivalents
Geant4ParticleMap::TrackEquivalents TrackEquivalents
Definition: Geant4ParticlePrint.h:42
dd4hep::sim::Geant4ParticleMap::TrackEquivalents
std::map< int, int > TrackEquivalents
Definition: Geant4Particle.h:341
dd4hep::sim::Geant4ParticlePrint::Geant4ParticlePrint
Geant4ParticlePrint(Geant4Context *context, const std::string &nam)
Standard constructor.
Definition: Geant4ParticlePrint.cpp:32
dd4hep::sim::Geant4ParticlePrint::end
virtual void end(const G4Event *event) override
Post-event action callback.
Definition: Geant4ParticlePrint.cpp:72
dd4hep::sim::Geant4ParticlePrint::begin
virtual void begin(const G4Event *event) override
Pre-event action callback.
Definition: Geant4ParticlePrint.cpp:67
dd4hep::sim::Geant4EventAction
Concrete basic implementation of the Geant4 event action.
Definition: Geant4EventAction.h:53
dd4hep::sim::Geant4ParticlePrint::printParticles
void printParticles(const G4Event *e, const ParticleMap &particles) const
Print record of kept particles.
Definition: Geant4ParticlePrint.cpp:155
Geant4GeneratorAction.h
dd4hep::sim::Geant4ParticleMap::ParticleMap
std::map< int, Particle * > ParticleMap
Definition: Geant4Particle.h:340
dd4hep::sim::Geant4ParticlePrint::m_printGeneration
bool m_printGeneration
Property: Flag to indicate output type as part of the generator action.
Definition: Geant4ParticlePrint.h:51
dd4hep::sim::Geant4ParticlePrint::Particle
Geant4ParticleMap::Particle Particle
Definition: Geant4ParticlePrint.h:40
dd4hep::sim::Geant4ParticlePrint::printParticleTree
void printParticleTree(const G4Event *e, const ParticleMap &particles, int level, Geant4ParticleHandle p) const
Print tree of kept particles.
Definition: Geant4ParticlePrint.cpp:187
dd4hep::sim::Geant4ParticlePrint::makePrintout
void makePrintout(const G4Event *e) const
Print particle table.
Definition: Geant4ParticlePrint.cpp:49
dd4hep::sim::Geant4ParticlePrint::printParticle
void printParticle(const std::string &prefix, const G4Event *e, Geant4ParticleHandle p) const
Definition: Geant4ParticlePrint.cpp:76
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::sim::Geant4ParticleHandle
Data structure to access derived MC particle information.
Definition: Geant4Particle.h:181
dd4hep::sim::Geant4ParticlePrint::operator()
virtual void operator()(G4Event *event)
Generation action callback.
Definition: Geant4ParticlePrint.cpp:62
Geant4Particle.h
dd4hep::sim::Geant4Particle
Data structure to store the MC particle information.
Definition: Geant4Particle.h:103
dd4hep::sim::Geant4ParticlePrint::m_outputType
int m_outputType
Property: Flag to indicate output type: 1: TABLE, 2:TREE, 3:BOTH (default)
Definition: Geant4ParticlePrint.h:45
dd4hep::sim::Geant4ParticlePrint::m_printEnd
bool m_printEnd
Property: Flag to indicate output type at end of event.
Definition: Geant4ParticlePrint.h:49
dd4hep::sim::Geant4Context
Generic context to extend user, run and event information.
Definition: Geant4Context.h:201
dd4hep::sim::Geant4Action::context
Geant4Context * context() const
Access the context.
Definition: Geant4Action.h:270