- Timestamp:
- Nov 5, 2010, 3:45:55 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeData.hh
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4CascadeData.hh,v 1. 7 2010/06/25 09:41:54 gunterExp $27 // GEANT4 tag: $Name: geant4-09-04-beta-01$26 // $Id: G4CascadeData.hh,v 1.10 2010/08/04 05:28:24 mkelsey Exp $ 27 // GEANT4 tag: $Name: hadr-casc-V09-03-85 $ 28 28 // 29 29 // 20100507 M. Kelsey -- Use template arguments to dimension const-refs … … 35 35 // 20100611 M. Kelsey -- Work around Intel ICC compiler warning about 36 36 // index[] subscripts out of range. Dimension to full [9]. 37 // 20100803 M. Kelsey -- Add printing function for debugging, split 38 // implementation code to .icc file. Add name argument. 37 39 38 40 #ifndef G4_CASCADE_DATA_HH … … 41 43 #include "globals.hh" 42 44 #include "G4CascadeSampler.hh" /* To get number of energy bins */ 45 #include "G4String.hh" 46 43 47 44 48 template <int NE,int N2,int N3,int N4,int N5,int N6,int N7,int N8=0,int N9=0> … … 72 76 static const G4int empty9bfs[1][9]; 73 77 78 const G4String name; // For diagnostic purposes 79 74 80 G4int maxMultiplicity() const { return NM+1; } // Used by G4CascadeFunctions 81 82 void print(G4int mult=-1) const; // Dump multiplicty tables (-1 == all) 83 void printXsec(const G4double (&xsec)[NE]) const; 75 84 76 85 // Constructor for kaon/hyperon channels, with multiplicity <= 7 … … 78 87 const G4int (&the4bfs)[N4][4], const G4int (&the5bfs)[N5][5], 79 88 const G4int (&the6bfs)[N6][6], const G4int (&the7bfs)[N7][7], 80 const G4double (&xsec)[NXS][NE]) 89 const G4double (&xsec)[NXS][NE], 90 const G4String& aName="G4CascadeData") 81 91 : x2bfs(the2bfs), x3bfs(the3bfs), x4bfs(the4bfs), x5bfs(the5bfs), 82 92 x6bfs(the6bfs), x7bfs(the7bfs), x8bfs(empty8bfs), x9bfs(empty9bfs), 83 crossSections(xsec), tot(sum) { initialize(); }93 crossSections(xsec), tot(sum), name(aName) { initialize(); } 84 94 85 95 // Constructor for kaon/hyperon channels, with multiplicity <= 7 and inclusive … … 87 97 const G4int (&the4bfs)[N4][4], const G4int (&the5bfs)[N5][5], 88 98 const G4int (&the6bfs)[N6][6], const G4int (&the7bfs)[N7][7], 89 const G4double (&xsec)[NXS][NE], const G4double (&theTot)[NE]) 99 const G4double (&xsec)[NXS][NE], const G4double (&theTot)[NE], 100 const G4String& aName="G4CascadeData") 90 101 : x2bfs(the2bfs), x3bfs(the3bfs), x4bfs(the4bfs), x5bfs(the5bfs), 91 102 x6bfs(the6bfs), x7bfs(the7bfs), x8bfs(empty8bfs), x9bfs(empty9bfs), 92 crossSections(xsec), tot(theTot) { initialize(); }103 crossSections(xsec), tot(theTot), name(aName) { initialize(); } 93 104 94 105 // Constructor for pion/nuleon channels, with multiplicity > 7 … … 97 108 const G4int (&the6bfs)[N6][6], const G4int (&the7bfs)[N7][7], 98 109 const G4int (&the8bfs)[N8D][8], const G4int (&the9bfs)[N9D][9], 99 const G4double (&xsec)[NXS][NE]) 110 const G4double (&xsec)[NXS][NE], 111 const G4String& aName="G4CascadeData") 100 112 : x2bfs(the2bfs), x3bfs(the3bfs), x4bfs(the4bfs), x5bfs(the5bfs), 101 113 x6bfs(the6bfs), x7bfs(the7bfs), x8bfs(the8bfs), x9bfs(the9bfs), 102 crossSections(xsec), tot(sum) { initialize(); }114 crossSections(xsec), tot(sum), name(aName) { initialize(); } 103 115 104 116 // Constructor for pion/nuleon channels, with multiplicity > 7 and inclusive … … 107 119 const G4int (&the6bfs)[N6][6], const G4int (&the7bfs)[N7][7], 108 120 const G4int (&the8bfs)[N8D][8], const G4int (&the9bfs)[N9D][9], 109 const G4double (&xsec)[NXS][NE], const G4double (&theTot)[NE]) 121 const G4double (&xsec)[NXS][NE], const G4double (&theTot)[NE], 122 const G4String& aName="G4CascadeData") 110 123 : x2bfs(the2bfs), x3bfs(the3bfs), x4bfs(the4bfs), x5bfs(the5bfs), 111 124 x6bfs(the6bfs), x7bfs(the7bfs), x8bfs(the8bfs), x9bfs(the9bfs), 112 crossSections(xsec), tot(theTot) { initialize(); } 125 crossSections(xsec), tot(theTot), name(aName) { initialize(); } 126 113 127 void initialize(); // Fill summed arrays from input 114 128 }; 115 116 template <int NE,int N2,int N3,int N4,int N5,int N6,int N7,int N8,int N9> inline117 void G4CascadeData<NE,N2,N3,N4,N5,N6,N7,N8,N9>::initialize() {118 // Initialize index offsets for cross-section array (can't do globally)119 index[0] = 0; index[1] = N02; index[2] = N23; index[3] = N24;120 index[4] = N25; index[5] = N26; index[6] = N27; index[7] = N28;121 index[8] = N29;122 123 // Initialize multiplicity array124 for (G4int m = 0; m < NM; m++) {125 G4int start = index[m];126 G4int stop = index[m+1];127 for (G4int k = 0; k < NE; k++) {128 multiplicities[m][k] = 0.0;129 for (G4int i = start; i < stop; i++) {130 multiplicities[m][k] += crossSections[i][k];131 }132 }133 }134 135 // Initialize total cross section array136 for (G4int k = 0; k < NE; k++) {137 sum[k] = 0.0;138 for (G4int m = 0; m < NM; m++) {139 sum[k] += multiplicities[m][k];140 }141 }142 }143 129 144 130 // Dummy arrays for use when optional template arguments are skipped … … 149 135 const G4int G4CascadeData<NE,N2,N3,N4,N5,N6,N7,N8,N9>::empty9bfs[1][9] = {{0}}; 150 136 137 // GCC and other compilers require template implementations here 138 #include "G4CascadeData.icc" 139 151 140 #endif
Note: See TracChangeset
for help on using the changeset viewer.