Ignore:
Timestamp:
Nov 5, 2010, 3:45:55 PM (14 years ago)
Author:
garnier
Message:

update ti head

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeData.hh

    r1337 r1340  
    2424// ********************************************************************
    2525//
    26 // $Id: G4CascadeData.hh,v 1.7 2010/06/25 09:41:54 gunter Exp $
    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 $
    2828//
    2929// 20100507  M. Kelsey -- Use template arguments to dimension const-refs
     
    3535// 20100611  M. Kelsey -- Work around Intel ICC compiler warning about
    3636//              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.
    3739
    3840#ifndef G4_CASCADE_DATA_HH
     
    4143#include "globals.hh"
    4244#include "G4CascadeSampler.hh"          /* To get number of energy bins */
     45#include "G4String.hh"
     46
    4347
    4448template <int NE,int N2,int N3,int N4,int N5,int N6,int N7,int N8=0,int N9=0>
     
    7276  static const G4int empty9bfs[1][9];
    7377
     78  const G4String name;                  // For diagnostic purposes
     79
    7480  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;
    7584
    7685  // Constructor for kaon/hyperon channels, with multiplicity <= 7
     
    7887                const G4int (&the4bfs)[N4][4], const G4int (&the5bfs)[N5][5],
    7988                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")
    8191    : x2bfs(the2bfs), x3bfs(the3bfs), x4bfs(the4bfs), x5bfs(the5bfs),
    8292      x6bfs(the6bfs), x7bfs(the7bfs), x8bfs(empty8bfs), x9bfs(empty9bfs),
    83       crossSections(xsec), tot(sum) { initialize(); }
     93      crossSections(xsec), tot(sum), name(aName) { initialize(); }
    8494
    8595  // Constructor for kaon/hyperon channels, with multiplicity <= 7 and inclusive
     
    8797                const G4int (&the4bfs)[N4][4], const G4int (&the5bfs)[N5][5],
    8898                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")
    90101    : x2bfs(the2bfs), x3bfs(the3bfs), x4bfs(the4bfs), x5bfs(the5bfs),
    91102      x6bfs(the6bfs), x7bfs(the7bfs), x8bfs(empty8bfs), x9bfs(empty9bfs),
    92       crossSections(xsec), tot(theTot) { initialize(); }
     103      crossSections(xsec), tot(theTot), name(aName) { initialize(); }
    93104
    94105  // Constructor for pion/nuleon channels, with multiplicity > 7
     
    97108                const G4int (&the6bfs)[N6][6], const G4int (&the7bfs)[N7][7],
    98109                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")
    100112    : x2bfs(the2bfs), x3bfs(the3bfs), x4bfs(the4bfs), x5bfs(the5bfs),
    101113      x6bfs(the6bfs), x7bfs(the7bfs), x8bfs(the8bfs), x9bfs(the9bfs),
    102       crossSections(xsec), tot(sum) { initialize(); }
     114      crossSections(xsec), tot(sum), name(aName) { initialize(); }
    103115
    104116  // Constructor for pion/nuleon channels, with multiplicity > 7 and inclusive
     
    107119                const G4int (&the6bfs)[N6][6], const G4int (&the7bfs)[N7][7],
    108120                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")
    110123    : x2bfs(the2bfs), x3bfs(the3bfs), x4bfs(the4bfs), x5bfs(the5bfs),
    111124      x6bfs(the6bfs), x7bfs(the7bfs), x8bfs(the8bfs), x9bfs(the9bfs),
    112       crossSections(xsec), tot(theTot) { initialize(); }
     125      crossSections(xsec), tot(theTot), name(aName) { initialize(); }
     126
    113127  void initialize();                    // Fill summed arrays from input
    114128};
    115 
    116 template <int NE,int N2,int N3,int N4,int N5,int N6,int N7,int N8,int N9> inline
    117 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 array
    124   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 array
    136   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 }
    143129
    144130// Dummy arrays for use when optional template arguments are skipped
     
    149135const G4int G4CascadeData<NE,N2,N3,N4,N5,N6,N7,N8,N9>::empty9bfs[1][9] = {{0}};
    150136
     137// GCC and other compilers require template implementations here
     138#include "G4CascadeData.icc"
     139
    151140#endif
Note: See TracChangeset for help on using the changeset viewer.