Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:37

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "ActsExamples/EventData/SimParticle.hpp"
0012 
0013 #include <memory>
0014 
0015 #include <G4ParticleTable.hh>
0016 #include <G4SystemOfUnits.hh>
0017 #include <G4ThreeVector.hh>
0018 #include <G4VUserPrimaryGeneratorAction.hh>
0019 #include <globals.hh>
0020 
0021 class G4ParticleGun;
0022 class G4Event;
0023 
0024 namespace ActsExamples::Geant4::HepMC3 {
0025 
0026 /// The PrimaryGeneratorAction is the implementation of the Geant4
0027 /// class G4VUserPrimaryGeneratorAction. It generates a random direction
0028 /// and shoots a particle.
0029 class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction {
0030  public:
0031   /// Constructor
0032   PrimaryGeneratorAction(G4int randomSeed1 = 12345, G4int randomSeed2 = 23456);
0033   /// Destructor
0034   ~PrimaryGeneratorAction() override;
0035 
0036   /// Static access method
0037   static PrimaryGeneratorAction* instance();
0038 
0039   /// Interface method to generate the primary
0040   void GeneratePrimaries(G4Event* event) override;
0041 
0042   /// Prepare the particle gun with initial parameters
0043   void prepareParticleGun(const ActsExamples::SimParticle& part);
0044 
0045  private:
0046   /// Instance of the PrimaryGeneratorAction
0047   static PrimaryGeneratorAction* s_instance;
0048 
0049   /// Pointer to the G4 particle gun
0050   std::unique_ptr<G4ParticleGun> m_particleGun;
0051   /// The Geant4 particle table
0052   G4ParticleTable* m_particleTable;
0053 };
0054 
0055 }  // namespace ActsExamples::Geant4::HepMC3