remage
Simulation framework for HPGe-based experiments
 
Loading...
Searching...
No Matches
RMGGeneratorCosmicMuons.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_COSMIC_MUONS_HH_
17#define _RMG_GENERATOR_COSMIC_MUONS_HH_
18
19#include <memory>
20#include <string>
21
22#include "CLHEP/Units/SystemOfUnits.h"
23#include "G4GenericMessenger.hh"
24#include "G4ParticleGun.hh"
25
26#include "RMGVGenerator.hh"
27
28class EcoMug;
29
30namespace u = CLHEP;
41class RMGGeneratorCosmicMuons : public RMGVGenerator {
42
43 public:
44
46 enum class SkyShape {
49 };
50
53
55 RMGGeneratorCosmicMuons& operator=(RMGGeneratorCosmicMuons const&) = delete;
58
60 void GeneratePrimaries(G4Event*) override;
62 void SetParticlePosition(G4ThreeVector) override {}
63
65 void BeginOfRunAction(const G4Run*) override;
66 void EndOfRunAction(const G4Run*) override {}
67
68 private:
69
70 std::unique_ptr<EcoMug> fEcoMug;
71 std::unique_ptr<G4ParticleGun> fGun = nullptr;
72
73 std::unique_ptr<G4GenericMessenger> fMessenger = nullptr;
74 void DefineCommands();
75 void SetSkyShape(std::string shape);
76
77 SkyShape fSkyShape = SkyShape::kSphere;
78 double fSkyPlaneSize = -1;
79 double fSkyPlaneHeight = 50 * u::m;
80 double fSkyHSphereRadius = 50 * u::m;
81
82 double fSpherePositionThetaMin = 0 * u::deg;
83 double fSpherePositionThetaMax = 90 * u::deg;
84 double fSpherePositionPhiMin = 0 * u::deg;
85 double fSpherePositionPhiMax = 360 * u::deg;
86
87 double fMomentumMin = 0 * u::GeV;
88 double fMomentumMax = 1 * u::TeV;
89 double fThetaMin = 0 * u::deg;
90 double fThetaMax = 90 * u::deg;
91 double fPhiMin = 0 * u::deg;
92 double fPhiMax = 360 * u::deg;
93};
94
95#endif
96
97// vim: tabstop=2 shiftwidth=2 expandtab
Cosmic-muon primary generator backed by the EcoMug sampler.
Definition RMGGeneratorCosmicMuons.hh:41
void BeginOfRunAction(const G4Run *) override
Configure EcoMug with the user-supplied sky shape and kinematic ranges.
Definition RMGGeneratorCosmicMuons.cc:47
void GeneratePrimaries(G4Event *) override
Sample a muon from EcoMug and fire it through the internal particle gun.
Definition RMGGeneratorCosmicMuons.cc:102
SkyShape
Geometric shape of the surface from which muons are sampled.
Definition RMGGeneratorCosmicMuons.hh:46
@ kPlane
Horizontal square plane at a fixed height.
Definition RMGGeneratorCosmicMuons.hh:47
@ kSphere
Upper hemisphere of a sphere centred at the origin.
Definition RMGGeneratorCosmicMuons.hh:48
void SetParticlePosition(G4ThreeVector) override
No-op: vertex sampling is owned by EcoMug.
Definition RMGGeneratorCosmicMuons.hh:62
void EndOfRunAction(const G4Run *) override
Called at the end of a run.
Definition RMGGeneratorCosmicMuons.hh:66