Geant4 11.1.1
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//
27// Factory to return pointer to Bertini cross-section table based on
28// collision initial state (hadron type codes).
29//
30// Author: Michael Kelsey (SLAC)
31//
32// 20110729 M. Kelsey -- Use static instance() function to work around
33// "disappearance" bug on Linux (GCC 4.1.2). Add diagnostics.
34// 20110916 M. Kelsey -- Add "load on demand" to GetTable(), with full set
35// of channel .hh files for use with LoadTable().
36// 20110923 M. Kelsey -- Add optional stream& argument to printTable(),
37// pass through.
38// 20111007 M. Kelsey -- Add new gamma-n and gamma-p tables.
39// 20130129 M. Kelsey -- Drop load-on-demand interfaces, fill in ctor
40// 20130429 M. Kelsey -- Change instance to thread-local pointer.
41// 20141121 Use G4AutoDelete to avoid end-of-thread memory leaks
42
44#include "G4AutoDelete.hh"
45#include "G4CascadeChannel.hh"
58#include "G4CascadeNNChannel.hh"
59#include "G4CascadeNPChannel.hh"
60#include "G4CascadePPChannel.hh"
81#include <iostream>
82#include <map>
83using namespace G4InuclParticleNames;
84
85
86// Singleton is created at first invocation
87
88const G4CascadeChannelTables& G4CascadeChannelTables::instance() {
90 return _instance;
91}
92
93// Constructor and destructor fully populate tables
94
95G4CascadeChannelTables::G4CascadeChannelTables() {
96 tables.clear();
97 tables[gam*neu] = new G4CascadeGamNChannel;
98 tables[gam*pro] = new G4CascadeGamPChannel;
99 tables[k0*neu] = new G4CascadeKzeroNChannel;
100 tables[k0*pro] = new G4CascadeKzeroPChannel;
101 tables[k0b*neu] = new G4CascadeKzeroBarNChannel;
102 tables[k0b*pro] = new G4CascadeKzeroBarPChannel;
103 tables[kmi*neu] = new G4CascadeKminusNChannel;
104 tables[kmi*pro] = new G4CascadeKminusPChannel;
105 tables[kpl*neu] = new G4CascadeKplusNChannel;
106 tables[kpl*pro] = new G4CascadeKplusPChannel;
107 tables[lam*neu] = new G4CascadeLambdaNChannel;
108 tables[lam*pro] = new G4CascadeLambdaPChannel;
109 tables[neu*neu] = new G4CascadeNNChannel;
110 tables[neu*pro] = new G4CascadeNPChannel;
111 tables[pi0*neu] = new G4CascadePiZeroNChannel;
112 tables[pi0*pro] = new G4CascadePiZeroPChannel;
113 tables[pim*neu] = new G4CascadePiMinusNChannel;
114 tables[pim*pro] = new G4CascadePiMinusPChannel;
115 tables[pip*neu] = new G4CascadePiPlusNChannel;
116 tables[pip*pro] = new G4CascadePiPlusPChannel;
117 tables[pro*pro] = new G4CascadePPChannel;
118 tables[s0*neu] = new G4CascadeSigmaZeroNChannel;
119 tables[s0*pro] = new G4CascadeSigmaZeroPChannel;
120 tables[sm*neu] = new G4CascadeSigmaMinusNChannel;
121 tables[sm*pro] = new G4CascadeSigmaMinusPChannel;
122 tables[sp*neu] = new G4CascadeSigmaPlusNChannel;
123 tables[sp*pro] = new G4CascadeSigmaPlusPChannel;
124 tables[xi0*neu] = new G4CascadeXiZeroNChannel;
125 tables[xi0*pro] = new G4CascadeXiZeroPChannel;
126 tables[xim*neu] = new G4CascadeXiMinusNChannel;
127 tables[xim*pro] = new G4CascadeXiMinusPChannel;
128 tables[om*neu] = new G4CascadeOmegaMinusNChannel;
129 tables[om*pro] = new G4CascadeOmegaMinusPChannel;
130 tables[mum*pro] = new G4CascadeMuMinusPChannel;
131}
132
134 for(auto& itr : tables)
135 delete itr.second;
136 tables.clear();
137}
138
139
140// Argument is interaction code, product of G4InuclEP types
141
143 return instance().FindTable(initialState);
144}
145
146// Arguments are individual G4InuclElementaryParticle types
147
148const G4CascadeChannel*
150 return GetTable(had1*had2);
151}
152
153// Return cross-section table requested by user
154
155const G4CascadeChannel*
156G4CascadeChannelTables::FindTable(G4int initialState) const {
157#ifdef G4CASCADE_DEBUG_SAMPLER
158 G4cout << "G4CascadeChannelTables::FindTable " << initialState << G4endl;
159#endif
160 TableMap::const_iterator entry = tables.find(initialState);
161 return (entry != tables.end()) ? entry->second : 0;
162}
163
164
165// Convenience functions for diagnostic output
166
167void G4CascadeChannelTables::Print(std::ostream& os) {
168 const TableMap& theTables = instance().tables; // For convenience
169 TableMap::const_iterator entry;
170 for (entry = theTables.begin(); entry != theTables.end(); ++entry) {
171 if (entry->second) entry->second->printTable(os);
172 }
173}
174
175void G4CascadeChannelTables::PrintTable(G4int initialState, std::ostream& os) {
176 const G4CascadeChannel* tbl = GetTable(initialState);
177 if (tbl) tbl->printTable(os);
178}
G4CascadeFunctions< G4CascadeGamNChannelData, G4PionNucSampler > G4CascadeGamNChannel
G4CascadeFunctions< G4CascadeGamPChannelData, G4PionNucSampler > G4CascadeGamPChannel
G4CascadeFunctions< G4CascadeKminusNChannelData, G4KaonSampler > G4CascadeKminusNChannel
G4CascadeFunctions< G4CascadeKminusPChannelData, G4KaonSampler > G4CascadeKminusPChannel
G4CascadeFunctions< G4CascadeKplusNChannelData, G4KaonSampler > G4CascadeKplusNChannel
G4CascadeFunctions< G4CascadeKplusPChannelData, G4KaonSampler > G4CascadeKplusPChannel
G4CascadeFunctions< G4CascadeKzeroBarNChannelData, G4KaonSampler > G4CascadeKzeroBarNChannel
G4CascadeFunctions< G4CascadeKzeroBarPChannelData, G4KaonSampler > G4CascadeKzeroBarPChannel
G4CascadeFunctions< G4CascadeKzeroNChannelData, G4KaonSampler > G4CascadeKzeroNChannel
G4CascadeFunctions< G4CascadeKzeroPChannelData, G4KaonSampler > G4CascadeKzeroPChannel
G4CascadeFunctions< G4CascadeLambdaNChannelData, G4KaonHypSampler > G4CascadeLambdaNChannel
G4CascadeFunctions< G4CascadeLambdaPChannelData, G4KaonHypSampler > G4CascadeLambdaPChannel
G4CascadeFunctions< G4CascadeMuMinusPChannelData, G4PionNucSampler > G4CascadeMuMinusPChannel
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:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static void Print(std::ostream &os=G4cout)
static const G4CascadeChannel * GetTable(G4int initialState)
static void PrintTable(G4int initialState, std::ostream &os=G4cout)
virtual void printTable(std::ostream &os=G4cout) const =0
#define G4ThreadLocalStatic
Definition: tls.hh:76