59G4double G4GammaNuclearXS::coeff[3][3];
60G4double G4GammaNuclearXS::xs150[MAXZGAMMAXS] = {0.0};
61G4String G4GammaNuclearXS::gDataDirectory =
"";
73 G4cout <<
"G4GammaNuclearXS::G4GammaNuclearXS Initialise for Z < "
91 outFile <<
"G4GammaNuclearXS calculates the gamma nuclear\n"
92 <<
"cross-section for GDR energy region on nuclei using data from the high precision\n"
93 <<
"IAEA photonuclear database (2019). Then liniear connection\n"
94 <<
"implemented with previous CHIPS photonuclear model\n";
115 const G4int Z = (ZZ >= MAXZGAMMAXS) ? MAXZGAMMAXS - 1 : ZZ;
116 auto pv = GetPhysicsVector(
Z);
121 const G4double emax = pv->GetMaxEnergy();
125 xs = pv->Value(ekin);
126 }
else if(ekin >= rTransitionBound){
130 const G4double lxs = pv->Value(emax);
131 xs = lxs + (ekin - emax)*(rxs - lxs)/(rTransitionBound-emax);
136 G4cout <<
"Z= " <<
Z <<
" Ekin(MeV)= " << ekin/CLHEP::MeV
137 <<
", nElmXS(b)= " << xs/CLHEP::barn
164 const G4int Z = (ZZ >= MAXZGAMMAXS) ? MAXZGAMMAXS - 1 : ZZ;
170 auto pv = GetPhysicsVector(
Z);
175 const G4double emax = pv->GetMaxEnergy();
179 if(amin[
Z] < amax[
Z] &&
A >= amin[
Z] &&
A <= amax[
Z] &&
180 ekin < rTransitionBound) {
183 if(
nullptr != pviso) {
185 if(ekin <= emaxiso) {
186 xs = pviso->Value(ekin);
191 const G4double lxs = pviso->Value(emaxiso);
192 xs = lxs + (ekin - emaxiso)*(rxs - lxs)/(rTransitionBound-emaxiso);
196 G4cout <<
"G4GammaNuclearXS::IsoXS: Z= " <<
Z <<
" A= " <<
A
197 <<
" Ekin(MeV)= " << ekin/CLHEP::MeV
198 <<
", ElmXS(b)= " << xs/CLHEP::barn <<
G4endl;
207 if(ekin <= emax &&
Z != 1) {
208 xs = pv->Value(ekin)*
A/aeff[
Z];
211 }
else if(ekin >= rTransitionBound ||
Z == 1) {
212 if(Z <= 2 && ekin > 10.*GeV) {
213 xs = coeff[
Z][
A - amin[
Z]]*
222 const G4double lxs = pv->Value(emax)*
A/aeff[
Z];
223 xs = lxs + (ekin - emax)*(rxs - lxs)/(rTransitionBound-emax);
227 G4cout <<
"G4GammaNuclearXS::IsoXS: Z= " <<
Z <<
" A= " <<
A
228 <<
" Ekin(MeV)= " << ekin/CLHEP::MeV
229 <<
", ElmXS(b)= " << xs/CLHEP::barn <<
G4endl;
241 if(1 == nIso) {
return iso; }
250 if(amax[
Z] == amin[
Z] || kinEnergy > rTransitionBound ||
Z >= MAXZGAMMAXS ) {
251 for (j=0; j<(
G4int)nIso; ++j) {
252 sum += abundVector[j];
261 std::size_t nn = temp.size();
262 if(nn < nIso) { temp.resize(nIso, 0.); }
264 for (j=0; j<(
G4int)nIso; ++j) {
267 sum += abundVector[j]*
272 for (j = 0; j<(
G4int)nIso; ++j) {
285 G4cout <<
"G4GammaNuclearXS::BuildPhysicsTable for "
291 <<
" only gamma is allowed";
292 G4Exception(
"G4GammaNuclearXS::BuildPhysicsTable(..)",
"had012",
297 if(
nullptr == data) {
298#ifdef G4MULTITHREADED
300 if(
nullptr == data) {
306#ifdef G4MULTITHREADED
317 for (
auto & elm : *table ) {
318 G4int Z = std::max( 1, std::min( elm->GetZasInt(), MAXZGAMMAXS-1) );
324 std::size_t nIso = temp.size();
325 for (
auto & elm : *table ) {
326 std::size_t n = elm->GetNumberOfIsotopes();
327 if(n > nIso) { nIso = n; }
329 temp.resize(nIso, 0.0);
332const G4String& G4GammaNuclearXS::FindDirectoryPath()
336 if(gDataDirectory.empty()) {
338 if (
nullptr != path) {
339 std::ostringstream ost;
340 ost << path <<
"/gamma/inel";
341 gDataDirectory = ost.str();
343 G4Exception(
"G4GammaNuclearXS::Initialise(..)",
"had013",
345 "Environment variable G4PARTICLEXSDATA is not defined");
348 return gDataDirectory;
351void G4GammaNuclearXS::InitialiseOnFly(
G4int Z)
353#ifdef G4MULTITHREADED
358#ifdef G4MULTITHREADED
364void G4GammaNuclearXS::Initialise(
G4int Z)
369 std::ostringstream ost;
370 ost << FindDirectoryPath() <<
Z ;
382 if(amax[
Z] > amin[
Z]) {
383 G4int nmax = amax[
Z]-amin[
Z]+1;
386 std::ostringstream ost1;
387 ost1 << gDataDirectory <<
Z <<
"_" <<
A;
391 theGamma.SetKineticEnergy(10.*GeV);
394 if(sig2 > 0.) coeff[
Z][
A-amin[
Z]]=(sig1/sig2);
395 else coeff[
Z][
A-amin[
Z]]=1.;
402G4GammaNuclearXS::RetrieveVector(std::ostringstream& ost,
G4bool isElement,
G4int Z)
406 std::ifstream filein(ost.str().c_str());
407 if (!filein.is_open()) {
410 ed <<
"Data file <" << ost.str().c_str()
411 <<
"> is not opened!";
412 G4Exception(
"G4GammaNuclearXS::RetrieveVector(..)",
"had014",
417 G4cout <<
"File " << ost.str()
418 <<
" is opened by G4GammaNuclearXS" <<
G4endl;
421 if(std::find(std::begin(freeVectorException), std::end(freeVectorException),
Z ) == std::end(freeVectorException) && isElement) {
428 ed <<
"Data file <" << ost.str().c_str()
429 <<
"> is not retrieved!";
430 G4Exception(
"G4GammaNuclearXS::RetrieveVector(..)",
"had015",
std::vector< G4Element * > G4ElementTable
const char * G4FindDataDir(const char *)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
#define G4MUTEX_INITIALIZER
#define G4MUTEXLOCK(mutex)
#define G4MUTEXUNLOCK(mutex)
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cout
G4VCrossSectionDataSet * GetCrossSectionDataSet(const G4String &name, G4bool warning=false)
static G4CrossSectionDataSetRegistry * Instance()
G4double GetKineticEnergy() const
G4PhysicsVector * GetComponentDataByIndex(G4int Z, G4int idx)
void InitialiseForComponent(G4int Z, G4int nComponents=0)
void InitialiseForElement(G4int Z, G4PhysicsVector *v)
G4PhysicsVector * GetElementData(G4int Z)
void AddComponent(G4int Z, G4int id, G4PhysicsVector *v)
void SetName(const G4String &nam)
static G4ElementTable * GetElementTable()
G4double * GetRelativeAbundanceVector() const
const G4Isotope * GetIsotope(G4int iso) const
size_t GetNumberOfIsotopes() const
G4double GetIsoCrossSection(const G4DynamicParticle *, G4int Z, G4int A, const G4Isotope *iso=nullptr, const G4Element *elm=nullptr, const G4Material *mat=nullptr) final
~G4GammaNuclearXS() final
void BuildPhysicsTable(const G4ParticleDefinition &) final
G4double ElementCrossSection(G4double ekin, G4int Z)
G4bool IsIsoApplicable(const G4DynamicParticle *, G4int Z, G4int A, const G4Element *, const G4Material *mat) final
G4double GetElementCrossSection(const G4DynamicParticle *, G4int Z, const G4Material *mat=nullptr) final
void CrossSectionDescription(std::ostream &) const final
G4double IsoCrossSection(G4double ekin, G4int Z, G4int A)
const G4Isotope * SelectIsotope(const G4Element *, G4double kinEnergy, G4double logE) final
G4bool IsElementApplicable(const G4DynamicParticle *, G4int Z, const G4Material *) final
const G4String & GetParticleName() const
G4double GetMaxEnergy() const
G4bool Retrieve(std::ifstream &fIn, G4bool ascii=false)
virtual G4double GetElementCrossSection(const G4DynamicParticle *, G4int Z, const G4Material *mat=nullptr)
virtual G4double GetIsoCrossSection(const G4DynamicParticle *, G4int Z, G4int A, const G4Isotope *iso=nullptr, const G4Element *elm=nullptr, const G4Material *mat=nullptr)
void SetForAllAtomsAndEnergies(G4bool val)