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 <vector>
0012 
0013 #include <G4UserSteppingAction.hh>
0014 #include <HepMC3/GenParticle.h>
0015 #include <HepMC3/GenVertex.h>
0016 #include <globals.hh>
0017 
0018 namespace ActsExamples::Geant4::HepMC3 {
0019 
0020 /// Collects the particles history.
0021 class SteppingAction : public G4UserSteppingAction {
0022  public:
0023   explicit SteppingAction(std::vector<std::string> eventRejectionProcess);
0024   ~SteppingAction() override;
0025 
0026   /// Static access method to the instance
0027   static SteppingAction* instance();
0028 
0029   /// @brief Interface Method doing the step and records the data
0030   /// @param step is the Geant4 step of the particle
0031   void UserSteppingAction(const G4Step* step) override;
0032 
0033   /// Interface reset method
0034   void clear();
0035 
0036   /// Return the abort status
0037   bool eventAborted() { return m_eventAborted; }
0038 
0039  private:
0040   /// Instance of the SteppingAction
0041   static SteppingAction* s_instance;
0042   /// The end vertex of the previous step
0043   std::shared_ptr<::HepMC3::GenVertex> m_previousVertex = nullptr;
0044   /// List to veto events with certain processes
0045   std::vector<std::string> m_eventRejectionProcess;
0046   /// States whether an event was aborted
0047   bool m_eventAborted = false;
0048 };
0049 }  // namespace ActsExamples::Geant4::HepMC3