Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:00

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 // 20100507  M. Kelsey -- Use template arguments to dimension const-refs
0028 //      to arrays,for use in passing to functions as dimensioned.
0029 //      Add two additional optional(!) template args for piN/NN.
0030 //      Add new data member "sum" to separate summed xsec values
0031 //      from measured inclusive (tot) cross-sections.  Add two
0032 //      ctors to pass inclusive xsec array as input (for piN/NN).
0033 // 20100611  M. Kelsey -- Work around Intel ICC compiler warning about
0034 //      index[] subscripts out of range.  Dimension to full [9].
0035 // 20100803  M. Kelsey -- Add printing function for debugging, split
0036 //      implementation code to .icc file.  Add name argument.
0037 // 20110718  M. Kelsey -- Add inelastic cross-section sum to deal with
0038 //      suppressing elastic scattering off free nucleons (hydrogen)
0039 // 20110719  M. Kelsey -- Add ctor argument for two-body initial state
0040 // 20110725  M. Kelsey -- Save initial state as data member
0041 // 20110923  M. Kelsey -- Add optional ostream& argument to print() fns
0042 
0043 #ifndef G4_CASCADE_DATA_HH
0044 #define G4_CASCADE_DATA_HH
0045 
0046 #include "globals.hh"
0047 #include "G4CascadeSampler.hh"      /* To get number of energy bins */
0048 #include "G4String.hh"
0049 
0050 
0051 template <int NE,int N2,int N3,int N4,int N5,int N6,int N7,int N8=0,int N9=0>
0052 struct G4CascadeData
0053 {
0054   // NOTE: Need access to N2 by value to initialize index array
0055   enum { N02=N2, N23=N2+N3, N24=N23+N4, N25=N24+N5, N26=N25+N6, N27=N26+N7,
0056      N28=N27+N8, N29=N28+N9 };
0057 
0058   enum { N8D=N8?N8:1, N9D=N9?N9:1 };    // SPECIAL: Can't dimension arrays [0]
0059 
0060   enum { NM=N9?8:N8?7:6, NXS=N29 }; // Multiplicity and cross-section bins
0061 
0062   G4int index[9];           // Start and stop indices to xsec's
0063   G4double multiplicities[NM][NE];  // Multiplicity distributions
0064 
0065   const G4int (&x2bfs)[N2][2];      // Initialized from file-scope inputs
0066   const G4int (&x3bfs)[N3][3];
0067   const G4int (&x4bfs)[N4][4];
0068   const G4int (&x5bfs)[N5][5];
0069   const G4int (&x6bfs)[N6][6];
0070   const G4int (&x7bfs)[N7][7];
0071   const G4int (&x8bfs)[N8D][8];     // These may not be used if mult==7
0072   const G4int (&x9bfs)[N9D][9];
0073   const G4double (&crossSections)[NXS][NE];
0074 
0075   G4double sum[NE];         // Summed cross-sections, computed
0076   const G4double (&tot)[NE];        // Inclusive cross-sections (from input)
0077 
0078   G4double inelastic[NE];       // Sum of only inelastic channels
0079 
0080   static const G4int empty8bfs[1][8];   // For multiplicity==7 case
0081   static const G4int empty9bfs[1][9];
0082 
0083   const G4String name;          // For diagnostic purposes
0084   const G4int initialState;     // For registration in lookup table
0085 
0086   G4int maxMultiplicity() const { return NM+1; }  // Used by G4CascadeFunctions
0087 
0088   // Dump multiplicty tables to specified stream
0089   void print(std::ostream& os=G4cout) const;
0090   void print(G4int mult, std::ostream& os) const;
0091   void printXsec(const G4double (&xsec)[NE], std::ostream& os) const;
0092 
0093   // Constructor for kaon/hyperon channels, with multiplicity <= 7
0094   G4CascadeData(const G4int (&the2bfs)[N2][2], const G4int (&the3bfs)[N3][3],
0095         const G4int (&the4bfs)[N4][4], const G4int (&the5bfs)[N5][5],
0096         const G4int (&the6bfs)[N6][6], const G4int (&the7bfs)[N7][7],
0097         const G4double (&xsec)[NXS][NE], G4int ini,
0098         const G4String& aName="G4CascadeData")
0099     : x2bfs(the2bfs), x3bfs(the3bfs), x4bfs(the4bfs), x5bfs(the5bfs),
0100       x6bfs(the6bfs), x7bfs(the7bfs), x8bfs(empty8bfs), x9bfs(empty9bfs),
0101       crossSections(xsec), tot(sum), name(aName), initialState(ini) {
0102     initialize();
0103   }
0104 
0105   // Constructor for kaon/hyperon channels, with multiplicity <= 7 and inclusive
0106   G4CascadeData(const G4int (&the2bfs)[N2][2], const G4int (&the3bfs)[N3][3],
0107         const G4int (&the4bfs)[N4][4], const G4int (&the5bfs)[N5][5],
0108         const G4int (&the6bfs)[N6][6], const G4int (&the7bfs)[N7][7],
0109         const G4double (&xsec)[NXS][NE], const G4double (&theTot)[NE],
0110         G4int ini, const G4String& aName="G4CascadeData")
0111     : x2bfs(the2bfs), x3bfs(the3bfs), x4bfs(the4bfs), x5bfs(the5bfs),
0112       x6bfs(the6bfs), x7bfs(the7bfs), x8bfs(empty8bfs), x9bfs(empty9bfs),
0113       crossSections(xsec), tot(theTot), name(aName), initialState(ini) {
0114     initialize();
0115   }
0116 
0117   // Constructor for pion/nucleon channels, with multiplicity > 7
0118   G4CascadeData(const G4int (&the2bfs)[N2][2], const G4int (&the3bfs)[N3][3],
0119         const G4int (&the4bfs)[N4][4], const G4int (&the5bfs)[N5][5],
0120         const G4int (&the6bfs)[N6][6], const G4int (&the7bfs)[N7][7],
0121         const G4int (&the8bfs)[N8D][8], const G4int (&the9bfs)[N9D][9],
0122         const G4double (&xsec)[NXS][NE], G4int ini,
0123         const G4String& aName="G4CascadeData")
0124     : x2bfs(the2bfs), x3bfs(the3bfs), x4bfs(the4bfs), x5bfs(the5bfs),
0125       x6bfs(the6bfs), x7bfs(the7bfs), x8bfs(the8bfs), x9bfs(the9bfs),
0126       crossSections(xsec), tot(sum), name(aName), initialState(ini) {
0127     initialize();
0128   }
0129 
0130   // Constructor for pion/nucleon channels, with multiplicity > 7 and inclusive
0131   G4CascadeData(const G4int (&the2bfs)[N2][2], const G4int (&the3bfs)[N3][3],
0132         const G4int (&the4bfs)[N4][4], const G4int (&the5bfs)[N5][5],
0133         const G4int (&the6bfs)[N6][6], const G4int (&the7bfs)[N7][7],
0134         const G4int (&the8bfs)[N8D][8], const G4int (&the9bfs)[N9D][9],
0135         const G4double (&xsec)[NXS][NE], const G4double (&theTot)[NE],
0136         G4int ini, const G4String& aName="G4CascadeData")
0137     : x2bfs(the2bfs), x3bfs(the3bfs), x4bfs(the4bfs), x5bfs(the5bfs),
0138       x6bfs(the6bfs), x7bfs(the7bfs), x8bfs(the8bfs), x9bfs(the9bfs),
0139       crossSections(xsec), tot(theTot), name(aName), initialState(ini) {
0140     initialize();
0141   }
0142 
0143   void initialize();            // Fill summed arrays from input
0144 };
0145 
0146 // Dummy arrays for use when optional template arguments are skipped
0147 template <int NE,int N2,int N3,int N4,int N5,int N6,int N7,int N8,int N9>
0148 const G4int G4CascadeData<NE,N2,N3,N4,N5,N6,N7,N8,N9>::empty8bfs[1][8] = {{0}};
0149 
0150 template <int NE,int N2,int N3,int N4,int N5,int N6,int N7,int N8,int N9>
0151 const G4int G4CascadeData<NE,N2,N3,N4,N5,N6,N7,N8,N9>::empty9bfs[1][9] = {{0}};
0152 
0153 // GCC and other compilers require template implementations here
0154 #include "G4CascadeData.icc"
0155 
0156 #endif