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(exampleB4b ${Geant4_LIBRARIES})
|
||||
set(EXAMPLEB4B_SCRIPTS
|
||||
exampleB4b.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: exampleB4b.cc 94808 2015-12-10 08:22:26Z gcosmo $
|
||||
// $Id: exampleB4b.cc 100946 2016-11-03 11:28:08Z gcosmo $
|
||||
//
|
||||
/// \file exampleB4b.cc
|
||||
/// \brief Main program of the B4b example
|
||||
@@ -89,7 +89,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);
|
||||
}
|
||||
@@ -101,34 +101,33 @@ int main(int argc,char** argv)
|
||||
// Construct the default 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
|
||||
//
|
||||
B4DetectorConstruction* detConstruction = new B4DetectorConstruction();
|
||||
auto detConstruction = new B4DetectorConstruction();
|
||||
runManager->SetUserInitialization(detConstruction);
|
||||
|
||||
G4VModularPhysicsList* physicsList = new FTFP_BERT;
|
||||
auto physicsList = new FTFP_BERT;
|
||||
runManager->SetUserInitialization(physicsList);
|
||||
|
||||
B4bActionInitialization* actionInitialization
|
||||
= new B4bActionInitialization(detConstruction);
|
||||
auto actionInitialization = new B4bActionInitialization(detConstruction);
|
||||
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: B4bRunData.hh 69223 2013-04-23 12:36:10Z gcosmo $
|
||||
// $Id: B4bRunData.hh 100946 2016-11-03 11:28:08Z gcosmo $
|
||||
//
|
||||
/// \file B4bRunData.hh
|
||||
/// \brief Definition of the B4bRunData class
|
||||
@@ -34,13 +34,13 @@
|
||||
#include "G4Run.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include <array>
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
enum {
|
||||
kAbs = 0,
|
||||
kGap = 1,
|
||||
kDim = 2
|
||||
};
|
||||
const G4int kAbs = 0;
|
||||
const G4int kGap = 1;
|
||||
const G4int kDim = 2;
|
||||
|
||||
/// Run data class
|
||||
///
|
||||
@@ -72,9 +72,9 @@ public:
|
||||
G4double GetTrackLength(G4int id) const;
|
||||
|
||||
private:
|
||||
G4String fVolumeNames[kDim];
|
||||
G4double fEdep[kDim];
|
||||
G4double fTrackLength[kDim];
|
||||
std::array<G4String, kDim> fVolumeNames;
|
||||
std::array<G4double, kDim> fEdep;
|
||||
std::array<G4double, kDim> fTrackLength;
|
||||
};
|
||||
|
||||
// inline functions
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B4DetectorConstruction.cc 87359 2014-12-01 16:04:27Z gcosmo $
|
||||
// $Id: B4DetectorConstruction.cc 101905 2016-12-07 11:34:39Z gunter $
|
||||
//
|
||||
/// \file B4DetectorConstruction.cc
|
||||
/// \brief Implementation of the B4DetectorConstruction class
|
||||
@@ -54,14 +54,14 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ThreadLocal
|
||||
G4GlobalMagFieldMessenger* B4DetectorConstruction::fMagFieldMessenger = 0;
|
||||
G4GlobalMagFieldMessenger* B4DetectorConstruction::fMagFieldMessenger = nullptr;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4DetectorConstruction::B4DetectorConstruction()
|
||||
: G4VUserDetectorConstruction(),
|
||||
fAbsorberPV(0),
|
||||
fGapPV(0),
|
||||
fAbsorberPV(nullptr),
|
||||
fGapPV(nullptr),
|
||||
fCheckOverlaps(true)
|
||||
{
|
||||
}
|
||||
@@ -88,7 +88,7 @@ G4VPhysicalVolume* B4DetectorConstruction::Construct()
|
||||
void B4DetectorConstruction::DefineMaterials()
|
||||
{
|
||||
// Lead material defined using NIST Manager
|
||||
G4NistManager* nistManager = G4NistManager::Instance();
|
||||
auto nistManager = G4NistManager::Instance();
|
||||
nistManager->FindOrBuildMaterial("G4_Pb");
|
||||
|
||||
// Liquid argon material
|
||||
@@ -116,15 +116,15 @@ G4VPhysicalVolume* B4DetectorConstruction::DefineVolumes()
|
||||
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* B4DetectorConstruction::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* B4DetectorConstruction::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* B4DetectorConstruction::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* B4DetectorConstruction::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
|
||||
@@ -228,11 +228,11 @@ G4VPhysicalVolume* B4DetectorConstruction::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
|
||||
@@ -264,9 +264,9 @@ G4VPhysicalVolume* B4DetectorConstruction::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);
|
||||
|
||||
@@ -283,7 +283,7 @@ void B4DetectorConstruction::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: 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: B4bEventAction.cc 75604 2013-11-04 13:17:26Z gcosmo $
|
||||
// $Id: B4bEventAction.cc 100946 2016-11-03 11:28:08Z gcosmo $
|
||||
//
|
||||
/// \file B4bEventAction.cc
|
||||
/// \brief Implementation of the B4bEventAction class
|
||||
@@ -73,7 +73,7 @@ void B4bEventAction::PrintEventStatistics(
|
||||
|
||||
void B4bEventAction::BeginOfEventAction(const G4Event* /*event*/)
|
||||
{
|
||||
B4bRunData* runData
|
||||
auto runData
|
||||
= static_cast<B4bRunData*>(
|
||||
G4RunManager::GetRunManager()->GetNonConstCurrentRun());
|
||||
runData->Reset();
|
||||
@@ -83,15 +83,15 @@ void B4bEventAction::BeginOfEventAction(const G4Event* /*event*/)
|
||||
|
||||
void B4bEventAction::EndOfEventAction(const G4Event* event)
|
||||
{
|
||||
B4bRunData* runData
|
||||
auto runData
|
||||
= static_cast<B4bRunData*>(
|
||||
G4RunManager::GetRunManager()->GetNonConstCurrentRun());
|
||||
runData->FillPerEvent();
|
||||
|
||||
//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;
|
||||
|
||||
|
||||
@@ -48,23 +48,24 @@ B4bRunAction::B4bRunAction()
|
||||
// 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
|
||||
//
|
||||
@@ -100,7 +101,7 @@ void B4bRunAction::BeginOfRunAction(const G4Run* run)
|
||||
//G4RunManager::GetRunManager()->SetRandomNumberStore(true);
|
||||
|
||||
// Get analysis manager
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
// Open an output file
|
||||
//
|
||||
@@ -114,7 +115,7 @@ void B4bRunAction::EndOfRunAction(const G4Run* /*aRun*/)
|
||||
{
|
||||
// print histogram statistics
|
||||
//
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
if ( analysisManager->GetH1(1) ) {
|
||||
G4cout << G4endl << " ----> print histograms statistic ";
|
||||
if(isMaster) {
|
||||
@@ -125,24 +126,24 @@ void B4bRunAction::EndOfRunAction(const G4Run* /*aRun*/)
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B4bRunData.cc 69223 2013-04-23 12:36:10Z gcosmo $
|
||||
// $Id: B4bRunData.cc 100946 2016-11-03 11:28:08Z gcosmo $
|
||||
//
|
||||
/// \file B4bRunData.cc
|
||||
/// \brief Implementation of the B4bRunData class
|
||||
@@ -36,15 +36,16 @@
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4bRunData::B4bRunData() : G4Run()
|
||||
B4bRunData::B4bRunData()
|
||||
: G4Run(),
|
||||
fVolumeNames{ { "Absorber", "Gap" } }
|
||||
{
|
||||
fVolumeNames[0] = "Absorber";
|
||||
fVolumeNames[1] = "Gap";
|
||||
|
||||
for ( G4int i=0; i<kDim; i++) {
|
||||
fEdep[i] = 0.;
|
||||
fTrackLength[i] = 0.;
|
||||
}
|
||||
for ( auto& edep : fEdep ) {
|
||||
edep = 0.;
|
||||
}
|
||||
for ( auto& trackLength : fTrackLength ) {
|
||||
trackLength = 0.;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -57,20 +58,19 @@ B4bRunData::~B4bRunData()
|
||||
void B4bRunData::FillPerEvent()
|
||||
{
|
||||
// get analysis manager
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
//accumulate statistic
|
||||
//
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
for ( G4int i=0; i<kDim; i++) {
|
||||
// fill histograms
|
||||
analysisManager->FillH1(i+1, fEdep[i]);
|
||||
analysisManager->FillH1(kDim+i+1, fTrackLength[i]);
|
||||
|
||||
// fill ntuple
|
||||
analysisManager->FillNtupleDColumn(i, fEdep[i]);
|
||||
analysisManager->FillNtupleDColumn(kDim+i, fTrackLength[i]);
|
||||
// accumulate statistic
|
||||
// in the order od the histograms, ntuple columns declarations
|
||||
G4int counter = 0;
|
||||
for ( auto edep : fEdep ) {
|
||||
analysisManager->FillH1(counter, edep);
|
||||
analysisManager->FillNtupleDColumn(counter++, edep);
|
||||
}
|
||||
for ( auto trackLength : fTrackLength ) {
|
||||
analysisManager->FillH1(counter, trackLength);
|
||||
analysisManager->FillNtupleDColumn(counter++, trackLength);
|
||||
}
|
||||
|
||||
analysisManager->AddNtupleRow();
|
||||
}
|
||||
|
||||
@@ -78,10 +78,12 @@ void B4bRunData::FillPerEvent()
|
||||
|
||||
void B4bRunData::Reset()
|
||||
{
|
||||
for ( G4int i=0; i<kDim; i++) {
|
||||
fEdep[i] = 0.;
|
||||
fTrackLength[i] = 0.;
|
||||
}
|
||||
for ( auto& edep : fEdep ) {
|
||||
edep = 0.;
|
||||
}
|
||||
for ( auto& trackLength : fTrackLength ) {
|
||||
trackLength = 0.;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B4bSteppingAction.cc 69223 2013-04-23 12:36:10Z gcosmo $
|
||||
// $Id: B4bSteppingAction.cc 100946 2016-11-03 11:28:08Z gcosmo $
|
||||
//
|
||||
/// \file B4bSteppingAction.cc
|
||||
/// \brief Implementation of the B4bSteppingAction class
|
||||
@@ -57,11 +57,10 @@ void B4bSteppingAction::UserSteppingAction(const G4Step* step)
|
||||
// Collect energy and track length step by step
|
||||
|
||||
// get volume of the current step
|
||||
G4VPhysicalVolume* volume
|
||||
= step->GetPreStepPoint()->GetTouchableHandle()->GetVolume();
|
||||
auto volume = step->GetPreStepPoint()->GetTouchableHandle()->GetVolume();
|
||||
|
||||
// energy deposit
|
||||
G4double edep = step->GetTotalEnergyDeposit();
|
||||
auto edep = step->GetTotalEnergyDeposit();
|
||||
|
||||
// step length
|
||||
G4double stepLength = 0.;
|
||||
@@ -69,7 +68,7 @@ void B4bSteppingAction::UserSteppingAction(const G4Step* step)
|
||||
stepLength = step->GetStepLength();
|
||||
}
|
||||
|
||||
B4bRunData* runData = static_cast<B4bRunData*>
|
||||
auto runData = static_cast<B4bRunData*>
|
||||
(G4RunManager::GetRunManager()->GetNonConstCurrentRun());
|
||||
|
||||
if ( volume == fDetConstruction->GetAbsorberPV() ) {
|
||||
|
||||
Reference in New Issue
Block a user