Import Geant4 10.7.0 source tree

This commit is contained in:
Gabriele Cosmo
2020-12-04 12:30:43 +01:00
parent 67ba86d073
commit dab42d2018
3770 changed files with 226369 additions and 286486 deletions
@@ -62,6 +62,7 @@
#include "G4PSSphereSurfaceFlux3D.hh"
#include "G4PSCylinderSurfaceCurrent3D.hh"
#include "G4PSCylinderSurfaceFlux3D.hh"
#include "G4PSVolumeFlux3D.hh"
#include "G4PSNofCollision3D.hh"
#include "G4PSPopulation3D.hh"
#include "G4PSTrackCounter3D.hh"
@@ -217,6 +218,7 @@ G4ScoreQuantityMessenger::~G4ScoreQuantityMessenger()
delete qPassTrackLengthCmd;
delete qFlatSurfCurrCmd;
delete qFlatSurfFluxCmd;
delete qVolFluxCmd;
// delete qSphereSurfCurrCmd;
// delete qSphereSurfFluxCmd;
// delete qCylSurfCurrCmd;
@@ -437,6 +439,17 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
}
mesh->SetPrimitiveScorer(ps);
}
} else if(command== qVolFluxCmd) {
if( CheckMeshPS(mesh, token[0],command )) {
G4PSVolumeFlux* ps = nullptr;
if(shape==MeshShape::realWorldLogVol || shape==MeshShape::probe)
{ ps = new G4PSVolumeFlux(token[0],StoI(token[2]),mesh->GetCopyNumberLevel()); }
else
{ ps = new G4PSVolumeFlux3D(token[0],StoI(token[2])); }
ps->SetDivCos(StoI(token[1]));
mesh->SetPrimitiveScorer(ps);
}
// } else if(command== qSphereSurfCurrCmd){
// if( CheckMeshPS(mesh, token[0],command )) {
// G4PSSphereSurfaceCurrent3D* ps =
@@ -58,6 +58,7 @@
#include "G4PSSphereSurfaceFlux3D.hh"
#include "G4PSCylinderSurfaceCurrent3D.hh"
#include "G4PSCylinderSurfaceFlux3D.hh"
#include "G4PSVolumeFlux3D.hh"
#include "G4PSNofCollision3D.hh"
#include "G4PSPopulation3D.hh"
#include "G4PSTrackCounter3D.hh"
@@ -291,6 +292,24 @@ void G4ScoreQuantityMessenger::QuantityCommands()
param->SetDefaultValue("percm2");
qFlatSurfFluxCmd->SetParameter(param);
//
qVolFluxCmd = new G4UIcommand("/score/quantity/volumeFlux",this);
qVolFluxCmd->SetGuidance("Volume flux scorer.");
qVolFluxCmd->SetGuidance("This scorer scores the number of particles getting into the volume without normalized by the surface area.");
qVolFluxCmd->SetGuidance("[usage] /score/quantity/volumeFlux qname divcos dflag");
qVolFluxCmd->SetGuidance(" qname :(String) scorer name");
qVolFluxCmd->SetGuidance(" divcos :(Bool) divide by cos(theta), where theta is the incident angle (default : false)");
qVolFluxCmd->SetGuidance(" dflag :(Int) direction, 1 : inward (default), 2 : outward");
param = new G4UIparameter("qname",'s',false);
qVolFluxCmd->SetParameter(param);
param = new G4UIparameter("divcos",'b',true);
param->SetDefaultValue(false);
qVolFluxCmd->SetParameter(param);
param = new G4UIparameter("dflag",'i',true);
param->SetParameterRange("dflag>=1 && dflag<=2");
param->SetDefaultValue(1);
qVolFluxCmd->SetParameter(param);
// qSphereSurfCurrCmd = new G4UIcommand("/score/quantity/sphereSurfaceCurrent",this);
// qSphereSurfCurrCmd->SetGuidance("Sphere surface current Scorer.");
// qSphereSurfCurrCmd->
@@ -24,7 +24,6 @@
// ********************************************************************
//
//
//
// ---------------------------------------------------------------------
#include "G4ScoringMessenger.hh"
@@ -360,6 +359,23 @@ G4ScoringMessenger::G4ScoringMessenger(G4ScoringManager* SManager)
dumpAllQtsWithFactorCmd->SetParameter(param);
dumpAllQtsWithFactorCmd->SetToBeBroadcasted(false);
fill1DCmd = new G4UIcommand("/score/fill1D", this);
fill1DCmd->SetGuidance("Let a primitive scorer fill 1-D histogram");
fill1DCmd->SetGuidance("Before using this command, primitive scorer must be defined and assigned.");
fill1DCmd->SetGuidance("Also before using this command, a histogram has to be defined by /analysis/h1/create command.");
fill1DCmd->SetGuidance("This command is available only for real-world volume or probe.");
fill1DCmd->SetGuidance("Please note that this command has to be applied to each copy number of the scoring volume.");
fill1DCmd->SetGuidance("If same histogram ID is used more than once, more than one scorers fill that histogram.");
param = new G4UIparameter("histID", 'i', false);
fill1DCmd->SetParameter(param);
param = new G4UIparameter("meshName", 's', false);
fill1DCmd->SetParameter(param);
param = new G4UIparameter("scorerName", 's', false);
fill1DCmd->SetParameter(param);
param = new G4UIparameter("copyNo", 'i', true);
param->SetDefaultValue(0);
fill1DCmd->SetParameter(param);
}
G4ScoringMessenger::~G4ScoringMessenger()
@@ -411,6 +427,7 @@ G4ScoringMessenger::~G4ScoringMessenger()
delete dumpQtyWithFactorCmd;
delete dumpAllQtsToFileCmd;
delete dumpAllQtsWithFactorCmd;
delete fill1DCmd;
//
delete scoreDir;
}
@@ -510,6 +527,8 @@ void G4ScoringMessenger::SetNewValue(G4UIcommand * command,G4String newVal)
fSMan->SetFactor(fac);
fSMan->DumpAllQuantitiesToFile(meshName, fileName, option);
fSMan->SetFactor(1.0);
} else if(command==fill1DCmd) {
Fill1D(command,newVal);
} else if(command==verboseCmd) {
fSMan->SetVerboseLevel(verboseCmd->GetNewIntValue(newVal));
} else if(command==meshBoxCreateCmd) {
@@ -827,4 +846,66 @@ void G4ScoringMessenger::MeshBinCommand(G4VScoringMesh* mesh,G4TokenVec& token){
mesh->SetNumberOfSegments(nSegment);
}
#include "G4VPrimitivePlotter.hh"
#include "G4VScoreHistFiller.hh"
void G4ScoringMessenger::Fill1D(G4UIcommand* cmd, G4String newVal)
{
using MeshShape = G4VScoringMesh::MeshShape;
G4Tokenizer next(newVal);
G4int histID = StoI(next());
G4String meshName = next();
G4String primName = next();
G4int copyNo = StoI(next());
auto filler = G4VScoreHistFiller::Instance();
if(!filler)
{
G4ExceptionDescription ed;
ed << "G4TScoreHistFiller is not instantiated in this application.";
cmd->CommandFailed(ed);
return;
}
//
// To do : check the validity of histID
//
auto sm = G4ScoringManager::GetScoringManagerIfExist();
auto mesh = sm->FindMesh(meshName);
if(mesh==nullptr)
{
G4ExceptionDescription ed;
ed << "Mesh name <" << meshName << "> is not found.";
cmd->CommandFailed(ed);
return;
}
auto shape = mesh->GetShape();
if(shape!=MeshShape::realWorldLogVol && shape!=MeshShape::probe)
{
G4ExceptionDescription ed;
ed << "Mesh <" << meshName << "> is not real-world logical volume or probe.";
cmd->CommandFailed(ed);
return;
}
auto prim = mesh->GetPrimitiveScorer(primName);
if(prim==nullptr)
{
G4ExceptionDescription ed;
ed << "Primitive scorer name <" << primName << "> is not found.";
cmd->CommandFailed(ed);
return;
}
auto pp = dynamic_cast<G4VPrimitivePlotter*>(prim);
if(pp==nullptr)
{
G4ExceptionDescription ed;
ed << "Primitive scorer <" << primName << "> does not support direct histogram filling.";
cmd->CommandFailed(ed);
return;
}
pp->Plot(copyNo,histID);
}
@@ -117,6 +117,7 @@ void G4ScoringProbe::SetupGeometry(G4VPhysicalVolume* worldPhys)
G4bool G4ScoringProbe::SetMaterial(G4String val)
{
G4AutoLock l(&logvolmutex);
if(val == "none")
{
layeredMaterialName = val;