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
+70 -1
View File
@@ -1,4 +1,4 @@
$Id: History 106957 2017-10-31 08:32:27Z gcosmo $
$Id: History 110513 2018-05-28 07:37:38Z gcosmo $
-------------------------------------------------------------------
@@ -26,6 +26,75 @@ committal in the CVS repository !
History file for visualization management sub-category
------------------------------------------------------
25 May 2018 John Allison (visman-V10-04-11)
- Introduce /vis/drawLogicalVolume:
o Synonymous with /vis/specify.
o Both commands create a new scene and invoke /vis/scene/add/logicalVolume.
24 May 2018 John Allison (visman-V10-04-10)
- /vis/specify, /vis/scene/add/logicalVolume:
o Include overlap checking.
08 May 2018 Ben Morgan (visman-V10-04-09)
- G4VisCommandsMultithreading.cc:
- Explicitly #include G4Types header before use
of G4MULTITHREADED symbol. This prepares visman
for migration from -D flags to explicit header-set
#defines. It is backward compatible with old system.
25 April 2018 John Allison (visman-V10-04-08)
- G4VSceneHandler::CreateModelingParameters:
o Copy colour-by-density to modeling parameters.
24 April 2018 John Allison (visman-V10-04-07)
- G4ViewParameters.cc: Small bug fix.
24 April 2018 John Allison (visman-V10-04-06)
- Co-works greps-V10-04-04.
23 April 2018 John Allison (visman-V10-04-05)
- Co-works greps-V10-04-03.
- G4VisCommandsViewerSet.cc: /vis/viewer/set/timeWindow/ commands:
o Migrate to greps-V10-04-03.
- G4VisCommandsViewer.cc: Fix small error in guidance.
- G4ViewParameters.cc:
o Complete implementation of /vis/viewer/colourByDensity, e.g.,
operator<<, etc.
o Migrate to greps-V10-04-03.
22 April 2018 John Allison
- G4VisCommandsViewer, G4ViewParameters:
o Add /vis/viewer/colourByDensity.
22 April 2018 John Allison (visman-V10-04-04)
- G4VSceneHandler.cc: Reduced repetitive error messages.
31st March 2018 John Allison
- /vis/viewer/set/culling density: further cosmetic improvement.
30th March 2018 John Allison
- /vis/viewer/set/culling density: cosmetic improvement.
28th March 2018 John Allison (visman-V10-04-03)
- Introduce G4VVisCommand::ProvideValueOfUnit.
- /vis/viewer/set/culling density:
o Use G4VVisCommand::ProvideValueOfUnit.
o Fix bug and improve parsing.
- /vis/drawTree: Improve guidance.
11th March 2018 John Allison (visman-V10-04-02)
- G4VViewer.hh: Improve comments about switching threads.
8th January 2018 John Allison (visman-V10-04-01)
- Merged timemovebranch:
o Moved time window parameters from G4OpenGLStoredViewer to
G4ViewParameters. Now one can interpolate time window parameters (using
/vis/viewer/interpolate) and make a movie of particles moving through time.
o See vis-V10-04-00 History for more details.
12th December 2017 John Allison (visman-V10-04-00)
- G4ViewParameters.cc: Minor cosmetic.
29th October 2017 John Allison (visman-V10-03-16)
- G4VisManager.cc: Protect /vis/enable issued before run established.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VViewer.hh 99668 2016-09-30 08:02:13Z gcosmo $
// $Id: G4VViewer.hh 108859 2018-03-12 07:44:53Z gcosmo $
//
//
// John Allison 27th March 1996
@@ -102,17 +102,32 @@ public: // With description
std::vector<G4ThreeVector> ComputeFlyThrough(G4Vector3D*);
#ifdef G4MULTITHREADED
// In MT mode these functions are called in the following order for each run:
// Note: the order of calling of MovingToVisSubThread and SwitchToVisSubThread
// is undefined, so you may need to implement mutexes to ensure your preferred
// order - see, e.g., G4OpenGLQtViewer. To summarise, the order of calling is
// as follows - see G4VisManager.cc.
// DoneWithMasterThread
// MovingToVisSubThread ) or ( SwitchToVisSubThread
// SwitchToVisSubThread ) ( MovingToVisSubThread
// DoneWithVisSubThread
// MovingToMasterThread
// SwitchToMasterThread
// Called on the master thread before starting the vis sub-thread.
virtual void DoneWithMasterThread ();
// Called on the master thread after starting the vis sub-thread.
virtual void MovingToVisSubThread ();
// Called on the vis sub-thread when waiting for events.
// Called on the vis sub-thread at start of vis sub-thread.
virtual void SwitchToVisSubThread ();
// Called on the vis sub-thread when all events have been processed.
virtual void DoneWithVisSubThread ();
// Called on the vis sub-thread when all events have been processed.
virtual void MovingToMasterThread ();
// Called on the master thread after the vis sub-thread has terminated.
virtual void SwitchToMasterThread ();
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VVisCommand.hh 105349 2017-07-21 12:23:24Z gcosmo $
// $Id: G4VVisCommand.hh 109186 2018-04-03 07:22:18Z gcosmo $
// Base class for visualization commands - John Allison 9th August 1998
// It is really a messenger - we have one command per messenger.
@@ -87,6 +87,13 @@ protected:
// third and fourth arguments are ignored), or
// (1.,0.,0.,0.5): this also will be red with opacity 0.5.
G4bool ProvideValueOfUnit
(const G4String& where,
const G4String& unit,
const G4String& category,
G4double& value);
// Return false if there's a problem
// Other utilities.
void UpdateVisManagerScene (const G4String& sceneName = "");
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ViewParameters.hh 99418 2016-09-21 09:18:42Z gcosmo $
// $Id: G4ViewParameters.hh 109510 2018-04-26 07:15:57Z gcosmo $
//
//
// John Allison 19th July 1996
@@ -129,6 +129,8 @@ public: // With description
G4bool IsDensityCulling () const;
G4double GetVisibleDensity () const;
G4bool IsCullingCovered () const;
G4int GetCBDAlgorithmNumber () const;
const std::vector<G4double>& GetCBDParameters () const;
G4bool IsSection () const;
const G4Plane3D& GetSectionPlane () const;
G4bool IsCutaway () const;
@@ -179,7 +181,25 @@ public: // With description
RotationStyle GetRotationStyle () const;
const std::vector<G4ModelingParameters::VisAttributesModifier>&
GetVisAttributesModifiers () const;
G4double GetStartTime () const;
G4double GetEndTime () const;
G4double GetFadeFactor () const;
G4bool IsDisplayHeadTime () const;
G4double GetDisplayHeadTimeX () const;
G4double GetDisplayHeadTimeY () const;
G4double GetDisplayHeadTimeSize () const;
G4double GetDisplayHeadTimeRed () const;
G4double GetDisplayHeadTimeGreen () const;
G4double GetDisplayHeadTimeBlue () const;
G4bool IsDisplayLightFront () const;
G4double GetDisplayLightFrontX () const;
G4double GetDisplayLightFrontY () const;
G4double GetDisplayLightFrontZ () const;
G4double GetDisplayLightFrontT () const;
G4double GetDisplayLightFrontRed () const;
G4double GetDisplayLightFrontGreen () const;
G4double GetDisplayLightFrontBlue () const;
// Here Follow functions to evaluate useful quantities as a
// function of the radius of the Bounding Sphere of the object being
// viewed. Call them in the order given - for efficiency, later
@@ -200,6 +220,8 @@ public: // With description
void SetDensityCulling (G4bool);
void SetVisibleDensity (G4double visibleDensity);
void SetCullingCovered (G4bool);
void SetCBDAlgorithmNumber (G4int);
void SetCBDParameters (const std::vector<G4double>&);
void SetSectionPlane (const G4Plane3D& sectionPlane);
void UnsetSectionPlane ();
void SetCutawayMode (CutawayMode);
@@ -250,6 +272,24 @@ public: // With description
void SetRotationStyle (RotationStyle);
void ClearVisAttributesModifiers ();
void AddVisAttributesModifier(const G4ModelingParameters::VisAttributesModifier&);
void SetStartTime (G4double);
void SetEndTime (G4double);
void SetFadeFactor (G4double);
void SetDisplayHeadTime (G4bool);
void SetDisplayHeadTimeX (G4double);
void SetDisplayHeadTimeY (G4double);
void SetDisplayHeadTimeSize (G4double);
void SetDisplayHeadTimeRed (G4double);
void SetDisplayHeadTimeGreen (G4double);
void SetDisplayHeadTimeBlue (G4double);
void SetDisplayLightFront (G4bool);
void SetDisplayLightFrontX (G4double);
void SetDisplayLightFrontY (G4double);
void SetDisplayLightFrontZ (G4double);
void SetDisplayLightFrontT (G4double);
void SetDisplayLightFrontRed (G4double);
void SetDisplayLightFrontGreen (G4double);
void SetDisplayLightFrontBlue (G4double);
// Command dumping functions.
// For camera commands we need to provide the standard target point from
@@ -258,7 +298,8 @@ public: // With description
G4String DrawingStyleCommands () const;
G4String SceneModifyingCommands() const;
G4String TouchableCommands () const;
G4String TimeWindowCommands () const;
// Other functions.
void PrintDifferences (const G4ViewParameters& v) const;
@@ -287,6 +328,8 @@ private:
G4bool fDensityCulling; // Density culling requested. If so...
G4double fVisibleDensity; // ...density lower than this not drawn.
G4bool fCullCovered; // Cull daughters covered by opaque mothers.
G4int fCBDAlgorithmNumber; // Colour by density algorithm number.
std::vector<G4double> fCBDParameters; // Colour by density parameters.
G4bool fSection; // Section drawing requested (DCUT in GEANT3).
G4Plane3D fSectionPlane; // Cut plane for section drawing (DCUT).
CutawayMode fCutawayMode; // Cutaway mode.
@@ -329,6 +372,16 @@ private:
G4bool fPicking; // Request picking.
RotationStyle fRotationStyle; // Rotation style.
std::vector<G4ModelingParameters::VisAttributesModifier> fVisAttributesModifiers;
G4double fStartTime, fEndTime; // Time range (e.g., for trajectory steps).
G4double fFadeFactor; // 0: no fade; 1: maximum fade with time within range.
G4bool fDisplayHeadTime; // Display head time (fEndTime) in 2D text.
G4double fDisplayHeadTimeX, fDisplayHeadTimeY; // 2D screen coords.
G4double fDisplayHeadTimeSize; // Screen size.
G4double fDisplayHeadTimeRed, fDisplayHeadTimeGreen, fDisplayHeadTimeBlue;
G4bool fDisplayLightFront;// Display light front at head time originating at
G4double fDisplayLightFrontX, fDisplayLightFrontY, fDisplayLightFrontZ,
fDisplayLightFrontT;
G4double fDisplayLightFrontRed, fDisplayLightFrontGreen, fDisplayLightFrontBlue;
enum { // Constants for geometry mask in ParseGeometry and related functions.
fNoValue = 0,
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ViewParameters.icc 99418 2016-09-21 09:18:42Z gcosmo $
// $Id: G4ViewParameters.icc 109510 2018-04-26 07:15:57Z gcosmo $
//
//
// John Allison 20th October 1996
@@ -59,6 +59,14 @@ inline G4bool G4ViewParameters::IsCullingCovered () const {
return fCullCovered;
}
inline G4int G4ViewParameters::GetCBDAlgorithmNumber () const {
return fCBDAlgorithmNumber;
}
inline const std::vector<G4double>& G4ViewParameters::GetCBDParameters () const {
return fCBDParameters;
}
inline G4bool G4ViewParameters::IsSection () const {
return fSection;
}
@@ -212,6 +220,78 @@ G4ViewParameters::GetVisAttributesModifiers() const {
return fVisAttributesModifiers;
}
inline G4double G4ViewParameters::GetStartTime () const {
return fStartTime;
}
inline G4double G4ViewParameters::GetEndTime () const {
return fEndTime;
}
inline G4double G4ViewParameters::GetFadeFactor () const {
return fFadeFactor;
}
inline G4bool G4ViewParameters::IsDisplayHeadTime () const {
return fDisplayHeadTime;
}
inline G4double G4ViewParameters::GetDisplayHeadTimeX () const {
return fDisplayHeadTimeX;
}
inline G4double G4ViewParameters::GetDisplayHeadTimeY () const {
return fDisplayHeadTimeY;
}
inline G4double G4ViewParameters::GetDisplayHeadTimeSize () const {
return fDisplayHeadTimeSize;
}
inline G4double G4ViewParameters::GetDisplayHeadTimeRed () const {
return fDisplayHeadTimeRed;
}
inline G4double G4ViewParameters::GetDisplayHeadTimeGreen () const {
return fDisplayHeadTimeGreen;
}
inline G4double G4ViewParameters::GetDisplayHeadTimeBlue () const {
return fDisplayHeadTimeBlue;
}
inline G4bool G4ViewParameters::IsDisplayLightFront () const {
return fDisplayLightFront;
}
inline G4double G4ViewParameters::GetDisplayLightFrontX () const {
return fDisplayLightFrontX;
}
inline G4double G4ViewParameters::GetDisplayLightFrontY () const {
return fDisplayLightFrontY;
}
inline G4double G4ViewParameters::GetDisplayLightFrontZ () const {
return fDisplayLightFrontZ;
}
inline G4double G4ViewParameters::GetDisplayLightFrontT () const {
return fDisplayLightFrontT;
}
inline G4double G4ViewParameters::GetDisplayLightFrontRed () const {
return fDisplayLightFrontRed;
}
inline G4double G4ViewParameters::GetDisplayLightFrontGreen () const {
return fDisplayLightFrontGreen;
}
inline G4double G4ViewParameters::GetDisplayLightFrontBlue () const {
return fDisplayLightFrontBlue;
}
inline void
G4ViewParameters::SetDrawingStyle (G4ViewParameters::DrawingStyle style) {
fDrawingStyle = style;
@@ -237,6 +317,14 @@ inline void G4ViewParameters::SetCullingCovered (G4bool value) {
fCullCovered = value;
}
inline void G4ViewParameters::SetCBDAlgorithmNumber (G4int n) {
fCBDAlgorithmNumber = n;
}
inline void G4ViewParameters::SetCBDParameters (const std::vector<G4double>& p) {
fCBDParameters = p;
}
inline void G4ViewParameters::SetSectionPlane (const G4Plane3D& sectionPlane) {
fSection = true;
fSectionPlane = sectionPlane;
@@ -391,3 +479,74 @@ inline void G4ViewParameters::ClearVisAttributesModifiers () {
fVisAttributesModifiers.clear ();
}
inline void G4ViewParameters::SetStartTime (G4double startTime) {
fStartTime = startTime;
}
inline void G4ViewParameters::SetEndTime (G4double endTime) {
fEndTime = endTime;
}
inline void G4ViewParameters::SetFadeFactor (G4double fadeFactor) {
fFadeFactor = fadeFactor;
}
inline void G4ViewParameters::SetDisplayHeadTime (G4bool displayHeadTime) {
fDisplayHeadTime = displayHeadTime;
}
inline void G4ViewParameters::SetDisplayHeadTimeX (G4double displayHeadTimeX) {
fDisplayHeadTimeX = displayHeadTimeX;
}
inline void G4ViewParameters::SetDisplayHeadTimeY (G4double displayHeadTimeY) {
fDisplayHeadTimeY = displayHeadTimeY;
}
inline void G4ViewParameters::SetDisplayHeadTimeSize (G4double displayHeadTimeSize) {
fDisplayHeadTimeSize = displayHeadTimeSize;
}
inline void G4ViewParameters::SetDisplayHeadTimeRed (G4double displayHeadTimeRed) {
fDisplayHeadTimeRed = displayHeadTimeRed;
}
inline void G4ViewParameters::SetDisplayHeadTimeGreen (G4double displayHeadTimeGreen) {
fDisplayHeadTimeGreen = displayHeadTimeGreen;
}
inline void G4ViewParameters::SetDisplayHeadTimeBlue (G4double displayHeadTimeBlue) {
fDisplayHeadTimeBlue = displayHeadTimeBlue;
}
inline void G4ViewParameters::SetDisplayLightFront (G4bool displayLightFront) {
fDisplayLightFront = displayLightFront;
}
inline void G4ViewParameters::SetDisplayLightFrontX (G4double displayLightFrontX) {
fDisplayLightFrontX = displayLightFrontX;
}
inline void G4ViewParameters::SetDisplayLightFrontY (G4double displayLightFrontY) {
fDisplayLightFrontY = displayLightFrontY;
}
inline void G4ViewParameters::SetDisplayLightFrontZ (G4double displayLightFrontZ) {
fDisplayLightFrontZ = displayLightFrontZ;
}
inline void G4ViewParameters::SetDisplayLightFrontT (G4double displayLightFrontT) {
fDisplayLightFrontT = displayLightFrontT;
}
inline void G4ViewParameters::SetDisplayLightFrontRed (G4double displayLightFrontRed) {
fDisplayLightFrontRed = displayLightFrontRed;
}
inline void G4ViewParameters::SetDisplayLightFrontGreen (G4double displayLightFrontGreen) {
fDisplayLightFrontGreen = displayLightFrontGreen;
}
inline void G4ViewParameters::SetDisplayLightFrontBlue (G4double displayLightFrontBlue) {
fDisplayLightFrontBlue = displayLightFrontBlue;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsCompound.hh 66373 2012-12-18 09:41:34Z gcosmo $
// $Id: G4VisCommandsCompound.hh 110513 2018-05-28 07:37:38Z gcosmo $
// Compound /vis/ commands - John Allison 15th May 2000
@@ -55,7 +55,18 @@ private:
G4UIcommand* fpCommand;
};
class G4VisCommandDrawVolume: public G4VVisCommand {
class G4VisCommandDrawLogicalVolume: public G4VVisCommand {
public:
G4VisCommandDrawLogicalVolume ();
virtual ~G4VisCommandDrawLogicalVolume ();
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4VisCommandDrawLogicalVolume (const G4VisCommandDrawLogicalVolume&);
G4VisCommandDrawLogicalVolume& operator = (const G4VisCommandDrawLogicalVolume&);
G4UIcommand* fpCommand;
};
class G4VisCommandDrawVolume: public G4VVisCommand {
public:
G4VisCommandDrawVolume ();
virtual ~G4VisCommandDrawVolume ();
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsViewer.hh 102234 2017-01-13 15:59:41Z gcosmo $
// $Id: G4VisCommandsViewer.hh 109510 2018-04-26 07:15:57Z gcosmo $
// /vis/viewer commands - John Allison 25th October 1998
@@ -140,6 +140,18 @@ private:
G4UIcommand* fpCommand;
};
class G4VisCommandViewerColourByDensity: public G4VVisCommandViewer {
public:
G4VisCommandViewerColourByDensity ();
virtual ~G4VisCommandViewerColourByDensity ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4VisCommandViewerColourByDensity (const G4VisCommandViewerColourByDensity&);
G4VisCommandViewerColourByDensity& operator = (const G4VisCommandViewerColourByDensity&);
G4UIcommand* fpCommand;
};
class G4VisCommandViewerCopyViewFrom: public G4VVisCommandViewer {
public:
G4VisCommandViewerCopyViewFrom ();
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsViewerSet.hh 66373 2012-12-18 09:41:34Z gcosmo $
// $Id: G4VisCommandsViewerSet.hh 108131 2018-01-09 13:23:26Z gcosmo $
// /vis/viewer/set commands - John Allison 16th May 2000
@@ -35,6 +35,7 @@
#include <vector>
class G4UIdirectory;
class G4UIcommand;
class G4UIcmdWithAString;
class G4UIcmdWithABool;
@@ -82,6 +83,12 @@ private:
G4UIcommand* fpCommandViewpointThetaPhi;
G4UIcommand* fpCommandViewpointVector;
G4ThreeVector fViewpointVector;
G4UIdirectory* fpTimeWindowDirectory;
G4UIcommand* fpCommandTimeWindowDisplayHeadTime;
G4UIcommand* fpCommandTimeWindowDisplayLightFront;
G4UIcommand* fpCommandTimeWindowEndTime;
G4UIcmdWithADouble* fpCommandTimeWindowFadeFactor;
G4UIcommand* fpCommandTimeWindowStartTime;
};
#endif
@@ -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);