Import Geant4 10.6.0 source tree
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include "G4ScoreQuantityMessenger.hh"
|
||||
#include "G4ScoringManager.hh"
|
||||
#include "G4VScoringMesh.hh"
|
||||
#include "G4VPrimitiveScorer.hh"
|
||||
|
||||
#include "G4PSCellCharge3D.hh"
|
||||
#include "G4PSCellFlux3D.hh"
|
||||
@@ -66,6 +67,30 @@
|
||||
#include "G4PSTrackCounter3D.hh"
|
||||
#include "G4PSTermination3D.hh"
|
||||
#include "G4PSMinKinEAtGeneration3D.hh"
|
||||
|
||||
#include "G4PSCellCharge.hh"
|
||||
#include "G4PSCellFlux.hh"
|
||||
#include "G4PSPassageCellFlux.hh"
|
||||
#include "G4PSEnergyDeposit.hh"
|
||||
#include "G4PSDoseDeposit.hh"
|
||||
#include "G4PSNofStep.hh"
|
||||
#include "G4PSNofSecondary.hh"
|
||||
//
|
||||
#include "G4PSTrackLength.hh"
|
||||
#include "G4PSPassageCellCurrent.hh"
|
||||
#include "G4PSPassageTrackLength.hh"
|
||||
#include "G4PSFlatSurfaceCurrent.hh"
|
||||
#include "G4PSFlatSurfaceFlux.hh"
|
||||
#include "G4PSSphereSurfaceCurrent.hh"
|
||||
#include "G4PSSphereSurfaceFlux.hh"
|
||||
#include "G4PSCylinderSurfaceCurrent.hh"
|
||||
#include "G4PSCylinderSurfaceFlux.hh"
|
||||
#include "G4PSNofCollision.hh"
|
||||
#include "G4PSPopulation.hh"
|
||||
#include "G4PSTrackCounter.hh"
|
||||
#include "G4PSTermination.hh"
|
||||
#include "G4PSMinKinEAtGeneration.hh"
|
||||
|
||||
//
|
||||
// For debug purpose
|
||||
#include "G4PSStepChecker3D.hh"
|
||||
@@ -214,7 +239,10 @@ G4ScoreQuantityMessenger::~G4ScoreQuantityMessenger()
|
||||
|
||||
void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal)
|
||||
{
|
||||
using MeshShape = G4VScoringMesh::MeshShape;
|
||||
|
||||
G4ExceptionDescription ed;
|
||||
|
||||
//
|
||||
// Get Current Mesh
|
||||
//
|
||||
@@ -225,6 +253,8 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
|
||||
command->CommandFailed(ed);
|
||||
return;
|
||||
}
|
||||
// Mesh type
|
||||
auto shape = mesh->GetShape();
|
||||
// Tokens
|
||||
G4TokenVec token;
|
||||
FillTokenVec(newVal,token);
|
||||
@@ -238,84 +268,112 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
|
||||
mesh->SetCurrentPSUnit(newVal);
|
||||
} else if(command== qCellChgCmd) {
|
||||
if ( CheckMeshPS(mesh,token[0],command) ){
|
||||
G4PSCellCharge3D* ps = new G4PSCellCharge3D(token[0]);
|
||||
G4PSCellCharge* ps = nullptr;
|
||||
if(shape==MeshShape::realWorldLogVol)
|
||||
{ ps = new G4PSCellCharge(token[0],mesh->GetCopyNumberLevel()); }
|
||||
else
|
||||
{ ps = new G4PSCellCharge3D(token[0]); }
|
||||
ps->SetUnit(token[1]);
|
||||
mesh->SetPrimitiveScorer(ps);
|
||||
}
|
||||
} else if(command== qCellFluxCmd) {
|
||||
if ( CheckMeshPS(mesh,token[0],command) ){
|
||||
if( mesh->GetShape()==boxMesh ) {
|
||||
G4PSCellFlux3D* ps = new G4PSCellFlux3D(token[0]);
|
||||
ps->SetUnit(token[1]);
|
||||
mesh->SetPrimitiveScorer(ps);
|
||||
} else if( mesh->GetShape()==cylinderMesh ) {
|
||||
G4PSCellFluxForCylinder3D* ps =
|
||||
new G4PSCellFluxForCylinder3D(token[0]);
|
||||
ps->SetUnit(token[1]);
|
||||
G4PSCellFlux* ps = nullptr;
|
||||
if( shape==MeshShape::box ) {
|
||||
ps = new G4PSCellFlux3D(token[0]);
|
||||
} else if( shape==MeshShape::cylinder ) {
|
||||
G4PSCellFluxForCylinder3D* pps = new G4PSCellFluxForCylinder3D(token[0]);
|
||||
G4ThreeVector msize = mesh->GetSize(); // gevin in R Z N/A
|
||||
ps->SetCylinderSize(msize[0],msize[1]); // given in dr dz
|
||||
pps->SetCylinderSize(msize[0],msize[1]); // given in dr dz
|
||||
G4int nSeg[3];
|
||||
mesh->GetNumberOfSegments(nSeg);
|
||||
ps->SetNumberOfSegments(nSeg);
|
||||
mesh->SetPrimitiveScorer(ps);
|
||||
pps->SetNumberOfSegments(nSeg);
|
||||
ps = pps;
|
||||
} else if(shape==MeshShape::realWorldLogVol) {
|
||||
ed<<"Cell flux for real world volume is not yet supported. Command ignored.";
|
||||
command->CommandFailed(ed);
|
||||
return;
|
||||
}
|
||||
ps->SetUnit(token[1]);
|
||||
mesh->SetPrimitiveScorer(ps);
|
||||
}
|
||||
} else if(command== qPassCellFluxCmd) {
|
||||
if ( CheckMeshPS(mesh,token[0],command) ){
|
||||
if( mesh->GetShape()==boxMesh ) {
|
||||
G4PSPassageCellFlux3D* ps = new G4PSPassageCellFlux3D(token[0]);
|
||||
ps->SetUnit(token[1]);
|
||||
mesh->SetPrimitiveScorer(ps);
|
||||
} else if( mesh->GetShape()==cylinderMesh ) {
|
||||
G4PSPassageCellFluxForCylinder3D* ps =
|
||||
new G4PSPassageCellFluxForCylinder3D(token[0]);
|
||||
ps->SetUnit(token[1]);
|
||||
G4PSPassageCellFlux* ps = nullptr;
|
||||
if( shape==MeshShape::box ) {
|
||||
ps = new G4PSPassageCellFlux3D(token[0]);
|
||||
} else if( shape==MeshShape::cylinder ) {
|
||||
G4PSPassageCellFluxForCylinder3D* pps = new G4PSPassageCellFluxForCylinder3D(token[0]);
|
||||
G4ThreeVector msize = mesh->GetSize(); // gevin in R Z N/A
|
||||
ps->SetCylinderSize(msize[0],msize[1]); // given in dr dz
|
||||
pps->SetCylinderSize(msize[0],msize[1]); // given in dr dz
|
||||
G4int nSeg[3];
|
||||
mesh->GetNumberOfSegments(nSeg);
|
||||
ps->SetNumberOfSegments(nSeg);
|
||||
mesh->SetPrimitiveScorer(ps);
|
||||
pps->SetNumberOfSegments(nSeg);
|
||||
ps = pps;
|
||||
} else if(shape==MeshShape::realWorldLogVol) {
|
||||
ed<<"Passing cell flux for real world volume is not yet supported. Command ignored.";
|
||||
command->CommandFailed(ed);
|
||||
return;
|
||||
}
|
||||
ps->SetUnit(token[1]);
|
||||
mesh->SetPrimitiveScorer(ps);
|
||||
}
|
||||
} else if(command==qeDepCmd) {
|
||||
if ( CheckMeshPS(mesh,token[0],command) ){
|
||||
G4PSEnergyDeposit3D* ps =new G4PSEnergyDeposit3D(token[0]);
|
||||
G4PSEnergyDeposit* ps = nullptr;
|
||||
if(shape==MeshShape::realWorldLogVol)
|
||||
{ ps =new G4PSEnergyDeposit(token[0],mesh->GetCopyNumberLevel()); }
|
||||
else
|
||||
{ ps =new G4PSEnergyDeposit3D(token[0]); }
|
||||
ps->SetUnit(token[1]);
|
||||
mesh->SetPrimitiveScorer(ps);
|
||||
}
|
||||
} else if(command== qdoseDepCmd) {
|
||||
if ( CheckMeshPS(mesh,token[0],command) ){
|
||||
if( mesh->GetShape()==boxMesh ) {
|
||||
G4PSDoseDeposit3D* ps = new G4PSDoseDeposit3D(token[0]);
|
||||
ps->SetUnit(token[1]);
|
||||
mesh->SetPrimitiveScorer(ps);
|
||||
} else if( mesh->GetShape()==cylinderMesh ) {
|
||||
G4PSDoseDepositForCylinder3D* ps =
|
||||
new G4PSDoseDepositForCylinder3D(token[0]);
|
||||
ps->SetUnit(token[1]);
|
||||
G4PSDoseDeposit* ps = nullptr;
|
||||
if( shape==MeshShape::box ) {
|
||||
ps = new G4PSDoseDeposit3D(token[0]);
|
||||
} else if( shape==MeshShape::cylinder ) {
|
||||
G4PSDoseDepositForCylinder3D* pps = new G4PSDoseDepositForCylinder3D(token[0]);
|
||||
pps->SetUnit(token[1]);
|
||||
G4ThreeVector msize = mesh->GetSize(); // gevin in R Z N/A
|
||||
ps->SetCylinderSize(msize[0],msize[1]); // given in dr dz
|
||||
pps->SetCylinderSize(msize[0],msize[1]); // given in dr dz
|
||||
G4int nSeg[3];
|
||||
mesh->GetNumberOfSegments(nSeg);
|
||||
ps->SetNumberOfSegments(nSeg);
|
||||
mesh->SetPrimitiveScorer(ps);
|
||||
pps->SetNumberOfSegments(nSeg);
|
||||
ps = pps;
|
||||
} else if(shape==MeshShape::realWorldLogVol) {
|
||||
ps = new G4PSDoseDeposit(token[0],mesh->GetCopyNumberLevel());
|
||||
}
|
||||
ps->SetUnit(token[1]);
|
||||
mesh->SetPrimitiveScorer(ps);
|
||||
}
|
||||
} else if(command== qnOfStepCmd) {
|
||||
if ( CheckMeshPS(mesh,token[0],command) ){
|
||||
G4PSNofStep3D* ps = new G4PSNofStep3D(token[0]);
|
||||
G4PSNofStep* ps = nullptr;
|
||||
if(shape==MeshShape::realWorldLogVol)
|
||||
{ ps = new G4PSNofStep(token[0],mesh->GetCopyNumberLevel()); }
|
||||
else
|
||||
{ ps = new G4PSNofStep3D(token[0]); }
|
||||
ps->SetBoundaryFlag(StoB(token[1]));
|
||||
mesh->SetPrimitiveScorer(ps);
|
||||
}
|
||||
} else if(command== qnOfSecondaryCmd) {
|
||||
if ( CheckMeshPS(mesh,token[0],command) ){
|
||||
G4PSNofSecondary3D* ps =new G4PSNofSecondary3D(token[0]);
|
||||
G4PSNofSecondary* ps = nullptr;
|
||||
if(shape==MeshShape::realWorldLogVol)
|
||||
{ ps = new G4PSNofSecondary(token[0],mesh->GetCopyNumberLevel()); }
|
||||
else
|
||||
{ ps = new G4PSNofSecondary3D(token[0]); }
|
||||
mesh->SetPrimitiveScorer(ps);
|
||||
}
|
||||
} else if(command== qTrackLengthCmd) {
|
||||
if ( CheckMeshPS(mesh,token[0],command) ){
|
||||
G4PSTrackLength3D* ps = new G4PSTrackLength3D(token[0]);
|
||||
G4PSTrackLength* ps = nullptr;
|
||||
if(shape==MeshShape::realWorldLogVol)
|
||||
{ ps = new G4PSTrackLength(token[0],mesh->GetCopyNumberLevel()); }
|
||||
else
|
||||
{ ps = new G4PSTrackLength3D(token[0]); }
|
||||
ps->Weighted(StoB(token[1]));
|
||||
ps->MultiplyKineticEnergy(StoB(token[2]));
|
||||
ps->DivideByVelocity(StoB(token[3]));
|
||||
@@ -324,21 +382,32 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
|
||||
}
|
||||
} else if(command== qPassCellCurrCmd){
|
||||
if( CheckMeshPS(mesh,token[0],command) ) {
|
||||
G4PSPassageCellCurrent* ps = new G4PSPassageCellCurrent3D(token[0]);
|
||||
G4PSPassageCellCurrent* ps = nullptr;
|
||||
if(shape==MeshShape::realWorldLogVol)
|
||||
{ ps = new G4PSPassageCellCurrent(token[0],mesh->GetCopyNumberLevel()); }
|
||||
else
|
||||
{ ps = new G4PSPassageCellCurrent3D(token[0]); }
|
||||
ps->Weighted(StoB(token[1]));
|
||||
mesh->SetPrimitiveScorer(ps);
|
||||
}
|
||||
} else if(command== qPassTrackLengthCmd){
|
||||
if( CheckMeshPS(mesh,token[0],command) ) {
|
||||
G4PSPassageTrackLength* ps = new G4PSPassageTrackLength3D(token[0]);
|
||||
G4PSPassageTrackLength* ps = nullptr;
|
||||
if(shape==MeshShape::realWorldLogVol)
|
||||
{ ps = new G4PSPassageTrackLength(token[0],mesh->GetCopyNumberLevel()); }
|
||||
else
|
||||
{ ps = new G4PSPassageTrackLength3D(token[0]); }
|
||||
ps->Weighted(StoB(token[1]));
|
||||
ps->SetUnit(token[2]);
|
||||
mesh->SetPrimitiveScorer(ps);
|
||||
}
|
||||
} else if(command== qFlatSurfCurrCmd){
|
||||
if( CheckMeshPS(mesh,token[0],command)) {
|
||||
G4PSFlatSurfaceCurrent3D* ps =
|
||||
new G4PSFlatSurfaceCurrent3D(token[0],StoI(token[1]));
|
||||
G4PSFlatSurfaceCurrent* ps = nullptr;
|
||||
if(shape==MeshShape::realWorldLogVol)
|
||||
{ ps = new G4PSFlatSurfaceCurrent(token[0],StoI(token[1]),mesh->GetCopyNumberLevel()); }
|
||||
else
|
||||
{ ps = new G4PSFlatSurfaceCurrent3D(token[0],StoI(token[1])); }
|
||||
ps->Weighted(StoB(token[2]));
|
||||
ps->DivideByArea(StoB(token[3]));
|
||||
if ( StoB(token[3]) ){
|
||||
@@ -350,7 +419,11 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
|
||||
}
|
||||
} else if(command== qFlatSurfFluxCmd){
|
||||
if( CheckMeshPS(mesh, token[0],command )) {
|
||||
G4PSFlatSurfaceFlux3D* ps = new G4PSFlatSurfaceFlux3D(token[0],StoI(token[1]));
|
||||
G4PSFlatSurfaceFlux* ps = nullptr;
|
||||
if(shape==MeshShape::realWorldLogVol)
|
||||
{ ps = new G4PSFlatSurfaceFlux(token[0],StoI(token[1]),mesh->GetCopyNumberLevel()); }
|
||||
else
|
||||
{ ps = new G4PSFlatSurfaceFlux3D(token[0],StoI(token[1])); }
|
||||
ps->Weighted(StoB(token[2]));
|
||||
ps->DivideByArea(StoB(token[3]));
|
||||
if ( StoB(token[3]) ){
|
||||
@@ -413,38 +486,62 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
|
||||
// }
|
||||
} else if(command== qNofCollisionCmd){
|
||||
if( CheckMeshPS(mesh,token[0],command)) {
|
||||
G4PSNofCollision3D* ps =new G4PSNofCollision3D(token[0]);
|
||||
G4PSNofCollision* ps = nullptr;
|
||||
if(shape==MeshShape::realWorldLogVol)
|
||||
{ ps = new G4PSNofCollision3D(token[0],mesh->GetCopyNumberLevel()); }
|
||||
else
|
||||
{ ps = new G4PSNofCollision3D(token[0]); }
|
||||
ps->Weighted(StoB(token[1]));
|
||||
mesh->SetPrimitiveScorer(ps);
|
||||
}
|
||||
} else if(command== qPopulationCmd){
|
||||
if( CheckMeshPS(mesh,token[0],command) ) {
|
||||
G4PSPopulation3D* ps =new G4PSPopulation3D(token[0]);
|
||||
G4PSPopulation* ps = nullptr;
|
||||
if(shape==MeshShape::realWorldLogVol)
|
||||
{ ps = new G4PSPopulation(token[0],mesh->GetCopyNumberLevel()); }
|
||||
else
|
||||
{ ps = new G4PSPopulation3D(token[0]); }
|
||||
ps->Weighted(StoB(token[1]));
|
||||
mesh->SetPrimitiveScorer(ps);
|
||||
}
|
||||
} else if(command== qTrackCountCmd){
|
||||
if( CheckMeshPS(mesh,token[0],command)) {
|
||||
G4PSTrackCounter3D* ps =new G4PSTrackCounter3D(token[0],StoI(token[1]));
|
||||
G4PSTrackCounter* ps = nullptr;
|
||||
if(shape==MeshShape::realWorldLogVol)
|
||||
{ ps = new G4PSTrackCounter(token[0],StoI(token[1]),mesh->GetCopyNumberLevel()); }
|
||||
else
|
||||
{ ps = new G4PSTrackCounter3D(token[0],StoI(token[1])); }
|
||||
ps->Weighted(StoB(token[2]));
|
||||
mesh->SetPrimitiveScorer(ps);
|
||||
}
|
||||
} else if(command== qTerminationCmd){
|
||||
if( CheckMeshPS(mesh,token[0],command)) {
|
||||
G4PSTermination3D* ps =new G4PSTermination3D(token[0]);
|
||||
G4PSTermination* ps = nullptr;
|
||||
if(shape==MeshShape::realWorldLogVol)
|
||||
{ ps = new G4PSTermination(token[0],mesh->GetCopyNumberLevel()); }
|
||||
else
|
||||
{ ps = new G4PSTermination3D(token[0]); }
|
||||
ps->Weighted(StoB(token[1]));
|
||||
mesh->SetPrimitiveScorer(ps);
|
||||
}
|
||||
|
||||
} else if(command== qMinKinEAtGeneCmd){
|
||||
if( CheckMeshPS(mesh,token[0],command) ){
|
||||
G4PSMinKinEAtGeneration3D* ps =new G4PSMinKinEAtGeneration3D(token[0]);
|
||||
G4PSMinKinEAtGeneration* ps = nullptr;
|
||||
if(shape==MeshShape::realWorldLogVol)
|
||||
{ ps = new G4PSMinKinEAtGeneration(token[0],mesh->GetCopyNumberLevel()); }
|
||||
else
|
||||
{ ps = new G4PSMinKinEAtGeneration3D(token[0]); }
|
||||
ps->SetUnit(token[1]);
|
||||
mesh->SetPrimitiveScorer(ps);
|
||||
}
|
||||
} else if(command== qStepCheckerCmd){
|
||||
if( CheckMeshPS(mesh,token[0],command) ){
|
||||
G4PSStepChecker3D* ps =new G4PSStepChecker3D(token[0]);
|
||||
G4PSStepChecker* ps = nullptr;
|
||||
if(shape==MeshShape::realWorldLogVol)
|
||||
{ ps = new G4PSStepChecker(token[0],mesh->GetCopyNumberLevel()); }
|
||||
else
|
||||
{ ps = new G4PSStepChecker3D(token[0]); }
|
||||
mesh->SetPrimitiveScorer(ps);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
G4ScoringBox::G4ScoringBox(G4String wName)
|
||||
:G4VScoringMesh(wName), fSegmentDirection(-1)
|
||||
{
|
||||
fShape = boxMesh;
|
||||
fShape = MeshShape::box;
|
||||
fDivisionAxisNames[0] = "X";
|
||||
fDivisionAxisNames[1] = "Y";
|
||||
fDivisionAxisNames[2] = "Z";
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
G4ScoringCylinder::G4ScoringCylinder(G4String wName)
|
||||
:G4VScoringMesh(wName)
|
||||
{
|
||||
fShape = cylinderMesh;
|
||||
fShape = MeshShape::cylinder;
|
||||
|
||||
fDivisionAxisNames[0] = "Z";
|
||||
fDivisionAxisNames[1] = "PHI";
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#include "G4ScoringRealWorld.hh"
|
||||
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4PhysicalVolumeStore.hh"
|
||||
#include "G4Region.hh"
|
||||
|
||||
#include "G4MultiFunctionalDetector.hh"
|
||||
#include "G4SDParticleFilter.hh"
|
||||
#include "G4VPrimitiveScorer.hh"
|
||||
|
||||
#include "G4ScoringManager.hh"
|
||||
#include "G4StatDouble.hh"
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
G4ScoringRealWorld::G4ScoringRealWorld(G4String lvName)
|
||||
:G4VScoringMesh(lvName)
|
||||
{
|
||||
fShape = MeshShape::realWorldLogVol;
|
||||
logVolName = lvName;
|
||||
G4double size[] = {0.,0.,0.};
|
||||
SetSize(size);
|
||||
G4int nBin[] = {1,1,1};
|
||||
SetNumberOfSegments(nBin);
|
||||
}
|
||||
|
||||
G4ScoringRealWorld::~G4ScoringRealWorld()
|
||||
{
|
||||
}
|
||||
|
||||
void G4ScoringRealWorld::List() const
|
||||
{
|
||||
G4cout << "G4ScoringRealWorld : " << logVolName << G4endl;
|
||||
G4VScoringMesh::List();
|
||||
}
|
||||
|
||||
void G4ScoringRealWorld::SetupGeometry(G4VPhysicalVolume* )
|
||||
{
|
||||
auto store = G4LogicalVolumeStore::GetInstance();
|
||||
auto itr = store->begin();
|
||||
for(;itr!=store->end();itr++)
|
||||
{
|
||||
if((*itr)->GetName()==logVolName)
|
||||
{
|
||||
fMeshElementLogical = (*itr); // Logical volume to score
|
||||
G4int nb = 0;
|
||||
auto pvStore = G4PhysicalVolumeStore::GetInstance();
|
||||
auto pvItr = pvStore->begin();
|
||||
for(;pvItr!=pvStore->end();pvItr++)
|
||||
{
|
||||
if((*pvItr)->GetLogicalVolume()==(*itr))
|
||||
{ nb += (*pvItr)->GetMultiplicity(); }
|
||||
}
|
||||
G4int nBin[] = {nb,1,1};
|
||||
SetNumberOfSegments(nBin);
|
||||
// check if this logical volume belongs to the real world
|
||||
auto region = (*itr)->GetRegion();
|
||||
if(region && !(region->IsInMassGeometry()))
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Logical Volume with name <" << logVolName << "> is not used in the mass world.";
|
||||
G4Exception("G4ScoringRealWorld","SWV0001",FatalException,ed);
|
||||
}
|
||||
// set the sensitive detector
|
||||
fMeshElementLogical->SetSensitiveDetector(fMFD);
|
||||
return;
|
||||
}
|
||||
}
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Logical Volume with name <" << logVolName << "> is not found";
|
||||
G4Exception("G4ScoringRealWorld","SWV0000",FatalException,ed);
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ void G4VScoreWriter::DumpQuantityToFile(const G4String& psName,
|
||||
}
|
||||
ofile << "# mesh name: " << fScoringMesh->GetWorldName() << G4endl;
|
||||
|
||||
|
||||
using MeshScoreMap = G4VScoringMesh::MeshScoreMap;
|
||||
// retrieve the map
|
||||
MeshScoreMap fSMap = fScoringMesh->GetScoreMap();
|
||||
|
||||
@@ -174,6 +174,7 @@ void G4VScoreWriter::DumpAllQuantitiesToFile(const G4String& fileName,
|
||||
ofile << "# mesh name: " << fScoringMesh->GetWorldName() << G4endl;
|
||||
|
||||
// retrieve the map
|
||||
using MeshScoreMap = G4VScoringMesh::MeshScoreMap;
|
||||
MeshScoreMap fSMap = fScoringMesh->GetScoreMap();
|
||||
MeshScoreMap::const_iterator msMapItr = fSMap.begin();
|
||||
std::map<G4int, G4StatDouble*> * score;
|
||||
|
||||
@@ -43,11 +43,13 @@
|
||||
#include "G4SDManager.hh"
|
||||
|
||||
G4VScoringMesh::G4VScoringMesh(const G4String& wName)
|
||||
: fWorldName(wName),fCurrentPS(nullptr),fConstructed(false),fActive(true),fShape(undefinedMesh),
|
||||
: fWorldName(wName),fCurrentPS(nullptr),fConstructed(false),fActive(true),
|
||||
fShape(MeshShape::undefined),
|
||||
fRotationMatrix(nullptr), fMFD(new G4MultiFunctionalDetector(wName)),
|
||||
verboseLevel(0),sizeIsSet(false),nMeshIsSet(false),
|
||||
fDrawUnit(""), fDrawUnitValue(1.), fMeshElementLogical(nullptr),
|
||||
fParallelWorldProcess(nullptr), fGeometryHasBeenDestroyed(false)
|
||||
fParallelWorldProcess(nullptr), fGeometryHasBeenDestroyed(false),
|
||||
copyNumberLevel(0)
|
||||
{
|
||||
G4SDManager::GetSDMpointer()->AddNewDetector(fMFD);
|
||||
|
||||
@@ -90,7 +92,7 @@ void G4VScoringMesh::SetCenterPosition(G4double centerPosition[3]) {
|
||||
fCenterPosition = G4ThreeVector(centerPosition[0], centerPosition[1], centerPosition[2]);
|
||||
}
|
||||
void G4VScoringMesh::SetNumberOfSegments(G4int nSegment[3]) {
|
||||
if ( !nMeshIsSet ){
|
||||
if ( !nMeshIsSet || fShape==MeshShape::realWorldLogVol ){
|
||||
for(int i = 0; i < 3; i++) fNSegment[i] = nSegment[i];
|
||||
nMeshIsSet = true;
|
||||
} else {
|
||||
@@ -357,7 +359,7 @@ void G4VScoringMesh::Construct(G4VPhysicalVolume* fWorldPhys)
|
||||
fGeometryHasBeenDestroyed = false;
|
||||
}
|
||||
if(verboseLevel > 0)
|
||||
G4cout << fWorldPhys->GetName() << " --- All quantities are reset."
|
||||
G4cout << fWorldName << " --- All quantities are reset."
|
||||
<< G4endl;
|
||||
ResetScore();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user