Import Geant4 11.3.0.beta source tree
This commit is contained in:
@@ -39,7 +39,6 @@
|
||||
#include "G4Run.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4ScoringManager.hh"
|
||||
#include "G4TiMemory.hh"
|
||||
#include "G4Timer.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
@@ -56,6 +55,8 @@
|
||||
#include "G4WorkerRunManagerKernel.hh"
|
||||
#include "G4WorkerThread.hh"
|
||||
|
||||
#include "G4GeometryManager.hh" // For parallel geometry initialisation
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
@@ -137,10 +138,20 @@ void G4WorkerRunManager::InitializeGeometry()
|
||||
"G4VUserDetectorConstruction is not defined!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (fGeometryHasBeenDestroyed) {
|
||||
G4TransportationManager::GetTransportationManager()->ClearParallelWorlds();
|
||||
}
|
||||
|
||||
// Step 0: Contribute to the voxelisation of the geometry
|
||||
if( G4GeometryManager::IsParallelOptimisationConfigured() ) {
|
||||
G4cout << "G4RunManager::InitializeGeometry calling GeometryManager's UndertakeOptimisation"
|
||||
<< G4endl; // TODO - suppress / delete this in final version
|
||||
G4GeometryManager::GetInstance()->UndertakeOptimisation();
|
||||
}
|
||||
// A barrier must ensure that all that all threads have finished this work.
|
||||
// Currently we rely on the (later) barrier at the end of initialisation.
|
||||
|
||||
// Step1: Get pointer to the physiWorld (note: needs to get the "super
|
||||
// pointer, i.e. the one shared by all threads"
|
||||
G4RunManagerKernel* masterKernel = G4MTRunManager::GetMasterRunManagerKernel();
|
||||
@@ -217,10 +228,6 @@ void G4WorkerRunManager::RunInitialization()
|
||||
}
|
||||
if (userRunAction != nullptr) userRunAction->BeginOfRunAction(currentRun);
|
||||
|
||||
#if defined(GEANT4_USE_TIMEMORY)
|
||||
workerRunProfiler.reset(new ProfilerConfig(currentRun));
|
||||
#endif
|
||||
|
||||
if (isScoreNtupleWriter) {
|
||||
G4VScoreNtupleWriter::Instance()->OpenFile();
|
||||
}
|
||||
@@ -408,22 +415,51 @@ G4Event* G4WorkerRunManager::GenerateEvent(G4int i_event)
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
void G4WorkerRunManager::MergePartialResults()
|
||||
void G4WorkerRunManager::MergePartialResults(G4bool mergeEvents)
|
||||
{
|
||||
// Merge partial results into global run
|
||||
G4MTRunManager* mtRM = G4MTRunManager::GetMasterRunManager();
|
||||
G4ScoringManager* ScM = G4ScoringManager::GetScoringManagerIfExist();
|
||||
if (ScM != nullptr) mtRM->MergeScores(ScM);
|
||||
mtRM->MergeRun(currentRun);
|
||||
/************************** MAMAMAMAMA
|
||||
if(mergeEvents) {
|
||||
G4int ctr = 0;
|
||||
G4int ctrD = 0;
|
||||
G4int ctrK = 0;
|
||||
G4int ctrG = 0;
|
||||
auto eventVector = currentRun->GetEventVector();
|
||||
if(eventVector!=nullptr || !(eventVector->empty())) {
|
||||
auto eItr = eventVector->cbegin();
|
||||
while(eItr != eventVector->cend())
|
||||
{
|
||||
ctr++;
|
||||
const G4Event* ev = *eItr;
|
||||
if(ev->ToBeKept()) { ctrD++; }
|
||||
if(ev->KeepTheEventFlag()) { ctrK++; }
|
||||
if(ev->GetNumberOfGrips()>0) { ctrG++; }
|
||||
eItr++;
|
||||
}
|
||||
// if(!(ev->ToBeKept()))
|
||||
// {
|
||||
// ReportEventDeletion(ev);
|
||||
// delete ev;
|
||||
// eItr = eventVector->erase(eItr);
|
||||
// ctrD++;
|
||||
// }
|
||||
// else
|
||||
// { eItr++; }
|
||||
// }
|
||||
}
|
||||
G4cout<<"MAMAMAMAMA ctr="<<ctr<<" - ctrD="<<ctrD<<" - ctrK="<<ctrK<<" - ctrG="<<ctrG<<G4endl;
|
||||
}
|
||||
********************************/
|
||||
if(mergeEvents) mtRM->MergeRun(currentRun);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
void G4WorkerRunManager::RunTermination()
|
||||
{
|
||||
if (!fakeRun) {
|
||||
#if defined(GEANT4_USE_TIMEMORY)
|
||||
workerRunProfiler.reset();
|
||||
#endif
|
||||
MergePartialResults();
|
||||
|
||||
// Call a user hook: note this is before the next barrier
|
||||
|
||||
Reference in New Issue
Block a user