forked from celeritas-project/celeritas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ActionInitialization.hh
53 lines (45 loc) · 1.54 KB
/
ActionInitialization.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//----------------------------------*-C++-*----------------------------------//
// Copyright 2022-2023 UT-Battelle, LLC, and other Celeritas developers.
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file celer-g4/ActionInitialization.hh
//---------------------------------------------------------------------------//
#pragma once
#include <memory>
#include <G4VUserActionInitialization.hh>
#include "accel/SharedParams.hh"
#include "GeantDiagnostics.hh"
namespace celeritas
{
class HepMC3PrimaryGenerator;
namespace app
{
//---------------------------------------------------------------------------//
/*!
* Set up demo-specific action initializations.
*/
class ActionInitialization final : public G4VUserActionInitialization
{
public:
//!@{
//! \name Type aliases
using SPParams = std::shared_ptr<SharedParams>;
using SPDiagnostics = std::shared_ptr<GeantDiagnostics>;
//!@}
public:
explicit ActionInitialization(SPParams params);
void BuildForMaster() const final;
void Build() const final;
//! Get the number of events to be transported
int num_events() const { return num_events_; }
private:
SPParams params_;
SPDiagnostics diagnostics_;
std::shared_ptr<HepMC3PrimaryGenerator> hepmc_gen_;
int num_events_{0};
mutable bool init_shared_;
};
//---------------------------------------------------------------------------//
} // namespace app
} // namespace celeritas