Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:24

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 #ifndef DDG4_GEANT4PARTICLEPRINT_H
0015 #define DDG4_GEANT4PARTICLEPRINT_H
0016 
0017 // Framework include files
0018 #include <DDG4/Geant4EventAction.h>
0019 #include <DDG4/Geant4GeneratorAction.h>
0020 #include <DDG4/Geant4Particle.h>
0021 
0022 // Forward declarations
0023 class G4Event;
0024 
0025 /// Namespace for the AIDA detector description toolkit
0026 namespace dd4hep {
0027 
0028   /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit
0029   namespace sim {
0030 
0031     /// Geant4Action to print MC particle information.
0032     /**
0033      *
0034      *  \author  M.Frank
0035      *  \version 1.0
0036      *  \ingroup DD4HEP_SIMULATION
0037      */
0038     class Geant4ParticlePrint : public Geant4EventAction        {
0039     public:
0040       typedef Geant4ParticleMap::Particle Particle;
0041       typedef Geant4ParticleMap::ParticleMap ParticleMap;
0042       typedef Geant4ParticleMap::TrackEquivalents TrackEquivalents;
0043     protected:
0044       /// Property: Flag to indicate output type: 1: TABLE, 2:TREE, 3:BOTH (default)
0045       int m_outputType;
0046       /// Property: Flag to indicate output type at begin of event
0047       bool m_printBegin;
0048       /// Property: Flag to indicate output type at end of event
0049       bool m_printEnd;
0050       /// Property: Flag to indicate output type as part of the generator action
0051       bool m_printGeneration;
0052       /// Property: Flag to indicate output of hit data in tree
0053       bool m_printHits;
0054 
0055       void printParticle(const std::string& prefix, const G4Event* e, Geant4ParticleHandle p) const;
0056       /// Print record of kept particles
0057       void printParticles(const G4Event* e, const ParticleMap& particles) const;
0058       /// Print tree of kept particles
0059       void printParticleTree(const G4Event* e, const ParticleMap& particles, int level, Geant4ParticleHandle p)  const;
0060       /// Print tree of kept particles
0061       void printParticleTree(const G4Event* e, const ParticleMap& particles)  const;
0062       /// Print particle table
0063       void makePrintout(const G4Event* e)  const;
0064 
0065 
0066     public:
0067       /// Standard constructor
0068       Geant4ParticlePrint(Geant4Context* context, const std::string& nam);
0069       /// Default destructor
0070       virtual ~Geant4ParticlePrint();
0071       /// Pre-event action callback
0072       virtual void begin(const G4Event* event);
0073       /// Post-event action callback
0074       virtual void end(const G4Event* event);
0075       /// Generation action callback
0076       virtual void operator()(G4Event* event);
0077 
0078     };
0079   }    // End namespace sim
0080 }      // End namespace dd4hep
0081 
0082 #endif // DDG4_GEANT4PARTICLEPRINT_H