BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
BDSProcessMap.cc
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2022.
4
5This file is part of BDSIM.
6
7BDSIM is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published
9by the Free Software Foundation version 3 of the License.
10
11BDSIM is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
18*/
19#include "BDSProcessMap.hh"
20#include <unordered_map>
21
22#include "globals.hh" // geant4 types / globals
23
25
27{
28 if (!instance)
29 {instance = new BDSProcessMap();}
30 return instance;
31}
32
33BDSProcessMap::~BDSProcessMap()
34{
35 delete instance;
36 instance = nullptr;
37}
38
39G4String BDSProcessMap::operator()(const G4int& type, const G4int& subType) const
40{
41 G4String output = "";
42 auto result = processes.find(type);
43 if (result == processes.end())
44 {
45 output += "Unknown";
46 G4cout << "Unknown process ID \"" << type << "\"" << G4endl;
47 }
48 else
49 {output += result->second;}
50
51 // sub type is optional as some don't have it
52 // need to have valid process type to look up subprocess map
53 if (subType > 0 && result != processes.end())
54 {
55 output += " : ";
56 // note have to use 'at' for const-ness
57 const auto& subMap = subProcesses.at(result->first);
58 auto result2 = subMap.find(subType);
59 if (result2 == subMap.end())
60 {
61 output += "Unknown";
62 G4cout << "Unknown subprocess ID \"" << subType << "\"" << G4endl;
63 }
64 else
65 {output += result2->second;}
66 }
67 return output;
68}
69
71{
73 processes[0] = "fNotDefined";
74 processes[1] = "fTransportation";
76 {
77 {91, "TRANSPORTATION"},
78 {92, "COUPLED_TRANSPORTATION"}
79 };
80 processes[2] = "fElectromagnetic";
82 {
83 {1, "fCoulombScattering"},
84 {2, "fIonisation"},
85 {3, "fBremsstrahlung"},
86 {4, "fPairProdByCharged"},
87 {5, "fAnnihilation"},
88 {6, "fAnnihilationToMuMu"},
89 {7, "fAnnihilationToHadrons"},
90 {8, "fNuclearStopping"},
91 {10, "fMultipleScattering"},
92 {11, "fRayleigh"},
93 {12, "fPhotoElectricEffect"},
94 {13, "fComptonScattering"},
95 {14, "fGammaConversion"},
96 {15, "fGammaConversionToMuMu"},
97 {21, "fCerenkov"},
98 {22, "fScintillation"},
99 {23, "fSynchrotronRadiation"},
100 {24, "fTransitionRadiation"}
101 };
102 processes[3] = "fOptical";
104 {
105 {0, "kCerenkov"},
106 {1, "kScintillation"},
107 {2, "kAbsorption"},
108 {3, "kRayleigh"},
109 {4, "kMieHG"},
110 {5, "kBoundary"},
111 {6, "kWLS"},
112 {7, "kNoProcess"}
113 };
114 processes[4] = "fHadronic";
116 {
117 {111, "fHadronElastic"},
118 {121, "fHadronInelastic"},
119 {131, "fCapture"},
120 {141, "fFission"},
121 {151, "fHadronAtRest"},
122 {152, "fLeptonAtRest"},
123 {161, "fChargeExchange"},
124 {210, "fRadioactiveDecay"}
125 };
126 processes[5] = "fPhotolepton_hadron";
127 processes[6] = "fDecay";
129 {
130 {201, "DECAY"},
131 {202, "DECAY_WithSpin"},
132 {203, "DECAY_PionMakeSpin"},
133 {210, "DECAY_Radioactive"},
134 {211, "DECAY_Unknown"},
135 {231, "DECAY_External"}
136 };
137 processes[7] = "fGeneral";
139 {
140 {401, "STEP_LIMITER"},
141 {402, "USER_SPECIAL_CUTS"},
142 {403, "NEUTRON_KILLER"}
143 };
144 processes[8] = "fParameterisation";
145 processes[9] = "fUserDefined";
146 processes[10] = "fParallel";
148 {
149 {491, "Parallel"} //SBLN unknown - but something to do with parallel world transportation.
150 };
151 processes[11] = "fPhonon";
152 processes[12] = "fUCN";
153}
Map of all process names to IDs.
static BDSProcessMap * Instance()
Singleton accessor.
std::unordered_map< G4int, processMap > subProcesses
std::unordered_map< G4int, G4String > processMap
Typedef to make syntax more readable.
static BDSProcessMap * instance
Singleton instance.
processMap processes
Map of main process categories.
BDSProcessMap()
Private default constructor as singleton pattern.
G4String operator()(const G4int &type, const G4int &subType=-1) const
Main access method for getting the name of processes.