Import Geant4 10.3.0 source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# $Id: CMakeLists.txt 86065 2014-11-07 08:51:15Z gcosmo $
|
||||
# $Id: CMakeLists.txt 100923 2016-11-03 10:50:34Z gcosmo $
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Setup the project
|
||||
@@ -46,9 +46,7 @@ target_link_libraries(exampleB4d ${Geant4_LIBRARIES})
|
||||
set(EXAMPLEB4D_SCRIPTS
|
||||
exampleB4d.out
|
||||
exampleB4.in
|
||||
icons.mac
|
||||
gui.mac
|
||||
run.png
|
||||
init_vis.mac
|
||||
run1.mac
|
||||
run2.mac
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: exampleB4d.cc 94808 2015-12-10 08:22:26Z gcosmo $
|
||||
// $Id: exampleB4d.cc 100946 2016-11-03 11:28:08Z gcosmo $
|
||||
//
|
||||
/// \file exampleB4d.cc
|
||||
/// \brief Main program of the B4d example
|
||||
@@ -90,7 +90,7 @@ int main(int argc,char** argv)
|
||||
|
||||
// Detect interactive mode (if no macro provided) and define UI session
|
||||
//
|
||||
G4UIExecutive* ui = 0;
|
||||
G4UIExecutive* ui = nullptr;
|
||||
if ( ! macro.size() ) {
|
||||
ui = new G4UIExecutive(argc, argv, session);
|
||||
}
|
||||
@@ -102,34 +102,33 @@ int main(int argc,char** argv)
|
||||
// Construct the MT run manager
|
||||
//
|
||||
#ifdef G4MULTITHREADED
|
||||
G4MTRunManager * runManager = new G4MTRunManager;
|
||||
auto runManager = new G4MTRunManager;
|
||||
if ( nThreads > 0 ) {
|
||||
runManager->SetNumberOfThreads(nThreads);
|
||||
}
|
||||
#else
|
||||
G4RunManager * runManager = new G4RunManager;
|
||||
auto runManager = new G4RunManager;
|
||||
#endif
|
||||
|
||||
// Set mandatory initialization classes
|
||||
//
|
||||
B4dDetectorConstruction* detConstruction = new B4dDetectorConstruction();
|
||||
auto detConstruction = new B4dDetectorConstruction();
|
||||
runManager->SetUserInitialization(detConstruction);
|
||||
|
||||
G4VModularPhysicsList* physicsList = new FTFP_BERT;
|
||||
auto physicsList = new FTFP_BERT;
|
||||
runManager->SetUserInitialization(physicsList);
|
||||
|
||||
B4dActionInitialization* actionInitialization
|
||||
= new B4dActionInitialization();
|
||||
auto actionInitialization = new B4dActionInitialization();
|
||||
runManager->SetUserInitialization(actionInitialization);
|
||||
|
||||
// Initialize visualization
|
||||
G4VisManager* visManager = new G4VisExecutive;
|
||||
auto visManager = new G4VisExecutive;
|
||||
// G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
|
||||
// G4VisManager* visManager = new G4VisExecutive("Quiet");
|
||||
visManager->Initialize();
|
||||
|
||||
// Get the pointer to the User Interface manager
|
||||
G4UImanager* UImanager = G4UImanager::GetUIpointer();
|
||||
auto UImanager = G4UImanager::GetUIpointer();
|
||||
|
||||
// Process macro or start UI session
|
||||
//
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,10 +3,6 @@
|
||||
# the menu bar of the G4UIXm, G4UIQt, G4UIWin32 sessions.
|
||||
# It has no effect with G4UIterminal.
|
||||
#
|
||||
# Add icons of general interest
|
||||
#
|
||||
/control/execute icons.mac
|
||||
#
|
||||
# File menu :
|
||||
/gui/addMenu file File
|
||||
/gui/addButton file Quit exit
|
||||
@@ -46,5 +42,3 @@
|
||||
# To limit the output flow in the "dump" widget :
|
||||
/run/printProgress 100
|
||||
#
|
||||
# User defined icon :
|
||||
/gui/addIcon "Run beam on" user_icon "/run/beamOn 1" run.png
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B4Analysis.hh 68058 2013-03-13 14:47:43Z gcosmo $
|
||||
// $Id: B4Analysis.hh 100946 2016-11-03 11:28:08Z gcosmo $
|
||||
//
|
||||
/// \file B4Analysis.hh
|
||||
/// \brief Selection of the analysis technology
|
||||
@@ -32,6 +32,7 @@
|
||||
#define B4Analysis_h 1
|
||||
|
||||
#include "g4root.hh"
|
||||
//#include "g4cvs.hh"
|
||||
//#include "g4xml.hh"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B4PrimaryGeneratorAction.cc 75215 2013-10-29 16:07:06Z gcosmo $
|
||||
// $Id: B4PrimaryGeneratorAction.cc 100946 2016-11-03 11:28:08Z gcosmo $
|
||||
//
|
||||
/// \file B4PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the B4PrimaryGeneratorAction class
|
||||
@@ -45,14 +45,14 @@
|
||||
|
||||
B4PrimaryGeneratorAction::B4PrimaryGeneratorAction()
|
||||
: G4VUserPrimaryGeneratorAction(),
|
||||
fParticleGun(0)
|
||||
fParticleGun(nullptr)
|
||||
{
|
||||
G4int nofParticles = 1;
|
||||
fParticleGun = new G4ParticleGun(nofParticles);
|
||||
|
||||
// default particle kinematic
|
||||
//
|
||||
G4ParticleDefinition* particleDefinition
|
||||
auto particleDefinition
|
||||
= G4ParticleTable::GetParticleTable()->FindParticle("e-");
|
||||
fParticleGun->SetParticleDefinition(particleDefinition);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
|
||||
@@ -73,20 +73,24 @@ void B4PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
// This function is called at the begining of event
|
||||
|
||||
// In order to avoid dependence of PrimaryGeneratorAction
|
||||
// on DetectorConstruction class we get world volume
|
||||
// on DetectorConstruction class we get world volume
|
||||
// from G4LogicalVolumeStore
|
||||
//
|
||||
G4double worldZHalfLength = 0;
|
||||
G4LogicalVolume* worlLV
|
||||
= G4LogicalVolumeStore::GetInstance()->GetVolume("World");
|
||||
G4Box* worldBox = 0;
|
||||
if ( worlLV) worldBox = dynamic_cast< G4Box*>(worlLV->GetSolid());
|
||||
G4double worldZHalfLength = 0.;
|
||||
auto worldLV = G4LogicalVolumeStore::GetInstance()->GetVolume("World");
|
||||
|
||||
// Check that the world volume has box shape
|
||||
G4Box* worldBox = nullptr;
|
||||
if ( worldLV ) {
|
||||
worldBox = dynamic_cast<G4Box*>(worldLV->GetSolid());
|
||||
}
|
||||
|
||||
if ( worldBox ) {
|
||||
worldZHalfLength = worldBox->GetZHalfLength();
|
||||
}
|
||||
else {
|
||||
G4ExceptionDescription msg;
|
||||
msg << "World volume of box not found." << G4endl;
|
||||
msg << "World volume of box shape not found." << G4endl;
|
||||
msg << "Perhaps you have changed geometry." << G4endl;
|
||||
msg << "The gun will be place in the center.";
|
||||
G4Exception("B4PrimaryGeneratorAction::GeneratePrimaries()",
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B4RunAction.cc 87359 2014-12-01 16:04:27Z gcosmo $
|
||||
// $Id: B4RunAction.cc 100946 2016-11-03 11:28:08Z gcosmo $
|
||||
//
|
||||
/// \file B4RunAction.cc
|
||||
/// \brief Implementation of the B4RunAction class
|
||||
@@ -47,23 +47,24 @@ B4RunAction::B4RunAction()
|
||||
// Create analysis manager
|
||||
// The choice of analysis technology is done via selectin of a namespace
|
||||
// in B4Analysis.hh
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
G4cout << "Using " << analysisManager->GetType() << G4endl;
|
||||
|
||||
// Create directories
|
||||
//analysisManager->SetHistoDirectoryName("histograms");
|
||||
//analysisManager->SetNtupleDirectoryName("ntuple");
|
||||
analysisManager->SetVerboseLevel(1);
|
||||
analysisManager->SetFirstHistoId(1);
|
||||
analysisManager->SetNtupleMerging(true);
|
||||
// Note: merging ntuples is available only with Root output
|
||||
|
||||
// Book histograms, ntuple
|
||||
//
|
||||
|
||||
// Creating histograms
|
||||
analysisManager->CreateH1("1","Edep in absorber", 100, 0., 800*MeV);
|
||||
analysisManager->CreateH1("2","Edep in gap", 100, 0., 100*MeV);
|
||||
analysisManager->CreateH1("3","trackL in absorber", 100, 0., 1*m);
|
||||
analysisManager->CreateH1("4","trackL in gap", 100, 0., 50*cm);
|
||||
analysisManager->CreateH1("Eabs","Edep in absorber", 100, 0., 800*MeV);
|
||||
analysisManager->CreateH1("Egap","Edep in gap", 100, 0., 100*MeV);
|
||||
analysisManager->CreateH1("Labs","trackL in absorber", 100, 0., 1*m);
|
||||
analysisManager->CreateH1("Lgap","trackL in gap", 100, 0., 50*cm);
|
||||
|
||||
// Creating ntuple
|
||||
//
|
||||
@@ -90,7 +91,7 @@ void B4RunAction::BeginOfRunAction(const G4Run* /*run*/)
|
||||
//G4RunManager::GetRunManager()->SetRandomNumberStore(true);
|
||||
|
||||
// Get analysis manager
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
// Open an output file
|
||||
//
|
||||
@@ -104,7 +105,7 @@ void B4RunAction::EndOfRunAction(const G4Run* /*run*/)
|
||||
{
|
||||
// print histogram statistics
|
||||
//
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
if ( analysisManager->GetH1(1) ) {
|
||||
G4cout << G4endl << " ----> print histograms statistic ";
|
||||
if(isMaster) {
|
||||
@@ -115,31 +116,30 @@ void B4RunAction::EndOfRunAction(const G4Run* /*run*/)
|
||||
}
|
||||
|
||||
G4cout << " EAbs : mean = "
|
||||
<< G4BestUnit(analysisManager->GetH1(0)->mean(), "Energy")
|
||||
<< " rms = "
|
||||
<< G4BestUnit(analysisManager->GetH1(0)->rms(), "Energy") << G4endl;
|
||||
|
||||
G4cout << " EGap : mean = "
|
||||
<< G4BestUnit(analysisManager->GetH1(1)->mean(), "Energy")
|
||||
<< " rms = "
|
||||
<< G4BestUnit(analysisManager->GetH1(1)->rms(), "Energy") << G4endl;
|
||||
|
||||
G4cout << " EGap : mean = "
|
||||
<< G4BestUnit(analysisManager->GetH1(2)->mean(), "Energy")
|
||||
<< " rms = "
|
||||
<< G4BestUnit(analysisManager->GetH1(2)->rms(), "Energy") << G4endl;
|
||||
|
||||
G4cout << " LAbs : mean = "
|
||||
<< G4BestUnit(analysisManager->GetH1(2)->mean(), "Length")
|
||||
<< " rms = "
|
||||
<< G4BestUnit(analysisManager->GetH1(2)->rms(), "Length") << G4endl;
|
||||
|
||||
G4cout << " LGap : mean = "
|
||||
<< G4BestUnit(analysisManager->GetH1(3)->mean(), "Length")
|
||||
<< " rms = "
|
||||
<< G4BestUnit(analysisManager->GetH1(3)->rms(), "Length") << G4endl;
|
||||
|
||||
G4cout << " LGap : mean = "
|
||||
<< G4BestUnit(analysisManager->GetH1(4)->mean(), "Length")
|
||||
<< " rms = "
|
||||
<< G4BestUnit(analysisManager->GetH1(4)->rms(), "Length") << G4endl;
|
||||
}
|
||||
|
||||
// save histograms & ntuple
|
||||
//
|
||||
analysisManager->Write();
|
||||
analysisManager->CloseFile();
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B4dDetectorConstruction.cc 87359 2014-12-01 16:04:27Z gcosmo $
|
||||
// $Id: B4dDetectorConstruction.cc 101905 2016-12-07 11:34:39Z gunter $
|
||||
//
|
||||
/// \file B4dDetectorConstruction.cc
|
||||
/// \brief Implementation of the B4dDetectorConstruction class
|
||||
@@ -88,7 +88,7 @@ G4VPhysicalVolume* B4dDetectorConstruction::Construct()
|
||||
void B4dDetectorConstruction::DefineMaterials()
|
||||
{
|
||||
// Lead material defined using NIST Manager
|
||||
G4NistManager* nistManager = G4NistManager::Instance();
|
||||
auto nistManager = G4NistManager::Instance();
|
||||
nistManager->FindOrBuildMaterial("G4_Pb");
|
||||
|
||||
// Liquid argon material
|
||||
@@ -111,20 +111,20 @@ void B4dDetectorConstruction::DefineMaterials()
|
||||
G4VPhysicalVolume* B4dDetectorConstruction::DefineVolumes()
|
||||
{
|
||||
// Geometry parameters
|
||||
G4int nofLayers = 10;
|
||||
G4double absoThickness = 10.*mm;
|
||||
G4double gapThickness = 5.*mm;
|
||||
G4double calorSizeXY = 10.*cm;
|
||||
G4int nofLayers = 10;
|
||||
G4double absoThickness = 10.*mm;
|
||||
G4double gapThickness = 5.*mm;
|
||||
G4double calorSizeXY = 10.*cm;
|
||||
|
||||
G4double layerThickness = absoThickness + gapThickness;
|
||||
G4double calorThickness = nofLayers * layerThickness;
|
||||
G4double worldSizeXY = 1.2 * calorSizeXY;
|
||||
G4double worldSizeZ = 1.2 * calorThickness;
|
||||
auto layerThickness = absoThickness + gapThickness;
|
||||
auto calorThickness = nofLayers * layerThickness;
|
||||
auto worldSizeXY = 1.2 * calorSizeXY;
|
||||
auto worldSizeZ = 1.2 * calorThickness;
|
||||
|
||||
// Get materials
|
||||
G4Material* defaultMaterial = G4Material::GetMaterial("Galactic");
|
||||
G4Material* absorberMaterial = G4Material::GetMaterial("G4_Pb");
|
||||
G4Material* gapMaterial = G4Material::GetMaterial("liquidArgon");
|
||||
auto defaultMaterial = G4Material::GetMaterial("Galactic");
|
||||
auto absorberMaterial = G4Material::GetMaterial("G4_Pb");
|
||||
auto gapMaterial = G4Material::GetMaterial("liquidArgon");
|
||||
|
||||
if ( ! defaultMaterial || ! absorberMaterial || ! gapMaterial ) {
|
||||
G4ExceptionDescription msg;
|
||||
@@ -136,17 +136,17 @@ G4VPhysicalVolume* B4dDetectorConstruction::DefineVolumes()
|
||||
//
|
||||
// World
|
||||
//
|
||||
G4VSolid* worldS
|
||||
auto worldS
|
||||
= new G4Box("World", // its name
|
||||
worldSizeXY/2, worldSizeXY/2, worldSizeZ/2); // its size
|
||||
|
||||
G4LogicalVolume* worldLV
|
||||
auto worldLV
|
||||
= new G4LogicalVolume(
|
||||
worldS, // its solid
|
||||
defaultMaterial, // its material
|
||||
"World"); // its name
|
||||
|
||||
G4VPhysicalVolume* worldPV
|
||||
auto worldPV
|
||||
= new G4PVPlacement(
|
||||
0, // no rotation
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
@@ -160,11 +160,11 @@ G4VPhysicalVolume* B4dDetectorConstruction::DefineVolumes()
|
||||
//
|
||||
// Calorimeter
|
||||
//
|
||||
G4VSolid* calorimeterS
|
||||
auto calorimeterS
|
||||
= new G4Box("Calorimeter", // its name
|
||||
calorSizeXY/2, calorSizeXY/2, calorThickness/2); // its size
|
||||
|
||||
G4LogicalVolume* calorLV
|
||||
auto calorLV
|
||||
= new G4LogicalVolume(
|
||||
calorimeterS, // its solid
|
||||
defaultMaterial, // its material
|
||||
@@ -183,11 +183,11 @@ G4VPhysicalVolume* B4dDetectorConstruction::DefineVolumes()
|
||||
//
|
||||
// Layer
|
||||
//
|
||||
G4VSolid* layerS
|
||||
auto layerS
|
||||
= new G4Box("Layer", // its name
|
||||
calorSizeXY/2, calorSizeXY/2, layerThickness/2); // its size
|
||||
|
||||
G4LogicalVolume* layerLV
|
||||
auto layerLV
|
||||
= new G4LogicalVolume(
|
||||
layerS, // its solid
|
||||
defaultMaterial, // its material
|
||||
@@ -204,11 +204,11 @@ G4VPhysicalVolume* B4dDetectorConstruction::DefineVolumes()
|
||||
//
|
||||
// Absorber
|
||||
//
|
||||
G4VSolid* absorberS
|
||||
auto absorberS
|
||||
= new G4Box("Abso", // its name
|
||||
calorSizeXY/2, calorSizeXY/2, absoThickness/2); // its size
|
||||
|
||||
G4LogicalVolume* absorberLV
|
||||
auto absorberLV
|
||||
= new G4LogicalVolume(
|
||||
absorberS, // its solid
|
||||
absorberMaterial, // its material
|
||||
@@ -227,11 +227,11 @@ G4VPhysicalVolume* B4dDetectorConstruction::DefineVolumes()
|
||||
//
|
||||
// Gap
|
||||
//
|
||||
G4VSolid* gapS
|
||||
auto gapS
|
||||
= new G4Box("Gap", // its name
|
||||
calorSizeXY/2, calorSizeXY/2, gapThickness/2); // its size
|
||||
|
||||
G4LogicalVolume* gapLV
|
||||
auto gapLV
|
||||
= new G4LogicalVolume(
|
||||
gapS, // its solid
|
||||
gapMaterial, // its material
|
||||
@@ -262,9 +262,9 @@ G4VPhysicalVolume* B4dDetectorConstruction::DefineVolumes()
|
||||
//
|
||||
// Visualization attributes
|
||||
//
|
||||
worldLV->SetVisAttributes (G4VisAttributes::Invisible);
|
||||
worldLV->SetVisAttributes (G4VisAttributes::GetInvisible());
|
||||
|
||||
G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
|
||||
auto simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
|
||||
simpleBoxVisAtt->SetVisibility(true);
|
||||
calorLV->SetVisAttributes(simpleBoxVisAtt);
|
||||
|
||||
@@ -285,15 +285,15 @@ void B4dDetectorConstruction::ConstructSDandField()
|
||||
|
||||
// declare Absorber as a MultiFunctionalDetector scorer
|
||||
//
|
||||
G4MultiFunctionalDetector* absDetector
|
||||
= new G4MultiFunctionalDetector("Absorber");
|
||||
auto absDetector = new G4MultiFunctionalDetector("Absorber");
|
||||
G4SDManager::GetSDMpointer()->AddNewDetector(absDetector);
|
||||
|
||||
G4VPrimitiveScorer* primitive;
|
||||
primitive = new G4PSEnergyDeposit("Edep");
|
||||
absDetector->RegisterPrimitive(primitive);
|
||||
|
||||
primitive = new G4PSTrackLength("TrackLength");
|
||||
G4SDChargedFilter* charged = new G4SDChargedFilter("chargedFilter");
|
||||
auto charged = new G4SDChargedFilter("chargedFilter");
|
||||
primitive ->SetFilter(charged);
|
||||
absDetector->RegisterPrimitive(primitive);
|
||||
|
||||
@@ -301,8 +301,8 @@ void B4dDetectorConstruction::ConstructSDandField()
|
||||
|
||||
// declare Gap as a MultiFunctionalDetector scorer
|
||||
//
|
||||
G4MultiFunctionalDetector* gapDetector
|
||||
= new G4MultiFunctionalDetector("Gap");
|
||||
auto gapDetector = new G4MultiFunctionalDetector("Gap");
|
||||
G4SDManager::GetSDMpointer()->AddNewDetector(gapDetector);
|
||||
|
||||
primitive = new G4PSEnergyDeposit("Edep");
|
||||
gapDetector->RegisterPrimitive(primitive);
|
||||
@@ -319,7 +319,7 @@ void B4dDetectorConstruction::ConstructSDandField()
|
||||
// Create global magnetic field messenger.
|
||||
// Uniform magnetic field is then created automatically if
|
||||
// the field value is not zero.
|
||||
G4ThreeVector fieldValue = G4ThreeVector();
|
||||
G4ThreeVector fieldValue;
|
||||
fMagFieldMessenger = new G4GlobalMagFieldMessenger(fieldValue);
|
||||
fMagFieldMessenger->SetVerboseLevel(1);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B4dEventAction.cc 75604 2013-11-04 13:17:26Z gcosmo $
|
||||
// $Id: B4dEventAction.cc 100946 2016-11-03 11:28:08Z gcosmo $
|
||||
//
|
||||
/// \file B4dEventAction.cc
|
||||
/// \brief Implementation of the B4dEventAction class
|
||||
@@ -61,7 +61,7 @@ G4THitsMap<G4double>*
|
||||
B4dEventAction::GetHitsCollection(G4int hcID,
|
||||
const G4Event* event) const
|
||||
{
|
||||
G4THitsMap<G4double>* hitsCollection
|
||||
auto hitsCollection
|
||||
= static_cast<G4THitsMap<G4double>*>(
|
||||
event->GetHCofThisEvent()->GetHC(hcID));
|
||||
|
||||
@@ -79,10 +79,10 @@ B4dEventAction::GetHitsCollection(G4int hcID,
|
||||
|
||||
G4double B4dEventAction::GetSum(G4THitsMap<G4double>* hitsMap) const
|
||||
{
|
||||
G4double sumValue = 0;
|
||||
std::map<G4int, G4double*>::iterator it;
|
||||
for ( it = hitsMap->GetMap()->begin(); it != hitsMap->GetMap()->end(); it++) {
|
||||
sumValue += *(it->second);
|
||||
G4double sumValue = 0.;
|
||||
for ( auto it : *hitsMap->GetMap() ) {
|
||||
// hitsMap->GetMap() returns the map of std::map<G4int, G4double*>
|
||||
sumValue += *(it.second);
|
||||
}
|
||||
return sumValue;
|
||||
}
|
||||
@@ -131,23 +131,23 @@ void B4dEventAction::EndOfEventAction(const G4Event* event)
|
||||
|
||||
// Get sum values from hits collections
|
||||
//
|
||||
G4double absoEdep = GetSum(GetHitsCollection(fAbsoEdepHCID, event));
|
||||
G4double gapEdep = GetSum(GetHitsCollection(fGapEdepHCID, event));
|
||||
auto absoEdep = GetSum(GetHitsCollection(fAbsoEdepHCID, event));
|
||||
auto gapEdep = GetSum(GetHitsCollection(fGapEdepHCID, event));
|
||||
|
||||
G4double absoTrackLength
|
||||
auto absoTrackLength
|
||||
= GetSum(GetHitsCollection(fAbsoTrackLengthHCID, event));
|
||||
G4double gapTrackLength
|
||||
auto gapTrackLength
|
||||
= GetSum(GetHitsCollection(fGapTrackLengthHCID, event));
|
||||
|
||||
// get analysis manager
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
// fill histograms
|
||||
//
|
||||
analysisManager->FillH1(1, absoEdep);
|
||||
analysisManager->FillH1(2, gapEdep);
|
||||
analysisManager->FillH1(3, absoTrackLength);
|
||||
analysisManager->FillH1(4, gapTrackLength);
|
||||
analysisManager->FillH1(0, absoEdep);
|
||||
analysisManager->FillH1(1, gapEdep);
|
||||
analysisManager->FillH1(2, absoTrackLength);
|
||||
analysisManager->FillH1(3, gapTrackLength);
|
||||
|
||||
// fill ntuple
|
||||
//
|
||||
@@ -159,8 +159,8 @@ void B4dEventAction::EndOfEventAction(const G4Event* event)
|
||||
|
||||
//print per event (modulo n)
|
||||
//
|
||||
G4int eventID = event->GetEventID();
|
||||
G4int printModulo = G4RunManager::GetRunManager()->GetPrintProgress();
|
||||
auto eventID = event->GetEventID();
|
||||
auto printModulo = G4RunManager::GetRunManager()->GetPrintProgress();
|
||||
if ( ( printModulo > 0 ) && ( eventID % printModulo == 0 ) ) {
|
||||
G4cout << "---> End of event: " << eventID << G4endl;
|
||||
PrintEventStatistics(absoEdep, absoTrackLength, gapEdep, gapTrackLength);
|
||||
|
||||
Reference in New Issue
Block a user