Import Geant4 10.5.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2018-06-29 10:58:11 +02:00
parent fe81a77428
commit 6aa23be517
1581 changed files with 124288 additions and 83758 deletions
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VSceneHandler.cc 102802 2017-02-22 15:19:00Z gcosmo $
// $Id: G4VSceneHandler.cc 109510 2018-04-26 07:15:57Z gcosmo $
//
//
// John Allison 19th July 1996
@@ -594,12 +594,16 @@ void G4VSceneHandler::RequestPrimitives (const G4VSolid& solid) {
if (pPVModel) {
G4cerr << pPVModel->GetFullPVPath();
}
G4cerr <<
"\n This means it cannot be visualized on most systems (try RayTracer)."
"\n 1) The solid may not have implemented the CreatePolyhedron method."
"\n 2) For Boolean solids, the BooleanProcessor, which attempts to create"
"\n the resultant polyhedron, may have failed."
<< G4endl;
static G4bool explanation = false;
if (!explanation) {
explanation = true;
G4cerr <<
"\n This means it cannot be visualized on most systems (try RayTracer)."
"\n 1) The solid may not have implemented the CreatePolyhedron method."
"\n 2) For Boolean solids, the BooleanProcessor, which attempts to create"
"\n the resultant polyhedron, may have failed.";
}
G4cerr << G4endl;
}
}
}
@@ -819,6 +823,9 @@ G4ModelingParameters* G4VSceneHandler::CreateModelingParameters ()
pModelingParams->SetWarning
(G4VisManager::GetVerbosity() >= G4VisManager::warnings);
pModelingParams->SetCBDAlgorithmNumber(vp.GetCBDAlgorithmNumber());
pModelingParams->SetCBDParameters(vp.GetCBDParameters());
pModelingParams->SetExplodeFactor(vp.GetExplodeFactor());
pModelingParams->SetExplodeCentre(vp.GetExplodeCentre());
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VVisCommand.cc 105349 2017-07-21 12:23:24Z gcosmo $
// $Id: G4VVisCommand.cc 109510 2018-04-26 07:15:57Z gcosmo $
// Base class for visualization commands - John Allison 9th August 1998
// It is really a messenger - we have one command per messenger.
@@ -156,6 +156,38 @@ void G4VVisCommand::ConvertToColour
}
}
G4bool G4VVisCommand::ProvideValueOfUnit
(const G4String& where,
const G4String& unit,
const G4String& category,
G4double& value)
{
// Return false if there's a problem
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
G4bool success = true;
if (!G4UnitDefinition::IsUnitDefined(unit)) {
if (verbosity >= G4VisManager::warnings) {
G4cerr << where
<< "\n Unit \"" << unit << "\" not defined"
<< G4endl;
}
success = false;
} else if (G4UnitDefinition::GetCategory(unit) != category) {
if (verbosity >= G4VisManager::warnings) {
G4cerr << where
<< "\n Unit \"" << unit << "\" not a unit of " << category;
if (category == "Volumic Mass") G4cerr << " (density)";
G4cerr << G4endl;
}
success = false;
} else {
value = G4UnitDefinition::GetValueOf(unit);
}
return success;
}
void G4VVisCommand::UpdateVisManagerScene
(const G4String& sceneName) {
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ViewParameters.cc 106122 2017-09-13 12:51:53Z gcosmo $
// $Id: G4ViewParameters.cc 109510 2018-04-26 07:15:57Z gcosmo $
//
//
// John Allison 19th July 1996
@@ -48,6 +48,7 @@ G4ViewParameters::G4ViewParameters ():
fDensityCulling (false),
fVisibleDensity (0.01 * g / cm3),
fCullCovered (false),
fCBDAlgorithmNumber (0),
fSection (false),
fSectionPlane (),
fCutawayMode (cutawayUnion),
@@ -80,7 +81,25 @@ G4ViewParameters::G4ViewParameters ():
fAutoRefresh (false),
fBackgroundColour (G4Colour(0.,0.,0.)), // Black
fPicking (false),
fRotationStyle (constrainUpDirection)
fRotationStyle (constrainUpDirection),
fStartTime(-G4VisAttributes::fVeryLongTime),
fEndTime(G4VisAttributes::fVeryLongTime),
fFadeFactor(0.),
fDisplayHeadTime(false),
fDisplayHeadTimeX(-0.9),
fDisplayHeadTimeY(-0.9),
fDisplayHeadTimeSize(24.),
fDisplayHeadTimeRed(0.),
fDisplayHeadTimeGreen(1.),
fDisplayHeadTimeBlue(1.),
fDisplayLightFront(false),
fDisplayLightFrontX(0.),
fDisplayLightFrontY(0.),
fDisplayLightFrontZ(0.),
fDisplayLightFrontT(0.),
fDisplayLightFrontRed(0.),
fDisplayLightFrontGreen(1.),
fDisplayLightFrontBlue(0.)
{
fDefaultMarker.SetScreenSize (5.);
// Markers are 5 pixels "overall" size, i.e., diameter.
@@ -437,7 +456,13 @@ G4String G4ViewParameters::SceneModifyingCommands() const
} else {
oss << "false";
}
oss << "\n/vis/viewer/colourByDensity "
<< fCBDAlgorithmNumber << " g/cm3";
for (auto p: fCBDParameters) {
oss << ' ' << p/(g/cm3);
}
oss << "\n/vis/viewer/set/sectionPlane ";
if (fSection) {
oss << "on "
@@ -485,19 +510,22 @@ G4String G4ViewParameters::TouchableCommands() const
{
std::ostringstream oss;
oss
<< "#\n# Touchable commands"
<< "\n/vis/viewer/clearVisAttributesModifiers";
oss << "#\n# Touchable commands";
const std::vector<G4ModelingParameters::VisAttributesModifier>& vams =
fVisAttributesModifiers;
if (vams.empty()) {
oss << "\n# None";
oss
<< "\n# None"
<< "\n/vis/viewer/clearVisAttributesModifiers";
oss << std::endl;
return oss.str();
}
oss
<< "\n/vis/viewer/clearVisAttributesModifiers";
G4ModelingParameters::PVNameCopyNoPath lastPath;
std::vector<G4ModelingParameters::VisAttributesModifier>::const_iterator
iModifier;
@@ -607,6 +635,61 @@ G4String G4ViewParameters::TouchableCommands() const
return oss.str();
}
G4String G4ViewParameters::TimeWindowCommands() const
{
std::ostringstream oss;
oss << "#\n# Time window commands";
oss
<< "\n/vis/viewer/set/timeWindow/startTime "
<< fStartTime/ns << " ns ";
oss
<< "\n/vis/viewer/set/timeWindow/endTime "
<< fEndTime/ns << " ns ";
oss << "\n/vis/viewer/set/timeWindow/fadeFactor "
<< fFadeFactor;
oss
<< "\n/vis/viewer/set/timeWindow/displayHeadTime ";
if (!fDisplayHeadTime) {
oss << "false";
} else {
oss
<< "true"
<< ' ' << fDisplayHeadTimeX
<< ' ' << fDisplayHeadTimeY
<< ' ' << fDisplayHeadTimeSize
<< ' ' << fDisplayHeadTimeRed
<< ' ' << fDisplayHeadTimeGreen
<< ' ' << fDisplayHeadTimeBlue;
}
oss
<< "\n/vis/viewer/set/timeWindow/displayLightFront ";
if (!fDisplayLightFront) {
oss << "false";
} else {
oss
<< "true"
<< ' ' << fDisplayLightFrontX/mm
<< ' ' << fDisplayLightFrontY/mm
<< ' ' << fDisplayLightFrontZ/mm
<< " mm"
<< ' ' << fDisplayLightFrontT/ns
<< " ns"
<< ' ' << fDisplayLightFrontRed
<< ' ' << fDisplayLightFrontGreen
<< ' ' << fDisplayLightFrontBlue;
}
oss << std::endl;
return oss.str();
}
void G4ViewParameters::PrintDifferences (const G4ViewParameters& v) const {
// Put performance-sensitive parameters first.
@@ -622,6 +705,7 @@ void G4ViewParameters::PrintDifferences (const G4ViewParameters& v) const {
(fDensityCulling != v.fDensityCulling) ||
(fVisibleDensity != v.fVisibleDensity) ||
(fCullCovered != v.fCullCovered) ||
(fCBDAlgorithmNumber != v.fCBDAlgorithmNumber) ||
(fSection != v.fSection) ||
(fNoOfSides != v.fNoOfSides) ||
(fUpVector != v.fUpVector) ||
@@ -649,6 +733,14 @@ void G4ViewParameters::PrintDifferences (const G4ViewParameters& v) const {
)
G4cout << "Difference in 1st batch." << G4endl;
if (fCBDAlgorithmNumber > 0) {
if (fCBDParameters.size() != v.fCBDParameters.size()) {
G4cout << "Difference in number of colour by density parameters." << G4endl;
} else if (fCBDParameters != v.fCBDParameters) {
G4cout << "Difference in values of colour by density parameters." << G4endl;
}
}
if (fSection) {
if (!(fSectionPlane == v.fSectionPlane))
G4cout << "Difference in section planes batch." << G4endl;
@@ -676,10 +768,47 @@ void G4ViewParameters::PrintDifferences (const G4ViewParameters& v) const {
if (fVisAttributesModifiers != v.fVisAttributesModifiers) {
G4cout << "Difference in vis attributes modifiers." << G4endl;
}
if (fStartTime != v.fStartTime ||
fEndTime != v.fEndTime) {
G4cout << "Difference in time window." << G4endl;
}
if (fFadeFactor != v.fFadeFactor) {
G4cout << "Difference in time window fade factor." << G4endl;
}
if (fDisplayHeadTime != v.fDisplayHeadTime) {
G4cout << "Difference in display head time flag." << G4endl;
} else {
if (fDisplayHeadTimeX != v.fDisplayHeadTimeX ||
fDisplayHeadTimeY != v.fDisplayHeadTimeY ||
fDisplayHeadTimeSize != v.fDisplayHeadTimeSize ||
fDisplayHeadTimeRed != v.fDisplayHeadTimeRed ||
fDisplayHeadTimeGreen != v.fDisplayHeadTimeGreen ||
fDisplayHeadTimeBlue != v.fDisplayHeadTimeBlue) {
G4cout << "Difference in display head time parameters." << G4endl;
}
}
if (fDisplayLightFront != v.fDisplayLightFront) {
G4cout << "Difference in display light front flag." << G4endl;
} else {
if (fDisplayLightFrontX != v.fDisplayLightFrontX ||
fDisplayLightFrontY != v.fDisplayLightFrontY ||
fDisplayLightFrontZ != v.fDisplayLightFrontZ ||
fDisplayLightFrontT != v.fDisplayLightFrontT ||
fDisplayLightFrontRed != v.fDisplayLightFrontRed ||
fDisplayLightFrontGreen != v.fDisplayLightFrontGreen ||
fDisplayLightFrontBlue != v.fDisplayLightFrontBlue) {
G4cout << "Difference in display light front parameters." << G4endl;
}
}
}
std::ostream& operator << (std::ostream& os,
const G4ViewParameters::DrawingStyle& style) {
std::ostream& operator <<
(std::ostream& os, const G4ViewParameters::DrawingStyle& style)
{
switch (style) {
case G4ViewParameters::wireframe:
os << "wireframe"; break;
@@ -733,6 +862,16 @@ std::ostream& operator << (std::ostream& os, const G4ViewParameters& v) {
if (v.fCullCovered) os << "on";
else os << "off";
os << "\n Colour by density: ";
if (v.fCBDAlgorithmNumber <= 0) {
os << "inactive";
} else {
os << "Algorithm " << v.fCBDAlgorithmNumber << ", Parameters:";
for (auto p: v.fCBDParameters) {
os << ' ' << G4BestUnit(p,"Volumic Mass");
}
}
os << "\n Section flag: ";
if (v.fSection) os << "true, section/cut plane: " << v.fSectionPlane;
else os << "false";
@@ -844,6 +983,32 @@ std::ostream& operator << (std::ostream& os, const G4ViewParameters& v) {
os << vams;
}
os << "\n Time window parameters:"
<< "\n Start time: " << v.fStartTime/ns << " ns"
<< "\n End time: " << v.fEndTime/ns << " ns"
<< "\n Fade factor: " << v.fFadeFactor;
if (!v.fDisplayHeadTime) {
os << "\n Head time display not requested.";
} else {
os
<< "\n Head time position: "
<< v.fDisplayHeadTimeX << ' ' << v.fDisplayHeadTimeY
<< "\n Head time size: " << v.fDisplayHeadTimeSize
<< "\n Head time colour: " << v.fDisplayHeadTimeRed
<< ' ' << v.fDisplayHeadTimeGreen << ' ' << v.fDisplayHeadTimeBlue;
}
if (!v.fDisplayLightFront) {
os << "\n Light front display not requested.";
} else {
os
<< "\n Light front position: "
<< v.fDisplayLightFrontX/mm << ' ' << v.fDisplayLightFrontY/mm
<< v.fDisplayLightFrontZ/mm << " mm"
<< "\n Light front time: " << v.fDisplayLightFrontT/ns << " ns"
<< "\n Light front colour: " << v.fDisplayLightFrontRed
<< ' ' << v.fDisplayLightFrontGreen << ' ' << v.fDisplayLightFrontBlue;
}
return os;
}
@@ -861,6 +1026,7 @@ G4bool G4ViewParameters::operator != (const G4ViewParameters& v) const {
(fCullInvisible != v.fCullInvisible) ||
(fDensityCulling != v.fDensityCulling) ||
(fCullCovered != v.fCullCovered) ||
(fCBDAlgorithmNumber != v.fCBDAlgorithmNumber) ||
(fSection != v.fSection) ||
(IsCutaway() != v.IsCutaway()) ||
(IsExplode() != v.IsExplode()) ||
@@ -893,6 +1059,11 @@ G4bool G4ViewParameters::operator != (const G4ViewParameters& v) const {
if (fDensityCulling &&
(fVisibleDensity != v.fVisibleDensity)) return true;
if (fCBDAlgorithmNumber > 0) {
if (fCBDParameters.size() != v.fCBDParameters.size()) return true;
else if (fCBDParameters != v.fCBDParameters) return true;
}
if (fSection &&
(!(fSectionPlane == v.fSectionPlane))) return true;
@@ -912,6 +1083,35 @@ G4bool G4ViewParameters::operator != (const G4ViewParameters& v) const {
if (fVisAttributesModifiers != v.fVisAttributesModifiers) return true;
if (fStartTime != v.fStartTime ||
fEndTime != v.fEndTime ||
fFadeFactor != v.fFadeFactor) return true;
if (fDisplayHeadTime != v.fDisplayHeadTime) return true;
if (fDisplayHeadTime) {
if (fDisplayHeadTimeX != v.fDisplayHeadTimeX ||
fDisplayHeadTimeY != v.fDisplayHeadTimeY ||
fDisplayHeadTimeSize != v.fDisplayHeadTimeSize ||
fDisplayHeadTimeRed != v.fDisplayHeadTimeRed ||
fDisplayHeadTimeGreen != v.fDisplayHeadTimeGreen ||
fDisplayHeadTimeBlue != v.fDisplayHeadTimeBlue) {
return true;
}
}
if (fDisplayLightFront != v.fDisplayLightFront) return true;
if (fDisplayLightFront) {
if (fDisplayLightFrontX != v.fDisplayLightFrontX ||
fDisplayLightFrontY != v.fDisplayLightFrontY ||
fDisplayLightFrontZ != v.fDisplayLightFrontZ ||
fDisplayLightFrontT != v.fDisplayLightFrontT ||
fDisplayLightFrontRed != v.fDisplayLightFrontRed ||
fDisplayLightFrontGreen != v.fDisplayLightFrontGreen ||
fDisplayLightFrontBlue != v.fDisplayLightFrontBlue) {
return true;
}
}
return false;
}
@@ -1233,7 +1433,7 @@ G4ViewParameters* G4ViewParameters::CatmullRomCubicSplineInterpolation
else mi = 0.5 * (v[i+1].param - v[i-1].param); \
} else { \
/* Full Catmull-Rom slopes use previous AND next waypoints */ \
mi = 0.5 * (v[i+1].param - v[i-1].param); \
mi = 0.5 * (v[i+1].param - v[i-1].param); \
mi1 = 0.5 * (v[i+2].param - v[i ].param); \
} \
real = h00 * v[i].param + h10 * mi + h01 * v[i+1].param + h11 * mi1;
@@ -1358,8 +1558,8 @@ INTERPOLATE(plane.d()); d = real;
static G4VisAttributes workingVA;
if (v[i].fVisAttributesModifiers.size()) {
CONTINUITY(fVisAttributesModifiers.size());
if (continuous) { \
for (size_t j = 0; j < v[i].fVisAttributesModifiers.size(); ++j) { \
if (continuous) {
for (size_t j = 0; j < v[i].fVisAttributesModifiers.size(); ++j) {
CONTINUITY(fVisAttributesModifiers[j].GetPVNameCopyNoPath());
if (continuous) {
CONTINUITY(fVisAttributesModifiers[j].GetVisAttributesSignifier());
@@ -1377,6 +1577,15 @@ INTERPOLATE(plane.d()); d = real;
}
}
// Time window parameters (for showing particles in flight)
// Only two parameters are interpolated. The others are usually chosen
// once and for all by the user for a given series of views - or at least,
// if not, they will be interpolated by the default "crude" method above.
INTERPOLATE(fStartTime)
holdingValues.fStartTime = real;
INTERPOLATE(fEndTime)
holdingValues.fEndTime = real;
// Increment counters
iInterpolationPoint++;
t += dt;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsCompound.cc 98766 2016-08-09 14:17:17Z gcosmo $
// $Id: G4VisCommandsCompound.cc 110513 2018-05-28 07:37:38Z gcosmo $
// Compound /vis/ commands - John Allison 15th May 2000
@@ -43,9 +43,10 @@ G4VisCommandDrawTree::G4VisCommandDrawTree() {
G4bool omitable;
fpCommand = new G4UIcommand("/vis/drawTree", this);
fpCommand->SetGuidance
("(DTREE) Creates a scene consisting of this physical volume and"
"\n produces a representation of the geometry hieracrhy.");
fpCommand->SetGuidance("The scene becomes current.");
("Produces a representation of the geometry hierarchy. Further"
"\nguidance is given on running the command. Or look at the guidance"
"\nfor \"/vis/ASCIITree/verbose\".");
fpCommand->SetGuidance("The pre-existing scene and view are preserved.");
G4UIparameter* parameter;
parameter = new G4UIparameter("physical-volume-name", 's', omitable = true);
parameter -> SetDefaultValue("world");
@@ -197,6 +198,77 @@ void G4VisCommandDrawView::SetNewValue(G4UIcommand*, G4String newValue) {
UImanager->SetVerboseLevel(keepVerbose);
}
////////////// /vis/specify ///////////////////////////////////////
G4VisCommandDrawLogicalVolume::G4VisCommandDrawLogicalVolume() {
G4bool omitable;
fpCommand = new G4UIcommand("/vis/drawLogicalVolume", this);
fpCommand->SetGuidance
("Draws logical volume with Boolean components, voxels and readout geometry.");
fpCommand->SetGuidance
("Synonymous with \"/vis/specify\".");
fpCommand->SetGuidance
("Creates a scene consisting of this logical volume and asks the"
"\n current viewer to draw it to the specified depth of descent"
"\n showing boolean components (if any), voxels (if any),"
"\n readout geometry (if any), local axes and overlaps (if any),"
"\n under control of the appropriate flag.");
fpCommand->SetGuidance
("Note: voxels are not constructed until start of run - /run/beamOn."
"\n (For voxels without a run, \"/run/beamOn 0\".)");
fpCommand->SetGuidance("The scene becomes current.");
G4UIparameter* parameter;
parameter = new G4UIparameter("logical-volume-name", 's', omitable = false);
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("depth-of-descent", 'i', omitable = true);
parameter->SetDefaultValue(1);
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("booleans-flag", 'b', omitable = true);
parameter->SetDefaultValue(true);
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("voxels-flag", 'b', omitable = true);
parameter->SetDefaultValue(true);
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("readout-flag", 'b', omitable = true);
parameter->SetDefaultValue(true);
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("axes-flag", 'b', omitable = true);
parameter->SetDefaultValue(true);
parameter -> SetGuidance ("Set \"false\" to suppress axes.");
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("check-overlap-flag", 'b', omitable = true);
parameter->SetDefaultValue(true);
parameter -> SetGuidance ("Set \"false\" to suppress overlap check.");
fpCommand->SetParameter(parameter);
}
G4VisCommandDrawLogicalVolume::~G4VisCommandDrawLogicalVolume() {
delete fpCommand;
}
void G4VisCommandDrawLogicalVolume::SetNewValue(G4UIcommand*, G4String newValue) {
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
G4UImanager* UImanager = G4UImanager::GetUIpointer();
G4int keepVerbose = UImanager->GetVerboseLevel();
G4int newVerbose(0);
if (keepVerbose >= 2 || verbosity >= G4VisManager::confirmations)
newVerbose = 2;
UImanager->SetVerboseLevel(newVerbose);
// UImanager->ApplyCommand(G4String("/geometry/print " + newValue));
UImanager->ApplyCommand("/vis/scene/create");
UImanager->ApplyCommand(G4String("/vis/scene/add/logicalVolume " + newValue));
UImanager->ApplyCommand("/vis/sceneHandler/attach");
UImanager->SetVerboseLevel(keepVerbose);
static G4bool warned = false;
if (verbosity >= G4VisManager::confirmations && !warned) {
G4cout <<
"NOTE: For systems which are not \"auto-refresh\" you will need to"
"\n issue \"/vis/viewer/refresh\" or \"/vis/viewer/flush\"."
<< G4endl;
warned = true;
}
}
////////////// /vis/drawVolume ///////////////////////////////////////
G4VisCommandDrawVolume::G4VisCommandDrawVolume() {
@@ -308,12 +380,14 @@ G4VisCommandSpecify::G4VisCommandSpecify() {
fpCommand = new G4UIcommand("/vis/specify", this);
fpCommand->SetGuidance
("Draws logical volume with Boolean components, voxels and readout geometry.");
fpCommand->SetGuidance
("Synonymous with \"/vis/drawLogicalVolume\".");
fpCommand->SetGuidance
("Creates a scene consisting of this logical volume and asks the"
"\n current viewer to draw it to the specified depth of descent"
"\n showing boolean components (if any), voxels (if any),"
"\n readout geometry (if any) and local axes, under control of the"
"\n appropriate flag.");
"\n readout geometry (if any), local axes and overlaps (if any),"
"\n under control of the appropriate flag.");
fpCommand->SetGuidance
("Note: voxels are not constructed until start of run - /run/beamOn."
"\n (For voxels without a run, \"/run/beamOn 0\".)");
@@ -337,6 +411,10 @@ G4VisCommandSpecify::G4VisCommandSpecify() {
parameter->SetDefaultValue(true);
parameter -> SetGuidance ("Set \"false\" to suppress axes.");
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("check-overlap-flag", 'b', omitable = true);
parameter->SetDefaultValue(true);
parameter -> SetGuidance ("Set \"false\" to suppress overlap check.");
fpCommand->SetParameter(parameter);
}
G4VisCommandSpecify::~G4VisCommandSpecify() {
@@ -28,6 +28,7 @@
// /vis/multithreading commands - John Allison 29th September 2015
#include "G4Types.hh"
#ifdef G4MULTITHREADED
#include "G4VisCommandsMultithreading.hh"
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsSceneAdd.cc 104163 2017-05-15 06:52:42Z gcosmo $
// $Id: G4VisCommandsSceneAdd.cc 110480 2018-05-25 07:25:18Z gcosmo $
// /vis/scene/add commands - John Allison 9th August 1998
#include "G4VisCommandsSceneAdd.hh"
@@ -1163,7 +1163,8 @@ G4VisCommandSceneAddLogicalVolume::G4VisCommandSceneAddLogicalVolume () {
fpCommand -> SetGuidance ("Adds a logical volume to the current scene,");
fpCommand -> SetGuidance
("Shows boolean components (if any), voxels (if any), readout geometry"
"\n (if any) and local axes, under control of the appropriate flag."
"\n (if any), local axes and overlaps (if any), under control of the"
"\n appropriate flag."
"\n Note: voxels are not constructed until start of run -"
"\n \"/run/beamOn\". (For voxels without a run, \"/run/beamOn 0\".)");
G4UIparameter* parameter;
@@ -1186,6 +1187,10 @@ G4VisCommandSceneAddLogicalVolume::G4VisCommandSceneAddLogicalVolume () {
parameter -> SetDefaultValue (true);
parameter -> SetGuidance ("Set \"false\" to suppress axes.");
fpCommand -> SetParameter (parameter);
parameter = new G4UIparameter("check-overlap-flag", 'b', omitable = true);
parameter->SetDefaultValue(true);
parameter -> SetGuidance ("Set \"false\" to suppress overlap check.");
fpCommand->SetParameter(parameter);
}
G4VisCommandSceneAddLogicalVolume::~G4VisCommandSceneAddLogicalVolume () {
@@ -1213,13 +1218,16 @@ void G4VisCommandSceneAddLogicalVolume::SetNewValue (G4UIcommand*,
G4String name;
G4int requestedDepthOfDescent;
G4String booleansString, voxelsString, readoutString, axesString;
G4String overlapString;
std::istringstream is (newValue);
is >> name >> requestedDepthOfDescent
>> booleansString >> voxelsString >> readoutString >> axesString;
>> booleansString >> voxelsString >> readoutString >> axesString
>> overlapString;
G4bool booleans = G4UIcommand::ConvertToBool(booleansString);
G4bool voxels = G4UIcommand::ConvertToBool(voxelsString);
G4bool readout = G4UIcommand::ConvertToBool(readoutString);
G4bool axes = G4UIcommand::ConvertToBool(axesString);
G4bool checkOverlaps = G4UIcommand::ConvertToBool(overlapString);
G4LogicalVolumeStore *pLVStore = G4LogicalVolumeStore::GetInstance();
int nLV = pLVStore -> size ();
@@ -1263,7 +1271,7 @@ void G4VisCommandSceneAddLogicalVolume::SetNewValue (G4UIcommand*,
}
G4LogicalVolumeModel* model = new G4LogicalVolumeModel
(pLV, requestedDepthOfDescent, booleans, voxels, readout);
(pLV, requestedDepthOfDescent, booleans, voxels, readout, checkOverlaps);
const G4String& currentSceneName = pScene -> GetName ();
G4bool successful = pScene -> AddRunDurationModel (model, warn);
@@ -1291,15 +1299,17 @@ void G4VisCommandSceneAddLogicalVolume::SetNewValue (G4UIcommand*,
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Logical volume \"" << pLV -> GetName ()
<< " with requested depth of descent "
<< "\" with requested depth of descent "
<< requestedDepthOfDescent
<< ",\n with";
<< ",\n with";
if (!booleans) G4cout << "out";
G4cout << " boolean components, with";
if (!voxels) G4cout << "out";
G4cout << " voxels and with";
G4cout << " voxels,\n with";
if (!readout) G4cout << "out";
G4cout << " readout geometry,"
G4cout << " readout geometry and with";
if (!checkOverlaps) G4cout << "out";
G4cout << " overlap checking"
<< "\n has been added to scene \"" << currentSceneName << "\".";
if (axes) {
if (axesSuccessful) {
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsViewer.cc 104163 2017-05-15 06:52:42Z gcosmo $
// $Id: G4VisCommandsViewer.cc 109510 2018-04-26 07:15:57Z gcosmo $
// /vis/viewer commands - John Allison 25th October 1998
@@ -559,6 +559,124 @@ void G4VisCommandViewerClone::SetNewValue (G4UIcommand*, G4String newValue) {
}
}
////////////// /vis/viewer/colourByDensity ///////////////////////////////////////
G4VisCommandViewerColourByDensity::G4VisCommandViewerColourByDensity () {
G4bool omitable;
fpCommand = new G4UIcommand ("/vis/viewer/colourByDensity", this);
fpCommand -> SetGuidance
("If a volume has no vis attributes, colour it by density.");
fpCommand -> SetGuidance
("Provide algorithm number, e.g., \"1\" (or \"0\" to switch off)."
"\nThen a unit of density, e.g., \"g/cm3\"."
"\nThen parameters for the algorithm assumed to be densities in that unit.");
fpCommand -> SetGuidance
("Algorithm 1: Simple algorithm takes 3 parameters: d0, d1 and d2."
"\nVolumes with density < d0 are invisible."
"\nVolumes with d0 <= density < d1 have colour on range red->green."
"\nVolumes with d1 <= density < d2 have colour on range green->blue."
"\nVolumes with density > d2 are blue.");
G4UIparameter* parameter;
parameter = new G4UIparameter("n",'i',omitable = true);
parameter -> SetDefaultValue (0);
parameter -> SetGuidance ("Algorithm number (or \"0\" to switch off).");
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("unit",'s',omitable = true);
parameter -> SetDefaultValue ("g/cm3");
parameter -> SetGuidance ("Unit of following densities, e.g., \"g/cm3\".");
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("d0",'d',omitable = true);
parameter -> SetDefaultValue (0.);
parameter -> SetGuidance ("Density parameter 0.");
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("d1",'d',omitable = true);
parameter -> SetDefaultValue (0.);
parameter -> SetGuidance ("Density parameter 1.");
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("d2",'d',omitable = true);
parameter -> SetDefaultValue (0.);
parameter -> SetGuidance ("Density parameter 2.");
fpCommand->SetParameter(parameter);
}
G4VisCommandViewerColourByDensity::~G4VisCommandViewerColourByDensity () {
delete fpCommand;
}
G4String G4VisCommandViewerColourByDensity::GetCurrentValue (G4UIcommand*) {
return "";
}
void G4VisCommandViewerColourByDensity::SetNewValue (G4UIcommand*, G4String newValue) {
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
if (!viewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
"ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
<< G4endl;
}
return;
}
G4ViewParameters vp = viewer->GetViewParameters();
G4int algorithmNumber;
G4double d0, d1, d2;
G4String unit;
std::istringstream is (newValue);
is >> algorithmNumber >> unit >> d0 >> d1 >> d2;
if (algorithmNumber < 0 || algorithmNumber > 1) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
"ERROR: Unrecognised algorithm number: " << algorithmNumber
<< G4endl;
}
return;
}
std::vector<G4double> parameters;
if (algorithmNumber > 0) {
const G4String where = "G4VisCommandViewerColourByDensity::SetNewValue";
G4double valueOfUnit;
// "Volumic Mass" is Michel's phrase for "Density"
if (ProvideValueOfUnit(where,unit,"Volumic Mass",valueOfUnit)) {
// Successful outcome of unit search
d0 *= valueOfUnit; d1 *= valueOfUnit; d2 *= valueOfUnit;
} else {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
"ERROR: Unrecognised or inappropriate unit: " << unit
<< G4endl;
}
return;
}
parameters.push_back(d0);
parameters.push_back(d1);
parameters.push_back(d2);
}
vp.SetCBDAlgorithmNumber(algorithmNumber);
vp.SetCBDParameters(parameters);
if (verbosity >= G4VisManager::confirmations) {
if (vp.GetCBDAlgorithmNumber() == 0) {
G4cout << "Colour by density deactivated" << G4endl;
} else {
G4cout << "Colour by density algorithm " << vp.GetCBDAlgorithmNumber()
<< " selected for viewer \"" << viewer->GetName()
<< "\n Parameters:";
for (auto p: vp.GetCBDParameters()) {
G4cout << ' ' << G4BestUnit(p,"Volumic Mass");
}
G4cout << G4endl;
}
}
SetViewParameters(viewer, vp);
}
////////////// /vis/viewer/copyViewFrom //////////////////////////
G4VisCommandViewerCopyViewFrom::G4VisCommandViewerCopyViewFrom () {
@@ -1645,6 +1763,7 @@ namespace {
<< vp.DrawingStyleCommands()
<< vp.SceneModifyingCommands()
<< vp.TouchableCommands()
<< vp.TimeWindowCommands()
<< std::endl;
}
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsViewerSet.cc 106122 2017-09-13 12:51:53Z gcosmo $
// $Id: G4VisCommandsViewerSet.cc 109510 2018-04-26 07:15:57Z gcosmo $
// /vis/viewer/set commands - John Allison 16th May 2000
@@ -42,6 +42,7 @@
#include "G4SystemOfUnits.hh"
#include <sstream>
#include <iomanip>
G4VisCommandsViewerSet::G4VisCommandsViewerSet ():
fLightsVector (G4ThreeVector(1.,1.,1.)),
@@ -114,7 +115,7 @@ G4VisCommandsViewerSet::G4VisCommandsViewerSet ():
("\"density\": culls volumes with density lower than threshold. Useful"
"\nfor eliminating \"container volumes\" with no physical correspondence,"
"\nwhose material is usually air. If this is selected, provide threshold"
"\ndensity and unit (g/cm3 mg/cm3 or kg/m3)."
"\ndensity and unit (e.g., g/cm3, mg/cm3 or kg/m3)."
);
parameter = new G4UIparameter("culling-option",'s',omitable = false);
parameter->SetParameterCandidates
@@ -127,7 +128,8 @@ G4VisCommandsViewerSet::G4VisCommandsViewerSet ():
parameter->SetDefaultValue("0.01");
fpCommandCulling->SetParameter(parameter);
parameter = new G4UIparameter("unit",'s',omitable = true);
parameter->SetParameterCandidates ("g/cm3, mg/cm3 kg/m3");
// parameter->SetParameterCandidates ("g/cm3 mg/cm3 kg/m3");
// Instead of the above, SetNewValue accepts *any* density unit.
parameter->SetDefaultValue("g/cm3");
fpCommandCulling->SetParameter(parameter);
@@ -442,37 +444,187 @@ G4VisCommandsViewerSet::G4VisCommandsViewerSet ():
parameter = new G4UIparameter ("z", 'd', omitable = true);
parameter -> SetDefaultValue (1.);
fpCommandViewpointVector -> SetParameter (parameter);
fpTimeWindowDirectory = new G4UIdirectory ("/vis/viewer/set/timeWindow/");
fpTimeWindowDirectory -> SetGuidance ("Set time window parameters of current viewer.");
G4String timeWindowGuidance =
"For these commands use"
"\n /vis/scene/add/trajectories rich"
"\n /vis/modeling/trajectories/drawByCharge-0/default/setTimeSliceInterval 0.01 ns"
"\nthen typically"
"\n /vis/viewer/set/timeWindow/displayLightFront true 0 0 -50 cm -0.5 ns"
"\n /vis/viewer/set/timeWindow/displayHeadTime true"
"\n /vis/viewer/set/timeWindow/fadeFactor 1"
"\n /run/beamOn # or several until you get a good event or events"
"\n /vis/viewer/set/timeWindow/startTime 0 ns 1 ns"
"\n /vis/viewer/save"
"\n /vis/viewer/set/timeWindow/startTime 1 ns 1 ns"
"\nthen zoom, pan etc to a view of interest and"
"\n /vis/viewer/save"
"\nthen repeat with next start time, another view and a save, then try"
"\n /vis/viewer/interpolate";
fpCommandTimeWindowDisplayHeadTime =
new G4UIcommand("/vis/viewer/set/timeWindow/displayHeadTime", this);
fpCommandTimeWindowDisplayHeadTime->SetGuidance
("Display head time of range in 2D text.");
fpCommandTimeWindowDisplayHeadTime->SetGuidance(timeWindowGuidance);
parameter = new G4UIparameter ("displayHeadTime", 'b', omitable = false);
parameter->SetDefaultValue(false);
fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
parameter = new G4UIparameter ("screenX", 'd', omitable = true);
parameter->SetGuidance("-1 < screenX < 1");
parameter->SetParameterRange("screenX >= -1. && screenX <= 1.");
parameter->SetDefaultValue(-0.9);
fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
parameter = new G4UIparameter ("screenY", 'd', omitable = true);
parameter->SetGuidance("-1 < screenY < 1");
parameter->SetParameterRange("screenY >= -1. && screenY <= 1.");
parameter->SetDefaultValue(-0.9);
fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
parameter = new G4UIparameter ("screenSize", 'd', omitable = true);
parameter->SetDefaultValue(24.);
fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
parameter = new G4UIparameter ("red", 'd', omitable = true);
parameter->SetParameterRange("red >= 0. && red <= 1.");
parameter->SetDefaultValue(0.);
fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
parameter = new G4UIparameter ("green", 'd', omitable = true);
parameter->SetParameterRange("green >= 0. && green <= 1.");
parameter->SetDefaultValue(1.);
fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
parameter = new G4UIparameter ("blue", 'd', omitable = true);
parameter->SetParameterRange("blue >= 0. && blue <= 1.");
parameter->SetDefaultValue(1.);
fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
fpCommandTimeWindowDisplayLightFront =
new G4UIcommand("/vis/viewer/set/timeWindow/displayLightFront", this);
fpCommandTimeWindowDisplayLightFront->SetGuidance
("Display the light front at head time.");
fpCommandTimeWindowDisplayLightFront->SetGuidance
("Tip: The trajectories can appear of jump ahead of the light front"
"\nbecause their time range overlaps the viewer's time range. To"
"\naverage out this discrete time effect, advance the light front by"
"\nhalf the trajectories interval. E.g., if the trajectory time slice"
"\ninterval is 0.01 ns:"
"\n /vis/viewer/set/timeWindow/displayLightFront true -90 0 0 mm -0.005 ns"
"\nTo prevent them beating the light front at all:"
"\n /vis/viewer/set/timeWindow/displayLightFront true -90 0 0 mm -0.01 ns");
fpCommandTimeWindowDisplayLightFront->SetGuidance(timeWindowGuidance);
parameter = new G4UIparameter ("displayLightFront", 'b', omitable = false);
parameter->SetDefaultValue(false);
fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
parameter = new G4UIparameter ("originX", 'd', omitable = true);
parameter->SetDefaultValue(0.);
fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
parameter = new G4UIparameter ("originY", 'd', omitable = true);
parameter->SetDefaultValue(0.);
fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
parameter = new G4UIparameter ("originZ", 'd', omitable = true);
parameter->SetDefaultValue(0.);
fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
parameter = new G4UIparameter ("space_unit", 's', omitable = true);
parameter->SetDefaultValue("m");
fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
parameter = new G4UIparameter ("originT", 'd', omitable = true);
parameter->SetDefaultValue(0.);
fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
parameter = new G4UIparameter ("time_unit", 's', omitable = true);
parameter->SetDefaultValue("s");
fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
parameter = new G4UIparameter ("red", 'd', omitable = true);
parameter->SetParameterRange("red >= 0. && red <= 1.");
parameter->SetDefaultValue(0.);
fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
parameter = new G4UIparameter ("green", 'd', omitable = true);
parameter->SetParameterRange("green >= 0. && green <= 1.");
parameter->SetDefaultValue(1.);
fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
parameter = new G4UIparameter ("blue", 'd', omitable = true);
parameter->SetParameterRange("blue >= 0. && blue <= 1.");
parameter->SetDefaultValue(0.);
fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
fpCommandTimeWindowEndTime =
new G4UIcommand("/vis/viewer/set/timeWindow/endTime", this);
fpCommandTimeWindowEndTime->SetGuidance("Set end and range of track time.");
fpCommandTimeWindowEndTime->SetGuidance(timeWindowGuidance);
parameter = new G4UIparameter ("end-time", 'd', omitable = false);
parameter->SetDefaultValue(G4VisAttributes::fVeryLongTime);
fpCommandTimeWindowEndTime->SetParameter(parameter);
parameter = new G4UIparameter ("end-time-unit", 's', omitable = false);
parameter->SetDefaultValue("ns");
fpCommandTimeWindowEndTime->SetParameter(parameter);
parameter = new G4UIparameter ("time-range", 'd', omitable = true);
parameter->SetDefaultValue(-1.);
fpCommandTimeWindowEndTime->SetParameter(parameter);
parameter = new G4UIparameter ("time-range-unit", 's', omitable = true);
parameter->SetDefaultValue("ns");
fpCommandTimeWindowEndTime->SetParameter(parameter);
fpCommandTimeWindowFadeFactor =
new G4UIcmdWithADouble("/vis/viewer/set/timeWindow/fadeFactor", this);
fpCommandTimeWindowFadeFactor->SetGuidance
("0: no fade; 1: maximum fade with time window.");
fpCommandTimeWindowFadeFactor->SetGuidance(timeWindowGuidance);
fpCommandTimeWindowFadeFactor->SetParameterName("fade_factor", omitable = false);
fpCommandTimeWindowFadeFactor->SetRange("fade_factor>=0.&&fade_factor<=1.");
fpCommandTimeWindowFadeFactor->SetDefaultValue(0.);
fpCommandTimeWindowStartTime =
new G4UIcommand("/vis/viewer/set/timeWindow/startTime", this);
fpCommandTimeWindowStartTime->SetGuidance("Set start and range of track time.");
fpCommandTimeWindowStartTime->SetGuidance(timeWindowGuidance);
parameter = new G4UIparameter ("start-time", 'd', omitable = false);
parameter->SetDefaultValue(-G4VisAttributes::fVeryLongTime);
fpCommandTimeWindowStartTime->SetParameter(parameter);
parameter = new G4UIparameter ("start-time-unit", 's', omitable = false);
parameter->SetDefaultValue("ns");
fpCommandTimeWindowStartTime->SetParameter(parameter);
parameter = new G4UIparameter ("time-range", 'd', omitable = true);
parameter->SetDefaultValue(-1.);
fpCommandTimeWindowStartTime->SetParameter(parameter);
parameter = new G4UIparameter ("time-range-unit", 's', omitable = true);
parameter->SetDefaultValue("ns");
fpCommandTimeWindowStartTime->SetParameter(parameter);
}
G4VisCommandsViewerSet::~G4VisCommandsViewerSet() {
delete fpCommandAll;
delete fpCommandTimeWindowStartTime;
delete fpCommandTimeWindowFadeFactor;
delete fpCommandTimeWindowEndTime;
delete fpCommandTimeWindowDisplayLightFront;
delete fpCommandTimeWindowDisplayHeadTime;
delete fpTimeWindowDirectory;
delete fpCommandViewpointVector;
delete fpCommandViewpointThetaPhi;
delete fpCommandUpVector;
delete fpCommandUpThetaPhi;
delete fpCommandTargetPoint;
delete fpCommandStyle;
delete fpCommandSectionPlane;
delete fpCommandRotationStyle;
delete fpCommandProjection;
delete fpCommandPicking;
delete fpCommandLineSegments;
delete fpCommandLightsVector;
delete fpCommandLightsThetaPhi;
delete fpCommandLightsMove;
delete fpCommandHiddenMarker;
delete fpCommandHiddenEdge;
delete fpCommandGlobalMarkerScale;
delete fpCommandGlobalLineWidthScale;
delete fpCommandExplodeFactor;
delete fpCommandEdge;
delete fpCommandDefaultTextColour;
delete fpCommandDefaultColour;
delete fpCommandCutawayMode;
delete fpCommandCulling;
delete fpCommandBackground;
delete fpCommandAuxEdge;
delete fpCommandAutoRefresh;
delete fpCommandBackground;
delete fpCommandCulling;
delete fpCommandCutawayMode;
delete fpCommandDefaultColour;
delete fpCommandDefaultTextColour;
delete fpCommandEdge;
delete fpCommandExplodeFactor;
delete fpCommandGlobalLineWidthScale;
delete fpCommandGlobalMarkerScale;
delete fpCommandHiddenEdge;
delete fpCommandHiddenMarker;
delete fpCommandLineSegments;
delete fpCommandLightsMove;
delete fpCommandLightsThetaPhi;
delete fpCommandLightsVector;
delete fpCommandPicking;
delete fpCommandProjection;
delete fpCommandRotationStyle;
delete fpCommandSectionPlane;
delete fpCommandStyle;
delete fpCommandTargetPoint;
delete fpCommandUpThetaPhi;
delete fpCommandUpVector;
delete fpCommandViewpointThetaPhi;
delete fpCommandViewpointVector;
delete fpCommandAll;
}
G4String G4VisCommandsViewerSet::GetCurrentValue(G4UIcommand*) {
@@ -638,22 +790,32 @@ void G4VisCommandsViewerSet::SetNewValue
}
}
else if (cullingOption == "density") {
vp.SetDensityCulling(boolFlag);
const G4String where =
"G4VisCommandsViewerSet::SetNewValue: culling: culling by density";
if (boolFlag) {
density *= G4UnitDefinition::GetValueOf(unit);
vp.SetVisibleDensity(density);
}
else {
density = vp.GetVisibleDensity();
G4double valueOfUnit;
// "Volumic Mass" is Michel's phrase for "Density"
if (ProvideValueOfUnit(where,unit,"Volumic Mass",valueOfUnit)) {
// Successful outcome of unit search
vp.SetDensityCulling(boolFlag);
density *= valueOfUnit;
vp.SetVisibleDensity(density);
} else {
// Unsuccessful outcome of unit search. Flag and density unchanged.
density = vp.GetVisibleDensity();
}
} else { // Reset flag but density unchanged.
vp.SetDensityCulling(boolFlag);
}
if (verbosity >= G4VisManager::confirmations) {
G4cout <<
"G4VisCommandsViewerSet::SetNewValue: culling: culling by density"
"\n flag set to " << G4UIcommand::ConvertToString(boolFlag) <<
". Volumes with density less than " <<
G4BestUnit(density,"Volumic Mass") <<
"\n will be culled, i.e., not drawn, if this flag is true."
<< G4endl;
G4cout
<< where
<< "\n flag set to "
<< std::boolalpha << vp.IsDensityCulling()
<< ". Volumes with density less than "
<< G4BestUnit(density,"Volumic Mass")
<< "\n will be culled, i.e., not drawn, if this flag is true."
<< G4endl;
}
}
else {
@@ -952,7 +1114,6 @@ void G4VisCommandsViewerSet::SetNewValue
G4double x, y, z, nx, ny, nz;
std::istringstream is (newValue);
is >> choice >> x >> y >> z >> unit >> nx >> ny >> nz;
G4int iSelector = -1;
if (choice.compareTo("off",G4String::ignoreCase) == 0 ||
!G4UIcommand::ConvertToBool(choice)) iSelector = 0;
@@ -970,7 +1131,6 @@ void G4VisCommandsViewerSet::SetNewValue
}
return;
}
G4double F = 1.;
// iSelector can only be 0 or 1
switch (iSelector) {
@@ -984,7 +1144,6 @@ void G4VisCommandsViewerSet::SetNewValue
vp.SetViewpointDirection(G4Normal3D(nx,ny,nz));
break;
}
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Section drawing is now: ";
if (vp.IsSection ()) G4cout << "on";
@@ -1141,6 +1300,117 @@ void G4VisCommandsViewerSet::SetNewValue
}
}
else if (command == fpCommandTimeWindowDisplayHeadTime)
{
G4String display;
G4double screenX, screenY, screenSize, red, green, blue;
std::istringstream iss(newValue);
iss >> display >> screenX >> screenY
>> screenSize >> red >> green >> blue;
vp.SetDisplayHeadTime(command->ConvertToBool(display));
vp.SetDisplayHeadTimeX(screenX);
vp.SetDisplayHeadTimeY(screenY);
vp.SetDisplayHeadTimeSize(screenSize);
vp.SetDisplayHeadTimeRed(red);
vp.SetDisplayHeadTimeGreen(green);
vp.SetDisplayHeadTimeBlue(blue);
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Display head time flag set: "
<< vp
<< G4endl;
}
}
else if (command == fpCommandTimeWindowDisplayLightFront)
{
G4String display, originX, originY, originZ, unitS, originT, unitT;
G4double red, green, blue;
std::istringstream iss(newValue);
iss >> display
>> originX >> originY >> originZ >> unitS
>> originT >> unitT
>> red >> green >> blue;
vp.SetDisplayLightFront(command->ConvertToBool(display));
vp.SetDisplayLightFrontX
(command->ConvertToDimensionedDouble(G4String(originX + ' ' + unitS)));
vp.SetDisplayLightFrontY
(command->ConvertToDimensionedDouble(G4String(originY + ' ' + unitS)));
vp.SetDisplayLightFrontZ
(command->ConvertToDimensionedDouble(G4String(originZ + ' ' + unitS)));
vp.SetDisplayLightFrontT
(command->ConvertToDimensionedDouble(G4String(originT + ' ' + unitT)));
vp.SetDisplayLightFrontRed(red);
vp.SetDisplayLightFrontGreen(green);
vp.SetDisplayLightFrontBlue(blue);
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Display light front flag set: "
<< vp
<< G4endl;
}
}
else if (command == fpCommandTimeWindowEndTime)
{
G4String end_time_string, end_time_unit,
time_range_string, time_range_unit;
std::istringstream iss(newValue);
iss >> end_time_string >> end_time_unit
>> time_range_string >> time_range_unit;
vp.SetEndTime
(command->ConvertToDimensionedDouble
(G4String(end_time_string + ' ' + end_time_unit)));
G4double timeRange = command->ConvertToDimensionedDouble
(G4String(time_range_string + ' ' + time_range_unit));
if (timeRange > 0.) {
vp.SetStartTime
(vp.GetEndTime() - timeRange);
}
if (verbosity >= G4VisManager::confirmations) {
G4cout
<< "Time window start time: " << vp.GetStartTime()/ns << " ns"
<< ", time window end time: " << vp.GetEndTime()/ns << " ns";
if (timeRange > 0.) {
G4cout << "\n (time range: " << timeRange/ns << " ns)";
}
G4cout << G4endl;
}
}
else if (command == fpCommandTimeWindowFadeFactor) {
vp.SetFadeFactor(command->ConvertToDouble(newValue));
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Time window fade factor changed to " << vp.GetFadeFactor()
<< G4endl;
}
}
else if (command == fpCommandTimeWindowStartTime)
{
G4String start_time_string, start_time_unit,
time_range_string, time_range_unit;
std::istringstream iss(newValue);
iss >> start_time_string >> start_time_unit
>> time_range_string >> time_range_unit;
vp.SetStartTime
(command->ConvertToDimensionedDouble
(G4String(start_time_string + ' ' + start_time_unit)));
G4double timeRange = command->ConvertToDimensionedDouble
(G4String(time_range_string + ' ' + time_range_unit));
if (timeRange > 0.) {
vp.SetEndTime
(vp.GetStartTime() + timeRange);
}
if (verbosity >= G4VisManager::confirmations) {
G4cout
<< "Time window start time: " << vp.GetStartTime()/ns << " ns"
<< ", time window end time: " << vp.GetEndTime()/ns << " ns";
if (timeRange > 0.) {
G4cout << "\n (time range: " << timeRange/ns << " ns)";
}
G4cout << G4endl;
}
}
else {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VisManager.cc 106957 2017-10-31 08:32:27Z gcosmo $
// $Id: G4VisManager.cc 110513 2018-05-28 07:37:38Z gcosmo $
//
//
// GEANT4 Visualization Manager - John Allison 02/Jan/1996.
@@ -479,6 +479,7 @@ void G4VisManager::RegisterMessengers () {
// Compound commands...
RegisterMessenger(new G4VisCommandDrawTree);
RegisterMessenger(new G4VisCommandDrawView);
RegisterMessenger(new G4VisCommandDrawLogicalVolume);
RegisterMessenger(new G4VisCommandDrawVolume);
RegisterMessenger(new G4VisCommandOpen);
RegisterMessenger(new G4VisCommandSpecify);
@@ -588,6 +589,7 @@ void G4VisManager::RegisterMessengers () {
RegisterMessenger(new G4VisCommandViewerClearTransients);
RegisterMessenger(new G4VisCommandViewerClearVisAttributesModifiers);
RegisterMessenger(new G4VisCommandViewerClone);
RegisterMessenger(new G4VisCommandViewerColourByDensity);
RegisterMessenger(new G4VisCommandViewerCopyViewFrom);
RegisterMessenger(new G4VisCommandViewerCreate);
RegisterMessenger(new G4VisCommandViewerDolly);