Import Geant4 10.4.0.beta source tree
This commit is contained in:
@@ -79,12 +79,16 @@ TSRun::~TSRun()
|
||||
{
|
||||
//--- Clear HitsMap for RUN
|
||||
for(unsigned i = 0; i < fRunMaps.size(); ++i)
|
||||
fRunMaps[i]->clear();
|
||||
delete fRunMaps[i];
|
||||
|
||||
if(!G4Threading::IsWorkerThread())
|
||||
{
|
||||
for(unsigned i = 0; i < fAtomicRunMaps.size(); ++i)
|
||||
fAtomicRunMaps[i]->clear();
|
||||
delete fAtomicRunMaps[i];
|
||||
|
||||
fAtomicRunMaps.clear();
|
||||
fMutexRunMaps.clear();
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -103,38 +107,39 @@ void TSRun::ConstructMFD(const G4String& mfdName)
|
||||
//
|
||||
if ( mfd )
|
||||
{
|
||||
//--- Loop over the registered primitive scorers.
|
||||
for (G4int icol = 0; icol < mfd->GetNumberOfPrimitives(); icol++){
|
||||
// Get Primitive Scorer object.
|
||||
G4VPrimitiveScorer* scorer = mfd->GetPrimitive(icol);
|
||||
// collection name and collectionID for HitsCollection,
|
||||
// where type of HitsCollection is G4THitsMap in case
|
||||
// of primitive scorer.
|
||||
// The collection name is given by <MFD name>/<Primitive
|
||||
// Scorer name>.
|
||||
G4String collectionName = scorer->GetName();
|
||||
G4String fullCollectionName = mfdName+"/"+collectionName;
|
||||
G4int collectionID = SDman->GetCollectionID(fullCollectionName);
|
||||
//
|
||||
if ( collectionID >= 0 ){
|
||||
G4cout << "++ " << fullCollectionName<< " id " << collectionID
|
||||
<< G4endl;
|
||||
// Store obtained HitsCollection information into data members.
|
||||
// And, creates new G4THitsMap for accumulating quantities during RUN.
|
||||
fCollNames.push_back(fullCollectionName);
|
||||
fCollIDs.push_back(collectionID);
|
||||
fRunMaps.push_back(new G4THitsMap<G4double>(mfdName,
|
||||
collectionName));
|
||||
if(!G4Threading::IsWorkerThread())
|
||||
{
|
||||
fAtomicRunMaps.push_back(new G4TAtomicHitsMap<G4double>
|
||||
(mfdName, collectionName));
|
||||
}
|
||||
} else {
|
||||
G4cout << "** collection " << fullCollectionName << " not found. "
|
||||
<<G4endl;
|
||||
}
|
||||
//--- Loop over the registered primitive scorers.
|
||||
for (G4int icol = 0; icol < mfd->GetNumberOfPrimitives(); icol++){
|
||||
// Get Primitive Scorer object.
|
||||
G4VPrimitiveScorer* scorer = mfd->GetPrimitive(icol);
|
||||
// collection name and collectionID for HitsCollection,
|
||||
// where type of HitsCollection is G4THitsMap in case
|
||||
// of primitive scorer.
|
||||
// The collection name is given by <MFD name>/<Primitive
|
||||
// Scorer name>.
|
||||
G4String collectionName = scorer->GetName();
|
||||
G4String fullCollectionName = mfdName+"/"+collectionName;
|
||||
G4int collectionID = SDman->GetCollectionID(fullCollectionName);
|
||||
//
|
||||
if ( collectionID >= 0 ){
|
||||
G4cout << "++ " << fullCollectionName<< " id " << collectionID
|
||||
<< G4endl;
|
||||
// Store obtained HitsCollection information into data members.
|
||||
// And, creates new G4THitsMap for accumulating quantities during RUN.
|
||||
fCollNames.push_back(fullCollectionName);
|
||||
fCollIDs.push_back(collectionID);
|
||||
fRunMaps.push_back(new G4THitsMap<G4double>(mfdName,
|
||||
collectionName));
|
||||
if(!G4Threading::IsWorkerThread())
|
||||
{
|
||||
fAtomicRunMaps.push_back(new G4TAtomicHitsMap<G4double>
|
||||
(mfdName, collectionName));
|
||||
fMutexRunMaps[fCollNames[collectionID]].clear();
|
||||
}
|
||||
} else {
|
||||
G4cout << "** collection " << fullCollectionName << " not found. "
|
||||
<<G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -146,7 +151,7 @@ void TSRun::ConstructMFD(const G4String& mfdName)
|
||||
// is accumulated during a TSRun.
|
||||
void TSRun::RecordEvent(const G4Event* aEvent)
|
||||
{
|
||||
numberOfEvent++; // This is an original line.
|
||||
G4Run::RecordEvent(aEvent);
|
||||
|
||||
//=============================
|
||||
// HitsCollection of This Event
|
||||
@@ -176,10 +181,9 @@ void TSRun::RecordEvent(const G4Event* aEvent)
|
||||
static G4Mutex mtx = G4MUTEX_INITIALIZER;
|
||||
{
|
||||
G4AutoLock lock(&mtx);
|
||||
auto itr = EvtMap->GetMap()->begin();
|
||||
for(; itr != EvtMap->GetMap()->end(); itr++)
|
||||
for(const auto& itr : *EvtMap)
|
||||
{
|
||||
fMutexRunMaps[fCollNames[fCollID]][itr->first] += *itr->second;
|
||||
fMutexRunMaps[fCollNames[fCollID]][itr.first] += *itr.second;
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------//
|
||||
@@ -187,8 +191,6 @@ void TSRun::RecordEvent(const G4Event* aEvent)
|
||||
|
||||
}
|
||||
|
||||
G4Run::RecordEvent(aEvent);
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -250,7 +252,7 @@ TSRun::MutexHitsMap_t*
|
||||
TSRun::GetMutexHitsMap(const G4String& collName) const
|
||||
{
|
||||
if(fMutexRunMaps.find(collName) != fMutexRunMaps.end())
|
||||
return &fMutexRunMaps[collName];
|
||||
return &fMutexRunMaps[collName];
|
||||
|
||||
G4Exception("TSRun", collName.c_str(), JustWarning,
|
||||
"GetHitsMap failed to locate the requested MutexHitsMap");
|
||||
|
||||
Reference in New Issue
Block a user