Import Geant4 10.6.1 source tree
This commit is contained in:
@@ -16,6 +16,15 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
February 12th, 2020 T.Aso (detutils-V10-05-06)
|
||||
- In G4ScoreQuantityMessenger, changed SetDefaultUnit() in trackLength
|
||||
scorer to SetDefaultValue() to support various unit category.
|
||||
Addressing problem report #2216.
|
||||
|
||||
December 29th, 2019 M.Asai (detutils-V10-05-05)
|
||||
- G4ScoringManager, G4VScoreWriter, G4ScoringMessenger:
|
||||
Add missing setter/getter functions.
|
||||
|
||||
October 23rd, 2019 M.Asai (detutils-V10-05-04)
|
||||
- Revising utils/src/G4ScoringQuantiryMessenger.cc to better handle
|
||||
ther error cases.
|
||||
|
||||
@@ -153,6 +153,18 @@ class G4ScoringManager
|
||||
if(writer) writer->SetVerboseLevel(verboseLevel);
|
||||
}
|
||||
// Replace score writers.
|
||||
|
||||
public:
|
||||
inline void SetFactor(G4double val=1.0)
|
||||
{ if(writer) writer->SetFactor(val); }
|
||||
inline G4double GetFactor() const
|
||||
{
|
||||
if(writer)
|
||||
{ return writer->GetFactor(); }
|
||||
else
|
||||
{ return -1.0; }
|
||||
}
|
||||
|
||||
private:
|
||||
//Disable copy constructor and assignement operator
|
||||
G4ScoringManager(const G4ScoringManager&);
|
||||
|
||||
@@ -129,6 +129,8 @@ class G4ScoringMessenger: public G4UImessenger
|
||||
// Dump scoring result to file
|
||||
G4UIcommand * dumpQtyToFileCmd;
|
||||
G4UIcommand * dumpAllQtsToFileCmd;
|
||||
G4UIcommand * dumpQtyWithFactorCmd;
|
||||
G4UIcommand * dumpAllQtsWithFactorCmd;
|
||||
//
|
||||
|
||||
};
|
||||
|
||||
@@ -55,9 +55,9 @@ public:
|
||||
// set a socring mesh to retrieve its quantities
|
||||
void SetScoringMesh(G4VScoringMesh * sm);
|
||||
// set a verbose level
|
||||
inline void SetVerboseLevel(G4int vl) {
|
||||
verboseLevel = vl;
|
||||
}
|
||||
inline void SetVerboseLevel(G4int vl) { verboseLevel = vl; }
|
||||
inline void SetFactor(G4double val=1.0) { fact = val; }
|
||||
inline G4double GetFactor() const { return fact; }
|
||||
|
||||
protected:
|
||||
// get an index from (x,y,z)
|
||||
@@ -67,6 +67,7 @@ protected:
|
||||
G4int fNMeshSegments[3]; // number of segments of the mesh
|
||||
G4VScoringMesh * fScoringMesh;
|
||||
G4int verboseLevel;
|
||||
G4double fact;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -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