- Timestamp:
- Apr 6, 2009, 12:30:29 PM (15 years ago)
- Location:
- trunk/source/processes/hadronic/models/coherent_elastic/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/hadronic/models/coherent_elastic/src/G4ChargeExchange.cc
r819 r962 25 25 // 26 26 // 27 // $Id: G4ChargeExchange.cc,v 1.1 1 2007/05/25 17:46:52 dennisExp $28 // GEANT4 tag $Name: $27 // $Id: G4ChargeExchange.cc,v 1.14 2008/12/18 13:01:48 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // … … 41 41 #include "G4ParticleDefinition.hh" 42 42 #include "G4IonTable.hh" 43 #include "G4QElasticCrossSection.hh"44 #include "G4VQCrossSection.hh"45 #include "G4ElasticHadrNucleusHE.hh"46 43 #include "Randomize.hh" 47 #include "G4HadronElastic.hh" 48 49 50 G4ChargeExchange::G4ChargeExchange(G4HadronElastic* hel, G4double elim, 51 G4double ehigh) 52 : G4HadronicInteraction("G4ChargeExchange"), 53 fElastic(hel), 54 native(false), 55 ekinlim(elim), 56 ekinhigh(ehigh) 44 #include "G4NucleiProperties.hh" 45 46 G4ChargeExchange::G4ChargeExchange() : G4HadronicInteraction("Charge Exchange") 57 47 { 58 48 SetMinEnergy( 0.0*GeV ); 59 49 SetMaxEnergy( 100.*TeV ); 60 ekinlow = 19.0*MeV; 61 62 verboseLevel= 0; 63 if(!fElastic) { 64 native = true; 65 fElastic = new G4HadronElastic(); 66 } 67 qCManager = fElastic->GetCS(); 68 hElastic = fElastic->GetHElastic(); 50 51 lowEnergyRecoilLimit = 100.*keV; 52 lowestEnergyLimit = 1.*MeV; 69 53 70 54 theProton = G4Proton::Proton(); … … 100 84 101 85 G4ChargeExchange::~G4ChargeExchange() 102 { 103 if(native) delete fElastic; 104 } 86 {} 105 87 106 88 G4HadFinalState* G4ChargeExchange::ApplyYourself( … … 117 99 G4int A = static_cast<G4int>(aTarget+0.5); 118 100 119 if(ekin == 0.0|| A < 3) {101 if(ekin <= lowestEnergyLimit || A < 3) { 120 102 theParticleChange.SetEnergyChange(ekin); 121 103 theParticleChange.SetMomentumChange(aTrack.Get4Momentum().vect().unit()); … … 133 115 // Scattered particle referred to axis of incident particle 134 116 const G4ParticleDefinition* theParticle = aParticle->GetDefinition(); 135 G4double m1 = theParticle->GetPDGMass();136 117 137 118 G4int N = A - Z; … … 145 126 G4ParticleDefinition * theDef = 0; 146 127 147 if (Z == 1 && A == 3) theDef = theT; 148 else if (Z == 2 && A == 3) theDef = theHe3; 149 else if (Z == 2 && A == 4) theDef = theA; 150 else theDef = G4ParticleTable::GetParticleTable()->FindIon(Z,A,0,Z); 151 152 G4double m2 = theDef->GetPDGMass(); 128 G4double m2 = G4NucleiProperties::GetNuclearMass((G4double)A, (G4double)Z); 153 129 G4LorentzVector lv1 = aParticle->Get4Momentum(); 154 130 G4LorentzVector lv0(0.0,0.0,0.0,m2); … … 259 235 260 236 G4double etot = lv0.e() + lv1.e(); 261 if(etot < m11 + m21) return &theParticleChange; 237 238 // kinematiacally impossible 239 if(etot < m11 + m21) { 240 theParticleChange.SetEnergyChange(ekin); 241 theParticleChange.SetMomentumChange(aTrack.Get4Momentum().vect().unit()); 242 return &theParticleChange; 243 } 262 244 263 245 G4ThreeVector p1 = lv1.vect(); 264 G4double e1 = 0.5*etot*(1.0 +(m21*m21 - m11*m11)/(etot*etot));246 G4double e1 = 0.5*etot*(1.0 - (m21*m21 - m11*m11)/(etot*etot)); 265 247 // G4double e2 = etot - e1; 266 248 G4double ptot = std::sqrt(e1*e1 - m11*m11); 267 249 268 250 G4double tmax = 4.0*ptot*ptot; 269 G4double t = 0.0; 270 271 // Choose generator 272 G4ElasticGenerator gtype = fLElastic; 273 if ((theParticle == theProton || theParticle == theNeutron) && 274 Z <= 2 && ekin >= ekinlow) { 275 gtype = fQElastic; 276 } else { 277 if(ekin >= ekinlow) gtype = fSWave; 278 else if(ekin >= ekinhigh) gtype = fHElastic; 279 } 280 281 // Sample t 282 if(gtype == fQElastic) { 283 if (verboseLevel > 1) 284 G4cout << "G4ChargeExchange: Z= " << Z << " N= " 285 << N << " pdg= " << projPDG 286 << " mom(GeV)= " << plab/GeV << " " << qCManager << G4endl; 287 if(Z == 1 && N == 2) N = 1; 288 else if (Z == 2 && N == 1) N = 2; 289 G4double cs = qCManager->GetCrossSection(false,plab,Z,N,projPDG); 290 if(cs > 0.0) t = qCManager->GetExchangeT(Z,N,projPDG); 291 else gtype = fSWave; 292 } 293 294 if(gtype == fHElastic) { 295 t = hElastic->SampleT(theParticle,plab,Z,A); 296 if(t > tmax) gtype = fSWave; 297 } 298 299 if(gtype == fLElastic) { 300 t = GeV*GeV*fElastic->SampleT(ptot,m1,m2,aTarget); 301 if(t > tmax) gtype = fSWave; 302 } 303 304 // NaN finder 305 if(!(t < 0.0 || t >= 0.0)) { 306 if (verboseLevel > -1) { 307 G4cout << "G4ChargeExchange:WARNING: Z= " << Z << " N= " 308 << N << " pdg= " << projPDG 309 << " mom(GeV)= " << plab/GeV 310 << " the model type " << gtype; 311 if(gtype == fQElastic) G4cout << " CHIPS "; 312 else if(gtype == fLElastic) G4cout << " LElastic "; 313 else if(gtype == fHElastic) G4cout << " HElastic "; 314 G4cout << " t= " << t 315 << " S-wave will be sampled" 316 << G4endl; 317 } 318 gtype = fSWave; 319 } 320 321 if(gtype == fSWave) t = G4UniformRand()*tmax; 251 G4double g2 = GeV*GeV; 252 253 G4double t = g2*SampleT(tmax/g2,aTarget); 322 254 323 255 if(verboseLevel>1) 324 G4cout <<" type= " << gtype <<"t= " << t << " tmax= " << tmax256 G4cout <<"## G4ChargeExchange t= " << t << " tmax= " << tmax 325 257 << " ptot= " << ptot << G4endl; 326 258 … … 328 260 G4double phi = G4UniformRand()*twopi; 329 261 G4double cost = 1. - 2.0*t/tmax; 330 if(std::abs(cost) > 1.0) cost = -1.0 + 2.0*G4UniformRand();262 if(std::abs(cost) > 1.0) cost = 1.0; 331 263 G4double sint = std::sqrt((1.0-cost)*(1.0+cost)); 332 264 333 if (verboseLevel > 1)334 G4cout << "cos(t)=" << cost << " std::sin(t)=" << sint << G4endl;265 //if (verboseLevel > 1) 266 // G4cout << "cos(t)=" << cost << " std::sin(t)=" << sint << G4endl; 335 267 336 268 G4ThreeVector v1(sint*std::cos(phi),sint*std::sin(phi),cost); … … 343 275 344 276 theParticleChange.SetStatusChange(stopAndKill); 277 theParticleChange.SetEnergyChange(0.0); 345 278 G4DynamicParticle * aSec = new G4DynamicParticle(theSecondary, nlv1); 346 279 theParticleChange.AddSecondary(aSec); 347 280 348 281 G4double erec = nlv0.e() - m21; 282 283 //G4cout << "erec= " <<erec << " Esec= " << aSec->GetKineticEnergy() << G4endl; 284 349 285 if(theHyperon) { 350 286 theParticleChange.SetLocalEnergyDeposit(erec); … … 352 288 aSec->SetDefinition(theRecoil); 353 289 aSec->SetKineticEnergy(0.0); 354 } else if(erec > ekinlim) {290 } else if(erec > lowEnergyRecoilLimit) { 355 291 aSec = new G4DynamicParticle(theRecoil, nlv0); 356 292 theParticleChange.AddSecondary(aSec); 357 293 } else { 294 if(erec < 0.0) erec = 0.0; 358 295 theParticleChange.SetLocalEnergyDeposit(erec); 359 296 } 360 297 return &theParticleChange; 361 298 } 299 300 G4double G4ChargeExchange::SampleT(G4double tmax, G4double A) 301 { 302 G4double aa, bb, cc, dd; 303 if (A <= 62.) { 304 aa = std::pow(A, 1.63); 305 bb = 14.5*std::pow(A, 0.66); 306 cc = 1.4*std::pow(A, 0.33); 307 dd = 10.; 308 } else { 309 aa = std::pow(A, 1.33); 310 bb = 60.*std::pow(A, 0.33); 311 cc = 0.4*std::pow(A, 0.40); 312 dd = 10.; 313 } 314 G4double x1 = (1.0 - std::exp(-tmax*bb))*aa/bb; 315 G4double x2 = (1.0 - std::exp(-tmax*dd))*cc/dd; 316 317 G4double t; 318 G4double y = bb; 319 if(G4UniformRand()*(x1 + x2) < x2) y = dd; 320 321 do {t = -std::log(G4UniformRand())/y;} while (t > tmax); 322 323 return t; 324 } 325 -
trunk/source/processes/hadronic/models/coherent_elastic/src/G4ChargeExchangeProcess.cc
r819 r962 25 25 // 26 26 // 27 // $Id: G4ChargeExchangeProcess.cc,v 1. 9 2007/01/30 10:23:26vnivanch Exp $28 // GEANT4 tag $Name: $27 // $Id: G4ChargeExchangeProcess.cc,v 1.15 2008/11/27 16:43:00 vnivanch Exp $ 28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // 31 // Geant4 Hadron Elastic Scattering Process -- headerfile31 // Geant4 Hadron Charge Exchange Process -- source file 32 32 // 33 33 // Created 21 April 2006 V.Ivanchenko … … 45 45 #include "G4CrossSectionDataStore.hh" 46 46 #include "G4HadronElasticDataSet.hh" 47 #include "G4VQCrossSection.hh"48 #include "G4QElasticCrossSection.hh"49 #include "G4QCHIPSWorld.hh"50 47 #include "G4Element.hh" 51 48 #include "G4ElementVector.hh" … … 53 50 #include "G4Neutron.hh" 54 51 #include "G4Proton.hh" 55 #include "G4HadronElastic.hh"56 52 #include "G4PhysicsLinearVector.hh" 57 53 … … 59 55 : G4HadronicProcess(procName), first(true) 60 56 { 61 thEnergy = 19.*MeV; 57 SetProcessSubType(fChargeExchange); 58 thEnergy = 20.*MeV; 62 59 verboseLevel= 1; 63 qCManager = 0;64 60 AddDataSet(new G4HadronElasticDataSet); 65 61 theProton = G4Proton::Proton(); … … 99 95 } 100 96 101 void G4ChargeExchangeProcess::SetQElasticCrossSection(G4VQCrossSection* p)102 {103 qCManager = p;104 }105 106 97 void G4ChargeExchangeProcess:: 107 98 BuildPhysicsTable(const G4ParticleDefinition& aParticleType) … … 120 111 121 112 G4double F[n] = {0.33,0.27,0.29,0.31,0.27,0.18,0.13,0.1,0.09,0.07}; 122 factors = new G4PhysicsLinearVector(0.0, 1.8*GeV,n);113 factors = new G4PhysicsLinearVector(0.0,2.0*GeV,n); 123 114 for(size_t i=0; i<n; i++) {factors->PutValue(i,F[i]);} 124 115 … … 126 117 127 118 G4double F[n] = {0.50,0.45,0.40,0.35,0.30,0.25,0.06,0.04,0.005,0.0}; 128 factors = new G4PhysicsLinearVector(0.0, 3.6*GeV,n);119 factors = new G4PhysicsLinearVector(0.0,4.0*GeV,n); 129 120 for(size_t i=0; i<n; i++) {factors->PutValue(i,F[i]);} 130 121 } 122 //factors->SetSpline(true); 131 123 132 124 if(verboseLevel>1) … … 135 127 << G4endl; 136 128 } 137 store->BuildPhysicsTable(aParticleType); 138 } 139 140 G4double G4ChargeExchangeProcess::GetMeanFreePath(const G4Track& track, 141 G4double, 142 G4ForceCondition* cond) 143 { 144 *cond = NotForced; 145 const G4DynamicParticle* dp = track.GetDynamicParticle(); 146 const G4Material* material = track.GetMaterial(); 147 cross = 0.0; 148 G4double x = DBL_MAX; 149 150 // The process is effective only above the threshold 151 if(dp->GetKineticEnergy() < thEnergy) return x; 152 153 // Compute cross sesctions 154 const G4ElementVector* theElementVector = material->GetElementVector(); 155 const G4double* theAtomNumDensityVector = material->GetVecNbOfAtomsPerVolume(); 156 G4double temp = material->GetTemperature(); 157 G4int nelm = material->GetNumberOfElements(); 158 if(verboseLevel>1) 159 G4cout << "G4ChargeExchangeProcess get mfp for " 160 << theParticle->GetParticleName() 161 << " p(GeV)= " << dp->GetTotalMomentum()/GeV 162 << " in " << material->GetName() 163 << G4endl; 164 for (G4int i=0; i<nelm; i++) { 165 const G4Element* elm = (*theElementVector)[i]; 166 G4double x = GetMicroscopicCrossSection(dp, elm, temp); 167 cross += theAtomNumDensityVector[i]*x; 168 xsec[i] = cross; 169 } 170 if(verboseLevel>1) 171 G4cout << "G4ChargeExchangeProcess cross(1/mm)= " << cross 172 << " E(MeV)= " << dp->GetKineticEnergy() 173 << " " << theParticle->GetParticleName() 174 << " in " << material->GetName() 175 << G4endl; 176 if(cross > DBL_MIN) x = 1./cross; 177 178 return x; 129 G4HadronicProcess::BuildPhysicsTable(aParticleType); 179 130 } 180 131 … … 188 139 G4int iz = G4int(Z); 189 140 G4double x = 0.0; 190 if(iz == 1) return x; 141 142 // The process is effective only above the threshold 143 if(iz == 1 || dp->GetKineticEnergy() < thEnergy) return x; 191 144 192 145 if(verboseLevel>1) … … 195 148 << G4endl; 196 149 x = store->GetCrossSection(dp, elm, temp); 197 198 // NaN finder199 if(!(x < 0.0 || x >= 0.0)) {200 if (verboseLevel > -1) {201 G4cout << "G4ChargeExchangeProcess WARNING: Z= " << iz202 << " pdg= " << pPDG203 << " mom(GeV)= " << dp->GetTotalMomentum()/GeV204 << " cross= " << x205 << " set to zero"206 << G4endl;207 }208 x = 0.0;209 }210 150 211 151 if(verboseLevel>1) … … 217 157 G4bool b; 218 158 G4double A = elm->GetN(); 219 x *= factors->GetValue(dp->GetTotalMomentum(), b)/std::pow(A, 0.42); 159 G4double ptot = dp->GetTotalMomentum(); 160 x *= factors->GetValue(ptot, b)/std::pow(A, 0.42); 220 161 if(theParticle == thePiPlus || theParticle == theProton || 221 162 theParticle == theKPlus || theParticle == theANeutron) 222 x *= (1.0 - Z/A);163 { x *= (1.0 - Z/A); } 223 164 224 165 else if(theParticle == thePiMinus || theParticle == theNeutron || 225 166 theParticle == theKMinus || theParticle == theAProton) 226 x *= Z/A; 167 { x *= Z/A; } 168 169 if(theParticle->GetPDGMass() < GeV) { 170 if(ptot > 2.*GeV) x *= 4.0*GeV*GeV/(ptot*ptot); 171 } 172 173 if(verboseLevel>1) 174 G4cout << "Corrected cross(mb)= " << x/millibarn << G4endl; 227 175 228 176 return x; 229 }230 231 G4VParticleChange* G4ChargeExchangeProcess::PostStepDoIt(232 const G4Track& track,233 const G4Step& step)234 {235 G4ForceCondition* cn = 0;236 aParticleChange.Initialize(track);237 G4double mfp = GetMeanFreePath(track, 0.0, cn);238 if(mfp == DBL_MAX) return G4VDiscreteProcess::PostStepDoIt(track,step);239 240 G4double kineticEnergy = track.GetKineticEnergy();241 G4Material* material = track.GetMaterial();242 243 // Select element244 const G4ElementVector* theElementVector = material->GetElementVector();245 G4Element* elm = (*theElementVector)[0];246 G4int nelm = material->GetNumberOfElements() - 1;247 if (nelm > 0) {248 G4double x = G4UniformRand()*cross;249 G4int i = -1;250 do {i++;} while (x > xsec[i] && i < nelm);251 elm = (*theElementVector)[i];252 }253 G4double Z = elm->GetZ();254 G4double A = G4double(G4int(elm->GetN()+0.5));255 256 // Select isotope257 G4IsotopeVector* isv = elm->GetIsotopeVector();258 G4int ni = 0;259 if(isv) ni = isv->size();260 261 if(ni == 1) {262 A = G4double((*isv)[0]->GetN());263 } else if(ni > 1) {264 265 G4double* ab = elm->GetRelativeAbundanceVector();266 G4int j = -1;267 ni--;268 G4double y = G4UniformRand();269 do {270 j++;271 y -= ab[j];272 } while (y > 0.0 && j < ni);273 A = G4double((*isv)[j]->GetN());274 }275 G4HadronicInteraction* hadi =276 ChooseHadronicInteraction( kineticEnergy, material, elm);277 278 // Initialize the hadronic projectile from the track279 G4HadProjectile thePro(track);280 if(verboseLevel>1)281 G4cout << "G4ChargeExchangeProcess::PostStepDoIt for "282 << theParticle->GetParticleName()283 << " Target Z= " << Z284 << " A= " << A << G4endl;285 targetNucleus.SetParameters(A, Z);286 287 aParticleChange.Initialize(track);288 G4HadFinalState* result = hadi->ApplyYourself(thePro, targetNucleus);289 G4ThreeVector indir = track.GetMomentumDirection();290 G4int nsec = result->GetNumberOfSecondaries();291 292 if(verboseLevel>1)293 G4cout << "Efin= " << result->GetEnergyChange()294 << " de= " << result->GetLocalEnergyDeposit()295 << " nsec= " << nsec296 << G4endl;297 298 299 if(nsec > 0) {300 aParticleChange.ProposeEnergy(0.0);301 aParticleChange.ProposeTrackStatus(fStopAndKill);302 aParticleChange.ProposeLocalEnergyDeposit(result->GetLocalEnergyDeposit());303 aParticleChange.SetNumberOfSecondaries(nsec);304 for(G4int j=0; j<nsec; j++) {305 G4DynamicParticle* p = result->GetSecondary(j)->GetParticle();306 G4ThreeVector pdir = p->GetMomentumDirection();307 // G4cout << "recoil " << pdir << G4endl;308 pdir = pdir.rotateUz(indir);309 // G4cout << "recoil rotated " << pdir << G4endl;310 p->SetMomentumDirection(pdir);311 aParticleChange.AddSecondary(p);312 }313 }314 result->Clear();315 316 return G4VDiscreteProcess::PostStepDoIt(track,step);317 177 } 318 178 -
trunk/source/processes/hadronic/models/coherent_elastic/src/G4DiffuseElastic.cc
r819 r962 25 25 // 26 26 // $Id: G4DiffuseElastic.cc,v 1.20 2008/01/14 10:39:13 vnivanch Exp $ 27 // GEANT4 tag $Name: $27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // -
trunk/source/processes/hadronic/models/coherent_elastic/src/G4ElasticHadrNucleusHE.cc
r819 r962 26 26 // 27 27 // $Id: G4ElasticHadrNucleusHE.cc,v 1.79 2008/01/14 10:39:13 vnivanch Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // -
trunk/source/processes/hadronic/models/coherent_elastic/src/G4HadronElastic.cc
r819 r962 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4HadronElastic.cc,v 1. 56.2.1 2008/04/23 14:14:55 gcosmoExp $27 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $26 // $Id: G4HadronElastic.cc,v 1.61 2008/08/05 07:37:39 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // … … 100 100 thePionPlus = G4PionPlus::PionPlus(); 101 101 thePionMinus= G4PionMinus::PionMinus(); 102 103 nnans = 0; 104 npos = 0; 105 nneg = 0; 106 neneg = 0; 102 107 } 103 108 … … 105 110 { 106 111 delete hElastic; 112 if( (nnans + npos + nneg + neneg) > 0 ) { 113 G4cout << "### G4HadronElastic destructor Warnings: "; 114 if(nnans > 0) G4cout << "### N(nans) = " << nnans; 115 if(npos > 0) G4cout << "### N(cost > 1)= " << npos; 116 if(nneg > 0) G4cout << "### N(cost <-1)= " << nneg; 117 if(neneg > 0) G4cout << "### N(E < 0)= " << neneg; 118 G4cout << "###" << G4endl; 119 } 107 120 } 108 121 … … 148 161 G4int N = A - Z; 149 162 G4int projPDG = theParticle->GetPDGEncoding(); 150 if (verboseLevel>1) 163 if (verboseLevel>1) { 151 164 G4cout << "G4HadronElastic for " << theParticle->GetParticleName() 152 165 << " PDGcode= " << projPDG << " on nucleus Z= " << Z 153 166 << " A= " << A << " N= " << N 154 167 << G4endl; 155 168 } 156 169 G4ParticleDefinition * theDef = 0; 157 170 … … 180 193 181 194 // Q-elastic for p,n scattering on H and He 182 if (theParticle == theProton || theParticle == theNeutron) 195 if (theParticle == theProton || theParticle == theNeutron) { 183 196 // && Z <= 2 && ekin >= lowEnergyLimitQ) 184 197 gtype = fQElastic; 185 198 186 else {199 } else { 187 200 // S-wave for very low energy 188 201 if(plab < plabLowLimit) gtype = fSWave; 189 202 // HE-elastic for energetic projectile mesons 190 203 else if(ekin >= lowEnergyLimitHE && theParticle->GetBaryonNumber() == 0) 191 gtype = fHElastic;204 { gtype = fHElastic; } 192 205 } 193 206 … … 212 225 213 226 if(gtype == fLElastic) { 214 t = GeV*GeV*SampleT(ptot,m1,m2,aTarget); 227 G4double g2 = GeV*GeV; 228 t = g2*SampleT(tmax/g2,m1,m2,aTarget); 215 229 } 216 230 … … 234 248 } 235 249 t = 0.0; 250 nnans++; 236 251 } 237 252 238 253 if(gtype == fSWave) t = G4UniformRand()*tmax; 239 254 240 if(verboseLevel>1) 255 if(verboseLevel>1) { 241 256 G4cout <<"type= " << gtype <<" t= " << t << " tmax= " << tmax 242 257 << " ptot= " << ptot << G4endl; 243 258 } 244 259 // Sampling in CM system 245 260 G4double phi = G4UniformRand()*twopi; … … 247 262 G4double sint; 248 263 249 if( cost >= 1.0 || cost < -1 )250 {264 // problem in sampling 265 if(cost >= 1.0) { 251 266 cost = 1.0; 252 267 sint = 0.0; 253 } 254 else 255 { 268 npos++; 269 } else if(cost < -1 ) { 270 /* 271 G4cout << "G4HadronElastic:WARNING: Z= " << Z << " N= " 272 << N << " " << aParticle->GetDefinition()->GetParticleName() 273 << " mom(GeV)= " << plab/GeV 274 << " the model type " << gtype; 275 if(gtype == fQElastic) G4cout << " CHIPS "; 276 else if(gtype == fLElastic) G4cout << " LElastic "; 277 else if(gtype == fHElastic) G4cout << " HElastic "; 278 G4cout << " cost= " << cost 279 << G4endl; 280 */ 281 cost = 1.0; 282 sint = 0.0; 283 nneg++; 284 285 // normal situation 286 } else { 256 287 sint = std::sqrt((1.0-cost)*(1.0+cost)); 257 288 } 258 if (verboseLevel>1) 289 if (verboseLevel>1) { 259 290 G4cout << "cos(t)=" << cost << " std::sin(t)=" << sint << G4endl; 260 291 } 261 292 G4ThreeVector v1(sint*std::cos(phi),sint*std::sin(phi),cost); 262 293 v1 *= ptot; … … 273 304 } 274 305 if(eFinal <= lowestEnergyLimit) { 275 if(eFinal < 0.0) { 306 if(eFinal < 0.0 && verboseLevel > 0) { 307 neneg++; 276 308 G4cout << "G4HadronElastic WARNING ekin= " << eFinal 277 309 << " after scattering of " … … 308 340 309 341 G4double 310 G4HadronElastic::SampleT(G4double , G4double, G4double, G4double atno2)342 G4HadronElastic::SampleT(G4double tmax, G4double, G4double, G4double atno2) 311 343 { 312 344 // G4cout << "Entering elastic scattering 2"<<G4endl; … … 315 347 // parameterized functions and a Monte Carlo method to invert the CDF. 316 348 317 G4double ran = G4UniformRand();349 // G4double ran = G4UniformRand(); 318 350 G4double aa, bb, cc, dd, rr; 319 351 if (atno2 <= 62.) { … … 330 362 aa = aa/bb; 331 363 cc = cc/dd; 364 G4double ran, t1, t2; 365 do { 366 ran = G4UniformRand(); 367 t1 = -std::log(ran)/bb; 368 t2 = -std::log(ran)/dd; 369 } while(t1 > tmax || t2 > tmax); 370 332 371 rr = (aa + cc)*ran; 372 333 373 if (verboseLevel > 1) { 334 374 G4cout << "DoIt: aa,bb,cc,dd,rr" << G4endl; 335 375 G4cout << aa << " " << bb << " " << cc << " " << dd << " " << rr << G4endl; 336 }337 G4double t1 = -std::log(ran)/bb;338 G4double t2 = -std::log(ran)/dd;339 if (verboseLevel > 1) {340 376 G4cout << "t1,Fctcos " << t1 << " " << Fctcos(t1, aa, bb, cc, dd, rr) << G4endl; 341 377 G4cout << "t2,Fctcos " << t2 << " " << Fctcos(t2, aa, bb, cc, dd, rr) << G4endl; … … 348 384 aa, bb, cc, dd, rr); 349 385 if (verboseLevel > 1) { 350 G4cout << "From Rtmi, ier1=" << ier1 << G4endl;386 G4cout << "From Rtmi, ier1=" << ier1 << " t= " << t << G4endl; 351 387 G4cout << "t, Fctcos " << t << " " << Fctcos(t, aa, bb, cc, dd, rr) << G4endl; 352 388 } -
trunk/source/processes/hadronic/models/coherent_elastic/src/G4UHadronElasticProcess.cc
r819 r962 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4UHadronElasticProcess.cc,v 1.3 5.2.1 2008/04/23 14:14:55 gcosmoExp $27 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $26 // $Id: G4UHadronElasticProcess.cc,v 1.39 2008/10/22 08:16:40 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // Geant4 Hadron Elastic Scattering Process -- header file … … 58 58 : G4HadronicProcess(pName), lowestEnergy(0.0), first(true) 59 59 { 60 SetProcessSubType(fHadronElastic); 60 61 AddDataSet(new G4HadronElasticDataSet); 61 62 theProton = G4Proton::Proton(); … … 89 90 if(theParticle->GetPDGCharge() != 0.0) lowestEnergy = eV; 90 91 91 if(verboseLevel>1 || 92 (verboseLevel==1 && theParticle == theNeutron)) { 93 G4cout << G4endl; 92 // if(verboseLevel>1 || 93 // (verboseLevel==1 && theParticle == theNeutron)) { 94 if(verboseLevel>1 && theParticle == theNeutron) { 95 // G4cout << G4endl; 94 96 G4cout << "G4UHadronElasticProcess for " 95 97 << theParticle->GetParticleName() … … 100 102 } 101 103 } 102 store->BuildPhysicsTable(aParticleType); 104 G4HadronicProcess::BuildPhysicsTable(aParticleType); 105 //store->BuildPhysicsTable(aParticleType); 103 106 } 104 107
Note: See TracChangeset
for help on using the changeset viewer.