Import Geant4 10.7.2 source tree

This commit is contained in:
Gabriele Cosmo
2021-06-14 10:01:31 +02:00
parent 3dfcdb544e
commit c968e26a39
271 changed files with 26365 additions and 21942 deletions
+1 -1
View File
@@ -167,7 +167,7 @@ endif
banner:
@$(ECHO) "*************************************************************"
@$(ECHO) " Installation Geant4 version geant4-10-07-patch-01 "
@$(ECHO) " Installation Geant4 version geant4-10-07-patch-02 "
@$(ECHO) " Copyright (C) 1994-2021 Geant4 Collaboration "
@$(ECHO) "*************************************************************"
+5
View File
@@ -16,6 +16,11 @@ committal in the SVN repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
February 26, 2021 I. Hrivnacova (analysis-V10-06-14)
- Fixed ntuple indexing when FinishNtuple is called in different order
than CreateNtuple.
Addressing the problem report #2335.
February 2, 2021 I. Hrivnacova (analysis-V10-06-13)
- Fixed the problem with merging ntuples with columns of vector type
reported by Riccardo Pilato in G4 Forum.
@@ -42,12 +42,14 @@ struct G4NtupleBooking
{
G4NtupleBooking()
: fNtupleBooking(),
fNtupleId(-1),
fFileName(),
fActivation(true) {}
~G4NtupleBooking() {}
tools::ntuple_booking fNtupleBooking;
G4int fNtupleId;
G4String fFileName;
G4bool fActivation;
};
@@ -152,12 +152,39 @@ G4bool G4TNtupleManager<TN, TF>::FillNtupleTColumn(
template <typename TN, typename TF>
G4int G4TNtupleManager<TN, TF>::CreateNtuple(G4NtupleBooking* ntupleBooking)
{
// This ntuple id
auto ntupleId = G4int(fNtupleDescriptionVector.size()) + fFirstId;
#ifdef G4VERBOSE
if ( fState.GetVerboseL4() ) {
fState.GetVerboseL4()
->Message("create from booking", "ntuple",
ntupleBooking->fNtupleBooking.name());
}
#endif
// The ntuple index
auto index = ntupleBooking->fNtupleId - fFirstId;
// Check if the ntuple description of this id already exists
// (what should normally never happen)
// delete it and print a warning
if ( index < G4int(fNtupleDescriptionVector.size()) &&
fNtupleDescriptionVector[index] ) {
delete fNtupleDescriptionVector[index];
G4ExceptionDescription description;
description
<< "Ntuple description " << ntupleBooking->fNtupleId << " already exists.";
G4Exception("G4TNtupleManager::CreateNtuple",
"Analysis_W002", JustWarning, description);
}
// Allocate the vector element(s)
while ( index >= G4int(fNtupleDescriptionVector.size()) ) {
fNtupleDescriptionVector.push_back(nullptr);
}
// Create ntuple description from ntuple booking.
auto ntupleDescription = new G4TNtupleDescription<TN, TF>(ntupleBooking);
fNtupleDescriptionVector.push_back(ntupleDescription);
fNtupleDescriptionVector[index] = ntupleDescription;
// Do not create ntuple if it is inactivated
if ( fState.GetIsActivation() &&
@@ -167,19 +194,12 @@ G4int G4TNtupleManager<TN, TF>::CreateNtuple(G4NtupleBooking* ntupleBooking)
if ( ntupleDescription->fNtuple ) {
G4ExceptionDescription description;
description
<< "Ntuple " << ntupleId << " already exists.";
<< "Ntuple " << ntupleBooking->fNtupleId << " already exists.";
G4Exception("G4TNtupleManager::CreateNtuple",
"Analysis_W002", JustWarning, description);
return ntupleId;
return ntupleBooking->fNtupleId;
}
#ifdef G4VERBOSE
if ( fState.GetVerboseL4() )
fState.GetVerboseL4()
->Message("create from booking", "ntuple",
ntupleDescription->fNtupleBooking.name());
#endif
// create ntuple
CreateTNtupleFromBooking(ntupleDescription);
@@ -191,13 +211,12 @@ G4int G4TNtupleManager<TN, TF>::CreateNtuple(G4NtupleBooking* ntupleBooking)
if ( fState.GetVerboseL3() )
fState.GetVerboseL3()
->Message("create from booking", "ntuple",
ntupleDescription->fNtupleBooking.name());
ntupleBooking->fNtupleBooking.name());
#endif
return ntupleId;
return ntupleBooking->fNtupleId;
}
//_____________________________________________________________________________
template <typename TN, typename TF>
void G4TNtupleManager<TN, TF>::CreateNtuplesFromBooking(
@@ -101,6 +101,7 @@ G4int G4NtupleBookingManager::CreateNtuple(
// Save name & title in ntuple booking
ntupleBooking->fNtupleBooking.set_name(name);
ntupleBooking->fNtupleBooking.set_title(title);
ntupleBooking->fNtupleId = G4int(index + fFirstId);
// Create ntuple
fLockFirstId = true;
@@ -108,12 +109,12 @@ G4int G4NtupleBookingManager::CreateNtuple(
#ifdef G4VERBOSE
if ( fState.GetVerboseL2() ) {
G4ExceptionDescription description;
description << name << " ntupleId " << index + fFirstId;
description << name << " ntupleId " << ntupleBooking->fNtupleId;
fState.GetVerboseL2()->Message("create", "ntuple booking", description);
}
#endif
return G4int(index + fFirstId);
return ntupleBooking->fNtupleId;
}
//_____________________________________________________________________________
+4
View File
@@ -16,6 +16,10 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
June 7th, 2021 M. Asai (event-V10-06-10)
- Fix the default value of /gps/ang/maxphi command. Addressing to
the bug report 2383.
November 20th, 2020 B.Morgan (event-V10-06-09)
- Bugfix of build to ensure SmartStack preprocessor define is propagated.
No changes to code.
@@ -412,28 +412,28 @@ G4GeneralParticleSourceMessenger(G4GeneralParticleSource* fPtclGun)
minthetaCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/mintheta",this);
minthetaCmd1->SetGuidance("Set minimum theta");
minthetaCmd1->SetParameterName("MinTheta",false,false);
minthetaCmd1->SetParameterName("MinTheta",true,false);
minthetaCmd1->SetDefaultValue(0.);
minthetaCmd1->SetDefaultUnit("rad");
// minthetaCmd1->SetUnitCandidates("rad deg");
maxthetaCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/maxtheta",this);
maxthetaCmd1->SetGuidance("Set maximum theta");
maxthetaCmd1->SetParameterName("MaxTheta",false,false);
maxthetaCmd1->SetParameterName("MaxTheta",true,false);
maxthetaCmd1->SetDefaultValue(pi);
maxthetaCmd1->SetDefaultUnit("rad");
// maxthetaCmd1->SetUnitCandidates("rad deg");
minphiCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/minphi",this);
minphiCmd1->SetGuidance("Set minimum phi");
minphiCmd1->SetParameterName("MinPhi",false,false);
minphiCmd1->SetParameterName("MinPhi",true,false);
minphiCmd1->SetDefaultUnit("rad");
// minphiCmd1->SetUnitCandidates("rad deg");
maxphiCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/maxphi",this);
maxphiCmd1->SetGuidance("Set maximum phi");
maxphiCmd1->SetParameterName("MaxPhi",false,false);
maxphiCmd1->SetDefaultValue(pi);
maxphiCmd1->SetParameterName("MaxPhi",true,false);
maxphiCmd1->SetDefaultValue(2.*pi);
maxphiCmd1->SetDefaultUnit("rad");
// maxphiCmd1->SetUnitCandidates("rad deg");
+3
View File
@@ -16,6 +16,9 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
06 May 2021 - G.Cosmo (externals-V10-06-07)
- CLHEP: Fixed trivial compilation warnings on gcc-11 in Random headers.
8 December 2020 - B.Morgan (externals-V10-06-06)
- Force PTL to install its CMake configuration files within the directory
where Geant4 installs its own.
+3
View File
@@ -16,6 +16,9 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
06 May 2021 - G.Cosmo
- Fixed trivial compilation warnings on gcc-11 in Random headers.
11 November 2020 - G.Cosmo
- Synchronised with CLHEP-2.4.4.0:
* Vector (G.Amadio <amadio@cern.ch>)
@@ -144,6 +144,7 @@ private:
#if defined __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#pragma GCC diagnostic ignored "-Wuninitialized"
#endif
inline double convert1double(myuint_t u)
{
+7 -7
View File
@@ -63,29 +63,29 @@ public:
// Static methods to shoot random values using the static generator
static long shoot( double m=1.0 );
static long shoot( double mean=1.0 );
static void shootArray ( const int size, long* vect, double m=1.0 );
static void shootArray ( const int size, long* vect, double mean=1.0 );
// Static methods to shoot random values using a given engine
// by-passing the static generator.
static long shoot( HepRandomEngine* anEngine, double m=1.0 );
static long shoot( HepRandomEngine* anEngine, double mean=1.0 );
static void shootArray ( HepRandomEngine* anEngine,
const int size, long* vect, double m=1.0 );
const int size, long* vect, double mean=1.0 );
// Methods using the localEngine to shoot random values, by-passing
// the static generator.
long fire();
long fire( double m );
long fire( double mean );
void fireArray ( const int size, long* vect );
void fireArray ( const int size, long* vect, double m);
void fireArray ( const int size, long* vect, double mean);
double operator()();
double operator()( double m );
double operator()( double mean );
std::string name() const;
HepRandomEngine & engine();
+7 -7
View File
@@ -71,29 +71,29 @@ public:
// Static methods to shoot random values using the static generator
static long shoot( double m=1.0 );
static long shoot( double mean=1.0 );
static void shootArray ( const int size, long* vect, double m=1.0 );
static void shootArray ( const int size, long* vect, double mean=1.0 );
// Static methods to shoot random values using a given engine
// by-passing the static generator.
static long shoot( HepRandomEngine* anEngine, double m=1.0 );
static long shoot( HepRandomEngine* anEngine, double mean=1.0 );
static void shootArray ( HepRandomEngine* anEngine,
const int size, long* vect, double m=1.0 );
const int size, long* vect, double mean=1.0 );
// Methods using the localEngine to shoot random values, by-passing
// the static generator.
long fire();
long fire( double m );
long fire( double mean );
void fireArray ( const int size, long* vect );
void fireArray ( const int size, long* vect, double m);
void fireArray ( const int size, long* vect, double mean);
double operator()();
double operator()( double m );
double operator()( double mean );
std::string name() const;
HepRandomEngine & engine();
+1 -1
View File
@@ -94,7 +94,7 @@ public:
// Static member functions using the static generator
// --------------------------------------------------
static void setTheSeed(long seed, int lux=3);
static void setTheSeed(long seed, int lxr=3);
// (Re)Initializes the generator with a seed.
static long getTheSeed();
@@ -51,8 +51,8 @@ public:
Ranlux64Engine( std::istream& is );
Ranlux64Engine();
Ranlux64Engine( long seed, int lux = 1 );
Ranlux64Engine( int rowIndex, int colIndex, int lux );
Ranlux64Engine( long seed, int lxr = 1 );
Ranlux64Engine( int rowIndex, int colIndex, int lxr );
virtual ~Ranlux64Engine();
// Constructors and destructor
@@ -63,10 +63,10 @@ public:
void flatArray (const int size, double* vect);
// Fills the array "vect" of specified size with flat random values.
void setSeed(long seed, int lux=1);
void setSeed(long seed, int lxr=1);
// Sets the state of the algorithm according to seed.
void setSeeds(const long * seeds, int lux=1);
void setSeeds(const long * seeds, int lxr=1);
// Sets the state of the algorithm according to the zero terminated
// array of seeds. Only the first seed is used.
+4 -4
View File
@@ -47,8 +47,8 @@ public:
RanluxEngine( std::istream& is );
RanluxEngine();
RanluxEngine( long seed, int lux = 3 );
RanluxEngine( int rowIndex, int colIndex, int lux );
RanluxEngine( long seed, int lxr = 3 );
RanluxEngine( int rowIndex, int colIndex, int lxr );
virtual ~RanluxEngine();
// Constructors and destructor
@@ -70,10 +70,10 @@ public:
void flatArray (const int size, double* vect);
// Fills the array "vect" of specified size with flat random values.
void setSeed(long seed, int lux=3);
void setSeed(long seed, int lxr=3);
// Sets the state of the algorithm according to seed.
void setSeeds(const long * seeds, int lux=3);
void setSeeds(const long * seeds, int lxr=3);
// Sets the state of the algorithm according to the zero terminated
// array of seeds. Only the first seed is used.
+3
View File
@@ -19,6 +19,9 @@ committal in the CVS repository !
History file for G4 zlib package
--------------------------------
23 February 2021 Ben Morgan (zlib-V10-06-02)
- Use separate genexes in G4zlib include directories to prevent parsing issues.
29 October 2020 Ben Morgan (zlib-V10-06-01)
- sources.cmake: remove include of obsolete CMake module,
update for full migration to new CMake system.
+1 -1
View File
@@ -136,5 +136,5 @@ GEANT4_DEFINE_MODULE(NAME G4zlib
)
# List any source specific properties here
geant4_module_include_directories(G4zlib
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src;${CMAKE_CURRENT_BINARY_DIR}>
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src> $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)
+5
View File
@@ -16,6 +16,11 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
May 17, 2021 E.Tcherniaev geom-csg-V10-06-07
- Bux fix in G4Sphere::GetSurfaceArea()
- G4Sphere::GetCubicVolume() moved to source
- Revised G4Sphere::GetPointOnSurface()
February 1, 2021 G.Cosmo geom-csg-V10-06-06
- G4Trap, G4Para: removed spurious character in printout in StreamInfo().
Addressed problem report #2318.
@@ -121,7 +121,7 @@ class G4Sphere : public G4CSGSolid
// Methods for solid
inline G4double GetCubicVolume();
G4double GetCubicVolume();
G4double GetSurfaceArea();
void ComputeDimensions( G4VPVParameterisation* p,
@@ -115,7 +115,7 @@ G4double G4Sphere::GetCosEndTheta () const
return cosETheta;
}
inline
inline
void G4Sphere::Initialize()
{
fCubicVolume = 0.;
@@ -127,7 +127,7 @@ inline
void G4Sphere::InitializePhiTrigonometry()
{
hDPhi = 0.5*fDPhi; // half delta phi
cPhi = fSPhi + hDPhi;
cPhi = fSPhi + hDPhi;
ePhi = fSPhi + fDPhi;
sinCPhi = std::sin(cPhi);
@@ -310,7 +310,7 @@ void G4Sphere::SetDeltaThetaAngle(G4double newDTheta)
// Old access functions
inline
G4double G4Sphere::GetRmin() const
G4double G4Sphere::GetRmin() const
{
return GetInsideRadius();
}
@@ -344,12 +344,3 @@ G4double G4Sphere::GetDTheta() const
{
return GetDeltaThetaAngle();
}
inline
G4double G4Sphere::GetCubicVolume()
{
if(fCubicVolume != 0.) {;}
else { fCubicVolume = fDPhi*(std::cos(fSTheta)-std::cos(fSTheta+fDTheta))*
(fRmax*fRmax*fRmax-fRmin*fRmin*fRmin)/3.; }
return fCubicVolume;
}
File diff suppressed because it is too large Load Diff
+12
View File
@@ -16,6 +16,18 @@ committal in the source repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
30-April-2021 G.Cosmo (geom-specific-V10-06-12)
- Fixed use of conversion factor in G4UPolyhedra wrapper for "generic"
polyhedra constructs.
19-April-2021 E.Tcherniaev
- G4Polyhedra, G4Polycone: Fix calculation of endPhi for the case
of negative phiStart, it addresses also problem report #2362
18-March-2021 E.Tcherniaev
- Fix calculation of bounding box position in G4Voxelizer::BuildVoxelLimits(),
it addresses problem report #2301
13-January-2021 G.Cosmo (geom-specific-V10-06-11)
- Reduce cases of bad speculation in G4PolyhedraSide::Inside() and
G4PolyPhiFace::InsideEdges(), based on report in profiling analysis
@@ -220,11 +220,16 @@ void G4Polycone::Create( G4double phiStart,
numCorner = rz->NumVertices();
startPhi = phiStart;
while( startPhi < 0. ) // Loop checking, 13.08.2015, G.Cosmo
startPhi += twopi;
//
// Phi opening? Account for some possible roundoff, and interpret
// nonsense value as representing no phi opening
//
if (phiTotal <= 0 || phiTotal > twopi-1E-10)
if ( (phiTotal <= 0) || (phiTotal > twopi*(1-DBL_EPSILON)) )
{
phiIsOpen = false;
startPhi = 0.;
@@ -233,17 +238,7 @@ void G4Polycone::Create( G4double phiStart,
else
{
phiIsOpen = true;
//
// Convert phi into our convention
//
startPhi = phiStart;
while( startPhi < 0. ) // Loop checking, 13.08.2015, G.Cosmo
startPhi += twopi;
endPhi = phiStart+phiTotal;
while( endPhi < startPhi ) // Loop checking, 13.08.2015, G.Cosmo
endPhi += twopi;
endPhi = startPhi + phiTotal;
}
//
@@ -248,18 +248,12 @@ void G4Polyhedra::Create( G4double phiStart,
if ( (phiTotal <= 0) || (phiTotal > twopi*(1-DBL_EPSILON)) )
{
phiIsOpen = false;
endPhi = phiStart+twopi;
endPhi = startPhi + twopi;
}
else
{
phiIsOpen = true;
//
// Convert phi into our convention
//
endPhi = phiStart+phiTotal;
while( endPhi < startPhi ) // Loop checking, 13.08.2015, G.Cosmo
endPhi += twopi;
endPhi = startPhi + phiTotal;
}
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// Implementation of G4UPolycone wrapper class
// Implementation of G4UPolyhedra wrapper class
//
// 31.10.13 G.Cosmo, CERN
// --------------------------------------------------------------------
@@ -116,11 +116,10 @@ G4UPolyhedra::G4UPolyhedra(const G4String& name,
wrDelta = twopi;
}
wrNumSide = numSide;
G4double convertRad = 1./std::cos(0.5*wrDelta/wrNumSide);
rzcorners.resize(0);
for (G4int i=0; i<numRZ; ++i)
{
rzcorners.push_back(G4TwoVector(r[i]*convertRad,z[i]));
rzcorners.push_back(G4TwoVector(r[i],z[i]));
}
std::vector<G4int> iout;
G4GeomTools::RemoveRedundantVertices(rzcorners,iout,2*kCarTolerance);
@@ -261,7 +260,8 @@ void G4UPolyhedra::SetOriginalParameters()
fOriginalParameters.Rmin = new G4double[numPlanes];
fOriginalParameters.Rmax = new G4double[numPlanes];
G4double convertRad = std::cos(0.5*deltaPhi/numSides);
G4double convertRad = fGenericPgon
? 1.0 : std::cos(0.5*deltaPhi/numSides);
for (G4int i=0; i<numPlanes; ++i)
{
fOriginalParameters.Z_values[i] = GetZPlanes()[i];
@@ -116,10 +116,6 @@ void G4Voxelizer::BuildEmpty()
void G4Voxelizer::BuildVoxelLimits(std::vector<G4VSolid*>& solids,
std::vector<G4Transform3D>& transforms)
{
G4Rotate3D rot;
G4Translate3D transl ;
G4Scale3D scale;
// "BuildVoxelLimits"'s aim is to store the coordinates of the origin as
// well as the half lengths related to the bounding box of each node.
// These quantities are stored in the array "fBoxes" (6 different values per
@@ -157,9 +153,8 @@ void G4Voxelizer::BuildVoxelLimits(std::vector<G4VSolid*>& solids,
max += toleranceVector;
}
TransformLimits(min, max, transform);
fBoxes[i].hlen = (max - min) / 2;
transform.getDecomposition(scale,rot,transl);
fBoxes[i].pos = transl.getTranslation();
fBoxes[i].hlen = (max - min) / 2.;
fBoxes[i].pos = (max + min) / 2.;
}
fTotalCandidates = fBoxes.size();
}
+9
View File
@@ -16,6 +16,15 @@ commit in the repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
June 9, 2021 Gabriele (global-V10-06-29)
- Removed spurious spaces in #define in G4Version header.
Addressing problem report #2384.
- Updated tag IDs for release 10.7.p02.
March 26, 2021 Gabriele Cosmo
- Zero terminate buffer in G4strstreambuf destructor before flushing.
Addressing problem report #2350.
February 2, 2021 Gabriele (global-V10-06-28)
- Updated tag IDs for release 10.7.p01.
@@ -40,11 +40,11 @@
// |--> patch number
#ifndef G4VERSION_NUMBER
# define G4VERSION_NUMBER 1071
#define G4VERSION_NUMBER 1072
#endif
#ifndef G4VERSION_TAG
# define G4VERSION_TAG "$Name: geant4-10-07-patch-01 $"
#define G4VERSION_TAG "$Name: geant4-10-07-patch-02 $"
#endif
// as variables
@@ -53,10 +53,10 @@
#include "G4Types.hh"
#ifdef G4MULTITHREADED
static const G4String G4Version = "$Name: geant4-10-07-patch-01 [MT]$";
static const G4String G4Version = "$Name: geant4-10-07-patch-02 [MT]$";
#else
static const G4String G4Version = "$Name: geant4-10-07-patch-01 $";
static const G4String G4Version = "$Name: geant4-10-07-patch-02 $";
#endif
static const G4String G4Date = "(5-February-2021)";
static const G4String G4Date = "(11-June-2021)";
#endif
@@ -43,7 +43,10 @@ inline G4strstreambuf::~G4strstreambuf()
// flushing buffer...
// std::cout is used because destination object may not be alive.
if(count != 0)
{
buffer[count] = '\0';
std::cout << buffer;
}
delete[] buffer;
}
+3
View File
@@ -19,6 +19,9 @@ committal in the CVS repository !
History file for graphics_reps category
---------------------------------------
06 May 2021 Gabriele Cosmo (greps-V10-06-07)
- Fixed shadowing compilation warning in G4Colours reported with gcc-11.
01 December 2020 Evgueni Tcherniaev (greps-V10-06-06)
- HepPolyhedron: revised HepPolyhedronHype,
it addresses problem report #2295.
+2 -2
View File
@@ -85,8 +85,8 @@ class G4Colour {
public: // With description
G4Colour (G4double r = 1., G4double g = 1., G4double b = 1.,
G4double a = 1.);
G4Colour (G4double r_ = 1., G4double g_ = 1., G4double b_ = 1.,
G4double a_ = 1.);
G4Colour (G4ThreeVector);
// Converts the components of the 3-vector into red, green, blue.
+3
View File
@@ -16,6 +16,9 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
06 May, 2021 G. Cosmo (intercoms-V10-06-08)
- Fixed shadowing compilation warning in G4UImanager reported with gcc-11.
16 January 2020 John Allison (intercoms-V10-06-07)
- G4UImanager:
o Introduce flag and access functions for LastCommandOutputTreated.
+1 -1
View File
@@ -235,7 +235,7 @@ class G4UImanager : public G4VStateDependent
G4bool ifAppend = true);
void SetCerrFileName(const G4String& fileN = "G4cerr.txt",
G4bool ifAppend = true);
void SetThreadPrefixString(const G4String& s = "W");
void SetThreadPrefixString(const G4String& prefix = "W");
void SetThreadUseBuffer(G4bool flg = true);
void SetThreadIgnore(G4int tid = 0);
void SetThreadIgnoreInit(G4bool flg = true);
+7
View File
@@ -16,6 +16,13 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
18 March 2021 John Allison (interfaces-V10-06-13)
- G4UIQt::ReceiveG4cout/G4cerr:
o Trap empty string with empty() instead of using unary operator!
(The latter may work for std::string but G4String has a conversion
operator to char*, so ! is always false.)
o Fixes bug report #2347.
26 January 2020 John Allison (interfaces-V10-06-12)
- G4UIQt.cc: Get colour and background from OS.
o Instead of fixed background <span style='background:#EEEEEE...
+2 -2
View File
@@ -2014,7 +2014,7 @@ G4int G4UIQt::ReceiveG4cout (
const G4String& aString
)
{
if (!aString) return 0;
if(aString.empty()) return 0;
#ifdef G4MULTITHREADED
G4AutoLock al(&ReceiveG4coutMutex);
@@ -2105,7 +2105,7 @@ G4int G4UIQt::ReceiveG4cerr (
const G4String& aString
)
{
if (!aString) return 0;
if (aString.empty()) return 0;
#ifdef G4MULTITHREADED
G4AutoLock al(&ReceiveG4cerrMutex);
+11
View File
@@ -16,6 +16,17 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
06-05-21 G.Cosmo (materials-V10-06-14)
- Fixed shadowing compilation warning in G4Isotope reported with gcc-11.
16-04-21 V.Ivanchenko (materials-V10-06-13)
- G4AtomicShells, G4AtomicShells_XDB_EADL - fixed method
GetNumberOfFreeElectrons(..) - problem #2356
05-02-21 V.Ivanchenko
- G4DensityEffectData - fixed typo in Z=37 elementary material name
(problem #2324)
16-11-20 G.Cosmo (materials-V10-06-12)
- Fixed typos in printed-out text. Addressing problem report #2285.
+1 -1
View File
@@ -78,7 +78,7 @@ class G4Isotope
G4int z, //atomic number
G4int n, //number of nucleons
G4double a = 0., //mass of mole
G4int m = 0); //isomer level
G4int mlevel = 0); //isomer level
virtual ~G4Isotope();
+1 -1
View File
@@ -789,7 +789,7 @@ G4AtomicShells::GetNumberOfFreeElectrons(G4int Z, G4double th)
G4int idxmax = idx + fNumberOfShells[Z];
G4int n = 0;
for (G4int i=idx; i<idxmax; ++i) {
if(fBindingEnergies[i] <= th) { n += fNumberOfElectrons[i]; }
if(fBindingEnergies[i]*CLHEP::eV <= th) { n += fNumberOfElectrons[i]; }
}
return n;
}
@@ -41,7 +41,6 @@
#include "G4AtomicShells_XDB_EADL.hh"
#include "G4SystemOfUnits.hh"
const G4int
G4AtomicShells_XDB_EADL::fNumberOfShells[121] =
{
@@ -711,7 +710,6 @@ G4AtomicShells_XDB_EADL::fBindingEnergies[2171] =
0.0396, 0.0251, 0.0113, 0.0042
};
const G4int
G4AtomicShells_XDB_EADL::fNumberOfElectrons[2171] =
{
@@ -1276,7 +1274,7 @@ G4AtomicShells_XDB_EADL::GetNumberOfFreeElectrons(G4int Z, G4double th)
G4int idxmax = idx + fNumberOfShells[Z];
G4int n = 0;
for (G4int i=idx; i<idxmax; ++i) {
if(fBindingEnergies[i] <= th) { n += fNumberOfElectrons[i]; }
if(fBindingEnergies[i]*CLHEP::keV <= th) { n += fNumberOfElectrons[i]; }
}
return n;
}
+2 -2
View File
@@ -271,9 +271,9 @@ void G4DensityEffectData::Initialize()
indexZ[36]=36;
state[36]=kStateGas;
//G4_Ru index=37
//G4_Rb index=37
G4double M37[NDENSARRAY]={23.467,1.823,6.4776,0.5737,3.7995,0.07261,3.4177,0.14,0.026,363. };
AddMaterial(M37,"G4_Ru");
AddMaterial(M37,"G4_Rb");
indexZ[37]=37;
//G4_Sr index=38
+3
View File
@@ -16,6 +16,9 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
- 06 May 2021 Gabriele Cosmo (particles-V10-06-11)
- Fixed shadowing compilation warning in G4IonTable reported with gcc-11.
- 16 November 2020 Gabriele Cosmo (particles-V10-06-10)
- Fixed typos in printed-out text. Addressing problem report #2285.
@@ -111,21 +111,21 @@ class G4IonTable
// Find/Get "ground state" and "excited state"
//
G4ParticleDefinition* GetIon(G4int Z, G4int A, G4int lvl=0);
G4ParticleDefinition* GetIon(G4int Z, G4int A, G4int L, G4int lvl);
G4ParticleDefinition* GetIon(G4int Z, G4int A, G4int nL, G4int lvl);
G4ParticleDefinition* GetIon(G4int Z, G4int A, G4double E, G4int J=0);
G4ParticleDefinition* GetIon(G4int Z, G4int A, G4double E,
G4Ions::G4FloatLevelBase flb, G4int J=0);
G4ParticleDefinition* GetIon(G4int Z, G4int A, G4double E,
char flbChar, G4int J=0);
G4ParticleDefinition* GetIon(G4int Z, G4int A, G4int L, G4double E,
G4ParticleDefinition* GetIon(G4int Z, G4int A, G4int nL, G4double E,
G4int J=0);
G4ParticleDefinition* GetIon(G4int Z, G4int A, G4int L, G4double E,
G4ParticleDefinition* GetIon(G4int Z, G4int A, G4int nL, G4double E,
G4Ions::G4FloatLevelBase flb, G4int J=0);
G4ParticleDefinition* GetIon(G4int Z, G4int A, G4int L, G4double E,
G4ParticleDefinition* GetIon(G4int Z, G4int A, G4int nL, G4double E,
char flbChar, G4int J=0);
// Z: Atomic Number
// A: Atomic Mass (nn + np +nlambda)
// L: Number of Lmabda
// nL: Number of Lambda
// E: Excitation energy
// lvl: Isomer Level 0: ground state)
// flb: Floating level base (enum defined in G4Ions.hh)
@@ -140,21 +140,21 @@ class G4IonTable
// Find/Get "excited state"
//
G4ParticleDefinition* FindIon(G4int Z, G4int A, G4int lvl=0);
G4ParticleDefinition* FindIon(G4int Z, G4int A, G4int L, G4int lvl);
G4ParticleDefinition* FindIon(G4int Z, G4int A, G4int nL, G4int lvl);
G4ParticleDefinition* FindIon(G4int Z, G4int A, G4double E, G4int J=0);
G4ParticleDefinition* FindIon(G4int Z, G4int A, G4double E,
G4Ions::G4FloatLevelBase flb, G4int J=0);
G4ParticleDefinition* FindIon(G4int Z, G4int A, G4double E,
char flbChar, G4int J=0);
G4ParticleDefinition* FindIon(G4int Z, G4int A, G4int L, G4double E,
G4ParticleDefinition* FindIon(G4int Z, G4int A, G4int nL, G4double E,
G4int J=0);
G4ParticleDefinition* FindIon(G4int Z, G4int A, G4int L, G4double E,
G4ParticleDefinition* FindIon(G4int Z, G4int A, G4int nL, G4double E,
G4Ions::G4FloatLevelBase flb, G4int J=0);
G4ParticleDefinition* FindIon(G4int Z, G4int A, G4int L, G4double E,
G4ParticleDefinition* FindIon(G4int Z, G4int A, G4int nL, G4double E,
char flbChar, G4int J=0);
// Z: Atomic Number
// A: Atomic Mass (nn + np +nlambda)
// L: Number of Lmabda
// nL: Number of Lambda
// E: Excitaion energy
// lvl: Isomer Level 0: ground state)
// flb: Floating level base (enum defined in G4Ions.hh)
@@ -171,9 +171,9 @@ class G4IonTable
const G4String& GetIonName(G4int Z, G4int A, G4int lvl=0) const;
const G4String& GetIonName(G4int Z, G4int A, G4double E,
G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::no_Float) const;
const G4String& GetIonName(G4int Z, G4int A, G4int L, G4double E,
const G4String& GetIonName(G4int Z, G4int A, G4int nL, G4double E,
G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::no_Float) const;
const G4String& GetIonName(G4int Z, G4int A, G4int L, G4int lvl) const;
const G4String& GetIonName(G4int Z, G4int A, G4int nL, G4int lvl) const;
// Get ion name
static G4int GetNucleusEncoding(G4int Z, G4int A,
@@ -185,13 +185,13 @@ class G4IonTable
// I gives the isomer level, with I = 0 corresponding
// to the ground state and I >0 to excitations
static G4int GetNucleusEncoding(G4int Z, G4int A, G4int L,
static G4int GetNucleusEncoding(G4int Z, G4int A, G4int nL,
G4double E=0.0, G4int lvl=0);
// Get PDG code for Hyper-Nucleus Ions.
// Nuclear codes are given as 10-digit numbers +-10LZZZAAAI.
// For a nucleus consisting of np protons and nn neutrons
// A = np + nn +nlambda and Z = np.
// L = nlambda
// nL = nlambda
// I gives the isomer level, with I = 0 corresponding
// to the ground state and I >0 to excitations
@@ -203,13 +203,13 @@ class G4IonTable
G4double& E, G4int& lvl);
// Energy will not be given even for excited state!!
G4double GetIonMass(G4int Z, G4int A, G4int L=0, G4int lvl=0) const;
G4double GetNucleusMass(G4int Z, G4int A, G4int L=0, G4int lvl=0) const;
G4double GetIonMass(G4int Z, G4int A, G4int nL=0, G4int lvl=0) const;
G4double GetNucleusMass(G4int Z, G4int A, G4int nL=0, G4int lvl=0) const;
G4double GetIsomerMass(G4int Z, G4int A, G4int lvl=0) const;
// These methods returns Nucleus (i.e. full ionized atom) mass, where
// Z is Atomic Number (number of protons) and
// A is Atomic Number (number of nucleons and hyperons)
// L is number of lambda (A= nn + np + nlambda)
// nL is number of lambda (A= nn + np + nlambda)
// lvl is isomer level
G4double GetLifeTime(const G4ParticleDefinition*) const;
@@ -270,18 +270,18 @@ class G4IonTable
protected:
G4ParticleDefinition* FindIonInMaster(G4int Z, G4int A, G4int lvl=0);
G4ParticleDefinition* FindIonInMaster(G4int Z, G4int A, G4int L, G4int lvl);
G4ParticleDefinition* FindIonInMaster(G4int Z, G4int A, G4int nL, G4int lvl);
G4ParticleDefinition* FindIonInMaster(G4int Z, G4int A, G4double E,
G4Ions::G4FloatLevelBase flb, G4int J=0);
G4ParticleDefinition* FindIonInMaster(G4int Z, G4int A, G4int L,
G4ParticleDefinition* FindIonInMaster(G4int Z, G4int A, G4int nL,
G4double E, G4Ions::G4FloatLevelBase flb, G4int J=0);
G4ParticleDefinition* CreateIon(G4int Z, G4int A, G4double E,
G4Ions::G4FloatLevelBase flb);
G4ParticleDefinition* CreateIon(G4int Z, G4int A, G4int L, G4double E,
G4ParticleDefinition* CreateIon(G4int Z, G4int A, G4int nL, G4double E,
G4Ions::G4FloatLevelBase flb);
G4ParticleDefinition* CreateIon(G4int Z, G4int A, G4int lvl=0);
G4ParticleDefinition* CreateIon(G4int Z, G4int A, G4int L, G4int lvl);
G4ParticleDefinition* CreateIon(G4int Z, G4int A, G4int nL, G4int lvl);
void InsertWorker(const G4ParticleDefinition* particle);
+4
View File
@@ -15,6 +15,10 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
27 March 2021 - G.Cosmo (ascii-V10-06-03)
- Fixed definition of generic polyhedra in G4tgbVolume::FindOrConstructG4Solid()
for POLYHEDRA tag. Based on findings in GitHub PR#24 by P.Heidary.
8 October 2020 - G.Cosmo (ascii-V10-06-02)
- Minor c++11 review. Code cleanup and formatting.
+2 -2
View File
@@ -429,11 +429,11 @@ G4VSolid* G4tgbVolume::FindOrConstructG4Solid(const G4tgrSolid* sol)
G4bool genericPoly = false;
if(solParam.size() == 4 + nplanes * 3)
{
genericPoly = true;
genericPoly = false;
}
else if(solParam.size() == 4 + nplanes * 2)
{
genericPoly = false;
genericPoly = true;
}
else
{
+17
View File
@@ -16,6 +16,23 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
21 May 2021 Gabriele Cosmo (gdml-V10-06-07)
- G4GDMLReadSolids: updated optical surface properties based on relatively
recent introduction of DAVIS interface.
Addressing problem report #2371.
17 March 2021 Witek Pokorski
- Solves the problem #2343 of not all assemblies being written out to the GDML file.
Fix provided by Laurie Nevay.
16 March 2021 Witek Pokorski
- Solves the problem #2342 of multiUnion and assembly write creating degenerated names
(position, rotation and nodes). Fix provided by Laurie Nevay.
4 March 2021 Witek Pokorski
- Removed the hardcoded size 10000 in G4GDMLWrite causing the values in GDML truncated.
Adressing problem report #2336. Fix by Tao Lin.
3 February 2021 Gabriele Cosmo (gdml-V10-06-06)
- Fixed parsing of regions in G4GDMLParser::ImportRegions().
Allow for proper deletion of meta-data lists in destructor.
@@ -132,7 +132,7 @@ class G4GDMLWrite
xercesc::DOMDocument* doc = nullptr;
xercesc::DOMElement* extElement = nullptr;
xercesc::DOMElement* userinfoElement = nullptr;
XMLCh tempStr[10000];
G4GDMLAuxListType auxList;
G4bool overwriteOutputFile = false;
};
@@ -3654,6 +3654,10 @@ void G4GDMLReadSolids::OpticalSurfaceRead(
{
model = LUT;
}
else if((smodel == "DAVIS") || (smodel == "3"))
{
model = DAVIS;
}
else
{
model = dichroic;
@@ -3775,10 +3779,46 @@ void G4GDMLReadSolids::OpticalSurfaceRead(
{
finish = groundvm2000air;
}
else
else if((sfinish == "groundvm2000glue") || (sfinish == "29"))
{
finish = groundvm2000glue;
}
else if((sfinish == "Rough_LUT") || (sfinish == "30"))
{
finish = Rough_LUT;
}
else if((sfinish == "RoughTeflon_LUT") || (sfinish == "31"))
{
finish = RoughTeflon_LUT;
}
else if((sfinish == "RoughESR_LUT") || (sfinish == "32"))
{
finish = RoughESR_LUT;
}
else if((sfinish == "RoughESRGrease_LUT") || (sfinish == "33"))
{
finish = RoughESRGrease_LUT;
}
else if((sfinish == "Polished_LUT") || (sfinish == "34"))
{
finish = Polished_LUT;
}
else if((sfinish == "PolishedTeflon_LUT") || (sfinish == "35"))
{
finish = PolishedTeflon_LUT;
}
else if((sfinish == "PolishedESR_LUT") || (sfinish == "36"))
{
finish = PolishedESR_LUT;
}
else if((sfinish == "PolishedESRGrease_LUT") || (sfinish == "37"))
{
finish = PolishedESRGrease_LUT;
}
else
{
finish = Detector_LUT;
}
if((stype == "dielectric_metal") || (stype == "0"))
{
@@ -3792,11 +3832,15 @@ void G4GDMLReadSolids::OpticalSurfaceRead(
{
type = dielectric_LUT;
}
else if((stype == "dielectric_dichroic") || (stype == "3"))
else if((stype == "dielectric_LUTDAVIS") || (stype == "3"))
{
type = dielectric_LUTDAVIS;
}
else if((stype == "dielectric_dichroic") || (stype == "4"))
{
type = dielectric_dichroic;
}
else if((stype == "firsov") || (stype == "4"))
else if((stype == "firsov") || (stype == "5"))
{
type = firsov;
}
+28 -9
View File
@@ -155,10 +155,15 @@ G4String G4GDMLWrite::GenerateName(const G4String& name, const void* const ptr)
xercesc::DOMAttr* G4GDMLWrite::NewAttribute(const G4String& name,
const G4String& value)
{
xercesc::XMLString::transcode(name, tempStr, 9999);
XMLCh* tempStr = NULL;
tempStr = xercesc::XMLString::transcode(name);
xercesc::DOMAttr* att = doc->createAttribute(tempStr);
xercesc::XMLString::transcode(value, tempStr, 9999);
xercesc::XMLString::release(&tempStr);
tempStr = xercesc::XMLString::transcode(value);
att->setValue(tempStr);
xercesc::XMLString::release(&tempStr);
return att;
}
@@ -166,22 +171,32 @@ xercesc::DOMAttr* G4GDMLWrite::NewAttribute(const G4String& name,
xercesc::DOMAttr* G4GDMLWrite::NewAttribute(const G4String& name,
const G4double& value)
{
xercesc::XMLString::transcode(name, tempStr, 9999);
XMLCh* tempStr = NULL;
tempStr = xercesc::XMLString::transcode(name);
xercesc::DOMAttr* att = doc->createAttribute(tempStr);
xercesc::XMLString::release(&tempStr);
std::ostringstream ostream;
ostream.precision(15);
ostream << value;
G4String str = ostream.str();
xercesc::XMLString::transcode(str, tempStr, 9999);
tempStr = xercesc::XMLString::transcode(str);
att->setValue(tempStr);
xercesc::XMLString::release(&tempStr);
return att;
}
// --------------------------------------------------------------------
xercesc::DOMElement* G4GDMLWrite::NewElement(const G4String& name)
{
xercesc::XMLString::transcode(name, tempStr, 9999);
return doc->createElement(tempStr);
XMLCh* tempStr = NULL;
tempStr = xercesc::XMLString::transcode(name);
xercesc::DOMElement* elem = doc->createElement(tempStr);
xercesc::XMLString::release(&tempStr);
return elem;
}
// --------------------------------------------------------------------
@@ -212,13 +227,17 @@ G4Transform3D G4GDMLWrite::Write(const G4String& fname,
VolumeMap().clear(); // The module map is global for all modules,
// so clear it only at once!
xercesc::XMLString::transcode("LS", tempStr, 9999);
XMLCh* tempStr = NULL;
tempStr = xercesc::XMLString::transcode("LS");
xercesc::DOMImplementationRegistry::getDOMImplementation(tempStr);
xercesc::XMLString::transcode("Range", tempStr, 9999);
xercesc::XMLString::release(&tempStr);
tempStr = xercesc::XMLString::transcode("Range");
xercesc::DOMImplementation* impl =
xercesc::DOMImplementationRegistry::getDOMImplementation(tempStr);
xercesc::XMLString::transcode("gdml", tempStr, 9999);
xercesc::XMLString::release(&tempStr);
tempStr = xercesc::XMLString::transcode("gdml");
doc = impl->createDocument(0, tempStr, 0);
xercesc::XMLString::release(&tempStr);
xercesc::DOMElement* gdml = doc->getDocumentElement();
#if XERCES_VERSION_MAJOR >= 3
@@ -116,19 +116,19 @@ void G4GDMLWriteSolids::MultiUnionWrite(xercesc::DOMElement* solElement,
xercesc::DOMElement* solidElement = NewElement("solid");
solidElement->setAttributeNode(NewAttribute("ref", solidref));
xercesc::DOMElement* multiUnionNodeElement = NewElement("multiUnionNode");
multiUnionNodeElement->setAttributeNode(NewAttribute("name", nodeName));
multiUnionNodeElement->setAttributeNode(NewAttribute("name", name+"_"+nodeName));
multiUnionNodeElement->appendChild(solidElement); // Append solid to node
if((std::fabs(pos.x()) > kLinearPrecision) ||
(std::fabs(pos.y()) > kLinearPrecision) ||
(std::fabs(pos.z()) > kLinearPrecision))
{
PositionWrite(multiUnionNodeElement, name + "_pos", pos);
PositionWrite(multiUnionNodeElement,name+"_"+nodeName+"_pos",pos);
}
if((std::fabs(rot.x()) > kAngularPrecision) ||
(std::fabs(rot.y()) > kAngularPrecision) ||
(std::fabs(rot.z()) > kAngularPrecision))
{
RotationWrite(multiUnionNodeElement, name + "_rot", rot);
RotationWrite(multiUnionNodeElement,name+"_"+nodeName+"_rot",rot);
}
multiUnionElement->appendChild(multiUnionNodeElement); // Append node
}
@@ -303,14 +303,14 @@ void G4GDMLWriteStructure::AssemblyWrite(xercesc::DOMElement* volumeElement,
std::fabs(pos.y()) > kLinearPrecision ||
std::fabs(pos.z()) > kLinearPrecision)
{
PositionWrite(physvolElement, "Position_" + std::to_string(i5), pos);
PositionWrite(physvolElement,name+"_position_" + std::to_string(i5), pos);
}
if(std::fabs(rot.x()) > kAngularPrecision ||
std::fabs(rot.y()) > kAngularPrecision ||
std::fabs(rot.z()) > kAngularPrecision)
{
RotationWrite(physvolElement, "Rotation_" + std::to_string(i5), rot);
RotationWrite(physvolElement,name+"_rotation_" + std::to_string(i5), rot);
}
++vit;
}
@@ -610,7 +610,7 @@ G4Transform3D G4GDMLWriteStructure::TraverseVolumeTree(
daughterCount = 0;
}
std::vector<G4int> addedImprints;
std::map<G4int, std::vector<G4int> > assemblyIDToAddedImprints;
for(G4int i = 0; i < daughterCount; ++i) // Traverse all the children!
{
@@ -693,6 +693,7 @@ G4Transform3D G4GDMLWriteStructure::TraverseVolumeTree(
{
AssemblyWrite(structureElement, assemblyID);
addedAssemblies.push_back(assemblyID);
assemblyIDToAddedImprints[assemblyID] = std::vector<G4int>();
}
// 2) add the assembly (as physical volume) to the mother volume
@@ -701,10 +702,11 @@ G4Transform3D G4GDMLWriteStructure::TraverseVolumeTree(
// here I need a check if assembly has been already added to the
// mother volume
if(std::find(addedImprints.cbegin(), addedImprints.cend(),
imprintID) == addedImprints.cend())
std::vector<G4int>& addedImprints2 = assemblyIDToAddedImprints[assemblyID];
if(std::find(addedImprints2.cbegin(), addedImprints2.cend(),
imprintID) == addedImprints2.cend())
{
G4String imprintname = "Imprint_" + std::to_string(imprintID);
G4String imprintname = "Imprint_" + std::to_string(imprintID) + "_";
imprintname = GenerateName(imprintname, physvol);
// I need to get those two from the container of imprints from
@@ -757,7 +759,7 @@ G4Transform3D G4GDMLWriteStructure::TraverseVolumeTree(
volumeElement->appendChild(physvolElement);
//
addedImprints.push_back(imprintID);
addedImprints2.push_back(imprintID);
}
}
else // not part of assembly, so a normal physical volume
@@ -13,6 +13,15 @@ introduced in the code and keeptrack of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
24 April 2021, V.Ivanchenko (phys-ctor-em-V10-06-22)
- G4EmStandardPhysics, G4EmStandardPhysicsGS - set default verbosity 1
18 March 2021, V.Ivanchenko
- GeneralGammaProcess - reduced usage of protected variables
12 Febuary 2021, V.Ivanchenko
- G4EmBuilder - added geantinos to the minimal list of EM particles
18 January 2021, V.Ivanchenko (phys-ctor-em-V10-06-21)
- G4GammaGeneralProcess - changed 1st energy limit from 50 keV to 150 keV
to guarantee K-shell energy for any element be within 1st energy area;
@@ -52,7 +52,7 @@ class G4EmStandardPhysics : public G4VPhysicsConstructor
{
public:
explicit G4EmStandardPhysics(G4int ver=0, const G4String& name="");
explicit G4EmStandardPhysics(G4int ver=1, const G4String& name="");
~G4EmStandardPhysics() override;
@@ -52,7 +52,7 @@ class G4EmStandardPhysicsGS : public G4VPhysicsConstructor
{
public:
explicit G4EmStandardPhysicsGS(G4int ver=0, const G4String& name="");
explicit G4EmStandardPhysicsGS(G4int ver=1, const G4String& name="");
~G4EmStandardPhysicsGS() override;
@@ -47,8 +47,6 @@
#ifndef G4GammaGeneralProcess_h
#define G4GammaGeneralProcess_h 1
#include <CLHEP/Units/SystemOfUnits.h>
#include "G4VEmProcess.hh"
#include "globals.hh"
#include "G4EmDataHandler.hh"
@@ -157,8 +155,8 @@ private:
protected:
G4HadronicProcess* theGammaNuclear;
G4VProcess* selectedProc;
G4HadronicProcess* theGammaNuclear = nullptr;
G4VProcess* selectedProc = nullptr;
private:
static G4EmDataHandler* theHandler;
@@ -166,23 +164,23 @@ private:
static G4bool theT[nTables];
static G4String nameT[nTables];
G4VEmProcess* thePhotoElectric;
G4VEmProcess* theCompton;
G4VEmProcess* theConversionEE;
G4VEmProcess* theRayleigh;
G4GammaConversionToMuons* theConversionMM;
G4VEmProcess* thePhotoElectric = nullptr;
G4VEmProcess* theCompton = nullptr;
G4VEmProcess* theConversionEE = nullptr;
G4VEmProcess* theRayleigh = nullptr;
G4GammaConversionToMuons* theConversionMM = nullptr;
G4double minPEEnergy;
G4double minEEEnergy;
G4double minMMEnergy;
G4double peLambda;
G4double preStepLogE;
G4double factor;
G4double peLambda = 0.0;
G4double preStepLogE = 1.0;
G4double factor = 1.0;
size_t nLowE;
size_t nHighE;
size_t idxEnergy;
G4bool splineFlag;
size_t nLowE = 40;
size_t nHighE = 50;
size_t idxEnergy = 0;
G4bool splineFlag = false;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -216,7 +214,7 @@ G4GammaGeneralProcess::SelectedProcess(const G4Step& step, G4VProcess* ptr)
inline void G4GammaGeneralProcess::SelectEmProcess(const G4Step& step, G4VEmProcess* proc)
{
proc->CurrentSetup(currentCouple,preStepKinEnergy);
proc->CurrentSetup(currentCouple, preStepKinEnergy);
SelectedProcess(step, proc);
}
@@ -66,6 +66,9 @@
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4ChargedGeantino.hh"
#include "G4Geantino.hh"
#include "G4MuonPlus.hh"
#include "G4MuonMinus.hh"
#include "G4PionPlus.hh"
@@ -233,6 +236,9 @@ void G4EmBuilder::ConstructCharged(G4hMultipleScattering* hmsc,
void G4EmBuilder::ConstructMinimalEmSet()
{
// pseudo-particles
G4Geantino::GeantinoDefinition();
G4ChargedGeantino::ChargedGeantinoDefinition();
// gamma
G4Gamma::Gamma();
// leptons
@@ -68,6 +68,7 @@
#include "G4Material.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4GammaConversionToMuons.hh"
#include "G4Gamma.hh"
#include "G4Log.hh"
#include <iostream>
@@ -86,22 +87,10 @@ G4GammaGeneralProcess::G4GammaGeneralProcess():
G4VEmProcess("GammaGeneralProc", fElectromagnetic),
minPEEnergy(150*CLHEP::keV),
minEEEnergy(2*CLHEP::electron_mass_c2),
minMMEnergy(100*CLHEP::MeV),
peLambda(0.0),
nLowE(40),
nHighE(50),
splineFlag(false)
minMMEnergy(100*CLHEP::MeV)
{
thePhotoElectric = theCompton = theConversionEE = theRayleigh = nullptr;
theGammaNuclear = nullptr;
theConversionMM = nullptr;
selectedProc = nullptr;
idxEnergy = 0;
preStepLogE = factor = 1.0;
SetVerboseLevel(1);
SetParticle(theGamma);
SetParticle(G4Gamma::Gamma());
SetProcessSubType(fGammaGeneralProcess);
}
@@ -153,14 +142,16 @@ void G4GammaGeneralProcess::AddHadProcess(G4HadronicProcess* ptr)
void G4GammaGeneralProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
{
SetParticle(&part);
currentCouple = nullptr;
currentMaterial = nullptr;
preStepLambda = 0.0;
idxEnergy = 0;
currentCouple = nullptr;
isTheMaster = lManager->IsMaster();
if(isTheMaster) { SetVerboseLevel(theParameters->Verbose()); }
else { SetVerboseLevel(theParameters->WorkerVerbose()); }
G4EmParameters* param = G4EmParameters::Instance();
G4LossTableManager* man = G4LossTableManager::Instance();
isTheMaster = man->IsMaster();
if(isTheMaster) { SetVerboseLevel(param->Verbose()); }
else { SetVerboseLevel(param->WorkerVerbose()); }
if(1 < verboseLevel) {
G4cout << "G4GammaGeneralProcess::PreparePhysicsTable() for "
@@ -197,6 +188,9 @@ void G4GammaGeneralProcess::InitialiseProcess(const G4ParticleDefinition*)
{
if(isTheMaster) {
G4EmParameters* param = G4EmParameters::Instance();
G4LossTableManager* man = G4LossTableManager::Instance();
// tables are created and its size is defined only once
if(nullptr == theHandler) {
theHandler = new G4EmDataHandler(nTables);
@@ -207,15 +201,15 @@ void G4GammaGeneralProcess::InitialiseProcess(const G4ParticleDefinition*)
theHandler->SetMasterProcess(theConversionEE);
theHandler->SetMasterProcess(theRayleigh);
}
auto bld = lManager->GetTableBuilder();
auto bld = man->GetTableBuilder();
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
size_t numOfCouples = theCoupleTable->GetTableSize();
G4double mine = theParameters->MinKinEnergy();
G4double maxe = theParameters->MaxKinEnergy();
G4int nd = theParameters->NumberOfBinsPerDecade();
G4double mine = param->MinKinEnergy();
G4double maxe = param->MaxKinEnergy();
G4int nd = param->NumberOfBinsPerDecade();
size_t nbin1 = std::max(5, nd*G4lrint(std::log10(minPEEnergy/mine)));
size_t nbin2 = std::max(5, nd*G4lrint(std::log10(maxe/minMMEnergy)));
@@ -230,7 +224,6 @@ void G4GammaGeneralProcess::InitialiseProcess(const G4ParticleDefinition*)
cVector.SetSpline(splineFlag);
dVector.SetSpline(splineFlag);
}
for(size_t i=0; i<nTables; ++i) {
if(!theT[i]) { continue; }
//G4cout << "## PreparePhysTable " << i << "." << G4endl;
@@ -295,7 +288,7 @@ void G4GammaGeneralProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
G4ProductionCutsTable::GetProductionCutsTable();
size_t numOfCouples = theCoupleTable->GetTableSize();
G4LossTableBuilder* bld = lManager->GetTableBuilder();
G4LossTableBuilder* bld = G4LossTableManager::Instance()->GetTableBuilder();
const std::vector<G4PhysicsTable*>& tables = theHandler->GetTables();
G4CrossSectionDataStore* gn = (nullptr != theGammaNuclear)
@@ -468,7 +461,6 @@ void G4GammaGeneralProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
void G4GammaGeneralProcess::StartTracking(G4Track*)
{
theNumberOfInteractionLengthLeft = -1.0;
currentMaterial = nullptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -482,17 +474,24 @@ G4double G4GammaGeneralProcess::PostStepGetPhysicalInteractionLength(
G4double x = DBL_MAX;
G4double energy = track.GetKineticEnergy();
currentCouple = track.GetMaterialCutsCouple();
const G4Material* mat = currentCouple->GetMaterial();
const G4MaterialCutsCouple* couple = track.GetMaterialCutsCouple();
// compute mean free path
if(mat != currentMaterial || energy != preStepKinEnergy) {
currentCoupleIndex = currentCouple->GetIndex();
G4bool recompute = false;
if(couple != currentCouple) {
currentCouple = couple;
currentCoupleIndex = couple->GetIndex();
basedCoupleIndex = (*theDensityIdx)[currentCoupleIndex];
factor = (*theDensityFactor)[currentCoupleIndex];
currentMaterial = mat;
currentMaterial = couple->GetMaterial();
recompute = true;
}
if(energy != preStepKinEnergy) {
preStepKinEnergy = energy;
preStepLogE = track.GetDynamicParticle()->GetLogKineticEnergy();
recompute = true;
}
if(recompute) {
preStepLambda = TotalCrossSectionPerVolume();
// zero cross section
@@ -578,8 +577,8 @@ G4VParticleChange* G4GammaGeneralProcess::PostStepDoIt(const G4Track& track,
theNumberOfInteractionLengthLeft = -1.0;
selectedProc = nullptr;
G4double q = G4UniformRand();
/*
G4cout << "PostStep: preStepLambda= " << preStepLambda << " x= " << x
/*
G4cout << "PostStep: preStepLambda= " << preStepLambda
<< " PE= " << peLambda << " q= " << q << " idxE= " << idxEnergy
<< G4endl;
*/
@@ -648,7 +647,7 @@ void G4GammaGeneralProcess::SelectHadProcess(const G4Track& track,
{
SelectedProcess(step, proc);
proc->GetCrossSectionDataStore()->ComputeCrossSection(track.GetDynamicParticle(),
track.GetMaterial());
currentMaterial);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -13,6 +13,9 @@ introduced in the code and keeptrack of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
10-March-2021, Krzysztof Genser (phys-ctor-hinelastic-V10-06-20)
- G4HadronPhysicsShielding: corrected parameters of the M variant
05-December-2020, Vladimir Ivanchenko (phys-ctor-hinelastic-V10-06-19)
- G4HadronPhysicsFTFP_BERT, G4HadronPhysicsQGSP_BERT, G4HadronInelasticQBBC,
G4HadronPhysicsQGSP_BIC : fixed type of builder in all hadron
@@ -131,6 +131,12 @@ G4HadronPhysicsShielding::G4HadronPhysicsShielding(const G4String& name, G4int,
{
minFTFP_pion = minFTFPEnergy;
maxBERT_pion = maxBertiniEnergy;
minFTFP_kaon = minFTFPEnergy;
maxBERT_kaon = maxBertiniEnergy;
minFTFP_proton = minFTFPEnergy;
maxBERT_proton = maxBertiniEnergy;
minFTFP_neutron = minFTFPEnergy;
maxBERT_neutron = maxBertiniEnergy;
}
G4HadronPhysicsShielding::~G4HadronPhysicsShielding()
+4
View File
@@ -13,6 +13,10 @@ introduced in the code and keeptrack of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
17-February-2021 Robert Hatcher (phys-lists-V10-06-03)
- Update list of EM extension shorthands known to extensible factory to
match old factory
24-November-2020 Alberto Ribon (phys-lists-V10-06-02)
- LBE : added G4ShortLivedConstructor (to avoid crashes, e.g. when rho0
is produced by the decay of eta_prime).
@@ -81,11 +81,16 @@ G4PhysListRegistry* G4PhysListRegistry::Instance()
// the GS EM extension originally required double underscores
// support either one or two as __GS is confusing to users
// same for __SS
theInstance->AddPhysicsExtension("GS","G4EmStandardPhysicsGS");
theInstance->AddPhysicsExtension("GS" ,"G4EmStandardPhysicsGS");
theInstance->AddPhysicsExtension("_GS","G4EmStandardPhysicsGS");
theInstance->AddPhysicsExtension("SS","G4EmStandardPhysicsSS");
theInstance->AddPhysicsExtension("SS" ,"G4EmStandardPhysicsSS");
theInstance->AddPhysicsExtension("_SS","G4EmStandardPhysicsSS");
theInstance->AddPhysicsExtension("EM0","G4EmStandardPhysics");
theInstance->AddPhysicsExtension("WVI","G4EmStandardPhysicsWVI");
theInstance->AddPhysicsExtension("LE" ,"G4EmLowEPPhysics");
theInstance->AddPhysicsExtension("_LE","G4EmLowEPPhysics");
return theInstance;
}
@@ -16,6 +16,15 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
28 April 21: V.Ivanchenko (emmuons-V10-06-04)
- G4EnergyLossForExtrapolator, G4TablesForExtrapolator - added
more thread safety for initialisation of the next runs
06 April 21: V.Ivanchenko
- G4EnergyLossForExtrapolator, G4TablesForExtrapolator - allowed
several runs with extrapolator; fixed extrapolation for
hadrons
29 October 20: V.Ivanchenko (emmuons-V10-06-03)
- G4ModifiedMephi - new angular generator for muon/hadron
bremsstrahlung
@@ -72,11 +72,16 @@ public:
~G4EnergyLossForExtrapolator();
G4double ComputeDEDX(G4double kinEnergy, const G4ParticleDefinition*);
void Initialisation();
G4double ComputeRange(G4double kinEnergy, const G4ParticleDefinition*);
G4double ComputeDEDX(G4double kinEnergy, const G4ParticleDefinition*,
const G4Material*);
G4double ComputeEnergy(G4double range, const G4ParticleDefinition*);
G4double ComputeRange(G4double kinEnergy, const G4ParticleDefinition*,
const G4Material*);
G4double ComputeEnergy(G4double range, const G4ParticleDefinition*,
const G4Material*);
G4double EnergyAfterStep(G4double kinEnergy, G4double step,
const G4Material*, const G4ParticleDefinition*);
@@ -95,9 +100,9 @@ public:
const G4Material*,
const G4String& particleName);
inline G4double AverageScatteringAngle(G4double kinEnergy, G4double step,
const G4Material*,
const G4ParticleDefinition* part);
G4double AverageScatteringAngle(G4double kinEnergy, G4double step,
const G4Material*,
const G4ParticleDefinition* part);
inline G4double AverageScatteringAngle(G4double kinEnergy, G4double step,
const G4Material*,
@@ -107,9 +112,9 @@ public:
const G4ParticleDefinition* part,
G4double kinEnergy, G4double stepLength);
inline G4double EnergyDispersion(G4double kinEnergy, G4double step,
const G4Material*,
const G4ParticleDefinition*);
G4double EnergyDispersion(G4double kinEnergy, G4double step,
const G4Material*,
const G4ParticleDefinition*);
inline G4double EnergyDispersion(G4double kinEnergy, G4double step,
const G4Material*,
@@ -122,76 +127,59 @@ public:
inline void SetMaxKinEnergy(G4double);
inline void SetMaxEnergyTransfer(G4double);
// hide assignment operator
G4EnergyLossForExtrapolator & operator=
(const G4EnergyLossForExtrapolator &right) = delete;
G4EnergyLossForExtrapolator(const G4EnergyLossForExtrapolator&) = delete;
private:
void Initialisation();
void BuildTables();
G4bool SetupKinematics(const G4ParticleDefinition*, const G4Material*,
G4double kinEnergy);
const G4ParticleDefinition* FindParticle(const G4String& name);
inline G4double ComputeValue(G4double x, const G4PhysicsTable* table,
size_t idx);
size_t idxMat);
inline const G4PhysicsTable* GetPhysicsTable(ExtTableType type) const;
// hide assignment operator
G4EnergyLossForExtrapolator & operator=(const G4EnergyLossForExtrapolator &right);
G4EnergyLossForExtrapolator(const G4EnergyLossForExtrapolator&);
#ifdef G4MULTITHREADED
static G4Mutex extrapolatorMutex;
static G4Mutex extrMutex;
#endif
static G4TablesForExtrapolator* tables;
const G4ParticleDefinition* currentParticle;
const G4ParticleDefinition* electron;
const G4ParticleDefinition* positron;
const G4ParticleDefinition* muonPlus;
const G4ParticleDefinition* muonMinus;
const G4ParticleDefinition* proton;
const G4ParticleDefinition* currentParticle = nullptr;
const G4ParticleDefinition* electron = nullptr;
const G4ParticleDefinition* positron = nullptr;
const G4ParticleDefinition* muonPlus = nullptr;
const G4ParticleDefinition* muonMinus= nullptr;
const G4ParticleDefinition* proton = nullptr;
const G4Material* currentMaterial = nullptr;
G4double electronDensity = 0.0;
G4double radLength = 0.0;
G4double charge2 = 0.0;
G4double kineticEnergy = 0.0;
G4double gam = 1.0;
G4double bg2 = 0.0;
G4double beta2 = 0.0;
G4double tmax = 0.0;
G4String currentParticleName;
size_t idxDedxElectron;
size_t idxDedxPositron;
size_t idxDedxMuon;
size_t idxDedxProton;
size_t idxRangeElectron;
size_t idxRangePositron;
size_t idxRangeMuon;
size_t idxRangeProton;
size_t idxInvRangeElectron;
size_t idxInvRangePositron;
size_t idxInvRangeMuon;
size_t idxInvRangeProton;
size_t idxMscElectron;
const G4Material* currentMaterial;
G4int index;
G4double linLossLimit = 0.01;
G4double emin = 0.0;
G4double emax = 0.0;
G4double maxEnergyTransfer = 0.0;
G4double electronDensity;
G4double radLength;
G4double mass;
G4double charge2;
G4double kineticEnergy;
G4double gam;
G4double bg2;
G4double beta2;
G4double tmax;
size_t index = 0;
size_t nmat = 0;
G4int nbins = 80;
G4int verbose = 0;
G4double linLossLimit;
G4double emin;
G4double emax;
G4double maxEnergyTransfer;
G4bool isMaster = false;
G4int nbins;
G4int nmat;
G4int verbose;
G4String currentParticleName = "";
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -248,24 +236,6 @@ G4EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4EnergyLossForExtrapolator::AverageScatteringAngle(
G4double kinEnergy,
G4double stepLength,
const G4Material* mat,
const G4ParticleDefinition* part)
{
G4double theta = 0.0;
if(SetupKinematics(part, mat, kinEnergy)) {
G4double t = stepLength/radLength;
G4double y = std::max(0.001, t);
theta = 19.23*CLHEP::MeV*std::sqrt(charge2*t)*(1.0 + 0.038*G4Log(y))
/(beta2*gam*mass);
}
return theta;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4EnergyLossForExtrapolator::ComputeTrueStep(const G4Material* mat,
const G4ParticleDefinition* part,
@@ -276,33 +246,14 @@ G4EnergyLossForExtrapolator::ComputeTrueStep(const G4Material* mat,
return stepLength*std::sqrt(1.0 + 0.625*theta*theta);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy,
G4double stepLength,
const G4Material* mat,
const G4ParticleDefinition* part)
{
G4double sig2 = 0.0;
if(SetupKinematics(part, mat, kinEnergy)) {
G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength);
sig2 = (1.0/beta2 - 0.5)
*CLHEP::twopi_mc2_rcl2*tmax*step*electronDensity*charge2;
}
return sig2;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4EnergyLossForExtrapolator::ComputeValue(G4double x,
const G4PhysicsTable* table,
size_t idx)
size_t idxMat)
{
G4double res = 0.0;
if(table) { res = ((*table)[index])->Value(x, idx); }
return res;
return (nullptr != table) ? ((*table)[idxMat])->Value(x, index) : 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -83,6 +83,11 @@ public:
void Initialisation();
// hide assignment operator
G4TablesForExtrapolator & operator=
(const G4TablesForExtrapolator &right) = delete;
G4TablesForExtrapolator(const G4TablesForExtrapolator&) = delete;
private:
G4PhysicsTable* PrepareTable(G4PhysicsTable*);
@@ -99,47 +104,43 @@ private:
void ComputeTrasportXS(const G4ParticleDefinition* part,
G4PhysicsTable* table);
// hide assignment operator
G4TablesForExtrapolator & operator=(const G4TablesForExtrapolator &right);
G4TablesForExtrapolator(const G4TablesForExtrapolator&);
std::vector<const G4MaterialCutsCouple*> couples;
G4DataVector cuts;
const G4ParticleDefinition* currentParticle;
const G4ParticleDefinition* electron;
const G4ParticleDefinition* positron;
const G4ParticleDefinition* muonPlus;
const G4ParticleDefinition* muonMinus;
const G4ParticleDefinition* proton;
const G4ParticleDefinition* currentParticle = nullptr;
G4DataVector cuts;
G4LossTableBuilder* builder = nullptr;
G4ProductionCuts* pcuts = nullptr;
G4LossTableBuilder* builder;
G4ProductionCuts* pcuts;
std::vector<const G4MaterialCutsCouple*> couples;
G4PhysicsTable* dedxElectron;
G4PhysicsTable* dedxPositron;
G4PhysicsTable* dedxMuon;
G4PhysicsTable* dedxProton;
G4PhysicsTable* rangeElectron;
G4PhysicsTable* rangePositron;
G4PhysicsTable* rangeMuon;
G4PhysicsTable* rangeProton;
G4PhysicsTable* invRangeElectron;
G4PhysicsTable* invRangePositron;
G4PhysicsTable* invRangeMuon;
G4PhysicsTable* invRangeProton;
G4PhysicsTable* mscElectron;
G4int verbose;
G4int nbins;
G4int nmat;
G4PhysicsTable* dedxElectron = nullptr;
G4PhysicsTable* dedxPositron = nullptr;
G4PhysicsTable* dedxMuon = nullptr;
G4PhysicsTable* dedxProton = nullptr;
G4PhysicsTable* rangeElectron = nullptr;
G4PhysicsTable* rangePositron = nullptr;
G4PhysicsTable* rangeMuon = nullptr;
G4PhysicsTable* rangeProton = nullptr;
G4PhysicsTable* invRangeElectron = nullptr;
G4PhysicsTable* invRangePositron = nullptr;
G4PhysicsTable* invRangeMuon = nullptr;
G4PhysicsTable* invRangeProton = nullptr;
G4PhysicsTable* mscElectron = nullptr;
G4double emin;
G4double emax;
G4double mass;
G4double charge2;
G4double mass = 0.0;
G4double charge2 = 0.0;
G4bool splineFlag;
G4int verbose;
G4int nbins;
G4int nmat = 0;
G4bool splineFlag = false;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -62,7 +62,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifdef G4MULTITHREADED
G4Mutex G4EnergyLossForExtrapolator::extrapolatorMutex = G4MUTEX_INITIALIZER;
G4Mutex G4EnergyLossForExtrapolator::extrMutex = G4MUTEX_INITIALIZER;
#endif
G4TablesForExtrapolator* G4EnergyLossForExtrapolator::tables = nullptr;
@@ -70,43 +70,17 @@ G4TablesForExtrapolator* G4EnergyLossForExtrapolator::tables = nullptr;
G4EnergyLossForExtrapolator::G4EnergyLossForExtrapolator(G4int verb)
: maxEnergyTransfer(DBL_MAX), verbose(verb)
{
currentParticle = nullptr;
currentMaterial = nullptr;
linLossLimit = 0.01;
emin = 1.*MeV;
emax = 10.*TeV;
nbins = 70;
nmat = index = 0;
mass = charge2 = electronDensity = radLength = bg2 = beta2
= kineticEnergy = tmax = 0.0;
gam = 1.0;
idxDedxElectron = idxDedxPositron = idxDedxMuon = idxDedxProton
= idxRangeElectron = idxRangePositron = idxRangeMuon = idxRangeProton
= idxInvRangeElectron = idxInvRangePositron = idxInvRangeMuon
= idxInvRangeProton = idxMscElectron = 0;
electron = positron = proton = muonPlus = muonMinus = nullptr;
emin = 1.*CLHEP::MeV;
emax = 100.*CLHEP::TeV;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EnergyLossForExtrapolator::~G4EnergyLossForExtrapolator()
{
if(tables) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&extrapolatorMutex);
if (tables) {
#endif
delete tables;
tables = nullptr;
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&extrapolatorMutex);
#endif
if(isMaster) {
delete tables;
tables = nullptr;
}
}
@@ -118,18 +92,17 @@ G4EnergyLossForExtrapolator::EnergyAfterStep(G4double kinEnergy,
const G4Material* mat,
const G4ParticleDefinition* part)
{
if(0 == nmat) { Initialisation(); }
G4double kinEnergyFinal = kinEnergy;
if(SetupKinematics(part, mat, kinEnergy)) {
G4double step = TrueStepLength(kinEnergy,stepLength,mat,part);
G4double r = ComputeRange(kinEnergy,part);
G4double r = ComputeRange(kinEnergy,part,mat);
if(r <= step) {
kinEnergyFinal = 0.0;
} else if(step < linLossLimit*r) {
kinEnergyFinal -= step*ComputeDEDX(kinEnergy,part);
kinEnergyFinal -= step*ComputeDEDX(kinEnergy,part,mat);
} else {
G4double r1 = r - step;
kinEnergyFinal = ComputeEnergy(r1,part);
kinEnergyFinal = ComputeEnergy(r1,part,mat);
}
}
return kinEnergyFinal;
@@ -143,19 +116,18 @@ G4EnergyLossForExtrapolator::EnergyBeforeStep(G4double kinEnergy,
const G4Material* mat,
const G4ParticleDefinition* part)
{
//G4cout << "G4EnergyLossForExtrapolator::EnergyBeforeStep" << G4endl;
if(0 == nmat) { Initialisation(); }
// G4cout << "G4EnergyLossForExtrapolator::EnergyBeforeStep" << G4endl;
G4double kinEnergyFinal = kinEnergy;
if(SetupKinematics(part, mat, kinEnergy)) {
G4double step = TrueStepLength(kinEnergy,stepLength,mat,part);
G4double r = ComputeRange(kinEnergy,part);
G4double r = ComputeRange(kinEnergy,part,mat);
if(step < linLossLimit*r) {
kinEnergyFinal += step*ComputeDEDX(kinEnergy,part);
kinEnergyFinal += step*ComputeDEDX(kinEnergy,part,mat);
} else {
G4double r1 = r + step;
kinEnergyFinal = ComputeEnergy(r1,part);
kinEnergyFinal = ComputeEnergy(r1,part,mat);
}
}
return kinEnergyFinal;
@@ -170,17 +142,16 @@ G4EnergyLossForExtrapolator::TrueStepLength(G4double kinEnergy,
const G4ParticleDefinition* part)
{
G4double res = stepLength;
if(0 == nmat) { Initialisation(); }
//G4cout << "## G4EnergyLossForExtrapolator::TrueStepLength L= " << res
// << " " << part->GetParticleName() << G4endl;
if(SetupKinematics(part, mat, kinEnergy)) {
if(part == electron || part == positron) {
G4double x = stepLength*
ComputeValue(kinEnergy, GetPhysicsTable(fMscElectron), idxMscElectron);
const G4double x = stepLength*
ComputeValue(kinEnergy, GetPhysicsTable(fMscElectron), mat->GetIndex());
//G4cout << " x= " << x << G4endl;
if(x < 0.2) { res *= (1.0 + 0.5*x + x*x/3.0); }
else if(x < 0.9999) { res = -G4Log(1.0 - x)*stepLength/x; }
else { res = ComputeRange(kinEnergy,part); }
else { res = ComputeRange(kinEnergy, part, mat); }
} else {
res = ComputeTrueStep(mat,part,kinEnergy,stepLength);
}
@@ -195,31 +166,29 @@ G4EnergyLossForExtrapolator::SetupKinematics(const G4ParticleDefinition* part,
const G4Material* mat,
G4double kinEnergy)
{
if(0 == nmat) { Initialisation(); }
if(!part || !mat || kinEnergy < keV) { return false; }
G4bool flag = false;
if(mat->GetNumberOfMaterials() != nmat) { Initialisation(); }
if(nullptr == part || nullptr == mat || kinEnergy < CLHEP::keV)
{ return false; }
if(part != currentParticle) {
flag = true;
currentParticle = part;
mass = part->GetPDGMass();
G4double q = part->GetPDGCharge()/eplus;
charge2 = q*q;
}
if(mat != currentMaterial) {
G4int i = mat->GetIndex();
size_t i = mat->GetIndex();
if(i >= nmat) {
G4cout << "### G4EnergyLossForExtrapolator WARNING:index i= "
<< i << " is out of table - NO extrapolation" << G4endl;
G4cout << "### G4EnergyLossForExtrapolator WARNING: material index i= "
<< i << " above number of materials " << nmat << G4endl;
return false;
} else {
flag = true;
currentMaterial = mat;
electronDensity = mat->GetElectronDensity();
radLength = mat->GetRadlen();
index = i;
}
}
if(flag || kinEnergy != kineticEnergy) {
if(kinEnergy != kineticEnergy) {
kineticEnergy = kinEnergy;
G4double mass = part->GetPDGMass();
G4double tau = kinEnergy/mass;
gam = tau + 1.0;
@@ -228,10 +197,10 @@ G4EnergyLossForExtrapolator::SetupKinematics(const G4ParticleDefinition* part,
tmax = kinEnergy;
if(part == electron) tmax *= 0.5;
else if(part != positron) {
G4double r = electron_mass_c2/mass;
tmax = 2.0*bg2*electron_mass_c2/(1.0 + 2.0*gam*r + r*r);
G4double r = CLHEP::electron_mass_c2/mass;
tmax = 2.0*bg2*CLHEP::electron_mass_c2/(1.0 + 2.0*gam*r + r*r);
}
if(tmax > maxEnergyTransfer) { tmax = maxEnergyTransfer; }
tmax = std::min(tmax, maxEnergyTransfer);
}
return true;
}
@@ -241,36 +210,38 @@ G4EnergyLossForExtrapolator::SetupKinematics(const G4ParticleDefinition* part,
const G4ParticleDefinition*
G4EnergyLossForExtrapolator::FindParticle(const G4String& name)
{
const G4ParticleDefinition* p = nullptr;
if(name != currentParticleName) {
p = G4ParticleTable::GetParticleTable()->FindParticle(name);
if(!p) {
currentParticle = G4ParticleTable::GetParticleTable()->FindParticle(name);
currentParticleName = name;
if(nullptr == currentParticle) {
G4cout << "### G4EnergyLossForExtrapolator WARNING: "
<< "FindParticle() fails to find "
<< name << G4endl;
currentParticleName = "";
}
} else {
p = currentParticle;
}
return p;
return currentParticle;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double
G4EnergyLossForExtrapolator::ComputeDEDX(G4double ekin,
const G4ParticleDefinition* part)
const G4ParticleDefinition* part,
const G4Material* mat)
{
if(mat->GetNumberOfMaterials() != nmat) { Initialisation(); }
G4double x = 0.0;
if(part == electron) {
x = ComputeValue(ekin, GetPhysicsTable(fDedxElectron), idxDedxElectron);
x = ComputeValue(ekin, GetPhysicsTable(fDedxElectron), mat->GetIndex());
} else if(part == positron) {
x = ComputeValue(ekin, GetPhysicsTable(fDedxPositron), idxDedxPositron);
x = ComputeValue(ekin, GetPhysicsTable(fDedxPositron), mat->GetIndex());
} else if(part == muonPlus || part == muonMinus) {
x = ComputeValue(ekin, GetPhysicsTable(fDedxMuon), idxDedxMuon);
x = ComputeValue(ekin, GetPhysicsTable(fDedxMuon), mat->GetIndex());
} else {
G4double e = ekin*proton_mass_c2/mass;
x = ComputeValue(e, GetPhysicsTable(fDedxProton), idxDedxProton)*charge2;
G4double e = ekin*CLHEP::proton_mass_c2/part->GetPDGMass();
G4double q = part->GetPDGCharge()/CLHEP::eplus;
x = ComputeValue(e, GetPhysicsTable(fDedxProton), mat->GetIndex())*q*q;
}
return x;
}
@@ -279,20 +250,23 @@ G4EnergyLossForExtrapolator::ComputeDEDX(G4double ekin,
G4double
G4EnergyLossForExtrapolator::ComputeRange(G4double ekin,
const G4ParticleDefinition* part)
const G4ParticleDefinition* part,
const G4Material* mat)
{
if(mat->GetNumberOfMaterials() != nmat) { Initialisation(); }
G4double x = 0.0;
if(part == electron) {
x = ComputeValue(ekin, GetPhysicsTable(fRangeElectron), idxRangeElectron);
x = ComputeValue(ekin, GetPhysicsTable(fRangeElectron), mat->GetIndex());
} else if(part == positron) {
x = ComputeValue(ekin, GetPhysicsTable(fRangePositron), idxRangePositron);
x = ComputeValue(ekin, GetPhysicsTable(fRangePositron), mat->GetIndex());
} else if(part == muonPlus || part == muonMinus) {
x = ComputeValue(ekin, GetPhysicsTable(fRangeMuon), idxRangeMuon);
x = ComputeValue(ekin, GetPhysicsTable(fRangeMuon), mat->GetIndex());
} else {
G4double massratio = proton_mass_c2/mass;
G4double massratio = CLHEP::proton_mass_c2/part->GetPDGMass();
G4double e = ekin*massratio;
x = ComputeValue(e, GetPhysicsTable(fRangeProton), idxRangeProton)
/(charge2*massratio);
G4double q = part->GetPDGCharge()/CLHEP::eplus;
x = ComputeValue(e, GetPhysicsTable(fRangeProton), mat->GetIndex())
/(q*q*massratio);
}
return x;
}
@@ -301,71 +275,107 @@ G4EnergyLossForExtrapolator::ComputeRange(G4double ekin,
G4double
G4EnergyLossForExtrapolator::ComputeEnergy(G4double range,
const G4ParticleDefinition* part)
const G4ParticleDefinition* part,
const G4Material* mat)
{
if(mat->GetNumberOfMaterials() != nmat) { Initialisation(); }
G4double x = 0.0;
if(part == electron) {
x = ComputeValue(range, GetPhysicsTable(fInvRangeElectron),
idxInvRangeElectron);
x = ComputeValue(range,GetPhysicsTable(fInvRangeElectron),mat->GetIndex());
} else if(part == positron) {
x = ComputeValue(range, GetPhysicsTable(fInvRangePositron),
idxInvRangePositron);
x = ComputeValue(range,GetPhysicsTable(fInvRangePositron),mat->GetIndex());
} else if(part == muonPlus || part == muonMinus) {
x = ComputeValue(range, GetPhysicsTable(fInvRangeMuon), idxInvRangeMuon);
x = ComputeValue(range, GetPhysicsTable(fInvRangeMuon), mat->GetIndex());
} else {
G4double massratio = proton_mass_c2/mass;
G4double r = range*massratio*charge2;
x = ComputeValue(r, GetPhysicsTable(fInvRangeProton),
idxInvRangeProton)/massratio;
G4double massratio = CLHEP::proton_mass_c2/part->GetPDGMass();
G4double q = part->GetPDGCharge()/CLHEP::eplus;
G4double r = range*massratio*q*q;
x = ComputeValue(r, GetPhysicsTable(fInvRangeProton), mat->GetIndex())/massratio;
}
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double
G4EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy,
G4double stepLength,
const G4Material* mat,
const G4ParticleDefinition* part)
{
G4double sig2 = 0.0;
if(SetupKinematics(part, mat, kinEnergy)) {
G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength);
sig2 = (1.0/beta2 - 0.5)
*CLHEP::twopi_mc2_rcl2*tmax*step*electronDensity*charge2;
}
return sig2;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EnergyLossForExtrapolator::AverageScatteringAngle(
G4double kinEnergy,
G4double stepLength,
const G4Material* mat,
const G4ParticleDefinition* part)
{
G4double theta = 0.0;
if(SetupKinematics(part, mat, kinEnergy)) {
G4double t = stepLength/radLength;
G4double y = std::max(0.001, t);
theta = 19.23*CLHEP::MeV*std::sqrt(charge2*t)*(1.0 + 0.038*G4Log(y))
/(beta2*gam*part->GetPDGMass());
}
return theta;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EnergyLossForExtrapolator::Initialisation()
{
if(verbose>1) {
if(verbose>0) {
G4cout << "### G4EnergyLossForExtrapolator::Initialisation" << G4endl;
}
currentParticle = nullptr;
currentMaterial = nullptr;
kineticEnergy = 0.0;
electron = G4Electron::Electron();
positron = G4Positron::Positron();
proton = G4Proton::Proton();
muonPlus = G4MuonPlus::MuonPlus();
muonMinus= G4MuonMinus::MuonMinus();
currentParticleName = "";
BuildTables();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EnergyLossForExtrapolator::BuildTables()
{
// initialisation for the 1st run
if(nullptr == tables) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&extrapolatorMutex);
G4MUTEXLOCK(&extrMutex);
if(nullptr == tables) {
#endif
isMaster = true;
tables = new G4TablesForExtrapolator(verbose, nbins, emin, emax);
tables->Initialisation();
nmat = G4Material::GetNumberOfMaterials();
if(verbose > 0) {
G4cout << "### G4EnergyLossForExtrapolator::BuildTables for "
<< nmat << " materials Nbins= "
<< nbins << " Emin(MeV)= " << emin << " Emax(MeV)= " << emax
<< G4endl;
}
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&extrMutex);
#endif
}
// initialisation for the next run
if(isMaster && G4Material::GetNumberOfMaterials() != nmat) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&extrMutex);
#endif
if(verbose > 0) {
G4cout << "### G4EnergyLossForExtrapolator::BuildTables for "
<< G4Material::GetNumberOfMaterials() << " materials Nbins= "
<< nbins << " Emin(MeV)= " << emin << " Emax(MeV)= " << emax
<< G4endl;
}
G4int newmat = G4Material::GetNumberOfMaterials();
if(!tables) {
tables = new G4TablesForExtrapolator(verbose, nbins, emin, emax);
} else if(nmat != newmat) {
tables->Initialisation();
}
nmat = newmat;
#ifdef G4MULTITHREADED
G4MUTEXUNLOCK(&extrapolatorMutex);
G4MUTEXUNLOCK(&extrMutex);
#endif
}
nmat = G4Material::GetNumberOfMaterials();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -48,6 +48,7 @@
#include "G4TablesForExtrapolator.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4LossTableManager.hh"
#include "G4PhysicsLogVector.hh"
#include "G4ParticleDefinition.hh"
#include "G4Material.hh"
@@ -66,60 +67,78 @@
#include "G4ProductionCuts.hh"
#include "G4LossTableBuilder.hh"
#include "G4WentzelVIModel.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4TablesForExtrapolator::G4TablesForExtrapolator(G4int verb, G4int bins,
G4double e1, G4double e2)
: builder(nullptr), verbose(verb), nbins(bins), nmat(0), emin(e1), emax(e2)
: emin(e1), emax(e2), verbose(verb), nbins(bins)
{
electron = G4Electron::Electron();
positron = G4Positron::Positron();
proton = G4Proton::Proton();
muonPlus = G4MuonPlus::MuonPlus();
muonMinus= G4MuonMinus::MuonMinus();
dedxElectron = dedxPositron = dedxProton = dedxMuon = rangeElectron =
rangePositron = rangeProton = rangeMuon = invRangeElectron =
invRangePositron = invRangeProton = invRangeMuon = mscElectron = nullptr;
pcuts = nullptr;
Initialisation();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4TablesForExtrapolator::~G4TablesForExtrapolator()
{
for(G4int i=0; i<nmat; i++) { delete couples[i]; }
dedxElectron->clearAndDestroy();
dedxPositron->clearAndDestroy();
dedxProton->clearAndDestroy();
dedxMuon->clearAndDestroy();
rangeElectron->clearAndDestroy();
rangePositron->clearAndDestroy();
rangeProton->clearAndDestroy();
rangeMuon->clearAndDestroy();
invRangeElectron->clearAndDestroy();
invRangePositron->clearAndDestroy();
invRangeProton->clearAndDestroy();
invRangeMuon->clearAndDestroy();
mscElectron->clearAndDestroy();
delete dedxElectron;
delete dedxPositron;
delete dedxProton;
delete dedxMuon;
delete rangeElectron;
delete rangePositron;
delete rangeProton;
delete rangeMuon;
delete invRangeElectron;
delete invRangePositron;
delete invRangeProton;
delete invRangeMuon;
delete mscElectron;
if(nullptr != dedxElectron) {
dedxElectron->clearAndDestroy();
delete dedxElectron;
}
if(nullptr != dedxPositron) {
dedxPositron->clearAndDestroy();
delete dedxPositron;
}
if(nullptr != dedxProton) {
dedxProton->clearAndDestroy();
delete dedxProton;
}
if(nullptr != dedxMuon) {
dedxMuon->clearAndDestroy();
delete dedxMuon;
}
if(nullptr != rangeElectron) {
rangeElectron->clearAndDestroy();
delete rangeElectron;
}
if(nullptr != rangePositron) {
rangePositron->clearAndDestroy();
delete rangePositron;
}
if(nullptr != rangeProton) {
rangeProton->clearAndDestroy();
delete rangeProton;
}
if(nullptr != rangeMuon) {
rangeMuon->clearAndDestroy();
delete rangeMuon;
}
if(nullptr != invRangeElectron) {
invRangeElectron->clearAndDestroy();
delete invRangeElectron;
}
if(nullptr != invRangePositron) {
invRangePositron->clearAndDestroy();
delete invRangePositron;
}
if(nullptr != invRangeProton) {
invRangeProton->clearAndDestroy();
delete invRangeProton;
}
if(nullptr != invRangeMuon) {
invRangeMuon->clearAndDestroy();
delete invRangeMuon;
}
if(nullptr != mscElectron) {
mscElectron->clearAndDestroy();
delete mscElectron;
}
delete pcuts;
delete builder;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -179,24 +198,18 @@ void G4TablesForExtrapolator::Initialisation()
if(verbose>1) {
G4cout << "### G4TablesForExtrapolator::Initialisation" << G4endl;
}
currentParticle = nullptr;
mass = charge2 = 0.0;
G4int num = G4Material::GetNumberOfMaterials();
if(nmat == num) { return; }
nmat = G4Material::GetNumberOfMaterials();
cuts.resize(nmat, DBL_MAX);
couples.resize(nmat, nullptr);
const G4MaterialTable* mtable = G4Material::GetMaterialTable();
if(!pcuts) { pcuts = new G4ProductionCuts(); }
G4int i0 = couples.size();
if(0 == i0) {
couples.reserve(nmat);
cuts.reserve(nmat);
for(G4int i=0; i<nmat; ++i) {
couples[i] = new G4MaterialCutsCouple((*mtable)[i],pcuts);
}
for(G4int i=i0; i<nmat; ++i) {
couples.push_back(new G4MaterialCutsCouple((*mtable)[i],pcuts));
cuts.push_back(DBL_MAX);
}
splineFlag = G4EmParameters::Instance()->Spline();
dedxElectron = PrepareTable(dedxElectron);
dedxPositron = PrepareTable(dedxPositron);
@@ -212,7 +225,7 @@ void G4TablesForExtrapolator::Initialisation()
invRangeProton = PrepareTable(invRangeProton);
mscElectron = PrepareTable(mscElectron);
if(!builder) { builder = new G4LossTableBuilder(); }
builder = G4LossTableManager::Instance()->GetTableBuilder();
builder->InitialiseBaseMaterials();
if(verbose>1) {
@@ -260,15 +273,10 @@ void G4TablesForExtrapolator::Initialisation()
G4PhysicsTable* G4TablesForExtrapolator::PrepareTable(G4PhysicsTable* ptr)
{
G4PhysicsTable* table;
G4int i0 = 0;
if(ptr) {
table = ptr;
i0 = ptr->size();
} else {
table = new G4PhysicsTable();
}
for(G4int i=i0; i<nmat; ++i) {
G4PhysicsTable* table = ptr;
if(nullptr == ptr) { table = new G4PhysicsTable(); }
G4int n = table->length();
for(G4int i=n; i<nmat; ++i) {
G4PhysicsVector* v = new G4PhysicsLogVector(emin, emax, nbins);
v->SetSpline(splineFlag);
table->push_back(v);
@@ -305,14 +313,13 @@ void G4TablesForExtrapolator::ComputeElectronDEDX(
if(1<verbose) {
G4cout << "i= " << i << " mat= " << mat->GetName() << G4endl;
}
const G4MaterialCutsCouple* couple = couples[i];
G4PhysicsVector* aVector = (*table)[i];
for(G4int j=0; j<=nbins; ++j) {
G4double e = aVector->Energy(j);
G4double dedx = ioni->ComputeDEDX(couple,part,e,e)
+ brem->ComputeDEDX(couple,part,e,e);
G4double dedx = ioni->ComputeDEDXPerVolume(mat,part,e,e)
+ brem->ComputeDEDXPerVolume(mat,part,e,e);
if(1<verbose) {
G4cout << "j= " << j
<< " e(MeV)= " << e/MeV
@@ -363,14 +370,13 @@ G4TablesForExtrapolator::ComputeMuonDEDX(const G4ParticleDefinition* part,
if(1<verbose) {
G4cout << "i= " << i << " mat= " << mat->GetName() << G4endl;
}
const G4MaterialCutsCouple* couple = couples[i];
G4PhysicsVector* aVector = (*table)[i];
for(G4int j=0; j<=nbins; j++) {
for(G4int j=0; j<=nbins; ++j) {
G4double e = aVector->Energy(j);
G4double dedx = ioni->ComputeDEDX(couple,part,e,e) +
pair->ComputeDEDX(couple,part,e,e) +
brem->ComputeDEDX(couple,part,e,e);
G4double dedx = ioni->ComputeDEDXPerVolume(mat,part,e,e) +
pair->ComputeDEDXPerVolume(mat,part,e,e) +
brem->ComputeDEDXPerVolume(mat,part,e,e);
aVector->PutValue(j,dedx);
if(1<verbose) {
G4cout << "j= " << j
@@ -413,12 +419,11 @@ G4TablesForExtrapolator::ComputeProtonDEDX(const G4ParticleDefinition* part,
const G4Material* mat = (*mtable)[i];
if(1<verbose)
G4cout << "i= " << i << " mat= " << mat->GetName() << G4endl;
const G4MaterialCutsCouple* couple = couples[i];
G4PhysicsVector* aVector = (*table)[i];
for(G4int j=0; j<=nbins; j++) {
for(G4int j=0; j<=nbins; ++j) {
G4double e = aVector->Energy(j);
G4double dedx = ioni->ComputeDEDX(couple,part,e,e);
G4double dedx = ioni->ComputeDEDXPerVolume(mat,part,e,e);
aVector->PutValue(j,dedx);
if(1<verbose) {
G4cout << "j= " << j
@@ -437,7 +442,7 @@ G4TablesForExtrapolator::ComputeProtonDEDX(const G4ParticleDefinition* part,
void
G4TablesForExtrapolator::ComputeTrasportXS(const G4ParticleDefinition* part,
G4PhysicsTable* table)
G4PhysicsTable* table)
{
G4WentzelVIModel* msc = new G4WentzelVIModel();
msc->SetPolarAngleLimit(CLHEP::pi);
@@ -451,7 +456,7 @@ G4TablesForExtrapolator::ComputeTrasportXS(const G4ParticleDefinition* part,
const G4MaterialTable* mtable = G4Material::GetMaterialTable();
if(0<verbose) {
G4cout << "G4TablesForExtrapolator::ComputeProtonDEDX for "
G4cout << "G4TablesForExtrapolator::ComputeTransportXS for "
<< part->GetParticleName()
<< G4endl;
}
@@ -463,7 +468,7 @@ G4TablesForExtrapolator::ComputeTrasportXS(const G4ParticleDefinition* part,
if(1<verbose)
G4cout << "i= " << i << " mat= " << mat->GetName() << G4endl;
G4PhysicsVector* aVector = (*table)[i];
for(G4int j=0; j<=nbins; j++) {
for(G4int j=0; j<=nbins; ++j) {
G4double e = aVector->Energy(j);
G4double xs = msc->CrossSectionPerVolume(mat,part,e);
@@ -16,6 +16,12 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
06 May 21: G.Cosmo (emutils-V10-06-18)
- Fixed shadowing compilation warning in G4EmCorrections reported with gcc-11.
14 April 21: V.Ivanchenko (emutils-V10-06-17)
- G4EmParameters - fix problem #2350 (correct line break)
30 January 21: V.Ivanchenko (emutils-V10-06-16)
- G4VEnergyLossProcess, G4VEmProcess, - improved printout
G4EmExtraParameters, G4EmExtraParametersMessenger - fixed #2292
@@ -154,8 +154,8 @@ public:
G4double kineticEnergy);
// ionisation models for ions
inline void SetIonisationModels(G4VEmModel* m1 = nullptr,
G4VEmModel* m2 = nullptr);
inline void SetIonisationModels(G4VEmModel* mod1 = nullptr,
G4VEmModel* mod2 = nullptr);
inline G4int GetNumberOfStoppingVectors() const;
@@ -1392,7 +1392,7 @@ void G4EmParameters::StreamInfo(std::ostream& os) const
<< fCParameters->DNAElectronMsc() << "\n";
os << "Use DNA e- solvation model type "
<< fCParameters->DNAeSolvationSubType() << "\n";
os << "=======================================================================" << "\n";
os << "=======================================================================" << G4endl;
}
os.precision(prec);
}
@@ -16,6 +16,10 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
26 May 21: D. Sawkey (xrays-V10-06-09)
- G4Scintillation: change IsApplicable to all particles except opticalphoton
and short-lived. Address bug 2372.
5 October 20: D. Sawkey (xrays-V10-06-08)
- G4Cerenkov, G4Scintillation: apply clang-format style guidelines
@@ -123,9 +123,11 @@ G4Scintillation::~G4Scintillation()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool G4Scintillation::IsApplicable(const G4ParticleDefinition& aParticleType)
{
return (aParticleType.GetPDGCharge() == 0.0 || aParticleType.IsShortLived())
? false
: true;
if (aParticleType.GetParticleName() == "opticalphoton")
return false;
if (aParticleType.IsShortLived())
return false;
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -14,6 +14,20 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
15 April 2021 Vladimir Ivanchenko (hadr-deex-V10-06-08)
- G4DeexPrecoParameters - fixed problem #2350
07 March 2021 Vladimir Ivanchenko
- G4PolarizationTransition - J.Detwiler fixed sampling of angular
correlations (problem #2344)
18 February 2021 Alberto Ribon
- G4DeexPrecoParameters - changed half-life time threshold for isomer
production from 1 microsecond to 1 nanosecond.
The goal is to avoid unphysical missing energy cases as reported by
NA61/SHINE Collaboration. According to our CPU benchmarks, the
overhead due to this change is below the ~ 1% level.
12 August 2020 Vladimir Ivanchenko (hadr-deex-V10-06-07)
- G4NuclearLevelData - use Zmax for initialisation before the run
@@ -68,7 +68,7 @@ void G4DeexPrecoParameters::SetDefaults()
fPrecoHighEnergy = 30*CLHEP::MeV;
fPhenoFactor = 1.0;
fMinExcitation = 10*CLHEP::eV;
fMaxLifeTime = 1*CLHEP::microsecond;
fMaxLifeTime = 1*CLHEP::nanosecond;
fMinExPerNucleounForMF = 200*CLHEP::GeV;
fMinZForPreco = 3;
fMinAForPreco = 5;
@@ -330,7 +330,7 @@ std::ostream& G4DeexPrecoParameters::StreamInfo(std::ostream& os) const
<< fInternalConversionID << "\n";
os << "Correlated gamma emission flag " << fCorrelatedGamma << "\n";
os << "Max 2J for sampling of angular correlations " << fTwoJMAX << "\n";
os << "=======================================================================" << "\n";
os << "=======================================================================" << G4endl;
os.precision(prec);
return os;
}
@@ -253,24 +253,24 @@ void G4PolarizationTransition::SampleGammaTransition(
G4cout << *nucpol << G4endl;
}
const POLAR& pol = nucpol->GetPolarization();
if(fTwoJ1 == 0) {
nucpol->Unpolarize();
cosTheta = 2*G4UniformRand() - 1.0;
phi = CLHEP::twopi*G4UniformRand();
return;
}
const POLAR& pol = nucpol->GetPolarization();
cosTheta = GenerateGammaCosTheta(pol);
if(fVerbose > 2) {
G4cout << "G4PolarizationTransition::SampleGammaTransition: cosTheta= "
<< cosTheta << G4endl;
}
phi = GenerateGammaPhi(cosTheta, pol);
if(fVerbose > 2) {
G4cout << "G4PolarizationTransition::SampleGammaTransition: phi= "
<< phi << G4endl;
else {
cosTheta = GenerateGammaCosTheta(pol);
if(fVerbose > 2) {
G4cout << "G4PolarizationTransition::SampleGammaTransition: cosTheta= "
<< cosTheta << G4endl;
}
phi = GenerateGammaPhi(cosTheta, pol);
if(fVerbose > 2) {
G4cout << "G4PolarizationTransition::SampleGammaTransition: phi= "
<< phi << G4endl;
}
}
if(fTwoJ2 == 0) {
@@ -14,6 +14,14 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
23 May 2021 Dennis Wright (hadr-hpp-V10-06-14)
----------------------------------------------
- G4ParticleHPInelasticCompFS:::CompositeApply():
in two places, replace line
if (eExcitation < 20*CLHEP::keV) {eExcitation=0;}
with eExcitation = std::max(0.,QI[0] - QI[it])
in order to implement fix of bug #2333
05 January 2021 Vladimir Ivanchenko (hadr-hpp-V10-06-13)
--------------------------------------------------------
- G4ParticleHPThermalScattering - add final state phi-rotation;
@@ -404,14 +404,16 @@ void G4ParticleHPInelasticCompFS::CompositeApply(const G4HadProjectile& theTrack
//Use QI value for calculating excitation energy of residual.
G4bool useQI=false;
G4double dqi = QI[it];
if ( dqi < 0 || 849 < dqi ) useQI = true; //Former libraies does not have values of this range
if (dqi < 0 || 849 < dqi) useQI = true; // Former libraries do not have values in this range
if (useQI) {
// QI introudced since G4NDL3.15
// G4double QM=(incidReactionProduct.GetMass()+targetMass)-(aHadron.GetMass()+residualMass);
// eExcitation = QM-QI[it];
eExcitation = QI[0] - QI[it]; // Bug fix #1838
if(eExcitation < 20*CLHEP::keV) eExcitation = 0;
// eExcitation = QI[0] - QI[it]; // Bug fix #1838
// if(eExcitation < 20*CLHEP::keV) eExcitation = 0;
eExcitation = std::max(0.,QI[0] - QI[it]); // Bug fix 2333
// Re-evluate iLevel based on this eExcitation
iLevel = 0;
@@ -592,14 +594,17 @@ void G4ParticleHPInelasticCompFS::CompositeApply(const G4HadProjectile& theTrack
}
}
//G4cout << "nothingWasKnownOnHadron " << nothingWasKnownOnHadron << G4endl;
if(nothingWasKnownOnHadron)
if (nothingWasKnownOnHadron)
{
// In this case, hadron should be isotropic in CM
// Next 12 lines are Emilio's replacement
// G4double QM=(incidReactionProduct.GetMass()+targetMass)-(aHadron.GetMass()+residualMass);
// G4double eExcitation = QM-QI[it];
G4double eExcitation = QI[0] - QI[it]; // Fix of bug #1838
if(eExcitation<20*CLHEP::keV){eExcitation=0;}
// G4double eExcitation = QI[0] - QI[it]; // Fix of bug #1838
// if(eExcitation<20*CLHEP::keV){eExcitation=0;}
G4double eExcitation = std::max(0.,QI[0] - QI[it]); // Fix of bug #2333
two_body_reaction(&incidReactionProduct,&theTarget,&aHadron,eExcitation);
if(thePhotons==0 && eExcitation>0){
for(iLevel=theGammas.GetNumberOfLevels()-1; iLevel>=0; iLevel--)
@@ -14,6 +14,22 @@ track of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
15 April 2021 Vladimir Ivanchenko radioactive_decay-V10-06-11
---------------------------------------------------------------
- G4RadioactiveDecayBase - fix #2350
16 February 2021 Alberto Ribon radioactive_decay-V10-06-10
------------------------------------------------------------
- G4RadioactiveDecayBase : set the weight of secondaries tracks to the
mother's weight value in the method G4RadioactiveDecayBase::DecayAnalog.
Thanks to Michael Dressel (Desy) for spotting this.
This bug, present since a long time, affects only simulations that
use Radioactive Decay in analogue mode with "external" biasing
(e.g. generic biasing, GPS generator with weights, etc.).
For completeness (but useless because this deprecated class will be
removed in Geant4 11), the corresponding fix was done also in the
class G4RadioactiveDecay in the method DecayIt.
05 August 2020 Alberto Ribon radioactive_decay-V10-06-09
----------------------------------------------------------
- G4RadioactiveDecayBaseMessenger, G4RadioactiveDecaymessenger,
@@ -1809,7 +1809,7 @@ G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4Step&)
for (index=0; index < numberOfSecondaries; index++) {
G4Track* secondary = new G4Track(products->PopProducts(),
finalGlobalTime, currentPosition);
secondary->SetWeight(theTrack.GetWeight());
secondary->SetCreatorModelIndex(theRadDecayMode);
//Change for atomics relaxation
if (theRadDecayMode == IT && index>0){
@@ -495,7 +495,7 @@ G4RadioactiveDecayBase::StreamInfo(std::ostream& os, const G4String& endline)
os << "Use Bearden atomic level energies "
<< emparam->BeardenFluoDir() << endline;
os << "======================================================================"
<< endline;
<< G4endl;
os.precision(prec);
}
@@ -1151,6 +1151,7 @@ void G4RadioactiveDecayBase::DecayAnalog(const G4Track& theTrack)
for (G4int index = 0; index < numberOfSecondaries; index++) {
G4Track* secondary = new G4Track(products->PopProducts(), finalGlobalTime,
theTrack.GetPosition() );
secondary->SetWeight(theTrack.GetWeight());
secondary->SetCreatorModelIndex(theRadDecayMode);
//Change for atomics relaxation
if (theRadDecayMode == IT && index>0){
+4
View File
@@ -16,6 +16,10 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
- Apr. 26, 2021 Alberto Ribon (procman-V10-06-04)
- G4ProcessTable : added missing checks against null elements.
(Thanks to Ivana Hrivnacova for reporting it.)
- Jun. 4, 2020 Gabriele Cosmo (procman-V10-06-03)
- Fixed Coverity warning for uninitialised data in G4VProcess.
@@ -386,7 +386,7 @@ G4ProcessTable::Find(const G4String& processName)
{
anElement = (*itr);
// check name
if ( anElement->GetProcessName() == processName )
if ( anElement != nullptr && anElement->GetProcessName() == processName )
{
isFound = true;
tmpTblVector->push_back(anElement);
@@ -417,7 +417,7 @@ G4ProcessTable::Find(G4ProcessType processType)
{
anElement = (*itr);
// check name
if ( anElement->GetProcess()->GetProcessType() == processType )
if ( anElement != nullptr && anElement->GetProcess()->GetProcessType() == processType )
{
isFound = true;
tmpTblVector->push_back(anElement);
@@ -446,7 +446,7 @@ G4ProcessTable::ExtractProcesses(G4ProcTableVector* procTblVector) const
for (auto itr=procTblVector->cbegin(); itr!=procTblVector->cend(); ++itr)
{
G4ProcTblElement* anElement = (*itr);
procList->insert( anElement->GetProcess() );
if ( anElement != nullptr) procList->insert( anElement->GetProcess() );
}
return procList;
}
@@ -506,6 +506,7 @@ void G4ProcessTable::SetProcessActivation( const G4String& processName,
for (auto itr=pTblVector->cbegin(); itr!=pTblVector->cend(); ++itr)
{
anElement = (*itr);
if ( anElement == nullptr ) continue;
G4VProcess* process = anElement->GetProcess();
for (G4int idx = 0 ; idx < anElement->Length(); ++idx)
{
@@ -572,6 +573,7 @@ void G4ProcessTable::SetProcessActivation( G4ProcessType processType,
for (auto itr=pTblVector->cbegin(); itr!=pTblVector->cend(); ++itr)
{
anElement = (*itr);
if ( anElement == nullptr ) continue;
G4VProcess* process = anElement->GetProcess();
#ifdef G4VERBOSE
if (verboseLevel>1)
@@ -643,6 +645,7 @@ void G4ProcessTable::DumpInfo(G4VProcess* process,
itr!=fProcTblVector->cend(); ++itr, ++idxTbl)
{
anElement = (*itr);
if ( anElement == nullptr ) continue;
if (process == anElement->GetProcess() )
{
if (particle != nullptr)