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(exampleB4a ${Geant4_LIBRARIES})
|
||||
set(EXAMPLEB4A_SCRIPTS
|
||||
exampleB4a.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: exampleB4a.cc 94808 2015-12-10 08:22:26Z gcosmo $
|
||||
// $Id: exampleB4a.cc 100946 2016-11-03 11:28:08Z gcosmo $
|
||||
//
|
||||
/// \file exampleB4a.cc
|
||||
/// \brief Main program of the B4a 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,35 +101,34 @@ 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);
|
||||
|
||||
B4aActionInitialization* actionInitialization
|
||||
= new B4aActionInitialization(detConstruction);
|
||||
auto actionInitialization = new B4aActionInitialization(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: 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: 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......
|
||||
|
||||
@@ -61,7 +61,7 @@ void B4aActionInitialization::Build() const
|
||||
{
|
||||
SetUserAction(new B4PrimaryGeneratorAction);
|
||||
SetUserAction(new B4RunAction);
|
||||
B4aEventAction* eventAction = new B4aEventAction;
|
||||
auto eventAction = new B4aEventAction;
|
||||
SetUserAction(eventAction);
|
||||
SetUserAction(new B4aSteppingAction(fDetConstruction,eventAction));
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B4aEventAction.cc 75604 2013-11-04 13:17:26Z gcosmo $
|
||||
// $Id: B4aEventAction.cc 100946 2016-11-03 11:28:08Z gcosmo $
|
||||
//
|
||||
/// \file B4aEventAction.cc
|
||||
/// \brief Implementation of the B4aEventAction class
|
||||
@@ -73,13 +73,13 @@ void B4aEventAction::EndOfEventAction(const G4Event* event)
|
||||
//
|
||||
|
||||
// get analysis manager
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
// fill histograms
|
||||
analysisManager->FillH1(1, fEnergyAbs);
|
||||
analysisManager->FillH1(2, fEnergyGap);
|
||||
analysisManager->FillH1(3, fTrackLAbs);
|
||||
analysisManager->FillH1(4, fTrackLGap);
|
||||
analysisManager->FillH1(0, fEnergyAbs);
|
||||
analysisManager->FillH1(1, fEnergyGap);
|
||||
analysisManager->FillH1(2, fTrackLAbs);
|
||||
analysisManager->FillH1(3, fTrackLGap);
|
||||
|
||||
// fill ntuple
|
||||
analysisManager->FillNtupleDColumn(0, fEnergyAbs);
|
||||
@@ -90,8 +90,8 @@ void B4aEventAction::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;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B4aSteppingAction.cc 68058 2013-03-13 14:47:43Z gcosmo $
|
||||
// $Id: B4aSteppingAction.cc 100946 2016-11-03 11:28:08Z gcosmo $
|
||||
//
|
||||
/// \file B4aSteppingAction.cc
|
||||
/// \brief Implementation of the B4aSteppingAction class
|
||||
@@ -43,14 +43,12 @@ B4aSteppingAction::B4aSteppingAction(
|
||||
: G4UserSteppingAction(),
|
||||
fDetConstruction(detectorConstruction),
|
||||
fEventAction(eventAction)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4aSteppingAction::~B4aSteppingAction()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -59,11 +57,10 @@ void B4aSteppingAction::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.;
|
||||
|
||||
@@ -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() ) {
|
||||
|
||||
@@ -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(exampleB4c ${Geant4_LIBRARIES})
|
||||
set(EXAMPLEB4C_SCRIPTS
|
||||
exampleB4c.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: exampleB4c.cc 94808 2015-12-10 08:22:26Z gcosmo $
|
||||
// $Id: exampleB4c.cc 100946 2016-11-03 11:28:08Z gcosmo $
|
||||
//
|
||||
/// \file exampleB4c.cc
|
||||
/// \brief Main program of the B4c example
|
||||
@@ -111,24 +111,23 @@ int main(int argc,char** argv)
|
||||
|
||||
// Set mandatory initialization classes
|
||||
//
|
||||
B4cDetectorConstruction* detConstruction = new B4cDetectorConstruction();
|
||||
auto detConstruction = new B4cDetectorConstruction();
|
||||
runManager->SetUserInitialization(detConstruction);
|
||||
|
||||
G4VModularPhysicsList* physicsList = new FTFP_BERT;
|
||||
auto physicsList = new FTFP_BERT;
|
||||
runManager->SetUserInitialization(physicsList);
|
||||
|
||||
B4cActionInitialization* actionInitialization
|
||||
= new B4cActionInitialization();
|
||||
auto actionInitialization = new B4cActionInitialization();
|
||||
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: B4cCalorHit.hh 69223 2013-04-23 12:36:10Z gcosmo $
|
||||
// $Id: B4cCalorHit.hh 100946 2016-11-03 11:28:08Z gcosmo $
|
||||
//
|
||||
/// \file B4cCalorHit.hh
|
||||
/// \brief Definition of the B4cCalorHit class
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "G4THitsCollection.hh"
|
||||
#include "G4Allocator.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "tls.hh"
|
||||
#include "G4Threading.hh"
|
||||
|
||||
/// Calorimeter hit class
|
||||
///
|
||||
@@ -75,7 +75,7 @@ class B4cCalorHit : public G4VHit
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
typedef G4THitsCollection<B4cCalorHit> B4cCalorHitsCollection;
|
||||
using B4cCalorHitsCollection = G4THitsCollection<B4cCalorHit>;
|
||||
|
||||
extern G4ThreadLocal G4Allocator<B4cCalorHit>* B4cCalorHitAllocator;
|
||||
|
||||
@@ -83,8 +83,9 @@ extern G4ThreadLocal G4Allocator<B4cCalorHit>* B4cCalorHitAllocator;
|
||||
|
||||
inline void* B4cCalorHit::operator new(size_t)
|
||||
{
|
||||
if(!B4cCalorHitAllocator)
|
||||
if (!B4cCalorHitAllocator) {
|
||||
B4cCalorHitAllocator = new G4Allocator<B4cCalorHit>;
|
||||
}
|
||||
void *hit;
|
||||
hit = (void *) B4cCalorHitAllocator->MallocSingle();
|
||||
return hit;
|
||||
@@ -92,8 +93,9 @@ inline void* B4cCalorHit::operator new(size_t)
|
||||
|
||||
inline void B4cCalorHit::operator delete(void *hit)
|
||||
{
|
||||
if(!B4cCalorHitAllocator)
|
||||
if (!B4cCalorHitAllocator) {
|
||||
B4cCalorHitAllocator = new G4Allocator<B4cCalorHit>;
|
||||
}
|
||||
B4cCalorHitAllocator->FreeSingle((B4cCalorHit*) hit);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B4cCalorimeterSD.hh 68058 2013-03-13 14:47:43Z gcosmo $
|
||||
// $Id: B4cCalorimeterSD.hh 100946 2016-11-03 11:28:08Z gcosmo $
|
||||
//
|
||||
/// \file B4cCalorimeterSD.hh
|
||||
/// \brief Definition of the B4cCalorimeterSD class
|
||||
@@ -63,7 +63,7 @@ class B4cCalorimeterSD : public G4VSensitiveDetector
|
||||
|
||||
private:
|
||||
B4cCalorHitsCollection* fHitsCollection;
|
||||
G4int fNofCells;
|
||||
G4int fNofCells;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -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: B4cCalorimeterSD.cc 87359 2014-12-01 16:04:27Z gcosmo $
|
||||
// $Id: B4cCalorimeterSD.cc 100946 2016-11-03 11:28:08Z gcosmo $
|
||||
//
|
||||
/// \file B4cCalorimeterSD.cc
|
||||
/// \brief Implementation of the B4cCalorimeterSD class
|
||||
@@ -42,7 +42,7 @@ B4cCalorimeterSD::B4cCalorimeterSD(
|
||||
const G4String& hitsCollectionName,
|
||||
G4int nofCells)
|
||||
: G4VSensitiveDetector(name),
|
||||
fHitsCollection(0),
|
||||
fHitsCollection(nullptr),
|
||||
fNofCells(nofCells)
|
||||
{
|
||||
collectionName.insert(hitsCollectionName);
|
||||
@@ -63,7 +63,7 @@ void B4cCalorimeterSD::Initialize(G4HCofThisEvent* hce)
|
||||
= new B4cCalorHitsCollection(SensitiveDetectorName, collectionName[0]);
|
||||
|
||||
// Add this collection in hce
|
||||
G4int hcID
|
||||
auto hcID
|
||||
= G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
|
||||
hce->AddHitsCollection( hcID, fHitsCollection );
|
||||
|
||||
@@ -80,7 +80,7 @@ G4bool B4cCalorimeterSD::ProcessHits(G4Step* step,
|
||||
G4TouchableHistory*)
|
||||
{
|
||||
// energy deposit
|
||||
G4double edep = step->GetTotalEnergyDeposit();
|
||||
auto edep = step->GetTotalEnergyDeposit();
|
||||
|
||||
// step length
|
||||
G4double stepLength = 0.;
|
||||
@@ -90,14 +90,13 @@ G4bool B4cCalorimeterSD::ProcessHits(G4Step* step,
|
||||
|
||||
if ( edep==0. && stepLength == 0. ) return false;
|
||||
|
||||
G4TouchableHistory* touchable
|
||||
= (G4TouchableHistory*)(step->GetPreStepPoint()->GetTouchable());
|
||||
auto touchable = (step->GetPreStepPoint()->GetTouchable());
|
||||
|
||||
// Get calorimeter cell id
|
||||
G4int layerNumber = touchable->GetReplicaNumber(1);
|
||||
auto layerNumber = touchable->GetReplicaNumber(1);
|
||||
|
||||
// Get hit accounting data for this cell
|
||||
B4cCalorHit* hit = (*fHitsCollection)[layerNumber];
|
||||
auto hit = (*fHitsCollection)[layerNumber];
|
||||
if ( ! hit ) {
|
||||
G4ExceptionDescription msg;
|
||||
msg << "Cannot access hit " << layerNumber;
|
||||
@@ -106,7 +105,7 @@ G4bool B4cCalorimeterSD::ProcessHits(G4Step* step,
|
||||
}
|
||||
|
||||
// Get hit for total accounting
|
||||
B4cCalorHit* hitTotal
|
||||
auto hitTotal
|
||||
= (*fHitsCollection)[fHitsCollection->entries()-1];
|
||||
|
||||
// Add values
|
||||
@@ -121,7 +120,7 @@ G4bool B4cCalorimeterSD::ProcessHits(G4Step* step,
|
||||
void B4cCalorimeterSD::EndOfEvent(G4HCofThisEvent*)
|
||||
{
|
||||
if ( verboseLevel>1 ) {
|
||||
G4int nofHits = fHitsCollection->entries();
|
||||
auto nofHits = fHitsCollection->entries();
|
||||
G4cout
|
||||
<< G4endl
|
||||
<< "-------->Hits Collection: in this event they are " << nofHits
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B4cDetectorConstruction.cc 87359 2014-12-01 16:04:27Z gcosmo $
|
||||
// $Id: B4cDetectorConstruction.cc 101905 2016-12-07 11:34:39Z gunter $
|
||||
//
|
||||
/// \file B4cDetectorConstruction.cc
|
||||
/// \brief Implementation of the B4cDetectorConstruction class
|
||||
@@ -84,7 +84,7 @@ G4VPhysicalVolume* B4cDetectorConstruction::Construct()
|
||||
void B4cDetectorConstruction::DefineMaterials()
|
||||
{
|
||||
// Lead material defined using NIST Manager
|
||||
G4NistManager* nistManager = G4NistManager::Instance();
|
||||
auto nistManager = G4NistManager::Instance();
|
||||
nistManager->FindOrBuildMaterial("G4_Pb");
|
||||
|
||||
// Liquid argon material
|
||||
@@ -112,15 +112,15 @@ G4VPhysicalVolume* B4cDetectorConstruction::DefineVolumes()
|
||||
G4double gapThickness = 5.*mm;
|
||||
G4double calorSizeXY = 10.*cm;
|
||||
|
||||
G4double layerThickness = absoThickness + gapThickness;
|
||||
G4double calorThickness = fNofLayers * layerThickness;
|
||||
G4double worldSizeXY = 1.2 * calorSizeXY;
|
||||
G4double worldSizeZ = 1.2 * calorThickness;
|
||||
auto layerThickness = absoThickness + gapThickness;
|
||||
auto calorThickness = fNofLayers * 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;
|
||||
@@ -132,17 +132,17 @@ G4VPhysicalVolume* B4cDetectorConstruction::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)
|
||||
@@ -156,11 +156,11 @@ G4VPhysicalVolume* B4cDetectorConstruction::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
|
||||
@@ -179,11 +179,11 @@ G4VPhysicalVolume* B4cDetectorConstruction::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
|
||||
@@ -200,11 +200,11 @@ G4VPhysicalVolume* B4cDetectorConstruction::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
|
||||
@@ -223,11 +223,11 @@ G4VPhysicalVolume* B4cDetectorConstruction::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
|
||||
@@ -258,9 +258,9 @@ G4VPhysicalVolume* B4cDetectorConstruction::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);
|
||||
|
||||
@@ -279,12 +279,14 @@ void B4cDetectorConstruction::ConstructSDandField()
|
||||
//
|
||||
// Sensitive detectors
|
||||
//
|
||||
B4cCalorimeterSD* absoSD
|
||||
auto absoSD
|
||||
= new B4cCalorimeterSD("AbsorberSD", "AbsorberHitsCollection", fNofLayers);
|
||||
G4SDManager::GetSDMpointer()->AddNewDetector(absoSD);
|
||||
SetSensitiveDetector("AbsoLV",absoSD);
|
||||
|
||||
B4cCalorimeterSD* gapSD
|
||||
auto gapSD
|
||||
= new B4cCalorimeterSD("GapSD", "GapHitsCollection", fNofLayers);
|
||||
G4SDManager::GetSDMpointer()->AddNewDetector(gapSD);
|
||||
SetSensitiveDetector("GapLV",gapSD);
|
||||
|
||||
//
|
||||
@@ -293,7 +295,7 @@ void B4cDetectorConstruction::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: B4cEventAction.cc 88427 2015-02-19 08:19:38Z gcosmo $
|
||||
// $Id: B4cEventAction.cc 100946 2016-11-03 11:28:08Z gcosmo $
|
||||
//
|
||||
/// \file B4cEventAction.cc
|
||||
/// \brief Implementation of the B4cEventAction class
|
||||
@@ -61,7 +61,7 @@ B4cCalorHitsCollection*
|
||||
B4cEventAction::GetHitsCollection(G4int hcID,
|
||||
const G4Event* event) const
|
||||
{
|
||||
B4cCalorHitsCollection* hitsCollection
|
||||
auto hitsCollection
|
||||
= static_cast<B4cCalorHitsCollection*>(
|
||||
event->GetHCofThisEvent()->GetHC(hcID));
|
||||
|
||||
@@ -113,17 +113,17 @@ void B4cEventAction::EndOfEventAction(const G4Event* event)
|
||||
}
|
||||
|
||||
// Get hits collections
|
||||
B4cCalorHitsCollection* absoHC = GetHitsCollection(fAbsHCID, event);
|
||||
B4cCalorHitsCollection* gapHC = GetHitsCollection(fGapHCID, event);
|
||||
auto absoHC = GetHitsCollection(fAbsHCID, event);
|
||||
auto gapHC = GetHitsCollection(fGapHCID, event);
|
||||
|
||||
// Get hit with total values
|
||||
B4cCalorHit* absoHit = (*absoHC)[absoHC->entries()-1];
|
||||
B4cCalorHit* gapHit = (*gapHC)[gapHC->entries()-1];
|
||||
auto absoHit = (*absoHC)[absoHC->entries()-1];
|
||||
auto gapHit = (*gapHC)[gapHC->entries()-1];
|
||||
|
||||
// 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;
|
||||
|
||||
@@ -136,13 +136,13 @@ void B4cEventAction::EndOfEventAction(const G4Event* event)
|
||||
//
|
||||
|
||||
// get analysis manager
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
// fill histograms
|
||||
analysisManager->FillH1(1, absoHit->GetEdep());
|
||||
analysisManager->FillH1(2, gapHit->GetEdep());
|
||||
analysisManager->FillH1(3, absoHit->GetTrackLength());
|
||||
analysisManager->FillH1(4, gapHit->GetTrackLength());
|
||||
analysisManager->FillH1(0, absoHit->GetEdep());
|
||||
analysisManager->FillH1(1, gapHit->GetEdep());
|
||||
analysisManager->FillH1(2, absoHit->GetTrackLength());
|
||||
analysisManager->FillH1(3, gapHit->GetTrackLength());
|
||||
|
||||
// fill ntuple
|
||||
analysisManager->FillNtupleDColumn(0, absoHit->GetEdep());
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -15,6 +15,20 @@ track of all tags.
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
19/11/16 A. Dotti (exampleB4-V10-02-04)
|
||||
- explicit set of SDs to manager
|
||||
|
||||
03/11/16 I. Hrivnacova (exampleB4-V10-02-03)
|
||||
- Added C++11 features
|
||||
- Removed analysisManager->SetFirstHistoId(1); setting
|
||||
and added meaningful names to histograms
|
||||
|
||||
02/11/16 L.Garnier (exampleB4-V10-02-02)
|
||||
- Remove icons.mac. Automatically include since interfaces-V10-02-07
|
||||
|
||||
10/10/16 I. Hrivnacova (exampleB4-V10-02-01)
|
||||
- Activate merging of ntuples
|
||||
|
||||
09/12/15 I. Hrivnacova (exampleB4-V10-02-00)
|
||||
- Restored the third parameter in G4UIsession construction, which was
|
||||
lost when moving G4UIExecutive at the beginning of main().
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user