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 #include "RunAction.hpp"
0010 
0011 #include <stdexcept>
0012 
0013 #include <G4Run.hh>
0014 
0015 #include "EventAction.hpp"
0016 
0017 namespace ActsExamples::Geant4::HepMC3 {
0018 
0019 RunAction* RunAction::s_instance = nullptr;
0020 
0021 RunAction* RunAction::instance() {
0022   return s_instance;
0023 }
0024 
0025 RunAction::RunAction() : G4UserRunAction() {
0026   if (s_instance != nullptr) {
0027     throw std::logic_error("Attempted to duplicate the RunAction singleton");
0028   } else {
0029     s_instance = this;
0030   }
0031 }
0032 
0033 RunAction::~RunAction() {
0034   s_instance = nullptr;
0035 }
0036 
0037 void RunAction::BeginOfRunAction(const G4Run* /*run*/) {
0038   // initialize event cumulative quantities
0039   EventAction::instance()->clear();
0040 }
0041 
0042 void RunAction::EndOfRunAction(const G4Run* /*run*/) {}
0043 
0044 }  // namespace ActsExamples::Geant4::HepMC3