remage
Simulation framework for HPGe-based experiments
Toggle main menu visibility
Loading...
Searching...
No Matches
RMGGrabmayrGCReader.hh
1
// Copyright (C) 2024 Moritz Neuberger <https://orcid.org/0009-0001-8471-9076>
2
// Copyright (C) 2024 Eric Esch <https://orcid.org/0009-0000-4920-9313>
3
//
4
// This program is free software: you can redistribute it and/or modify it under
5
// the terms of the GNU Lesser General Public License as published by the Free
6
// Software Foundation, either version 3 of the License, or (at your option) any
7
// later version.
8
//
9
// This program is distributed in the hope that it will be useful, but WITHOUT
10
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12
// details.
13
//
14
// You should have received a copy of the GNU Lesser General Public License
15
// along with this program. If not, see <https://www.gnu.org/licenses/>.
16
17
#ifndef _RMG_GRABMAYR_GC_READER_HH_
18
#define _RMG_GRABMAYR_GC_READER_HH_
19
20
#include <cmath>
21
#include <fstream>
22
#include <iostream>
23
#include <memory>
24
#include <string>
25
#include <vector>
26
27
#include "G4GenericMessenger.hh"
28
#include "globals.hh"
29
30
// Modified from WLGDPetersGammaCascadeReader originally contributed by Moritz Neuberger
39
struct
GammaCascadeLine
{
40
G4int
en
;
41
G4int
ex
;
42
G4int
m
;
43
G4int
em
;
44
std::vector<G4int>
eg
;
45
};
46
47
55
class
RMGGrabmayrGCReader {
56
public
:
57
59
static
RMGGrabmayrGCReader*
GetInstance
();
60
~RMGGrabmayrGCReader();
61
// RMGGrabmayrGCReader& operator=(const RMGGrabmayrGCReader&) = delete;
62
64
G4bool
IsApplicable
(G4int z, G4int a);
66
void
CloseFiles
();
67
72
GammaCascadeLine
GetNextEntry
(G4int z, G4int a);
73
74
private
:
75
76
static
G4ThreadLocal RMGGrabmayrGCReader* instance;
77
RMGGrabmayrGCReader();
78
// std::vector<std::unique_ptr<std::ifstream>> files;
79
// map holding the corresponding file for each isotope
80
std::map<std::pair<G4int, G4int>, std::unique_ptr<std::ifstream>> fCascadeFiles;
81
std::unique_ptr<G4GenericMessenger> fGenericMessenger;
82
G4int fGammaCascadeRandomStartLocation = 0;
83
84
void
SetGammaCascadeFile(G4int z, G4int a,
G4String
file_name);
85
void
SetGammaCascadeRandomStartLocation(
int
answer);
86
void
SetStartLocation(std::ifstream& file)
const
;
87
88
void
RandomizeFiles();
89
void
DefineCommands();
90
91
// Nested messenger class
92
class
GCMessenger :
public
G4UImessenger
{
93
public
:
94
95
GCMessenger(RMGGrabmayrGCReader* reader);
96
~GCMessenger();
97
98
void
SetNewValue(
G4UIcommand
* command,
G4String
newValues)
override
;
99
100
private
:
101
102
RMGGrabmayrGCReader* fReader;
103
G4UIcommand
* fGammaFileCmd;
104
105
void
GammaFileCmd(
const
std::string& parameters);
106
};
107
108
std::unique_ptr<GCMessenger> fUIMessenger;
109
};
110
111
112
#endif
G4String
G4UIcommand
G4UImessenger
RMGGrabmayrGCReader::GetInstance
static RMGGrabmayrGCReader * GetInstance()
Thread-local singleton accessor.
Definition
RMGGrabmayrGCReader.cc:30
RMGGrabmayrGCReader::CloseFiles
void CloseFiles()
Close all open cascade files held by this thread.
Definition
RMGGrabmayrGCReader.cc:39
RMGGrabmayrGCReader::GetNextEntry
GammaCascadeLine GetNextEntry(G4int z, G4int a)
Read and return the next cascade entry for the (Z, A) isotope.
Definition
RMGGrabmayrGCReader.cc:54
RMGGrabmayrGCReader::IsApplicable
G4bool IsApplicable(G4int z, G4int a)
Whether a cascade file has been registered for the (Z, A) isotope.
Definition
RMGGrabmayrGCReader.cc:47
GammaCascadeLine
One pre-computed neutron-capture gamma cascade.
Definition
RMGGrabmayrGCReader.hh:39
GammaCascadeLine::m
G4int m
Cascade multiplicity (number of eg entries).
Definition
RMGGrabmayrGCReader.hh:42
GammaCascadeLine::eg
std::vector< G4int > eg
Photon energies of the cascade [keV].
Definition
RMGGrabmayrGCReader.hh:44
GammaCascadeLine::en
G4int en
Neutron kinetic energy bin [keV].
Definition
RMGGrabmayrGCReader.hh:40
GammaCascadeLine::em
G4int em
Missing energy not carried by the listed photons [keV].
Definition
RMGGrabmayrGCReader.hh:43
GammaCascadeLine::ex
G4int ex
Capture-state excitation energy [keV].
Definition
RMGGrabmayrGCReader.hh:41
include
RMGGrabmayrGCReader.hh
Generated by
1.17.0