Import Geant4 11.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2022-12-09 14:43:28 +01:00
parent c07cea1fe0
commit 9f34590941
3810 changed files with 200490 additions and 182326 deletions
+22
View File
@@ -7,6 +7,28 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2022-11-26 Gabriele Cosmo (hadr-util-V11-00-13)
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
## 2022-10-07 Alberto Ribon (hadr-util-V11-00-12)
- G4Nucleus : corrected the method GetN_asInt for the case of hypernuclei.
## 2022-08-02 Alberto Ribon (hadr-util-V11-00-11)
- G4HadronicParametersMessenger : rolled back as it was in hadr-until-V11-00-09,
to avoid circular dependency between G4hadronic_util and G4had_string_diff.
A new messenger class is created in G4had_string_diff.
## 2022-07-28 Alberto Ribon (hadr-util-V11-00-10)
- G4HadronicParametersMessenger : added two new UI commands to select one
tuning of the FTF model's parameters.
## 2022-07-05 Vladimir Ivanchenko (hadr-util-V11-00-09)
- G4NuclearPolarization - fixed Coverity warning
## 2022-07-05 Vladimir Ivanchenko (hadr-util-V11-00-08)
- G4HadronicParameters - added flag to enable general neutron process
- G4HadDataHandler - new data class
## 2022-06-09 Laurie Nevay (hadr-util-V11-00-07)
- Add option to G4HadronicParameters to control diffraction for baryon
number greater than 10.
@@ -0,0 +1,112 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
// File name: G4HadDataHandler
//
// Author: V. Ivanchenko
//
// Creation date: 05 July 2022
//
// Modifications:
//
// Class Description:
//
// A storage of G4PhysicsTable
//
// Class Description: End
// -------------------------------------------------------------------
//
#ifndef G4HadDataHandler_h
#define G4HadDataHandler_h 1
#include "globals.hh"
#include "G4PhysicsTable.hh"
#include "G4PhysicsVector.hh"
#include <vector>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4VProcess;
class G4HadDataHandler
{
public:
explicit G4HadDataHandler(std::size_t nTable);
~G4HadDataHandler();
// add table
void AddTable(G4PhysicsTable*);
// update table with existing index
void UpdateTable(G4PhysicsTable*, std::size_t idx);
// clean existing table
void CleanTable(std::size_t idx);
// keep pointer of master thread process
void SetMasterProcess(const G4VProcess*);
// return pointer of master thread process
const G4VProcess* GetMasterProcess(std::size_t idx) const;
// access to the table via index
inline const G4PhysicsTable* GetTable(std::size_t idx) const {
return (idx < tLength) ? data[idx] : nullptr;
}
inline G4PhysicsTable* Table(std::size_t idx) const {
return (idx < tLength) ? data[idx] : nullptr;
}
// access to vector, no check on input index
inline
const G4PhysicsVector* GetVector(std::size_t itable, std::size_t ivec) const
{ return (*(data[itable]))[ivec]; }
inline const std::vector<G4PhysicsTable*>& GetTables() const { return data; }
// hide assignment operator
G4HadDataHandler & operator=(const G4HadDataHandler &right) = delete;
G4HadDataHandler(const G4HadDataHandler&) = delete;
private:
std::vector<G4PhysicsTable*> data;
std::size_t tLength;
std::vector<const G4VProcess*> masterProcess;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -136,6 +136,10 @@ class G4HadronicParameters {
/// be turned back on. Applies to Baryon Number > 10 or # target nucleons > 10.
void SetEnableDiffDissociationForBGreater10(G4bool val);
inline G4bool EnableNeutronGeneralProcess() const;
void SetEnableNeutronGeneralProcess( G4bool val );
// Neutron general process may be enabled/disabled
private:
G4HadronicParameters();
@@ -160,14 +164,15 @@ class G4HadronicParameters {
G4double fXSFactorEM = 1.0;
G4double fXSFactorLimit = 0.2;
G4int fVerboseLevel = 1;
G4bool fEnableBC = false;
G4bool fEnableHyperNuclei = false;
G4bool fApplyFactorXS = false;
G4bool fEnableCRCoalescence = false;
G4bool fEnableIntegralInelasticXS = true;
G4bool fEnableIntegralElasticXS = true;
G4int fVerboseLevel = 1;
G4bool fEnableBC = false;
G4bool fEnableHyperNuclei = false;
G4bool fApplyFactorXS = false;
G4bool fEnableCRCoalescence = false;
G4bool fEnableIntegralInelasticXS = true;
G4bool fEnableIntegralElasticXS = true;
G4bool fEnableDiffDissociationForBGreater10 = false;
G4bool fNeutronGeneral = false;
};
inline G4double G4HadronicParameters::GetMaxEnergy() const {
@@ -253,4 +258,8 @@ inline G4bool G4HadronicParameters::EnableDiffDissociationForBGreater10() const
return fEnableDiffDissociationForBGreater10;
}
inline G4bool G4HadronicParameters::EnableNeutronGeneralProcess() const {
return fNeutronGeneral;
}
#endif
@@ -100,7 +100,7 @@ class G4Nucleus
{ return theA; }
inline G4int GetN_asInt() const
{ return theA-theZ; }
{ return theA-theZ-theL; }
inline G4int GetZ_asInt() const
{ return theZ; }
@@ -17,6 +17,7 @@ geant4_add_module(G4hadronic_util
G4Fragment.hh
G4FragmentVector.hh
G4GeneralPhaseSpaceDecay.hh
G4HadDataHandler.hh
G4HadDecayGenerator.hh
G4HadFinalState.hh
G4HadParticleCodes.hh
@@ -65,6 +66,7 @@ geant4_add_module(G4hadronic_util
G4FermiMomentum.cc
G4Fragment.cc
G4GeneralPhaseSpaceDecay.cc
G4HadDataHandler.cc
G4HadDecayGenerator.cc
G4HadFinalState.cc
G4HadPhaseSpaceGenbod.cc
@@ -70,12 +70,12 @@ void G4DecayKineticTracks::Decay(G4KineticTrackVector *tracks) const {
tracks->insert(tracks->end(), daughters->begin(), daughters->end());
delete track; // Remove parent track
delete daughters;
(*tracks)[i] = NULL; // Flag parent's slot for removal
(*tracks)[i] = nullptr; // Flag parent's slot for removal
}
}
// Find and remove null pointers created by decays above
for (int j=tracks->size()-1; j>=0; --j) {
if (NULL == (*tracks)[j]) tracks->erase(tracks->begin()+j);
for (G4int j=(G4int)tracks->size()-1; j>=0; --j) {
if (nullptr == (*tracks)[j]) tracks->erase(tracks->begin()+j);
}
}
@@ -542,7 +542,7 @@ G4bool G4Fancy3DNucleus::ReduceSum()
testSums.resize(myA-1); // Allocate block for filling below
G4ThreeVector delta;
for (G4int aNucleon=0; aNucleon < myA-1; aNucleon++) {
for (G4int aNucleon=0; aNucleon < myA-1; ++aNucleon) {
delta = 2.*((momentum[aNucleon]*testDir)*testDir);
testSums[aNucleon].Fill(delta, delta.mag(), aNucleon);
@@ -551,7 +551,7 @@ G4bool G4Fancy3DNucleus::ReduceSum()
std::sort(testSums.begin(), testSums.end());
// reduce Momentum Sum until the next would be allowed.
G4int index=testSums.size();
G4int index=(G4int)testSums.size();
while ( (sum-testSums[--index].Vector).mag()>PFermi && index>0) /* Loop checking, 30-Oct-2015, G.Folger */
{
// Only take one which improve, ie. don't change sign and overshoot...
@@ -0,0 +1,110 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
// File name: G4HadDataHandler
//
// Author: V. Ivanchenko
//
// Creation date: 05 July 2022
//
// Modifications:
//
// -------------------------------------------------------------------
//
//
#include "G4HadDataHandler.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4HadDataHandler::G4HadDataHandler(std::size_t n) : tLength(n)
{
data.resize(n, nullptr);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4HadDataHandler::~G4HadDataHandler()
{
for(std::size_t i=0; i<tLength; ++i) {
for(std::size_t j = i+1; j<tLength; ++j) {
if(data[j] == data[i]) { data[j] = nullptr; }
}
CleanTable(i);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4HadDataHandler::AddTable(G4PhysicsTable* ptr)
{
data.push_back(ptr);
++tLength;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4HadDataHandler::UpdateTable(G4PhysicsTable* ptr, std::size_t idx)
{
// update table pointer but not delete previous
if(idx < tLength) {
if(ptr != data[idx]) { data[idx] = ptr; }
} else {
G4cout << "### G4HadDataHandler::UpdateTable fail for idx=" << idx
<< " length=" << tLength << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4HadDataHandler::CleanTable(std::size_t idx)
{
if(idx < tLength && nullptr != data[idx]) {
data[idx]->clearAndDestroy();
delete data[idx];
data[idx] = nullptr;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4HadDataHandler::SetMasterProcess(const G4VProcess* ptr)
{
masterProcess.push_back(ptr);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const G4VProcess* G4HadDataHandler::GetMasterProcess(const size_t idx) const
{
return (idx < masterProcess.size()) ? masterProcess[idx] : nullptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -48,7 +48,7 @@ GenerateMultiBody(G4double initialMass,
finalState.clear();
size_t N = masses.size();
G4int N = (G4int)masses.size();
finalState.resize(N);
G4double mtot = std::accumulate(masses.begin(), masses.end(), 0.0);
@@ -60,7 +60,7 @@ GenerateMultiBody(G4double initialMass,
G4LorentzVector PRestCM(0.0,0.0,0.0,0.0);
G4LorentzVector PRestLab(0.0,0.0,0.0,Mass);
for (size_t k=N-1; k>0; --k) {
for (G4int k=N-1; k>0; --k) {
mu -= masses[k];
T *= (k>1) ? BetaKopylov(k) : 0.;
@@ -56,7 +56,7 @@ GenerateMultiBody(G4double initialMass,
finalState.clear();
//daughters' mass
G4int numberOfDaughters = masses.size();
G4int numberOfDaughters = (G4int)masses.size();
G4double sumofmasses =
std::accumulate(masses.begin(), masses.end(), 0.);
@@ -209,6 +209,12 @@ void G4HadronicParameters::SetEnableIntegralElasticXS( G4bool val ) {
if ( ! IsLocked() ) fEnableIntegralElasticXS = val;
}
void G4HadronicParameters::SetEnableDiffDissociationForBGreater10(G4bool val) {
void G4HadronicParameters::SetEnableDiffDissociationForBGreater10( G4bool val ) {
if ( ! IsLocked() ) fEnableDiffDissociationForBGreater10 = val;
}
void G4HadronicParameters::SetEnableNeutronGeneralProcess( G4bool val ) {
if ( ! IsLocked() ) fNeutronGeneral = val;
}
@@ -49,6 +49,7 @@ G4NuclearPolarization::G4NuclearPolarization(G4int Z, G4int A, G4double exc)
G4NuclearPolarization::~G4NuclearPolarization()
{
//G4cout << "NP: delete " << this << G4endl;
Clean();
}
void G4NuclearPolarization::Clean()