Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // INCL++ intra-nuclear cascade model 26 // INCL++ intra-nuclear cascade model 27 // Alain Boudard, CEA-Saclay, France 27 // Alain Boudard, CEA-Saclay, France 28 // Joseph Cugnon, University of Liege, Belgium 28 // Joseph Cugnon, University of Liege, Belgium 29 // Jean-Christophe David, CEA-Saclay, France 29 // Jean-Christophe David, CEA-Saclay, France 30 // Pekka Kaitaniemi, CEA-Saclay, France, and H 30 // Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland 31 // Sylvie Leray, CEA-Saclay, France 31 // Sylvie Leray, CEA-Saclay, France 32 // Davide Mancusi, CEA-Saclay, France 32 // Davide Mancusi, CEA-Saclay, France 33 // 33 // 34 #define INCLXX_IN_GEANT4_MODE 1 34 #define INCLXX_IN_GEANT4_MODE 1 35 35 36 #include "globals.hh" 36 #include "globals.hh" 37 37 38 #include "G4INCLNuclearDensity.hh" 38 #include "G4INCLNuclearDensity.hh" 39 #include "G4INCLParticleTable.hh" 39 #include "G4INCLParticleTable.hh" 40 #include "G4INCLGlobals.hh" 40 #include "G4INCLGlobals.hh" 41 #include <algorithm> 41 #include <algorithm> 42 42 43 namespace G4INCL { 43 namespace G4INCL { 44 44 45 NuclearDensity::NuclearDensity(const G4int A 45 NuclearDensity::NuclearDensity(const G4int A, const G4int Z, const G4int S, InterpolationTable const * const rpCorrelationTableProton, InterpolationTable const * const rpCorrelationTableNeutron, InterpolationTable const * const rpCorrelationTableLambda) : 46 theA(A), 46 theA(A), 47 theZ(Z), 47 theZ(Z), 48 theS(S), 48 theS(S), 49 theMaximumRadius(std::min((*rpCorrelationT 49 theMaximumRadius(std::min((*rpCorrelationTableProton)(1.), (*rpCorrelationTableNeutron)(1.))), 50 theProtonNuclearRadius(ParticleTable::getN 50 theProtonNuclearRadius(ParticleTable::getNuclearRadius(Proton,theA,theZ)) 51 { 51 { 52 std::fill(rFromP, rFromP + UnknownParticle 52 std::fill(rFromP, rFromP + UnknownParticle, static_cast<InterpolationTable*>(NULL)); 53 rFromP[Proton] = rpCorrelationTableProton; 53 rFromP[Proton] = rpCorrelationTableProton; 54 rFromP[Neutron] = rpCorrelationTableNeutro 54 rFromP[Neutron] = rpCorrelationTableNeutron; 55 rFromP[Lambda] = rpCorrelationTableLambda; 55 rFromP[Lambda] = rpCorrelationTableLambda; 56 rFromP[DeltaPlusPlus] = rpCorrelationTable 56 rFromP[DeltaPlusPlus] = rpCorrelationTableProton; 57 rFromP[DeltaPlus] = rpCorrelationTableProt 57 rFromP[DeltaPlus] = rpCorrelationTableProton; 58 rFromP[DeltaZero] = rpCorrelationTableNeut 58 rFromP[DeltaZero] = rpCorrelationTableNeutron; 59 rFromP[DeltaMinus] = rpCorrelationTableNeu 59 rFromP[DeltaMinus] = rpCorrelationTableNeutron; 60 // The interpolation table for local-energ 60 // The interpolation table for local-energy look-ups is simply obtained by 61 // inverting the r-p correlation table. 61 // inverting the r-p correlation table. 62 std::fill(pFromR, pFromR + UnknownParticle 62 std::fill(pFromR, pFromR + UnknownParticle, static_cast<InterpolationTable*>(NULL)); 63 pFromR[Proton] = new InterpolationTable(rF 63 pFromR[Proton] = new InterpolationTable(rFromP[Proton]->getNodeValues(), rFromP[Proton]->getNodeAbscissae()); 64 pFromR[Neutron] = new InterpolationTable(r 64 pFromR[Neutron] = new InterpolationTable(rFromP[Neutron]->getNodeValues(), rFromP[Neutron]->getNodeAbscissae()); 65 pFromR[Lambda] = new InterpolationTable(rF 65 pFromR[Lambda] = new InterpolationTable(rFromP[Lambda]->getNodeValues(), rFromP[Lambda]->getNodeAbscissae()); 66 pFromR[DeltaPlusPlus] = new InterpolationT 66 pFromR[DeltaPlusPlus] = new InterpolationTable(rFromP[DeltaPlusPlus]->getNodeValues(), rFromP[DeltaPlusPlus]->getNodeAbscissae()); 67 pFromR[DeltaPlus] = new InterpolationTable 67 pFromR[DeltaPlus] = new InterpolationTable(rFromP[DeltaPlus]->getNodeValues(), rFromP[DeltaPlus]->getNodeAbscissae()); 68 pFromR[DeltaZero] = new InterpolationTable 68 pFromR[DeltaZero] = new InterpolationTable(rFromP[DeltaZero]->getNodeValues(), rFromP[DeltaZero]->getNodeAbscissae()); 69 pFromR[DeltaMinus] = new InterpolationTabl 69 pFromR[DeltaMinus] = new InterpolationTable(rFromP[DeltaMinus]->getNodeValues(), rFromP[DeltaMinus]->getNodeAbscissae()); 70 INCL_DEBUG("Interpolation table for proton 70 INCL_DEBUG("Interpolation table for proton local energy (A=" << theA << ", Z=" << theZ << ") initialised:" 71 << '\n' 71 << '\n' 72 << pFromR[Proton]->print() 72 << pFromR[Proton]->print() 73 << '\n' 73 << '\n' 74 << "Interpolation table for neutron 74 << "Interpolation table for neutron local energy (A=" << theA << ", Z=" << theZ << ") initialised:" 75 << '\n' 75 << '\n' 76 << pFromR[Neutron]->print() 76 << pFromR[Neutron]->print() 77 << '\n' 77 << '\n' 78 << "Interpolation table for lambda l 78 << "Interpolation table for lambda local energy (A=" << theA << ", Z=" << theZ << ", S=" << theS << ") initialised:" 79 << '\n' 79 << '\n' 80 << pFromR[Lambda]->print() 80 << pFromR[Lambda]->print() 81 << '\n' 81 << '\n' 82 << "Interpolation table for delta++ 82 << "Interpolation table for delta++ local energy (A=" << theA << ", Z=" << theZ << ") initialised:" 83 << '\n' 83 << '\n' 84 << pFromR[DeltaPlusPlus]->print() 84 << pFromR[DeltaPlusPlus]->print() 85 << '\n' 85 << '\n' 86 << "Interpolation table for delta+ l 86 << "Interpolation table for delta+ local energy (A=" << theA << ", Z=" << theZ << ") initialised:" 87 << '\n' 87 << '\n' 88 << pFromR[DeltaPlus]->print() 88 << pFromR[DeltaPlus]->print() 89 << '\n' 89 << '\n' 90 << "Interpolation table for delta0 l 90 << "Interpolation table for delta0 local energy (A=" << theA << ", Z=" << theZ << ") initialised:" 91 << '\n' 91 << '\n' 92 << pFromR[DeltaZero]->print() 92 << pFromR[DeltaZero]->print() 93 << '\n' 93 << '\n' 94 << "Interpolation table for delta- l 94 << "Interpolation table for delta- local energy (A=" << theA << ", Z=" << theZ << ") initialised:" 95 << '\n' 95 << '\n' 96 << pFromR[DeltaMinus]->print() 96 << pFromR[DeltaMinus]->print() 97 << '\n'); 97 << '\n'); 98 initializeTransmissionRadii(); 98 initializeTransmissionRadii(); 99 } 99 } 100 100 101 NuclearDensity::~NuclearDensity() { 101 NuclearDensity::~NuclearDensity() { 102 // We don't delete the rFromP tables, whic 102 // We don't delete the rFromP tables, which are cached in the 103 // NuclearDensityFactory 103 // NuclearDensityFactory 104 delete pFromR[Proton]; 104 delete pFromR[Proton]; 105 delete pFromR[Neutron]; 105 delete pFromR[Neutron]; 106 delete pFromR[Lambda]; 106 delete pFromR[Lambda]; 107 delete pFromR[DeltaPlusPlus]; 107 delete pFromR[DeltaPlusPlus]; 108 delete pFromR[DeltaPlus]; 108 delete pFromR[DeltaPlus]; 109 delete pFromR[DeltaZero]; 109 delete pFromR[DeltaZero]; 110 delete pFromR[DeltaMinus]; 110 delete pFromR[DeltaMinus]; 111 } 111 } 112 112 113 NuclearDensity::NuclearDensity(const Nuclear 113 NuclearDensity::NuclearDensity(const NuclearDensity &rhs) : 114 theA(rhs.theA), 114 theA(rhs.theA), 115 theZ(rhs.theZ), 115 theZ(rhs.theZ), 116 theS(rhs.theS), 116 theS(rhs.theS), 117 theMaximumRadius(rhs.theMaximumRadius), 117 theMaximumRadius(rhs.theMaximumRadius), 118 theProtonNuclearRadius(rhs.theProtonNuclea 118 theProtonNuclearRadius(rhs.theProtonNuclearRadius) 119 { 119 { 120 // rFromP is owned by NuclearDensityFactor 120 // rFromP is owned by NuclearDensityFactory, so shallow copy is sufficient 121 std::fill(rFromP, rFromP + UnknownParticle 121 std::fill(rFromP, rFromP + UnknownParticle, static_cast<InterpolationTable*>(NULL)); 122 rFromP[Proton] = rhs.rFromP[Proton]; 122 rFromP[Proton] = rhs.rFromP[Proton]; 123 rFromP[Neutron] = rhs.rFromP[Neutron]; 123 rFromP[Neutron] = rhs.rFromP[Neutron]; 124 rFromP[Lambda] = rhs.rFromP[Lambda]; 124 rFromP[Lambda] = rhs.rFromP[Lambda]; 125 rFromP[DeltaPlusPlus] = rhs.rFromP[DeltaPl 125 rFromP[DeltaPlusPlus] = rhs.rFromP[DeltaPlusPlus]; 126 rFromP[DeltaPlus] = rhs.rFromP[DeltaPlus]; 126 rFromP[DeltaPlus] = rhs.rFromP[DeltaPlus]; 127 rFromP[DeltaZero] = rhs.rFromP[DeltaZero]; 127 rFromP[DeltaZero] = rhs.rFromP[DeltaZero]; 128 rFromP[DeltaMinus] = rhs.rFromP[DeltaMinus 128 rFromP[DeltaMinus] = rhs.rFromP[DeltaMinus]; 129 // deep copy for pFromR 129 // deep copy for pFromR 130 std::fill(pFromR, pFromR + UnknownParticle 130 std::fill(pFromR, pFromR + UnknownParticle, static_cast<InterpolationTable*>(NULL)); 131 pFromR[Proton] = new InterpolationTable(*( 131 pFromR[Proton] = new InterpolationTable(*(rhs.pFromR[Proton])); 132 pFromR[Neutron] = new InterpolationTable(* 132 pFromR[Neutron] = new InterpolationTable(*(rhs.pFromR[Neutron])); 133 pFromR[Lambda] = new InterpolationTable(*( 133 pFromR[Lambda] = new InterpolationTable(*(rhs.pFromR[Lambda])); 134 pFromR[DeltaPlusPlus] = new InterpolationT 134 pFromR[DeltaPlusPlus] = new InterpolationTable(*(rhs.pFromR[DeltaPlusPlus])); 135 pFromR[DeltaPlus] = new InterpolationTable 135 pFromR[DeltaPlus] = new InterpolationTable(*(rhs.pFromR[DeltaPlus])); 136 pFromR[DeltaZero] = new InterpolationTable 136 pFromR[DeltaZero] = new InterpolationTable(*(rhs.pFromR[DeltaZero])); 137 pFromR[DeltaMinus] = new InterpolationTabl 137 pFromR[DeltaMinus] = new InterpolationTable(*(rhs.pFromR[DeltaMinus])); 138 std::copy(rhs.transmissionRadius, rhs.tran 138 std::copy(rhs.transmissionRadius, rhs.transmissionRadius+UnknownParticle, transmissionRadius); 139 } 139 } 140 140 141 NuclearDensity &NuclearDensity::operator=(co 141 NuclearDensity &NuclearDensity::operator=(const NuclearDensity &rhs) { 142 NuclearDensity temporaryDensity(rhs); 142 NuclearDensity temporaryDensity(rhs); 143 swap(temporaryDensity); 143 swap(temporaryDensity); 144 return *this; 144 return *this; 145 } 145 } 146 146 147 void NuclearDensity::swap(NuclearDensity &rh 147 void NuclearDensity::swap(NuclearDensity &rhs) { 148 std::swap(theA, rhs.theA); 148 std::swap(theA, rhs.theA); 149 std::swap(theZ, rhs.theZ); 149 std::swap(theZ, rhs.theZ); 150 std::swap(theS, rhs.theS); 150 std::swap(theS, rhs.theS); 151 std::swap(theMaximumRadius, rhs.theMaximum 151 std::swap(theMaximumRadius, rhs.theMaximumRadius); 152 std::swap(theProtonNuclearRadius, rhs.theP 152 std::swap(theProtonNuclearRadius, rhs.theProtonNuclearRadius); 153 std::swap_ranges(transmissionRadius, trans 153 std::swap_ranges(transmissionRadius, transmissionRadius+UnknownParticle, rhs.transmissionRadius); 154 std::swap(rFromP[Proton], rhs.rFromP[Proto 154 std::swap(rFromP[Proton], rhs.rFromP[Proton]); 155 std::swap(rFromP[Neutron], rhs.rFromP[Neut 155 std::swap(rFromP[Neutron], rhs.rFromP[Neutron]); 156 std::swap(rFromP[Lambda], rhs.rFromP[Lambd 156 std::swap(rFromP[Lambda], rhs.rFromP[Lambda]); 157 std::swap(rFromP[DeltaPlusPlus], rhs.rFrom 157 std::swap(rFromP[DeltaPlusPlus], rhs.rFromP[DeltaPlusPlus]); 158 std::swap(rFromP[DeltaPlus], rhs.rFromP[De 158 std::swap(rFromP[DeltaPlus], rhs.rFromP[DeltaPlus]); 159 std::swap(rFromP[DeltaZero], rhs.rFromP[De 159 std::swap(rFromP[DeltaZero], rhs.rFromP[DeltaZero]); 160 std::swap(rFromP[DeltaMinus], rhs.rFromP[D 160 std::swap(rFromP[DeltaMinus], rhs.rFromP[DeltaMinus]); 161 std::swap(pFromR[Proton], rhs.pFromR[Proto 161 std::swap(pFromR[Proton], rhs.pFromR[Proton]); 162 std::swap(pFromR[Neutron], rhs.pFromR[Neut 162 std::swap(pFromR[Neutron], rhs.pFromR[Neutron]); 163 std::swap(pFromR[DeltaPlusPlus], rhs.pFrom 163 std::swap(pFromR[DeltaPlusPlus], rhs.pFromR[DeltaPlusPlus]); 164 std::swap(pFromR[DeltaPlus], rhs.pFromR[De 164 std::swap(pFromR[DeltaPlus], rhs.pFromR[DeltaPlus]); 165 std::swap(pFromR[DeltaZero], rhs.pFromR[De 165 std::swap(pFromR[DeltaZero], rhs.pFromR[DeltaZero]); 166 std::swap(pFromR[DeltaMinus], rhs.pFromR[D 166 std::swap(pFromR[DeltaMinus], rhs.pFromR[DeltaMinus]); 167 } 167 } 168 168 169 void NuclearDensity::initializeTransmissionR 169 void NuclearDensity::initializeTransmissionRadii() { 170 const G4double theProtonRadius = 0.88; // 170 const G4double theProtonRadius = 0.88; // fm 171 const G4double theProtonTransmissionRadius 171 const G4double theProtonTransmissionRadius = theProtonNuclearRadius + theProtonRadius; 172 172 173 transmissionRadius[Proton] = theProtonTran 173 transmissionRadius[Proton] = theProtonTransmissionRadius; 174 transmissionRadius[PiPlus] = theProtonNucl 174 transmissionRadius[PiPlus] = theProtonNuclearRadius; 175 transmissionRadius[PiMinus] = theProtonNuc 175 transmissionRadius[PiMinus] = theProtonNuclearRadius; 176 transmissionRadius[DeltaPlusPlus] = thePro 176 transmissionRadius[DeltaPlusPlus] = theProtonTransmissionRadius; 177 transmissionRadius[DeltaPlus] = theProtonT 177 transmissionRadius[DeltaPlus] = theProtonTransmissionRadius; 178 transmissionRadius[DeltaMinus] = theProton 178 transmissionRadius[DeltaMinus] = theProtonTransmissionRadius; 179 transmissionRadius[Composite] = theProtonN 179 transmissionRadius[Composite] = theProtonNuclearRadius; 180 transmissionRadius[SigmaPlus] = theProtonT 180 transmissionRadius[SigmaPlus] = theProtonTransmissionRadius; 181 transmissionRadius[SigmaMinus] = theProton 181 transmissionRadius[SigmaMinus] = theProtonTransmissionRadius; 182 transmissionRadius[KPlus] = theProtonNucle 182 transmissionRadius[KPlus] = theProtonNuclearRadius; 183 transmissionRadius[KMinus] = theProtonNucl 183 transmissionRadius[KMinus] = theProtonNuclearRadius; 184 transmissionRadius[antiProton] = theProton << 184 185 transmissionRadius[antiSigmaPlus] = thePro << 186 transmissionRadius[antiSigmaMinus] = thePr << 187 transmissionRadius[XiMinus] = theProtonTra << 188 transmissionRadius[antiXiMinus] = theProto << 189 << 190 // transmission radii for neutral particle 185 // transmission radii for neutral particles intentionally left uninitialised 191 } 186 } 192 187 193 G4double NuclearDensity::getMaxRFromP(Partic 188 G4double NuclearDensity::getMaxRFromP(ParticleType const t, const G4double p) const { 194 // assert(t==Proton || t==Neutron || t==Lambda 189 // assert(t==Proton || t==Neutron || t==Lambda || t==DeltaPlusPlus || t==DeltaPlus || t==DeltaZero || t==DeltaMinus); 195 return (*(rFromP[t]))(p); 190 return (*(rFromP[t]))(p); 196 } 191 } 197 192 198 G4double NuclearDensity::getMinPFromR(Partic 193 G4double NuclearDensity::getMinPFromR(ParticleType const t, const G4double r) const { 199 // assert(t==Proton || t==Neutron || t==Lambda 194 // assert(t==Proton || t==Neutron || t==Lambda || t==DeltaPlusPlus || t==DeltaPlus || t==DeltaZero || t==DeltaMinus); 200 return (*(pFromR[t]))(r); 195 return (*(pFromR[t]))(r); 201 } 196 } 202 197 203 } 198 } 204 199