Import Geant4 10.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2019-12-06 15:12:28 +01:00
parent b2a62ae692
commit 5baee230e9
2997 changed files with 141580 additions and 98673 deletions
@@ -32,6 +32,7 @@
#include "G4VScoringMesh.hh"
#include "G4ScoringBox.hh"
#include "G4ScoringCylinder.hh"
#include "G4ScoringRealWorld.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithoutParameter.hh"
@@ -49,7 +50,7 @@
G4ScoringMessenger::G4ScoringMessenger(G4ScoringManager* SManager)
:fSMan(SManager)
{
G4UIparameter* param;
G4UIparameter* param = nullptr;
scoreDir = new G4UIdirectory("/score/");
scoreDir->SetGuidance("Interactive scoring commands.");
@@ -83,6 +84,19 @@ G4ScoringMessenger::G4ScoringMessenger(G4ScoringManager* SManager)
// meshSphereCreateCmd = new G4UIcmdWithAString("/score/create/sphereMesh",this);
// meshSphereCreateCmd->SetGuidance("Create scoring mesh.");
// meshSphereCreateCmd->SetParameterName("MeshName",false);
//
meshRWLogVolCreateCmd = new G4UIcommand("/score/create/realWorldLogVol",this);
meshRWLogVolCreateCmd->SetGuidance("Define scorers to a logical volume defined in the real world.");
meshRWLogVolCreateCmd->SetGuidance(" - Name of the specified logical volume is used as the mesh name.");
meshRWLogVolCreateCmd->SetGuidance(" - /score/mesh commands do not affect for this mesh.");
meshRWLogVolCreateCmd->SetGuidance(" - If copyNumberLevel is set, the copy number of that-level higher");
meshRWLogVolCreateCmd->SetGuidance(" in the geometrical hierarchy is used as the index.");
param = new G4UIparameter("logVol",'s',false);
meshRWLogVolCreateCmd->SetParameter(param);
param = new G4UIparameter("copyNumberLevel",'i',true);
param->SetParameterRange("copyNumberLevel>=0");
param->SetDefaultValue(0);
meshRWLogVolCreateCmd->SetParameter(param);
//
meshOpnCmd = new G4UIcmdWithAString("/score/open",this);
meshOpnCmd->SetGuidance("Open scoring mesh.");
@@ -160,8 +174,8 @@ G4ScoringMessenger::G4ScoringMessenger(G4ScoringManager* SManager)
mRotDir = new G4UIdirectory("/score/mesh/rotate/");
mRotDir->SetGuidance("Mesh rotation commands.");
//
mRResetCmd = new G4UIcmdWithoutParameter("/score/mesh/rotate/reset",this);
mRResetCmd->SetGuidance("Reset rotation angles of the scoring mesh.");
//mRResetCmd = new G4UIcmdWithoutParameter("/score/mesh/rotate/reset",this);
//mRResetCmd->SetGuidance("Reset rotation angles of the scoring mesh.");
//
mRotXCmd = new G4UIcmdWithADoubleAndUnit("/score/mesh/rotate/rotateX",this);
mRotXCmd->SetGuidance("Rotate the scoring mesh in X axis.");
@@ -294,6 +308,7 @@ G4ScoringMessenger::~G4ScoringMessenger()
delete meshCreateDir;
delete meshBoxCreateCmd;
delete meshCylinderCreateCmd;
delete meshRWLogVolCreateCmd;
// delete meshSphereCreateCmd;
//
delete meshOpnCmd;
@@ -311,7 +326,7 @@ G4ScoringMessenger::~G4ScoringMessenger()
delete mTResetCmd;
delete mTXyzCmd;
delete mTransDir;
delete mRResetCmd;
// delete mRResetCmd;
delete mRotXCmd;
delete mRotYCmd;
delete mRotZCmd;
@@ -333,6 +348,8 @@ G4ScoringMessenger::~G4ScoringMessenger()
void G4ScoringMessenger::SetNewValue(G4UIcommand * command,G4String newVal)
{
using MeshShape = G4VScoringMesh::MeshShape;
if(command==listCmd) {
fSMan->List();
} else if(command==dumpCmd) {
@@ -419,6 +436,33 @@ void G4ScoringMessenger::SetNewValue(G4UIcommand * command,G4String newVal)
command->CommandFailed(ed);
}
}
} else if(command==meshRWLogVolCreateCmd) {
auto mesh = fSMan->GetCurrentMesh();
if ( mesh ){
G4ExceptionDescription ed;
ed << "ERROR[" << meshRWLogVolCreateCmd->GetCommandPath()
<< "] : Mesh <" << mesh->GetWorldName()
<< "> is still open. Close it first. Command ignored.";
command->CommandFailed(ed);
}
else
{
G4Tokenizer next(newVal);
G4String meshName = next();
G4int idx = StoI(next());
mesh = fSMan->FindMesh(meshName);
if ( !mesh ){
mesh = new G4ScoringRealWorld(meshName);
mesh->SetCopyNumberLevel(idx);
fSMan->RegisterScoringMesh(mesh);
}else{
G4ExceptionDescription ed;
ed << "ERROR[" << meshRWLogVolCreateCmd->GetCommandPath()
<< "] : Scoring mesh <" << meshName << "> already exists. Command ignored.";
command->CommandFailed(ed);
}
}
} else if(command==listColorMapCmd) {
fSMan->ListScoreColorMaps();
} else if(command==floatMinMaxCmd) {
@@ -478,6 +522,14 @@ void G4ScoringMessenger::SetNewValue(G4UIcommand * command,G4String newVal)
//
// Commands for Current Mesh
if ( mesh ){
MeshShape shape = mesh->GetShape();
if ( shape == MeshShape::realWorldLogVol ) {
G4ExceptionDescription ed;
ed << "ERROR[" << mBinCmd->GetCommandPath()
<< "] : Number of mesh command cannot be set for this type of mesh. Command ignored.";
command->CommandFailed(ed);
} else {
// Tokens
G4TokenVec token;
FillTokenVec(newVal,token);
@@ -488,8 +540,7 @@ void G4ScoringMessenger::SetNewValue(G4UIcommand * command,G4String newVal)
// mesh->Activate(meshActCmd->GetNewBoolValue(newVal));
// } else
if(command==mBoxSizeCmd) {
MeshShape shape = mesh->GetShape();
if ( shape == boxMesh ){
if ( shape == MeshShape::box){
G4ThreeVector size = mBoxSizeCmd->GetNew3VectorValue(newVal);
G4double vsize[3];
vsize[0] = size.x();
@@ -503,8 +554,7 @@ void G4ScoringMessenger::SetNewValue(G4UIcommand * command,G4String newVal)
command->CommandFailed(ed);
}
}else if(command==mCylinderSizeCmd) {
MeshShape shape = mesh->GetShape();
if ( shape == cylinderMesh ){
if ( shape == MeshShape::cylinder ){
G4double vsize[3];
vsize[0] = StoD(token[0]);
vsize[1] = StoD(token[1]);
@@ -520,7 +570,7 @@ void G4ScoringMessenger::SetNewValue(G4UIcommand * command,G4String newVal)
command->CommandFailed(ed);
}
} else if(command==mBinCmd) {
MeshBinCommand(mesh,token);
MeshBinCommand(mesh,token);
} else if(command==mTResetCmd) {
G4double centerPosition[3] ={ 0., 0., 0.};
mesh->SetCenterPosition(centerPosition);
@@ -531,7 +581,7 @@ void G4ScoringMessenger::SetNewValue(G4UIcommand * command,G4String newVal)
centerPosition[1] = xyz.y();
centerPosition[2] = xyz.z();
mesh->SetCenterPosition(centerPosition);
} else if(command==mRResetCmd) {
// } else if(command==mRResetCmd) {
} else if(command==mRotXCmd) {
G4double value = mRotXCmd->GetNewDoubleValue(newVal);
mesh->RotateX(value);
@@ -542,11 +592,12 @@ void G4ScoringMessenger::SetNewValue(G4UIcommand * command,G4String newVal)
G4double value = mRotZCmd->GetNewDoubleValue(newVal);
mesh->RotateZ(value);
}
}else{
G4ExceptionDescription ed;
ed << "ERROR: No mesh is currently open. Open/create a mesh first. Command ignored.";
command->CommandFailed(ed);
}
}else{
G4ExceptionDescription ed;
ed << "ERROR: No mesh is currently open. Open/create a mesh first. Command ignored.";
command->CommandFailed(ed);
}
}
}