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