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
@@ -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()