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