Import Geant4 10.6.1 source tree
This commit is contained in:
@@ -33,7 +33,8 @@
|
||||
// 29-Mar-2013 T.Aso Support weighted options in the nOfTrack command.
|
||||
// Support a boundary flag option in the nOfStep command
|
||||
// for skipping stepLength=0 steps.
|
||||
//
|
||||
// 13-Feb-2020 T.Aso Change SetDefaultUnit() in trackLength scorer to
|
||||
// SetDefaultValue() to support various unit category.
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
#include "G4ScoreQuantityMessenger.hh"
|
||||
@@ -205,7 +206,7 @@ void G4ScoreQuantityMessenger::QuantityCommands()
|
||||
param->SetDefaultValue("false");
|
||||
qTrackLengthCmd->SetParameter(param);
|
||||
param = new G4UIparameter("unit",'s',true);
|
||||
param->SetDefaultUnit("mm");
|
||||
param->SetDefaultValue("mm");
|
||||
qTrackLengthCmd->SetParameter(param);
|
||||
//
|
||||
qPassCellCurrCmd = new G4UIcommand("/score/quantity/passageCellCurrent",this);
|
||||
|
||||
@@ -287,6 +287,22 @@ G4ScoringMessenger::G4ScoringMessenger(G4ScoringManager* SManager)
|
||||
dumpQtyToFileCmd->SetParameter(param);
|
||||
dumpQtyToFileCmd->SetToBeBroadcasted(false);
|
||||
|
||||
dumpQtyWithFactorCmd = new G4UIcommand("/score/dumpQuantityWithFactor", this);
|
||||
dumpQtyWithFactorCmd->SetGuidance("Dump one scored quantity to file.");
|
||||
dumpQtyWithFactorCmd->SetGuidance("Each value is multiplied by the specified factor.");
|
||||
param = new G4UIparameter("meshName", 's', false);
|
||||
dumpQtyWithFactorCmd->SetParameter(param);
|
||||
param = new G4UIparameter("psName", 's', false);
|
||||
dumpQtyWithFactorCmd->SetParameter(param);
|
||||
param = new G4UIparameter("fileName", 's', false);
|
||||
dumpQtyWithFactorCmd->SetParameter(param);
|
||||
param = new G4UIparameter("factor", 'd', false);
|
||||
param->SetParameterRange("factor>0.");
|
||||
dumpQtyWithFactorCmd->SetParameter(param);
|
||||
param = new G4UIparameter("option", 's', true);
|
||||
dumpQtyWithFactorCmd->SetParameter(param);
|
||||
dumpQtyWithFactorCmd->SetToBeBroadcasted(false);
|
||||
|
||||
// Dump all scored quantities
|
||||
dumpAllQtsToFileCmd = new G4UIcommand("/score/dumpAllQuantitiesToFile", this);
|
||||
dumpAllQtsToFileCmd->SetGuidance("Dump all quantities of the mesh to file.");
|
||||
@@ -298,6 +314,20 @@ G4ScoringMessenger::G4ScoringMessenger(G4ScoringManager* SManager)
|
||||
dumpAllQtsToFileCmd->SetParameter(param);
|
||||
dumpAllQtsToFileCmd->SetToBeBroadcasted(false);
|
||||
|
||||
dumpAllQtsWithFactorCmd = new G4UIcommand("/score/dumpAllQuantitiesWithFactor", this);
|
||||
dumpAllQtsWithFactorCmd->SetGuidance("Dump all quantities of the mesh to file.");
|
||||
dumpAllQtsWithFactorCmd->SetGuidance("Each value is multiplied by the specified factor.");
|
||||
param = new G4UIparameter("meshName", 's', false);
|
||||
dumpAllQtsWithFactorCmd->SetParameter(param);
|
||||
param = new G4UIparameter("fileName", 's', false);
|
||||
dumpAllQtsWithFactorCmd->SetParameter(param);
|
||||
param = new G4UIparameter("factor", 'd', false);
|
||||
param->SetParameterRange("factor>0.");
|
||||
dumpAllQtsWithFactorCmd->SetParameter(param);
|
||||
param = new G4UIparameter("option", 's', true);
|
||||
dumpAllQtsWithFactorCmd->SetParameter(param);
|
||||
dumpAllQtsWithFactorCmd->SetToBeBroadcasted(false);
|
||||
|
||||
}
|
||||
|
||||
G4ScoringMessenger::~G4ScoringMessenger()
|
||||
@@ -340,8 +370,10 @@ G4ScoringMessenger::~G4ScoringMessenger()
|
||||
delete floatMinMaxCmd;
|
||||
delete colorMapMinMaxCmd;
|
||||
delete colorMapDir;
|
||||
delete dumpQtyToFileCmd;
|
||||
delete dumpQtyWithFactorCmd;
|
||||
delete dumpQtyWithFactorCmd;
|
||||
delete dumpAllQtsToFileCmd;
|
||||
delete dumpAllQtsWithFactorCmd;
|
||||
//
|
||||
delete scoreDir;
|
||||
}
|
||||
@@ -383,13 +415,64 @@ void G4ScoringMessenger::SetNewValue(G4UIcommand * command,G4String newVal)
|
||||
G4String psName = next();
|
||||
G4String fileName = next();
|
||||
G4String option = next("\n");
|
||||
auto mesh = fSMan->FindMesh(meshName);
|
||||
if(!mesh)
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Mesh name <" << meshName << "> is not found. Command ignored.";
|
||||
command->CommandFailed(ed);
|
||||
return;
|
||||
}
|
||||
fSMan->DumpQuantityToFile(meshName, psName, fileName, option);
|
||||
} else if(command==dumpQtyWithFactorCmd) {
|
||||
G4Tokenizer next(newVal);
|
||||
G4String meshName = next();
|
||||
G4String psName = next();
|
||||
G4String fileName = next();
|
||||
G4double fac = StoD(next());
|
||||
G4String option = next("\n");
|
||||
auto mesh = fSMan->FindMesh(meshName);
|
||||
if(!mesh)
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Mesh name <" << meshName << "> is not found. Command ignored.";
|
||||
command->CommandFailed(ed);
|
||||
return;
|
||||
}
|
||||
fSMan->SetFactor(fac);
|
||||
fSMan->DumpQuantityToFile(meshName, psName, fileName, option);
|
||||
fSMan->SetFactor(1.0);
|
||||
} else if(command==dumpAllQtsToFileCmd) {
|
||||
G4Tokenizer next(newVal);
|
||||
G4String meshName = next();
|
||||
G4String fileName = next();
|
||||
G4String option = next("\n");
|
||||
auto mesh = fSMan->FindMesh(meshName);
|
||||
if(!mesh)
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Mesh name <" << meshName << "> is not found. Command ignored.";
|
||||
command->CommandFailed(ed);
|
||||
return;
|
||||
}
|
||||
fSMan->DumpAllQuantitiesToFile(meshName, fileName, option);
|
||||
} else if(command==dumpAllQtsWithFactorCmd) {
|
||||
G4Tokenizer next(newVal);
|
||||
G4String meshName = next();
|
||||
G4String fileName = next();
|
||||
G4double fac = StoD(next());
|
||||
G4String option = next("\n");
|
||||
auto mesh = fSMan->FindMesh(meshName);
|
||||
if(!mesh)
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Mesh name <" << meshName << "> is not found. Command ignored.";
|
||||
command->CommandFailed(ed);
|
||||
return;
|
||||
}
|
||||
fSMan->SetFactor(fac);
|
||||
fSMan->DumpAllQuantitiesToFile(meshName, fileName, option);
|
||||
fSMan->SetFactor(1.0);
|
||||
} else if(command==verboseCmd) {
|
||||
fSMan->SetVerboseLevel(verboseCmd->GetNewIntValue(newVal));
|
||||
} else if(command==meshBoxCreateCmd) {
|
||||
|
||||
@@ -37,7 +37,8 @@
|
||||
#include <fstream>
|
||||
|
||||
G4VScoreWriter::G4VScoreWriter()
|
||||
: fScoringMesh(nullptr), verboseLevel(0) {
|
||||
: fScoringMesh(nullptr), verboseLevel(0), fact(1.0)
|
||||
{
|
||||
fNMeshSegments[0] = fNMeshSegments[1] = fNMeshSegments[2] = 0;
|
||||
}
|
||||
|
||||
@@ -90,7 +91,8 @@ void G4VScoreWriter::DumpQuantityToFile(const G4String& psName,
|
||||
|
||||
std::map<G4int, G4StatDouble*> * score = msMapItr->second->GetMap();
|
||||
ofile << "# primitive scorer name: " << msMapItr->first << std::endl;
|
||||
|
||||
if(fact!=1.0)
|
||||
{ ofile << "# multiplied factor : " << fact << std::endl; }
|
||||
|
||||
G4double unitValue = fScoringMesh->GetPSUnitValue(psName);
|
||||
G4String unit = fScoringMesh->GetPSUnit(psName);
|
||||
@@ -126,8 +128,8 @@ void G4VScoreWriter::DumpQuantityToFile(const G4String& psName,
|
||||
if(value == score->end()) {
|
||||
ofile << 0. << "," << 0. << "," << 0;
|
||||
} else {
|
||||
ofile << (value->second->sum_wx())/unitValue << ","
|
||||
<< (value->second->sum_wx2())/unitValue/unitValue << ","
|
||||
ofile << (value->second->sum_wx())/unitValue*fact << ","
|
||||
<< (value->second->sum_wx2())/unitValue/unitValue*fact*fact << ","
|
||||
<< value->second->n();
|
||||
}
|
||||
|
||||
@@ -172,6 +174,8 @@ void G4VScoreWriter::DumpAllQuantitiesToFile(const G4String& fileName,
|
||||
return;
|
||||
}
|
||||
ofile << "# mesh name: " << fScoringMesh->GetWorldName() << G4endl;
|
||||
if(fact!=1.0)
|
||||
{ ofile << "# multiplied factor : " << fact << std::endl; }
|
||||
|
||||
// retrieve the map
|
||||
using MeshScoreMap = G4VScoringMesh::MeshScoreMap;
|
||||
@@ -220,8 +224,8 @@ void G4VScoreWriter::DumpAllQuantitiesToFile(const G4String& fileName,
|
||||
if(value == score->end()) {
|
||||
ofile << 0. << "," << 0. << "," << 0;
|
||||
} else {
|
||||
ofile << (value->second->sum_wx())/unitValue << ","
|
||||
<< (value->second->sum_wx2())/unitValue/unitValue << ","
|
||||
ofile << (value->second->sum_wx())/unitValue*fact << ","
|
||||
<< (value->second->sum_wx2())/unitValue/unitValue*fact*fact << ","
|
||||
<< value->second->n();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user