Import Geant4 8.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:07:44 +02:00
parent fe73f43734
commit 75c7fd177d
764 changed files with 45230 additions and 95238 deletions
+27 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.90 2006/12/12 11:51:13 gcosmo Exp $
$Id: History,v 1.92 2007/01/11 16:43:49 allison Exp $
-------------------------------------------------------------------
@@ -26,6 +26,32 @@ committal in the CVS repository !
History file for visualization management sub-category
------------------------------------------------------
11th January 2007 John Allison (visman-V08-02-01)
- Added /vis/abortReviewKeptEvents.
- /vis/reviewKeptEvents: Improved guidance.
- Bug fix: /vis/open in /vis/reviewKeptEvents loop.
o Moved fpRequestedEvent from G4VSceneHandler to G4VisManager.
- Reduced WARNING noise.
5th January 2007 John Allison (visman-V08-02-00)
- G4VSceneHandler:
o Introduced LoadAtts (from G4OpenInventorSceneHandler, but now
available to all scene handlers). Loads G4AttValues and G4AttDefs
onto any object that inherits G4AttHolder.
o Change signature of GetLineWidth from G4Visible& to
G4VisAttributes* for consistency with similar utility functions.
(Only used by OpenGL at present; requires opengl-V08-02-00.)
o GetLineSegmentsPerCircle: protected against null vis atts pointer.
- G4VisCommandsGeometrySet and G4VisManager.cc:
o Introduced /vis/geometry/set/forceLineSegmentsPerCircle
(inadvertently omitted in previous release).
o Improved guidance.
- G4VisCommandsGeometry.cc: Invoke /vis/viewer/rebuild only if viewer current.
- G4VViewer.cc: Improved comment.
- G4VisCommandsCompound.cc:
o Re-introduced /vis/scene/add/eventID into /vis/drawVolume.
- G4VisCommandsViewer.cc: Improve guidance for /vis/viewer/addCutawayPlane.
12th December 2006 Gabriele Cosmo (visman-V08-01-16)
- Commented command "vis/scene/add/eventID" forcing event ID to scene in
G4VisCommandsCompound.cc.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VSceneHandler.hh,v 1.37 2006/11/15 19:25:31 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4VSceneHandler.hh,v 1.39 2007/01/11 16:38:14 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
//
// John Allison 19th July 1996.
@@ -58,6 +58,7 @@ class G4LogicalVolume;
class G4VPhysicalVolume;
class G4Material;
class G4Event;
class G4AttHolder;
class G4VSceneHandler: public G4VGraphicsScene {
@@ -216,10 +217,6 @@ public: // With description
void SetTransientsDrawnThisEvent (G4bool);
void SetTransientsDrawnThisRun (G4bool);
// Maintained by vis manager.
void SetEvent (const G4Event*);
// If non-zero, this event is used in ProcessScene. Otherwise, the
// current event, or last event(s) are used. The user must
// SetEvent(0) when finished.
//////////////////////////////////////////////////////////////
// Public utility functions.
@@ -232,9 +229,8 @@ public: // With description
const G4Colour& GetTextColor (const G4Text&);
// Returns colour of G4Text object, or default text colour.
G4double GetLineWidth(const G4Visible& visible);
// Returns line width of G4Visible object, or default line width.
// Multiplies by GlobalLineWidthScale.
G4double GetLineWidth(const G4VisAttributes*);
// Returns line width of G4VisAttributes multiplied by GlobalLineWidthScale.
G4ViewParameters::DrawingStyle GetDrawingStyle (const G4VisAttributes*);
// Returns drawing style from current view parameters, unless the user
@@ -246,7 +242,7 @@ public: // With description
// unless the user has forced through the vis attributes, thereby
// over-riding the current view parameter.
G4int GetNoOfSides(const G4VisAttributes* pVisAttribs);
G4int GetNoOfSides(const G4VisAttributes*);
// Returns no. of sides (lines segments per circle) from current
// view parameters, unless the user has forced through the vis
// attributes, thereby over-riding the current view parameter.
@@ -313,6 +309,15 @@ protected:
// Generic clipping using the BooleanProcessor in graphics_reps is
// implemented in this class. Subclasses that implement their own
// clipping should provide an override that returns zero.
void LoadAtts(const G4Visible&, G4AttHolder*);
// Load G4AttValues and G4AttDefs associated with the G4Visible
// object onto the G4AttHolder object. It checks fpModel, and also
// loads the G4AttValues and G4AttDefs from G4PhysicalVolumeModel,
// G4VTrajectory, G4VTrajectoryPoint, or G4VHits, as appropriate.
// The G4AttHolder object is an object of a class that publicly
// inherits G4AttHolder - see, e.g., SoG4Polyhedron in the Open
// Inventor driver. G4AttHolder deletes G4AttValues in its
// destructor to ensure proper clean-up of G4AttValues.
//////////////////////////////////////////////////////////////
// Data members
@@ -337,7 +342,6 @@ protected:
// object transformation.
G4int fNestingDepth; // For Begin/EndPrimitives.
const G4VisAttributes* fpVisAttribs; // Working vis attributes.
const G4Event* fRequestedEvent; // If non-zero, use this event.
const G4Transform3D fIdentityTransformation;
private:
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VSceneHandler.icc,v 1.18 2006/11/15 19:25:31 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4VSceneHandler.icc,v 1.20 2007/01/11 16:38:14 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
//
// John Allison 19th July 1996.
@@ -123,9 +123,6 @@ inline void G4VSceneHandler::SetTransientsDrawnThisRun (G4bool drawn) {
fTransientsDrawnThisRun = drawn;
}
inline void G4VSceneHandler::SetEvent (const G4Event* event) {
fRequestedEvent = event;
}
inline const G4Colour& G4VSceneHandler::GetColor (const G4Visible& visible) {
return GetColour (visible);
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommands.hh,v 1.6 2006/11/14 14:59:54 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4VisCommands.hh,v 1.7 2007/01/11 16:39:33 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
// /vis/ top level commands - John Allison 5th February 2001
@@ -38,6 +38,18 @@ class G4UIcmdWithABool;
class G4UIcmdWithAString;
class G4UIcmdWithoutParameter;
class G4VisCommandAbortReviewKeptEvents: public G4VVisCommand {
public:
G4VisCommandAbortReviewKeptEvents ();
virtual ~G4VisCommandAbortReviewKeptEvents ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4VisCommandAbortReviewKeptEvents (const G4VisCommandAbortReviewKeptEvents&);
G4VisCommandAbortReviewKeptEvents& operator = (const G4VisCommandAbortReviewKeptEvents&);
G4UIcmdWithABool* fpCommand;
};
class G4VisCommandEnable: public G4VVisCommand {
public:
G4VisCommandEnable ();
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsGeometrySet.hh,v 1.2 2006/06/29 21:28:36 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4VisCommandsGeometrySet.hh,v 1.3 2007/01/05 16:24:19 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
// /vis/geometry commands - John Allison 31st January 2006
@@ -81,6 +81,19 @@ private:
G4bool fForceAuxEdgeVisible;
};
class G4VisCommandGeometrySetForceLineSegmentsPerCircleFunction:
public G4VVisCommandGeometrySetFunction {
public:
G4VisCommandGeometrySetForceLineSegmentsPerCircleFunction
(G4int lineSegmentsPerCircle):
fLineSegmentsPerCircle(lineSegmentsPerCircle) {}
void operator()
(G4VisAttributes* visAtts) const
{visAtts->SetForceLineSegmentsPerCircle(fLineSegmentsPerCircle);}
private:
G4int fLineSegmentsPerCircle;
};
class G4VisCommandGeometrySetForceSolidFunction:
public G4VVisCommandGeometrySetFunction {
public:
@@ -211,6 +224,21 @@ private:
G4UIcommand* fpCommand;
};
class G4VisCommandGeometrySetForceLineSegmentsPerCircle:
public G4VVisCommandGeometrySet {
public:
G4VisCommandGeometrySetForceLineSegmentsPerCircle ();
virtual ~G4VisCommandGeometrySetForceLineSegmentsPerCircle ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4VisCommandGeometrySetForceLineSegmentsPerCircle
(const G4VisCommandGeometrySetForceLineSegmentsPerCircle&);
G4VisCommandGeometrySetForceLineSegmentsPerCircle& operator=
(const G4VisCommandGeometrySetForceLineSegmentsPerCircle&);
G4UIcommand* fpCommand;
};
class G4VisCommandGeometrySetForceWireframe:
public G4VVisCommandGeometrySet {
public:
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisManager.hh,v 1.65 2006/11/21 14:23:20 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4VisManager.hh,v 1.66 2007/01/11 16:40:05 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
//
@@ -348,6 +348,8 @@ public: // With description
G4int GetLastRunID () const;
G4bool GetTransientsDrawnThisRun () const;
G4bool GetTransientsDrawnThisEvent () const;
const G4Event* GetRequestedEvent () const;
G4bool GetAbortReviewKeptEvents () const;
void SetUserAction (G4VUserVisAction* pVisAction,
const G4VisExtent& = G4VisExtent::NullExtent);
@@ -365,6 +367,9 @@ public: // With description
void SetXGeometryString (const G4String&);
void SetEventRefreshing (G4bool);
void ResetTransientsDrawnFlags ();
// If non-zero, requested event is used in G4VSceneHandler::ProcessScene.
void SetRequestedEvent (const G4Event*);
void SetAbortReviewKeptEvents (G4bool);
/////////////////////////////////////////////////////////////////////
// Utility functions.
@@ -435,13 +440,15 @@ private:
std::vector<G4UIcommand*> fDirectoryList;
G4VisStateDependent* fpStateDependent; // Friend state dependent class.
G4int fWindowSizeHintX, fWindowSizeHintY; // For viewer...
G4String fXGeometryString; // ...construction.
G4TrajectoriesModel dummyTrajectoriesModel; // For passing drawing mode.
G4bool fEventRefreshing;
G4bool fTransientsDrawnThisRun;
G4bool fTransientsDrawnThisEvent;
G4bool fEventKeepingSuspended;
G4bool fKeptLastEvent;
G4String fXGeometryString; // ...construction.
G4TrajectoriesModel dummyTrajectoriesModel; // For passing drawing mode.
G4bool fEventRefreshing;
G4bool fTransientsDrawnThisRun;
G4bool fTransientsDrawnThisEvent;
G4bool fEventKeepingSuspended;
G4bool fKeptLastEvent;
const G4Event* fpRequestedEvent; // If non-zero, scene handler uses.
G4bool fAbortReviewKeptEvents;
// Trajectory draw model manager
G4VisModelManager<G4VTrajectoryModel>* fpTrajDrawModelMgr;
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisManager.icc,v 1.19 2006/11/14 14:59:55 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4VisManager.icc,v 1.20 2007/01/11 16:40:58 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
//
// GEANT4 Visualization Manager - John Allison 02/Jan/1996.
@@ -89,6 +89,14 @@ inline G4bool G4VisManager::GetTransientsDrawnThisRun() const {
return fTransientsDrawnThisRun;
}
inline const G4Event* G4VisManager::GetRequestedEvent() const {
return fpRequestedEvent;
}
inline G4bool G4VisManager::GetAbortReviewKeptEvents() const {
return fAbortReviewKeptEvents;
}
inline void G4VisManager::SetUserActionExtent (const G4VisExtent& extent) {
fUserVisActionExtent = extent;
}
@@ -121,3 +129,11 @@ inline void G4VisManager::RegisterMessenger(G4UImessenger* msgr)
{
fMessengerList.push_back(msgr);
}
inline void G4VisManager::SetRequestedEvent (const G4Event* event) {
fpRequestedEvent = event;
}
inline void G4VisManager::SetAbortReviewKeptEvents (G4bool abort) {
fAbortReviewKeptEvents = abort;
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VSceneHandler.cc,v 1.77 2006/11/21 14:23:53 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4VSceneHandler.cc,v 1.79 2007/01/11 16:38:14 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
//
// John Allison 19th July 1996
@@ -70,12 +70,15 @@
#include "G4PhysicalVolumeModel.hh"
#include "G4ModelingParameters.hh"
#include "G4VTrajectory.hh"
#include "G4VTrajectoryPoint.hh"
#include "G4HitsModel.hh"
#include "G4VHit.hh"
#include "Randomize.hh"
#include "G4StateManager.hh"
#include "G4RunManager.hh"
#include "G4Run.hh"
#include "G4Transform3D.hh"
#include "G4AttHolder.hh"
G4VSceneHandler::G4VSceneHandler (G4VGraphicsSystem& system, G4int id, const G4String& name):
fSystem (system),
@@ -94,8 +97,7 @@ G4VSceneHandler::G4VSceneHandler (G4VGraphicsSystem& system, G4int id, const G4S
fpModel (0),
fpObjectTransformation (0),
fNestingDepth (0),
fpVisAttribs (0),
fRequestedEvent (0)
fpVisAttribs (0)
{
G4VisManager* pVMan = G4VisManager::GetInstance ();
fpScene = pVMan -> GetCurrentScene ();
@@ -420,14 +422,11 @@ void G4VSceneHandler::RequestPrimitives (const G4VSolid& solid) {
BeginPrimitives (*fpObjectTransformation);
G4NURBS* pNURBS = 0;
G4Polyhedron* pPolyhedron = 0;
const G4VisAttributes* pVisAttribs =
fpViewer -> GetApplicableVisAttributes (fpVisAttribs);
switch (fpViewer -> GetViewParameters () . GetRepStyle ()) {
case G4ViewParameters::nurbs:
pNURBS = solid.CreateNURBS ();
if (pNURBS) {
pNURBS -> SetVisAttributes
(fpViewer -> GetApplicableVisAttributes (pVisAttribs));
pNURBS -> SetVisAttributes (fpVisAttribs);
AddPrimitive (*pNURBS);
delete pNURBS;
break;
@@ -446,11 +445,11 @@ void G4VSceneHandler::RequestPrimitives (const G4VSolid& solid) {
// Dropping through to polyhedron...
case G4ViewParameters::polyhedron:
default:
G4Polyhedron::SetNumberOfRotationSteps (GetNoOfSides (pVisAttribs));
G4Polyhedron::SetNumberOfRotationSteps (GetNoOfSides (fpVisAttribs));
pPolyhedron = solid.GetPolyhedron ();
G4Polyhedron::ResetNumberOfRotationSteps ();
if (pPolyhedron) {
pPolyhedron -> SetVisAttributes (pVisAttribs);
pPolyhedron -> SetVisAttributes (fpVisAttribs);
AddPrimitive (*pPolyhedron);
}
else {
@@ -548,8 +547,8 @@ void G4VSceneHandler::ProcessScene (G4VViewer&) {
visManager->SetEventRefreshing(true);
if (fRequestedEvent) {
DrawEvent(fRequestedEvent);
if (visManager->GetRequestedEvent()) {
DrawEvent(visManager->GetRequestedEvent());
} else {
@@ -707,6 +706,54 @@ const G4Polyhedron* G4VSceneHandler::CreateCutawayPolyhedron()
return 0;
}
void G4VSceneHandler::LoadAtts(const G4Visible& visible, G4AttHolder* holder)
{
// Load G4Atts from G4VisAttributes, if any...
const std::map<G4String,G4AttDef>* vaDefs =
visible.GetVisAttributes()->GetAttDefs();
if (vaDefs) {
holder->AddAtts(visible.GetVisAttributes()->CreateAttValues(), vaDefs);
}
G4PhysicalVolumeModel* pPVModel =
dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
if (pPVModel) {
// Load G4Atts from G4PhysicalVolumeModel...
const std::map<G4String,G4AttDef>* defs = pPVModel->GetAttDefs();
if (defs) {
holder->AddAtts(pPVModel->CreateCurrentAttValues(), defs);
}
}
G4TrajectoriesModel* trajModel = dynamic_cast<G4TrajectoriesModel*>(fpModel);
if (trajModel) {
// Load G4Atts from trajectory...
const G4VTrajectory* traj = trajModel->GetCurrentTrajectory();
const std::map<G4String,G4AttDef>* defs = traj->GetAttDefs();
if (defs) {
holder->AddAtts(traj->CreateAttValues(), defs);
}
G4int nPoints = traj->GetPointEntries();
for (G4int i = 0; i < nPoints; ++i) {
G4VTrajectoryPoint* trajPoint = traj->GetPoint(i);
const std::map<G4String,G4AttDef>* defs = trajPoint->GetAttDefs();
if (defs) {
holder->AddAtts(trajPoint->CreateAttValues(), defs);
}
}
}
G4HitsModel* hitsModel = dynamic_cast<G4HitsModel*>(fpModel);
if (hitsModel) {
// Load G4Atts from hit...
const G4VHit* hit = hitsModel->GetCurrentHit();
const std::map<G4String,G4AttDef>* defs = hit->GetAttDefs();
if (defs) {
holder->AddAtts(hit->CreateAttValues(), defs);
}
}
}
const G4Colour& G4VSceneHandler::GetColour (const G4Visible& visible) {
// Colour is determined by the applicable vis attributes.
const G4Colour& colour = fpViewer ->
@@ -723,10 +770,9 @@ const G4Colour& G4VSceneHandler::GetTextColour (const G4Text& text) {
return colour;
}
G4double G4VSceneHandler::GetLineWidth(const G4Visible& visible)
G4double G4VSceneHandler::GetLineWidth(const G4VisAttributes* pVisAttribs)
{
G4double lineWidth = fpViewer->
GetApplicableVisAttributes(visible.GetVisAttributes())->GetLineWidth();
G4double lineWidth = pVisAttribs->GetLineWidth();
if (lineWidth < 1.) lineWidth = 1.;
lineWidth *= fpViewer -> GetViewParameters().GetGlobalLineWidthScale();
if (lineWidth < 1.) lineWidth = 1.;
@@ -738,7 +784,7 @@ G4ViewParameters::DrawingStyle G4VSceneHandler::GetDrawingStyle
// Drawing style is normally determined by the view parameters, but
// it can be overriddden by the ForceDrawingStyle flag in the vis
// attributes.
G4ViewParameters::DrawingStyle style =
G4ViewParameters::DrawingStyle style =
fpViewer->GetViewParameters().GetDrawingStyle();
if (pVisAttribs -> IsForceDrawingStyle ()) {
G4VisAttributes::ForcedDrawingStyle forcedStyle =
@@ -810,15 +856,17 @@ G4int G4VSceneHandler::GetNoOfSides(const G4VisAttributes* pVisAttribs)
// by the view parameters, but it can be overriddden by the
// ForceLineSegmentsPerCircle in the vis attributes.
G4int lineSegmentsPerCircle = fpViewer->GetViewParameters().GetNoOfSides();
if (pVisAttribs->GetForcedLineSegmentsPerCircle() > 0)
lineSegmentsPerCircle = pVisAttribs->GetForcedLineSegmentsPerCircle();
const G4int nSegmentsMin = 12;
if (lineSegmentsPerCircle < nSegmentsMin) {
lineSegmentsPerCircle = nSegmentsMin;
G4cout <<
"G4VSceneHandler::GetNoOfSides: attempt to set the"
"\nnumber of line segements per circle < " << nSegmentsMin
<< "; forced to " << lineSegmentsPerCircle << G4endl;
if (pVisAttribs) {
if (pVisAttribs->IsForceLineSegmentsPerCircle())
lineSegmentsPerCircle = pVisAttribs->GetForcedLineSegmentsPerCircle();
const G4int nSegmentsMin = 12;
if (lineSegmentsPerCircle < nSegmentsMin) {
lineSegmentsPerCircle = nSegmentsMin;
G4cout <<
"G4VSceneHandler::GetNoOfSides: attempt to set the"
"\nnumber of line segements per circle < " << nSegmentsMin
<< "; forced to " << lineSegmentsPerCircle << G4endl;
}
}
return lineSegmentsPerCircle;
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VViewer.cc,v 1.23 2006/06/29 21:29:26 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4VViewer.cc,v 1.24 2007/01/05 16:25:15 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
//
// John Allison 27th March 1996
@@ -81,7 +81,7 @@ void G4VViewer::SetName (const G4String& name) {
const G4VisAttributes* G4VViewer::GetApplicableVisAttributes
(const G4VisAttributes* pVisAttribs) const {
// If the pointer is null, pick up the default vis attributes from
// If pVisAttribs is zero, pick up the default vis attributes from
// the view parameters.
if (!pVisAttribs)
pVisAttribs = GetViewParameters ().GetDefaultVisAttributes ();
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommands.cc,v 1.20 2006/11/26 15:49:10 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4VisCommands.cc,v 1.21 2007/01/11 16:39:33 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
// /vis/ top level commands - John Allison 5th February 2001
@@ -40,6 +40,30 @@
#include "G4Run.hh"
#include "G4UIsession.hh"
////////////// /vis/abortReviewKeptEvents /////////////////////////////
G4VisCommandAbortReviewKeptEvents::G4VisCommandAbortReviewKeptEvents () {
G4bool omitable;
fpCommand = new G4UIcmdWithABool("/vis/abortReviewKeptEvents", this);
fpCommand -> SetGuidance("Abort review of kept events.");
fpCommand -> SetParameterName("abort", omitable=true);
fpCommand -> SetDefaultValue(true);
}
G4VisCommandAbortReviewKeptEvents::~G4VisCommandAbortReviewKeptEvents () {
delete fpCommand;
}
G4String G4VisCommandAbortReviewKeptEvents::GetCurrentValue (G4UIcommand*) {
return G4String();
}
void G4VisCommandAbortReviewKeptEvents::SetNewValue (G4UIcommand*,
G4String newValue) {
fpVisManager->SetAbortReviewKeptEvents(G4UIcommand::ConvertToBool(newValue));
}
////////////// /vis/enable ///////////////////////////////////////
G4VisCommandEnable::G4VisCommandEnable () {
@@ -127,11 +151,16 @@ G4VisCommandReviewKeptEvents::G4VisCommandReviewKeptEvents ()
fpCommand -> SetGuidance("Review kept events.");
fpCommand -> SetGuidance
("If a macro file is specified, it is executed for each event.");
fpCommand -> SetGuidance
("If a macro file is not specified, each event is drawn to the current"
"\nviewer. After each event, the session is paused. The user may issue"
"\nany allowed command. Then enter \"continue\" to continue to the next"
"\nevent.");
fpCommand -> SetGuidance(
"If a macro file is not specified, each event is drawn to the current"
"\nviewer. After each event, the session is paused. The user may issue"
"\nany allowed command. Then enter \"cont[inue]\" to continue to the next"
"\nevent."
"\nUseful commands might be:"
"\n \"/vis/viewer/...\" to change the view (zoom, set/viewpoint,...)."
"\n \"/vis/oglx/printEPS\" to get hard copy."
"\n \"/vis/open\" to get alternative viewer."
"\n \"/vis/abortReviewKeptEvents\", then \"cont[inue]\", to abort.");
fpCommand -> SetParameterName("macro-file-name", omitable=true);
fpCommand -> SetDefaultValue("");
}
@@ -184,8 +213,6 @@ void G4VisCommandReviewKeptEvents::SetNewValue (G4UIcommand*, G4String newValue)
return;
}
G4VSceneHandler* sceneHandler = fpVisManager->GetCurrentSceneHandler();
G4UImanager* UImanager = G4UImanager::GetUIpointer();
G4int keepVerbose = UImanager->GetVerboseLevel();
G4int newVerbose(0);
@@ -199,14 +226,26 @@ void G4VisCommandReviewKeptEvents::SetNewValue (G4UIcommand*, G4String newValue)
if (macroFileName.empty()) {
// Draw to viewer and pause session...
G4UIsession* session = UImanager->GetSession();
for (size_t i = 0; i < nKeptEvents; ++i) {
const G4Event* event = (*events)[i];
if (verbosity >= G4VisManager::warnings) {
G4cout << "Drawing event : " << event->GetEventID() <<
". At EndOfEvent, enter any command, then \"continue\"..."
". At EndOfEvent, enter any command, then \"cont[inue]\"..."
<< G4endl;
static G4bool first = true;
if (first) {
first = false;
G4cout <<
" Useful commands might be:"
"\n \"/vis/viewer/...\" to change the view (zoom, set/viewpoint,...)."
"\n \"/vis/oglx/printEPS\" to get hard copy."
"\n \"/vis/open\" to get alternative viewer."
"\n \"/vis/abortReviewKeptEvents\", then \"cont[inue]\", to abort."
<< G4endl;
}
}
sceneHandler->SetEvent(event);
fpVisManager->SetRequestedEvent(event);
UImanager->ApplyCommand("/vis/viewer/rebuild");
/* The above command forces a rebuild of the scene, including
the detector. This is fine for "immediate" viewers - a
@@ -223,12 +262,12 @@ void G4VisCommandReviewKeptEvents::SetNewValue (G4UIcommand*, G4String newValue)
there too. This needs further investigation - enhanced
features or a complete re-think.
*/
if (!viewer->GetViewParameters().IsAutoRefresh())
UImanager->ApplyCommand("/vis/viewer/flush");
G4UIsession* session = UImanager->GetSession();
UImanager->ApplyCommand("/vis/viewer/flush");
session->PauseSessionStart("EndOfEvent");
sceneHandler->SetEvent(0);
fpVisManager->SetRequestedEvent(0);
if (fpVisManager->GetAbortReviewKeptEvents()) break;
}
fpVisManager->SetAbortReviewKeptEvents(false);
} else {
@@ -239,9 +278,9 @@ void G4VisCommandReviewKeptEvents::SetNewValue (G4UIcommand*, G4String newValue)
G4cout << "Drawing event : " << event->GetEventID()
<< " with macro file \"" << macroFileName << G4endl;
}
sceneHandler->SetEvent(event);
fpVisManager->SetRequestedEvent(event);
UImanager->ApplyCommand("/control/execute " + macroFileName);
sceneHandler->SetEvent(0);
fpVisManager->SetRequestedEvent(0);
}
}
pScene->SetRefreshAtEndOfEvent(currentRefreshAtEndOfEvent);
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsCompound.cc,v 1.35 2006/12/12 11:48:13 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4VisCommandsCompound.cc,v 1.38 2007/03/27 15:41:34 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
// Compound /vis/ commands - John Allison 15th May 2000
@@ -201,14 +201,13 @@ void G4VisCommandDrawVolume::SetNewValue(G4UIcommand*, G4String newValue) {
newVerbose = 2;
UImanager->SetVerboseLevel(newVerbose);
UImanager->ApplyCommand("/vis/scene/create");
// UImanager->ApplyCommand("/vis/scene/add/eventID");
UImanager->ApplyCommand(G4String("/vis/scene/add/volume " + newValue));
UImanager->ApplyCommand("/vis/sceneHandler/attach");
UImanager->SetVerboseLevel(keepVerbose);
static G4bool warned = false;
if (verbosity >= G4VisManager::warnings && !warned) {
if (verbosity >= G4VisManager::confirmations && !warned) {
G4cout <<
"WARNING: For systems which are not \"auto-refresh\" you will need to"
"NOTE: For systems which are not \"auto-refresh\" you will need to"
"\n issue \"/vis/viewer/refresh\" or \"/vis/viewer/flush\"."
<< G4endl;
warned = true;
@@ -321,9 +320,9 @@ void G4VisCommandSpecify::SetNewValue(G4UIcommand*, G4String newValue) {
UImanager->ApplyCommand("/vis/sceneHandler/attach");
UImanager->SetVerboseLevel(keepVerbose);
static G4bool warned = false;
if (verbosity >= G4VisManager::warnings && !warned) {
if (verbosity >= G4VisManager::confirmations && !warned) {
G4cout <<
"WARNING: For systems which are not \"auto-refresh\" you will need to"
"NOTE: For systems which are not \"auto-refresh\" you will need to"
"\n issue \"/vis/viewer/refresh\" or \"/vis/viewer/flush\"."
<< G4endl;
warned = true;
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsGeometry.cc,v 1.3 2006/06/29 21:29:38 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4VisCommandsGeometry.cc,v 1.4 2007/01/05 16:29:38 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
// /vis/geometry commands - John Allison 31st January 2006
@@ -146,5 +146,7 @@ void G4VisCommandGeometryRestore::SetNewValue(G4UIcommand*, G4String newValue)
}
return;
}
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/rebuild");
if (fpVisManager->GetCurrentViewer()) {
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/rebuild");
}
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsGeometrySet.cc,v 1.6 2006/09/19 16:05:13 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4VisCommandsGeometrySet.cc,v 1.7 2007/01/05 16:24:19 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
// /vis/geometry commands - John Allison 31st January 2006
@@ -170,7 +170,7 @@ G4VisCommandGeometrySetDaughtersInvisible::G4VisCommandGeometrySetDaughtersInvis
{
G4bool omitable;
fpCommand = new G4UIcommand("/vis/geometry/set/daughtersInvisible", this);
fpCommand->SetGuidance("Sets daughters of logical volume(s) invisible.");
fpCommand->SetGuidance("Makes daughters of logical volume(s) invisible.");
fpCommand->SetGuidance("\"all\" sets all logical volumes.");
fpCommand->SetGuidance
("Optionally propagates down hierarchy to given depth.");
@@ -242,7 +242,8 @@ G4VisCommandGeometrySetForceAuxEdgeVisible::G4VisCommandGeometrySetForceAuxEdgeV
G4bool omitable;
fpCommand = new G4UIcommand("/vis/geometry/set/forceAuxEdgeVisible", this);
fpCommand->SetGuidance
("Sets auxiliary (soft) edges of logical volume(s) drawing visible.");
("Forces auxiliary (soft) edges of logical volume(s) to be visible,"
"\nregardless of the view parameters.");
fpCommand->SetGuidance("\"all\" sets all logical volumes.");
fpCommand->SetGuidance
("Optionally propagates down hierarchy to given depth.");
@@ -287,6 +288,59 @@ void G4VisCommandGeometrySetForceAuxEdgeVisible::SetNewValue
Set(name, setForceAuxEdgeVisible, requestedDepth);
}
////////////// /vis/geometry/set/forceLineSegmentsPerCircle /////////////////////////
G4VisCommandGeometrySetForceLineSegmentsPerCircle::G4VisCommandGeometrySetForceLineSegmentsPerCircle()
{
G4bool omitable;
fpCommand = new G4UIcommand("/vis/geometry/set/forceLineSegmentsPerCircle", this);
fpCommand->SetGuidance
("Forces number of line segments per circle, the precision with which a"
"\ncurved line or surface is represented by a polygon or polyhedron,"
"\nregardless of the view parameters.");
fpCommand->SetGuidance("\"all\" sets all logical volumes.");
fpCommand->SetGuidance
("Optionally propagates down hierarchy to given depth.");
G4UIparameter* parameter;
parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true);
parameter->SetDefaultValue("all");
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("depth", 'd', omitable = true);
parameter->SetDefaultValue(0);
parameter->SetGuidance
("Depth of propagation (-1 means unlimited depth).");
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("lineSegmentsPerCircle", 'd', omitable = true);
parameter->SetGuidance
("< 0 means not forced, i.e., under control of viewer.");
parameter->SetDefaultValue(-1);
fpCommand->SetParameter(parameter);
}
G4VisCommandGeometrySetForceLineSegmentsPerCircle::~G4VisCommandGeometrySetForceLineSegmentsPerCircle()
{
delete fpCommand;
}
G4String
G4VisCommandGeometrySetForceLineSegmentsPerCircle::GetCurrentValue(G4UIcommand*)
{
return "";
}
void G4VisCommandGeometrySetForceLineSegmentsPerCircle::SetNewValue
(G4UIcommand*, G4String newValue)
{
G4String name;
G4int requestedDepth;
G4int lineSegmentsPerCircle;
std::istringstream iss(newValue);
iss >> name >> requestedDepth >> lineSegmentsPerCircle;
G4VisCommandGeometrySetForceLineSegmentsPerCircleFunction setForceLineSegmentsPerCircle(lineSegmentsPerCircle);
Set(name, setForceLineSegmentsPerCircle, requestedDepth);
}
////////////// /vis/geometry/set/forceSolid /////////////////////////
G4VisCommandGeometrySetForceSolid::G4VisCommandGeometrySetForceSolid()
@@ -294,7 +348,8 @@ G4VisCommandGeometrySetForceSolid::G4VisCommandGeometrySetForceSolid()
G4bool omitable;
fpCommand = new G4UIcommand("/vis/geometry/set/forceSolid", this);
fpCommand->SetGuidance
("Sets logical volume(s) drawing always to be as solid (surface drawing).");
("Forces logical volume(s) always to be drawn solid (surface drawing),"
"\nregardless of the view parameters.");
fpCommand->SetGuidance("\"all\" sets all logical volumes.");
fpCommand->SetGuidance
("Optionally propagates down hierarchy to given depth.");
@@ -344,7 +399,8 @@ G4VisCommandGeometrySetForceWireframe::G4VisCommandGeometrySetForceWireframe()
G4bool omitable;
fpCommand = new G4UIcommand("/vis/geometry/set/forceWireframe", this);
fpCommand->SetGuidance
("Sets logical volume(s) drawing always to be as wireframe.");
("Forces logical volume(s) always to be drawn as wireframe,"
"\nregardless of the view parameters.");
fpCommand->SetGuidance("\"all\" sets all logical volumes.");
fpCommand->SetGuidance
("Optionally propagates down hierarchy to given depth.");
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsViewer.cc,v 1.66 2006/11/25 15:38:03 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4VisCommandsViewer.cc,v 1.68 2007/01/11 16:41:30 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
// /vis/viewer commands - John Allison 25th October 1998
@@ -72,7 +72,7 @@ G4VisCommandViewerAddCutawayPlane::G4VisCommandViewerAddCutawayPlane () {
G4bool omitable;
fpCommand = new G4UIcommand ("/vis/viewer/addCutawayPlane", this);
fpCommand -> SetGuidance
("Add cutaway plane A*x + B*y + C*z + D = 0 to current viewer.");
("Add cutaway plane to current viewer.");
G4UIparameter* parameter;
parameter = new G4UIparameter("x",'d',omitable = true);
parameter -> SetDefaultValue (0);
@@ -1138,8 +1138,8 @@ void G4VisCommandViewerRefresh::SetNewValue (G4UIcommand*, G4String newValue) {
G4Scene* scene = sceneHandler->GetScene();
if (!scene) {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: SceneHandler \"" << sceneHandler->GetName()
if (verbosity >= G4VisManager::confirmations) {
G4cout << "NOTE: SceneHandler \"" << sceneHandler->GetName()
<< "\", to which viewer \"" << refreshName << "\"" <<
"\n is attached, has no scene - \"/vis/scene/create\" and"
" \"/vis/sceneHandler/attach\""
@@ -1412,8 +1412,8 @@ void G4VisCommandViewerUpdate::SetNewValue (G4UIcommand*, G4String newValue) {
G4Scene* scene = sceneHandler->GetScene();
if (!scene) {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: SceneHandler \"" << sceneHandler->GetName()
if (verbosity >= G4VisManager::confirmations) {
G4cout << "NOTE: SceneHandler \"" << sceneHandler->GetName()
<< "\", to which viewer \"" << updateName << "\"" <<
"\n is attached, has no scene - \"/vis/scene/create\" and"
" \"/vis/sceneHandler/attach\""
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VisManager.cc,v 1.109 2006/11/26 15:43:51 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4VisManager.cc,v 1.111 2007/01/11 16:41:59 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
//
// GEANT4 Visualization Manager - John Allison 02/Jan/1996.
@@ -91,7 +91,9 @@ G4VisManager::G4VisManager ():
fTransientsDrawnThisRun (false),
fTransientsDrawnThisEvent (false),
fEventKeepingSuspended (false),
fKeptLastEvent (false)
fKeptLastEvent (false),
fpRequestedEvent (0),
fAbortReviewKeptEvents (false)
// All other objects use default constructors.
{
fpTrajDrawModelMgr = new G4VisModelManager<G4VTrajectoryModel>("/vis/modeling/trajectories");
@@ -589,45 +591,42 @@ void G4VisManager::CreateViewer (G4String name) {
fpSceneHandler -> AddViewerToList (fpViewer);
fpSceneHandler -> SetCurrentViewer (fpViewer);
if (fVerbosity >= confirmations) {
G4cout << "G4VisManager::CreateViewer: new viewer created:"
<< G4endl;
}
const G4ViewParameters& vp = fpViewer->GetViewParameters();
G4bool warn = false;
if (fVerbosity >= parameters) {
G4cout << " view parameters are:\n " << vp << G4endl;
}
if (vp.IsCulling () && vp.IsCullingInvisible ()) {
warn = true;
static G4bool warned = false;
if (fVerbosity >= confirmations) {
G4cout << "G4VisManager::CreateViewer: new viewer created:"
<< G4endl;
}
if (fVerbosity >= parameters) {
G4cout << " view parameters are:\n " << vp << G4endl;
}
if (fVerbosity >= warnings) {
G4cout <<
"WARNING: objects with visibility flag set to \"false\""
" will not be drawn!"
"\n \"/vis/viewer/set/culling global false\" to Draw such objects."
<< G4endl;
if (!warned) {
G4cout <<
"NOTE: objects with visibility flag set to \"false\""
" will not be drawn!"
"\n \"/vis/viewer/set/culling global false\" to Draw such objects."
"\n Also see other \"/vis/viewer/set\" commands."
<< G4endl;
warned = true;
}
}
}
if (vp.IsCullingCovered ()) {
if (!warn) {
if (fVerbosity >= confirmations) {
G4cout << "G4VisManager::CreateViewer: new viewer created:"
<< G4endl;
static G4bool warned = false;
if (fVerbosity >= warnings) {
if (!warned) {
G4cout <<
"WARNING: covered objects in solid mode will not be rendered!"
"\n \"/vis/viewer/set/culling coveredDaughters false\" to reverse this."
"\n Also see other \"/vis/viewer/set\" commands."
<< G4endl;
warned = true;
}
}
warn = true;
if (fVerbosity >= warnings) {
G4cout <<
"WARNING: covered objects in solid mode will not be rendered!"
"\n \"/vis/viewer/set/culling coveredDaughters false\" to reverse this."
<< G4endl;
}
}
if (warn) {
if (fVerbosity >= warnings) {
G4cout << " Also see other \"/vis/viewer/set\" commands."
<< G4endl;
}
}
}
else {
@@ -892,6 +891,7 @@ void G4VisManager::RegisterMessengers () {
G4UIcommand* directory;
// Top level basic commands...
RegisterMessenger(new G4VisCommandAbortReviewKeptEvents);
RegisterMessenger(new G4VisCommandEnable);
RegisterMessenger(new G4VisCommandList);
RegisterMessenger(new G4VisCommandVerbose);
@@ -920,6 +920,7 @@ void G4VisManager::RegisterMessengers () {
RegisterMessenger(new G4VisCommandGeometrySetLineStyle);
RegisterMessenger(new G4VisCommandGeometrySetLineWidth);
RegisterMessenger(new G4VisCommandGeometrySetForceAuxEdgeVisible);
RegisterMessenger(new G4VisCommandGeometrySetForceLineSegmentsPerCircle);
RegisterMessenger(new G4VisCommandGeometrySetForceSolid);
RegisterMessenger(new G4VisCommandGeometrySetForceWireframe);
RegisterMessenger(new G4VisCommandGeometrySetVisibility);