Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-12 09:07:46

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 Geant4GeneratorAction
0015  *
0016  @{
0017   \package Geant4PrimaryHandler
0018  * \brief Geant4Action to convert the particle information to Geant4
0019  *
0020  *
0021 @}
0022  */
0023 
0024 #ifndef DDG4_GEANT4PRIMARYHANDLER_H
0025 #define DDG4_GEANT4PRIMARYHANDLER_H
0026 
0027 // Framework include files
0028 #include <DDG4/Geant4GeneratorAction.h>
0029 
0030 // C/C++ include files
0031 #include <set>
0032 
0033 /// Namespace for the AIDA detector description toolkit
0034 namespace dd4hep {
0035 
0036   /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit
0037   namespace sim {
0038     /// Geant4PrimaryConfig to hold configuration for PrimaryHandlers
0039     class Geant4PrimaryConfig {
0040     public:
0041       /// particles with these PDG IDs are not passed to geant for simulation
0042       std::set<int> m_rejectPDGs = {1, 2, 3, 4, 5, 6, 21, 23, 24, 25};
0043       /// particles with these PDG IDs are not passed to geant for simulation if their properTime is zero
0044       std::set<int> m_zeroTimePDGs = {11, 13, 15, 17};
0045       /// for these particles the decay time is chosen by Geant4 according to the lifetime configured instead of what is
0046       /// assigned in the MC generator
0047       std::set<int> m_decayByGeant = {};
0048 
0049       std::string toString() const {
0050         std::stringstream str;
0051         str << "\nRejectPDGs: ";
0052         for (int i: m_rejectPDGs) { str << i << ", "; }
0053         str << "\nzeroTimePDGs: ";
0054         for (int i: m_zeroTimePDGs) { str << i << ", "; }
0055         str << "\nDecayByGeant: ";
0056         for (int i: m_decayByGeant) { str << i << ", "; }
0057         return str.str();
0058       }
0059     };
0060 
0061     /// Geant4Action to convert the particle information to Geant4
0062     /** Convert the primary interaction (object \tt{Geant4PrimaryInteraction} object
0063      *  attached to the \tt{Geant4Event} event context) and pass the result
0064      *  to Geant4 for simulation.
0065      *
0066      *  \author  M.Frank
0067      *  \version 1.0
0068      *  \ingroup DD4HEP_SIMULATION
0069      */
0070     class Geant4PrimaryHandler : public Geant4GeneratorAction    {
0071     public:
0072       /// Standard constructor
0073       Geant4PrimaryHandler(Geant4Context* context, const std::string& nam);
0074       /// Default destructor
0075       virtual ~Geant4PrimaryHandler();
0076       /// Event generation action callback
0077       virtual void operator()(G4Event* event)  override;
0078 
0079     public:
0080       Geant4PrimaryConfig m_primaryConfig{};
0081 
0082     };
0083   }    // End namespace sim
0084 }      // End namespace dd4hep
0085 
0086 #endif // DDG4_GEANT4PRIMARYHANDLER_H