Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
+64 -37
View File
@@ -27,10 +27,10 @@
/// \brief Implementation of the B02Run class
//
//
// $Id$
// $Id: B02Run.cc 77475 2013-11-25 09:38:51Z gcosmo $
//
//=====================================================================
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
// (Description)
// B02Run Class is for accumulating scored quantities which is
@@ -48,14 +48,14 @@
//
// The resultant information is kept inside B02Run objects as
// data members.
// std::vector<G4String> theCollName; // Collection Name,
// std::vector<G4int> theCollID; // Collection ID,
// std::vector<G4THitsMap<G4double>*> theRunMap; // HitsMap for RUN.
// std::vector<G4String> fCollName; // Collection Name,
// std::vector<G4int> fCollID; // Collection ID,
// std::vector<G4THitsMap<G4double>*> fRunMap; // HitsMap for RUN.
//
// The resualtant HitsMap objects are obtain using access method,
// GetHitsMap(..).
//
//=====================================================================
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "B02Run.hh"
#include "G4SDManager.hh"
@@ -64,6 +64,7 @@
#include "G4VPrimitiveScorer.hh"
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// Constructor.
// (The vector of MultiFunctionalDetector name has to given.)
B02Run::B02Run(const std::vector<G4String> mfdName): G4Run()
@@ -81,48 +82,53 @@ B02Run::B02Run(const std::vector<G4String> mfdName): G4Run()
(G4MultiFunctionalDetector*)(SDman->FindSensitiveDetector(detName));
//
if ( mfd ){
//--- Loop over the registered primitive scorers.
//--- Loop over the registered primitive scorers.
for (G4int icol = 0; icol < mfd->GetNumberOfPrimitives(); icol++){
// Get Primitive Scorer object.
// 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>.
// 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 = detName+"/"+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.
theCollName.push_back(fullCollectionName);
theCollID.push_back(collectionID);
theRunMap.push_back(new G4THitsMap<G4double>(detName,collectionName));
G4cout << "++ "<<fullCollectionName<< " id " << collectionID
<< G4endl;
// Store obtained HitsCollection information into data members.
// And, creates new G4THitsMap for accumulating quantities during RUN.
fCollName.push_back(fullCollectionName);
fCollID.push_back(collectionID);
fRunMap.push_back(new G4THitsMap<G4double>(detName
,collectionName));
}else{
G4cout << "** collection " << fullCollectionName << " not found. "<<G4endl;
G4cout << "** collection " << fullCollectionName
<< " not found. "<<G4endl;
}
}
}
}
}
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// Destructor
// clear all data members.
B02Run::~B02Run()
{
//--- Clear HitsMap for RUN
G4int Nmap = theRunMap.size();
G4int Nmap = fRunMap.size();
for ( G4int i = 0; i < Nmap; i++){
if(theRunMap[i] ) theRunMap[i]->clear();
if(fRunMap[i] ) fRunMap[i]->clear();
}
theCollName.clear();
theCollID.clear();
theRunMap.clear();
fCollName.clear();
fCollID.clear();
fRunMap.clear();
}
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// RecordEvent is called at end of event.
// For scoring purpose, the resultant quantity in a event,
// is accumulated during a Run.
@@ -135,20 +141,21 @@ void B02Run::RecordEvent(const G4Event* aEvent)
//============================
G4HCofThisEvent* HCE = aEvent->GetHCofThisEvent();
if (!HCE) return;
//=======================================================
// Sum up HitsMap of this Event into HitsMap of this RUN
//=======================================================
G4int Ncol = theCollID.size();
G4int Ncol = fCollID.size();
for ( G4int i = 0; i < Ncol ; i++ ){ // Loop over HitsCollection
G4THitsMap<G4double>* EvtMap=0;
if ( theCollID[i] >= 0 ){ // Collection is attached to HCE
EvtMap = (G4THitsMap<G4double>*)(HCE->GetHC(theCollID[i]));
if ( fCollID[i] >= 0 ){ // Collection is attached to HCE
EvtMap = (G4THitsMap<G4double>*)(HCE->GetHC(fCollID[i]));
}else{
G4cout <<" Error EvtMap Not Found "<< i << G4endl;
}
if ( EvtMap ) {
//=== Sum up HitsMap of this event to HitsMap of RUN.===
*theRunMap[i] += *EvtMap;
*fRunMap[i] += *EvtMap;
//======================================================
}
}
@@ -156,7 +163,8 @@ void B02Run::RecordEvent(const G4Event* aEvent)
}
//=================================================================
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
// Access method for HitsMap of the RUN
//
//-----
@@ -165,7 +173,6 @@ void B02Run::RecordEvent(const G4Event* aEvent)
G4THitsMap<G4double>* B02Run::GetHitsMap(const G4String& detName,
const G4String& colName){
G4String fullName = detName+"/"+colName;
G4cout << " getting hits map " << fullName << G4endl;
return GetHitsMap(fullName);
}
@@ -174,17 +181,17 @@ G4THitsMap<G4double>* B02Run::GetHitsMap(const G4String& detName,
// By full description of collection name, that is
// <MultiFunctional Detector Name>/<Primitive Scorer Name>
G4THitsMap<G4double>* B02Run::GetHitsMap(const G4String& fullName){
G4cout << " getting hits map " << fullName << G4endl;
G4int Ncol = theCollName.size();
G4int Ncol = fCollName.size();
for ( G4int i = 0; i < Ncol; i++){
if ( theCollName[i] == fullName ){
return theRunMap[i];
if ( fCollName[i] == fullName ){
return fRunMap[i];
}
}
return NULL;
}
//-----
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// - Dump All HitsMap of this RUN. (for debuging and monitoring of quantity).
// This method calls G4THisMap::PrintAll() for individual HitsMap.
void B02Run::DumpAllScorer(){
@@ -209,3 +216,23 @@ void B02Run::DumpAllScorer(){
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B02Run::Merge(const G4Run* aRun)
{
const B02Run * localRun = static_cast<const B02Run *>(aRun);
//=======================================================
// Merge HitsMap of working threads
//=======================================================
G4int nCol = localRun->fCollID.size();
for ( G4int i = 0; i < nCol ; i++ ){ // Loop over HitsCollection
if ( localRun->fCollID[i] >= 0 ){
*fRunMap[i] += *localRun->fRunMap[i];
}
}
G4Run::Merge(aRun);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......