Back to home page

EIC code displayed by LXR

 
 

    


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

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 <map>
0012 #include <memory>
0013 #include <string>
0014 
0015 #include <G4UserEventAction.hh>
0016 #include <HepMC3/GenEvent.h>
0017 #include <globals.hh>
0018 
0019 namespace ActsExamples::Geant4::HepMC3 {
0020 
0021 /// The EventAction class is the realization of the Geant4 class
0022 /// G4UserEventAction and is writing out the collected RecordedMaterialTrack
0023 /// entities needed for material mapping once per event.
0024 ///
0025 class EventAction final : public G4UserEventAction {
0026  public:
0027   /// Static access method
0028   static EventAction* instance();
0029 
0030   /// Construct the action and ensure singleton usage.
0031   explicit EventAction(std::vector<std::string> processFilter);
0032   ~EventAction() override;
0033 
0034   /// Interface method for begin of the event
0035   /// @param event is the G4Event to be processed
0036   /// @note resets the event and step action
0037   void BeginOfEventAction(const G4Event* event) override;
0038 
0039   /// Interface method for end of event
0040   /// @param event is the G4Event to be processed
0041   void EndOfEventAction(const G4Event* event) override;
0042 
0043   /// Clear the recorded data.
0044   void clear();
0045 
0046   /// Getter of the created HepMC3 event
0047   ::HepMC3::GenEvent& event();
0048 
0049  private:
0050   /// Instance of the EventAction
0051   static EventAction* s_instance;
0052   /// The current HepMC3 event
0053   ::HepMC3::GenEvent m_event;
0054   /// List of processes that can be combined to a single vertex
0055   std::vector<std::string> m_processFilter;
0056 };
0057 }  // namespace ActsExamples::Geant4::HepMC3