Import Geant4 11.2.2 source tree

This commit is contained in:
Gabriele Cosmo
2024-06-21 15:46:33 +02:00
parent dda54bbdcf
commit f7b23877ed
411 changed files with 22817 additions and 21317 deletions
+13 -5
View File
@@ -45,8 +45,16 @@ endif()
geant4_compose_targets()
if(GEANT4_USE_VTK)
vtk_module_autoinit(
TARGETS G4visVtk
MODULES ${VTK_LIBRARIES}
)
endif()
if(TARGET G4visVtk)
vtk_module_autoinit(
TARGETS G4visVtk
MODULES ${VTK_LIBRARIES}
)
endif()
if(TARGET G4visVtk-static)
vtk_module_autoinit(
TARGETS G4visVtk-static
MODULES ${VTK_LIBRARIES}
)
endif()
endif()
+9
View File
@@ -6,6 +6,15 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-06-05 I. Hrivnacova (analysis-V11-01-11)
- Do not delete G4Accumulable<T> default constructor,
as it prevents from using it in an array without an explicit
initialization in the header.
## 2024-05-02 Gabriele Cosmo
- Fixed wrong conversion to G4String in G4THnToolsManager, leading to
compilation error on gcc compiler with C++23 Standard enabled.
## 2023-11-03 Ben Morgan (analysis-V11-01-10)
- Use "G4" prefixed version of EXPAT/ZLIB CMake variables
@@ -42,11 +42,10 @@ class G4Accumulable : public G4VAccumulable
public:
G4Accumulable(const G4String& name, T initValue,
G4MergeMode mergeMode = G4MergeMode::kAddition);
G4Accumulable(T initValue,
G4Accumulable(T initValue = 0,
G4MergeMode mergeMode = G4MergeMode::kAddition);
G4Accumulable(const G4Accumulable& rhs);
G4Accumulable(G4Accumulable&& rhs) noexcept;
G4Accumulable() = delete;
~G4Accumulable() override = default;
// Operators
@@ -297,7 +297,7 @@ template <unsigned int DIM, typename HT>
G4String G4THnToolsManager<DIM, HT>::GetTitle(G4int id) const
{
auto ht = GetTInFunction(id, "GetTitle");
if (ht == nullptr) return 0;
if (ht == nullptr) return G4String();
return ht->title();
}
@@ -308,7 +308,7 @@ template <unsigned int DIM, typename HT>
G4String G4THnToolsManager<DIM, HT>::GetAxisTitle(unsigned int idim, G4int id) const
{
auto ht = GetTInFunction(id, "GetAxisTitle");
if (ht == nullptr) return 0;
if (ht == nullptr) return G4String();
G4String title;
G4bool result = ht->annotation(fkKeyAxisTitle[idim], title);
+4
View File
@@ -6,6 +6,10 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-05-07 Gabriele Cosmo (digits_hits-V11-01-01)
- Fixed compilation error in G4THitsMap on macOS/clang with C++23 Standard
enabled.
## 2022-12-12 Ben Morgan (digits_hits-V11-01-00)
- Remove obsolete GNUmakefile scripts
@@ -33,6 +33,7 @@
#include <map>
#include <unordered_map>
#include <type_traits>
// class description:
//
+8
View File
@@ -6,6 +6,14 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-03-13 Gabriele Cosmo (g4tools-V11-01-07)
- Fixed string assignments in 'window' and 'pixwin', to support either UNICODE
or UTF-16 encoding on Windows. Addressing problem report #2599.
## 2024-02-15 Gabriele Cosmo
- Fixed compilation warnings in ccontour and gl2ps on gcc when LTO settings
are enabled.
## 2023-11-09 Guy Barrand (g4tools-V11-01-06)
- tools/wroot/file: in the constructor, for the streaming of the root directory, take into account the streaming of what would be
the fUUID (a TUUID in ROOT) field of the TDirectory version 4. This permits to fix the "G4AnalysisManager creates ROOT files
+9 -10
View File
@@ -168,8 +168,8 @@ protected:
double m_pLimits[4]; // left, right, bottom, top
int m_iColFir; // primary grid, number of columns
int m_iRowFir; // primary grid, number of rows
int m_iColSec; // secondary grid, number of columns
int m_iRowSec; // secondary grid, number of rows
unsigned int m_iColSec; // secondary grid, number of columns
unsigned int m_iRowSec; // secondary grid, number of rows
void* m_pFieldFcnData; // G.Barrand : handle a user data pointer.
double (*m_pFieldFcn)(double x, double y,void*); // pointer to F(x,y) function
@@ -252,7 +252,7 @@ inline void ccontour::InitMemory()
if (!m_ppFnData)
{
m_ppFnData=new CFnStr*[m_iColSec+1];
for (int i=0;i<m_iColSec+1;i++)
for (unsigned int i=0;i<m_iColSec+1;i++)
{
m_ppFnData[i]=NULL;
}
@@ -263,8 +263,7 @@ inline void ccontour::CleanMemory()
{
if (m_ppFnData)
{
int i;
for (i=0;i<m_iColSec+1;i++)
for (unsigned int i=0;i<m_iColSec+1;i++)
{
if (m_ppFnData[i])
delete[] (m_ppFnData[i]);
@@ -279,8 +278,8 @@ inline void ccontour::generate()
int i, j;
int x3, x4, y3, y4, x, y, oldx3, xlow;
const int cols=m_iColSec+1;
const int rows=m_iRowSec+1;
const unsigned int cols=m_iColSec+1;
const unsigned int rows=m_iRowSec+1;
//double xoff,yoff;
// Initialize memroy if needed
@@ -298,12 +297,12 @@ inline void ccontour::generate()
for (x = oldx3; x <= x4; x++)
{ /* allocate new columns needed
*/
if (x >= cols)
if (x >= (int)cols)
break;
if (m_ppFnData[x]==NULL)
m_ppFnData[x] = new CFnStr[rows];
for (y = 0; y < rows; y++)
for (y = 0; y < (int)rows; y++)
FnctData(x,y)->m_sTopLen = -1;
}
@@ -351,7 +350,7 @@ inline void ccontour::generate()
if (m_ppFnData[x]==NULL)
m_ppFnData[x] = new CFnStr[rows];
for (y = 0; y < rows; y++)
for (y = 0; y < (int)rows; y++)
FnctData(x,y)->m_sTopLen = -1;
}
}
+1 -1
View File
@@ -1638,7 +1638,7 @@ inline tools_GLint tools_gl2psSplitPrimitive(tools_GL2PSprimitive *prim, tools_G
{
tools_GLshort i, j, in = 0, out = 0, in0[5], in1[5], out0[5], out1[5];
tools_GLint type;
tools_GLfloat d[5];
tools_GLfloat d[5] = {0.0};
type = TOOLS_GL2PS_COINCIDENT;
+4 -4
View File
@@ -50,8 +50,8 @@ class pixwin {
wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
wc.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
wc.lpszMenuName = s_class().c_str();
wc.lpszClassName = s_class().c_str();
wc.lpszMenuName = (PTSTR)s_class().c_str();
wc.lpszClassName = (PTSTR)s_class().c_str();
::RegisterClass(&wc);
s_done = true;
}
@@ -73,7 +73,7 @@ public:
,m_interactor(0)
{
register_class();
m_hwnd = ::CreateWindow(s_class().c_str(),
m_hwnd = ::CreateWindow((PTSTR)s_class().c_str(),
//m_hwnd = ::CreateWindowEx(WS_EX_LAYERED,s_class().c_str(),
NULL,
WS_CHILD | WS_VISIBLE,
@@ -115,7 +115,7 @@ protected:
register_class();
RECT rect;
::GetClientRect(m_parent,&rect);
m_hwnd = ::CreateWindow(s_class().c_str(),
m_hwnd = ::CreateWindow((PTSTR)s_class().c_str(),
NULL,
WS_CHILD | WS_VISIBLE,
0,0,
+4 -4
View File
@@ -28,8 +28,8 @@ class window {
wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
wc.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
wc.lpszMenuName = s_class().c_str();
wc.lpszClassName = s_class().c_str();
wc.lpszMenuName = (PTSTR)s_class().c_str();
wc.lpszClassName = (PTSTR)s_class().c_str();
::RegisterClass(&wc);
s_done = true;
}
@@ -54,7 +54,7 @@ public:
// WARNING : given a_w,a_h may not be the client area because of various decorations.
// See set_client_area_size() method to enforce a client area size.
register_class();
m_hwnd = ::CreateWindow(s_class().c_str(),
m_hwnd = ::CreateWindow((PTSTR)s_class().c_str(),
NULL,
a_mask,
a_x,a_y,
@@ -63,7 +63,7 @@ public:
::GetModuleHandle(NULL),
NULL);
if(!m_hwnd) return;
::SetWindowText(m_hwnd,a_title);
::SetWindowText(m_hwnd,(PTSTR)a_title);
::SetWindowLongPtr(m_hwnd,GWLP_USERDATA,LONG_PTR(this));
}
virtual ~window(){
+3
View File
@@ -6,6 +6,9 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-04-24 Pere Mato (ptl-V11-01-01)
- Changed Windows.h to windows.h since for MinGW always seems to be lower case, not relevant for native builds.
## 2023-10-11 Ben Morgan (ptl-V11-01-00)
- Disable optimization of ThreadPool::execute_thread on Apple/Intel/AppleClang builds
- Workaround for Bugzilla 2564
+1 -1
View File
@@ -27,7 +27,7 @@
#include "PTL/Utility.hh"
#if defined(PTL_WINDOWS)
# include <Windows.h>
# include <windows.h>
#endif
#if defined(PTL_MACOS)
+4
View File
@@ -6,6 +6,10 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-04-17 Ben Morgan (field-V11-01-07)
- Fix maybe-uninitialized warnings found in ATLAS builds
- Reported in internal ATLASSIM-6058 ticket.
## 2023-11-03 Gabriele Cosmo (field-V11-01-06)
- Reinstated default DormandPrince745 stepper.
@@ -130,7 +130,7 @@ void G4DormandPrince745::Stepper(const G4double yInput[],
dc7 = -(- 1.0 / 40.0);
const G4int numberOfVariables = GetNumberOfVariables();
State yTemp;
State yTemp = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
// The number of variables to be integrated over
//
@@ -304,7 +304,7 @@ void G4DormandPrince745::SetupInterpolation5thOrder()
b98 = -805.0 / 4104.0;
const G4int numberOfVariables = GetNumberOfVariables();
State yTemp;
State yTemp = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
// Evaluate the extra stages
//
@@ -115,8 +115,10 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
G4FieldTrack yFldTrkStart(y_current);
#endif
G4double y[G4FieldTrack::ncompSVEC], dydx[G4FieldTrack::ncompSVEC];
G4double ystart[G4FieldTrack::ncompSVEC], yEnd[G4FieldTrack::ncompSVEC];
G4double y[G4FieldTrack::ncompSVEC] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
G4double dydx[G4FieldTrack::ncompSVEC] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
G4double ystart[G4FieldTrack::ncompSVEC] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
G4double yEnd[G4FieldTrack::ncompSVEC] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
G4double x1, x2;
G4bool succeeded = true;
+5
View File
@@ -6,6 +6,11 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-04-21 Gabriele Cosmo (geomnav-V11-01-09)
- Fixed compilation error in G4Navigator on Windows VC++ with
C++20 Standard enabled.
Based on [GitHub PR#69](https://github.com/Geant4/geant4/pull/69).
## 2023-11-17 Gabriele Cosmo (geomnav-V11-01-08)
- Fixed "/geometry/test/check_parallel" UI command in G4GeometryMessenger.
@@ -1031,7 +1031,7 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector& pGlobalpoint,
<< " (local position: " << newLocalPoint << ")" << G4endl
<< " (local direction: " << localDirection << ")." << G4endl
<< " Previous phys volume: '"
<< ( fLastMotherPhys != nullptr ? fLastMotherPhys->GetName() : "" )
<< ( fLastMotherPhys != nullptr ? fLastMotherPhys->GetName() : G4String("") )
<< "'" << G4endl << G4endl;
if( actAndReport || abandon )
{
+3
View File
@@ -6,6 +6,9 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-02-01 Gabriele Cosmo (geom-specific-V11-01-07)
- Use std::size_t for array sizes in G4PolyhedraSide and G4PolyPhiFace.
## 2023-07-10 Evgueni Tcherniaev (geom-specific-V11-01-06)
- Fixed bounding box calculation in G4VTwistedFaceted::BoundingLimits().
@@ -43,7 +43,7 @@
// Author: David C. Williams (davidw@scipp.ucsc.edu)
// --------------------------------------------------------------------
#ifndef G4POLYPHIFACE_HH
#define G4POLYPHIFACE_HH
#define G4POLYPHIFACE_HH 1
#include "G4VCSGface.hh"
#include "G4TwoVector.hh"
@@ -65,7 +65,7 @@ struct G4PolyPhiFaceVertex
struct G4PolyPhiFaceEdge
{
G4PolyPhiFaceEdge() {}
G4PolyPhiFaceEdge() = default;
G4PolyPhiFaceVertex *v0{nullptr}, *v1{nullptr}; // Corners
G4double tr{.0}, tz{0.}, // Unit vector along edge
length{0.}; // Length of edge
@@ -205,7 +205,7 @@ class G4PolyPhiFace : public G4VCSGface
protected:
G4int numEdges; // Number of edges
G4int numEdges = 0; // Number of edges
G4PolyPhiFaceEdge* edges = nullptr; // The edges of the face
G4PolyPhiFaceVertex* corners = nullptr; // And the corners
G4ThreeVector normal; // Normal unit vector
@@ -56,7 +56,7 @@ G4PolyPhiFace::G4PolyPhiFace( const G4ReduciblePolygon* rz,
kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
numEdges = rz->NumVertices();
rMin = rz->Amin();
rMax = rz->Amax();
zMin = rz->Bmin();
@@ -92,7 +92,8 @@ G4PolyPhiFace::G4PolyPhiFace( const G4ReduciblePolygon* rz,
//
// Allocate corners
//
corners = new G4PolyPhiFaceVertex[numEdges];
const std::size_t maxEdges = numEdges>0 ? numEdges : 1;
corners = new G4PolyPhiFaceVertex[maxEdges];
//
// Fill them
//
@@ -112,13 +113,13 @@ G4PolyPhiFace::G4PolyPhiFace( const G4ReduciblePolygon* rz,
// Add pointer on prev corner
//
if( corn == corners )
{ corn->prev = corners+numEdges-1;}
{ corn->prev = corners+maxEdges-1;}
else
{ corn->prev = helper; }
// Add pointer on next corner
//
if( corn < corners+numEdges-1 )
if( corn < corners+maxEdges-1 )
{ corn->next = corn+1;}
else
{ corn->next = corners; }
@@ -129,7 +130,7 @@ G4PolyPhiFace::G4PolyPhiFace( const G4ReduciblePolygon* rz,
//
// Allocate edges
//
edges = new G4PolyPhiFaceEdge[numEdges];
edges = new G4PolyPhiFaceEdge[maxEdges];
//
// Fill them
@@ -137,7 +138,7 @@ G4PolyPhiFace::G4PolyPhiFace( const G4ReduciblePolygon* rz,
G4double rFact = std::cos(0.5*deltaPhi);
G4double rFactNormalize = 1.0/std::sqrt(1.0+rFact*rFact);
G4PolyPhiFaceVertex* prev = corners+numEdges-1,
G4PolyPhiFaceVertex* prev = corners+maxEdges-1,
* here = corners;
G4PolyPhiFaceEdge* edge = edges;
do // Loop checking, 13.08.2015, G.Cosmo
@@ -176,12 +177,12 @@ G4PolyPhiFace::G4PolyPhiFace( const G4ReduciblePolygon* rz,
sideNorm += normal;
edge->norm3D = sideNorm.unit();
} while( edge++, prev=here, ++here < corners+numEdges );
} while( edge++, prev=here, ++here < corners+maxEdges );
//
// Go back and fill in corner "normals"
//
G4PolyPhiFaceEdge* prevEdge = edges+numEdges-1;
G4PolyPhiFaceEdge* prevEdge = edges+maxEdges-1;
edge = edges;
do // Loop checking, 13.08.2015, G.Cosmo
{
@@ -238,7 +239,7 @@ G4PolyPhiFace::G4PolyPhiFace( const G4ReduciblePolygon* rz,
// Combine it with the r/z direction from the face
//
edge->v0->norm3D = rNorm*xyVector.unit() + G4ThreeVector( 0, 0, zNorm );
} while( prevEdge=edge, ++edge < edges+numEdges );
} while( prevEdge=edge, ++edge < edges+maxEdges );
//
// Build point on surface
@@ -335,23 +336,25 @@ void G4PolyPhiFace::CopyStuff( const G4PolyPhiFace& source )
kCarTolerance = source.kCarTolerance;
fSurfaceArea = source.fSurfaceArea;
const std::size_t maxEdges = (numEdges > 0) ? numEdges : 1;
//
// Corner dynamic array
//
corners = new G4PolyPhiFaceVertex[numEdges];
corners = new G4PolyPhiFaceVertex[maxEdges];
G4PolyPhiFaceVertex *corn = corners,
*sourceCorn = source.corners;
do // Loop checking, 13.08.2015, G.Cosmo
{
*corn = *sourceCorn;
} while( ++sourceCorn, ++corn < corners+numEdges );
} while( ++sourceCorn, ++corn < corners+maxEdges );
//
// Edge dynamic array
//
edges = new G4PolyPhiFaceEdge[numEdges];
edges = new G4PolyPhiFaceEdge[maxEdges];
G4PolyPhiFaceVertex* prev = corners+numEdges-1,
G4PolyPhiFaceVertex* prev = corners+maxEdges-1,
* here = corners;
G4PolyPhiFaceEdge* edge = edges,
* sourceEdge = source.edges;
@@ -360,7 +363,7 @@ void G4PolyPhiFace::CopyStuff( const G4PolyPhiFace& source )
*edge = *sourceEdge;
edge->v0 = prev;
edge->v1 = here;
} while( ++sourceEdge, ++edge, prev=here, ++here < corners+numEdges );
} while( ++sourceEdge, ++edge, prev=here, ++here < corners+maxEdges );
}
// Intersect
@@ -1095,7 +1098,8 @@ void G4PolyPhiFace::Triangulate()
// The copy of Polycone is made and this copy is reordered in order to
// have a list of triangles. This list is used for GetPointOnFace().
auto tri_help = new G4PolyPhiFaceVertex[numEdges];
const std::size_t maxEdges = (numEdges > 0) ? numEdges : 1;
auto tri_help = new G4PolyPhiFaceVertex[maxEdges];
triangles = tri_help;
G4PolyPhiFaceVertex* triang = triangles;
@@ -1114,18 +1118,18 @@ void G4PolyPhiFace::Triangulate()
triang->r = helper->r;
triang->z = helper->z;
triang->x = helper->x;
triang->y= helper->y;
triang->y = helper->y;
// add pointer on prev corner
//
if( helper==corners )
{ triang->prev=triangles+numEdges-1; }
{ triang->prev=triangles+maxEdges-1; }
else
{ triang->prev=helper2; }
// add pointer on next corner
//
if( helper<corners+numEdges-1 )
if( helper<corners+maxEdges-1 )
{ triang->next=triang+1; }
else
{ triang->next=triangles; }
@@ -1229,11 +1233,11 @@ void G4PolyPhiFace::Triangulate()
if(chose>=Achose1 && chose<Achose2)
{
G4ThreeVector point;
point=points[i] ;
surface_point=point;
break;
point=points[i];
surface_point=point;
break;
}
i++; Achose1=Achose2;
++i; Achose1=Achose2;
} while( i<numEdges-2 );
delete [] tri_help;
@@ -108,13 +108,13 @@ G4PolyhedraSide::G4PolyhedraSide( const G4PolyhedraSideRZ* prevRZ,
//
// Construct side plane vector set
//
numSide = theNumSide;
deltaPhi = phiTotal/theNumSide;
numSide = theNumSide>0 ? theNumSide : 1;
deltaPhi = phiTotal/numSide;
endPhi = startPhi+phiTotal;
vecs = new G4PolyhedraSideVec[numSide];
edges = new G4PolyhedraSideEdge[phiIsOpen ? numSide+1 : numSide];
const std::size_t maxSides = numSide;
vecs = new G4PolyhedraSideVec[maxSides];
edges = new G4PolyhedraSideEdge[phiIsOpen ? maxSides+1 : maxSides];
//
// ...this is where we start
@@ -207,7 +207,7 @@ G4PolyhedraSide::G4PolyhedraSide( const G4PolyhedraSideRZ* prevRZ,
b1 = b2;
c1 = c2;
d1 = d2;
} while( ++vec < vecs+numSide );
} while( ++vec < vecs+maxSides );
//
// Clean up hanging edge
@@ -219,14 +219,14 @@ G4PolyhedraSide::G4PolyhedraSide( const G4PolyhedraSideRZ* prevRZ,
}
else
{
vecs[numSide-1].edges[1] = edges;
vecs[maxSides-1].edges[1] = edges;
}
//
// Go back and fill in remaining fields in edges
//
vec = vecs;
G4PolyhedraSideVec *prev = vecs+numSide-1;
G4PolyhedraSideVec *prev = vecs+maxSides-1;
do // Loop checking, 13.08.2015, G.Cosmo
{
edge = vec->edges[0]; // The edge between prev and vec
@@ -249,7 +249,7 @@ G4PolyhedraSide::G4PolyhedraSide( const G4PolyhedraSideRZ* prevRZ,
eNorm = vec->edgeNorm[1] + prev->edgeNorm[1];
edge->cornNorm[1] = eNorm.unit();
} while( prev=vec, ++vec < vecs + numSide );
} while( prev=vec, ++vec < vecs + maxSides );
if (phiIsOpen)
{
@@ -279,7 +279,7 @@ G4PolyhedraSide::G4PolyhedraSide( const G4PolyhedraSideRZ* prevRZ,
//
// Repeat for ending phi
//
vec = vecs + numSide - 1;
vec = vecs + maxSides - 1;
normvec = vec->edges[1]->corner[0] - vec->edges[1]->corner[1];
normvec = normvec.cross(vec->normal);
@@ -356,11 +356,11 @@ void G4PolyhedraSide::CopyStuff( const G4PolyhedraSide& source )
//
// The simple stuff
//
numSide = source.numSide;
r[0] = source.r[0];
r[1] = source.r[1];
z[0] = source.z[0];
z[1] = source.z[1];
numSide = source.numSide;
startPhi = source.startPhi;
deltaPhi = source.deltaPhi;
endPhi = source.endPhi;
@@ -380,7 +380,8 @@ void G4PolyhedraSide::CopyStuff( const G4PolyhedraSide& source )
//
// Duplicate edges
//
G4int numEdges = phiIsOpen ? numSide+1 : numSide;
const std::size_t numSides = (numSide > 0) ? numSide : 1;
const std::size_t numEdges = phiIsOpen ? numSides+1 : numSides;
edges = new G4PolyhedraSideEdge[numEdges];
G4PolyhedraSideEdge *edge = edges,
@@ -393,7 +394,7 @@ void G4PolyhedraSide::CopyStuff( const G4PolyhedraSide& source )
//
// Duplicate vecs
//
vecs = new G4PolyhedraSideVec[numSide];
vecs = new G4PolyhedraSideVec[numSides];
G4PolyhedraSideVec *vec = vecs,
*sourceVec = source.vecs;
@@ -402,7 +403,7 @@ void G4PolyhedraSide::CopyStuff( const G4PolyhedraSide& source )
*vec = *sourceVec;
vec->edges[0] = edges + (sourceVec->edges[0] - source.edges);
vec->edges[1] = edges + (sourceVec->edges[1] - source.edges);
} while( ++sourceVec, ++vec < vecs + numSide );
} while( ++sourceVec, ++vec < vecs + numSides );
}
// Intersect
+8
View File
@@ -6,6 +6,14 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-03-28 Gabriele Cosmo (geomvol-V11-01-03)
- Use 'const auto &' for iterator in G4LogicalSkinSurface::CleanSurfaceTable().
## 2024-03-08 Gabriele Cosmo
- Use std::map instead of std::vector to define G4LogicalSkinSurfaceTable,
to speedup search of skin surfaces in large tables, as already done
previously for G4LogicalBorderSurface. Addressing problem report #2598.
## 2023-10-24 Gabriele Cosmo (geomvol-V11-01-02)
- Minor cleanup and code indentation. No functional changes.
@@ -35,14 +35,15 @@
#ifndef G4LogicalSkinSurface_hh
#define G4LogicalSkinSurface_hh 1
#include <vector>
#include <map>
#include "G4LogicalSurface.hh"
class G4LogicalVolume;
class G4LogicalSkinSurface;
using G4LogicalSkinSurfaceTable = std::vector<G4LogicalSkinSurface*>;
using G4LogicalSkinSurfaceTable
= std::map<const G4LogicalVolume*, G4LogicalSkinSurface*>;
class G4LogicalSkinSurface : public G4LogicalSurface
{
@@ -51,7 +51,7 @@ G4LogicalSkinSurface::G4LogicalSkinSurface(const G4String& name,
}
// Store in the table of Surfaces
//
theSkinSurfaceTable->push_back(this);
theSkinSurfaceTable->insert(std::make_pair(logicalVolume, this));
}
// --------------------------------------------------------------------
@@ -99,10 +99,8 @@ G4LogicalSkinSurface::GetSurface(const G4LogicalVolume* vol)
{
if (theSkinSurfaceTable != nullptr)
{
for(auto pos : *theSkinSurfaceTable)
{
if (pos->GetLogicalVolume() == vol) { return pos; }
}
auto pos = theSkinSurfaceTable->find(vol);
if(pos != theSkinSurfaceTable->cend()) return pos->second;
}
return nullptr;
}
@@ -117,11 +115,12 @@ void G4LogicalSkinSurface::DumpInfo()
if (theSkinSurfaceTable != nullptr)
{
for(auto pos : *theSkinSurfaceTable)
for(const auto & pos : *theSkinSurfaceTable)
{
G4cout << pos->GetName() << " : " << G4endl
G4LogicalSkinSurface* pSurf = pos.second;
G4cout << pSurf->GetName() << " : " << G4endl
<< " Skin of logical volume "
<< pos->GetLogicalVolume()->GetName()
<< pSurf->GetLogicalVolume()->GetName()
<< G4endl;
}
}
@@ -133,9 +132,9 @@ void G4LogicalSkinSurface::CleanSurfaceTable()
{
if (theSkinSurfaceTable != nullptr)
{
for(auto pos : *theSkinSurfaceTable)
for(const auto & pos : *theSkinSurfaceTable)
{
if (pos != nullptr) { delete pos; }
delete pos.second;
}
theSkinSurfaceTable->clear();
}
+13
View File
@@ -6,6 +6,19 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-04-25 Pere Mato (global-V11-01-28)
- Changed Windows.h to windows.h since for MinGW always seems to be lower case, not relevant for native builds.
_MSC_VER is only available for VC compiler, the os one is _WIN32.
## 2024-04-20 Gabriele Cosmo
- Fixed compilation error in G4PhysicsModelCatalog on Windows VC++ with
C++20 Standard enabled.
Based on [GitHub PR#69](https://github.com/Geant4/geant4/pull/69).
## 2024-04-04 Stephan Hageboeck
- Provide a helpful error message when GEANT4_DATA_DIR is set to an invalid
location.
## 2023-12-21 Yoshihide Sato (global-V11-01-27)
- G4PhysicsModelCatalog.cc: added the ID for the Light-Ion QMD model.
@@ -43,7 +43,7 @@
/// |--> patch number (single digit)
///
#ifndef G4VERSION_NUMBER
#define G4VERSION_NUMBER 1121
#define G4VERSION_NUMBER 1122
#endif
/// @def G4VERSION_REFERENCE_TAG
@@ -59,7 +59,7 @@
#endif
#ifndef G4VERSION_TAG
#define G4VERSION_TAG "$Name: geant4-11-02-patch-01 $"
#define G4VERSION_TAG "$Name: geant4-11-02-patch-02 $"
#endif
// as variables
@@ -68,10 +68,10 @@
#include "G4Types.hh"
#ifdef G4MULTITHREADED
static const G4String G4Version = "$Name: geant4-11-02-patch-01 [MT]$";
static const G4String G4Version = "$Name: geant4-11-02-patch-02 [MT]$";
#else
static const G4String G4Version = "$Name: geant4-11-02-patch-01 $";
static const G4String G4Version = "$Name: geant4-11-02-patch-02 $";
#endif
static const G4String G4Date = "(16-February-2024)";
static const G4String G4Date = "(21-June-2024)";
#endif
@@ -29,12 +29,13 @@
#ifndef G4GMAKE
#include "G4FindDataDir.hh"
#include "G4Filesystem.hh"
#include "G4Exception.hh"
#include <cstdio>
#include <cstdlib>
#include <cstring>
#if defined(_MSC_VER)
#if defined(_WIN32)
#define setenv(name, value, overwrite) _putenv_s(name, value)
#endif
@@ -91,7 +92,7 @@ static const char* G4FindDataDir(const char* name, const path& prefix, const pat
}
const char* G4FindDataDir(const char* name)
{
{
#if defined(G4MULTITHREADED)
static std::mutex mutex;
std::lock_guard<std::mutex> lock(mutex);
@@ -104,8 +105,12 @@ const char* G4FindDataDir(const char* name)
/* If we know which directory/version to search for, try to find it */
if (const char *dataset = G4GetDataDir(name)) {
/* If GEANT4_DATA_DIR environment variable is set, use it and don't search further */
if (const char *basedir = std::getenv("GEANT4_DATA_DIR"))
return G4FindDataDir(name, basedir, dataset);
if (const char *basedir = std::getenv("GEANT4_DATA_DIR")) {
if (is_directory(basedir)) return G4FindDataDir(name, basedir, dataset);
G4Exception("G4FindDataDir", "Invalid GEANT4_DATA_DIR", JustWarning, "The GEANT4_DATA_DIR environment variable points to an invalid directory.\n"
"Will try fallback locations now. Correct the variable to disable this behaviour.");
}
/* If GEANT4_DATA_DIR environment variable is not set, search in default system paths */
for (const auto prefix : system_paths)
@@ -377,7 +377,7 @@ void G4PhysicsModelCatalog::Initialize() {
// --- Low-energy data-driven : 25'000 - 25'999 ---
// ------------------------------------------------
// - 25'000 - 25'199 : ParticleHP
// - 25'200 - 25'200 : LEND
// - 25'200 - 25'299 : LEND
// ...
// - 25'500 - 25'999 : RadioactiveDecay
@@ -585,7 +585,7 @@ void G4PhysicsModelCatalog::Initialize() {
// --- Others ... ---
// ======================================================================
// ================== 4th MODELS ADDED AFTER Geant4 11 ==================
// ================== 4th MODELS ADDED AFTER Geant4 11.0 ================
// ======================================================================
// PLEASE ADD MODELS ONLY BELOW HERE, WITH PROPER modelID .
// IF YOU ARE NOT SURE, PLEASE CONTACT ONE OF THE COORDINATORS OF THE
@@ -684,12 +684,14 @@ const G4String G4PhysicsModelCatalog::GetModelNameFromID( const G4int modelID )
// --------------------------------------------------------------------------
const G4String G4PhysicsModelCatalog::GetModelNameFromIndex( const G4int modelIndex ) {
return ( modelIndex >= 0 && modelIndex < Entries() ) ? (*theVectorOfModelNames)[ modelIndex ] : "Undefined";
return ( modelIndex >= 0 && modelIndex < Entries() )
? (*theVectorOfModelNames)[ modelIndex ] : G4String("Undefined");
}
// --------------------------------------------------------------------------
G4int G4PhysicsModelCatalog::GetModelID( const G4int modelIndex ) {
return ( modelIndex >= 0 && modelIndex < Entries() ) ? (*theVectorOfModelIDs)[ modelIndex ] : -1;
return ( modelIndex >= 0 && modelIndex < Entries() )
? (*theVectorOfModelIDs)[ modelIndex ] : -1;
}
// --------------------------------------------------------------------------
+2 -2
View File
@@ -34,8 +34,8 @@
#include "G4AutoLock.hh"
#include "globals.hh"
#if defined(WIN32) || defined(__MINGW32__)
# include <Windows.h>
#if defined(_WIN32)
# include <windows.h>
#else
# include <sys/syscall.h>
# include <sys/types.h>
+8
View File
@@ -6,6 +6,14 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-05-18 Makoto Asai (intercoms-V11-01-09)
- G4GenericMessenger.cc : Further addressing to Bug Report #2606
## 2024-04-24 Makoto Asai
- G4UIparsing.hh : checking int or long int parameter value is withing the
range of G4int or G4long
- G4GenericMessenger.cc : Addressing to Bug Report #2606
## 2023-10-16 Makoto Asai (intercoms-V11-01-08)
- Add G4UImessenger::LtoS().
- Missed when StoL() was introduced.
@@ -56,6 +56,27 @@ inline G4String TtoS(T value)
return os.str();
}
// Check if the value is within the range of (long) int
inline G4bool ChkMax(const char* str, short maxDigits)
{
if(maxDigits > 10) {
// long int assumed
auto tmpval = std::stoll(str);
if(tmpval > LONG_MAX || tmpval < LONG_MIN) {
G4cerr << "input string '" << str << "' out-of-range for conversion to 'long int' value" << G4endl;
return false;
}
} else {
// int assumed
auto tmpval = std::stol(str);
if(tmpval > INT_MAX || tmpval < INT_MIN) {
G4cerr << "input string '" << str << "' out-of-range for conversion to 'int' value" << G4endl;
return false;
}
}
return true;
}
// Return true if `str` parses to an integral number no more than `maxDigit` digits
inline G4bool IsInt(const char* str, short maxDigits)
{
@@ -74,7 +95,7 @@ inline G4bool IsInt(const char* str, short maxDigits)
G4cerr << "digit length exceeds" << G4endl;
return false;
}
return true;
return ChkMax(str,maxDigits);
}
}
return false;
+27 -1
View File
@@ -33,20 +33,26 @@
// M.Asai, SLAC - 04 May 2014
// Fix core dump when GetCurrentValue() method is invoked for
// a command defined by DeclareMethod().
// M.Asai, SLAC - 30 September 2020
// Adding new parameter type 'L' for long int.
// M.Asai, SLAC - 11 July 2021
// Adding G4ThreeVector type without unit
// M.Asai, JLab - 24 April 2024
// Fix DeclareMethod() wrongly converts valid boolean parameters.
// --------------------------------------------------------------------
#include "G4GenericMessenger.hh"
#include "G4Threading.hh"
#include "G4Types.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWith3Vector.hh"
#include "G4UIcmdWith3VectorAndUnit.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcommand.hh"
#include "G4UIdirectory.hh"
#include "G4UImessenger.hh"
#include "G4Tokenizer.hh"
#include <iostream>
@@ -228,6 +234,13 @@ void G4GenericMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
else if (typeid(*command) == typeid(G4UIcmdWith3VectorAndUnit)) {
newValue = G4UIcommand::ConvertToString(G4UIcommand::ConvertToDimensioned3Vector(newValue));
}
else if (typeid(*command) == typeid(G4UIcmdWithABool)) {
if(StoB(newValue)) {
newValue = "1";
} else {
newValue = "0";
}
}
if (properties.find(command->GetCommandName()) != properties.cend()) {
Property& p = properties[command->GetCommandName()];
@@ -239,7 +252,20 @@ void G4GenericMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
m.method.operator()(m.object);
}
else if (m.method.NArg() > 0) {
m.method.operator()(m.object, newValue);
G4Tokenizer tokens(newValue);
G4String paraValue;
for (std::size_t i = 0; i < m.method.NArg(); ++i) {
G4String aToken = tokens();
if(m.method.ArgType(i)==typeid(bool)) {
if(StoB(aToken)) {
aToken = "1";
} else {
aToken = "0";
}
}
paraValue += aToken + " ";
}
m.method.operator()(m.object, paraValue);
}
else {
throw G4InvalidUICommand();
+7
View File
@@ -6,6 +6,13 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-03-13 Gabriele Cosmo (interfaces-V11-01-32)
- Fixed string assignments in G4Win32 and G4UIWin32, to support either UNICODE
or UTF-16 encoding on Windows. Addressing problem report #2599.
## 2024-02-02 Gabriele Cosmo
- Use std::size_t as arrays size in G4InteractorMessenger and G4UIArrayString.
## 2023-11-06 John Allison (interfaces-V11-01-31)
- Requires visman-V11-01-31.
- G4UIQt::SceneTreeItemClicked:
@@ -58,8 +58,8 @@ class G4UIArrayString
G4int CalculateColumnWidth() const;
G4String* stringArray;
G4int nElement;
G4int nColumn;
std::size_t nElement;
std::size_t nColumn;
};
#endif
@@ -193,9 +193,9 @@ G4InteractorMessenger::~G4InteractorMessenger()
void G4InteractorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
auto paramn = (G4int)command->GetParameterEntries();
const auto paramn = command->GetParameterEntries();
auto params = new G4String[paramn];
if (GetValues(newValue, paramn, params)) {
if (GetValues(newValue, (G4int)paramn, params)) {
if (command == addMenu) {
session->AddMenu((const char*)params[0], (const char*)params[1]);
}
+16 -16
View File
@@ -62,7 +62,7 @@ G4UIArrayString::G4UIArrayString(const G4String& stream)
// push...
indx = 0;
for (G4int i = 0; i < nElement; ++i) {
for (std::size_t i = 0; i < nElement; ++i) {
std::size_t jc = astream.find(' ', indx);
if (jc != G4String::npos)
stringArray[i] = astream.substr(indx, jc - indx);
@@ -93,9 +93,9 @@ G4String* G4UIArrayString::GetElement(G4int icol, G4int irow) const
{
if (icol < 1 || irow < 1) // offset of column/row is "1".
G4cerr << "G4UIArrayString: overrange" << G4endl;
if (icol > nColumn) G4cerr << "G4UIArrayString: overrange" << G4endl;
if (icol > (G4int)nColumn) G4cerr << "G4UIArrayString: overrange" << G4endl;
G4int jq = (irow - 1) * nColumn + icol;
std::size_t jq = (irow - 1) * nColumn + icol;
if (jq > nElement) G4cerr << "G4UIArrayString: overrange" << G4endl;
jq--;
@@ -103,28 +103,28 @@ G4String* G4UIArrayString::GetElement(G4int icol, G4int irow) const
}
////////////////////////////////////////////
G4int G4UIArrayString::GetNRow(int icol) const
G4int G4UIArrayString::GetNRow(G4int icol) const
////////////////////////////////////////////
{
G4int ni;
if (nElement % nColumn == 0)
ni = nElement / nColumn;
ni = G4int(nElement / nColumn);
else
ni = nElement / nColumn + 1;
ni = G4int(nElement / nColumn) + 1;
G4int nn = nElement % nColumn;
if (nn == 0) nn = nColumn;
G4int nn = G4int(nElement % nColumn);
if (nn == 0) nn = (G4int)nColumn;
if (icol <= nn) return ni;
return ni - 1;
}
////////////////////////////////////////////////
G4int G4UIArrayString::GetNField(int icol) const
G4int G4UIArrayString::GetNField(G4int icol) const
////////////////////////////////////////////////
{
std::size_t maxWidth = 0;
for (G4int iy = 1; iy <= GetNRow(icol); iy++) {
for (G4int iy = 1; iy <= GetNRow(icol); ++iy) {
std::size_t ilen = GetElement(icol, iy)->length();
// care for color code
// if(GetElement(icol,iy)-> index(strESC,0) != G4String::npos) {
@@ -140,12 +140,12 @@ G4int G4UIArrayString::GetNField(int icol) const
}
/////////////////////////////////////////////////
int G4UIArrayString::CalculateColumnWidth() const
G4int G4UIArrayString::CalculateColumnWidth() const
/////////////////////////////////////////////////
{
G4int totalWidth = 0;
for (G4int ix = 1; ix <= nColumn; ix++) {
for (G4int ix = 1; ix <= (G4int)nColumn; ++ix) {
totalWidth += GetNField(ix);
}
@@ -168,12 +168,12 @@ void G4UIArrayString::Show(G4int ncol)
}
for (G4int iy = 1; iy <= GetNRow(1); iy++) {
G4int nc = nColumn;
G4int nc = (G4int)nColumn;
if (iy == GetNRow(1)) { // last row
nc = nElement % nColumn;
if (nc == 0) nc = nColumn;
nc = G4int(nElement % nColumn);
if (nc == 0) nc = (G4int)nColumn;
}
for (G4int ix = 1; ix <= nc; ix++) {
for (G4int ix = 1; ix <= nc; ++ix) {
G4String word = GetElement(ix, iy)->data();
// care for color code
@@ -98,11 +98,11 @@ G4UIWin32::G4UIWin32()
wc.hIcon = LoadIcon(nullptr, IDI_APPLICATION);
wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wc.lpszMenuName = mainClassName;
wc.lpszClassName = mainClassName;
wc.lpszMenuName = (PTSTR)mainClassName;
wc.lpszClassName = (PTSTR)mainClassName;
if (! RegisterClass(&wc)) {
MessageBox(nullptr, "G4UIWin32: Win32 window registration failed!", "Error!",
MessageBoxA(nullptr, "G4UIWin32: Win32 window registration failed!", "Error!",
MB_ICONEXCLAMATION | MB_OK);
G4cout << "G4UIWin32: Win32 window registration failed!" << G4endl;
return;
@@ -115,45 +115,46 @@ G4UIWin32::G4UIWin32()
// Add some initial options to the menu
HMENU hMenu = CreatePopupMenu();
AppendMenu(menuBar, MF_POPUP, (UINT_PTR)hMenu, "&Geant4");
AppendMenuA(menuBar, MF_POPUP, (UINT_PTR)hMenu, "&Geant4");
AddInteractor("Geant4", (G4Interactor)hMenu);
AppendMenu(hMenu, MF_STRING, ID_OPEN_MACRO, "&Open macro...");
AppendMenu(hMenu, MF_STRING, ID_SAVE_VIEWER_STATE, "&Save viewer state...");
AppendMenu(hMenu, MF_SEPARATOR, -1, "");
AppendMenu(hMenu, MF_STRING, ID_RUN_BEAMON, "&Beam On");
AppendMenu(hMenu, MF_SEPARATOR, -1, "");
AppendMenu(hMenu, MF_STRING, ID_EXIT_APP, "E&xit");
AppendMenuA(hMenu, MF_STRING, ID_OPEN_MACRO, "&Open macro...");
AppendMenuA(hMenu, MF_STRING, ID_SAVE_VIEWER_STATE, "&Save viewer state...");
AppendMenuA(hMenu, MF_SEPARATOR, -1, "");
AppendMenuA(hMenu, MF_STRING, ID_RUN_BEAMON, "&Beam On");
AppendMenuA(hMenu, MF_SEPARATOR, -1, "");
AppendMenuA(hMenu, MF_STRING, ID_EXIT_APP, "E&xit");
hMenu = CreatePopupMenu();
AppendMenu(menuBar, MF_POPUP, (UINT_PTR)hMenu, "&View");
AppendMenuA(menuBar, MF_POPUP, (UINT_PTR)hMenu, "&View");
AddInteractor("View", (G4Interactor)hMenu);
AppendMenu(hMenu, MF_STRING, ID_VIEW_SOLID, "S&olid");
AppendMenu(hMenu, MF_STRING, ID_VIEW_WIREFRAME, "&Wireframe");
AppendMenu(hMenu, MF_SEPARATOR, -1, "");
AppendMenu(hMenu, MF_STRING, ID_PROJ_ORTHOGRAPHIC, "&Orthographic");
AppendMenu(hMenu, MF_STRING, ID_PROJ_PERSPECTIVE, "P&erspective");
AppendMenu(hMenu, MF_SEPARATOR, -1, "");
AppendMenu(hMenu, MF_STRING, ID_ORIENTATION_XY, "&X-Y Plane");
AppendMenu(hMenu, MF_STRING, ID_ORIENTATION_XZ, "X-&Z Plane");
AppendMenu(hMenu, MF_STRING, ID_ORIENTATION_YZ, "&Y-Z Plane");
AppendMenu(hMenu, MF_STRING, ID_ORIENTATION_OBLIQUE, "&Oblique");
AppendMenuA(hMenu, MF_STRING, ID_VIEW_SOLID, "S&olid");
AppendMenuA(hMenu, MF_STRING, ID_VIEW_WIREFRAME, "&Wireframe");
AppendMenuA(hMenu, MF_SEPARATOR, -1, "");
AppendMenuA(hMenu, MF_STRING, ID_PROJ_ORTHOGRAPHIC, "&Orthographic");
AppendMenuA(hMenu, MF_STRING, ID_PROJ_PERSPECTIVE, "P&erspective");
AppendMenuA(hMenu, MF_SEPARATOR, -1, "");
AppendMenuA(hMenu, MF_STRING, ID_ORIENTATION_XY, "&X-Y Plane");
AppendMenuA(hMenu, MF_STRING, ID_ORIENTATION_XZ, "X-&Z Plane");
AppendMenuA(hMenu, MF_STRING, ID_ORIENTATION_YZ, "&Y-Z Plane");
AppendMenuA(hMenu, MF_STRING, ID_ORIENTATION_OBLIQUE, "&Oblique");
hMenu = CreatePopupMenu();
AppendMenu(menuBar, MF_POPUP, (UINT_PTR)hMenu, "&Zoom");
AppendMenuA(menuBar, MF_POPUP, (UINT_PTR)hMenu, "&Zoom");
AddInteractor("Zoom", (G4Interactor)hMenu);
AppendMenu(hMenu, MF_STRING, ID_ZOOM_IN, "Zoom &In");
AppendMenu(hMenu, MF_STRING, ID_ZOOM_OUT, "Zoom &Out");
AppendMenuA(hMenu, MF_STRING, ID_ZOOM_IN, "Zoom &In");
AppendMenuA(hMenu, MF_STRING, ID_ZOOM_OUT, "Zoom &Out");
tmpSession = this;
fHWndMainWindow = ::CreateWindowEx(WS_EX_CLIENTEDGE, mainClassName, "Geant4",
char winName[] = "Geant4";
fHWndMainWindow = ::CreateWindowEx(WS_EX_CLIENTEDGE, (PTSTR)mainClassName, (PTSTR)winName,
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, nullptr, menuBar, ::GetModuleHandle(nullptr), nullptr);
if (fHWndMainWindow == nullptr) {
MessageBox(nullptr, "Window Creation Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK);
MessageBoxA(nullptr, "Window Creation Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK);
return;
}
tmpSession = nullptr;
@@ -360,7 +361,7 @@ void G4UIWin32::AddMenu(const char* a_name, const char* a_label)
{
if (a_name != nullptr) {
HMENU hMenu = CreatePopupMenu();
AppendMenu(menuBar, MF_POPUP, (UINT_PTR)hMenu, a_label);
AppendMenuA(menuBar, MF_POPUP, (UINT_PTR)hMenu, a_label);
AddInteractor(a_name, (G4Interactor)hMenu);
DrawMenuBar(fHWndMainWindow);
}
@@ -376,7 +377,7 @@ void G4UIWin32::AddButton(const char* a_menu, const char* a_label, const char* a
HMENU hMenu = (HMENU)GetInteractor(a_menu);
actionIdentifier++;
commands[actionIdentifier] = a_command;
AppendMenu(hMenu, MF_STRING, actionIdentifier, a_label);
AppendMenuA(hMenu, MF_STRING, actionIdentifier, a_label);
}
}
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
@@ -398,7 +399,7 @@ LRESULT CALLBACK G4UIWin32::MainWindowProc(
auto* This = (G4UIWin32*)tmpSession;
if (This != nullptr) {
if (! This->CreateComponents(aWindow)) {
MessageBox(aWindow, "Could not create components.", "Error", MB_OK | MB_ICONERROR);
MessageBoxA(aWindow, "Could not create components.", "Error", MB_OK | MB_ICONERROR);
return false;
}
}
@@ -409,7 +410,7 @@ LRESULT CALLBACK G4UIWin32::MainWindowProc(
auto* This = (G4UIWin32*)::GetWindowLongPtr(aWindow, GWLP_USERDATA);
if (This != nullptr) {
if (! This->ResizeComponents(aWindow)) {
MessageBox(aWindow, "Could not resize components.", "Error", MB_OK | MB_ICONERROR);
MessageBoxA(aWindow, "Could not resize components.", "Error", MB_OK | MB_ICONERROR);
return false;
}
}
@@ -439,13 +440,13 @@ LRESULT CALLBACK G4UIWin32::MainWindowProc(
auto lpttt = (LPTOOLTIPTEXT)lParam;
lpttt->hinst = nullptr;
UINT idButton = lpttt->hdr.idFrom;
lpttt->lpszText = (LPSTR)This->GetToolTips(idButton).c_str();
lpttt->lpszText = (PTSTR)This->GetToolTips(idButton).c_str();
} break;
// Tooltip for TreeView
case TVN_GETINFOTIP: {
auto pTip = (LPNMTVGETINFOTIP)lParam;
pTip->pszText = (LPSTR)This->GetHelpTreeToolTips(pTip->hItem).c_str();
pTip->pszText = (PTSTR)This->GetHelpTreeToolTips(pTip->hItem).c_str();
} break;
// Double click for TreeView
@@ -568,16 +569,18 @@ G4bool G4UIWin32::CreateComponents(HWND aWindow)
G4int statwidths[] = {100, -1};
// Create Edit Control
fHWndEditor = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "",
char winName[] = "EDIT";
char winParam[] = "";
fHWndEditor = CreateWindowEx(WS_EX_CLIENTEDGE, (PTSTR)winName, (PTSTR)winParam,
WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | ES_MULTILINE | ES_AUTOVSCROLL |
ES_AUTOHSCROLL | ES_READONLY,
0, 0, 100, 100, aWindow, (HMENU)IDC_MAIN_EDIT, GetModuleHandle(nullptr), nullptr);
if (fHWndEditor == nullptr)
MessageBox(aWindow, "Could not create edit box.", "Error", MB_OK | MB_ICONERROR);
MessageBoxA(aWindow, "Could not create edit box.", "Error", MB_OK | MB_ICONERROR);
// Set editor font
// hfDefault = (HFONT) GetStockObject(DEFAULT_GUI_FONT);
hfDefault = CreateFont(-10, -8, 0, 0, 0, false, 0, 0, OEM_CHARSET, OUT_RASTER_PRECIS,
hfDefault = CreateFontA(-10, -8, 0, 0, 0, false, 0, 0, OEM_CHARSET, OUT_RASTER_PRECIS,
CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH, "System");
SendMessage(fHWndEditor, WM_SETFONT, (WPARAM)hfDefault, MAKELPARAM(false, 0));
@@ -589,7 +592,7 @@ G4bool G4UIWin32::CreateComponents(HWND aWindow)
WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS, 0, 0, 0, 0, aWindow,
(HMENU)IDC_MAIN_TOOL, GetModuleHandle(nullptr), nullptr);
if (fHWndToolBar == nullptr)
MessageBox(aWindow, "Could not create tool bar.", "Error", MB_OK | MB_ICONERROR);
MessageBoxA(aWindow, "Could not create tool bar.", "Error", MB_OK | MB_ICONERROR);
// Required for backward compatibility.
SendMessage(fHWndToolBar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), (LPARAM)0);
@@ -743,7 +746,7 @@ void G4UIWin32::ProcessTabKey()
G4String cmd = Complete(command);
const char* d = cmd.data();
G4int l = strlen(d);
Edit_SetText(fHWndComboEditor, d);
Edit_SetText(fHWndComboEditor, (PTSTR)d);
Edit_SetSel(fHWndComboEditor, l, l);
}
else {
@@ -828,7 +831,7 @@ void G4UIWin32::ProcessUpKey()
G4String command = fHistory[pos];
const char* d = command.data();
G4int l = strlen(d);
Edit_SetText(fHWndComboEditor, d);
Edit_SetText(fHWndComboEditor, (PTSTR)d);
Edit_SetSel(fHWndComboEditor, l, l);
fHistoryPos = pos;
@@ -846,13 +849,14 @@ void G4UIWin32::ProcessDownKey()
G4String command = fHistory[pos];
const char* d = command.data();
G4int l = strlen(d);
Edit_SetText(fHWndComboEditor, d);
Edit_SetText(fHWndComboEditor, (PTSTR)d);
Edit_SetSel(fHWndComboEditor, l, l);
fHistoryPos = pos;
}
else if (pos >= (G4int)fHistory.size()) {
Edit_SetText(fHWndComboEditor, "");
char eName[] = "";
Edit_SetText(fHWndComboEditor, (PTSTR)eName);
Edit_SetSel(fHWndComboEditor, 0, 0);
fHistoryPos = -1;
@@ -946,7 +950,10 @@ G4bool G4UIWin32::ProcessDefaultCommands(G4int idCommand)
case ID_HELP_ABOUT:
return true;
case ID_LOG_CLEAN:
SetDlgItemText(fHWndMainWindow, IDC_MAIN_EDIT, "");
{
char eName[] = "";
SetDlgItemText(fHWndMainWindow, IDC_MAIN_EDIT, (PTSTR)eName);
}
return true;
case ID_LOG_SAVE:
DoSaveLog(fHWndMainWindow);
@@ -1049,7 +1056,7 @@ void G4UIWin32::HelpTreeDoubleClick(HTREEITEM item)
{
const char* item_path = GetItemPath(item);
G4int l = strlen(item_path);
Edit_SetText(fHWndComboEditor, item_path);
Edit_SetText(fHWndComboEditor, (PTSTR)item_path);
Edit_SetSel(fHWndComboEditor, l, l);
SetFocus(fHWndComboEditor);
@@ -1077,7 +1084,7 @@ G4bool G4UIWin32::SaveLogFile(LPCTSTR fileName)
text = (LPSTR)GlobalAlloc(GPTR, dwBufferSize);
if (text != nullptr) {
if (GetWindowText(fHWndEditor, text, dwBufferSize)) {
if (GetWindowTextA(fHWndEditor, text, dwBufferSize)) {
DWORD dwWritten;
if (WriteFile(hFile, text, dwTextLength, &dwWritten, nullptr)) bSuccess = true;
@@ -1122,11 +1129,13 @@ void G4UIWin32::DoOpenMacro(HWND aWindow)
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = aWindow;
ofn.lpstrFilter = "Macro Files (*.mac)\0*.mac\0All Files (*.*)\0*.*\0";
ofn.lpstrFile = szFileName;
char fName[] = "Macro Files (*.mac)\0*.mac\0All Files (*.*)\0*.*\0";
ofn.lpstrFilter = (PTSTR)fName;
ofn.lpstrFile = (PTSTR)szFileName;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
ofn.lpstrDefExt = "mac";
char dName[] = "mac";
ofn.lpstrDefExt = (PTSTR)dName;
if (GetOpenFileName(&ofn)) {
G4String command = "/control/execute " + G4String(szFileName);
@@ -1150,10 +1159,12 @@ void G4UIWin32::DoSaveViewer(HWND aWindow)
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = aWindow;
ofn.lpstrFilter = "Macro Files (*.mac)\0*.mac\0All Files (*.*)\0*.*\0";
ofn.lpstrFile = szFileName;
char fName[] = "Macro Files (*.mac)\0*.mac\0All Files (*.*)\0*.*\0";
ofn.lpstrFilter = (PTSTR)fName;
ofn.lpstrFile = (PTSTR)szFileName;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrDefExt = "mac";
char dName[] = "mac";
ofn.lpstrDefExt = (PTSTR)dName;
ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
if (GetSaveFileName(&ofn)) {
@@ -1178,14 +1189,16 @@ void G4UIWin32::DoSaveLog(HWND aWindow)
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = aWindow;
ofn.lpstrFilter = "Log Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0";
ofn.lpstrFile = szFileName;
char fName[] = "Log Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0";
ofn.lpstrFilter = (PTSTR)fName;
ofn.lpstrFile = (PTSTR)szFileName;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrDefExt = "txt";
char dName[] = "txt";
ofn.lpstrDefExt = (PTSTR)dName;
ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
if (GetSaveFileName(&ofn)) {
if (SaveLogFile(szFileName)) {
if (SaveLogFile((PTSTR)szFileName)) {
SendDlgItemMessage(aWindow, IDC_MAIN_STATUS, SB_SETTEXT, 0, (LPARAM) "Saved log file...");
SendDlgItemMessage(aWindow, IDC_MAIN_STATUS, SB_SETTEXT, 1, (LPARAM)szFileName);
}
@@ -1211,7 +1224,7 @@ G4bool G4UIWin32::InitHelpTreeItems()
commandText = treeTop->GetTree(a + 1)->GetPathName().data();
// Add the item to the tree-view control.
newItem = AddItemToHelpTree(const_cast<LPTSTR>(GetShortCommandPath(commandText).c_str()));
newItem = AddItemToHelpTree((PTSTR)GetShortCommandPath(commandText).c_str());
if (newItem == nullptr) return false;
@@ -1239,7 +1252,7 @@ void G4UIWin32::CreateHelpTree(HTREEITEM aParent, G4UIcommandTree* aCommandTree)
// Add the item to the tree-view control.
newItem =
AddItemToHelpTree(const_cast<LPTSTR>(GetShortCommandPath(commandText).c_str()), aParent);
AddItemToHelpTree((PTSTR)GetShortCommandPath(commandText).c_str(), aParent);
// Look for children
CreateHelpTree(newItem, aCommandTree->GetTree(a + 1));
@@ -1250,7 +1263,7 @@ void G4UIWin32::CreateHelpTree(HTREEITEM aParent, G4UIcommandTree* aCommandTree)
commandText = aCommandTree->GetCommand(a + 1)->GetCommandPath().data();
// Add the item to the tree-view control.
AddItemToHelpTree(const_cast<LPTSTR>(GetShortCommandPath(commandText).c_str()), aParent);
AddItemToHelpTree((PTSTR)GetShortCommandPath(commandText).c_str(), aParent);
}
}
}
@@ -1319,9 +1332,9 @@ LPSTR G4UIWin32::GetItemPath(HTREEITEM item)
tvitem.cchTextMax = sizeof(infoTipBuf) / sizeof(TCHAR);
std::string str = "";
while (item != nullptr) {
while (item != nullptr) {
TreeView_GetItem(fHWndHelpTree, &tvitem);
str = "/" + std::string(tvitem.pszText) + str;
str = "/" + std::string((PSTR)tvitem.pszText) + str;
item = TreeView_GetParent(fHWndHelpTree, item);
tvitem.hItem = item;
@@ -1331,7 +1344,7 @@ LPSTR G4UIWin32::GetItemPath(HTREEITEM item)
result[str.size()] = 0;
std::copy(str.begin(), str.end(), result);
return result;
return (LPSTR)result;
}
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
/****************************************************************************************************/
@@ -28,7 +28,6 @@
// Original author: G.Barrand, 1998
// --------------------------------------------------------------------
// this :
#include "G4Win32.hh"
#include "G4ios.hh"
@@ -65,12 +64,13 @@ G4Win32::G4Win32()
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = GetStockBrush(BLACK_BRUSH);
wc.lpszMenuName = className;
wc.lpszClassName = className;
wc.lpszMenuName = (PTSTR)className;
wc.lpszClassName = (PTSTR)className;
::RegisterClass(&wc);
char winName[] = "Test";
topWindow =
::CreateWindowEx(WS_EX_CLIENTEDGE, className, "Test", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
::CreateWindowEx(WS_EX_CLIENTEDGE, (PTSTR)className, (PTSTR)winName, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, ::GetModuleHandle(NULL), NULL);
if (topWindow == NULL) {
+7
View File
@@ -6,6 +6,13 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-04-04 Vladimir Ivanchenko (materials-V11-01-15)
- G4NistMaterialBuilder in the method HepAndNuclearMaterials()
G4_BRASS, G4_BRONZE, and G4_STAILESS_STEEL are defined using
mass fractions of components instead of number of atoms
in order to have more natural description (problem #2601).
Results may be changed on level 10^-5 due to numerical differences.
## 2023-11-13 Ben Morgan (materials-V11-01-14)
- Use G4FindDataDir to access data libraries in place of raw `getenv`.
@@ -1850,21 +1850,21 @@ void G4NistMaterialBuilder::HepAndNuclearMaterials()
// SRIM-2008 materials
AddMaterial("G4_BRASS", 8.52, 0, 0.0, 3);
AddElementByAtomCount("Cu", 62);
AddElementByAtomCount("Zn", 35);
AddElementByAtomCount("Pb" , 3);
AddElementByWeightFraction( 29, 0.57515);
AddElementByWeightFraction( 30, 0.33415);
AddElementByWeightFraction( 82, 0.0907);
AddMaterial("G4_BRONZE", 8.82, 0, 0.0, 3);
AddElementByAtomCount("Cu", 89);
AddElementByAtomCount("Zn", 9);
AddElementByAtomCount("Pb" , 2);
AddElementByWeightFraction( 29, 0.8494);
AddElementByWeightFraction( 30, 0.0884);
AddElementByWeightFraction( 82, 0.0622);
// parameters are taken from
// http://www.azom.com/article.aspx?ArticleID=965
AddMaterial("G4_STAINLESS-STEEL", 8.00, 0, 0.0, 3);
AddElementByAtomCount("Fe", 74);
AddElementByAtomCount("Cr", 18);
AddElementByAtomCount("Ni" , 8);
AddElementByWeightFraction( 26, 0.7462);
AddElementByWeightFraction( 24, 0.1690);
AddElementByWeightFraction( 28, 0.0848);
AddMaterial("G4_CR39", 1.32, 0, 0.0, 3);
AddElementByAtomCount("H", 18);
+19
View File
@@ -6,6 +6,25 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-06-20 Gabriele Cosmo (gdml-V11-01-03)
- Disabled schema validation by default, as XercesC currently does
support only 'http' (see: https://issues.apache.org/jira/browse/XERCESC-2220).
- Added possibility to define G4GDML_DEFAULT_SCHEMALOCATION string as
environment variable, to point to local path for the schema.
Defined new flag G4GDML_DEFAULT_WRITE_SCHEMALOCATION for schema location
in writing.
## 2024-03-08 Gabriele Cosmo
- Use std::map instead of std::vector to iterate on logical-skin surfaces
in G4GDMLWriteStructure::GetSkinSurface().
Part of fix addressing problem report #2598.
## 2024-02-29 Gabriele Cosmo
- Fix in schema module gdml_solids.xsd for tessellated solid semantics, to
correctly reference facet types. Fixes schema validation errors which may
occur on some custom XSD validation tools. Schema updated to GDML-3.1.7.
Thanks to A.Trouche (Artenum) for providing the patch.
## 2023-06-16 I. Hrivnacova (gdml-V11-01-02)
- Let G4ThreeVectorCompare obey the strict weak ordering requirements;
which fixes failures in inserting elements in the std::map with
@@ -44,9 +44,15 @@
#include "G4Navigator.hh"
#include "G4Threading.hh"
#ifndef G4GDML_DEFAULT_SCHEMALOCATION
#define G4GDML_DEFAULT_SCHEMALOCATION \
G4String("http://service-spi.web.cern.ch/service-spi/app/releases/GDML/" \
"schema/gdml.xsd")
G4String("http://cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd")
#endif
#ifndef G4GDML_DEFAULT_WRITE_SCHEMALOCATION
#define G4GDML_DEFAULT_WRITE_SCHEMALOCATION \
G4String("http://cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd")
#endif
class G4GDMLParser
{
@@ -59,20 +65,22 @@ class G4GDMLParser
//
// Parser constructors & destructor
inline void Read(const G4String& filename, G4bool Validate = true);
inline void Read(const G4String& filename, G4bool Validate = false);
//
// Imports geometry with world-volume, specified by the GDML filename
// in input. Validation against schema is activated by default.
// Schema validation is disabled, as XercesC currently does not support https.
inline void ReadModule(const G4String& filename, G4bool Validate = true);
inline void ReadModule(const G4String& filename, G4bool Validate = false);
//
// Imports a single GDML module, specified by the GDML filename
// in input. Validation against schema is activated by default.
// Schema validation is disabled, as XercesC currently does not support https.
inline void Write( const G4String& filename,
const G4VPhysicalVolume* pvol = 0,
G4bool storeReferences = true,
const G4String& SchemaLocation = G4GDML_DEFAULT_SCHEMALOCATION);
const G4String& SchemaLocation = G4GDML_DEFAULT_WRITE_SCHEMALOCATION);
//
// Exports on a GDML file, specified by 'filename' a geometry tree
// starting from 'pvol' as top volume. Uniqueness of stored entities
@@ -82,7 +90,7 @@ class G4GDMLParser
inline void Write( const G4String& filename, const G4LogicalVolume* lvol,
G4bool storeReferences = true,
const G4String& SchemaLocation = G4GDML_DEFAULT_SCHEMALOCATION);
const G4String& SchemaLocation = G4GDML_DEFAULT_WRITE_SCHEMALOCATION);
//
// Exports on a GDML file, specified by 'filename' a geometry tree
// starting from 'pvol' as top volume. Uniqueness of stored entities
+2 -2
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://cern.ch/service-spi/app/releases/GDML/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="gdml_core.xsd"/>
<xs:include schemaLocation="gdml_define.xsd"/>
<xs:include schemaLocation="gdml_materials.xsd"/>
@@ -198,7 +198,7 @@
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute fixed="3.1.6" name="version" type="xs:string">
<xs:attribute fixed="3.1.7" name="version" type="xs:string">
<xs:annotation>
<xs:documentation>The GDML Schema version consists of 3 digits X.Y.Z
where these mean:
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xs:schema []>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://cern.ch/service-spi/app/releases/GDML/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<xs:simpleType name="InlineExpressionType">
<xs:restriction base="xs:string"></xs:restriction>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xs:schema []>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://cern.ch/service-spi/app/releases/GDML/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="gdml_core.xsd"/>
<xs:include schemaLocation="gdml_extensions.xsd"/>
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://cern.ch/service-spi/app/releases/GDML/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="loop">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xs:schema []>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="0.1" xmlns:gdml="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://cern.ch/service-spi/app/releases/GDML/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<xs:include schemaLocation="gdml_core.xsd"></xs:include>
<xs:include schemaLocation="gdml_define.xsd"></xs:include>
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://cern.ch/service-spi/app/releases/GDML/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="gdml_define.xsd"/>
<xs:include schemaLocation="gdml_extensions.xsd"/>
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://cern.ch/service-spi/app/releases/GDML/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="gdml_define.xsd"/>
<xs:include schemaLocation="gdml_extensions.xsd"/>
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xs:schema []>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://cern.ch/service-spi/app/releases/GDML/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="gdml_core.xsd"></xs:include>
<xs:include schemaLocation="gdml_define.xsd"></xs:include>
<xs:include schemaLocation="gdml_extensions.xsd"/>
@@ -981,7 +981,7 @@
<xs:complexContent>
<xs:extension base="SolidType">
<xs:sequence>
<xs:element name="Facet" minOccurs="1" maxOccurs="unbounded" type="FacetType"/>
<xs:element minOccurs="1" maxOccurs="unbounded" ref="Facet"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
@@ -431,19 +431,16 @@ G4bool G4GDMLWriteStructure::FindOpticalSurface(const G4SurfaceProperty* psurf)
const G4LogicalSkinSurface* G4GDMLWriteStructure::GetSkinSurface(
const G4LogicalVolume* const lvol)
{
G4LogicalSkinSurface* surf = 0;
G4LogicalSkinSurface* surf = nullptr;
std::size_t nsurf = G4LogicalSkinSurface::GetNumberOfSkinSurfaces();
if(nsurf)
{
const G4LogicalSkinSurfaceTable* stable =
G4LogicalSkinSurface::GetSurfaceTable();
for(auto pos = stable->cbegin(); pos != stable->cend(); ++pos)
auto pos = stable->find(lvol);
if(pos != stable->cend())
{
if(lvol == (*pos)->GetLogicalVolume())
{
surf = *pos;
break;
}
surf = pos->second;
}
}
return surf;
+7
View File
@@ -4,6 +4,13 @@ See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top). It must **not**
be used as a substitute for writing good git commit messages!
## 2024-06-05 Alberto Ribon (phys-lists-V11-01-08)
- G4PhysListFactory : added three new variants of the physics list `Shielding`,
which use the model G4LightIonQMDReaction : `ShieldingLIQMD`,
`ShieldingLIQMD_HP` and `ShieldingLIQMD_HPT`.
Note that `ShieldingLIQMD` and `ShieldingLIQMD_HP` are the same: the latter
is introduced only for consistency.
## 2023-11-09 Yoshihide Sato (phys-lists-V11-01-07)
- Add a option for `Shielding` to use G4LightIonQMDPhysics,
which is the constructor of light ion qmd.
@@ -82,16 +82,17 @@
G4PhysListFactory::G4PhysListFactory(G4int ver)
: defName("FTFP_BERT"),verbose(ver),theMessenger(nullptr)
{
nlists_hadr = 33;
G4String ss[33] = {
nlists_hadr = 36;
G4String ss[36] = {
"FTFP_BERT","FTFP_BERT_TRV","FTFP_BERT_ATL","FTFP_BERT_HP","FTFQGSP_BERT",
"FTFP_INCLXX","FTFP_INCLXX_HP","FTF_BIC", "LBE","QBBC",
"FTFP_INCLXX","FTFP_INCLXX_HP","FTF_BIC","LBE","QBBC",
"QGSP_BERT","QGSP_BERT_HP","QGSP_BIC","QGSP_BIC_HP","QGSP_BIC_AllHP",
"QGSP_FTFP_BERT","QGSP_INCLXX","QGSP_INCLXX_HP","QGS_BIC",
"Shielding","ShieldingLEND","ShieldingM","NuBeam",
"Shielding_HP","ShieldingM_HP",
"FTFP_BERT_HPT", "FTFP_INCLXX_HPT", "QGSP_BERT_HPT", "QGSP_BIC_HPT",
"QGSP_BIC_AllHPT", "QGSP_INCLXX_HPT", "Shielding_HPT", "ShieldingM_HPT" };
"Shielding","ShieldingLEND","ShieldingLIQMD","ShieldingM","NuBeam",
"Shielding_HP","ShieldingLIQMD_HP","ShieldingM_HP",
"FTFP_BERT_HPT","FTFP_INCLXX_HPT","QGSP_BERT_HPT","QGSP_BIC_HPT",
"QGSP_BIC_AllHPT","QGSP_INCLXX_HPT","Shielding_HPT","ShieldingLIQMD_HPT",
"ShieldingM_HPT"};
for(size_t i=0; i<nlists_hadr; ++i) {
listnames_hadr.push_back(ss[i]);
}
@@ -160,46 +161,50 @@ G4PhysListFactory::GetReferencePhysList(const G4String& name)
<< em_name << "> EMoption= " << em_opt << G4endl;
}
G4VModularPhysicsList* p = nullptr;
if(had_name == "FTFP_BERT") {p = new FTFP_BERT(verbose);}
else if(had_name == "FTFP_BERT_HP") {p = new FTFP_BERT_HP(verbose);}
else if(had_name == "FTFP_BERT_TRV") {p = new FTFP_BERT_TRV(verbose);}
else if(had_name == "FTFP_BERT_ATL") {p = new FTFP_BERT_ATL(verbose);}
else if(had_name == "FTFQGSP_BERT") {p = new FTFQGSP_BERT(verbose);}
else if(had_name == "FTFP_INCLXX") {p = new FTFP_INCLXX(verbose);}
else if(had_name == "FTFP_INCLXX_HP") {p = new FTFP_INCLXX_HP(verbose);}
else if(had_name == "FTF_BIC") {p = new FTF_BIC(verbose);}
else if(had_name == "LBE") {p = new LBE();}
else if(had_name == "QBBC") {p = new QBBC(verbose);}
else if(had_name == "QGSP_BERT") {p = new QGSP_BERT(verbose);}
else if(had_name == "QGSP_BERT_HP") {p = new QGSP_BERT_HP(verbose);}
else if(had_name == "QGSP_BIC") {p = new QGSP_BIC(verbose);}
else if(had_name == "QGSP_BIC_HP") {p = new QGSP_BIC_HP(verbose);}
else if(had_name == "QGSP_BIC_AllHP") {p = new QGSP_BIC_AllHP(verbose);}
else if(had_name == "QGSP_FTFP_BERT") {p = new QGSP_FTFP_BERT(verbose);}
else if(had_name == "QGSP_INCLXX") {p = new QGSP_INCLXX(verbose);}
else if(had_name == "QGSP_INCLXX_HP") {p = new QGSP_INCLXX_HP(verbose);}
else if(had_name == "QGS_BIC") {p = new QGS_BIC(verbose);}
else if(had_name == "Shielding") {p = new Shielding(verbose);}
else if(had_name == "ShieldingLEND") {p = new ShieldingLEND(verbose);}
else if(had_name == "ShieldingM") {p = new Shielding(verbose,"HP","M");}
else if(had_name == "NuBeam") {p = new NuBeam(verbose);}
else if(had_name == "Shielding_HP") {p = new Shielding(verbose);}
else if(had_name == "ShieldingM_HP") {p = new Shielding(verbose,"HP","M");}
else if(had_name == "FTFP_BERT_HPT") {p = new FTFP_BERT_HP(verbose);
p->RegisterPhysics(new G4ThermalNeutrons);}
else if(had_name == "FTFP_INCLXX_HPT"){p = new FTFP_INCLXX_HP(verbose);
p->RegisterPhysics(new G4ThermalNeutrons);}
else if(had_name == "QGSP_BERT_HPT") {p = new QGSP_BERT_HP(verbose);
p->RegisterPhysics(new G4ThermalNeutrons);}
else if(had_name == "QGSP_BIC_HPT") {p = new QGSP_BIC_HPT(verbose);}
else if(had_name == "QGSP_BIC_AllHPT"){p = new QGSP_BIC_AllHP(verbose);
p->RegisterPhysics(new G4ThermalNeutrons);}
else if(had_name == "QGSP_INCLXX_HPT"){p = new QGSP_INCLXX_HP(verbose);
p->RegisterPhysics(new G4ThermalNeutrons);}
else if(had_name == "Shielding_HPT") {p = new Shielding(verbose);
p->RegisterPhysics(new G4ThermalNeutrons);}
else if(had_name == "ShieldingM_HPT") {p = new Shielding(verbose,"HP","M");
p->RegisterPhysics(new G4ThermalNeutrons);}
if(had_name == "FTFP_BERT") {p = new FTFP_BERT(verbose);}
else if(had_name == "FTFP_BERT_HP") {p = new FTFP_BERT_HP(verbose);}
else if(had_name == "FTFP_BERT_TRV") {p = new FTFP_BERT_TRV(verbose);}
else if(had_name == "FTFP_BERT_ATL") {p = new FTFP_BERT_ATL(verbose);}
else if(had_name == "FTFQGSP_BERT") {p = new FTFQGSP_BERT(verbose);}
else if(had_name == "FTFP_INCLXX") {p = new FTFP_INCLXX(verbose);}
else if(had_name == "FTFP_INCLXX_HP") {p = new FTFP_INCLXX_HP(verbose);}
else if(had_name == "FTF_BIC") {p = new FTF_BIC(verbose);}
else if(had_name == "LBE") {p = new LBE();}
else if(had_name == "QBBC") {p = new QBBC(verbose);}
else if(had_name == "QGSP_BERT") {p = new QGSP_BERT(verbose);}
else if(had_name == "QGSP_BERT_HP") {p = new QGSP_BERT_HP(verbose);}
else if(had_name == "QGSP_BIC") {p = new QGSP_BIC(verbose);}
else if(had_name == "QGSP_BIC_HP") {p = new QGSP_BIC_HP(verbose);}
else if(had_name == "QGSP_BIC_AllHP") {p = new QGSP_BIC_AllHP(verbose);}
else if(had_name == "QGSP_FTFP_BERT") {p = new QGSP_FTFP_BERT(verbose);}
else if(had_name == "QGSP_INCLXX") {p = new QGSP_INCLXX(verbose);}
else if(had_name == "QGSP_INCLXX_HP") {p = new QGSP_INCLXX_HP(verbose);}
else if(had_name == "QGS_BIC") {p = new QGS_BIC(verbose);}
else if(had_name == "Shielding") {p = new Shielding(verbose);}
else if(had_name == "ShieldingLEND") {p = new ShieldingLEND(verbose);}
else if(had_name == "ShieldingLIQMD") {p = new Shielding(verbose,"HP","",true);}
else if(had_name == "ShieldingM") {p = new Shielding(verbose,"HP","M");}
else if(had_name == "NuBeam") {p = new NuBeam(verbose);}
else if(had_name == "Shielding_HP") {p = new Shielding(verbose);}
else if(had_name == "ShieldingLIQMD_HP") {p = new Shielding(verbose,"HP","",true);}
else if(had_name == "ShieldingM_HP") {p = new Shielding(verbose,"HP","M");}
else if(had_name == "FTFP_BERT_HPT") {p = new FTFP_BERT_HP(verbose);
p->RegisterPhysics(new G4ThermalNeutrons);}
else if(had_name == "FTFP_INCLXX_HPT") {p = new FTFP_INCLXX_HP(verbose);
p->RegisterPhysics(new G4ThermalNeutrons);}
else if(had_name == "QGSP_BERT_HPT") {p = new QGSP_BERT_HP(verbose);
p->RegisterPhysics(new G4ThermalNeutrons);}
else if(had_name == "QGSP_BIC_HPT") {p = new QGSP_BIC_HPT(verbose);}
else if(had_name == "QGSP_BIC_AllHPT") {p = new QGSP_BIC_AllHP(verbose);
p->RegisterPhysics(new G4ThermalNeutrons);}
else if(had_name == "QGSP_INCLXX_HPT") {p = new QGSP_INCLXX_HP(verbose);
p->RegisterPhysics(new G4ThermalNeutrons);}
else if(had_name == "Shielding_HPT") {p = new Shielding(verbose);
p->RegisterPhysics(new G4ThermalNeutrons);}
else if(had_name == "ShieldingLIQMD_HPT") {p = new Shielding(verbose,"HP","",true);
p->RegisterPhysics(new G4ThermalNeutrons);}
else if(had_name == "ShieldingM_HPT") {p = new Shielding(verbose,"HP","M");
p->RegisterPhysics(new G4ThermalNeutrons);}
else {
p = new FTFP_BERT(verbose);
G4ExceptionDescription ed;
@@ -6,6 +6,15 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-05-11 Gabriele Cosmo (emdna-V11-01-26)
- Fixed compilation error on macOS/clang with C++23 enabled, for the use
of std::function in G4OctreeFinder.
## 2024-04-19 Gabriele Cosmo
- Fixed compilation error on Windows VC++ with C++20 Standard enabled.
Added missing declarations for TG4MoleculeShoot specialisations on G4Track.
Based on [GitHub PR#69](https://github.com/Geant4/geant4/pull/69).
## 2023-11-14 Ben Morgan (emdna-V11-01-25)
- Use G4FindDataDir to access data libraries in place of raw `getenv`.
@@ -27,14 +27,17 @@
#ifndef G4OctreeFinder_hh
#define G4OctreeFinder_hh 1
#include "globals.hh"
#include <map>
#include "G4Octree.hh"
#include "G4Track.hh"
#include "G4ITType.hh"
#include "G4memory.hh"
#include "G4TrackList.hh"
#include <map>
#include <functional>
#undef DEBUG
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4VFinder
@@ -144,4 +147,4 @@ public:
};
#include "G4OctreeFinder.icc"
#endif
#endif
@@ -110,6 +110,15 @@ protected:
void ShootAtFixedPosition(G4MoleculeGun*){}
};
template<>
void TG4MoleculeShoot<G4Track>::ShootAtRandomPosition(G4MoleculeGun* gun);
template<>
void TG4MoleculeShoot<G4Track>::ShootAtFixedPosition(G4MoleculeGun* gun);
template<>
void TG4MoleculeShoot<G4Track>::Shoot(G4MoleculeGun* gun);
template<typename TYPE>
G4shared_ptr<G4MoleculeShoot> G4MoleculeShoot::ChangeType()
{
@@ -6,6 +6,13 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-06-06 V.Ivanchenko (emstand-V11-01-26)
- G4BetheHeitler5DModel - fixed computation of sinTheta
## 2024-05-28 V.Ivanchenko
- G4BetheHeitler5DModel - added checks on arguments of G4Exp in SampleSecondaries(..)
method to avoid FPE problems in the case of -O3 optimisation
## 2024-01-23 V.Ivanchenko (emstand-V11-01-25)
- G4IonICRU73Data - fixed bug #2586 for the case if target material has
an element with Z>92, improve debug printouts. In the Lindhard-Sorensen
@@ -388,7 +388,12 @@ G4BetheHeitler5DModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
G4LorentzVector LeptonMinus;
G4double pdf = 0.;
G4double rndmv6[6];
G4double rndmv6[6] = {0.0};
const G4double corrFac = 1.0/(correctionIndex + 1.0);
const G4double expLowLim = -20.;
const G4double logLowLim = G4Exp(expLowLim/corrFac);
G4double z0, z1, z2, x0, x1;
G4double betheheitler, sinTheta, cosTheta, dum0;
// START Sampling
do {
@@ -399,18 +404,25 @@ G4BetheHeitler5DModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
// integral y = pow(x,(c+1))/(c+1) @ x = 1 => y = 1 /(1+c)
// invCdf exp( log(y /* *( c + 1.0 )/ (c + 1.0 ) */ ) /( c + 1.0) )
//////////////////////////////////////////////////
const G4double X1 =
G4Exp(G4Log(rndmv6[0])/(correctionIndex + 1.0));
const G4double x0 = G4Exp(xl1 + (xu1 - xl1)*rndmv6[1]);
const G4double dum0 = 1./(1.+x0);
const G4double cosTheta = (x0-1.)*dum0;
const G4double sinTheta = std::sqrt(4.*x0)*dum0;
z0 = (rndmv6[0] > logLowLim) ? G4Log(rndmv6[0])*corrFac : expLowLim;
G4double X1 = (z0 > expLowLim) ? G4Exp(z0) : 0.0;
z1 = xl1 + (xu1 - xl1)*rndmv6[1];
if (z1 > expLowLim) {
x0 = G4Exp(z1);
dum0 = 1.0/(1.0 + x0);
x1 = dum0*x0;
cosTheta = -1.0 + 2.0*x1;
sinTheta = 2*std::sqrt(x1*(1.0 - x1));
} else {
x0 = 0.0;
dum0 = 1.0;
cosTheta = -1.0;
sinTheta = 0.0;
}
const G4double PairInvMass = PairInvMassMin*G4Exp(X1*X1*lnPairInvMassRange);
// G4double rndmv3[3];
// rndmEngine->flatArray(3, rndmv3);
z2 = X1*X1*lnPairInvMassRange;
const G4double PairInvMass = PairInvMassMin*((z2 > 1.e-3) ? G4Exp(z2) : 1 + z2 + 0.5*z2*z2);
// cos and sin theta-lepton
const G4double cosThetaLept = std::cos(pi*rndmv6[2]);
@@ -423,7 +435,7 @@ G4BetheHeitler5DModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
const G4double sinPhiLept = std::copysign(std::sqrt((1.-cosPhiLept)*(1.+cosPhiLept)),rndmv6[3]-0.5);
// cos and sin phi
const G4double cosPhi = std::cos(twoPi*rndmv6[4]-pi);
const G4double sinPhi = std::copysign(std::sqrt((1.-cosPhi)*(1.+cosPhi)),rndmv6[4]-0.5);
const G4double sinPhi = std::copysign(std::sqrt((1.-cosPhi)*(1.+cosPhi)),rndmv6[4]-0.5);
//////////////////////////////////////////////////
// frames:
@@ -550,7 +562,6 @@ G4BetheHeitler5DModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
}
} // else FormFactor = 1 by default
G4double betheheitler;
if (GammaPolarizationMag==0.) {
const G4double pPlusSTP = PPlus*sinThetaPlus;
const G4double pMinusSTM = PMinus*sinThetaMinus;
@@ -581,7 +592,7 @@ G4BetheHeitler5DModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
pdf = cross * (xu1 - xl1) / G4Exp(correctionIndex*G4Log(X1)); // cond1;
} while ( pdf < ymax * rndmv6[5] );
// END of Sampling
if ( fVerbose > 2 ) {
G4double recul = std::sqrt(Recoil.x()*Recoil.x()+Recoil.y()*Recoil.y()
+Recoil.z()*Recoil.z());
@@ -6,6 +6,15 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-05-22 V.Ivanchenko (emutils-V11-01-28)
- G4EmUtility - simplify computation of cross section maximum for discrete
processes to fix the problem of FPE if -O3 compiler option is used.
## 2024-04-21 Gabriele Cosmo (emutils-V11-01-27)
- Fixed compilation error in G4EmConfigurator on Windows VC++ with
C++20 Standard enabled.
Based on [GitHub PR#69](https://github.com/Geant4/geant4/pull/69).
## 2023-12-15 V.Ivanchenko (emutils-V11-01-26)
- G4VEmProcess, G4VEnergyLossProcess - minor CPU optimisation by reduction
of number of calls for Log of kinetic energy
@@ -348,7 +348,7 @@ G4EmConfigurator::PrepareModels(const G4ParticleDefinition* aParticle,
if(n > 0) {
G4String particleName = aParticle->GetParticleName();
G4String processName = (nullptr == p) ? "msc" : p->GetProcessName();
G4String processName = (nullptr == p) ? G4String("msc") : p->GetProcessName();
for(size_t i=0; i<n; ++i) {
if(processName == processes[i]) {
if((particleName == particles[i]) ||
@@ -150,14 +150,16 @@ G4EmUtility::FindCrossSectionMax(G4VDiscreteProcess* p,
const G4ParticleDefinition* part)
{
std::vector<G4double>* ptr = nullptr;
if(nullptr == p || nullptr == part) { return ptr; }
/*
G4cout << "G4EmUtility::FindCrossSectionMax for "
<< p->GetProcessName() << " and " << part->GetParticleName() << G4endl;
*/
if (nullptr == p || nullptr == part) { return ptr; }
G4EmParameters* theParameters = G4EmParameters::Instance();
G4double tmin = theParameters->MinKinEnergy();
G4double tmax = theParameters->MaxKinEnergy();
const G4double tmin = theParameters->MinKinEnergy();
const G4double tmax = theParameters->MaxKinEnergy();
const G4double ee = G4Log(tmax/tmin);
const G4double scale = theParameters->NumberOfBinsPerDecade()/g4log10;
G4int nbin = static_cast<G4int>(ee*scale);
nbin = std::max(nbin, 4);
G4double x = G4Exp(ee/(G4double)nbin);
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
@@ -166,39 +168,28 @@ G4EmUtility::FindCrossSectionMax(G4VDiscreteProcess* p,
ptr->resize(n, DBL_MAX);
G4bool isPeak = false;
G4double scale = theParameters->NumberOfBinsPerDecade()/g4log10;
G4double e, sig, ee, x, sm, em, emin, emax;
// first loop on existing vectors
for (std::size_t i=0; i<n; ++i) {
auto couple = theCoupleTable->GetMaterialCutsCouple((G4int)i);
emin = std::max(p->MinPrimaryEnergy(part, couple->GetMaterial()), tmin);
emax = std::max(tmax, 2*emin);
ee = G4Log(emax/emin);
G4int nbin = G4lrint(ee*scale);
if(nbin < 4) { nbin = 4; }
x = G4Exp(ee/nbin);
sm = 0.0;
em = 0.0;
e = emin;
for(G4int j=0; j<=nbin; ++j) {
sig = p->GetCrossSection(e, couple);
if(sig >= sm) {
const G4int nn = static_cast<G4int>(n);
for (G4int i=0; i<nn; ++i) {
G4double sm = 0.0;
G4double em = 0.0;
G4double e = tmin;
for (G4int j=0; j<=nbin; ++j) {
G4double sig = p->GetCrossSection(e, theCoupleTable->GetMaterialCutsCouple(i));
if (sig >= sm) {
em = e;
sm = sig;
e = (j+1 < nbin) ? e*x : emax;
e = (j+1 < nbin) ? e*x : tmax;
} else {
isPeak = true;
(*ptr)[i] = em;
break;
}
}
//G4cout << i << ". em=" << em << " sm=" << sm << G4endl;
}
// there is no peak for any couple
if(!isPeak) {
if (!isPeak) {
delete ptr;
ptr = nullptr;
}
@@ -6,6 +6,11 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-05-22 Gunter Folger (had-binary-V11-01-01)
- Address problem reported by Atlas of throwing execption if momentum cannot
be corrected. Problem ocurrs for D + H around 1600 MeV
- The exception is removed,in this rare case the initial state is kept
unchanged instead.
## 2023-04-28 Vladimir Ivantchenko (had-binary-V11-01-00)
- G4BinaryCascade, G4BinaryLightIonReaction - do not call getenv, use
@@ -121,146 +121,135 @@ ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus & targetNucleus )
{
// G4cout << "Using pre-compound only, E= "<<mom.t()-mom.mag()<<G4endl;
// m_nucl = mom.mag();
cascaders=FuseNucleiAndPrompound(mom);
if( !cascaders )
{
cascaders=FuseNucleiAndPrompound(mom);
if( !cascaders )
{
// abort!! happens for too low energy for nuclei to fuse
// abort!! happens for too low energy for nuclei to fuse
theResult.Clear();
theResult.SetStatusChange(isAlive);
theResult.SetEnergyChange(aTrack.GetKineticEnergy());
theResult.SetMomentumChange(aTrack.Get4Momentum().vect().unit());
return &theResult;
}
theResult.Clear();
theResult.SetStatusChange(isAlive);
theResult.SetEnergyChange(aTrack.GetKineticEnergy());
theResult.SetMomentumChange(aTrack.Get4Momentum().vect().unit());
return &theResult;
}
}
else
{
result=Interact(mom,toBreit);
if(! result )
{
// abort!!
if(! result )
{
// abort!!
G4cerr << "G4BinaryLightIonReaction no final state for: " << G4endl;
G4cerr << " Primary " << aTrack.GetDefinition()
<< ", (A,Z)=(" << aTrack.GetDefinition()->GetBaryonNumber()
<< "," << aTrack.GetDefinition()->GetPDGCharge()/eplus << ") "
<< ", kinetic energy " << aTrack.GetKineticEnergy()
<< G4endl;
G4cerr << " Target nucleus (A,Z)=("
<< (swapped?pA:tA) << ","
<< (swapped?pZ:tZ) << ")" << G4endl;
G4cerr << " if frequent, please submit above information as bug report"
<< G4endl << G4endl;
G4cerr << "G4BinaryLightIonReaction no final state for: " << G4endl;
G4cerr << " Primary " << aTrack.GetDefinition()
<< ", (A,Z)=(" << aTrack.GetDefinition()->GetBaryonNumber()
<< "," << aTrack.GetDefinition()->GetPDGCharge()/eplus << ") "
<< ", kinetic energy " << aTrack.GetKineticEnergy()
<< G4endl;
G4cerr << " Target nucleus (A,Z)=("
<< (swapped?pA:tA) << ","
<< (swapped?pZ:tZ) << ")" << G4endl;
G4cerr << " if frequent, please submit above information as bug report"
<< G4endl << G4endl;
theResult.Clear();
theResult.SetStatusChange(isAlive);
theResult.SetEnergyChange(aTrack.GetKineticEnergy());
theResult.SetMomentumChange(aTrack.Get4Momentum().vect().unit());
return &theResult;
}
theResult.Clear();
theResult.SetStatusChange(isAlive);
theResult.SetEnergyChange(aTrack.GetKineticEnergy());
theResult.SetMomentumChange(aTrack.Get4Momentum().vect().unit());
return &theResult;
}
// Calculate excitation energy,
G4double theStatisticalExEnergy = GetProjectileExcitation();
// Calculate excitation energy,
G4double theStatisticalExEnergy = GetProjectileExcitation();
pInitialState = mom;
//G4cout << "BLIC: pInitialState from aTrack : " << pInitialState;
pInitialState.setT(pInitialState.getT() +
G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass(tZ,tA));
//G4cout << "BLIC: target nucleus added : " << pInitialState << G4endl;
pInitialState = mom;
//G4cout << "BLIC: pInitialState from aTrack : " << pInitialState;
pInitialState.setT(pInitialState.getT() +
G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass(tZ,tA));
//G4cout << "BLIC: target nucleus added : " << pInitialState << G4endl;
delete target3dNucleus;target3dNucleus=0;
delete projectile3dNucleus;projectile3dNucleus=0;
delete target3dNucleus;target3dNucleus=0;
delete projectile3dNucleus;projectile3dNucleus=0;
G4ReactionProductVector * spectators= new G4ReactionProductVector;
G4ReactionProductVector * spectators= new G4ReactionProductVector;
cascaders = new G4ReactionProductVector;
cascaders = new G4ReactionProductVector;
G4LorentzVector pspectators=SortResult(result,spectators,cascaders);
// this also sets spectatorA and spectatorZ
G4LorentzVector pspectators=SortResult(result,spectators,cascaders);
// this also sets spectatorA and spectatorZ
// pFinalState=std::accumulate(cascaders->begin(),cascaders->end(),pFinalState,ReactionProduct4Mom);
// pFinalState=std::accumulate(cascaders->begin(),cascaders->end(),pFinalState,ReactionProduct4Mom);
std::vector<G4ReactionProduct *>::iterator iter;
std::vector<G4ReactionProduct *>::iterator iter;
// G4cout << "pInitialState, pFinalState / pspectators"<< pInitialState << " / " << pFinalState << " / " << pspectators << G4endl;
// G4cout << "pInitialState, pFinalState / pspectators"<< pInitialState << " / " << pFinalState << " / " << pspectators << G4endl;
// if ( spectA-spectatorA !=0 || spectZ-spectatorZ !=0)
// {
// G4cout << "spect Nucl != spectators: nucl a,z; spect a,z" <<
// spectatorA <<" "<< spectatorZ <<" ; " << spectA <<" "<< spectZ << G4endl;
// }
delete result;
result=0;
G4LorentzVector momentum(pInitialState-pFinalState);
G4int loopcount(0);
//G4cout << "BLIC: momentum, pspectators : " << momentum << " / " << pspectators << G4endl;
while (std::abs(momentum.e()-pspectators.e()) > 10*MeV) /* Loop checking, 31.08.2015, G.Folger */
// see if on loopcount
{
G4LorentzVector pCorrect(pInitialState-pspectators);
//G4cout << "BLIC:: BIC nonconservation? (pInitialState-pFinalState) / spectators :" << momentum << " / " << pspectators << "pCorrect "<< pCorrect<< G4endl;
// Correct outgoing casacde particles.... to have momentum of (initial state - spectators)
G4bool EnergyIsCorrect=EnergyAndMomentumCorrector(cascaders, pCorrect);
if ( ! EnergyIsCorrect && debug_G4BinaryLightIonReactionResults)
{
G4cout << "Warning - G4BinaryLightIonReaction E/P correction for cascaders failed" << G4endl;
}
pFinalState=G4LorentzVector(0,0,0,0);
for(iter=cascaders->begin(); iter!=cascaders->end(); iter++)
{
pFinalState += G4LorentzVector( (*iter)->GetMomentum(), (*iter)->GetTotalEnergy() );
}
momentum=pInitialState-pFinalState;
if (++loopcount > 10 )
{
if ( momentum.vect().mag() - momentum.e()> 10*keV )
{
G4cerr << "G4BinaryLightIonReaction.cc: Cannot correct 4-momentum of cascade particles" << G4endl;
throw G4HadronicException(__FILE__, __LINE__, "G4BinaryCasacde::ApplyCollision()");
} else {
break;
}
}
}
if (spectatorA > 0 )
{
// check spectator momentum
if ( momentum.vect().mag() - momentum.e()< 10*keV )
delete result;
result=0;
G4LorentzVector momentum(pInitialState-pFinalState);
G4int loopcount(0);
//G4cout << "BLIC: momentum, pspectators : " << momentum << " / " << pspectators << G4endl;
while (std::abs(momentum.e()-pspectators.e()) > 10*MeV) /* Loop checking, 31.08.2015, G.Folger */
// see if on loopcount
{
G4LorentzVector pCorrect(pInitialState-pspectators);
//G4cout << "BLIC:: BIC nonconservation? (pInitialState-pFinalState) / spectators :" << momentum << " / " << pspectators << "pCorrect "<< pCorrect<< G4endl;
// Correct outgoing casacde particles.... to have momentum of (initial state - spectators)
G4bool EnergyIsCorrect=EnergyAndMomentumCorrector(cascaders, pCorrect);
if ( ! EnergyIsCorrect && debug_G4BinaryLightIonReactionResults)
{
// DeExciteSpectatorNucleus() also handles also case of A=1, Z=0,1
DeExciteSpectatorNucleus(spectators, cascaders, theStatisticalExEnergy, momentum);
G4cout << "Warning - G4BinaryLightIonReaction E/P correction for cascaders failed" << G4endl;
}
pFinalState=G4LorentzVector(0,0,0,0);
for(iter=cascaders->begin(); iter!=cascaders->end(); iter++)
{
pFinalState += G4LorentzVector( (*iter)->GetMomentum(), (*iter)->GetTotalEnergy() );
}
momentum=pInitialState-pFinalState;
if (++loopcount > 10 )
{
break;
}
}
} else { // momentum non-conservation --> fail
for (iter=spectators->begin();iter!=spectators->end();iter++)
{
delete *iter;
}
delete spectators;
for(iter=cascaders->begin(); iter!=cascaders->end(); iter++)
{
delete *iter;
}
delete cascaders;
// Check if Energy/Momemtum is now ok, if not return initial state
if ( std::abs(momentum.e()-pspectators.e()) > 10*MeV )
{
for (iter=spectators->begin();iter!=spectators->end();iter++)
{
delete *iter;
}
delete spectators;
for(iter=cascaders->begin(); iter!=cascaders->end(); iter++)
{
delete *iter;
}
delete cascaders;
G4cout << "G4BinaryLightIonReaction.cc: mom check: " << momentum
<< " 3.mag "<< momentum.vect().mag() << G4endl
<< " .. pInitialState/pFinalState/spectators " << pInitialState <<" "
<< pFinalState << " " << pspectators << G4endl
<< " .. A,Z " << spectatorA <<" "<< spectatorZ << G4endl;
G4cout << "G4BinaryLightIonReaction invalid final state for: " << G4endl;
G4cout << " Primary " << aTrack.GetDefinition()
<< ", (A,Z)=(" << aTrack.GetDefinition()->GetBaryonNumber()
<< "," << aTrack.GetDefinition()->GetPDGCharge()/eplus << ") "
<< ", kinetic energy " << aTrack.GetKineticEnergy()
<< G4endl;
G4cout << " Target nucleus (A,Z)=(" << targetNucleus.GetA_asInt()
<< "," << targetNucleus.GetZ_asInt() << ")" << G4endl;
G4cout << " if frequent, please submit above information as bug report"
<< G4endl << G4endl;
G4cout << "G4BinaryLightIonReaction.cc: mom check: " << G4endl
<< " initial - final " << momentum << " 3.mag "<< momentum.vect().mag() << G4endl
<< " .. pInitialState/pFinalState/spectators " << G4endl
<< pInitialState << G4endl
<< pFinalState << G4endl
<< pspectators << G4endl
<< " .. A,Z " << spectatorA <<" "<< spectatorZ << G4endl;
G4cout << "G4BinaryLightIonReaction invalid final state for: " << G4endl;
G4cout << " Primary " << aTrack.GetDefinition()
<< ", (A,Z)=(" << aTrack.GetDefinition()->GetBaryonNumber()
<< "," << aTrack.GetDefinition()->GetPDGCharge()/eplus << ") "
<< ", kinetic energy " << aTrack.GetKineticEnergy()
<< G4endl;
G4cout << " Target nucleus (A,Z)=(" << targetNucleus.GetA_asInt()
<< "," << targetNucleus.GetZ_asInt() << ")" << G4endl;
G4cout << " if frequent, please submit above information as bug report"
<< G4endl << G4endl;
#ifdef debug_G4BinaryLightIonReaction
G4ExceptionDescription ed;
ed << "G4BinaryLightIonreaction: Terminate for above error" << G4endl;
@@ -268,15 +257,20 @@ ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus & targetNucleus )
ed);
#endif
theResult.Clear();
theResult.SetStatusChange(isAlive);
theResult.SetEnergyChange(aTrack.GetKineticEnergy());
theResult.SetMomentumChange(aTrack.Get4Momentum().vect().unit());
return &theResult;
}
} else { // no spectators
delete spectators;
}
theResult.Clear();
theResult.SetStatusChange(isAlive);
theResult.SetEnergyChange(aTrack.GetKineticEnergy());
theResult.SetMomentumChange(aTrack.Get4Momentum().vect().unit());
return &theResult;
}
if (spectatorA > 0 )
{
// DeExciteSpectatorNucleus() also handles also case of A=1, Z=0,1
DeExciteSpectatorNucleus(spectators, cascaders, theStatisticalExEnergy, momentum);
} else { // no spectators
delete spectators;
}
}
// Rotate to lab
G4LorentzRotation toZ;
@@ -289,12 +283,12 @@ ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus & targetNucleus )
theResult.Clear();
theResult.SetStatusChange(stopAndKill);
G4LorentzVector ptot(0);
G4ReactionProductVector::iterator iter;
#ifdef debug_BLIR_result
G4LorentzVector p_raw;
#endif
//G4int i=0;
#ifdef debug_BLIR_result
G4LorentzVector p_raw;
#endif
//G4int i=0;
G4ReactionProductVector::iterator iter;
for(iter=cascaders->begin(); iter!=cascaders->end(); iter++)
{
if((*iter)->GetNewlyAdded())
@@ -557,21 +551,27 @@ G4ReactionProductVector * G4BinaryLightIonReaction::Interact(G4LorentzVector & m
result=theModel->Propagate(initalState, target3dNucleus);
#ifdef debug_BLIR_finalstate
if( result && result->size()>0)
{
G4LorentzVector presult;
G4ReactionProductVector::iterator iter;
G4ReactionProduct xp;
for (iter=result->begin(); iter !=result->end(); ++iter)
{
presult += G4LorentzVector((*iter)->GetMomentum(),(*iter)->GetTotalEnergy());
}
if( result && result->size()>0)
{
G4cout << " Cascade result " << G4endl;
G4LorentzVector presult;
G4ReactionProductVector::iterator iter;
G4ReactionProduct xp;
for (iter=result->begin(); iter !=result->end(); ++iter)
{
presult += G4LorentzVector((*iter)->GetMomentum(),(*iter)->GetTotalEnergy());
G4cout << (*iter)->GetDefinition()->GetParticleName() << " : "
<< "("<< (*iter)->GetMomentum().x()<<","
<< (*iter)->GetMomentum().y()<<","
<< (*iter)->GetMomentum().z()<<";"
<< (*iter)->GetTotalEnergy() <<")"<< G4endl;
}
G4cout << "BLIC check result : initial " << pinitial << " mass tgt " << target3dNucleus->GetMass()
<< " final " << presult
<< " IF - FF " << pinitial +G4LorentzVector(target3dNucleus->GetMass()) - presult << G4endl;
G4cout << "BLIC check result : initial " << pinitial << " mass tgt " << target3dNucleus->GetMass()
<< " final " << presult
<< " IF - FF " << pinitial +G4LorentzVector(target3dNucleus->GetMass()) - presult << G4endl;
}
}
#endif
if( result && result->size()==0)
{
@@ -6,6 +6,10 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-05-02 Gabriele Cosmo (hadr-cohe-V11-01-05)
- Fixed compilation warnings for potentially uninitialised local variables in
SampleThetaCMS() for G4DiffuseElastic and G4NuclNuclDiffuseElastic.
## 2023-10-23 Vladimir Ivanchenko (hadr-cohe-V11-01-04)
- G4ChargeExchange - address interface change in G4ChargeExchangeXS
@@ -735,7 +735,8 @@ G4DiffuseElastic::SampleThetaCMS(const G4ParticleDefinition* particle,
G4double momentum, G4double A)
{
G4int i, iMax = 100;
G4double norm, result, theta1, theta2, thetaMax, sum = 0.;
G4double norm, theta1, theta2, thetaMax;
G4double result = 0., sum = 0.;
fParticle = particle;
fWaveVector = momentum/hbarc;
@@ -724,7 +724,8 @@ G4NuclNuclDiffuseElastic::SampleThetaCMS(const G4ParticleDefinition* particle,
G4double momentum, G4double A)
{
G4int i, iMax = 100;
G4double norm, result, theta1, theta2, thetaMax, sum = 0.;
G4double norm, theta1, theta2, thetaMax;
G4double result = 0., sum = 0.;
fParticle = particle;
fWaveVector = momentum/hbarc;
@@ -6,6 +6,9 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-04-12 Jean-Christophe David (hadr-inclxx-V11-01-05)
- Fix in G4INCLInteractionAvatar to not use local energy for all antibaryons.
## 2023-12-01 Ben Morgan (hadr-inclxx-V11-01-04)
- Replace raw std::getenv calls wih G4FindDataDir for G4INCLDATA location.
@@ -447,9 +447,8 @@ namespace G4INCL {
(*i)->setPotentialEnergy(0.);
}
//jcd if(shouldUseLocalEnergy && !(*i)->isPion()) { // This translates AECSVT's loops 1, 3 and 4
if(shouldUseLocalEnergy && !(*i)->isPion() && !(*i)->isEta() && !(*i)->isOmega() &&
!(*i)->isKaon() && !(*i)->isAntiKaon() && !(*i)->isSigma() && !(*i)->isPhoton() && !(*i)->isLambda() && !(*i)->isAntiNucleon()) { // This translates AECSVT's loops 1, 3 and 4
if(shouldUseLocalEnergy && !(*i)->isPion() && !(*i)->isEta() && !(*i)->isOmega() &&
!(*i)->isKaon() && !(*i)->isAntiKaon() && !(*i)->isSigma() && !(*i)->isPhoton() && !(*i)->isLambda() && !(*i)->isAntiBaryon()) { // This translates AECSVT's loops 1, 3 and 4
// assert(theNucleus); // Local energy without a nucleus doesn't make sense
const G4double energy = (*i)->getEnergy(); // Store the energy of the particle
G4double locE = KinematicsUtils::getLocalEnergy(theNucleus, *i); // Initial value of local energy
@@ -6,6 +6,16 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-05-02 Gabriele Cosmo (hadr-lend-V11-01-04)
- Fixed compilation warnings for potentially initialised local variables in
ptwXY_createFromFunctionZeroCrossing().
## 2024-04-24 Pere Mato
- Math macros such as M_PI are not standard. To define them the macro
_USE_MATH_DEFINES needs to be defined before including <cmath>.
- macro WIN32 is not standard, the correect macro is _WIN32.
- <BaseTsd.h> should be <basetsd.h> for MinGW.
## 2024-01-29 Vladimir Ivanchenko (hadr-lend-V11-01-03)
- MCGIDI_product, MCGIDI_outputChannel, MCGIDI_distribution - fixed alma9-gcc131
compilation warnings seen in CMSSW
@@ -9,10 +9,6 @@
#define MCGIDI_VERSION_MINOR 0
#define MCGIDI_VERSION_PATCHLEVEL 0
#ifdef WIN32
#define M_PI 3.141592653589793238463
#endif
#include <GIDI_settings.hh>
#include <map>
#include <vector>
@@ -6,15 +6,12 @@
#ifndef specialFunctions_h_included
#define specialFunctions_h_included
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>
#include "nf_utilities.h"
#ifdef WIN32
#define M_PI 3.141592653589793238463
#endif
#if defined __cplusplus
extern "C" {
namespace GIDI {
@@ -3,11 +3,9 @@
# <<END-copyright>>
*/
#include <string.h>
#define _USE_MATH_DEFINES
#include <cmath>
#ifdef WIN32
#define M_PI 3.141592653589793238463
#endif
#include "MCGIDI_fromTOM.h"
#include "MCGIDI_misc.h"
@@ -3,6 +3,7 @@
# <<END-copyright>>
*/
#include <string.h>
#define _USE_MATH_DEFINES
#include <cmath>
#include "MCGIDI.h"
@@ -54,6 +54,7 @@
*/
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <cmath>
#include "nf_specialFunctions.h"
@@ -120,7 +120,7 @@ static nfu_status ptwXY_createFromFunctionZeroCrossing( ptwXYPoints *ptwXY, doub
if ( y2 == y1 ) return ( nfu_badInput );
int i;
double x, y;
double x = 0, y = 0;
nfu_status status;
for( i = 0; i < 16; i++ ) {
@@ -11,8 +11,8 @@
#include <fcntl.h>
#include <errno.h>
#if defined(WIN32) || defined(__MINGW32__)
#include <BaseTsd.h>
#if defined(_WIN32)
#include <basetsd.h>
#include <io.h>
#include <windows.h>
#define realpath( a, b ) GetFullPathName( a, PATH_MAX, b, NULL )
@@ -6,6 +6,23 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-04-21 Gabriele Cosmo (hadr-hpp-V11-01-26)
- Fixed compilation error in G4ParticleHPManager and G4ParticleHPNames on
Windows VC++ with C++20 Standard enabled.
Based on [GitHub PR#69](https://github.com/Geant4/geant4/pull/69).
## 2024-02-26 Vladimir Ivanchenko
- G4CrossSectionHP - fixed method takeing into account temperatue effect
(the difference due to this fix is small), fixed elastic and capture
cross-sections in Argon by using only the main isotope Z=18, A=40 (there
was up to 50% overestimation of cross sections due to wrong data for
rare isotopes of argon); fixed cross sections for rare target atoms
Promethium, Astatine, Radon, Francium.
## 2024-02-12 Gabriele Cosmo
- Fixed remaining compilation warnings on gcc compiler when LTO settings
are enabled.
## 2024-01-30 Vladimir Ivanchenko (hadr-hpp-V11-01-25)
- G4ParticleHPFSFissionFS, G4ParticleHPFissionBaseFS - substitute
C-arrays with std::vector in order to reduce compilation warnings on gcc
@@ -85,6 +85,8 @@ class G4CrossSectionHP : public G4VCrossSectionDataSet
inline G4double GetMaxHPEnergy() const;
inline void SetBinSearch(G4int n);
private:
void Initialise(const G4int Z);
@@ -102,6 +104,7 @@ class G4CrossSectionHP : public G4VCrossSectionDataSet
inline G4bool CheckCache(const G4int Z);
const G4ParticleDefinition* fParticle;
const G4ParticleDefinition* fNeutron;
G4ParticleHPManager* fManagerHP;
const G4double emax;
@@ -113,6 +116,8 @@ class G4CrossSectionHP : public G4VCrossSectionDataSet
const G4int minZ;
const G4int maxZ;
G4int binSearch{2};
std::size_t index{0};
G4bool fPrinted{false};
@@ -157,4 +162,9 @@ inline G4double G4CrossSectionHP::GetMaxHPEnergy() const
return emax;
}
inline void G4CrossSectionHP::SetBinSearch(G4int n)
{
if (n > 0) { binSearch = n; }
}
#endif
@@ -55,13 +55,14 @@ class G4ParticleHPArbitaryTab : public G4VParticleHPEDis
inline void Init(std::istream& theData) override
{
G4int i;
std::size_t i;
theFractionalProb.Init(theData, CLHEP::eV);
theData >> nDistFunc; // = number of incoming n energy points
theDistFunc = new G4ParticleHPVector[nDistFunc];
const std::size_t dsize = nDistFunc > 0 ? nDistFunc : 1;
theDistFunc = new G4ParticleHPVector[dsize];
theManager.Init(theData);
G4double currentEnergy;
for (i = 0; i < nDistFunc; i++) {
for (i = 0; i < dsize; ++i) {
theData >> currentEnergy;
theDistFunc[i].SetLabel(currentEnergy * CLHEP::eV);
theDistFunc[i].Init(theData, CLHEP::eV);
@@ -76,17 +77,17 @@ class G4ParticleHPArbitaryTab : public G4VParticleHPEDis
//************************************************************************
// EMendoza:
// Here we calculate the thresholds for the 2D sampling:
for (i = 0; i < nDistFunc; i++) {
for (i = 0; i < dsize; ++i) {
G4int np = theDistFunc[i].GetVectorLength();
theLowThreshold[i] = theDistFunc[i].GetEnergy(0);
theHighThreshold[i] = theDistFunc[i].GetEnergy(np - 1);
for (G4int j = 0; j < np - 1; j++) {
for (G4int j = 0; j < np - 1; ++j) {
if (theDistFunc[i].GetXsec(j + 1) > 1.e-20) {
theLowThreshold[i] = theDistFunc[i].GetEnergy(j);
break;
}
}
for (G4int j = 1; j < np; j++) {
for (G4int j = 1; j < np; ++j) {
if (theDistFunc[i].GetXsec(j - 1) > 1.e-20) {
theHighThreshold[i] = theDistFunc[i].GetEnergy(j);
}
@@ -33,6 +33,7 @@
#include "G4ParticleHPLegendreTable.hh"
#include "G4ios.hh"
#include <vector>
#include <fstream>
class G4ParticleHPLegendreStore
@@ -40,11 +41,11 @@ class G4ParticleHPLegendreStore
public:
G4ParticleHPLegendreStore(G4int n)
{
theCoeff = new G4ParticleHPLegendreTable[n];
theCoeff.resize(n);
nEnergy = n;
}
~G4ParticleHPLegendreStore() { delete[] theCoeff; }
~G4ParticleHPLegendreStore() {}
inline void Init(G4int i, G4double e, G4int n) { theCoeff[i].Init(e, n); }
inline void SetNPoints(G4int n) { nEnergy = n; }
@@ -77,7 +78,7 @@ class G4ParticleHPLegendreStore
private:
G4int nEnergy;
G4ParticleHPLegendreTable* theCoeff;
std::vector<G4ParticleHPLegendreTable> theCoeff;
G4InterpolationManager theManager; // interpolate between different Tables
};
#endif
@@ -64,6 +64,7 @@ G4CrossSectionHP::G4CrossSectionHP(const G4ParticleDefinition* p,
G4int zmin, G4int zmax)
: G4VCrossSectionDataSet(nameData),
fParticle(p),
fNeutron(G4Neutron::Neutron()),
fManagerHP(G4ParticleHPManager::GetInstance()),
emax(emaxHP),
emaxT(fManagerHP->GetMaxEnergyDoppler()),
@@ -161,30 +162,35 @@ G4double G4CrossSectionHP::IsoCrossSection(const G4double ekin,
} else {
// Doppler broading
G4double lambda = 1.0/(CLHEP::k_Boltzmann*T);
G4double e0 = CLHEP::k_Boltzmann*T;
G4double mass = fParticle->GetPDGMass();
G4double massTarget = G4NucleiProperties::GetNuclearMass(A, Z);
G4LorentzVector lv(0., 0., 0., mass + ekin);
// projectile
G4LorentzVector lv(0., 0., std::sqrt(ekin*(ekin + 2*mass)), mass + ekin);
// limits of integration
const G4double lim = 1.01;
const G4int nmin = 3;
G4int i;
G4int ii = 0;
const G4int nn = 20;
G4double xs2 = 0.0;
for (i=1; i<nn; ++i) {
G4double erand = G4RandGamma::shoot(2.0, lambda);
for (G4int i=0; i<nn; ++i) {
G4double erand = G4RandGamma::shoot(2.0, e0);
auto mom = G4RandomDirection()*std::sqrt(2*massTarget*erand);
fLV.set(mom.x(), mom.y(), mom.z(), mass + erand);
fLV.set(mom.x(), mom.y(), mom.z(), massTarget + erand);
fBoost = fLV.boostVector();
G4double e = lv.boost(fBoost).e() - mass;
fLV = lv.boost(fBoost);
if (fLV.pz() <= 0.0) { continue; }
++ii;
G4double e = fLV.e() - mass;
G4double y = pv->Value(e, index);
xs += y;
xs2 += y*y;
if (i >= nmin && i*xs2 <= lim*xs*xs) { break; }
if (ii >= nmin && ii*xs2 <= lim*xs*xs) { break; }
}
xs /= (G4double)std::min(i, nn-1);
if (ii > 0) { xs /= (G4double)(ii); }
}
#ifdef G4VERBOSE
if (verboseLevel > 1) {
@@ -317,8 +323,7 @@ void G4CrossSectionHP::DumpPhysicsTable(const G4ParticleDefinition&)
const G4ElementTable* table = G4Element::GetElementTable();
for ( auto const & elm : *table ) {
G4int Z = elm->GetZasInt();
if (Z >= minZ && Z <= maxZ &&
nullptr != fData->GetElementData(Z - minZ)) {
if (Z >= minZ && Z <= maxZ && nullptr != fData->GetElementData(Z - minZ)) {
G4cout << "---------------------------------------------------" << G4endl;
G4cout << elm->GetName() << G4endl;
std::size_t n = fData->GetNumberOfComponents(Z);
@@ -369,31 +374,36 @@ void G4CrossSectionHP::Initialise(const G4int Z)
G4bool noComp = true;
for (G4int A=amin[Z]; A<=amax[Z]; ++A) {
std::ostringstream ost;
ost << fDataDirectory << Z << "_";
if (6 == Z && 12 == A) {
ost << "nat_";
ost << fDataDirectory;
// first check special cases
if (6 == Z && 12 == A && fParticle == fNeutron) {
ost << Z << "_nat_" << elementName[Z];
} else if (18 == Z && 40 != A) {
continue;
} else if (27 == Z && 62 == A) {
ost << "62m1_";
ost << Z << "_62m1_" << elementName[Z];
} else if (47 == Z && 106 == A) {
ost << "106m1_";
ost << Z << "_106m1_" << elementName[Z];
} else if (48 == Z && 115 == A) {
ost << "115m1_";
ost << Z << "_115m1_" << elementName[Z];
} else if (52 == Z && 127 == A) {
ost << "127m1_";
ost << Z << "_127m1_" << elementName[Z];
} else if (52 == Z && 129 == A) {
ost << "129m1_";
ost << Z << "_129m1_" << elementName[Z];
} else if (52 == Z && 131 == A) {
ost << "131m1_";
ost << Z << "_131m1_" << elementName[Z];
} else if (61 == Z && 145 == A) {
ost << Z << "_147_" << elementName[Z];
} else if (67 == Z && 166 == A) {
ost << "166m1_";
ost << Z << "_166m1_" << elementName[Z];
} else if (73 == Z && 180 == A) {
ost << "180m1_";
ost << Z << "_180m1_" << elementName[Z];
} else if ((Z == 85 && A == 210) || (Z == 86 && A == 222) || (Z == 87 && A == 223)) {
ost << "84_209_" << elementName[84];
} else {
ost << A << "_";
// the main file name
ost << Z << "_" << A << "_" << elementName[Z];
}
ost << elementName[Z];
std::ifstream filein(ost.str().c_str());
//G4cout << "File: " << ost.str() << " " << G4endl;
std::istringstream theXSData(tnam, std::ios::in);
fManagerHP->GetDataStream(ost.str().c_str(), theXSData);
if (theXSData) {
@@ -408,11 +418,11 @@ void G4CrossSectionHP::Initialise(const G4int Z)
for (G4int i=0; i<n; ++i) {
theXSData >> x >> y;
x *= CLHEP::eV;
y *= CLHEP::barn;
y *= CLHEP::barn;
//G4cout << " e=" << x << " xs=" << y << G4endl;
v->PutValues((std::size_t)i, x, y);
}
v->EnableLogBinSearch(2);
v->EnableLogBinSearch(binSearch);
if (noComp) {
G4int nmax = amax[Z] - A + 1;
fData->InitialiseForComponent(Z - minZ, nmax);
@@ -112,14 +112,15 @@ G4bool G4ParticleHPChannel::Register(G4ParticleHPFinalState* theFS)
G4int Z = theElement->GetZasInt();
niso = (G4int)theElement->GetNumberOfIsotopes();
const std::size_t nsize = niso > 0 ? niso : 1;
delete[] theIsotopeWiseData;
theIsotopeWiseData = new G4ParticleHPIsoData[niso];
theIsotopeWiseData = new G4ParticleHPIsoData[nsize];
delete[] active;
active = new G4bool[niso];
active = new G4bool[nsize];
delete[] theFinalStates;
theFinalStates = new G4ParticleHPFinalState*[niso];
theFinalStates = new G4ParticleHPFinalState*[nsize];
delete theChannelData;
theChannelData = new G4ParticleHPVector;
for (G4int i = 0; i < niso; ++i) {
@@ -93,7 +93,8 @@ G4ParticleHPContAngularPar::G4ParticleHPContAngularPar(G4ParticleHPContAngularPa
theDiscreteEnergiesOwn = val.theDiscreteEnergiesOwn;
toBeCached v;
fCache.Put(v);
theAngular = new G4ParticleHPList[nEnergies];
const std::size_t esize = nEnergies > 0 ? nEnergies : 1;
theAngular = new G4ParticleHPList[esize];
for (G4int ie = 0; ie < nEnergies; ++ie) {
theAngular[ie].SetLabel(val.theAngular[ie].GetLabel());
for (G4int ip = 0; ip < nAngularParameters; ++ip) {
@@ -116,7 +117,8 @@ void G4ParticleHPContAngularPar::Init(std::istream& aDataFile, const G4ParticleD
aDataFile >> theEnergy >> nEnergies >> nDiscreteEnergies >> nAngularParameters;
theEnergy *= eV;
theAngular = new G4ParticleHPList[nEnergies];
const std::size_t esize = nEnergies > 0 ? nEnergies : 1;
theAngular = new G4ParticleHPList[esize];
G4double sEnergy;
for (G4int i = 0; i < nEnergies; ++i) {
aDataFile >> sEnergy;
@@ -840,7 +842,8 @@ void G4ParticleHPContAngularPar::BuildByInterpolation(G4double anEnergy,
nEnergies = nDiscreteEnergies + (G4int)theEnergiesTransformed.size();
// Create final array of angular parameters
auto theNewAngular = new G4ParticleHPList[nEnergies];
const std::size_t esize = nEnergies > 0 ? nEnergies : 1;
auto theNewAngular = new G4ParticleHPList[esize];
// Copy discrete energies and interpolated parameters to new array
@@ -54,7 +54,8 @@ G4ParticleHPContEnergyAngular::~G4ParticleHPContEnergyAngular()
void G4ParticleHPContEnergyAngular::Init(std::istream& aDataFile)
{
aDataFile >> theTargetCode >> theAngularRep >> theInterpolation >> nEnergy;
theAngular = new G4ParticleHPContAngularPar[nEnergy];
const std::size_t esize = nEnergy > 0 ? nEnergy : 1;
theAngular = new G4ParticleHPContAngularPar[esize];
theManager.Init(aDataFile);
for (G4int i = 0; i < nEnergy; ++i) {
theAngular[i].Init(aDataFile, theProjectile);
@@ -63,8 +63,9 @@ void G4ParticleHPDiscreteTwoBody::Init(std::istream& aDataFile)
{
aDataFile >> nEnergy;
theManager.Init(aDataFile);
theCoeff = new G4ParticleHPLegendreTable[nEnergy];
for (G4int i = 0; i < nEnergy; i++) {
const std::size_t tsize = nEnergy > 0 ? nEnergy : 1;
theCoeff = new G4ParticleHPLegendreTable[tsize];
for (std::size_t i = 0; i < tsize; ++i) {
G4double energy;
G4int aRep, nCoeff;
aDataFile >> energy >> aRep >> nCoeff;
@@ -60,7 +60,8 @@ void G4ParticleHPElementData::Init(G4Element* theElement,
{
auto nIso = (G4int)theElement->GetNumberOfIsotopes();
auto Z = theElement->GetZasInt();
theIsotopeWiseData = new G4ParticleHPIsoData[nIso];
const std::size_t dsize = nIso > 0 ? nIso : 1;
theIsotopeWiseData = new G4ParticleHPIsoData[dsize];
for (G4int i1 = 0; i1 < nIso; ++i1) {
G4int A = theElement->GetIsotope(i1)->GetN();
@@ -63,10 +63,9 @@ void G4ParticleHPEnAngCorrelation::Init(std::istream& aDataFile)
{
inCharge = true;
aDataFile >> targetMass >> frameFlag >> nProducts;
//G4cout << "G4ParticleHPEnAngCorrelation::Init " << theProjectile->GetParticleName()
// << " frameFlag=" << frameFlag << " N=" << nProducts << " Mass=" << targetMass << G4endl;
theProducts = new G4ParticleHPProduct[nProducts];
for (G4int i = 0; i < nProducts; ++i) {
const std::size_t psize = nProducts > 0 ? nProducts : 1;
theProducts = new G4ParticleHPProduct[psize];
for (std::size_t i = 0; i < psize; ++i) {
theProducts[i].Init(aDataFile, theProjectile);
}
}
@@ -91,9 +91,9 @@ G4double G4ParticleHPField::GetY(G4double e, G4int j)
void G4ParticleHPField::Dump()
{
G4cout << nEntries << G4endl;
for (G4int i = 0; i < nEntries; i++) {
for (G4int i = 0; i < nEntries; ++i) {
G4cout << theData[i].GetX() << " ";
for (G4int j = 0; j < theData[i].GetDepth(); j++) {
for (G4int j = 0; j < theData[i].GetDepth(); ++j) {
G4cout << theData[i].GetY(j) << " ";
}
G4cout << G4endl;
@@ -107,12 +107,11 @@ void G4ParticleHPField::Check(G4int i)
"Skipped some index numbers in G4ParticleHPField");
if (i == nPoints) {
nPoints += 50;
auto buff = new G4ParticleHPFieldPoint[nPoints];
// G4cout << "copying 1"<<G4endl;
for (G4int j = 0; j < nEntries; j++) {
const std::size_t fsize = nPoints > 0 ? nPoints : 1;
auto buff = new G4ParticleHPFieldPoint[fsize];
for (G4int j = 0; j < nEntries; ++j) {
buff[j] = theData[j];
}
// G4cout << "copying 2"<<G4endl;
delete[] theData;
theData = buff;
}
@@ -52,18 +52,20 @@ void G4ParticleHPLabAngularEnergy::Init(std::istream& aDataFile)
{
aDataFile >> nEnergies;
theManager.Init(aDataFile);
theEnergies = new G4double[nEnergies];
nCosTh = new G4int[nEnergies];
theData = new G4ParticleHPVector*[nEnergies];
theSecondManager = new G4InterpolationManager[nEnergies];
for (G4int i = 0; i < nEnergies; i++) {
const std::size_t esize = nEnergies > 0 ? nEnergies : 1;
theEnergies = new G4double[esize];
nCosTh = new G4int[esize];
theData = new G4ParticleHPVector*[esize];
theSecondManager = new G4InterpolationManager[esize];
for (G4int i = 0; i < nEnergies; ++i) {
aDataFile >> theEnergies[i];
theEnergies[i] *= eV;
aDataFile >> nCosTh[i];
theSecondManager[i].Init(aDataFile);
theData[i] = new G4ParticleHPVector[nCosTh[i]];
const std::size_t dsize = nCosTh[i] > 0 ? nCosTh[i] : 1;
theData[i] = new G4ParticleHPVector[dsize];
G4double label;
for (G4int ii = 0; ii < nCosTh[i]; ii++) {
for (std::size_t ii = 0; ii < dsize; ++ii) {
aDataFile >> label;
theData[i][ii].SetLabel(label);
theData[i][ii].Init(aDataFile, eV);
@@ -72,7 +72,7 @@ G4ParticleHPManager::G4ParticleHPManager()
// path may be defined by two environment variables
// it is not mandatory to access PHP data - path may be not defined
const char* ttp = G4FindDataDir("G4PARTICLEHPDATA");
G4String tendl = (nullptr == ttp) ? "" : G4String(ttp);
G4String tendl = (nullptr == ttp) ? G4String("") : G4String(ttp);
const char* ssp = G4FindDataDir("G4PROTONHPDATA");
fDataPath[1] = (nullptr == ssp) ? tendl + "/Proton" : G4String(ssp);
@@ -78,7 +78,7 @@ G4ParticleHPNames::G4ParticleHPNames(G4int maxOffSet) : theMaxOffSet(maxOffSet)
G4String G4ParticleHPNames::GetName(G4int i)
{
return (i > 0 && i < 100) ? theString[i] : "";
return (i > 0 && i < 100) ? theString[i] : G4String("");
}
G4String G4ParticleHPNames::itoa(G4int current)
@@ -61,11 +61,12 @@ G4bool G4ParticleHPPhotonDist::InitMean(std::istream& aDataFile)
if (repFlag == 1) {
// multiplicities
aDataFile >> nDiscrete;
disType = new G4int[nDiscrete];
energy = new G4double[nDiscrete];
// actualMult = new G4int[nDiscrete];
theYield = new G4ParticleHPVector[nDiscrete];
for (G4int i = 0; i < nDiscrete; ++i) {
const std::size_t msize = nDiscrete > 0 ? nDiscrete : 1;
disType = new G4int[msize];
energy = new G4double[msize];
// actualMult = new G4int[msize];
theYield = new G4ParticleHPVector[msize];
for (std::size_t i = 0; i < msize; ++i) {
aDataFile >> disType[i] >> energy[i];
energy[i] *= eV;
theYield[i].Init(aDataFile, eV);
@@ -77,11 +78,12 @@ G4bool G4ParticleHPPhotonDist::InitMean(std::istream& aDataFile)
theBaseEnergy *= eV;
aDataFile >> theInternalConversionFlag;
aDataFile >> nGammaEnergies;
theLevelEnergies = new G4double[nGammaEnergies];
theTransitionProbabilities = new G4double[nGammaEnergies];
const std::size_t esize = nGammaEnergies > 0 ? nGammaEnergies : 1;
theLevelEnergies = new G4double[esize];
theTransitionProbabilities = new G4double[esize];
if (theInternalConversionFlag == 2)
thePhotonTransitionFraction = new G4double[nGammaEnergies];
for (G4int ii = 0; ii < nGammaEnergies; ++ii) {
thePhotonTransitionFraction = new G4double[esize];
for (std::size_t ii = 0; ii < esize; ++ii) {
if (theInternalConversionFlag == 1) {
aDataFile >> theLevelEnergies[ii] >> theTransitionProbabilities[ii];
theLevelEnergies[ii] *= eV;
@@ -146,8 +148,9 @@ void G4ParticleHPPhotonDist::InitAngular(std::istream& aDataFile)
vct_pXS_par.push_back(hpv);
}
}
if (theGammas == nullptr) theGammas = new G4double[nDiscrete2];
if (theShells == nullptr) theShells = new G4double[nDiscrete2];
const std::size_t psize = nDiscrete2 > 0 ? nDiscrete2 : 1;
if (theGammas == nullptr) theGammas = new G4double[psize];
if (theShells == nullptr) theShells = new G4double[psize];
for (i = 0; i < nIso; ++i) // isotropic photons
{
@@ -155,15 +158,17 @@ void G4ParticleHPPhotonDist::InitAngular(std::istream& aDataFile)
theGammas[i] *= eV;
theShells[i] *= eV;
}
nNeu = new G4int[nDiscrete2 - nIso];
if (tabulationType == 1) theLegendre = new G4ParticleHPLegendreTable*[nDiscrete2 - nIso];
if (tabulationType == 2) theAngular = new G4ParticleHPAngularP*[nDiscrete2 - nIso];
const std::size_t tsize = nDiscrete2 - nIso > 0 ? nDiscrete2 - nIso : 1;
nNeu = new G4int[tsize];
if (tabulationType == 1) theLegendre = new G4ParticleHPLegendreTable*[tsize];
if (tabulationType == 2) theAngular = new G4ParticleHPAngularP*[tsize];
for (i = nIso; i < nDiscrete2; ++i) {
if (tabulationType == 1) {
aDataFile >> theGammas[i] >> theShells[i] >> nNeu[i - nIso];
theGammas[i] *= eV;
theShells[i] *= eV;
theLegendre[i - nIso] = new G4ParticleHPLegendreTable[nNeu[i - nIso]];
const std::size_t lsize = nNeu[i - nIso] > 0 ? nNeu[i - nIso] : 1;
theLegendre[i - nIso] = new G4ParticleHPLegendreTable[lsize];
theLegendreManager.Init(aDataFile);
for (ii = 0; ii < nNeu[i - nIso]; ++ii) {
theLegendre[i - nIso][ii].Init(aDataFile);
@@ -173,7 +178,8 @@ void G4ParticleHPPhotonDist::InitAngular(std::istream& aDataFile)
aDataFile >> theGammas[i] >> theShells[i] >> nNeu[i - nIso];
theGammas[i] *= eV;
theShells[i] *= eV;
theAngular[i - nIso] = new G4ParticleHPAngularP[nNeu[i - nIso]];
const std::size_t asize = nNeu[i - nIso] > 0 ? nNeu[i - nIso] : 1;
theAngular[i - nIso] = new G4ParticleHPAngularP[asize];
for (ii = 0; ii < nNeu[i - nIso]; ++ii) {
theAngular[i - nIso][ii].Init(aDataFile);
}
@@ -213,9 +219,10 @@ void G4ParticleHPPhotonDist::InitEnergies(std::istream& aDataFile)
}
if (energyDistributionsNeeded == 0) return;
aDataFile >> nPartials;
distribution = new G4int[nPartials];
probs = new G4ParticleHPVector[nPartials];
partials = new G4ParticleHPPartial*[nPartials];
const std::size_t dsize = nPartials > 0 ? nPartials : 1;
distribution = new G4int[dsize];
probs = new G4ParticleHPVector[dsize];
partials = new G4ParticleHPPartial*[dsize];
G4int nen;
G4int dummy;
for (i = 0; i < nPartials; ++i) {
@@ -236,13 +243,13 @@ void G4ParticleHPPhotonDist::InitPartials(std::istream& aDataFile, G4ParticleHPV
if (nDiscrete != 1) {
theTotalXsec.Init(aDataFile, eV);
}
G4int i;
theGammas = new G4double[nDiscrete];
theShells = new G4double[nDiscrete];
isPrimary = new G4int[nDiscrete];
disType = new G4int[nDiscrete];
thePartialXsec = new G4ParticleHPVector[nDiscrete];
for (i = 0; i < nDiscrete; ++i) {
const std::size_t dsize = nDiscrete > 0 ? nDiscrete : 1;
theGammas = new G4double[dsize];
theShells = new G4double[dsize];
isPrimary = new G4int[dsize];
disType = new G4int[dsize];
thePartialXsec = new G4ParticleHPVector[dsize];
for (std::size_t i = 0; i < dsize; ++i) {
aDataFile >> theGammas[i] >> theShells[i] >> isPrimary[i] >> disType[i];
theGammas[i] *= eV;
theShells[i] *= eV;
@@ -6,6 +6,18 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-04-08 Vladimir Ivanchenko, Alvaro Tolosa Delgado (radioactive_decay-V11-01-11)
- G4BetaPlusDecay, G4BetaMinusDecay - minor fix of radioactive_decay-V11-02-02
In case Q-value is bigger than mass diference, betas in the tail of the spectrum
may have more energy than residual free energy. To minimize the non-conservation
of 4-momentum, in such cases neutrino and daughter nucleus are given 1 eV, leading
to non conservation of linear momentum because momentum of beta is not counterbalanced.
## 2024-02-20 Vladimir Ivanchenko
- G4BetaPlusDecay, G4BetaMinusDecay - added extra numerical protection on
level of 1 eV to avoid precision lost and production of neutrino with
negative kinetic energy
## 2024-02-13 Vladimir Ivanchenko (radioactive_decay-V11-01-10)
- G4BetaPlusDecay, G4BetaMinusDecay - fixed sampling algorithm (problem #2588)
@@ -65,6 +65,7 @@ G4double G4BetaDecayCorrections::FermiFunction(const G4double& W)
{
// Calculate the relativistic Fermi function. Argument W is the
// total electron energy in units of electron mass.
// Ref: E. Feenberg, G. Trigg, Reviews of Modern Physics, 22(1950)
G4double Wprime;
if (Z < 0) {
@@ -116,13 +116,12 @@ G4DecayProducts* G4BetaMinusDecay::DecayIt(G4double)
G4LorentzVector lv(-eMomentum*dir.x(), -eMomentum*dir.y(), -eMomentum*dir.z(),
parentMass - eKE - eMass);
G4double edel = std::max(lv.e() - resMass, 0.0);
// Free energy should be above zero
if (edel > 0.0) {
// centrum of mass system
G4double M = lv.mag();
// centrum of mass system
G4double M = lv.mag();
const G4double elim = CLHEP::eV;
G4double edel = M - resMass;
// Free energy should be above limit
if (edel >= elim) {
// neutrino
G4double eNu = 0.5*(M - resMass*resMass/M);
G4LorentzVector lvnu(eNu*G4RandomDirection(), eNu);
@@ -139,8 +138,8 @@ G4DecayProducts* G4BetaMinusDecay::DecayIt(G4double)
products->PushProducts(dp);
} else {
// neglecting relativistic kinematic and giving all energy to neutrino
dp = new G4DynamicParticle(fNeutrino, G4RandomDirection(), edel);
// neglecting relativistic kinematic and giving some energy to neutrino
dp = new G4DynamicParticle(fNeutrino, G4RandomDirection(), elim);
products->PushProducts(dp);
dp = new G4DynamicParticle(fResIon, G4ThreeVector(0.0,0.0,1.0), 0.0);
products->PushProducts(dp);
@@ -117,13 +117,12 @@ G4DecayProducts* G4BetaPlusDecay::DecayIt(G4double)
G4LorentzVector lv(-eMomentum*dir.x(), -eMomentum*dir.y(), -eMomentum*dir.z(),
parentMass - eKE - eMass);
G4double edel = std::max(lv.e() - resMass, 0.0);
// Free energy should be above zero
if (edel > 0.0) {
// centrum of mass system
G4double M = lv.mag();
const G4double elim = CLHEP::eV;
// centrum of mass system
G4double M = lv.mag();
G4double edel = M - resMass;
// Free energy should be above limit
if (edel >= elim) {
// neutrino
G4double eNu = 0.5*(M - resMass*resMass/M);
G4LorentzVector lvnu(eNu*G4RandomDirection(), eNu);
@@ -141,7 +140,7 @@ G4DecayProducts* G4BetaPlusDecay::DecayIt(G4double)
} else {
// neglecting relativistic kinematic and giving all energy to neutrino
dp = new G4DynamicParticle(fNeutrino, G4RandomDirection(), edel);
dp = new G4DynamicParticle(fNeutrino, G4RandomDirection(), elim);
products->PushProducts(dp);
dp = new G4DynamicParticle(fResIon, G4ThreeVector(0.0,0.0,1.0), 0.0);
products->PushProducts(dp);
+8
View File
@@ -6,6 +6,14 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-05-24 Daren Sawkey (op-V11-01-01)
- G4OpBoundaryProcess: Calculate Fresnel reflection/refraction correctly when
material property TRANSMITTANCE is specified. The ratio of Fresnel
reflection/refraction now does not change when a non-zero transmission is
specified. Previously, if transmission of X% was specified, there would be
transmission of X% as expected, but the ratio of Fresnel refraction to
Fresnel reflection would be set to X%. Addressing bug 2578.
## 2023-10-27 Daren Sawkey (op-V11-01-00)
- G4OpBoundaryProcess: verbosity of 0 silences run-time warnings
@@ -1206,9 +1206,15 @@ leap:
E2_total = E2_perp * E2_perp + E2_parl * E2_parl;
s2 = fRindex2 * cost2 * E2_total;
if(fTransmittance > 0.)
transCoeff = fTransmittance;
else if(cost1 != 0.0)
// D.Sawkey, 24 May 24
// Transmittance has already been taken into account in PostStepDoIt.
// For e.g. specular surfaces, the ratio of Fresnel refraction to
// reflection should be given by the math, not material property
// TRANSMITTANCE
//if(fTransmittance > 0.)
// transCoeff = fTransmittance;
//else if(cost1 != 0.0)
if(cost1 != 0.0)
transCoeff = s2 / s1;
else
transCoeff = 0.0;
+8 -2
View File
@@ -1,9 +1,15 @@
# Category prophonon History
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top). It must **not**
be used as a substitute for writing good git commit messages!
which **must** added in reverse chronological order (newest at the top).
It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-04-21 Gabriele Cosmo (prophonon-V11-01-00)
- Fixed compilation error in G4LatticeManager on Windows VC++ with
C++20 Standard enabled.
Based on [GitHub PR#69](https://github.com/Geant4/geant4/pull/69).
## 2021-12-10 Ben Morgan (prophonon-V11-00-00)
- Change to new Markdown History format

Some files were not shown because too many files have changed in this diff Show More