Back to home page

EIC code displayed by LXR

 
 

    


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 
0014 #ifndef DDG4_GEANT4GENERATORACTIONINIT_H
0015 #define DDG4_GEANT4GENERATORACTIONINIT_H
0016 
0017 // Framework include files
0018 #include <DDG4/Geant4GeneratorAction.h>
0019 
0020 // Forward declarations
0021 class G4Event;
0022 class G4Run;
0023 
0024 /// Namespace for the AIDA detector description toolkit
0025 namespace dd4hep {
0026 
0027   /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit
0028   namespace sim {
0029 
0030     /// Initialize the Geant4Event objects to host generator and MC truth related information
0031     /** Geant4 actions to collect the MC particle information.
0032      *
0033      *  This action should register all event extension required for the further
0034      *  processing. We want to avoid that every client has to check if a given
0035      *  object is present or not and than later install the required data structures.
0036      *
0037      *  These by default are extensions of type:
0038      *  -- Geant4PrimaryEvent with multiple interaction sections, one for each interaction
0039      *     This is the MAIN and ONLY information to feed Geant4
0040      *
0041      *  -- Geant4PrimaryInteraction containing the track/vertex information to create
0042      *     the primary particles for Geant4. This record is build from the Geant4PrimaryEvent
0043      *     information.
0044      *  -- Geant4PrimaryMap a map of the Geant4Particles converted to G4PrimaryParticles
0045      *     to ease particle handling later.
0046      *  -- Geant4ParticleMap the map of particles created during the event simulation.
0047      *     This map has directly the correct particle offsets, so that the merging of
0048      *     Geant4PrimaryInteraction particles and the simulation particles is easy....
0049      *
0050      *  \author  M.Frank
0051      *  \version 1.0
0052      *  \ingroup DD4HEP_SIMULATION
0053      */
0054     class Geant4GeneratorActionInit : public Geant4GeneratorAction    {
0055     protected:
0056       /// Current run identifier
0057       int m_run      {  0 };
0058       /// Counter for total number of events
0059       int m_evtTotal {  0 };
0060       /// Counter for total number of events in current run
0061       int m_evtRun   {  0 };
0062     public:
0063       /// Standard constructor
0064       Geant4GeneratorActionInit(Geant4Context* context, const std::string& nam);
0065       /// Default destructor
0066       virtual ~Geant4GeneratorActionInit();
0067       /// Event generation action callback
0068       virtual void operator()(G4Event* event);
0069       /// Begin-run action callback
0070       void begin(const G4Run* run);
0071       /// End-run action callback
0072       void end(const G4Run* run);
0073 
0074     };
0075   }    // End namespace sim
0076 }      // End namespace dd4hep
0077 
0078 #endif // DDG4_GEANT4GENERATORACTIONINIT_H