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, InterpolationTable const * const rpCorrelationTableProton, InterpolationTable const * const rpCorrelationTableNeutron) : 46 theA(A), 46 theA(A), 47 theZ(Z), 47 theZ(Z), 48 theS(S), << 49 theMaximumRadius(std::min((*rpCorrelationT 48 theMaximumRadius(std::min((*rpCorrelationTableProton)(1.), (*rpCorrelationTableNeutron)(1.))), 50 theProtonNuclearRadius(ParticleTable::getN 49 theProtonNuclearRadius(ParticleTable::getNuclearRadius(Proton,theA,theZ)) 51 { 50 { 52 std::fill(rFromP, rFromP + UnknownParticle 51 std::fill(rFromP, rFromP + UnknownParticle, static_cast<InterpolationTable*>(NULL)); 53 rFromP[Proton] = rpCorrelationTableProton; 52 rFromP[Proton] = rpCorrelationTableProton; 54 rFromP[Neutron] = rpCorrelationTableNeutro 53 rFromP[Neutron] = rpCorrelationTableNeutron; 55 rFromP[Lambda] = rpCorrelationTableLambda; << 56 rFromP[DeltaPlusPlus] = rpCorrelationTable 54 rFromP[DeltaPlusPlus] = rpCorrelationTableProton; 57 rFromP[DeltaPlus] = rpCorrelationTableProt 55 rFromP[DeltaPlus] = rpCorrelationTableProton; 58 rFromP[DeltaZero] = rpCorrelationTableNeut 56 rFromP[DeltaZero] = rpCorrelationTableNeutron; 59 rFromP[DeltaMinus] = rpCorrelationTableNeu 57 rFromP[DeltaMinus] = rpCorrelationTableNeutron; 60 // The interpolation table for local-energ 58 // The interpolation table for local-energy look-ups is simply obtained by 61 // inverting the r-p correlation table. 59 // inverting the r-p correlation table. 62 std::fill(pFromR, pFromR + UnknownParticle 60 std::fill(pFromR, pFromR + UnknownParticle, static_cast<InterpolationTable*>(NULL)); 63 pFromR[Proton] = new InterpolationTable(rF 61 pFromR[Proton] = new InterpolationTable(rFromP[Proton]->getNodeValues(), rFromP[Proton]->getNodeAbscissae()); 64 pFromR[Neutron] = new InterpolationTable(r 62 pFromR[Neutron] = new InterpolationTable(rFromP[Neutron]->getNodeValues(), rFromP[Neutron]->getNodeAbscissae()); 65 pFromR[Lambda] = new InterpolationTable(rF << 66 pFromR[DeltaPlusPlus] = new InterpolationT 63 pFromR[DeltaPlusPlus] = new InterpolationTable(rFromP[DeltaPlusPlus]->getNodeValues(), rFromP[DeltaPlusPlus]->getNodeAbscissae()); 67 pFromR[DeltaPlus] = new InterpolationTable 64 pFromR[DeltaPlus] = new InterpolationTable(rFromP[DeltaPlus]->getNodeValues(), rFromP[DeltaPlus]->getNodeAbscissae()); 68 pFromR[DeltaZero] = new InterpolationTable 65 pFromR[DeltaZero] = new InterpolationTable(rFromP[DeltaZero]->getNodeValues(), rFromP[DeltaZero]->getNodeAbscissae()); 69 pFromR[DeltaMinus] = new InterpolationTabl 66 pFromR[DeltaMinus] = new InterpolationTable(rFromP[DeltaMinus]->getNodeValues(), rFromP[DeltaMinus]->getNodeAbscissae()); 70 INCL_DEBUG("Interpolation table for proton 67 INCL_DEBUG("Interpolation table for proton local energy (A=" << theA << ", Z=" << theZ << ") initialised:" 71 << '\n' 68 << '\n' 72 << pFromR[Proton]->print() 69 << pFromR[Proton]->print() 73 << '\n' 70 << '\n' 74 << "Interpolation table for neutron 71 << "Interpolation table for neutron local energy (A=" << theA << ", Z=" << theZ << ") initialised:" 75 << '\n' 72 << '\n' 76 << pFromR[Neutron]->print() 73 << pFromR[Neutron]->print() 77 << '\n' 74 << '\n' 78 << "Interpolation table for lambda l << 79 << '\n' << 80 << pFromR[Lambda]->print() << 81 << '\n' << 82 << "Interpolation table for delta++ 75 << "Interpolation table for delta++ local energy (A=" << theA << ", Z=" << theZ << ") initialised:" 83 << '\n' 76 << '\n' 84 << pFromR[DeltaPlusPlus]->print() 77 << pFromR[DeltaPlusPlus]->print() 85 << '\n' 78 << '\n' 86 << "Interpolation table for delta+ l 79 << "Interpolation table for delta+ local energy (A=" << theA << ", Z=" << theZ << ") initialised:" 87 << '\n' 80 << '\n' 88 << pFromR[DeltaPlus]->print() 81 << pFromR[DeltaPlus]->print() 89 << '\n' 82 << '\n' 90 << "Interpolation table for delta0 l 83 << "Interpolation table for delta0 local energy (A=" << theA << ", Z=" << theZ << ") initialised:" 91 << '\n' 84 << '\n' 92 << pFromR[DeltaZero]->print() 85 << pFromR[DeltaZero]->print() 93 << '\n' 86 << '\n' 94 << "Interpolation table for delta- l 87 << "Interpolation table for delta- local energy (A=" << theA << ", Z=" << theZ << ") initialised:" 95 << '\n' 88 << '\n' 96 << pFromR[DeltaMinus]->print() 89 << pFromR[DeltaMinus]->print() 97 << '\n'); 90 << '\n'); 98 initializeTransmissionRadii(); 91 initializeTransmissionRadii(); 99 } 92 } 100 93 101 NuclearDensity::~NuclearDensity() { 94 NuclearDensity::~NuclearDensity() { 102 // We don't delete the rFromP tables, whic 95 // We don't delete the rFromP tables, which are cached in the 103 // NuclearDensityFactory 96 // NuclearDensityFactory 104 delete pFromR[Proton]; 97 delete pFromR[Proton]; 105 delete pFromR[Neutron]; 98 delete pFromR[Neutron]; 106 delete pFromR[Lambda]; << 107 delete pFromR[DeltaPlusPlus]; 99 delete pFromR[DeltaPlusPlus]; 108 delete pFromR[DeltaPlus]; 100 delete pFromR[DeltaPlus]; 109 delete pFromR[DeltaZero]; 101 delete pFromR[DeltaZero]; 110 delete pFromR[DeltaMinus]; 102 delete pFromR[DeltaMinus]; 111 } 103 } 112 104 113 NuclearDensity::NuclearDensity(const Nuclear 105 NuclearDensity::NuclearDensity(const NuclearDensity &rhs) : 114 theA(rhs.theA), 106 theA(rhs.theA), 115 theZ(rhs.theZ), 107 theZ(rhs.theZ), 116 theS(rhs.theS), << 117 theMaximumRadius(rhs.theMaximumRadius), 108 theMaximumRadius(rhs.theMaximumRadius), 118 theProtonNuclearRadius(rhs.theProtonNuclea 109 theProtonNuclearRadius(rhs.theProtonNuclearRadius) 119 { 110 { 120 // rFromP is owned by NuclearDensityFactor 111 // rFromP is owned by NuclearDensityFactory, so shallow copy is sufficient 121 std::fill(rFromP, rFromP + UnknownParticle 112 std::fill(rFromP, rFromP + UnknownParticle, static_cast<InterpolationTable*>(NULL)); 122 rFromP[Proton] = rhs.rFromP[Proton]; 113 rFromP[Proton] = rhs.rFromP[Proton]; 123 rFromP[Neutron] = rhs.rFromP[Neutron]; 114 rFromP[Neutron] = rhs.rFromP[Neutron]; 124 rFromP[Lambda] = rhs.rFromP[Lambda]; << 125 rFromP[DeltaPlusPlus] = rhs.rFromP[DeltaPl 115 rFromP[DeltaPlusPlus] = rhs.rFromP[DeltaPlusPlus]; 126 rFromP[DeltaPlus] = rhs.rFromP[DeltaPlus]; 116 rFromP[DeltaPlus] = rhs.rFromP[DeltaPlus]; 127 rFromP[DeltaZero] = rhs.rFromP[DeltaZero]; 117 rFromP[DeltaZero] = rhs.rFromP[DeltaZero]; 128 rFromP[DeltaMinus] = rhs.rFromP[DeltaMinus 118 rFromP[DeltaMinus] = rhs.rFromP[DeltaMinus]; 129 // deep copy for pFromR 119 // deep copy for pFromR 130 std::fill(pFromR, pFromR + UnknownParticle 120 std::fill(pFromR, pFromR + UnknownParticle, static_cast<InterpolationTable*>(NULL)); 131 pFromR[Proton] = new InterpolationTable(*( 121 pFromR[Proton] = new InterpolationTable(*(rhs.pFromR[Proton])); 132 pFromR[Neutron] = new InterpolationTable(* 122 pFromR[Neutron] = new InterpolationTable(*(rhs.pFromR[Neutron])); 133 pFromR[Lambda] = new InterpolationTable(*( << 134 pFromR[DeltaPlusPlus] = new InterpolationT 123 pFromR[DeltaPlusPlus] = new InterpolationTable(*(rhs.pFromR[DeltaPlusPlus])); 135 pFromR[DeltaPlus] = new InterpolationTable 124 pFromR[DeltaPlus] = new InterpolationTable(*(rhs.pFromR[DeltaPlus])); 136 pFromR[DeltaZero] = new InterpolationTable 125 pFromR[DeltaZero] = new InterpolationTable(*(rhs.pFromR[DeltaZero])); 137 pFromR[DeltaMinus] = new InterpolationTabl 126 pFromR[DeltaMinus] = new InterpolationTable(*(rhs.pFromR[DeltaMinus])); 138 std::copy(rhs.transmissionRadius, rhs.tran 127 std::copy(rhs.transmissionRadius, rhs.transmissionRadius+UnknownParticle, transmissionRadius); 139 } 128 } 140 129 141 NuclearDensity &NuclearDensity::operator=(co 130 NuclearDensity &NuclearDensity::operator=(const NuclearDensity &rhs) { 142 NuclearDensity temporaryDensity(rhs); 131 NuclearDensity temporaryDensity(rhs); 143 swap(temporaryDensity); 132 swap(temporaryDensity); 144 return *this; 133 return *this; 145 } 134 } 146 135 147 void NuclearDensity::swap(NuclearDensity &rh 136 void NuclearDensity::swap(NuclearDensity &rhs) { 148 std::swap(theA, rhs.theA); 137 std::swap(theA, rhs.theA); 149 std::swap(theZ, rhs.theZ); 138 std::swap(theZ, rhs.theZ); 150 std::swap(theS, rhs.theS); << 151 std::swap(theMaximumRadius, rhs.theMaximum 139 std::swap(theMaximumRadius, rhs.theMaximumRadius); 152 std::swap(theProtonNuclearRadius, rhs.theP 140 std::swap(theProtonNuclearRadius, rhs.theProtonNuclearRadius); 153 std::swap_ranges(transmissionRadius, trans 141 std::swap_ranges(transmissionRadius, transmissionRadius+UnknownParticle, rhs.transmissionRadius); 154 std::swap(rFromP[Proton], rhs.rFromP[Proto 142 std::swap(rFromP[Proton], rhs.rFromP[Proton]); 155 std::swap(rFromP[Neutron], rhs.rFromP[Neut 143 std::swap(rFromP[Neutron], rhs.rFromP[Neutron]); 156 std::swap(rFromP[Lambda], rhs.rFromP[Lambd << 157 std::swap(rFromP[DeltaPlusPlus], rhs.rFrom 144 std::swap(rFromP[DeltaPlusPlus], rhs.rFromP[DeltaPlusPlus]); 158 std::swap(rFromP[DeltaPlus], rhs.rFromP[De 145 std::swap(rFromP[DeltaPlus], rhs.rFromP[DeltaPlus]); 159 std::swap(rFromP[DeltaZero], rhs.rFromP[De 146 std::swap(rFromP[DeltaZero], rhs.rFromP[DeltaZero]); 160 std::swap(rFromP[DeltaMinus], rhs.rFromP[D 147 std::swap(rFromP[DeltaMinus], rhs.rFromP[DeltaMinus]); 161 std::swap(pFromR[Proton], rhs.pFromR[Proto 148 std::swap(pFromR[Proton], rhs.pFromR[Proton]); 162 std::swap(pFromR[Neutron], rhs.pFromR[Neut 149 std::swap(pFromR[Neutron], rhs.pFromR[Neutron]); 163 std::swap(pFromR[DeltaPlusPlus], rhs.pFrom 150 std::swap(pFromR[DeltaPlusPlus], rhs.pFromR[DeltaPlusPlus]); 164 std::swap(pFromR[DeltaPlus], rhs.pFromR[De 151 std::swap(pFromR[DeltaPlus], rhs.pFromR[DeltaPlus]); 165 std::swap(pFromR[DeltaZero], rhs.pFromR[De 152 std::swap(pFromR[DeltaZero], rhs.pFromR[DeltaZero]); 166 std::swap(pFromR[DeltaMinus], rhs.pFromR[D 153 std::swap(pFromR[DeltaMinus], rhs.pFromR[DeltaMinus]); 167 } 154 } 168 155 169 void NuclearDensity::initializeTransmissionR 156 void NuclearDensity::initializeTransmissionRadii() { 170 const G4double theProtonRadius = 0.88; // 157 const G4double theProtonRadius = 0.88; // fm 171 const G4double theProtonTransmissionRadius 158 const G4double theProtonTransmissionRadius = theProtonNuclearRadius + theProtonRadius; 172 159 173 transmissionRadius[Proton] = theProtonTran 160 transmissionRadius[Proton] = theProtonTransmissionRadius; 174 transmissionRadius[PiPlus] = theProtonNucl 161 transmissionRadius[PiPlus] = theProtonNuclearRadius; 175 transmissionRadius[PiMinus] = theProtonNuc 162 transmissionRadius[PiMinus] = theProtonNuclearRadius; 176 transmissionRadius[DeltaPlusPlus] = thePro 163 transmissionRadius[DeltaPlusPlus] = theProtonTransmissionRadius; 177 transmissionRadius[DeltaPlus] = theProtonT 164 transmissionRadius[DeltaPlus] = theProtonTransmissionRadius; 178 transmissionRadius[DeltaMinus] = theProton 165 transmissionRadius[DeltaMinus] = theProtonTransmissionRadius; 179 transmissionRadius[Composite] = theProtonN 166 transmissionRadius[Composite] = theProtonNuclearRadius; 180 transmissionRadius[SigmaPlus] = theProtonT << 181 transmissionRadius[SigmaMinus] = theProton << 182 transmissionRadius[KPlus] = theProtonNucle << 183 transmissionRadius[KMinus] = theProtonNucl << 184 transmissionRadius[antiProton] = theProton << 185 transmissionRadius[antiSigmaPlus] = thePro << 186 transmissionRadius[antiSigmaMinus] = thePr << 187 transmissionRadius[XiMinus] = theProtonTra << 188 transmissionRadius[antiXiMinus] = theProto << 189 << 190 // transmission radii for neutral particle 167 // transmission radii for neutral particles intentionally left uninitialised 191 } 168 } 192 169 193 G4double NuclearDensity::getMaxRFromP(Partic 170 G4double NuclearDensity::getMaxRFromP(ParticleType const t, const G4double p) const { 194 // assert(t==Proton || t==Neutron || t==Lambda << 171 // assert(t==Proton || t==Neutron || t==DeltaPlusPlus || t==DeltaPlus || t==DeltaZero || t==DeltaMinus); 195 return (*(rFromP[t]))(p); 172 return (*(rFromP[t]))(p); 196 } 173 } 197 174 198 G4double NuclearDensity::getMinPFromR(Partic 175 G4double NuclearDensity::getMinPFromR(ParticleType const t, const G4double r) const { 199 // assert(t==Proton || t==Neutron || t==Lambda << 176 // assert(t==Proton || t==Neutron || t==DeltaPlusPlus || t==DeltaPlus || t==DeltaZero || t==DeltaMinus); 200 return (*(pFromR[t]))(r); 177 return (*(pFromR[t]))(r); 201 } 178 } 202 179 203 } 180 } 204 181