Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-27 09:25:10

0001 //------------------------------- -*- C++ -*- -------------------------------//
0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details
0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0004 //---------------------------------------------------------------------------//
0005 //! \file celeritas/ext/HadronicInteractor.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <string>
0010 
0011 #include "G4HadronicProcessType.hh"
0012 
0013 class G4HadronicProcess;
0014 class G4VParticleChange;
0015 class G4ParticleDefinition;
0016 class G4Step;
0017 class G4Track;
0018 
0019 namespace celeritas
0020 {
0021 //---------------------------------------------------------------------------//
0022 /*!
0023  * Interface for invoking the PostStepDoIt action of Geant4 hadronic processes
0024  * for a given particle definition and hadronic process type.
0025  *
0026  * This class is used to sample final states of hadronic process type
0027  * that are not yet implemented on GPU. In such cases, the interaction is
0028  * processed on the CPU using Geant4 with reconstructed G4Track and G4Step
0029  * objects.
0030  *
0031  * Note that this class is expected to be thread-local in a multi-threaded
0032  * context to ensure thread-safety and independent processing of hadronic
0033  * interactions for each thread.
0034  */
0035 class HadronicInteractor
0036 {
0037   public:
0038     // Construct with particle definition and hadronic process type
0039     HadronicInteractor(G4ParticleDefinition const& particle,
0040                        G4HadronicProcessType type);
0041 
0042     // Process PostStepDoIt
0043     G4VParticleChange& operator()(G4Track& track);
0044 
0045     // Return the underlying process name
0046     std::string const& process_name() const;
0047 
0048   private:
0049     //// DATA ////
0050 
0051     // Particle definition for which the process is valid
0052     G4ParticleDefinition const& particle_;
0053 
0054     // Hadronic process obtained from Geant4 process store
0055     G4HadronicProcess* process_{nullptr};
0056 };
0057 
0058 //---------------------------------------------------------------------------//
0059 }  // namespace celeritas