Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RunAction.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RunAction.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2020 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #include "RunAction.hpp"
10 
11 #include <stdexcept>
12 
13 #include <G4Run.hh>
14 
15 #include "EventAction.hpp"
16 
17 namespace ActsExamples::Geant4::HepMC3 {
18 
19 RunAction* RunAction::s_instance = nullptr;
20 
22  return s_instance;
23 }
24 
25 RunAction::RunAction() : G4UserRunAction() {
26  if (s_instance != nullptr) {
27  throw std::logic_error("Attempted to duplicate the RunAction singleton");
28  } else {
29  s_instance = this;
30  }
31 }
32 
34  s_instance = nullptr;
35 }
36 
37 void RunAction::BeginOfRunAction(const G4Run* /*run*/) {
38  // initialize event cumulative quantities
40 }
41 
42 void RunAction::EndOfRunAction(const G4Run* /*run*/) {}
43 
44 } // namespace ActsExamples::Geant4::HepMC3