Import Geant4 11.3.0 source tree
This commit is contained in:
@@ -6,6 +6,28 @@ be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2024-10-26 Makoto Asai (event-V11-02-09)
|
||||
- Fixing event-V11-02-08 for forgotten deletion of trajectories.
|
||||
|
||||
## 2024-09-30 Makoto Asai (event-V11-02-08)
|
||||
- G4Event : Change the data member keepTheEvent mutable so that KeepTheEvent()
|
||||
method can be invoked for const G4Event object.
|
||||
|
||||
## 2024-08-01 Alberto Ribon (event-V11-02-07)
|
||||
- G4PrimaryTransformer : adapt and extend this class after the introduction of
|
||||
the new class G4ChargedUnknownParticle.
|
||||
( This is part of ATLAS and LHCb request to assign automatically
|
||||
ionisation and multiple scattering processes to charged primary particles
|
||||
with valid PDG code but not known to Geant4. )
|
||||
|
||||
## 2024-07-16 Gabriele Cosmo (event-V11-02-06)
|
||||
- Fixed reported Coverity defects: in G4GeneralParticleSourceMessenger for
|
||||
use of 'const auto&' and use of 'const G4String&'; in G4StackManager for
|
||||
copy/paste error in printout.
|
||||
|
||||
## 2024-06-28 Makoto Asai (event-V11-02-05)
|
||||
- Improve the use of Mutex lock in G4EventManager for sub-event parallel mode
|
||||
|
||||
## 2024-06-01 Makoto Asai (event-V11-02-04)
|
||||
- Initial implementation of creation/processing of SubEvents
|
||||
- Co-working with track-V11-02-03,
|
||||
|
||||
@@ -53,6 +53,7 @@ enum G4ClassificationOfNewTrack
|
||||
//----------------------------------------------------------------
|
||||
// following ENUM are available only for the sub-event parallelism
|
||||
//----------------------------------------------------------------
|
||||
fSubEvent_0=100,
|
||||
fSubEvent_1=101, fSubEvent_2=102, fSubEvent_3=103, fSubEvent_4=104,
|
||||
fSubEvent_5=105, fSubEvent_6=106, fSubEvent_7=107, fSubEvent_8=108,
|
||||
fSubEvent_9=109, fSubEvent_A=110, fSubEvent_B=111, fSubEvent_C=112,
|
||||
|
||||
@@ -98,7 +98,7 @@ class G4Event
|
||||
randomNumberStatusForProcessing = new G4String(st);
|
||||
validRandomNumberStatusForProcessing = true;
|
||||
}
|
||||
inline void KeepTheEvent(G4bool vl=true)
|
||||
inline void KeepTheEvent(G4bool vl=true) const
|
||||
{ keepTheEvent = vl; }
|
||||
inline G4bool KeepTheEventFlag() const
|
||||
{ return keepTheEvent; }
|
||||
@@ -142,7 +142,7 @@ class G4Event
|
||||
{ return numberOfPrimaryVertex; }
|
||||
// Returns number of primary verteces the G4Event object has.
|
||||
|
||||
inline G4PrimaryVertex* GetPrimaryVertex(G4int i=0) const
|
||||
inline G4PrimaryVertex* GetPrimaryVertex(G4int i=0) const
|
||||
{
|
||||
if( i == 0 )
|
||||
{ return thePrimaryVertex; }
|
||||
@@ -234,7 +234,7 @@ class G4Event
|
||||
G4bool validRandomNumberStatusForProcessing = false;
|
||||
|
||||
// Flag to keep the event until the end of run
|
||||
G4bool keepTheEvent = false;
|
||||
mutable G4bool keepTheEvent = false;
|
||||
mutable G4int grips = 0;
|
||||
|
||||
//========================= for sub-event parallelism
|
||||
@@ -242,10 +242,10 @@ class G4Event
|
||||
|
||||
public:
|
||||
G4SubEvent* PopSubEvent(G4int);
|
||||
// This method is to be invoked from G4RunManager.
|
||||
// This method is to be invoked from G4SubEvtRunManager.
|
||||
// SpawnSubEvent() is internally invoked.
|
||||
G4int TerminateSubEvent(G4SubEvent*);
|
||||
// This method is to be invoked from G4RunManager once a sub-event is
|
||||
// This method is to be invoked from G4SubEvtRunManager once a sub-event is
|
||||
// fully processed by a worker thread.
|
||||
|
||||
G4int StoreSubEvent(G4int,G4SubEvent*);
|
||||
@@ -289,9 +289,9 @@ class G4Event
|
||||
motherEvent = me;
|
||||
subEventType = ty;
|
||||
}
|
||||
G4Event* GetMotherEvent() const
|
||||
inline G4Event* GetMotherEvent() const
|
||||
{ return motherEvent; }
|
||||
G4int GetSubEventType() const
|
||||
inline G4int GetSubEventType() const
|
||||
{ return subEventType; }
|
||||
|
||||
private:
|
||||
|
||||
@@ -68,10 +68,6 @@ class G4EventManager
|
||||
void ProcessOneEvent(G4Event* anEvent);
|
||||
// This method is the main entry to this class for simulating an event.
|
||||
|
||||
void ProcessOneEventForSERM(G4Event* anEvent);
|
||||
// This method must be invoked by G4SubEventRunManager for processing
|
||||
// an event in the master thread, with Mutex lock
|
||||
|
||||
void ProcessOneEvent(G4TrackVector* trackVector, G4Event* anEvent= nullptr);
|
||||
// This is an alternative entry for HEP experiments which create G4Track
|
||||
// objects by themselves directly without using G4VPrimaryGenerator or a
|
||||
@@ -160,6 +156,7 @@ class G4EventManager
|
||||
subEventPara = true;
|
||||
subEventParaWorker = worker;
|
||||
}
|
||||
|
||||
G4SubEvent* PopSubEvent(G4int ty);
|
||||
// If this method is invoked by the G4RunManager while an event is still
|
||||
// in process. Null is returned if the sub-event does not have enough tracks.
|
||||
@@ -171,6 +168,11 @@ class G4EventManager
|
||||
// deleted after this method. All necessary information in "evt" must
|
||||
// be copied into the corresponding master G4Event object.
|
||||
|
||||
G4int StoreSubEvent(G4Event*, G4int&, G4SubEvent*);
|
||||
// This method is exclusively used by G4SubEventTrackStack class to
|
||||
// store a new G4SubEevnt into the current G4Event, with Mutex lock
|
||||
// shared with above two methods.
|
||||
|
||||
private:
|
||||
|
||||
void DoProcessing(G4Event* anEvent,
|
||||
|
||||
@@ -98,8 +98,8 @@ class G4GeneralParticleSourceMessenger: public G4UImessenger
|
||||
~G4GeneralParticleSourceMessenger() override;
|
||||
// Destructor: deletes commands
|
||||
|
||||
void IonCommand(G4String newValues);
|
||||
void IonLvlCommand(G4String newValues);
|
||||
void IonCommand(const G4String& newValues);
|
||||
void IonLvlCommand(const G4String& newValues);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -58,14 +58,18 @@ class G4PrimaryTransformer
|
||||
inline void SetVerboseLevel(G4int vl)
|
||||
{ verboseLevel = vl; }
|
||||
|
||||
void SetUnknnownParticleDefined(G4bool vl);
|
||||
// By invoking this method, the user can alter the treatment of unknown
|
||||
// particles. The ideal place to invoke this method is in the
|
||||
// BeginOfRunAction().
|
||||
void SetUnknownParticleDefined(G4bool vl);
|
||||
void SetChargedUnknownParticleDefined(G4bool vl);
|
||||
// By invoking these methods, the user can alter the treatment of,
|
||||
// respectively, 'unknown' and 'chargedunknown' particles.
|
||||
// The ideal place to invoke these methods is in the BeginOfRunAction().
|
||||
|
||||
inline G4bool GetUnknownParticleDefined() const
|
||||
{ return unknownParticleDefined; }
|
||||
|
||||
inline G4bool GetChargedUnknownParticleDefined() const
|
||||
{ return chargedUnknownParticleDefined; }
|
||||
|
||||
protected:
|
||||
|
||||
void GenerateTracks(G4PrimaryVertex* primaryVertex);
|
||||
@@ -96,11 +100,13 @@ class G4PrimaryTransformer
|
||||
G4ParticleTable* particleTable = nullptr;
|
||||
|
||||
G4ParticleDefinition* unknown = nullptr;
|
||||
G4ParticleDefinition* chargedunknown = nullptr;
|
||||
G4ParticleDefinition* opticalphoton = nullptr;
|
||||
G4int verboseLevel = 0;
|
||||
G4int trackID = 0;
|
||||
G4int nWarn = 0;
|
||||
G4bool unknownParticleDefined = false;
|
||||
G4bool chargedUnknownParticleDefined = false;
|
||||
G4bool opticalphotonDefined = false;
|
||||
|
||||
static G4double kETolerance;
|
||||
|
||||
@@ -133,6 +133,11 @@ void G4EventManager::DoProcessing(G4Event* anEvent,
|
||||
|
||||
#ifdef G4_STORE_TRAJECTORY
|
||||
trajectoryContainer = nullptr;
|
||||
// trajectoryContainer = currentEvent->GetTrajectoryContainer();
|
||||
// if(trajectoryContainer==nullptr) {
|
||||
// trajectoryContainer = new G4TrajectoryContainer;
|
||||
// currentEvent->SetTrajectoryContainer(trajectoryContainer);
|
||||
// }
|
||||
#endif
|
||||
|
||||
sdManager = G4SDManager::GetSDMpointerIfExist();
|
||||
@@ -375,6 +380,16 @@ void G4EventManager::TerminateSubEvent(const G4SubEvent* se,const G4Event* evt)
|
||||
#endif
|
||||
}
|
||||
|
||||
G4int G4EventManager::StoreSubEvent(G4Event* evt, G4int& subEvtType, G4SubEvent* se)
|
||||
{
|
||||
G4AutoLock lock(&EventMgrMutex);
|
||||
if(evt != currentEvent) {
|
||||
G4Exception("G4EventManager::StoreSubEvent","SubEvt1011", FatalException,
|
||||
"StoreSubEvent is invoked with a G4Event that is not the current event. PANIC!");
|
||||
}
|
||||
return evt->StoreSubEvent(subEvtType,se);
|
||||
}
|
||||
|
||||
void G4EventManager::StackTracks(G4TrackVector* trackVector,
|
||||
G4bool IDhasAlreadySet)
|
||||
{
|
||||
@@ -437,12 +452,6 @@ void G4EventManager::SetUserAction(G4UserSteppingAction* userAction)
|
||||
trackManager->SetUserAction(userAction);
|
||||
}
|
||||
|
||||
void G4EventManager::ProcessOneEventForSERM(G4Event* anEvent)
|
||||
{
|
||||
G4AutoLock lock(&EventMgrMutex);
|
||||
ProcessOneEvent(anEvent);
|
||||
}
|
||||
|
||||
void G4EventManager::ProcessOneEvent(G4Event* anEvent)
|
||||
{
|
||||
trackIDCounter = 0;
|
||||
|
||||
@@ -1419,7 +1419,7 @@ void G4GeneralParticleSourceMessenger::SetNewValue(G4UIcommand *command, G4Strin
|
||||
else if(command == applyEnergyWeightCmd1)
|
||||
{
|
||||
CHECKPG();
|
||||
auto eDisType = fParticleGun->GetEneDist()->GetEnergyDisType();
|
||||
const auto& eDisType = fParticleGun->GetEneDist()->GetEnergyDisType();
|
||||
if(eDisType != "Lin")
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
@@ -1522,7 +1522,7 @@ G4String G4GeneralParticleSourceMessenger::GetCurrentValue(G4UIcommand* command)
|
||||
return cv;
|
||||
}
|
||||
|
||||
void G4GeneralParticleSourceMessenger::IonCommand(G4String newValues)
|
||||
void G4GeneralParticleSourceMessenger::IonCommand(const G4String& newValues)
|
||||
{
|
||||
if (fShootIon)
|
||||
{
|
||||
@@ -1571,7 +1571,7 @@ void G4GeneralParticleSourceMessenger::IonCommand(G4String newValues)
|
||||
}
|
||||
}
|
||||
|
||||
void G4GeneralParticleSourceMessenger::IonLvlCommand(G4String newValues)
|
||||
void G4GeneralParticleSourceMessenger::IonLvlCommand(const G4String& newValues)
|
||||
{
|
||||
if (fShootIon)
|
||||
{
|
||||
|
||||
@@ -54,10 +54,12 @@ void G4PrimaryTransformer::CheckUnknown()
|
||||
{
|
||||
unknown = particleTable->FindParticle("unknown");
|
||||
unknownParticleDefined = unknown != nullptr;
|
||||
chargedunknown = particleTable->FindParticle("chargedunknown");
|
||||
chargedUnknownParticleDefined = chargedunknown != nullptr;
|
||||
opticalphoton = particleTable->FindParticle("opticalphoton");
|
||||
opticalphotonDefined = opticalphoton != nullptr;
|
||||
}
|
||||
|
||||
|
||||
G4TrackVector*
|
||||
G4PrimaryTransformer::GimmePrimaries(G4Event* anEvent, G4int trackIDCounter)
|
||||
{
|
||||
@@ -348,7 +350,7 @@ SetDecayProducts(G4PrimaryParticle* mother, G4DynamicParticle* motherDP)
|
||||
}
|
||||
}
|
||||
|
||||
void G4PrimaryTransformer::SetUnknnownParticleDefined(G4bool vl)
|
||||
void G4PrimaryTransformer::SetUnknownParticleDefined(G4bool vl)
|
||||
{
|
||||
unknownParticleDefined = vl;
|
||||
if(unknownParticleDefined && (unknown == nullptr))
|
||||
@@ -360,6 +362,18 @@ void G4PrimaryTransformer::SetUnknnownParticleDefined(G4bool vl)
|
||||
}
|
||||
}
|
||||
|
||||
void G4PrimaryTransformer::SetChargedUnknownParticleDefined(G4bool vl)
|
||||
{
|
||||
chargedUnknownParticleDefined = vl;
|
||||
if(chargedUnknownParticleDefined && (chargedunknown == nullptr))
|
||||
{
|
||||
G4cerr << "chargedUnknownParticleDefined cannot be set true because" << G4endl
|
||||
<< "G4ChargedUnknownParticle is not defined in the physics list." << G4endl
|
||||
<< "Command ignored." << G4endl;
|
||||
chargedUnknownParticleDefined = false;
|
||||
}
|
||||
}
|
||||
|
||||
G4bool G4PrimaryTransformer::CheckDynamicParticle(G4DynamicParticle* DP)
|
||||
{
|
||||
if(IsGoodForTrack(DP->GetDefinition())) return true;
|
||||
@@ -384,9 +398,16 @@ G4PrimaryTransformer::GetDefinition(G4PrimaryParticle* pp)
|
||||
{
|
||||
partDef = particleTable->FindParticle(pp->GetPDGcode());
|
||||
}
|
||||
if(unknownParticleDefined && ((partDef == nullptr)||partDef->IsShortLived()))
|
||||
if((partDef == nullptr) || partDef->IsShortLived())
|
||||
{
|
||||
partDef = unknown;
|
||||
if (chargedUnknownParticleDefined && pp->GetCharge()!=0.0)
|
||||
{
|
||||
partDef = chargedunknown;
|
||||
}
|
||||
else if (unknownParticleDefined)
|
||||
{
|
||||
partDef = unknown;
|
||||
}
|
||||
}
|
||||
return partDef;
|
||||
}
|
||||
|
||||
@@ -592,7 +592,7 @@ TransferOneStackedTrack(G4ClassificationOfNewTrack origin,
|
||||
else
|
||||
{
|
||||
G4ExceptionDescription ED;
|
||||
ED << "Invalid origin stack ID " << origin;
|
||||
ED << "Invalid destination stack ID " << destination;
|
||||
G4Exception("G4StackManager::TransferStackedTracks","Stack0911",
|
||||
FatalException, ED);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "G4Track.hh"
|
||||
#include "G4VTrajectory.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4EventManager.hh"
|
||||
|
||||
G4SubEventTrackStack::~G4SubEventTrackStack()
|
||||
{
|
||||
@@ -71,7 +72,8 @@ void G4SubEventTrackStack::PushToStack(const G4StackedTrack& aStackedTrack)
|
||||
else if(fCurrentSE->size()==fMaxEnt)
|
||||
{
|
||||
// current sus-event is already full. Transfer it to G4Event and create a new sub-event.
|
||||
auto nSubEv = fCurrentEvent->StoreSubEvent(fSubEventType,fCurrentSE);
|
||||
auto nSubEv = G4EventManager::GetEventManager()
|
||||
->StoreSubEvent(fCurrentEvent,fSubEventType,fCurrentSE);
|
||||
if(verboseLevel>1)
|
||||
{
|
||||
G4cout << "### event id " << fCurrentEvent->GetEventID()
|
||||
@@ -107,7 +109,8 @@ void G4SubEventTrackStack::ReleaseSubEvent()
|
||||
}
|
||||
if(fCurrentSE!=nullptr)
|
||||
{
|
||||
auto nSubEv = fCurrentEvent->StoreSubEvent(fSubEventType,fCurrentSE);
|
||||
auto nSubEv = G4EventManager::GetEventManager()
|
||||
->StoreSubEvent(fCurrentEvent,fSubEventType,fCurrentSE);
|
||||
if(verboseLevel>1)
|
||||
{
|
||||
G4cout << "### event id " << fCurrentEvent->GetEventID()
|
||||
|
||||
Reference in New Issue
Block a user