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 /** \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 
0046       std::string toString() const {
0047         std::stringstream str;
0048         str << "\nRejectPDGs: ";
0049         for (int i: m_rejectPDGs) { str << i << ", "; }
0050         str << "\nzeroTimePDGs: ";
0051         for (int i: m_zeroTimePDGs) { str << i << ", "; }
0052         return str.str();
0053       }
0054     };
0055 
0056     /// Geant4Action to convert the particle information to Geant4
0057     /** Convert the primary interaction (object \tt{Geant4PrimaryInteraction} object
0058      *  attached to the \tt{Geant4Event} event context) and pass the result
0059      *  to Geant4 for simulation.
0060      *
0061      *  \author  M.Frank
0062      *  \version 1.0
0063      *  \ingroup DD4HEP_SIMULATION
0064      */
0065     class Geant4PrimaryHandler : public Geant4GeneratorAction    {
0066     public:
0067       /// Standard constructor
0068       Geant4PrimaryHandler(Geant4Context* context, const std::string& nam);
0069       /// Default destructor
0070       virtual ~Geant4PrimaryHandler();
0071       /// Event generation action callback
0072       virtual void operator()(G4Event* event);
0073 
0074     public:
0075       Geant4PrimaryConfig m_primaryConfig{};
0076 
0077     };
0078   }    // End namespace sim
0079 }      // End namespace dd4hep
0080 
0081 #endif // DDG4_GEANT4PRIMARYHANDLER_H