Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4INCLNuclearDensity.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 // INCL++ intra-nuclear cascade model
27 // Alain Boudard, CEA-Saclay, France
28 // Joseph Cugnon, University of Liege, Belgium
29 // Jean-Christophe David, CEA-Saclay, France
30 // Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
31 // Sylvie Leray, CEA-Saclay, France
32 // Davide Mancusi, CEA-Saclay, France
33 //
34 #define INCLXX_IN_GEANT4_MODE 1
35 
36 #include "globals.hh"
37 
38 #include "G4INCLNuclearDensity.hh"
39 #include "G4INCLParticleTable.hh"
40 #include "G4INCLGlobals.hh"
41 #include <algorithm>
42 
43 namespace G4INCL {
44 
45  NuclearDensity::NuclearDensity(const G4int A, const G4int Z, InterpolationTable const * const rpCorrelationTableProton, InterpolationTable const * const rpCorrelationTableNeutron) :
46  theA(A),
47  theZ(Z),
48  theMaximumRadius(std::min((*rpCorrelationTableProton)(1.), (*rpCorrelationTableNeutron)(1.))),
49  theProtonNuclearRadius(ParticleTable::getNuclearRadius(Proton,theA,theZ))
50  {
51  std::fill(rFromP, rFromP + UnknownParticle, static_cast<InterpolationTable*>(NULL));
52  rFromP[Proton] = rpCorrelationTableProton;
53  rFromP[Neutron] = rpCorrelationTableNeutron;
54  rFromP[DeltaPlusPlus] = rpCorrelationTableProton;
55  rFromP[DeltaPlus] = rpCorrelationTableProton;
56  rFromP[DeltaZero] = rpCorrelationTableNeutron;
57  rFromP[DeltaMinus] = rpCorrelationTableNeutron;
58  // The interpolation table for local-energy look-ups is simply obtained by
59  // inverting the r-p correlation table.
60  std::fill(pFromR, pFromR + UnknownParticle, static_cast<InterpolationTable*>(NULL));
61  pFromR[Proton] = new InterpolationTable(rFromP[Proton]->getNodeValues(), rFromP[Proton]->getNodeAbscissae());
62  pFromR[Neutron] = new InterpolationTable(rFromP[Neutron]->getNodeValues(), rFromP[Neutron]->getNodeAbscissae());
63  pFromR[DeltaPlusPlus] = new InterpolationTable(rFromP[DeltaPlusPlus]->getNodeValues(), rFromP[DeltaPlusPlus]->getNodeAbscissae());
64  pFromR[DeltaPlus] = new InterpolationTable(rFromP[DeltaPlus]->getNodeValues(), rFromP[DeltaPlus]->getNodeAbscissae());
65  pFromR[DeltaZero] = new InterpolationTable(rFromP[DeltaZero]->getNodeValues(), rFromP[DeltaZero]->getNodeAbscissae());
66  pFromR[DeltaMinus] = new InterpolationTable(rFromP[DeltaMinus]->getNodeValues(), rFromP[DeltaMinus]->getNodeAbscissae());
67  INCL_DEBUG("Interpolation table for proton local energy (A=" << theA << ", Z=" << theZ << ") initialised:"
68  << '\n'
69  << pFromR[Proton]->print()
70  << '\n'
71  << "Interpolation table for neutron local energy (A=" << theA << ", Z=" << theZ << ") initialised:"
72  << '\n'
73  << pFromR[Neutron]->print()
74  << '\n'
75  << "Interpolation table for delta++ local energy (A=" << theA << ", Z=" << theZ << ") initialised:"
76  << '\n'
77  << pFromR[DeltaPlusPlus]->print()
78  << '\n'
79  << "Interpolation table for delta+ local energy (A=" << theA << ", Z=" << theZ << ") initialised:"
80  << '\n'
81  << pFromR[DeltaPlus]->print()
82  << '\n'
83  << "Interpolation table for delta0 local energy (A=" << theA << ", Z=" << theZ << ") initialised:"
84  << '\n'
85  << pFromR[DeltaZero]->print()
86  << '\n'
87  << "Interpolation table for delta- local energy (A=" << theA << ", Z=" << theZ << ") initialised:"
88  << '\n'
89  << pFromR[DeltaMinus]->print()
90  << '\n');
91  initializeTransmissionRadii();
92  }
93 
95  // We don't delete the rFromP tables, which are cached in the
96  // NuclearDensityFactory
97  delete pFromR[Proton];
98  delete pFromR[Neutron];
99  delete pFromR[DeltaPlusPlus];
100  delete pFromR[DeltaPlus];
101  delete pFromR[DeltaZero];
102  delete pFromR[DeltaMinus];
103  }
104 
106  theA(rhs.theA),
107  theZ(rhs.theZ),
108  theMaximumRadius(rhs.theMaximumRadius),
109  theProtonNuclearRadius(rhs.theProtonNuclearRadius)
110  {
111  // rFromP is owned by NuclearDensityFactory, so shallow copy is sufficient
112  std::fill(rFromP, rFromP + UnknownParticle, static_cast<InterpolationTable*>(NULL));
113  rFromP[Proton] = rhs.rFromP[Proton];
114  rFromP[Neutron] = rhs.rFromP[Neutron];
115  rFromP[DeltaPlusPlus] = rhs.rFromP[DeltaPlusPlus];
116  rFromP[DeltaPlus] = rhs.rFromP[DeltaPlus];
117  rFromP[DeltaZero] = rhs.rFromP[DeltaZero];
118  rFromP[DeltaMinus] = rhs.rFromP[DeltaMinus];
119  // deep copy for pFromR
120  std::fill(pFromR, pFromR + UnknownParticle, static_cast<InterpolationTable*>(NULL));
121  pFromR[Proton] = new InterpolationTable(*(rhs.pFromR[Proton]));
122  pFromR[Neutron] = new InterpolationTable(*(rhs.pFromR[Neutron]));
123  pFromR[DeltaPlusPlus] = new InterpolationTable(*(rhs.pFromR[DeltaPlusPlus]));
124  pFromR[DeltaPlus] = new InterpolationTable(*(rhs.pFromR[DeltaPlus]));
125  pFromR[DeltaZero] = new InterpolationTable(*(rhs.pFromR[DeltaZero]));
126  pFromR[DeltaMinus] = new InterpolationTable(*(rhs.pFromR[DeltaMinus]));
127  std::copy(rhs.transmissionRadius, rhs.transmissionRadius+UnknownParticle, transmissionRadius);
128  }
129 
131  NuclearDensity temporaryDensity(rhs);
132  swap(temporaryDensity);
133  return *this;
134  }
135 
137  std::swap(theA, rhs.theA);
138  std::swap(theZ, rhs.theZ);
139  std::swap(theMaximumRadius, rhs.theMaximumRadius);
140  std::swap(theProtonNuclearRadius, rhs.theProtonNuclearRadius);
141  std::swap_ranges(transmissionRadius, transmissionRadius+UnknownParticle, rhs.transmissionRadius);
142  std::swap(rFromP[Proton], rhs.rFromP[Proton]);
143  std::swap(rFromP[Neutron], rhs.rFromP[Neutron]);
144  std::swap(rFromP[DeltaPlusPlus], rhs.rFromP[DeltaPlusPlus]);
145  std::swap(rFromP[DeltaPlus], rhs.rFromP[DeltaPlus]);
146  std::swap(rFromP[DeltaZero], rhs.rFromP[DeltaZero]);
147  std::swap(rFromP[DeltaMinus], rhs.rFromP[DeltaMinus]);
148  std::swap(pFromR[Proton], rhs.pFromR[Proton]);
149  std::swap(pFromR[Neutron], rhs.pFromR[Neutron]);
150  std::swap(pFromR[DeltaPlusPlus], rhs.pFromR[DeltaPlusPlus]);
151  std::swap(pFromR[DeltaPlus], rhs.pFromR[DeltaPlus]);
152  std::swap(pFromR[DeltaZero], rhs.pFromR[DeltaZero]);
153  std::swap(pFromR[DeltaMinus], rhs.pFromR[DeltaMinus]);
154  }
155 
156  void NuclearDensity::initializeTransmissionRadii() {
157  const G4double theProtonRadius = 0.88; // fm
158  const G4double theProtonTransmissionRadius = theProtonNuclearRadius + theProtonRadius;
159 
160  transmissionRadius[Proton] = theProtonTransmissionRadius;
161  transmissionRadius[PiPlus] = theProtonNuclearRadius;
162  transmissionRadius[PiMinus] = theProtonNuclearRadius;
163  transmissionRadius[DeltaPlusPlus] = theProtonTransmissionRadius;
164  transmissionRadius[DeltaPlus] = theProtonTransmissionRadius;
165  transmissionRadius[DeltaMinus] = theProtonTransmissionRadius;
166  transmissionRadius[Composite] = theProtonNuclearRadius;
167  // transmission radii for neutral particles intentionally left uninitialised
168  }
169 
171 // assert(t==Proton || t==Neutron || t==DeltaPlusPlus || t==DeltaPlus || t==DeltaZero || t==DeltaMinus);
172  return (*(rFromP[t]))(p);
173  }
174 
176 // assert(t==Proton || t==Neutron || t==DeltaPlusPlus || t==DeltaPlus || t==DeltaZero || t==DeltaMinus);
177  return (*(pFromR[t]))(r);
178  }
179 
180 }
G4double getMinPFromR(const ParticleType t, const G4double r) const
const char * p
Definition: xmltok.h:285
NuclearDensity & operator=(const NuclearDensity &rhs)
Assignment operator.
int G4int
Definition: G4Types.hh:78
G4double getNuclearRadius(const ParticleType t, const G4int A, const G4int Z)
double A(double temperature)
void print(G4double elem)
void swap(NuclearDensity &rhs)
Helper method for the assignment operator.
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
double G4double
Definition: G4Types.hh:76
#define INCL_DEBUG(x)
Class for interpolating the of a 1-dimensional function.
G4double getMaxRFromP(const ParticleType t, const G4double p) const
Get the maximum allowed radius for a given momentum.
NuclearDensity(const G4int A, const G4int Z, InterpolationTable const *const rpCorrelationTableProton, InterpolationTable const *const rpCorrelationTableNeutron)