Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4CascadeChannelTables.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// Factory to return pointer to Bertini cross-section table based on
27// collision initial state (hadron type codes).
28//
29// Author: Michael Kelsey (SLAC)
30//
31// 20110729 M. Kelsey -- Use static instance() function to work around
32// "disappearance" bug on Linux (GCC 4.1.2). Add diagnostics.
33// 20110916 M. Kelsey -- Add "load on demand" to GetTable(), with full set
34// of channel .hh files for use with LoadTable().
35// 20110923 M. Kelsey -- Add optional stream& argument to printTable(),
36// pass through.
37// 20111007 M. Kelsey -- Add new gamma-n and gamma-p tables.
38
40#include "G4CascadeChannel.hh"
41#include <iostream>
42#include <map>
43
44
45// Singleton is created at first invocation
46
47G4CascadeChannelTables& G4CascadeChannelTables::instance() {
48 static G4CascadeChannelTables theInstance;
49 return theInstance;
50}
51
52
53// Argument is interaction code, product of G4InuclEP types
54
56 const G4CascadeChannel* theTable = instance().FindTable(initialState);
57 if (!theTable) theTable = instance().LoadTable(initialState);
58 return theTable;
59}
60
61// Arguments are individual G4InuclElementaryParticle types
62
63const G4CascadeChannel*
65 return GetTable(had1*had2);
66}
67
68// Register cross-section table for later lookup
69
70void
72 instance().SaveTable(initialState, table);
73}
74
75// Return cross-section table requested by user
76
77const G4CascadeChannel*
78G4CascadeChannelTables::FindTable(G4int initialState) {
79#ifdef G4CASCADE_DEBUG_SAMPLER
80 G4cout << "G4CascadeChannelTables::FindTable " << initialState << G4endl;
81#endif
82 return (tables.find(initialState)!=tables.end()) ? tables[initialState] : 0;
83}
84
85
86// Register specified table in list, replacing previous version
87
88void
89G4CascadeChannelTables::SaveTable(G4int initialState, G4CascadeChannel* table) {
90#ifdef G4CASCADE_DEBUG_SAMPLER
91 G4cout << "G4CascadeChannelTables::SaveTable " << initialState << G4endl;
92#endif
93 if (!table) return; // Avoid unnecessary work
94
95 if (FindTable(initialState)) delete tables[initialState];
96 tables[initialState] = table;
97}
98
99
100// Convenience function for diagnostic output
101
102void G4CascadeChannelTables::PrintTable(G4int initialState, std::ostream& os) {
103 const G4CascadeChannel* tbl = GetTable(initialState);
104 if (tbl) tbl->printTable(os);
105}
106
107
108// Special function to create and store table for specified interaction
109
122#include "G4CascadeNNChannel.hh"
123#include "G4CascadeNPChannel.hh"
124#include "G4CascadePPChannel.hh"
144using namespace G4InuclParticleNames;
145
146const G4CascadeChannel* G4CascadeChannelTables::LoadTable(G4int initialState) {
147#ifdef G4CASCADE_DEBUG_SAMPLER
148 G4cout << "G4CascadeChannelTables::LoadTable " << initialState << G4endl;
149#endif
150
151 G4CascadeChannel* tbl = 0;
152 switch (initialState) {
153 case gam*neu: tbl = new G4CascadeGamNChannel; break;
154 case gam*pro: tbl = new G4CascadeGamPChannel; break;
155 case k0*neu: tbl = new G4CascadeKzeroNChannel; break;
156 case k0*pro: tbl = new G4CascadeKzeroPChannel; break;
157 case k0b*neu: tbl = new G4CascadeKzeroBarNChannel; break;
158 case k0b*pro: tbl = new G4CascadeKzeroBarPChannel; break;
159 case kmi*neu: tbl = new G4CascadeKminusNChannel; break;
160 case kmi*pro: tbl = new G4CascadeKminusPChannel; break;
161 case kpl*neu: tbl = new G4CascadeKplusNChannel; break;
162 case kpl*pro: tbl = new G4CascadeKplusPChannel; break;
163 case lam*neu: tbl = new G4CascadeLambdaNChannel; break;
164 case lam*pro: tbl = new G4CascadeLambdaPChannel; break;
165 case neu*neu: tbl = new G4CascadeNNChannel; break;
166 case neu*pro: tbl = new G4CascadeNPChannel; break;
167 case pi0*neu: tbl = new G4CascadePiZeroNChannel; break;
168 case pi0*pro: tbl = new G4CascadePiZeroPChannel; break;
169 case pim*neu: tbl = new G4CascadePiMinusNChannel; break;
170 case pim*pro: tbl = new G4CascadePiMinusPChannel; break;
171 case pip*neu: tbl = new G4CascadePiPlusNChannel; break;
172 case pip*pro: tbl = new G4CascadePiPlusPChannel; break;
173 case pro*pro: tbl = new G4CascadePPChannel; break;
174 case s0*neu: tbl = new G4CascadeSigmaZeroNChannel; break;
175 case s0*pro: tbl = new G4CascadeSigmaZeroPChannel; break;
176 case sm*neu: tbl = new G4CascadeSigmaMinusNChannel; break;
177 case sm*pro: tbl = new G4CascadeSigmaMinusPChannel; break;
178 case sp*neu: tbl = new G4CascadeSigmaPlusNChannel; break;
179 case sp*pro: tbl = new G4CascadeSigmaPlusPChannel; break;
180 case xi0*neu: tbl = new G4CascadeXiZeroNChannel; break;
181 case xi0*pro: tbl = new G4CascadeXiZeroPChannel; break;
182 case xim*neu: tbl = new G4CascadeXiMinusNChannel; break;
183 case xim*pro: tbl = new G4CascadeXiMinusPChannel; break;
184 case om*neu: tbl = new G4CascadeOmegaMinusNChannel; break;
185 case om*pro: tbl = new G4CascadeOmegaMinusPChannel; break;
186 default: tbl = 0;
187 }
188
189 SaveTable(initialState, tbl);
190 return tbl;
191}
G4CascadeFunctions< G4CascadeGamNChannelData, G4PionNucSampler > G4CascadeGamNChannel
G4CascadeFunctions< G4CascadeGamPChannelData, G4PionNucSampler > G4CascadeGamPChannel
G4CascadeFunctions< G4CascadeKminusNChannelData, G4KaonHypSampler > G4CascadeKminusNChannel
G4CascadeFunctions< G4CascadeKminusPChannelData, G4KaonHypSampler > G4CascadeKminusPChannel
G4CascadeFunctions< G4CascadeKplusNChannelData, G4KaonHypSampler > G4CascadeKplusNChannel
G4CascadeFunctions< G4CascadeKplusPChannelData, G4KaonHypSampler > G4CascadeKplusPChannel
G4CascadeFunctions< G4CascadeKzeroBarNChannelData, G4KaonHypSampler > G4CascadeKzeroBarNChannel
G4CascadeFunctions< G4CascadeKzeroBarPChannelData, G4KaonHypSampler > G4CascadeKzeroBarPChannel
G4CascadeFunctions< G4CascadeKzeroNChannelData, G4KaonHypSampler > G4CascadeKzeroNChannel
G4CascadeFunctions< G4CascadeKzeroPChannelData, G4KaonHypSampler > G4CascadeKzeroPChannel
G4CascadeFunctions< G4CascadeLambdaNChannelData, G4KaonHypSampler > G4CascadeLambdaNChannel
G4CascadeFunctions< G4CascadeLambdaPChannelData, G4KaonHypSampler > G4CascadeLambdaPChannel
G4CascadeFunctions< G4CascadeOmegaMinusNChannelData, G4KaonHypSampler > G4CascadeOmegaMinusNChannel
G4CascadeFunctions< G4CascadeOmegaMinusPChannelData, G4KaonHypSampler > G4CascadeOmegaMinusPChannel
G4CascadeFunctions< G4CascadePiMinusNChannelData, G4PionNucSampler > G4CascadePiMinusNChannel
G4CascadeFunctions< G4CascadePiMinusPChannelData, G4PionNucSampler > G4CascadePiMinusPChannel
G4CascadeFunctions< G4CascadePiPlusNChannelData, G4PionNucSampler > G4CascadePiPlusNChannel
G4CascadeFunctions< G4CascadePiPlusPChannelData, G4PionNucSampler > G4CascadePiPlusPChannel
G4CascadeFunctions< G4CascadePiZeroNChannelData, G4PionNucSampler > G4CascadePiZeroNChannel
G4CascadeFunctions< G4CascadePiZeroPChannelData, G4PionNucSampler > G4CascadePiZeroPChannel
G4CascadeFunctions< G4CascadeSigmaMinusNChannelData, G4KaonHypSampler > G4CascadeSigmaMinusNChannel
G4CascadeFunctions< G4CascadeSigmaMinusPChannelData, G4KaonHypSampler > G4CascadeSigmaMinusPChannel
G4CascadeFunctions< G4CascadeSigmaPlusNChannelData, G4KaonHypSampler > G4CascadeSigmaPlusNChannel
G4CascadeFunctions< G4CascadeSigmaPlusPChannelData, G4KaonHypSampler > G4CascadeSigmaPlusPChannel
G4CascadeFunctions< G4CascadeSigmaZeroNChannelData, G4KaonHypSampler > G4CascadeSigmaZeroNChannel
G4CascadeFunctions< G4CascadeSigmaZeroPChannelData, G4KaonHypSampler > G4CascadeSigmaZeroPChannel
G4CascadeFunctions< G4CascadeXiMinusNChannelData, G4KaonHypSampler > G4CascadeXiMinusNChannel
G4CascadeFunctions< G4CascadeXiMinusPChannelData, G4KaonHypSampler > G4CascadeXiMinusPChannel
G4CascadeFunctions< G4CascadeXiZeroNChannelData, G4KaonHypSampler > G4CascadeXiZeroNChannel
G4CascadeFunctions< G4CascadeXiZeroPChannelData, G4KaonHypSampler > G4CascadeXiZeroPChannel
int G4int
Definition: G4Types.hh:66
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
static const G4CascadeChannel * GetTable(G4int initialState)
static void AddTable(G4int initialState, G4CascadeChannel *table)
static void PrintTable(G4int initialState, std::ostream &os=G4cout)
virtual void printTable(std::ostream &os=G4cout) const =0