Warning, file /include/Geant4/G4CascadeFunctions.icc was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #ifndef G4_CASCADE_FUNCTIONS_ICC
0027 #define G4_CASCADE_FUNCTIONS_ICC
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041 #include "G4CascadeChannelTables.hh"
0042 #include "globals.hh"
0043
0044
0045
0046
0047 template <class DATA, class SAMP>
0048 G4CascadeFunctions<DATA,SAMP>::G4CascadeFunctions() : SAMP() {}
0049
0050
0051
0052
0053
0054 template <class DATA, class SAMP>
0055 G4int G4CascadeFunctions<DATA,SAMP>::getMultiplicity(G4double ke) const {
0056
0057 if (&DATA::data.sum != &DATA::data.tot) {
0058 G4double summed = this->findCrossSection(ke, DATA::data.sum);
0059 G4double total = this->findCrossSection(ke, DATA::data.tot);
0060 if (G4UniformRand() > summed/total) return DATA::data.maxMultiplicity();
0061 }
0062
0063 return this->findMultiplicity(ke, DATA::data.multiplicities);
0064 }
0065
0066
0067
0068
0069 template <class DATA, class SAMP>
0070 void G4CascadeFunctions<DATA,SAMP>::
0071 getOutgoingParticleTypes(std::vector<G4int>& kinds,
0072 G4int mult, G4double ke) const {
0073 const G4int maxMult = DATA::data.maxMultiplicity();
0074
0075 if (mult > maxMult) {
0076 G4cerr << " Illegal multiplicity " << mult << " > " << maxMult << G4endl;
0077 mult = maxMult;
0078 }
0079
0080 kinds.clear();
0081 kinds.reserve(mult);
0082
0083 G4int channel = this->findFinalStateIndex(mult, ke, DATA::data.index,
0084 DATA::data.crossSections);
0085 #ifdef G4CASCADE_DEBUG_SAMPLER
0086 G4cout << " getOutgoingParticleTypes: mult=" << mult << " KE=" << ke
0087 << ": channel=" << channel << G4endl;
0088 #endif
0089
0090
0091 const G4int* chan = 0;
0092 if (mult == 2) chan = DATA::data.x2bfs[channel];
0093 if (mult == 3) chan = DATA::data.x3bfs[channel];
0094 if (mult == 4) chan = DATA::data.x4bfs[channel];
0095 if (mult == 5) chan = DATA::data.x5bfs[channel];
0096 if (mult == 6) chan = DATA::data.x6bfs[channel];
0097 if (mult == 7) chan = DATA::data.x7bfs[channel];
0098 if (mult == 8) chan = DATA::data.x8bfs[channel];
0099 if (mult == 9) chan = DATA::data.x9bfs[channel];
0100
0101 if (!chan) {
0102 G4cerr << " getOutgoingParticleTypes: invalid multiplicity " << mult
0103 << G4endl;
0104 return;
0105 }
0106
0107 kinds.insert(kinds.begin(), chan, chan+mult);
0108 return;
0109 }
0110
0111
0112
0113
0114 template <class DATA, class SAMP>
0115 void G4CascadeFunctions<DATA,SAMP>::printTable(std::ostream& os) const {
0116 os << " ---------- " << DATA::data.name << " ----------" << G4endl;
0117 SAMP::print(os);
0118 DATA::data.print(os);
0119 os << " ------------------------------" << G4endl;
0120 }
0121
0122 #endif