remage
Simulation framework for HPGe-based experiments
 
Loading...
Searching...
No Matches
RMGGeneratorG4Gun.hh
1// Copyright (C) 2022 Luigi Pertoldi <https://orcid.org/0000-0002-0467-2571>
2//
3// This program is free software: you can redistribute it and/or modify it under
4// the terms of the GNU Lesser General Public License as published by the Free
5// Software Foundation, either version 3 of the License, or (at your option) any
6// later version.
7//
8// This program is distributed in the hope that it will be useful, but WITHOUT
9// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11// details.
12//
13// You should have received a copy of the GNU Lesser General Public License
14// along with this program. If not, see <https://www.gnu.org/licenses/>.
15
16#ifndef _RMG_GENERATOR_G4GUN_HH_
17#define _RMG_GENERATOR_G4GUN_HH_
18
19#include <memory>
20
21#include "G4ParticleGun.hh"
22#include "G4ThreeVector.hh"
23
24#include "RMGVGenerator.hh"
25
26class G4Event;
27class G4ParticleGun;
34class RMGGeneratorG4Gun : public RMGVGenerator {
35
36 public:
37
38 RMGGeneratorG4Gun() : RMGVGenerator("G4Gun") {
39 fParticleGun = std::make_unique<G4ParticleGun>();
40 }
41 ~RMGGeneratorG4Gun() = default;
42
43 RMGGeneratorG4Gun(RMGGeneratorG4Gun const&) = delete;
44 RMGGeneratorG4Gun& operator=(RMGGeneratorG4Gun const&) = delete;
45 RMGGeneratorG4Gun(RMGGeneratorG4Gun&&) = delete;
46 RMGGeneratorG4Gun& operator=(RMGGeneratorG4Gun&&) = delete;
47
49 void GeneratePrimaries(G4Event* event) override { fParticleGun->GeneratePrimaryVertex(event); }
51 void SetParticlePosition(G4ThreeVector vec) override { fParticleGun->SetParticlePosition(vec); }
52
53 private:
54
55 std::unique_ptr<G4ParticleGun> fParticleGun = nullptr;
56};
57
58#endif
59
60// vim: tabstop=2 shiftwidth=2 expandtab
void GeneratePrimaries(G4Event *event) override
Fire the configured particle gun into event.
Definition RMGGeneratorG4Gun.hh:49
void SetParticlePosition(G4ThreeVector vec) override
Set the vertex position used by the next call to GeneratePrimaries.
Definition RMGGeneratorG4Gun.hh:51