70 emaxT(fManagerHP->GetMaxEnergyDoppler()),
71 elimit(1.0e-11*
CLHEP::eV),
72 logElimit(
G4Log(elimit)),
76 fDataDirectory(nameDir)
80 G4cout <<
"G4CrossSectionHP::G4CrossSectionHP: Initialise for "
81 << fDataName <<
" " << minZ <<
" < Z < " << maxZ
82 <<
" EmaxT(MeV)=" << emaxT <<
G4endl;
83 G4cout <<
"Data directory: " << fDataDirectory <<
G4endl;
86 auto data = ptr->GetElementDataByName(fDataName);
87 if (
nullptr == data) {
89 data->SetName(fDataName);
114 if (mat != fCurrentMat) { PrepareCache(mat); }
133 if (mat != fCurrentMat) { PrepareCache(mat); }
146 if (ekin > emax || Z > maxZ || Z < minZ || ekin < elimit) {
return xs; }
149 if (
nullptr == pv0) {
153 if (
nullptr == pv0) {
return xs; }
155 if (
nullptr == pv) {
return xs; }
158 G4double factT = T/CLHEP::STP_Temperature;
170 G4LorentzVector lv(0., 0., std::sqrt(ekin*(ekin + 2*mass)), mass + ekin);
174 const G4int nmin = 3;
180 G4double erand = G4RandGamma::shoot(2.0, e0);
182 fLV.
set(mom.x(), mom.y(), mom.z(), massTarget + erand);
184 fLV = lv.
boost(fBoost);
185 if (fLV.
pz() <= 0.0) {
continue; }
191 if (ii >= nmin && ii*xs2 <= lim*xs*xs) {
break; }
193 if (ii > 0) { xs /= (
G4double)(ii); }
197 G4cout <<
"G4CrossSectionHP::IsoXS " << fDataName
198 <<
" Z= " << Z <<
" A= " <<
A
199 <<
" Ekin(MeV)= " << ekin/MeV <<
" xs(b)= " << xs/barn
200 <<
" size=" << fZA.size() <<
G4endl;
205 for (std::size_t i=0; i<fZA.size(); ++i) {
206 if (Z == fZA[i].first &&
A == fZA[i].second) {
221 if(1 == nIso) {
return iso; }
225 if (Z >= minZ && Z <= maxZ && nullptr == fData->GetElementData(Z - minZ)) {
235 if (Z < minZ || Z > maxZ || !CheckCache(Z) ||
237 for (j = 0; j<nIso; ++j) {
238 sum += abundVector[j];
246 std::size_t nn = fTemp.size();
247 if (nn < nIso) { fTemp.resize(nIso, 0.); }
250 for (j=0; j<nIso; ++j) {
251 sum += abundVector[j]*
256 for (j = 0; j<nIso; ++j) {
257 if (fTemp[j] >= sum) {
268 G4cout <<
"G4CrossSectionHP::BuildPhysicsTable for "
276 for (
auto const & elm : *table ) {
277 G4int Z = elm->GetZasInt();
278 if (Z >= minZ && Z <= maxZ &&
285 std::size_t nmax = 0;
286 std::size_t imax = 0;
289 for (
auto const & elm : *mat->GetElementVector() ) {
290 std::size_t niso = elm->GetNumberOfIsotopes();
292 if(niso > imax) { imax = niso; }
294 if (n > nmax) { nmax = n; }
296 fTemp.resize(imax, 0.0);
299 fIsoXS.resize(nmax, 0.0);
315 G4cout <<
"HP Cross Section " << fDataName <<
" for "
317 G4cout <<
"(Pointwise cross-section at 0 Kelvin.)" <<
G4endl;
324 for (
auto const & elm : *table ) {
325 G4int Z = elm->GetZasInt();
326 if (Z >= minZ && Z <= maxZ && nullptr != fData->GetElementData(Z - minZ)) {
327 G4cout <<
"---------------------------------------------------" <<
G4endl;
330 for (
size_t i=0; i<n; ++i) {
338void G4CrossSectionHP::PrepareCache(
const G4Material* mat)
343 G4int Z = elm->GetZasInt();
344 for (
auto const & iso : *(elm->GetIsotopeVector()) ) {
346 fZA.emplace_back(Z,
A);
349 fIsoXS.resize(fZA.size(), 0.0);
352void G4CrossSectionHP::InitialiseOnFly(
const G4int Z)
359void G4CrossSectionHP::Initialise(
const G4int Z)
362 G4cout <<
" G4CrossSectionHP::Initialise: Z=" << Z
363 <<
" for " << fDataName
364 <<
" minZ=" << minZ <<
" maxZ=" << maxZ <<
G4endl;
366 if (Z < minZ || Z > maxZ ||
nullptr != fData->
GetElementData(Z - minZ)) {
375 for (
G4int A=amin[Z];
A<=amax[Z]; ++
A) {
376 std::ostringstream ost;
377 ost << fDataDirectory;
379 if (6 == Z && 12 ==
A && fParticle == fNeutron) {
380 ost << Z <<
"_nat_" << elementName[Z];
381 }
else if (18 == Z && 40 !=
A) {
383 }
else if (27 == Z && 62 ==
A) {
384 ost << Z <<
"_62m1_" << elementName[Z];
385 }
else if (47 == Z && 106 ==
A) {
386 ost << Z <<
"_106m1_" << elementName[Z];
387 }
else if (48 == Z && 115 ==
A) {
388 ost << Z <<
"_115m1_" << elementName[Z];
389 }
else if (52 == Z && 127 ==
A) {
390 ost << Z <<
"_127m1_" << elementName[Z];
391 }
else if (52 == Z && 129 ==
A) {
392 ost << Z <<
"_129m1_" << elementName[Z];
393 }
else if (52 == Z && 131 ==
A) {
394 ost << Z <<
"_131m1_" << elementName[Z];
395 }
else if (61 == Z && 145 ==
A) {
396 ost << Z <<
"_147_" << elementName[Z];
397 }
else if (67 == Z && 166 ==
A) {
398 ost << Z <<
"_166m1_" << elementName[Z];
399 }
else if (73 == Z && 180 ==
A) {
400 ost << Z <<
"_180m1_" << elementName[Z];
401 }
else if ((Z == 85 &&
A == 210) || (Z == 86 &&
A == 222) || (Z == 87 &&
A == 223)) {
402 ost <<
"84_209_" << elementName[84];
405 ost << Z <<
"_" <<
A <<
"_" << elementName[Z];
407 std::istringstream theXSData(tnam, std::ios::in);
411 theXSData >> i1 >> i2 >>
n;
413 G4cout <<
"## G4CrossSectionHP::Initialise for Z=" << Z
414 <<
" A=" <<
A <<
" Npoints=" <<
n <<
G4endl;
418 for (
G4int i=0; i<
n; ++i) {
427 G4int nmax = amax[Z] -
A + 1;
std::vector< G4Element * > G4ElementTable
G4double G4Log(G4double x)
G4ThreeVector G4RandomDirection()
#define G4MUTEX_INITIALIZER
G4GLOB_DLL std::ostream G4cout
Hep3Vector boostVector() const
HepLorentzVector & boost(double, double, double)
void set(double x, double y, double z, double t)
G4double ComputeIsoCrossSection(G4double kinEnergy, G4double loge, const G4ParticleDefinition *, G4int Z, G4int A, const G4Isotope *iso, const G4Element *elm, const G4Material *mat) override
G4double GetIsoCrossSection(const G4DynamicParticle *, G4int Z, G4int A, const G4Isotope *, const G4Element *, const G4Material *) override
void BuildPhysicsTable(const G4ParticleDefinition &) override
G4CrossSectionHP(const G4ParticleDefinition *, const G4String &nameData, const G4String &nameDir, G4double emaxHP, G4int zmin, G4int zmax)
void DumpPhysicsTable(const G4ParticleDefinition &) override
G4bool IsIsoApplicable(const G4DynamicParticle *, G4int Z, G4int A, const G4Element *, const G4Material *) override
const G4Isotope * SelectIsotope(const G4Element *, G4double kinEnergy, G4double logE) override
G4double GetLogKineticEnergy() const
G4double GetKineticEnergy() const
static G4ElementDataRegistry * Instance()
G4PhysicsVector * GetElementData(G4int Z) const
void InitialiseForComponent(G4int Z, G4int nComponents=0)
G4PhysicsVector * GetComponentDataByIndex(G4int Z, std::size_t idx) const
void InitialiseForElement(G4int Z, G4PhysicsVector *v)
G4int GetComponentID(G4int Z, std::size_t idx) const
void AddComponent(G4int Z, G4int id, G4PhysicsVector *v)
G4PhysicsVector * GetComponentDataByID(G4int Z, G4int id) const
std::size_t GetNumberOfComponents(G4int Z) const
static G4ElementTable * GetElementTable()
G4double * GetRelativeAbundanceVector() const
const G4Isotope * GetIsotope(G4int iso) const
size_t GetNumberOfIsotopes() const
const G4ElementVector * GetElementVector() const
G4double GetTemperature() const
static G4MaterialTable * GetMaterialTable()
static G4double GetNuclearMass(const G4double A, const G4double Z)
G4double GetPDGMass() const
const G4String & GetParticleName() const
G4int GetVerboseLevel() const
void GetDataStream(const G4String &, std::istringstream &iss)
G4bool GetNeglectDoppler() const
void PutValues(const std::size_t index, const G4double energy, const G4double value)
void EnableLogBinSearch(const G4int n=1)
G4double LogFreeVectorValue(const G4double energy, const G4double theLogEnergy) const
G4double Value(const G4double energy, std::size_t &lastidx) const