Import Geant4 10.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2017-12-08 12:52:30 +01:00
parent 98e455a940
commit fc6af9e721
2166 changed files with 276760 additions and 100873 deletions
@@ -25,64 +25,62 @@
//
// $Id$
//
/// \file ExG4DetectorConstruction02.cc
/// \brief Implementation of the ExG4DetectorConstruction02 class
/// \file DetectorConstruction.cc
/// \brief Implementation of the DetectorConstruction class
#include "ExG4DetectorConstruction02.hh"
#include "ExG4DetectorConstruction02Messenger.hh"
#include "DetectorConstruction.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4GenericMessenger.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4DetectorConstruction02::ExG4DetectorConstruction02(
DetectorConstruction::DetectorConstruction(
const G4String& boxMaterialName,
G4double boxHx, G4double boxHy, G4double boxHz,
const G4String& worldMaterialName,
G4double worldSizeFactor)
: G4VUserDetectorConstruction(),
fMessenger(this),
fMessenger(nullptr),
fBoxMaterialName(boxMaterialName),
fWorldMaterialName(worldMaterialName),
fBoxDimensions(boxHx*2, boxHy*2, boxHz*2),
fWorldSizeFactor(worldSizeFactor),
fBoxVolume(0),
fWorldVolume(0)
fBoxVolume(nullptr),
fWorldVolume(nullptr)
{
DefineCommands();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4DetectorConstruction02::~ExG4DetectorConstruction02()
{
DetectorConstruction::~DetectorConstruction()
{
delete fMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* ExG4DetectorConstruction02::Construct()
G4VPhysicalVolume* DetectorConstruction::Construct()
{
// Define materials via NIST manager
//
G4NistManager* nistManager = G4NistManager::Instance();
auto nistManager = G4NistManager::Instance();
G4Material* worldMaterial
= nistManager->FindOrBuildMaterial(fWorldMaterialName);
G4Material* boxMaterial
= nistManager->FindOrBuildMaterial(fBoxMaterialName);
auto worldMaterial = nistManager->FindOrBuildMaterial(fWorldMaterialName);
auto boxMaterial = nistManager->FindOrBuildMaterial(fBoxMaterialName);
// Geometry parameters
//
G4ThreeVector worldDimensions = fBoxDimensions * fWorldSizeFactor;
// World
//
G4Box* sWorld
auto sWorld
= new G4Box("World", //name
worldDimensions.x(), //dimensions (half-lentghs)
worldDimensions.y(),
@@ -93,7 +91,7 @@ G4VPhysicalVolume* ExG4DetectorConstruction02::Construct()
worldMaterial, //material
"World"); //name
G4VPhysicalVolume* pWorld
auto pWorld
= new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
fWorldVolume, //logical volume
@@ -104,7 +102,7 @@ G4VPhysicalVolume* ExG4DetectorConstruction02::Construct()
// Box
//
G4Box* sBox
auto sBox
= new G4Box("Box", //its name
fBoxDimensions.x(), //dimensions (half-lengths)
fBoxDimensions.y(),
@@ -130,13 +128,11 @@ G4VPhysicalVolume* ExG4DetectorConstruction02::Construct()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4DetectorConstruction02::SetBoxMaterial(const G4String& materialName)
void DetectorConstruction::SetBoxMaterial(const G4String& materialName)
{
G4NistManager* nistManager = G4NistManager::Instance();
G4Material* newMaterial
= nistManager->FindOrBuildMaterial(materialName);
auto nistManager = G4NistManager::Instance();
auto newMaterial = nistManager->FindOrBuildMaterial(materialName);
if ( ! newMaterial ) {
G4cerr << "Material " << materialName << " not found." << G4endl;
G4cerr << "The box material was not changed." << G4endl;
@@ -149,13 +145,11 @@ void ExG4DetectorConstruction02::SetBoxMaterial(const G4String& materialName)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4DetectorConstruction02::SetWorldMaterial(const G4String& materialName)
void DetectorConstruction::SetWorldMaterial(const G4String& materialName)
{
G4NistManager* nistManager = G4NistManager::Instance();
G4Material* newMaterial
= nistManager->FindOrBuildMaterial(materialName);
auto nistManager = G4NistManager::Instance();
auto newMaterial = nistManager->FindOrBuildMaterial(materialName);
if ( ! newMaterial ) {
G4cerr << "Material " << materialName << " not found." << G4endl;
G4cerr << "The box material was not changed." << G4endl;
@@ -168,18 +162,17 @@ void ExG4DetectorConstruction02::SetWorldMaterial(const G4String& materialName)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4DetectorConstruction02::SetBoxDimensions(
G4double hx, G4double hy, G4double hz)
void DetectorConstruction::SetBoxDimensions(G4ThreeVector dimensions)
{
/// Set box dimension (in half lengths).
/// This setting has effect only if called in PreInit> phase
fBoxDimensions = G4ThreeVector(hx, hy, hz);
fBoxDimensions = dimensions;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4DetectorConstruction02::SetWorldSizeFactor(G4double factor)
void DetectorConstruction::SetWorldSizeFactor(G4double factor)
{
/// Set the multiplication factor from box dimensions to world dimensions.
/// This setting has effect only if called in PreInit> phase
@@ -188,3 +181,46 @@ void ExG4DetectorConstruction02::SetWorldSizeFactor(G4double factor)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::DefineCommands()
{
// Define /B5/detector command directory using generic messenger class
fMessenger = new G4GenericMessenger(this,
"/detector/",
"Detector control");
// setBoxMaterial command
auto& setBoxMaterialCmd
= fMessenger->DeclareMethod("setBoxMaterial",
&DetectorConstruction::SetBoxMaterial,
"Set box material name.");
setBoxMaterialCmd.SetParameterName("boxMaterialName", false);
setBoxMaterialCmd.SetDefaultValue("G4_AIR");
// setWorldMaterial command
auto& setWorldMaterialCmd
= fMessenger->DeclareMethod("setWorldMaterial",
&DetectorConstruction::SetWorldMaterial,
"Set world material name.");
setWorldMaterialCmd.SetParameterName("worldMaterialName", false);
setWorldMaterialCmd.SetDefaultValue("G4_AIR");
// setBoxDimensions command
auto& setBoxDimensionsCmd
= fMessenger->DeclareMethodWithUnit("setBoxDimensions", "mm",
&DetectorConstruction::SetBoxDimensions,
"Set box dimensions (in half lentgh).");
setBoxDimensionsCmd.SetParameterName("boxDimensions", false);
setBoxDimensionsCmd.SetStates(G4State_PreInit);
// setWorldSizeFactor command
auto& setWorldSizeFactorCmd
= fMessenger->DeclareMethod("setWorldSizeFactor",
&DetectorConstruction::SetWorldSizeFactor,
"Set the multiplication factor from box dimensions to world dimensions.");
setWorldSizeFactorCmd.SetParameterName("worldSizeFactor", false);
setWorldSizeFactorCmd.SetRange("WorldSizeFactor >= 1");
setWorldSizeFactorCmd.SetStates(G4State_PreInit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -25,51 +25,52 @@
//
// $Id$
//
/// \file ExG4DetectorConstruction01.cc
/// \brief Implementation of the ExG4DetectorConstruction01 class
/// \file DetectorConstruction0.cc
/// \brief Implementation of the DetectorConstruction0 class
#include "ExG4DetectorConstruction01.hh"
#include "ExG4DetectorConstruction01Messenger.hh"
#include "DetectorConstruction0.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4GenericMessenger.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4DetectorConstruction01::ExG4DetectorConstruction01(
DetectorConstruction0::DetectorConstruction0(
const G4String& materialName,
G4double hx, G4double hy, G4double hz)
: G4VUserDetectorConstruction(),
fMessenger(this),
fMessenger(nullptr),
fMaterialName(materialName),
fDimensions(hx, hy, hz),
fWorldVolume(0)
fWorldVolume(nullptr)
{
DefineCommands();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4DetectorConstruction01::~ExG4DetectorConstruction01()
{
DetectorConstruction0::~DetectorConstruction0()
{
delete fMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* ExG4DetectorConstruction01::Construct()
G4VPhysicalVolume* DetectorConstruction0::Construct()
{
// Define materials via NIST manager
//
G4NistManager* nistManager = G4NistManager::Instance();
auto nistManager = G4NistManager::Instance();
G4Material* material
= nistManager->FindOrBuildMaterial(fMaterialName);
auto material = nistManager->FindOrBuildMaterial(fMaterialName);
// World
//
G4Box* sWorld
auto sWorld
= new G4Box("World", //name
fDimensions.x(), //dimensions (half-lentghs)
fDimensions.y(),
@@ -80,7 +81,7 @@ G4VPhysicalVolume* ExG4DetectorConstruction01::Construct()
material, //material
"World"); //name
G4VPhysicalVolume* pWorld
auto pWorld
= new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
fWorldVolume, //logical volume
@@ -96,13 +97,11 @@ G4VPhysicalVolume* ExG4DetectorConstruction01::Construct()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4DetectorConstruction01::SetMaterial(const G4String& materialName)
void DetectorConstruction0::SetMaterial(const G4String& materialName)
{
G4NistManager* nistManager = G4NistManager::Instance();
G4Material* newMaterial
= nistManager->FindOrBuildMaterial(materialName);
auto nistManager = G4NistManager::Instance();
auto newMaterial = nistManager->FindOrBuildMaterial(materialName);
if ( ! newMaterial ) {
G4cerr << "Material " << materialName << " not found." << G4endl;
G4cerr << "The box material was not changed." << G4endl;
@@ -115,13 +114,39 @@ void ExG4DetectorConstruction01::SetMaterial(const G4String& materialName)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4DetectorConstruction01::SetDimensions(
G4double hx, G4double hy, G4double hz)
void DetectorConstruction0::SetDimensions(G4ThreeVector dimensions)
{
/// Set world dimension (in half lengths).
/// This setting has effect only if called in PreInit> phase
fDimensions = G4ThreeVector(hx, hy, hz);
fDimensions = dimensions;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction0::DefineCommands()
{
// Define /B5/detector command directory using generic messenger class
fMessenger = new G4GenericMessenger(this,
"/detector/",
"Detector control");
// setMaterial command
auto& setMaterialCmd
= fMessenger->DeclareMethod("setMaterial",
&DetectorConstruction0::SetMaterial,
"Set world material name.");
setMaterialCmd.SetParameterName("materialName", false);
setMaterialCmd.SetDefaultValue("G4_AIR");
setMaterialCmd.SetStates(G4State_PreInit);
// setDimensions command
auto& setDimensionsCmd
= fMessenger->DeclareMethodWithUnit("setDimensions", "mm",
&DetectorConstruction0::SetDimensions,
"Set world dimensions (in half lentgh).");
setDimensionsCmd.SetParameterName("dimensions", false);
setDimensionsCmd.SetStates(G4State_PreInit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,100 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: ExG4DetectorConstruction01Messenger.cc 85714 2014-11-04 14:30:40Z ihrivnac $
//
/// \file ExG4DetectorConstruction01Messenger.cc
/// \brief Implementation of the ExG4DetectorConstruction01Messenger class
#include "ExG4DetectorConstruction01Messenger.hh"
#include "ExG4DetectorConstruction01.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWith3VectorAndUnit.hh"
#include "G4UIcmdWithADouble.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4DetectorConstruction01Messenger::ExG4DetectorConstruction01Messenger(
ExG4DetectorConstruction01* detectorConstruction)
: G4UImessenger(),
fDetectorConstruction(detectorConstruction),
fTopDirectory(0),
fDirectory(0),
fSetMaterialCmd(0),
fSetDimensionsCmd(0)
{
fTopDirectory = new G4UIdirectory("/ExG4/");
fTopDirectory->SetGuidance("UI commands of common example classes");
fDirectory = new G4UIdirectory("/ExG4/det/");
fDirectory->SetGuidance("Detector control");
fSetMaterialCmd
= new G4UIcmdWithAString("/ExG4/det/setBoxMaterial",this);
fSetMaterialCmd->SetGuidance("Select material of the box.");
fSetMaterialCmd->SetParameterName("BoxMaterial", false);
fSetMaterialCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSetDimensionsCmd
= new G4UIcmdWith3VectorAndUnit("/ExG4/det/setBoxDimensions",this);
fSetDimensionsCmd->SetGuidance("Set box dimensions (in half lentgh).");
fSetDimensionsCmd->SetParameterName(
"BoxDimensionsHx", "BoxDimensionsHy","BoxDimensionsHz",
false);
//fSetDimensionsCmd->SetUnitCategory("Length");
fSetDimensionsCmd->AvailableForStates(G4State_PreInit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4DetectorConstruction01Messenger::~ExG4DetectorConstruction01Messenger()
{
delete fTopDirectory;
delete fDirectory;
delete fSetMaterialCmd;
delete fSetDimensionsCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4DetectorConstruction01Messenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
if( command == fSetMaterialCmd ) {
fDetectorConstruction->SetMaterial(newValue);
}
else if( command == fSetDimensionsCmd ) {
G4ThreeVector newDimensions
= fSetDimensionsCmd->GetNew3VectorValue(newValue);
fDetectorConstruction
->SetDimensions(
newDimensions.x(), newDimensions.y(), newDimensions.z());
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,125 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file ExG4DetectorConstruction02Messenger.cc
/// \brief Implementation of the ExG4DetectorConstruction02Messenger class
#include "ExG4DetectorConstruction02Messenger.hh"
#include "ExG4DetectorConstruction02.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWith3VectorAndUnit.hh"
#include "G4UIcmdWithADouble.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4DetectorConstruction02Messenger::ExG4DetectorConstruction02Messenger(
ExG4DetectorConstruction02* detectorConstruction)
: G4UImessenger(),
fDetectorConstruction(detectorConstruction),
fTopDirectory(0),
fDirectory(0),
fSetBoxMaterialCmd(0),
fSetWorldMaterialCmd(0),
fSetBoxDimensionsCmd(0),
fSetWorldSizeFactorCmd(0)
{
fTopDirectory = new G4UIdirectory("/ExG4/");
fTopDirectory->SetGuidance("UI commands of common example classes");
fDirectory = new G4UIdirectory("/ExG4/det/");
fDirectory->SetGuidance("Detector control");
fSetBoxMaterialCmd
= new G4UIcmdWithAString("/ExG4/det/setBoxMaterial",this);
fSetBoxMaterialCmd->SetGuidance("Select material of the box.");
fSetBoxMaterialCmd->SetParameterName("BoxMaterial", false);
fSetBoxMaterialCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSetWorldMaterialCmd
= new G4UIcmdWithAString("/ExG4/det/setWorldMaterial",this);
fSetWorldMaterialCmd->SetGuidance("Select material of the world.");
fSetWorldMaterialCmd->SetParameterName("WorldMaterial", false);
fSetWorldMaterialCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSetBoxDimensionsCmd
= new G4UIcmdWith3VectorAndUnit("/ExG4/det/setBoxDimensions",this);
fSetBoxDimensionsCmd->SetGuidance("Set box dimensions (in half lentgh).");
fSetBoxDimensionsCmd->SetParameterName(
"BoxDimensionsHx", "BoxDimensionsHy","BoxDimensionsHz",
false);
//fSetBoxDimensionsCmd->SetUnitCategory("Length");
fSetBoxDimensionsCmd->AvailableForStates(G4State_PreInit);
fSetWorldSizeFactorCmd
= new G4UIcmdWithADouble("/ExG4/det/setWorldSizeFactor",this);
fSetWorldSizeFactorCmd->SetGuidance(
"Set the multiplication factor from box dimensions to world dimensions.");
fSetWorldSizeFactorCmd->SetParameterName("WorldSizeFactor", false);
fSetWorldSizeFactorCmd->SetRange("WorldSizeFactor >= 1");
fSetWorldSizeFactorCmd->AvailableForStates(G4State_PreInit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4DetectorConstruction02Messenger::~ExG4DetectorConstruction02Messenger()
{
delete fTopDirectory;
delete fDirectory;
delete fSetBoxMaterialCmd;
delete fSetWorldMaterialCmd;
delete fSetBoxDimensionsCmd;
delete fSetWorldSizeFactorCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4DetectorConstruction02Messenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
if( command == fSetBoxMaterialCmd ) {
fDetectorConstruction->SetBoxMaterial(newValue);
}
else if( command == fSetWorldMaterialCmd ) {
fDetectorConstruction->SetWorldMaterial(newValue);
}
else if( command == fSetBoxDimensionsCmd ) {
G4ThreeVector newDimensions
= fSetBoxDimensionsCmd->GetNew3VectorValue(newValue);
fDetectorConstruction
->SetBoxDimensions(
newDimensions.x(), newDimensions.y(), newDimensions.z());
}
else if ( command == fSetWorldSizeFactorCmd ) {
fDetectorConstruction
->SetWorldSizeFactor(fSetWorldSizeFactorCmd->GetNewDoubleValue(newValue));
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,103 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file ExG4EventAction01.cc
/// \brief Implementation of the ExG4EventAction01 class
#include "ExG4EventAction01.hh"
#include "G4RunManager.hh"
#include "G4Run.hh"
#include "G4Event.hh"
#include "G4Trajectory.hh"
#include "G4TrajectoryContainer.hh"
#include "G4VVisManager.hh"
#include "Randomize.hh"
#include <sstream>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const G4int ExG4EventAction01::fgkDefaultVerboseLevel = 1;
const G4int ExG4EventAction01::fgkDefaultPrintModulo = 10000;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4EventAction01::ExG4EventAction01()
: G4UserEventAction(),
fMessenger(this),
fVerboseLevel(fgkDefaultVerboseLevel),
fSaveRndm(false)
{
/// Standard constructor
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4EventAction01::~ExG4EventAction01()
{
/// Destructor
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4EventAction01::BeginOfEventAction(const G4Event* event)
{
// Print event info
//
G4int eventNumber = event->GetEventID();
// Print verbose info
//
if ( fVerboseLevel > 1 ) {
G4cout << "<<< Event " << eventNumber << " started." << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4EventAction01::EndOfEventAction(const G4Event* event)
{
// Print verbose info
//
if ( fVerboseLevel > 1 ) {
G4cout << "<<< Event " << event->GetEventID() << " ended." << G4endl;
}
// Save rndm status
//
if ( fSaveRndm ) {
const G4Run* run = G4RunManager::GetRunManager()->GetCurrentRun();
G4int runNumber = run->GetRunID();
G4int eventNumber = event->GetEventID();
std::ostringstream fileName;
fileName << "run" << runNumber << "event" << eventNumber << ".rndm";
CLHEP::HepRandom::saveEngineStatus(fileName.str().c_str());
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,93 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file ExG4EventAction01Messenger.cc
/// \brief Implementation of the ExG4EventAction01Messenger class
#include "ExG4EventAction01Messenger.hh"
#include "ExG4EventAction01.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithABool.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4EventAction01Messenger::ExG4EventAction01Messenger(
ExG4EventAction01* eventAction)
: G4UImessenger(),
fEventAction(eventAction),
fTopDirectory(0),
fDirectory(0),
fSetVerboseLevelCmd(0),
fSetSaveRndmCmd(0)
{
fTopDirectory = new G4UIdirectory("/ExG4/");
fTopDirectory->SetGuidance("UI commands of common example classes");
fDirectory = new G4UIdirectory("/ExG4/event/");
fDirectory->SetGuidance("Event control");
fSetVerboseLevelCmd
= new G4UIcmdWithAnInteger("/ExG4/event/verboseLevel",this);
fSetVerboseLevelCmd->SetGuidance("Set event verbose level ." );
fSetVerboseLevelCmd->SetParameterName("VerboseLevel",false);
fSetVerboseLevelCmd->AvailableForStates(G4State_PreInit, G4State_Init);
fSetSaveRndmCmd = new G4UIcmdWithABool("/ExG4/event/saveRndm",this);
fSetSaveRndmCmd
->SetGuidance("Activate saving random number at endOfEvent.");
fSetSaveRndmCmd->SetParameterName("SaveRndm",false);
fSetSaveRndmCmd->AvailableForStates(G4State_Idle, G4State_Init);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4EventAction01Messenger::~ExG4EventAction01Messenger()
{
delete fTopDirectory;
delete fDirectory;
delete fSetVerboseLevelCmd;
delete fSetSaveRndmCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4EventAction01Messenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
if(command == fSetVerboseLevelCmd) {
fEventAction
->SetVerboseLevel(fSetVerboseLevelCmd->GetNewIntValue(newValue));
}
else if ( command == fSetSaveRndmCmd ) {
fEventAction->SetSaveRndm(fSetSaveRndmCmd->GetNewBoolValue(newValue));
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,129 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file ExG4RunAction01.cc
/// \brief Implementation of the ExG4RunAction01 class
#include "ExG4RunAction01.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4VVisManager.hh"
//#include "G4ios.hh"
//#include <iomanip>
#include "Randomize.hh"
const G4String ExG4RunAction01::fgkDefaultRndmFileName = "run0.rndm";
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4RunAction01::ExG4RunAction01()
: G4UserRunAction(),
fMessenger(this),
fRndmFileName(fgkDefaultRndmFileName),
fVerboseLevel(1),
fSaveRndm(false),
fReadRndm(false),
fAutoSeed(false)
{
/// Standard constructor
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4RunAction01::~ExG4RunAction01()
{
/// Destructor
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4RunAction01::BeginOfRunAction(const G4Run* run)
{
if ( fVerboseLevel > 0 ) {
G4cout << "### Run " << run->GetRunID() << " start." << G4endl;
}
// read Rndm status
if ( fReadRndm ) {
G4cout << "\n---> rndm status restored from file: " << fRndmFileName << G4endl;
G4Random::restoreEngineStatus(fRndmFileName);
G4Random::showEngineStatus();
}
// automatic (time-based) random seeds for each run
if ( fAutoSeed ) {
G4RunManager::GetRunManager()->SetRandomNumberStore(true);
G4RunManager::GetRunManager()->SetRandomNumberStoreDir("random/");
G4cout << "*******************" << G4endl;
G4cout << "*** AUTOSEED ON ***" << G4endl;
G4cout << "*******************" << G4endl;
long seeds[2];
time_t systime = time(NULL);
seeds[0] = (long) systime;
seeds[1] = (long) (systime*G4UniformRand());
G4Random::setTheSeeds(seeds);
G4Random::showEngineStatus();
}
// save Rndm status
if ( fSaveRndm ) {
G4int runNumber = run->GetRunID();
std::ostringstream fileName;
fileName << "run" << runNumber << ".rndm";
G4Random::saveEngineStatus(fileName.str().c_str());
G4Random::showEngineStatus();
}
if ( G4VVisManager::GetConcreteInstance() ) {
G4UImanager::GetUIpointer()->ApplyCommand("/vis/scene/notifyHandlers");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4RunAction01::EndOfRunAction(const G4Run* run)
{
// save Rndm status
if ( fSaveRndm ) {
G4int runNumber = run->GetRunID();
std::ostringstream fileName;
fileName << "run" << runNumber << "end.rndm";
G4Random::saveEngineStatus(fileName.str().c_str());
G4Random::showEngineStatus();
}
if ( G4VVisManager::GetConcreteInstance() ) {
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,122 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file ExG4RunAction01Messenger.cc
/// \brief Implementation of the ExG4RunAction01Messenger class
#include "ExG4RunAction01Messenger.hh"
#include "ExG4RunAction01.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithAString.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
ExG4RunAction01Messenger::ExG4RunAction01Messenger(ExG4RunAction01* runAction)
: G4UImessenger(),
fRunAction (runAction),
fTopDirectory(0),
fDirectory(0),
fSetVerboseLevelCmd(0),
fSetSaveRndmCmd(0),
fSetReadRndmCmd(0),
fSetRndmFileNameCmd(0),
fSetAutoSeedCmd(0)
{
fTopDirectory = new G4UIdirectory("/ExG4/");
fTopDirectory->SetGuidance("UI commands of common example classes");
fDirectory = new G4UIdirectory("/ExG4/event/");
fDirectory->SetGuidance("Event control");
fSetVerboseLevelCmd = new G4UIcmdWithAnInteger("/ExG4/run/verboseLevel",this);
fSetVerboseLevelCmd->SetGuidance("Set run verbose level ." );
fSetVerboseLevelCmd->SetParameterName("VerboseLevel",false);
fSetVerboseLevelCmd->AvailableForStates(G4State_PreInit, G4State_Init);
fSetSaveRndmCmd = new G4UIcmdWithABool("/ExG4/run/saveRndm",this);
fSetSaveRndmCmd
->SetGuidance("Activate saving random number at beginOfRun and endOfRun .");
fSetSaveRndmCmd->SetParameterName("SaveRndm",false);
fSetSaveRndmCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fSetReadRndmCmd = new G4UIcmdWithABool("/ExG4/run/readRndm",this);
fSetReadRndmCmd->SetGuidance("Get rndm status from an external file at beginOfRun.");
fSetReadRndmCmd->SetParameterName("ReadRndm",false);
fSetReadRndmCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fSetRndmFileNameCmd = new G4UIcmdWithAString("/ExG4/run/rndmFileName",this);
fSetRndmFileNameCmd->SetGuidance("Set rndm file name (to read from).");
fSetRndmFileNameCmd->SetParameterName("RndmFileName",false);
fSetRndmFileNameCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fSetAutoSeedCmd = new G4UIcmdWithABool("/ExG4/run/autoSeed",this);
fSetAutoSeedCmd->SetGuidance("Switch on/off time-based random seeds");
fSetAutoSeedCmd->SetGuidance(" true: run seeds determined by system time");
fSetAutoSeedCmd->SetGuidance(" false: use command 'random/resetEngineFrom'");
fSetAutoSeedCmd->SetParameterName("AutoSeed",false);
fSetAutoSeedCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
ExG4RunAction01Messenger::~ExG4RunAction01Messenger()
{
delete fTopDirectory;
delete fDirectory;
delete fSetVerboseLevelCmd;
delete fSetSaveRndmCmd;
delete fSetReadRndmCmd;
delete fSetRndmFileNameCmd;
delete fSetAutoSeedCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void ExG4RunAction01Messenger::SetNewValue(G4UIcommand* command,G4String newValues)
{
if ( command == fSetVerboseLevelCmd ) {
fRunAction->SetVerboseLevel(fSetVerboseLevelCmd->GetNewIntValue(newValues));
}
else if ( command == fSetSaveRndmCmd ) {
fRunAction->SetSaveRndm(fSetSaveRndmCmd->GetNewBoolValue(newValues));
}
else if ( command == fSetReadRndmCmd ) {
fRunAction->SetReadRndm(fSetReadRndmCmd->GetNewBoolValue(newValues));
}
else if (command == fSetRndmFileNameCmd) {
fRunAction->SetRndmFileName(newValues);
}
else if ( command == fSetAutoSeedCmd ) {
fRunAction->SetAutoSeed(fSetAutoSeedCmd->GetNewBoolValue(newValues));
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -25,27 +25,27 @@
//
// $Id$
//
/// \file ExG4PhysicsList00.cc
/// \brief Implementation of the ExG4PhysicsList00 class
/// \file GeantinoPhysicsList.cc
/// \brief Implementation of the GeantinoPhysicsList class
#include "ExG4PhysicsList00.hh"
#include "GeantinoPhysicsList.hh"
#include "G4Geantino.hh"
#include "G4ChargedGeantino.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4PhysicsList00::ExG4PhysicsList00()
GeantinoPhysicsList::GeantinoPhysicsList()
: G4VUserPhysicsList()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4PhysicsList00::~ExG4PhysicsList00()
GeantinoPhysicsList::~GeantinoPhysicsList()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4PhysicsList00::ConstructParticle()
void GeantinoPhysicsList::ConstructParticle()
{
// In this method, static member functions should be called
// for all particles which you want to use.
@@ -58,7 +58,7 @@ void ExG4PhysicsList00::ConstructParticle()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4PhysicsList00::ConstructProcess()
void GeantinoPhysicsList::ConstructProcess()
{
// Define transportation process
@@ -25,37 +25,37 @@
//
// $Id$
//
/// \file ExG4PrimaryGeneratorAction02.cc
/// \brief Implementation of the ExG4PrimaryGeneratorAction02 class
/// \file GpsPrimaryGeneratorAction.cc
/// \brief Implementation of the GpsPrimaryGeneratorActionclass
#include "ExG4PrimaryGeneratorAction02.hh"
#include "GpsPrimaryGeneratorAction.hh"
#include "G4Event.hh"
#include "G4GeneralParticleSource.hh"
#include "G4SystemOfUnits.hh"
const G4String ExG4PrimaryGeneratorAction02::fgkDefaultParticleName = "e-";
const G4double ExG4PrimaryGeneratorAction02::fgkDefaultEnergy = 1*MeV;
const G4String GpsPrimaryGeneratorAction::fgkDefaultParticleName = "e-";
const G4double GpsPrimaryGeneratorAction::fgkDefaultEnergy = 1.*MeV;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4PrimaryGeneratorAction02::ExG4PrimaryGeneratorAction02()
GpsPrimaryGeneratorAction::GpsPrimaryGeneratorAction()
: G4VUserPrimaryGeneratorAction(),
fGeneralParticleSource(0)
fGeneralParticleSource(nullptr)
{
fGeneralParticleSource = new G4GeneralParticleSource();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4PrimaryGeneratorAction02::~ExG4PrimaryGeneratorAction02()
GpsPrimaryGeneratorAction::~GpsPrimaryGeneratorAction()
{
delete fGeneralParticleSource;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4PrimaryGeneratorAction02::GeneratePrimaries(G4Event* anEvent)
void GpsPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
// this function is called at the begining of event
@@ -25,10 +25,10 @@
//
// $Id$
//
/// \file ExG4PrimaryGeneratorAction01.cc
/// \brief Implementation of the ExG4PrimaryGeneratorAction01 class
/// \file GunPrimaryGeneratorAction.cc
/// \brief Implementation of the GunPrimaryGeneratorAction class
#include "ExG4PrimaryGeneratorAction01.hh"
#include "GunPrimaryGeneratorAction.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
@@ -37,13 +37,13 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4PrimaryGeneratorAction01::ExG4PrimaryGeneratorAction01(
GunPrimaryGeneratorAction::GunPrimaryGeneratorAction(
const G4String& particleName,
G4double energy,
G4ThreeVector position,
G4ThreeVector momentumDirection)
: G4VUserPrimaryGeneratorAction(),
fParticleGun(0)
fParticleGun(nullptr)
{
G4int nofParticles = 1;
fParticleGun = new G4ParticleGun(nofParticles);
@@ -60,14 +60,14 @@ ExG4PrimaryGeneratorAction01::ExG4PrimaryGeneratorAction01(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4PrimaryGeneratorAction01::~ExG4PrimaryGeneratorAction01()
GunPrimaryGeneratorAction::~GunPrimaryGeneratorAction()
{
delete fParticleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4PrimaryGeneratorAction01::GeneratePrimaries(G4Event* anEvent)
void GunPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
// this function is called at the begining of event