Import Geant4 11.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2025-12-05 08:54:02 +01:00
parent a499fb82e9
commit b4a16de652
6484 changed files with 232674 additions and 221097 deletions
+14
View File
@@ -5,7 +5,21 @@ which **must** added in reverse chronological order (newest at the top). It must
be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2025-11-06 Laurent Desorgher (event-V11-03-03)
- G4AdjointPrimaryGenerator: Make it G4ThreadLocal and add GetInstance() method
to solve a bug in Reverse MC simulation in MT mode.
- Works with run-V11-03-06
## 2025-11-05 John Allison (event-V11-03-02)
- G4EventManager.hh:
- GetNumberOfRemainingSubEvents():
- Fix warning: Implicit conversion loses integer precision.
## 2025-10-29 Makoto Asai (event-V11-03-01)
- G4EventManager: Enabling to receive next sub-event before completing the
current sub-event when used in the worker thread of sub-event parallel mode
- G4Event, G4SubEvent: Add some flags and pointers to enable above
## 2025-02-13 Gabriele Cosmo (event-V11-03-00)
- Fixed cut&paste error in G4StackManager::TransferStackedTracks(..),
reported by Coverity.
@@ -58,14 +58,13 @@ class G4Navigator;
class G4AdjointPrimaryGenerator
{
public:
static G4AdjointPrimaryGenerator* GetInstance();
G4AdjointPrimaryGenerator();
~G4AdjointPrimaryGenerator();
G4AdjointPrimaryGenerator(const G4AdjointPrimaryGenerator&) = delete;
G4AdjointPrimaryGenerator& operator=(const G4AdjointPrimaryGenerator&) = delete;
public:
G4AdjointPrimaryGenerator();
~G4AdjointPrimaryGenerator();
void GenerateAdjointPrimaryVertex(G4Event* anEvt,
G4ParticleDefinition* adj_part,
@@ -81,13 +80,13 @@ class G4AdjointPrimaryGenerator
G4ParticleDefinition* aPDef);
G4double SampleDistanceAlongBackRayAndComputeWeightCorrection(G4double& weight_corr);
private: // attributes
// The class responsible for the random generation of positions
// and direction of primaries for adjoint source set on the external
// surface of a G4 volume
//
//static G4ThreadLocal G4AdjointPrimaryGenerator* theInstance;
G4AdjointPosOnPhysVolGenerator* theG4AdjointPosOnPhysVolGenerator = nullptr;
G4SingleParticleSource* theSingleParticleSource = nullptr;
+6 -1
View File
@@ -282,17 +282,21 @@ class G4Event
private:
G4Event* motherEvent = nullptr;
G4int subEventType = -1;
const G4SubEvent* fSubEvent = nullptr;
public:
void FlagAsSubEvent(G4Event* me, G4int ty)
void FlagAsSubEvent(G4Event* me, G4int ty, const G4SubEvent* se)
{
motherEvent = me;
subEventType = ty;
fSubEvent = se;
}
inline G4Event* GetMotherEvent() const
{ return motherEvent; }
inline G4int GetSubEventType() const
{ return subEventType; }
inline const G4SubEvent* GetSubEvent() const
{ return fSubEvent; }
private:
mutable G4bool scoresRecorded = false;
@@ -302,6 +306,7 @@ class G4Event
G4bool ScoresAlreadyRecorded() const { return scoresRecorded; }
void EventCompleted() const { eventCompleted = true; }
G4bool IsEventCompleted() const { return eventCompleted; }
};
extern G4EVENT_DLL G4Allocator<G4Event>*& anEventAllocator();
+22
View File
@@ -208,6 +208,28 @@ class G4EventManager
G4String randomNumberStatusToG4Event;
G4StateManager* stateManager = nullptr;
//---------------------------------------------------------------
// Following methods and data members are used only by the G4EventManager
// used in the worker thread in Sub-event parallel mode
public:
inline G4Event* RetrieveCompletedSubEvent()
{
G4Event* evt = nullptr;
if(!completedEvents.empty())
{
evt = completedEvents.back();
completedEvents.pop_back();
}
return evt;
}
inline G4int GetNumberOfRemainingSubEvents()
{ return (G4int)processingEvents.size(); }
private:
std::vector<G4Event*> completedEvents;
std::vector<G4Event*> processingEvents;
};
#endif
+6
View File
@@ -75,11 +75,17 @@ class G4SubEvent : public std::vector<G4StackedTrack>
inline void SetEvent(G4Event* evt) { fpEvent = evt; }
inline G4Event* GetEvent() const { return fpEvent; }
// flag if all tracks of this sub-event have been tracked
// and thus ready to be merged to the corresponding event
inline void SetCompleted(G4bool val=true) const { fCompleted = val; }
inline G4bool IsCompleted() const { return fCompleted; }
private:
G4int fSubEventType = -1;
std::size_t fMaxEnt = 1000;
G4Event* fpEvent = nullptr;
mutable G4bool fCompleted = false;
};
+13 -1
View File
@@ -42,6 +42,19 @@
#include "G4Material.hh"
#include "Randomize.hh"
// --------------------------------------------------------------------
//
G4AdjointPrimaryGenerator* G4AdjointPrimaryGenerator::GetInstance()
{
static G4ThreadLocal G4AdjointPrimaryGenerator theInstance;
return &theInstance;
}
// --------------------------------------------------------------------
//
G4AdjointPrimaryGenerator::G4AdjointPrimaryGenerator()
@@ -49,7 +62,6 @@ G4AdjointPrimaryGenerator::G4AdjointPrimaryGenerator()
center_spherical_source = G4ThreeVector(0.,0.,0.);
type_of_adjoint_source="Spherical";
theSingleParticleSource = new G4SingleParticleSource();
theSingleParticleSource->GetEneDist()->SetEnergyDisType("Pow");
theSingleParticleSource->GetEneDist()->SetAlpha(-1.);
theSingleParticleSource->GetPosDist()->SetPosDisType("Point");
+12 -1
View File
@@ -341,7 +341,18 @@ void G4EventManager::DoProcessing(G4Event* anEvent,
}
}
if(!subEventParaWorker) stateManager->SetNewState(G4State_GeomClosed);
if(subEventParaWorker)
{
// check if the current sub-event is completed
currentEvent->GetSubEvent()->SetCompleted();
// if incomplete current event should be stored in processingEevnts vector
//// processingEevnts.push_back(currentEvent);
// also, once it is completed, it must be moved to completedEvents vector
// to be retrieved by the G4SubEvtWorkerRunManager
}
else
{ stateManager->SetNewState(G4State_GeomClosed); }
currentEvent = nullptr;
abortRequested = false;
}