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 // 26 // >> 27 // $Id: G4OpRayleigh.cc 71487 2013-06-17 08:19:40Z gcosmo $ 27 // 28 // 28 // << 29 // 29 ////////////////////////////////////////////// 30 //////////////////////////////////////////////////////////////////////// 30 // Optical Photon Rayleigh Scattering Class Im 31 // Optical Photon Rayleigh Scattering Class Implementation 31 ////////////////////////////////////////////// 32 //////////////////////////////////////////////////////////////////////// 32 // 33 // 33 // File: G4OpRayleigh.cc << 34 // File: G4OpRayleigh.cc 34 // Description: Discrete Process -- Rayleigh s << 35 // Description: Discrete Process -- Rayleigh scattering of optical 35 // photons << 36 // photons 36 // Version: 1.0 37 // Version: 1.0 37 // Created: 1996-05-31 << 38 // Created: 1996-05-31 38 // Author: Juliet Armstrong 39 // Author: Juliet Armstrong 39 // Updated: 2014-10-10 - This version cal << 40 // Updated: 2010-06-11 - Fix Bug 207; Thanks to Xin Qian 40 // length for more materials than << 41 // default is kept). To do this t << 42 // ISOTHERMAL_COMPRESSIBILITY as << 43 // optionally an RS_SCALE_LENGTH << 44 // from Philip Graham (Queen Mary << 45 // 2010-06-11 - Fix Bug 207; Than << 46 // (Kellogg Radiation Lab of Calt 41 // (Kellogg Radiation Lab of Caltech) 47 // 2005-07-28 - add G4ProcessType 42 // 2005-07-28 - add G4ProcessType to constructor 48 // 2001-10-18 by Peter Gumplinger 43 // 2001-10-18 by Peter Gumplinger 49 // eliminate unused variable warn 44 // eliminate unused variable warning on Linux (gcc-2.95.2) 50 // 2001-09-18 by mma 45 // 2001-09-18 by mma 51 // >numOfMaterials=G4Material::Ge << 46 // >numOfMaterials=G4Material::GetNumberOfMaterials() in BuildPhy 52 // 2001-01-30 by Peter Gumplinger 47 // 2001-01-30 by Peter Gumplinger 53 // > allow for positiv and negati 48 // > allow for positiv and negative CosTheta and force the 54 // > new momentum direction to be 49 // > new momentum direction to be in the same plane as the 55 // > new and old polarization vec 50 // > new and old polarization vectors 56 // 2001-01-29 by Peter Gumplinger 51 // 2001-01-29 by Peter Gumplinger 57 // > fix calculation of SinTheta 52 // > fix calculation of SinTheta (from CosTheta) 58 // 1997-04-09 by Peter Gumplinger 53 // 1997-04-09 by Peter Gumplinger 59 // > new physics/tracking scheme 54 // > new physics/tracking scheme >> 55 // mail: gum@triumf.ca 60 // 56 // 61 ////////////////////////////////////////////// 57 //////////////////////////////////////////////////////////////////////// 62 58 63 #include "G4OpRayleigh.hh" 59 #include "G4OpRayleigh.hh" >> 60 64 #include "G4ios.hh" 61 #include "G4ios.hh" 65 #include "G4PhysicalConstants.hh" 62 #include "G4PhysicalConstants.hh" 66 #include "G4SystemOfUnits.hh" 63 #include "G4SystemOfUnits.hh" 67 #include "G4OpticalParameters.hh" << 68 #include "G4OpProcessSubType.hh" 64 #include "G4OpProcessSubType.hh" 69 65 70 //....oooOO0OOooo........oooOO0OOooo........oo << 66 ///////////////////////// >> 67 // Class Implementation >> 68 ///////////////////////// >> 69 >> 70 ////////////// >> 71 // Operators >> 72 ////////////// >> 73 >> 74 // G4OpRayleigh::operator=(const G4OpRayleigh &right) >> 75 // { >> 76 // } >> 77 >> 78 ///////////////// >> 79 // Constructors >> 80 ///////////////// >> 81 71 G4OpRayleigh::G4OpRayleigh(const G4String& pro 82 G4OpRayleigh::G4OpRayleigh(const G4String& processName, G4ProcessType type) 72 : G4VDiscreteProcess(processName, type) << 83 : G4VDiscreteProcess(processName, type) 73 { 84 { 74 Initialise(); << 85 SetProcessSubType(fOpRayleigh); 75 SetProcessSubType(fOpRayleigh); << 86 76 thePhysicsTable = nullptr; << 87 thePhysicsTable = NULL; 77 << 88 78 if(verboseLevel > 0) << 89 DefaultWater = false; 79 { << 90 80 G4cout << GetProcessName() << " is created << 91 if (verboseLevel>0) { 81 } << 92 G4cout << GetProcessName() << " is created " << G4endl; >> 93 } 82 } 94 } 83 95 84 //....oooOO0OOooo........oooOO0OOooo........oo << 96 // G4OpRayleigh::G4OpRayleigh(const G4OpRayleigh &right) >> 97 // { >> 98 // } >> 99 >> 100 //////////////// >> 101 // Destructors >> 102 //////////////// >> 103 85 G4OpRayleigh::~G4OpRayleigh() 104 G4OpRayleigh::~G4OpRayleigh() 86 { 105 { 87 // VI: inside this PhysicsTable all properti << 106 if (thePhysicsTable!= NULL) { 88 // it is not possible to destroy << 107 thePhysicsTable->clearAndDestroy(); 89 delete thePhysicsTable; << 108 delete thePhysicsTable; >> 109 } 90 } 110 } 91 111 92 //....oooOO0OOooo........oooOO0OOooo........oo << 112 //////////// 93 void G4OpRayleigh::PreparePhysicsTable(const G << 113 // Methods 94 { << 114 //////////// 95 Initialise(); << 96 } << 97 115 98 //....oooOO0OOooo........oooOO0OOooo........oo << 116 void G4OpRayleigh::BuildPhysicsTable(const G4ParticleDefinition&) 99 void G4OpRayleigh::Initialise() << 100 { 117 { 101 SetVerboseLevel(G4OpticalParameters::Instanc << 118 if (!thePhysicsTable) BuildThePhysicsTable(); 102 } 119 } 103 120 104 //....oooOO0OOooo........oooOO0OOooo........oo << 121 // PostStepDoIt 105 G4VParticleChange* G4OpRayleigh::PostStepDoIt( << 122 // ------------- 106 << 123 // >> 124 G4VParticleChange* >> 125 G4OpRayleigh::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep) 107 { 126 { 108 aParticleChange.Initialize(aTrack); << 127 aParticleChange.Initialize(aTrack); 109 const G4DynamicParticle* aParticle = aTrack. << 110 128 111 if(verboseLevel > 1) << 129 const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle(); 112 { << 113 G4cout << "OpRayleigh: Scattering Photon!" << 114 << "Old Momentum Direction: " << aP << 115 << G4endl << "Old Polarization: " < << 116 << G4endl; << 117 } << 118 << 119 G4double cosTheta; << 120 G4ThreeVector oldMomDir, newMomDir; << 121 G4ThreeVector oldPol, newPol; << 122 G4double rand; << 123 G4double cost, sint, sinphi, cosphi; << 124 << 125 do << 126 { << 127 // Try to simulate the scattered photon mo << 128 // w.r.t. the initial photon momentum dire << 129 cost = G4UniformRand(); << 130 sint = std::sqrt(1. - cost * cost); << 131 // consider for the angle 90-180 degrees << 132 if(G4UniformRand() < 0.5) << 133 cost = -cost; << 134 << 135 // simulate the phi angle << 136 rand = twopi * G4UniformRand(); << 137 sinphi = std::sin(rand); << 138 cosphi = std::cos(rand); << 139 << 140 // construct the new momentum direction << 141 newMomDir.set(sint * cosphi, sint * sinphi << 142 oldMomDir = aParticle->GetMomentumDirectio << 143 newMomDir.rotateUz(oldMomDir); << 144 << 145 // calculate the new polarization directio << 146 // The new polarization needs to be in the << 147 // momentum direction and the old polariza << 148 oldPol = aParticle->GetPolarization(); << 149 newPol = (oldPol - newMomDir.dot(oldPol) * << 150 << 151 // There is a corner case, where the new m << 152 // is the same as old polarization directi << 153 // random generate the azimuthal angle w.r << 154 if(newPol.mag() == 0.) << 155 { << 156 rand = G4UniformRand() * twopi; << 157 newPol.set(std::cos(rand), std::sin(rand << 158 newPol.rotateUz(newMomDir); << 159 } << 160 else << 161 { << 162 // There are two directions perpendicula << 163 if(G4UniformRand() < 0.5) << 164 newPol = -newPol; << 165 } << 166 << 167 // simulate according to the distribution << 168 cosTheta = newPol.dot(oldPol); << 169 // Loop checking, 13-Aug-2015, Peter Gumpl << 170 } while(std::pow(cosTheta, 2) < G4UniformRan << 171 << 172 aParticleChange.ProposePolarization(newPol); << 173 aParticleChange.ProposeMomentumDirection(new << 174 << 175 if(verboseLevel > 1) << 176 { << 177 G4cout << "New Polarization: " << newPol < << 178 << "Polarization Change: " << *(aPa << 179 << G4endl << "New Momentum Directio << 180 << "Momentum Change: " << *(aPartic << 181 << G4endl; << 182 } << 183 130 184 return G4VDiscreteProcess::PostStepDoIt(aTra << 131 if (verboseLevel>0) { 185 } << 132 G4cout << "Scattering Photon!" << G4endl; >> 133 G4cout << "Old Momentum Direction: " >> 134 << aParticle->GetMomentumDirection() << G4endl; >> 135 G4cout << "Old Polarization: " >> 136 << aParticle->GetPolarization() << G4endl; >> 137 } >> 138 >> 139 G4double cosTheta; >> 140 G4ThreeVector OldMomentumDirection, NewMomentumDirection; >> 141 G4ThreeVector OldPolarization, NewPolarization; >> 142 >> 143 do { >> 144 // Try to simulate the scattered photon momentum direction >> 145 // w.r.t. the initial photon momentum direction >> 146 >> 147 G4double CosTheta = G4UniformRand(); >> 148 G4double SinTheta = std::sqrt(1.-CosTheta*CosTheta); >> 149 // consider for the angle 90-180 degrees >> 150 if (G4UniformRand() < 0.5) CosTheta = -CosTheta; >> 151 >> 152 // simulate the phi angle >> 153 G4double rand = twopi*G4UniformRand(); >> 154 G4double SinPhi = std::sin(rand); >> 155 G4double CosPhi = std::cos(rand); >> 156 >> 157 // start constructing the new momentum direction >> 158 G4double unit_x = SinTheta * CosPhi; >> 159 G4double unit_y = SinTheta * SinPhi; >> 160 G4double unit_z = CosTheta; >> 161 NewMomentumDirection.set (unit_x,unit_y,unit_z); >> 162 >> 163 // Rotate the new momentum direction into global reference system >> 164 OldMomentumDirection = aParticle->GetMomentumDirection(); >> 165 OldMomentumDirection = OldMomentumDirection.unit(); >> 166 NewMomentumDirection.rotateUz(OldMomentumDirection); >> 167 NewMomentumDirection = NewMomentumDirection.unit(); >> 168 >> 169 // calculate the new polarization direction >> 170 // The new polarization needs to be in the same plane as the new >> 171 // momentum direction and the old polarization direction >> 172 OldPolarization = aParticle->GetPolarization(); >> 173 G4double constant = -1./NewMomentumDirection.dot(OldPolarization); >> 174 >> 175 NewPolarization = NewMomentumDirection + constant*OldPolarization; >> 176 NewPolarization = NewPolarization.unit(); >> 177 >> 178 // There is a corner case, where the Newmomentum direction >> 179 // is the same as oldpolariztion direction: >> 180 // random generate the azimuthal angle w.r.t. Newmomentum direction >> 181 if (NewPolarization.mag() == 0.) { >> 182 rand = G4UniformRand()*twopi; >> 183 NewPolarization.set(std::cos(rand),std::sin(rand),0.); >> 184 NewPolarization.rotateUz(NewMomentumDirection); >> 185 } else { >> 186 // There are two directions which are perpendicular >> 187 // to the new momentum direction >> 188 if (G4UniformRand() < 0.5) NewPolarization = -NewPolarization; >> 189 } >> 190 >> 191 // simulate according to the distribution cos^2(theta) >> 192 cosTheta = NewPolarization.dot(OldPolarization); >> 193 } while (std::pow(cosTheta,2) < G4UniformRand()); >> 194 >> 195 aParticleChange.ProposePolarization(NewPolarization); >> 196 aParticleChange.ProposeMomentumDirection(NewMomentumDirection); >> 197 >> 198 if (verboseLevel>0) { >> 199 G4cout << "New Polarization: " >> 200 << NewPolarization << G4endl; >> 201 G4cout << "Polarization Change: " >> 202 << *(aParticleChange.GetPolarization()) << G4endl; >> 203 G4cout << "New Momentum Direction: " >> 204 << NewMomentumDirection << G4endl; >> 205 G4cout << "Momentum Change: " >> 206 << *(aParticleChange.GetMomentumDirection()) << G4endl; >> 207 } 186 208 187 //....oooOO0OOooo........oooOO0OOooo........oo << 209 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep); 188 void G4OpRayleigh::BuildPhysicsTable(const G4P << 189 { << 190 if(thePhysicsTable) << 191 { << 192 // thePhysicsTable->clearAndDestroy(); << 193 delete thePhysicsTable; << 194 thePhysicsTable = nullptr; << 195 } << 196 << 197 const G4MaterialTable* theMaterialTable = G4 << 198 const size_t numOfMaterials = G4 << 199 thePhysicsTable = ne << 200 << 201 for(size_t i = 0; i < numOfMaterials; ++i) << 202 { << 203 G4Material* material = (*the << 204 G4MaterialPropertiesTable* matProp = mater << 205 G4PhysicsFreeVector* rayleigh = nullptr; << 206 if(matProp) << 207 { << 208 rayleigh = matProp->GetProperty(kRAYLEIG << 209 if(rayleigh == nullptr) << 210 rayleigh = CalculateRayleighMeanFreePa << 211 } << 212 thePhysicsTable->insertAt(i, rayleigh); << 213 } << 214 } 210 } 215 211 216 //....oooOO0OOooo........oooOO0OOooo........oo << 212 // BuildThePhysicsTable for the Rayleigh Scattering process 217 G4double G4OpRayleigh::GetMeanFreePath(const G << 213 // -------------------------------------------------------- 218 G4Force << 214 // >> 215 void G4OpRayleigh::BuildThePhysicsTable() 219 { 216 { 220 auto rayleigh = static_cast<G4PhysicsFreeVec << 217 // Builds a table of scattering lengths for each material 221 (*thePhysicsTable)(aTrack.GetMaterial()- << 218 >> 219 if (thePhysicsTable) return; >> 220 >> 221 const G4MaterialTable* theMaterialTable= >> 222 G4Material::GetMaterialTable(); >> 223 G4int numOfMaterials = G4Material::GetNumberOfMaterials(); >> 224 >> 225 // create a new physics table >> 226 >> 227 thePhysicsTable = new G4PhysicsTable(numOfMaterials); >> 228 >> 229 // loop for materials >> 230 >> 231 for (G4int i=0 ; i < numOfMaterials; i++) >> 232 { >> 233 G4PhysicsOrderedFreeVector* ScatteringLengths = NULL; >> 234 >> 235 G4MaterialPropertiesTable *aMaterialPropertiesTable = >> 236 (*theMaterialTable)[i]->GetMaterialPropertiesTable(); >> 237 >> 238 if(aMaterialPropertiesTable){ >> 239 >> 240 G4MaterialPropertyVector* AttenuationLengthVector = >> 241 aMaterialPropertiesTable->GetProperty("RAYLEIGH"); >> 242 >> 243 if(!AttenuationLengthVector){ >> 244 >> 245 if ((*theMaterialTable)[i]->GetName() == "Water") >> 246 { >> 247 // Call utility routine to Generate >> 248 // Rayleigh Scattering Lengths 222 249 223 G4double rsLength = DBL_MAX; << 250 DefaultWater = true; 224 if(rayleigh) << 251 225 { << 252 ScatteringLengths = 226 rsLength = rayleigh->Value(aTrack.GetDynam << 253 RayleighAttenuationLengthGenerator(aMaterialPropertiesTable); 227 idx_rslength); << 254 } 228 } << 255 } 229 return rsLength; << 256 } >> 257 >> 258 thePhysicsTable->insertAt(i,ScatteringLengths); >> 259 } 230 } 260 } 231 261 232 //....oooOO0OOooo........oooOO0OOooo........oo << 262 // GetMeanFreePath() 233 G4PhysicsFreeVector* G4OpRayleigh::CalculateRa << 263 // ----------------- 234 const G4Material* material) const << 264 // >> 265 G4double G4OpRayleigh::GetMeanFreePath(const G4Track& aTrack, >> 266 G4double , >> 267 G4ForceCondition* ) 235 { 268 { 236 G4MaterialPropertiesTable* MPT = material->G << 269 const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle(); >> 270 const G4Material* aMaterial = aTrack.GetMaterial(); 237 271 238 // Retrieve the beta_T or isothermal compres << 272 G4double thePhotonEnergy = aParticle->GetTotalEnergy(); 239 // compatibility use a constant if the mater << 240 // doesn't have an ISOTHERMAL_COMPRESSIBILIT << 241 G4double betat; << 242 if(material->GetName() == "Water") << 243 { << 244 betat = 7.658e-23 * m3 / MeV; << 245 } << 246 else if(MPT->ConstPropertyExists(kISOTHERMAL << 247 { << 248 betat = MPT->GetConstProperty(kISOTHERMAL_ << 249 } << 250 else << 251 { << 252 return nullptr; << 253 } << 254 << 255 // If the material doesn't have a RINDEX pro << 256 G4MaterialPropertyVector* rIndex = MPT->GetP << 257 if(rIndex == nullptr) << 258 return nullptr; << 259 << 260 // Retrieve the optional scale factor (scale << 261 G4double scaleFactor = 1.0; << 262 if(MPT->ConstPropertyExists(kRS_SCALE_FACTOR << 263 { << 264 scaleFactor = MPT->GetConstProperty(kRS_SC << 265 } << 266 << 267 // Retrieve the material temperature. For ba << 268 // constant if the material is "Water" << 269 G4double temperature; << 270 if(material->GetName() == "Water") << 271 { << 272 temperature = << 273 283.15 * kelvin; // Temperature of wate << 274 } << 275 else << 276 { << 277 temperature = material->GetTemperature(); << 278 } << 279 << 280 auto rayleighMFPs = new G4PhysicsFreeVector( << 281 // This calculates the meanFreePath via the << 282 const G4double c1 = << 283 scaleFactor * betat * temperature * k_Bolt << 284 << 285 for(size_t uRIndex = 0; uRIndex < rIndex->Ge << 286 { << 287 const G4double energy = rIndex->Ene << 288 const G4double rIndexSquared = (*rIndex)[u << 289 const G4double xlambda = h_Planck * << 290 const G4double c2 = std::pow(tw << 291 const G4double c3 = << 292 std::pow(((rIndexSquared - 1.0) * (rInde << 293 << 294 const G4double meanFreePath = 1.0 / (c1 * << 295 << 296 if(verboseLevel > 0) << 297 { << 298 G4cout << energy << "MeV\t" << meanFreeP << 299 } << 300 273 301 rayleighMFPs->InsertValues(energy, meanFre << 274 G4double AttenuationLength = DBL_MAX; 302 } << 303 275 304 return rayleighMFPs; << 276 if (aMaterial->GetName() == "Water" && DefaultWater){ >> 277 >> 278 G4bool isOutRange; >> 279 >> 280 AttenuationLength = >> 281 (*thePhysicsTable)(aMaterial->GetIndex())-> >> 282 GetValue(thePhotonEnergy, isOutRange); >> 283 } >> 284 else { >> 285 >> 286 G4MaterialPropertiesTable* aMaterialPropertyTable = >> 287 aMaterial->GetMaterialPropertiesTable(); >> 288 >> 289 if(aMaterialPropertyTable){ >> 290 G4MaterialPropertyVector* AttenuationLengthVector = >> 291 aMaterialPropertyTable->GetProperty("RAYLEIGH"); >> 292 if(AttenuationLengthVector){ >> 293 AttenuationLength = AttenuationLengthVector -> >> 294 Value(thePhotonEnergy); >> 295 } >> 296 else{ >> 297 // G4cout << "No Rayleigh scattering length specified" << G4endl; >> 298 } >> 299 } >> 300 else{ >> 301 // G4cout << "No Rayleigh scattering length specified" << G4endl; >> 302 } >> 303 } >> 304 >> 305 return AttenuationLength; 305 } 306 } 306 307 307 //....oooOO0OOooo........oooOO0OOooo........oo << 308 // RayleighAttenuationLengthGenerator() 308 void G4OpRayleigh::SetVerboseLevel(G4int verbo << 309 // ------------------------------------ >> 310 // Private method to compute Rayleigh Scattering Lengths (for water) >> 311 // >> 312 G4PhysicsOrderedFreeVector* >> 313 G4OpRayleigh::RayleighAttenuationLengthGenerator(G4MaterialPropertiesTable *aMPT) 309 { 314 { 310 verboseLevel = verbose; << 315 // Physical Constants 311 G4OpticalParameters::Instance()->SetRayleigh << 316 >> 317 // isothermal compressibility of water >> 318 G4double betat = 7.658e-23*m3/MeV; >> 319 >> 320 // K Boltzman >> 321 G4double kboltz = 8.61739e-11*MeV/kelvin; >> 322 >> 323 // Temperature of water is 10 degrees celsius >> 324 // conversion to kelvin: >> 325 // TCelsius = TKelvin - 273.15 => 273.15 + 10 = 283.15 >> 326 G4double temp = 283.15*kelvin; >> 327 >> 328 // Retrieve vectors for refraction index >> 329 // and photon energy from the material properties table >> 330 >> 331 G4MaterialPropertyVector* Rindex = aMPT->GetProperty("RINDEX"); >> 332 >> 333 G4double refsq; >> 334 G4double e; >> 335 G4double xlambda; >> 336 G4double c1, c2, c3, c4; >> 337 G4double Dist; >> 338 G4double refraction_index; >> 339 >> 340 G4PhysicsOrderedFreeVector *RayleighScatteringLengths = >> 341 new G4PhysicsOrderedFreeVector(); >> 342 >> 343 if (Rindex ) { >> 344 >> 345 for (size_t i = 0; i < Rindex->GetVectorLength(); i++) { >> 346 >> 347 e = Rindex->Energy(i); >> 348 >> 349 refraction_index = (*Rindex)[i]; >> 350 >> 351 refsq = refraction_index*refraction_index; >> 352 xlambda = h_Planck*c_light/e; >> 353 >> 354 if (verboseLevel>0) { >> 355 G4cout << Rindex->Energy(i) << " MeV\t"; >> 356 G4cout << xlambda << " mm\t"; >> 357 } >> 358 >> 359 c1 = 1 / (6.0 * pi); >> 360 c2 = std::pow((2.0 * pi / xlambda), 4); >> 361 c3 = std::pow( ( (refsq - 1.0) * (refsq + 2.0) / 3.0 ), 2); >> 362 c4 = betat * temp * kboltz; >> 363 >> 364 Dist = 1.0 / (c1*c2*c3*c4); >> 365 >> 366 if (verboseLevel>0) { >> 367 G4cout << Dist << " mm" << G4endl; >> 368 } >> 369 RayleighScatteringLengths-> >> 370 InsertValues(Rindex->Energy(i), Dist); >> 371 } >> 372 >> 373 } >> 374 >> 375 return RayleighScatteringLengths; 312 } 376 } 313 377