Import Geant4 10.4.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2017-06-30 10:49:55 +02:00
parent 3a5407696b
commit 1a1316fea4
2180 changed files with 237880 additions and 59109 deletions
@@ -15,8 +15,32 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
22 May 2017 Dennis Wright (hadr-casc-V10-03-02)
------------------------------------------------
- G4ElementaryParticleCollider::generateSCMmuonAbsorption: fix rare seg fault
spotted and diagnosed by Ralf Ehrlich (mu2e/Virgina). Added line
particles.clear();
if GetThreeBodyMomenta() returns no momenta.
1 May 2017 Tatsumi Koi (hadr-casc-V10-03-01)
---------------------------------------------------
- G4CascadeParameters.cc: Use G4HadronicDeveloperParameters as a tool
for sharing parameters between developers and experienced users.
Need to set environment variable of "TEST_HDP" for testing the tool.
13 April 2017 Michael Kelsey (hadr-casc-V10-03-00)
---------------------------------------------------
- G4CascadeCoalescence: Remove clusterHash() function and triedClusters
registry. Drop redundant calls of tryCluster() with subcombinatorics; all
combinations are handled, uniquely, in main loop over indices. Eliminates
significant memory usage seen with high-energy applications of BERT.
- test/clusterComb.cc, test/GNUmakefile: New standalone test to exercise
combinatoric behaviour of G4CascadeCoalescence (used in testing above
changes).
29 November 2016 Dennis Wright (hadr-casc-V10-02-05)
----------------------------------------------------
-----------------------------------------------------
- G4InuclCollider::photonuclearOkay(): fix segfault reported by Daren Sawkey
in bug report #1883
@@ -34,6 +34,7 @@
// 20140116 M. Kelsey -- Move statics to const data members to avoid weird
// interactions with MT.
// 20151016 M. Kelsey -- Replace forward declare of G4InuclElemPart w/include.
// 20170406 M. Kelsey -- Remove clusterHash and triedClusters registry.
#ifndef G4CASCADE_COALESCENCE_HH
#define G4CASCADE_COALESCENCE_HH
@@ -64,7 +65,6 @@ private:
G4int verboseLevel; // Control diagnostic messages
std::vector<ClusterCandidate> allClusters; // List of candidates found
std::set<size_t> triedClusters; // Hashes of combinatorics
std::set<size_t> usedNucleons; // List of converted nucleons
G4CollisionOutput* thisFinalState; // Pointers to current event
@@ -92,14 +92,6 @@ private:
void fillCluster(size_t idx1, size_t idx2, size_t idx3);
void fillCluster(size_t idx1, size_t idx2, size_t idx3, size_t idx4);
// Convert cluster to hash index (for combinatoric reduction)
size_t clusterHash(const ClusterCandidate& clus) const;
// Check if candidate cluster has already been evaluated
bool clusterTried(const ClusterCandidate& clus) const {
return triedClusters.find(clusterHash(clus)) != triedClusters.end();
}
// Check if indexed nucleon is already in a cluster
bool nucleonUsed(size_t idx) const {
return usedNucleons.find(idx) != usedNucleons.end();
@@ -43,6 +43,8 @@
// 20120822 M. Kelsey -- Move envvars to G4CascadeParameters.
// 20130314 M. Kelsey -- Restore null initializer and if-block for _TLS_.
// 20130326 M. Kelsey -- Replace _TLS_ with mutable data member buffer.
// 20170406 M. Kelsey -- Remove recursive tryCluster() calls (redundant),
// and remove use of triedClusters registry.
#include "G4CascadeCoalescence.hh"
#include "G4CascadeParameters.hh"
@@ -59,12 +61,6 @@
#include <iterator>
// Short names for lists and iterators for convenience
typedef std::vector<G4InuclElementaryParticle> hadronList;
typedef hadronList::const_iterator hadronIter;
// Constructor and Destructor
G4CascadeCoalescence::G4CascadeCoalescence(G4int verbose)
@@ -101,7 +97,6 @@ void G4CascadeCoalescence::selectCandidates() {
if (verboseLevel)
G4cout << " >>> G4CascadeCoalescence::selectCandidates()" << G4endl;
triedClusters.clear();
allClusters.clear();
usedNucleons.clear();
@@ -134,58 +129,34 @@ void G4CascadeCoalescence::selectCandidates() {
void G4CascadeCoalescence::tryClusters(size_t idx1, size_t idx2,
size_t idx3, size_t idx4) {
if (nucleonUsed(idx1) || nucleonUsed(idx2) ||
nucleonUsed(idx3) || nucleonUsed(idx4)) return;
fillCluster(idx1,idx2,idx3,idx4);
if (clusterTried(thisCluster)) return;
if (verboseLevel>1) reportArgs("tryClusters",thisCluster);
if (verboseLevel>1)
G4cout << " >>> G4CascadeCoalescence::tryClusters " << idx1 << " " << idx2
<< " " << idx3 << " " << idx4 << G4endl;
triedClusters.insert(clusterHash(thisCluster)); // Remember current attempt
if (!nucleonUsed(idx1) && !nucleonUsed(idx2) &&
!nucleonUsed(idx3) && !nucleonUsed(idx4)) {
if (goodCluster(thisCluster)) {
allClusters.push_back(thisCluster);
usedNucleons.insert(idx1);
usedNucleons.insert(idx2);
usedNucleons.insert(idx3);
usedNucleons.insert(idx4);
return;
}
if (goodCluster(thisCluster)) {
allClusters.push_back(thisCluster);
usedNucleons.insert(idx1);
usedNucleons.insert(idx2);
usedNucleons.insert(idx3);
usedNucleons.insert(idx4);
}
tryClusters(idx2,idx3,idx4); // Try constituent subclusters
tryClusters(idx1,idx3,idx4);
tryClusters(idx1,idx2,idx4);
tryClusters(idx1,idx2,idx3);
}
void
G4CascadeCoalescence::tryClusters(size_t idx1, size_t idx2, size_t idx3) {
if (nucleonUsed(idx1) || nucleonUsed(idx2) || nucleonUsed(idx3)) return;
fillCluster(idx1,idx2,idx3);
if (clusterTried(thisCluster)) return;
if (verboseLevel>1) reportArgs("tryClusters",thisCluster);
if (verboseLevel>1)
G4cout << " >>> G4CascadeCoalescence::tryClusters " << idx1 << " " << idx2
<< " " << idx3 << G4endl;
triedClusters.insert(clusterHash(thisCluster)); // Remember current attempt
if (!nucleonUsed(idx1) && !nucleonUsed(idx2) && !nucleonUsed(idx3)) {
fillCluster(idx1,idx2,idx3);
if (goodCluster(thisCluster)) {
allClusters.push_back(thisCluster);
usedNucleons.insert(idx1);
usedNucleons.insert(idx2);
usedNucleons.insert(idx3);
return;
}
if (goodCluster(thisCluster)) {
allClusters.push_back(thisCluster);
usedNucleons.insert(idx1);
usedNucleons.insert(idx2);
usedNucleons.insert(idx3);
}
tryClusters(idx2,idx3); // Try constituent subclusters
tryClusters(idx1,idx3);
tryClusters(idx1,idx2);
}
void
@@ -193,15 +164,8 @@ G4CascadeCoalescence::tryClusters(size_t idx1, size_t idx2) {
if (nucleonUsed(idx1) || nucleonUsed(idx2)) return;
fillCluster(idx1,idx2);
if (clusterTried(thisCluster)) return;
if (verboseLevel>1) reportArgs("tryClusters",thisCluster);
if (verboseLevel>1)
G4cout << " >>> G4CascadeCoalescence::tryClusters " << idx1 << " " << idx2
<< G4endl;
triedClusters.insert(clusterHash(thisCluster)); // Remember current attempt
fillCluster(idx1,idx2);
if (goodCluster(thisCluster)) {
allClusters.push_back(thisCluster);
usedNucleons.insert(idx1);
@@ -291,18 +255,6 @@ clusterType(const ClusterCandidate& aCluster) const {
return type;
}
// Compute "cluster hash" as chain of indices
size_t G4CascadeCoalescence::
clusterHash(const ClusterCandidate& aCluster) const {
G4int hash = 0;
for (size_t i=0; i<aCluster.size(); i++) {
hash = hash*1000 + aCluster[i]; // FIXME: Use hadron list size instead?
}
return hash;
}
// Create cluster candidate with listed indices
@@ -47,6 +47,22 @@
#include <iostream>
using std::endl;
#define OLD_RADIUS_UNITS (3.3836/1.2) // Used with NucModel params
#include "G4HadronicDeveloperParameters.hh"
namespace {
G4HadronicDeveloperParameters& HDP = G4HadronicDeveloperParameters::GetInstance();
class BERTParameters {
public:
BERTParameters(){
//HDP.SetDefault("NAME",VALUE,LOWER_LIMIT(default=-DBL_MAX),UPPER_LIMIT(default=DBL_MAX));
HDP.SetDefault( "BERT_RADIUS_SCALE" , OLD_RADIUS_UNITS );
HDP.SetDefault( "BERT_XSEC_SCALE" , 1.0 , 0. );
}
};
BERTParameters BP;
}
// Singleton accessor
@@ -64,7 +80,7 @@ const G4CascadeParameters* G4CascadeParameters::Instance() {
// Constructor initializes everything once
#define OLD_RADIUS_UNITS (3.3836/1.2) // Used with NucModel params
//#define OLD_RADIUS_UNITS (3.3836/1.2) // Used with NucModel params
G4CascadeParameters::G4CascadeParameters()
: G4CASCADE_VERBOSE(getenv("G4CASCADE_VERBOSE")),
@@ -110,7 +126,10 @@ void G4CascadeParameters::Initialize() {
BEST_PAR = (0!=G4NUCMODEL_USE_BEST);
TWOPARAM_RADIUS = (0!=G4NUCMODEL_RAD_2PAR);
RADIUS_SCALE = (G4NUCMODEL_RAD_SCALE ? strtod(G4NUCMODEL_RAD_SCALE,0)
: (BEST_PAR?1.0:OLD_RADIUS_UNITS));
: (BEST_PAR?1.0:OLD_RADIUS_UNITS));
if ( getenv("TEST_HDP") ) {
HDP.DeveloperGet("BERT_RADIUS_SCALE",RADIUS_SCALE);
}
RADIUS_SMALL = ((G4NUCMODEL_RAD_SMALL ? strtod(G4NUCMODEL_RAD_SMALL,0)
: (BEST_PAR?1.992:(8.0/OLD_RADIUS_UNITS))) * RADIUS_SCALE);
RADIUS_ALPHA = (G4NUCMODEL_RAD_ALPHA ? strtod(G4NUCMODEL_RAD_ALPHA,0)
@@ -120,7 +139,10 @@ void G4CascadeParameters::Initialize() {
FERMI_SCALE = ((G4NUCMODEL_FERMI_SCALE ? strtod(G4NUCMODEL_FERMI_SCALE,0)
: (BEST_PAR?0.685:(1.932/OLD_RADIUS_UNITS))) * RADIUS_SCALE);
XSEC_SCALE = (G4NUCMODEL_XSEC_SCALE ? strtod(G4NUCMODEL_XSEC_SCALE,0)
: (BEST_PAR?0.1:1.0) );
: (BEST_PAR?0.1:1.0) );
if ( getenv("TEST_HDP") ) {
HDP.DeveloperGet("BERT_XSEC_SCALE",XSEC_SCALE);
}
GAMMAQD_SCALE = (G4NUCMODEL_GAMMAQD?strtod(G4NUCMODEL_GAMMAQD,0):1.);
DPMAX_DOUBLET = (DPMAX_2CLUSTER ? strtod(DPMAX_2CLUSTER,0) : 0.090);
DPMAX_TRIPLET = (DPMAX_3CLUSTER ? strtod(DPMAX_3CLUSTER,0) : 0.108);
@@ -488,6 +488,7 @@ G4ElementaryParticleCollider::generateSCMmuonAbsorption(G4double etot_scm,
<< " for " << type2 << " dibaryon" << G4endl;
particle_kinds.clear();
masses.clear();
particles.clear();
return;
}