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 // $Id: G4PAIPhotModel.cc 73607 2013-09-02 10:04:03Z gcosmo $ 26 // 27 // 27 // ------------------------------------------- 28 // ------------------------------------------------------------------- 28 // 29 // 29 // GEANT4 Class 30 // GEANT4 Class 30 // File name: G4PAIPhotModel.cc 31 // File name: G4PAIPhotModel.cc 31 // 32 // 32 // Author: Vladimir.Grichine@cern.ch on base o 33 // Author: Vladimir.Grichine@cern.ch on base of G4PAIModel MT interface 33 // 34 // 34 // Creation date: 07.10.2013 35 // Creation date: 07.10.2013 35 // 36 // 36 // Modifications: 37 // Modifications: 37 // 38 // 38 // 39 // 39 40 40 #include "G4PAIPhotModel.hh" 41 #include "G4PAIPhotModel.hh" 41 42 42 #include "G4SystemOfUnits.hh" 43 #include "G4SystemOfUnits.hh" 43 #include "G4PhysicalConstants.hh" 44 #include "G4PhysicalConstants.hh" 44 #include "G4Region.hh" 45 #include "G4Region.hh" >> 46 #include "G4PhysicsLogVector.hh" >> 47 #include "G4PhysicsFreeVector.hh" >> 48 #include "G4PhysicsTable.hh" 45 #include "G4ProductionCutsTable.hh" 49 #include "G4ProductionCutsTable.hh" 46 #include "G4MaterialCutsCouple.hh" 50 #include "G4MaterialCutsCouple.hh" 47 #include "G4MaterialTable.hh" 51 #include "G4MaterialTable.hh" 48 #include "G4RegionStore.hh" << 52 #include "G4SandiaTable.hh" >> 53 #include "G4OrderedTable.hh" 49 54 50 #include "Randomize.hh" 55 #include "Randomize.hh" 51 #include "G4Electron.hh" 56 #include "G4Electron.hh" 52 #include "G4Positron.hh" 57 #include "G4Positron.hh" 53 #include "G4Gamma.hh" 58 #include "G4Gamma.hh" 54 #include "G4Poisson.hh" 59 #include "G4Poisson.hh" 55 #include "G4Step.hh" 60 #include "G4Step.hh" 56 #include "G4Material.hh" 61 #include "G4Material.hh" 57 #include "G4DynamicParticle.hh" 62 #include "G4DynamicParticle.hh" 58 #include "G4ParticleDefinition.hh" 63 #include "G4ParticleDefinition.hh" 59 #include "G4ParticleChangeForLoss.hh" 64 #include "G4ParticleChangeForLoss.hh" 60 #include "G4PAIPhotData.hh" 65 #include "G4PAIPhotData.hh" 61 #include "G4DeltaAngle.hh" 66 #include "G4DeltaAngle.hh" 62 67 63 ////////////////////////////////////////////// 68 //////////////////////////////////////////////////////////////////////// 64 69 65 using namespace std; 70 using namespace std; 66 71 67 G4PAIPhotModel::G4PAIPhotModel(const G4Particl 72 G4PAIPhotModel::G4PAIPhotModel(const G4ParticleDefinition* p, const G4String& nam) 68 : G4VEmModel(nam),G4VEmFluctuationModel(nam) 73 : G4VEmModel(nam),G4VEmFluctuationModel(nam), 69 fVerbose(0), 74 fVerbose(0), 70 fModelData(nullptr), << 75 fModelData(0), 71 fParticle(nullptr) << 76 fParticle(0) 72 { 77 { 73 fElectron = G4Electron::Electron(); 78 fElectron = G4Electron::Electron(); 74 fPositron = G4Positron::Positron(); 79 fPositron = G4Positron::Positron(); 75 80 76 fParticleChange = nullptr; << 81 fParticleChange = 0; 77 82 78 if(p) { SetParticle(p); } 83 if(p) { SetParticle(p); } 79 else { SetParticle(fElectron); } 84 else { SetParticle(fElectron); } 80 85 81 // default generator 86 // default generator 82 SetAngularDistribution(new G4DeltaAngle()); 87 SetAngularDistribution(new G4DeltaAngle()); 83 fLowestTcut = 12.5*CLHEP::eV; << 88 >> 89 isInitialised = false; 84 } 90 } 85 91 86 ////////////////////////////////////////////// 92 //////////////////////////////////////////////////////////////////////////// 87 93 88 G4PAIPhotModel::~G4PAIPhotModel() 94 G4PAIPhotModel::~G4PAIPhotModel() 89 { 95 { 90 if(IsMaster()) { delete fModelData; fModelDa << 96 //G4cout << "G4PAIPhotModel::~G4PAIPhotModel() " << this << G4endl; >> 97 if(IsMaster()) { delete fModelData; fModelData = 0; } 91 } 98 } 92 99 93 ////////////////////////////////////////////// 100 //////////////////////////////////////////////////////////////////////////// 94 101 95 void G4PAIPhotModel::Initialise(const G4Partic 102 void G4PAIPhotModel::Initialise(const G4ParticleDefinition* p, 96 const G4DataVector& cuts) << 103 const G4DataVector& cuts) 97 { 104 { 98 if(fVerbose > 1) << 105 // if(fVerbose > 0) 99 { 106 { 100 G4cout<<"G4PAIPhotModel::Initialise for "< 107 G4cout<<"G4PAIPhotModel::Initialise for "<<p->GetParticleName()<<G4endl; 101 } 108 } >> 109 >> 110 if(isInitialised) { return; } >> 111 isInitialised = true; >> 112 102 SetParticle(p); 113 SetParticle(p); 103 fParticleChange = GetParticleChangeForLoss() 114 fParticleChange = GetParticleChangeForLoss(); 104 115 105 if( IsMaster() ) << 116 if(IsMaster()) { 106 { << 117 107 delete fModelData; << 118 InitialiseElementSelectors(p, cuts); 108 fMaterialCutsCoupleVector.clear(); << 119 109 << 120 if(!fModelData) { 110 G4double tmin = LowEnergyLimit()*fRatio; << 121 111 G4double tmax = HighEnergyLimit()*fRatio; << 122 G4double tmin = LowEnergyLimit()*fRatio; 112 fModelData = new G4PAIPhotData(tmin, tmax, << 123 G4double tmax = HighEnergyLimit()*fRatio; 113 << 124 fModelData = new G4PAIPhotData(tmin, tmax, fVerbose); >> 125 } 114 // Prepare initialization 126 // Prepare initialization 115 const G4MaterialTable* theMaterialTable = 127 const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable(); 116 size_t numOfMat = G4Material::GetNumberO 128 size_t numOfMat = G4Material::GetNumberOfMaterials(); 117 size_t numRegions = fPAIRegionVector.size( 129 size_t numRegions = fPAIRegionVector.size(); 118 130 119 // protect for unit tests << 131 for(size_t iReg = 0; iReg < numRegions; ++iReg) { 120 if(0 == numRegions) { << 121 G4Exception("G4PAIModel::Initialise()"," << 122 "no G4Regions are registered << 123 fPAIRegionVector.push_back(G4RegionStore << 124 ->GetRegion("DefaultRegionForTheWorld << 125 numRegions = 1; << 126 } << 127 << 128 for( size_t iReg = 0; iReg < numRegions; + << 129 { << 130 const G4Region* curReg = fPAIRegionVecto 132 const G4Region* curReg = fPAIRegionVector[iReg]; 131 G4Region* reg = const_cast<G4Region*>(cu 133 G4Region* reg = const_cast<G4Region*>(curReg); 132 134 133 for(size_t jMat = 0; jMat < numOfMat; ++ << 135 for(size_t jMat = 0; jMat < numOfMat; ++jMat) { 134 { << 135 G4Material* mat = (*theMaterialTable)[jMat]; 136 G4Material* mat = (*theMaterialTable)[jMat]; 136 const G4MaterialCutsCouple* cutCouple = reg- 137 const G4MaterialCutsCouple* cutCouple = reg->FindCouple(mat); 137 if(nullptr != cutCouple) << 138 //G4cout << "Couple <" << fCutCouple << G4endl; 138 { << 139 if(cutCouple) { 139 if(fVerbose > 1) << 140 /* 140 { << 141 G4cout << "Reg <" <<curReg->GetName() << 141 G4cout << "Reg <" <<curReg->GetName() << "> mat <" 142 << mat->GetName() << "> fCouple= " << 142 << fMaterial->GetName() << "> fCouple= " 143 << cutCouple << ", idx= " << cutCouple-> << 143 << fCutCouple << " idx= " << fCutCouple->GetIndex() 144 <<" " << p->GetParticleName() << 144 <<" " << p->GetParticleName() <<G4endl; 145 <<", cuts.size() = " << cuts.size() << G << 145 // G4cout << cuts.size() << G4endl; 146 } << 146 */ 147 // check if this couple is not already ini 147 // check if this couple is not already initialized 148 << 149 size_t n = fMaterialCutsCoupleVector.size( 148 size_t n = fMaterialCutsCoupleVector.size(); 150 << 149 if(0 < n) { 151 G4bool isnew = true; << 150 for(size_t i=0; i<fMaterialCutsCoupleVector.size(); ++i) { 152 if( 0 < n ) << 153 { << 154 for(size_t i=0; i<fMaterialCutsCoupleVec << 155 { << 156 if(cutCouple == fMaterialCutsCoupleVec 151 if(cutCouple == fMaterialCutsCoupleVector[i]) { 157 isnew = false; << 158 break; 152 break; 159 } 153 } 160 } 154 } 161 } 155 } 162 // initialise data banks 156 // initialise data banks 163 if(isnew) { << 157 fMaterialCutsCoupleVector.push_back(cutCouple); 164 fMaterialCutsCoupleVector.push_back(cutC << 158 G4double deltaCutInKinEnergy = cuts[cutCouple->GetIndex()]; 165 G4double deltaCutInKinEnergy = cuts[cutC << 159 fModelData->Initialise(cutCouple, deltaCutInKinEnergy, this); 166 fModelData->Initialise(cutCouple, deltaC << 167 } << 168 } 160 } 169 } 161 } 170 } 162 } 171 InitialiseElementSelectors(p, cuts); << 172 } 163 } 173 } 164 } 174 165 175 ////////////////////////////////////////////// 166 ///////////////////////////////////////////////////////////////////////// 176 167 177 void G4PAIPhotModel::InitialiseLocal(const G4P 168 void G4PAIPhotModel::InitialiseLocal(const G4ParticleDefinition*, 178 G4VEmModel* masterModel) 169 G4VEmModel* masterModel) 179 { 170 { 180 fModelData = static_cast<G4PAIPhotModel*>(ma 171 fModelData = static_cast<G4PAIPhotModel*>(masterModel)->GetPAIPhotData(); 181 fMaterialCutsCoupleVector = static_cast<G4PA << 172 SetElementSelectors(masterModel->GetElementSelectors()); 182 SetElementSelectors( masterModel->GetElement << 183 } << 184 << 185 ////////////////////////////////////////////// << 186 << 187 G4double G4PAIPhotModel::MinEnergyCut(const G4 << 188 const G4MaterialCutsCouple*) << 189 { << 190 return fLowestTcut; << 191 } 173 } 192 174 193 ////////////////////////////////////////////// 175 ////////////////////////////////////////////////////////////////////////////// 194 176 195 G4double G4PAIPhotModel::ComputeDEDXPerVolume( 177 G4double G4PAIPhotModel::ComputeDEDXPerVolume(const G4Material*, 196 const G4ParticleDefinition* p, 178 const G4ParticleDefinition* p, 197 G4double kineticEnergy, 179 G4double kineticEnergy, 198 G4double cutEnergy) 180 G4double cutEnergy) 199 { 181 { 200 G4int coupleIndex = FindCoupleIndex(CurrentC 182 G4int coupleIndex = FindCoupleIndex(CurrentCouple()); 201 if(0 > coupleIndex) { return 0.0; } 183 if(0 > coupleIndex) { return 0.0; } 202 184 203 G4double cut = std::min(MaxSecondaryEnergy(p 185 G4double cut = std::min(MaxSecondaryEnergy(p, kineticEnergy), cutEnergy); >> 186 204 G4double scaledTkin = kineticEnergy*fRatio; 187 G4double scaledTkin = kineticEnergy*fRatio; 205 G4double dedx = fChargeSquare*fModelData->DE << 188 206 return dedx; << 189 return fChargeSquare*fModelData->DEDXPerVolume(coupleIndex, scaledTkin, cut); 207 } 190 } 208 191 209 ////////////////////////////////////////////// 192 ///////////////////////////////////////////////////////////////////////// 210 193 211 G4double G4PAIPhotModel::CrossSectionPerVolume 194 G4double G4PAIPhotModel::CrossSectionPerVolume( const G4Material*, 212 const G4ParticleDefinition* p, 195 const G4ParticleDefinition* p, 213 G4double kineticEnergy, 196 G4double kineticEnergy, 214 G4double cutEnergy, 197 G4double cutEnergy, 215 G4double maxEnergy ) 198 G4double maxEnergy ) 216 { 199 { 217 G4int coupleIndex = FindCoupleIndex(CurrentC 200 G4int coupleIndex = FindCoupleIndex(CurrentCouple()); 218 if(0 > coupleIndex) { return 0.0; } << 201 >> 202 if(0 > coupleIndex) return 0.0; 219 203 220 G4double tmax = std::min(MaxSecondaryEnergy( 204 G4double tmax = std::min(MaxSecondaryEnergy(p, kineticEnergy), maxEnergy); 221 if(tmax <= cutEnergy) { return 0.0; } << 205 >> 206 if(tmax <= cutEnergy) return 0.0; 222 207 223 G4double scaledTkin = kineticEnergy*fRatio; 208 G4double scaledTkin = kineticEnergy*fRatio; 224 G4double xs = fChargeSquare*fModelData->Cros << 209 G4double xsc = fChargeSquare*fModelData->CrossSectionPerVolume(coupleIndex, 225 scal << 210 scaledTkin, 226 return xs; << 211 cutEnergy, tmax); >> 212 return xsc; 227 } 213 } 228 214 229 ////////////////////////////////////////////// 215 /////////////////////////////////////////////////////////////////////////// 230 // 216 // 231 // It is analog of PostStepDoIt in terms of se 217 // It is analog of PostStepDoIt in terms of secondary electron. 232 // 218 // 233 219 234 void G4PAIPhotModel::SampleSecondaries(std::ve 220 void G4PAIPhotModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp, 235 const G4MaterialCutsCouple* matCC, 221 const G4MaterialCutsCouple* matCC, 236 const G4DynamicParticle* dp, 222 const G4DynamicParticle* dp, 237 G4double tmin, 223 G4double tmin, 238 G4double maxEnergy) 224 G4double maxEnergy) 239 { 225 { 240 G4int coupleIndex = FindCoupleIndex(matCC); 226 G4int coupleIndex = FindCoupleIndex(matCC); 241 if(0 > coupleIndex) { return; } 227 if(0 > coupleIndex) { return; } 242 228 243 SetParticle(dp->GetDefinition()); 229 SetParticle(dp->GetDefinition()); 244 230 245 G4double kineticEnergy = dp->GetKineticEnerg 231 G4double kineticEnergy = dp->GetKineticEnergy(); 246 232 247 G4double tmax = MaxSecondaryEnergy(fParticle 233 G4double tmax = MaxSecondaryEnergy(fParticle, kineticEnergy); 248 234 249 if( maxEnergy < tmax) tmax = maxEnergy; 235 if( maxEnergy < tmax) tmax = maxEnergy; 250 if( tmin >= tmax) return; 236 if( tmin >= tmax) return; 251 237 252 G4ThreeVector direction = dp->GetMomentumDir 238 G4ThreeVector direction = dp->GetMomentumDirection(); 253 G4double scaledTkin = kineticEnergy*fRat 239 G4double scaledTkin = kineticEnergy*fRatio; 254 G4double totalEnergy = kineticEnergy + fM 240 G4double totalEnergy = kineticEnergy + fMass; 255 G4double totalMomentum = sqrt(kineticEnergy 241 G4double totalMomentum = sqrt(kineticEnergy*(totalEnergy + fMass)); 256 G4double plRatio = fModelData->GetPla 242 G4double plRatio = fModelData->GetPlasmonRatio(coupleIndex, scaledTkin); 257 243 258 if( G4UniformRand() <= plRatio ) 244 if( G4UniformRand() <= plRatio ) 259 { 245 { 260 G4double deltaTkin = fModelData->SamplePos 246 G4double deltaTkin = fModelData->SamplePostStepPlasmonTransfer(coupleIndex, scaledTkin); 261 247 262 // G4cout<<"G4PAIPhotModel::SampleSecondar 248 // G4cout<<"G4PAIPhotModel::SampleSecondaries; dp "<<dp->GetParticleDefinition()->GetParticleName() 263 // <<"; Tkin = "<<kineticEnergy/keV<<" keV 249 // <<"; Tkin = "<<kineticEnergy/keV<<" keV; transfer = "<<deltaTkin/keV<<" keV "<<G4endl; 264 250 265 if( deltaTkin <= 0. && fVerbose > 0) 251 if( deltaTkin <= 0. && fVerbose > 0) 266 { 252 { 267 G4cout<<"G4PAIPhotModel::SampleSecondary << 253 G4cout<<"G4PAIPhotModel::SampleSecondary e- deltaTkin = "<<deltaTkin<<G4endl; 268 } 254 } 269 if( deltaTkin <= 0.) { return; } << 255 if( deltaTkin <= 0.) return; 270 256 271 if( deltaTkin > tmax) { deltaTkin = tmax; << 257 if( deltaTkin > tmax) deltaTkin = tmax; 272 258 273 const G4Element* anElement = SelectTargetA << 259 const G4Element* anElement = SelectRandomAtom(matCC,fParticle,kineticEnergy); 274 << 260 G4int Z = G4lrint(anElement->GetZ()); 275 G4int Z = anElement->GetZasInt(); << 276 261 277 auto deltaRay = new G4DynamicParticle(fEle << 262 G4DynamicParticle* deltaRay = new G4DynamicParticle(fElectron, 278 GetAngularDistribution()->SampleDirectio 263 GetAngularDistribution()->SampleDirection(dp, deltaTkin, 279 Z, matCC->GetMaterial()), 264 Z, matCC->GetMaterial()), 280 deltaTkin); 265 deltaTkin); 281 266 282 // primary change 267 // primary change 283 268 284 kineticEnergy -= deltaTkin; 269 kineticEnergy -= deltaTkin; 285 270 286 if( kineticEnergy <= 0. ) // kill primary 271 if( kineticEnergy <= 0. ) // kill primary as local? energy deposition 287 { 272 { 288 fParticleChange->SetProposedKineticEnerg 273 fParticleChange->SetProposedKineticEnergy(0.0); 289 fParticleChange->ProposeLocalEnergyDepos 274 fParticleChange->ProposeLocalEnergyDeposit(kineticEnergy+deltaTkin); >> 275 // fParticleChange->ProposeTrackStatus(fStopAndKill); 290 return; 276 return; 291 } 277 } 292 else 278 else 293 { 279 { 294 G4ThreeVector dir = totalMomentum*direct 280 G4ThreeVector dir = totalMomentum*direction - deltaRay->GetMomentum(); 295 direction = dir.unit(); 281 direction = dir.unit(); 296 fParticleChange->SetProposedKineticEnerg 282 fParticleChange->SetProposedKineticEnergy(kineticEnergy); 297 fParticleChange->SetProposedMomentumDire 283 fParticleChange->SetProposedMomentumDirection(direction); 298 vdp->push_back(deltaRay); 284 vdp->push_back(deltaRay); 299 } 285 } 300 } 286 } 301 else // secondary X-ray CR photon 287 else // secondary X-ray CR photon 302 { 288 { 303 G4double deltaTkin = fModelData->Sampl 289 G4double deltaTkin = fModelData->SamplePostStepPhotonTransfer(coupleIndex, scaledTkin); 304 290 305 // G4cout<<"PAIPhotonModel PhotonPostStep 291 // G4cout<<"PAIPhotonModel PhotonPostStepTransfer = "<<deltaTkin/keV<<" keV"<<G4endl; 306 292 307 if( deltaTkin <= 0. ) 293 if( deltaTkin <= 0. ) 308 { 294 { 309 G4cout<<"G4PAIPhotonModel::SampleSeconda 295 G4cout<<"G4PAIPhotonModel::SampleSecondary gamma deltaTkin = "<<deltaTkin<<G4endl; 310 } 296 } 311 if( deltaTkin <= 0.) return; 297 if( deltaTkin <= 0.) return; 312 298 313 if( deltaTkin >= kineticEnergy ) // stop p 299 if( deltaTkin >= kineticEnergy ) // stop primary 314 { 300 { 315 deltaTkin = kineticEnergy; 301 deltaTkin = kineticEnergy; 316 kineticEnergy = 0.0; 302 kineticEnergy = 0.0; 317 } 303 } 318 G4double costheta = 0.; // G4UniformRand() 304 G4double costheta = 0.; // G4UniformRand(); // VG: ??? for start only 319 G4double sintheta = sqrt((1.+costheta)*(1. 305 G4double sintheta = sqrt((1.+costheta)*(1.-costheta)); 320 306 321 // direction of the 'Cherenkov' photon 307 // direction of the 'Cherenkov' photon 322 G4double phi = twopi*G4UniformRand(); 308 G4double phi = twopi*G4UniformRand(); 323 G4double dirx = sintheta*cos(phi), diry = 309 G4double dirx = sintheta*cos(phi), diry = sintheta*sin(phi), dirz = costheta; 324 310 325 G4ThreeVector deltaDirection(dirx,diry,dir 311 G4ThreeVector deltaDirection(dirx,diry,dirz); 326 deltaDirection.rotateUz(direction); 312 deltaDirection.rotateUz(direction); 327 313 328 if( kineticEnergy > 0.) // primary change 314 if( kineticEnergy > 0.) // primary change 329 { 315 { 330 kineticEnergy -= deltaTkin; 316 kineticEnergy -= deltaTkin; 331 fParticleChange->SetProposedKineticEnerg 317 fParticleChange->SetProposedKineticEnergy(kineticEnergy); 332 } 318 } 333 else // stop primary, but pass X-ray CR 319 else // stop primary, but pass X-ray CR 334 { 320 { 335 // fParticleChange->ProposeLocalEnergyDe 321 // fParticleChange->ProposeLocalEnergyDeposit(deltaTkin); 336 fParticleChange->SetProposedKineticEnerg 322 fParticleChange->SetProposedKineticEnergy(0.0); 337 } 323 } 338 // create G4DynamicParticle object for pho 324 // create G4DynamicParticle object for photon ray 339 325 340 auto photonRay = new G4DynamicParticle; << 326 G4DynamicParticle* photonRay = new G4DynamicParticle; 341 photonRay->SetDefinition( G4Gamma::Gamma() 327 photonRay->SetDefinition( G4Gamma::Gamma() ); 342 photonRay->SetKineticEnergy( deltaTkin ); 328 photonRay->SetKineticEnergy( deltaTkin ); 343 photonRay->SetMomentumDirection(deltaDirec 329 photonRay->SetMomentumDirection(deltaDirection); 344 330 345 vdp->push_back(photonRay); 331 vdp->push_back(photonRay); 346 } 332 } 347 return; 333 return; 348 } 334 } 349 335 350 ////////////////////////////////////////////// 336 /////////////////////////////////////////////////////////////////////// 351 337 352 G4double G4PAIPhotModel::SampleFluctuations( << 338 G4double G4PAIPhotModel::SampleFluctuations( const G4MaterialCutsCouple* matCC, 353 const G4MaterialCutsC << 339 const G4DynamicParticle* aParticle, 354 const G4DynamicPartic << 340 G4double, G4double step, 355 const G4double, const << 341 G4double eloss) 356 const G4double step, << 357 { 342 { 358 // return 0.; 343 // return 0.; 359 G4int coupleIndex = FindCoupleIndex(matCC); 344 G4int coupleIndex = FindCoupleIndex(matCC); 360 if(0 > coupleIndex) { return eloss; } 345 if(0 > coupleIndex) { return eloss; } 361 346 362 SetParticle(aParticle->GetDefinition()); 347 SetParticle(aParticle->GetDefinition()); 363 348 >> 349 364 // G4cout << "G4PAIPhotModel::SampleFluctuat 350 // G4cout << "G4PAIPhotModel::SampleFluctuations step(mm)= "<< step/mm 365 // << " Eloss(keV)= " << eloss/keV << " in 351 // << " Eloss(keV)= " << eloss/keV << " in " 366 // << matCC->GetMaterial()->GetName() << G4e 352 // << matCC->GetMaterial()->GetName() << G4endl; >> 353 367 354 368 G4double Tkin = aParticle->GetKineticE 355 G4double Tkin = aParticle->GetKineticEnergy(); 369 G4double scaledTkin = Tkin*fRatio; 356 G4double scaledTkin = Tkin*fRatio; 370 357 371 G4double loss = fModelData->SampleAlongStepP 358 G4double loss = fModelData->SampleAlongStepPhotonTransfer(coupleIndex, Tkin, 372 scaledTkin, << 359 scaledTkin, 373 step*fChargeSquare); << 360 step*fChargeSquare); 374 loss += fModelData->SampleAlongStepPlasmonTr << 361 loss += fModelData->SampleAlongStepPlasmonTransfer(coupleIndex, Tkin, 375 << 362 scaledTkin, >> 363 step*fChargeSquare); >> 364 376 365 377 // G4cout<<" PAIPhotModel::SampleFluctuatio 366 // G4cout<<" PAIPhotModel::SampleFluctuations loss = "<<loss/keV<<" keV, on step = " 378 // <<step/mm<<" mm"<<G4endl; 367 // <<step/mm<<" mm"<<G4endl; 379 return loss; 368 return loss; 380 369 381 } 370 } 382 371 383 ////////////////////////////////////////////// 372 ////////////////////////////////////////////////////////////////////// 384 // 373 // 385 // Returns the statistical estimation of the e 374 // Returns the statistical estimation of the energy loss distribution variance 386 // 375 // 387 376 388 377 389 G4double G4PAIPhotModel::Dispersion(const G4Ma << 378 G4double G4PAIPhotModel::Dispersion( const G4Material* material, 390 const G4Dy << 379 const G4DynamicParticle* aParticle, 391 const G4double tcut, << 380 G4double tmax, 392 const G4double tmax, << 381 G4double step ) 393 const G4double step) << 394 { 382 { 395 G4double particleMass = aParticle->GetMass( 383 G4double particleMass = aParticle->GetMass(); 396 G4double electronDensity = material->GetElec 384 G4double electronDensity = material->GetElectronDensity(); 397 G4double kineticEnergy = aParticle->GetKinet 385 G4double kineticEnergy = aParticle->GetKineticEnergy(); 398 G4double q = aParticle->GetCharge()/eplus; 386 G4double q = aParticle->GetCharge()/eplus; 399 G4double etot = kineticEnergy + particleMass 387 G4double etot = kineticEnergy + particleMass; 400 G4double beta2 = kineticEnergy*(kineticEnerg 388 G4double beta2 = kineticEnergy*(kineticEnergy + 2.0*particleMass)/(etot*etot); 401 G4double siga = (tmax/beta2 - 0.5*tcut) * t << 389 G4double siga = (1.0/beta2 - 0.5) * twopi_mc2_rcl2 * tmax * step 402 * electronDensity * q * q; 390 * electronDensity * q * q; 403 391 404 return siga; 392 return siga; >> 393 /* >> 394 G4double loss, sumLoss=0., sumLoss2=0., sigma2, meanLoss=0.; >> 395 for(G4int i = 0; i < fMeanNumber; i++) >> 396 { >> 397 loss = SampleFluctuations(material,aParticle,tmax,step,meanLoss); >> 398 sumLoss += loss; >> 399 sumLoss2 += loss*loss; >> 400 } >> 401 meanLoss = sumLoss/fMeanNumber; >> 402 sigma2 = meanLoss*meanLoss + (sumLoss2-2*sumLoss*meanLoss)/fMeanNumber; >> 403 return sigma2; >> 404 */ 405 } 405 } 406 406 407 ////////////////////////////////////////////// 407 ///////////////////////////////////////////////////////////////////// 408 408 409 G4double G4PAIPhotModel::MaxSecondaryEnergy( c 409 G4double G4PAIPhotModel::MaxSecondaryEnergy( const G4ParticleDefinition* p, 410 G4double kinEnergy) 410 G4double kinEnergy) 411 { 411 { 412 SetParticle(p); 412 SetParticle(p); 413 G4double tmax = kinEnergy; 413 G4double tmax = kinEnergy; 414 if(p == fElectron) { tmax *= 0.5; } 414 if(p == fElectron) { tmax *= 0.5; } 415 else if(p != fPositron) { 415 else if(p != fPositron) { 416 G4double ratio= electron_mass_c2/fMass; 416 G4double ratio= electron_mass_c2/fMass; 417 G4double gamma= kinEnergy/fMass + 1.0; 417 G4double gamma= kinEnergy/fMass + 1.0; 418 tmax = 2.0*electron_mass_c2*(gamma*gamma - 418 tmax = 2.0*electron_mass_c2*(gamma*gamma - 1.) / 419 (1. + 2.0*gamma*ratio + rati 419 (1. + 2.0*gamma*ratio + ratio*ratio); 420 } 420 } 421 return tmax; 421 return tmax; 422 } 422 } 423 423 424 ////////////////////////////////////////////// 424 /////////////////////////////////////////////////////////////// 425 425 426 void G4PAIPhotModel::DefineForRegion(const G4R 426 void G4PAIPhotModel::DefineForRegion(const G4Region* r) 427 { 427 { 428 fPAIRegionVector.push_back(r); 428 fPAIRegionVector.push_back(r); 429 } 429 } 430 430 431 // 431 // 432 // 432 // 433 ////////////////////////////////////////////// 433 ///////////////////////////////////////////////// 434 434