Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4GraphicsSystemList.cc 66373 2012-12-18 09:41:34Z gcosmo $
#include "G4GraphicsSystemList.hh"
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4Scene.cc 75567 2013-11-04 11:35:11Z gcosmo $
//
//
// Scene data John Allison 19th July 1996.
@@ -41,7 +41,7 @@ G4Scene::G4Scene (const G4String& name):
fName (name),
fRefreshAtEndOfEvent(true),
fRefreshAtEndOfRun(true),
fMaxNumberOfKeptEvents(0)
fMaxNumberOfKeptEvents(100)
{} // Note all other data members have default initial values.
G4Scene::~G4Scene () {}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4SceneHandlerList.cc 66373 2012-12-18 09:41:34Z gcosmo $
#include "G4SceneHandlerList.hh"
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4SceneList.cc 66373 2012-12-18 09:41:34Z gcosmo $
#include "G4SceneList.hh"
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VGraphicsSystem.cc 66373 2012-12-18 09:41:34Z gcosmo $
//
//
// John Allison 27th March 1996
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VSceneHandler.cc 73126 2013-08-19 08:01:37Z gcosmo $
//
//
// John Allison 19th July 1996
@@ -50,7 +50,6 @@
#include "G4Square.hh"
#include "G4Polymarker.hh"
#include "G4Polyhedron.hh"
#include "G4NURBS.hh"
#include "G4Visible.hh"
#include "G4VisAttributes.hh"
#include "G4VModel.hh"
@@ -125,6 +124,15 @@ G4VSceneHandler::~G4VSceneHandler () {
}
}
const G4VisExtent& G4VSceneHandler::GetExtent() const
{
if (fpScene) {
return fpScene->GetExtent();
} else {
return G4VisExtent::NullExtent;
}
}
void G4VSceneHandler::PreAddSolid (const G4Transform3D& objectTransformation,
const G4VisAttributes& visAttribs) {
fObjectTransformation = objectTransformation;
@@ -259,15 +267,12 @@ void G4VSceneHandler::AddSolid (const G4VSolid& solid) {
void G4VSceneHandler::AddCompound (const G4VTrajectory& traj) {
G4TrajectoriesModel* trajectoriesModel =
dynamic_cast<G4TrajectoriesModel*>(fpModel);
if (!trajectoriesModel) G4Exception
if (trajectoriesModel)
traj.DrawTrajectory();
else {
G4Exception
("G4VSceneHandler::AddCompound(const G4VTrajectory&)",
"visman0105", FatalException, "Not a G4TrajectoriesModel.");
else {
if (trajectoriesModel->IsDrawingModeSet()) {
traj.DrawTrajectory(trajectoriesModel->GetDrawingMode());
} else {
traj.DrawTrajectory();
}
}
}
@@ -479,57 +484,22 @@ void G4VSceneHandler::SetScene (G4Scene* pScene) {
void G4VSceneHandler::RequestPrimitives (const G4VSolid& solid) {
BeginPrimitives (fObjectTransformation);
G4NURBS* pNURBS = 0;
G4Polyhedron* pPolyhedron = 0;
switch (fpViewer -> GetViewParameters () . GetRepStyle ()) {
case G4ViewParameters::nurbs:
pNURBS = solid.CreateNURBS ();
if (pNURBS) {
static G4bool warned = false;
if (!warned) {
warned = true;
G4cout <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
"!!!!! NURBS are deprecated and will be removed in the next major release."
"\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
<< G4endl;
}
pNURBS -> SetVisAttributes (fpVisAttribs);
AddPrimitive (*pNURBS);
delete pNURBS;
break;
G4Polyhedron::SetNumberOfRotationSteps (GetNoOfSides (fpVisAttribs));
G4Polyhedron* pPolyhedron = solid.GetPolyhedron ();
G4Polyhedron::ResetNumberOfRotationSteps ();
if (pPolyhedron) {
pPolyhedron -> SetVisAttributes (fpVisAttribs);
AddPrimitive (*pPolyhedron);
}
else {
G4VisManager::Verbosity verbosity = G4VisManager::GetVerbosity();
if (verbosity >= G4VisManager::errors) {
G4cout <<
"ERROR: G4VSceneHandler::RequestPrimitives"
"\n Polyhedron not available for " << solid.GetName () <<
".\n This means it cannot be visualized on most systems."
"\n Contact the Visualization Coordinator." << G4endl;
}
else {
G4VisManager::Verbosity verbosity = G4VisManager::GetVerbosity();
if (verbosity >= G4VisManager::errors) {
G4cout <<
"ERROR: G4VSceneHandler::RequestPrimitives"
"\n NURBS not available for "
<< solid.GetName () << G4endl;
G4cout << "Trying polyhedron." << G4endl;
}
}
// Dropping through to polyhedron...
case G4ViewParameters::polyhedron:
default:
G4Polyhedron::SetNumberOfRotationSteps (GetNoOfSides (fpVisAttribs));
pPolyhedron = solid.GetPolyhedron ();
G4Polyhedron::ResetNumberOfRotationSteps ();
if (pPolyhedron) {
pPolyhedron -> SetVisAttributes (fpVisAttribs);
AddPrimitive (*pPolyhedron);
}
else {
G4VisManager::Verbosity verbosity = G4VisManager::GetVerbosity();
if (verbosity >= G4VisManager::errors) {
G4cout <<
"ERROR: G4VSceneHandler::RequestPrimitives"
"\n Polyhedron not available for " << solid.GetName () <<
".\n This means it cannot be visualized on most systems."
"\n Contact the Visualization Coordinator." << G4endl;
}
}
break;
}
EndPrimitives ();
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VViewer.cc 66373 2012-12-18 09:41:34Z gcosmo $
//
//
// John Allison 27th March 1996
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VVisCommand.cc 66870 2013-01-14 23:38:59Z adotti $
// Base class for visualization commands - John Allison 9th August 1998
// It is really a messenger - we have one command per messenger.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4ViewParameters.cc 71534 2013-06-17 16:07:53Z gcosmo $
//
//
// John Allison 19th July 1996
@@ -42,7 +42,6 @@
G4ViewParameters::G4ViewParameters ():
fDrawingStyle (wireframe),
fAuxEdgeVisible (false),
fRepStyle (polyhedron),
fCulling (true),
fCullInvisible (true),
fDensityCulling (false),
@@ -481,14 +480,18 @@ G4String G4ViewParameters::TouchableCommands() const
for (iModifier = vams.begin();
iModifier != vams.end();
++iModifier) {
oss << "\n/vis/set/touchable";
static G4ModelingParameters::PVNameCopyNoPath lastPath;
const G4ModelingParameters::PVNameCopyNoPath& vamPath =
iModifier->GetPVNameCopyNoPath();
G4ModelingParameters::PVNameCopyNoPathConstIterator iVAM;
for (iVAM = vamPath.begin();
iVAM != vamPath.end();
++iVAM) {
oss << ' ' << iVAM->GetName() << ' ' << iVAM->GetCopyNo();
if (vamPath != lastPath) {
lastPath = vamPath;
oss << "\n/vis/set/touchable";
G4ModelingParameters::PVNameCopyNoPathConstIterator iVAM;
for (iVAM = vamPath.begin();
iVAM != vamPath.end();
++iVAM) {
oss << ' ' << iVAM->GetName() << ' ' << iVAM->GetCopyNo();
}
}
const G4VisAttributes& vamVisAtts = iModifier->GetVisAttributes();
const G4Colour& c = vamVisAtts.GetColour();
@@ -583,7 +586,6 @@ void G4ViewParameters::PrintDifferences (const G4ViewParameters& v) const {
// No particular order from here on.
(fDrawingStyle != v.fDrawingStyle) ||
(fAuxEdgeVisible != v.fAuxEdgeVisible) ||
(fRepStyle != v.fRepStyle) ||
(fCulling != v.fCulling) ||
(fCullInvisible != v.fCullInvisible) ||
(fDensityCulling != v.fDensityCulling) ||
@@ -677,15 +679,6 @@ std::ostream& operator << (std::ostream& os, const G4ViewParameters& v) {
if (!v.fAuxEdgeVisible) os << "in";
os << "visible";
os << "\n Representation style: ";
switch (v.fRepStyle) {
case G4ViewParameters::polyhedron:
os << "polyhedron"; break;
case G4ViewParameters::nurbs:
os << "nurbs"; break;
default: os << "unrecognised"; break;
}
os << "\n Culling: ";
if (v.fCulling) os << "on";
else os << "off";
@@ -829,7 +822,6 @@ G4bool G4ViewParameters::operator != (const G4ViewParameters& v) const {
// No particular order from here on.
(fDrawingStyle != v.fDrawingStyle) ||
(fAuxEdgeVisible != v.fAuxEdgeVisible) ||
(fRepStyle != v.fRepStyle) ||
(fCulling != v.fCulling) ||
(fCullInvisible != v.fCullInvisible) ||
(fDensityCulling != v.fDensityCulling) ||
@@ -883,17 +875,14 @@ G4bool G4ViewParameters::operator != (const G4ViewParameters& v) const {
((fExplodeFactor != v.fExplodeFactor) ||
(fExplodeCentre != v.fExplodeCentre))) return true;
if (G4ModelingParameters::VAMSNotEqual
(fVisAttributesModifiers, v.fVisAttributesModifiers))
return true;
if (fVisAttributesModifiers != v.fVisAttributesModifiers) return true;
return false;
}
void G4ViewParameters::SetXGeometryString (const G4String& geomStringArg) {
void G4ViewParameters::SetXGeometryString (const G4String& geomStringArg)
{
G4int x,y = 0;
unsigned int w,h = 0;
G4String geomString = geomStringArg;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4ViewerList.cc 66373 2012-12-18 09:41:34Z gcosmo $
#include "G4ViewerList.hh"
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VisCommands.cc 75567 2013-11-04 11:35:11Z gcosmo $
// /vis/ top level commands - John Allison 5th February 2001
@@ -279,7 +279,10 @@ void G4VisCommandReviewKeptEvents::SetNewValue (G4UIcommand*, G4String newValue)
if (keepVerbose >= 2 || verbosity >= G4VisManager::confirmations)
newVerbose = 2;
UImanager->SetVerboseLevel(newVerbose);
G4VVisManager* keepConcreteInstance = fpVisManager->GetConcreteInstance();
fpVisManager->Enable();
// Event by event refreshing...
reviewing = true;
G4bool currentRefreshAtEndOfEvent = pScene->GetRefreshAtEndOfEvent();
@@ -299,6 +302,7 @@ void G4VisCommandReviewKeptEvents::SetNewValue (G4UIcommand*, G4String newValue)
first = false;
G4cout <<
" Useful commands might be:"
"\n \"/vis/scene/add/trajectories\" if not already added."
"\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."
@@ -347,6 +351,8 @@ void G4VisCommandReviewKeptEvents::SetNewValue (G4UIcommand*, G4String newValue)
pScene->SetRefreshAtEndOfEvent(currentRefreshAtEndOfEvent);
reviewing = false;
if (keepConcreteInstance) fpVisManager->Enable();
else fpVisManager->Disable();
UImanager->SetVerboseLevel(keepVerbose);
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VisCommandsCompound.cc 66870 2013-01-14 23:38:59Z adotti $
// Compound /vis/ commands - John Allison 15th May 2000
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VisCommandsGeometry.cc 66870 2013-01-14 23:38:59Z adotti $
// /vis/geometry commands - John Allison 31st January 2006
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VisCommandsGeometrySet.cc 66870 2013-01-14 23:38:59Z adotti $
// /vis/geometry commands - John Allison 31st January 2006
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VisCommandsScene.cc 75567 2013-11-04 11:35:11Z gcosmo $
// /vis/scene commands - John Allison 9th August 1998
@@ -320,6 +320,7 @@ void G4VisCommandSceneEndOfEventAction::SetNewValue (G4UIcommand*,
}
} else {
pScene->SetRefreshAtEndOfEvent(true);
pScene->SetMaxNumberOfKeptEvents(maxNumberOfKeptEvents);
pSceneHandler->SetMarkForClearingTransientStore(true);
}
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VisCommandsSceneAdd.cc 77479 2013-11-25 10:01:22Z gcosmo $
// /vis/scene/add commands - John Allison 9th August 1998
#include "G4VisCommandsSceneAdd.hh"
@@ -36,6 +36,7 @@
#include "G4ModelingParameters.hh"
#include "G4HitsModel.hh"
#include "G4DigiModel.hh"
#include "G4MagneticFieldModel.hh"
#include "G4PSHitsModel.hh"
#include "G4TrajectoriesModel.hh"
#include "G4ScaleModel.hh"
@@ -43,10 +44,8 @@
#include "G4ArrowModel.hh"
#include "G4AxesModel.hh"
#include "G4PhysicalVolumeSearchScene.hh"
#include "G4VGlobalFastSimulationManager.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4FlavoredParallelWorldModel.hh"
#include "G4ApplicationState.hh"
#include "G4VUserVisAction.hh"
#include "G4CallbackModel.hh"
@@ -57,14 +56,12 @@
#include "G4UIcommand.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4Tokenizer.hh"
#include "G4RunManager.hh"
#include "G4StateManager.hh"
#include "G4Run.hh"
#include "G4Event.hh"
#include "G4IdentityTrajectoryFilter.hh"
#include "G4TransportationManager.hh"
#include "G4PropagatorInField.hh"
#include "G4Trajectory.hh"
#include "G4TrajectoryPoint.hh"
#include "G4RichTrajectory.hh"
@@ -266,7 +263,14 @@ G4VisCommandSceneAddAxes::G4VisCommandSceneAddAxes () {
fpCommand = new G4UIcommand ("/vis/scene/add/axes", this);
fpCommand -> SetGuidance ("Add axes.");
fpCommand -> SetGuidance
("Draws axes at (x0, y0, z0) of given length and colour.");
("Draws axes at (x0, y0, z0) of given length and colour.");
fpCommand -> SetGuidance
("If \"unitcolour\" is \"auto\", x, y and z will be red, green and blue"
"\n respectively. Otherwise choose from the pre-defined text-specified"
"\n colours - see information printed by the vis manager at start-up or"
"\n use \"/vis/list\".");
fpCommand -> SetGuidance
("If \"length\" is negative, it is set to about 25% of scene extent.");
G4UIparameter* parameter;
parameter = new G4UIparameter ("x0", 'd', omitable = true);
parameter->SetDefaultValue (0.);
@@ -279,20 +283,12 @@ G4VisCommandSceneAddAxes::G4VisCommandSceneAddAxes () {
fpCommand->SetParameter (parameter);
parameter = new G4UIparameter ("length", 'd', omitable = true);
parameter->SetDefaultValue (-1.);
parameter->SetGuidance
("If negative, length automatic, about 25% of scene extent.");
fpCommand->SetParameter (parameter);
parameter = new G4UIparameter ("unit", 's', omitable = true);
parameter->SetDefaultValue ("m");
fpCommand->SetParameter (parameter);
parameter = new G4UIparameter ("unitcolour", 's', omitable = true);
parameter->SetDefaultValue ("auto");
parameter->SetGuidance
("If \"auto\", x, y and z will be red, green and blue respectively.");
parameter->SetGuidance
("Otherwise choose from the pre-defined text-specified colours - "
"\n see information printed by the vis manager at start-up or"
"\n use \"/vis/list\".");
fpCommand->SetParameter (parameter);
}
@@ -361,6 +357,9 @@ G4VisCommandSceneAddDate::G4VisCommandSceneAddDate () {
G4bool omitable;
fpCommand = new G4UIcommand ("/vis/scene/add/date", this);
fpCommand -> SetGuidance ("Adds date to current scene.");
fpCommand -> SetGuidance
("If \"date\"is omitted, the current date and time is drawn."
"\nOtherwise, the string, including the rest of the line, is drawn.");
G4UIparameter* parameter;
parameter = new G4UIparameter ("size", 'i', omitable = true);
parameter -> SetGuidance ("Screen size of text in pixels.");
@@ -368,7 +367,7 @@ G4VisCommandSceneAddDate::G4VisCommandSceneAddDate () {
fpCommand -> SetParameter (parameter);
parameter = new G4UIparameter ("x-position", 'd', omitable = true);
parameter -> SetGuidance ("x screen position in range -1 < x < 1.");
parameter -> SetDefaultValue (0.0); // Would prefer 0.95 right.
parameter -> SetDefaultValue (0.95);
fpCommand -> SetParameter (parameter);
parameter = new G4UIparameter ("y-position", 'd', omitable = true);
parameter -> SetGuidance ("y screen position in range -1 < y < 1.");
@@ -376,13 +375,9 @@ G4VisCommandSceneAddDate::G4VisCommandSceneAddDate () {
fpCommand -> SetParameter (parameter);
parameter = new G4UIparameter ("layout", 's', omitable = true);
parameter -> SetGuidance ("Layout, i.e., adjustment: left|centre|right.");
parameter -> SetDefaultValue ("left"); // Would prefer right.
parameter -> SetDefaultValue ("right");
fpCommand -> SetParameter (parameter);
parameter = new G4UIparameter ("date", 's', omitable = true);
parameter -> SetGuidance
("The date you want to appear on the view of the scene (this includes the"
"\nrest of the line, including spaces). The default, \'-\', writes the"
"\ndate and time of the moment of drawing.");
parameter -> SetDefaultValue ("-");
fpCommand -> SetParameter (parameter);
}
@@ -720,120 +715,6 @@ void G4VisCommandSceneAddFrame::Frame::operator()
sceneHandler.EndPrimitives2D();
}
////////////// /vis/scene/add/ghosts ///////////////////////////////////////
G4VisCommandSceneAddGhosts::G4VisCommandSceneAddGhosts () {
G4bool omitable;
fpCommand = new G4UIcmdWithAString ("/vis/scene/add/ghosts", this);
fpCommand -> SetGuidance
("Adds ghost volumes (G4FlavoredParallelWorld) to the current scene.");
fpCommand -> SetGuidance ("Selects by particle.");
fpCommand -> SetParameterName ("particle", omitable = true);
fpCommand -> SetDefaultValue ("all");
}
G4VisCommandSceneAddGhosts::~G4VisCommandSceneAddGhosts () {
delete fpCommand;
}
G4String G4VisCommandSceneAddGhosts::GetCurrentValue (G4UIcommand*) {
return "";
}
void G4VisCommandSceneAddGhosts::SetNewValue(G4UIcommand*, G4String newValue) {
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
G4bool warn(verbosity >= G4VisManager::warnings);
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cout << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
const G4String& currentSceneName = pScene -> GetName ();
// Gets the G4GlobalFastSimulationManager pointer if any.
G4VGlobalFastSimulationManager* theGlobalFastSimulationManager;
if(!(theGlobalFastSimulationManager =
G4VGlobalFastSimulationManager::GetConcreteInstance ())){
if (verbosity >= G4VisManager::errors) {
G4cout << "ERROR: no G4GlobalFastSimulationManager" << G4endl;
}
return;
}
// Gets the G4ParticleTable pointer.
G4ParticleTable* theParticleTable=G4ParticleTable::GetParticleTable();
// If "all" (the default) loops on all known particles
if(newValue=="all")
{
G4VFlavoredParallelWorld* CurrentFlavoredWorld = 0;
G4bool successful = false;
for (G4int iParticle=0; iParticle<theParticleTable->entries();
iParticle++)
{
CurrentFlavoredWorld = theGlobalFastSimulationManager->
GetFlavoredWorldForThis(theParticleTable->GetParticle(iParticle));
if(CurrentFlavoredWorld)
successful = successful || pScene ->
AddRunDurationModel(new G4FlavoredParallelWorldModel
(CurrentFlavoredWorld), warn);
}
if (successful)
{
if (verbosity >= G4VisManager::confirmations)
G4cout << "Ghosts have been added to scene \""
<< currentSceneName << "\"."
<< G4endl;
UpdateVisManagerScene (currentSceneName);
}
else
{
G4cout << "ERROR: There are no ghosts."<<G4endl;
G4VisCommandsSceneAddUnsuccessful(verbosity);
}
return;
}
// Given a particle name looks just for the concerned Ghosts, if any.
G4ParticleDefinition* currentParticle =
theParticleTable->FindParticle(newValue);
if (currentParticle == NULL)
{
if (verbosity >= G4VisManager::errors)
G4cout << "ERROR: \"" << newValue
<< "\": not found this particle name!" << G4endl;
return;
}
G4VFlavoredParallelWorld* worldForThis =
theGlobalFastSimulationManager->GetFlavoredWorldForThis(currentParticle);
if(worldForThis)
{
G4bool successful = pScene -> AddRunDurationModel
(new G4FlavoredParallelWorldModel (worldForThis), warn);
if (successful) {
if (verbosity >= G4VisManager::confirmations)
G4cout << "Ghosts have been added to scene \""
<< currentSceneName << "\"."
<< G4endl;
UpdateVisManagerScene (currentSceneName);
}
}
else
if (verbosity >= G4VisManager::errors)
{
G4cout << "ERROR: There are no ghosts for \""<<newValue<<"\""<<G4endl;
G4VisCommandsSceneAddUnsuccessful(verbosity);
}
}
////////////// /vis/scene/add/hits ///////////////////////////////////////
G4VisCommandSceneAddHits::G4VisCommandSceneAddHits () {
@@ -1192,21 +1073,23 @@ G4VisCommandSceneAddLogo::G4VisCommandSceneAddLogo () {
G4bool omitable;
fpCommand = new G4UIcommand ("/vis/scene/add/logo", this);
fpCommand -> SetGuidance ("Adds a G4 logo to the current scene.");
fpCommand -> SetGuidance
("If \"unit\" is \"auto\", height is roughly one tenth of scene extent.");
fpCommand -> SetGuidance
("\"direction\" is that of outward-facing normal to front face of logo."
"\nIf \"direction\" is \"auto\", logo faces the user in the current viewer.");
fpCommand -> SetGuidance
("\nIf \"placement\" is \"auto\", logo is placed at bottom right of screen"
"\n when viewed from logo direction.");
G4UIparameter* parameter;
parameter = new G4UIparameter ("height", 'd', omitable = true);
parameter->SetDefaultValue (1.);
fpCommand->SetParameter (parameter);
parameter = new G4UIparameter ("unit", 's', omitable = true);
parameter->SetGuidance
("auto or valid length unit - defaults to auto."
"\nIf auto, height is roughly one tenth of scene extent.");
parameter->SetDefaultValue ("auto");
fpCommand->SetParameter (parameter);
parameter = new G4UIparameter ("direction", 's', omitable = true);
parameter->SetGuidance
("auto|[-]x|[-]y|[-]z - defaults to auto."
"\nDirection of outward-facing normal to front face of logo."
"\nIf automatic, logo faces the user in the current viewer.");
parameter->SetGuidance ("auto|[-]x|[-]y|[-]z");
parameter->SetDefaultValue ("auto");
fpCommand->SetParameter (parameter);
parameter = new G4UIparameter ("red", 'd', omitable = true);
@@ -1218,13 +1101,7 @@ G4VisCommandSceneAddLogo::G4VisCommandSceneAddLogo () {
parameter = new G4UIparameter ("blue", 'd', omitable = true);
parameter->SetDefaultValue (0.);
fpCommand->SetParameter (parameter);
parameter = new G4UIparameter ("auto|manual", 's', omitable = true);
parameter->SetGuidance
("Automatic placement or manual placement at (xmid,ymid,zmid).");
parameter->SetGuidance
("If automatic, placed at bottom right of screen when viewed from");
parameter->SetGuidance
("logo direction.");
parameter = new G4UIparameter ("placement", 's', omitable = true);
parameter -> SetParameterCandidates("auto manual");
parameter->SetDefaultValue ("auto");
fpCommand->SetParameter (parameter);
@@ -1484,7 +1361,6 @@ void G4VisCommandSceneAddLogo::SetNewValue (G4UIcommand*, G4String newValue) {
G4VisCommandSceneAddLogo::G4Logo::G4Logo
(G4double height, const G4VisAttributes& visAtts):
fHeight(height),
fVisAtts(visAtts)
{
const G4double& h = height;
@@ -1648,6 +1524,71 @@ void G4VisCommandSceneAddLogo2D::Logo2D::operator()
sceneHandler.EndPrimitives2D();
}
////////////// /vis/scene/add/magneticField ///////////////////////////////////////
G4VisCommandSceneAddMagneticField::G4VisCommandSceneAddMagneticField () {
G4bool ommitable;
fpCommand = new G4UIcmdWithAnInteger ("/vis/scene/add/magneticField", this);
fpCommand->SetParameterName("nDataPointsPerHalfScene",ommitable=true);
fpCommand->SetDefaultValue(10);
fpCommand -> SetGuidance
("Adds magnetic field representation to current scene.");
fpCommand -> SetGuidance
("The parameter is no. of data points per half scene. So, possibly, at"
"\nmaximum, the number of data points sampled is (2*n+1)^3, which can grow"
"\nlarge--be warned!"
"\nYou might find that your scene is cluttered by thousands of arrows for"
"\nthe default number of data points, so try reducing to 2 or 3, e.g:"
"\n /vis/scene/add/magneticField 3"
"\nor, if only a small part of the scene has a field:"
"\n /vis/scene/add/magneticField 50 # or more");
fpCommand -> SetGuidance
("In the arrow representation, the length of the arrow is proporational"
"\nto the magnitude of the field and the colour is mapped onto the range"
"\nas a fraction of the maximum magnitude: 0->0.5->1 is blue->green->red.");
}
G4VisCommandSceneAddMagneticField::~G4VisCommandSceneAddMagneticField () {
delete fpCommand;
}
G4String G4VisCommandSceneAddMagneticField::GetCurrentValue (G4UIcommand*) {
return "";
}
void G4VisCommandSceneAddMagneticField::SetNewValue
(G4UIcommand*, G4String newValue) {
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
G4bool warn(verbosity >= G4VisManager::warnings);
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cout << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
G4int nDataPointsPerHalfScene = fpCommand->GetNewIntValue(newValue);
G4MagneticFieldModel* model =
new G4MagneticFieldModel(nDataPointsPerHalfScene);
const G4String& currentSceneName = pScene -> GetName ();
G4bool successful = pScene -> AddRunDurationModel (model, warn);
if (successful) {
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Magnetic field, if any, will be drawn in scene \""
<< currentSceneName
<< "\"\n with "
<< nDataPointsPerHalfScene << " data points per half scene."
<< G4endl;
}
}
else G4VisCommandsSceneAddUnsuccessful(verbosity);
UpdateVisManagerScene (currentSceneName);
}
////////////// /vis/scene/add/psHits ///////////////////////////////////////
G4VisCommandSceneAddPSHits::G4VisCommandSceneAddPSHits () {
@@ -1711,23 +1652,25 @@ void G4VisCommandSceneAddPSHits::SetNewValue
G4VisCommandSceneAddScale::G4VisCommandSceneAddScale () {
G4bool omitable;
fpCommand = new G4UIcommand ("/vis/scene/add/scale", this);
fpCommand -> SetGuidance
("Adds an annotated scale line to the current scene.");
fpCommand -> SetGuidance
("Adds an annotated scale line to the current scene.");
fpCommand -> SetGuidance
("If \"unit\" is \"auto\", length is roughly one tenth of the scene extent.");
fpCommand -> SetGuidance
("If \"direction\" is \"auto\", scale is roughly in the plane of the current view.");
fpCommand -> SetGuidance
("If \"placement\" is \"auto\", scale is placed at bottom left of current view."
"\n Otherwise placed at (xmid,ymid,zmid).");
fpCommand -> SetGuidance (G4Scale::GetGuidanceString());
G4UIparameter* parameter;
parameter = new G4UIparameter ("length", 'd', omitable = true);
parameter->SetDefaultValue (1.);
fpCommand->SetParameter (parameter);
parameter = new G4UIparameter ("unit", 's', omitable = true);
parameter->SetGuidance
("auto or valid length unit - defaults to auto."
"\nIf auto, length is roughly one tenth of the scene extent.");
parameter->SetDefaultValue ("auto");
fpCommand->SetParameter (parameter);
parameter = new G4UIparameter ("direction", 's', omitable = true);
parameter->SetGuidance
("auto|x|y|z - defaults to auto."
"\nIf auto, scale is roughly in the plane of the current view.");
parameter->SetGuidance ("auto|x|y|z");
parameter->SetDefaultValue ("auto");
fpCommand->SetParameter (parameter);
parameter = new G4UIparameter ("red", 'd', omitable = true);
@@ -1739,10 +1682,7 @@ G4VisCommandSceneAddScale::G4VisCommandSceneAddScale () {
parameter = new G4UIparameter ("blue", 'd', omitable = true);
parameter->SetDefaultValue (0.);
fpCommand->SetParameter (parameter);
parameter = new G4UIparameter ("auto|manual", 's', omitable = true);
parameter->SetGuidance
("Automatic placement or manual placement at (xmid,ymid,zmid)."
"\nIf automatic, scale is placed at bottom left of current view.");
parameter = new G4UIparameter ("placement", 's', omitable = true);
parameter -> SetParameterCandidates("auto manual");
parameter->SetDefaultValue ("auto");
fpCommand->SetParameter (parameter);
@@ -2086,15 +2026,12 @@ G4VisCommandSceneAddText::G4VisCommandSceneAddText () {
G4UIparameter* parameter;
parameter = new G4UIparameter ("x", 'd', omitable = true);
parameter->SetDefaultValue (0);
parameter->SetGuidance ("x");
fpCommand->SetParameter (parameter);
parameter = new G4UIparameter ("y", 'd', omitable = true);
parameter->SetDefaultValue (0);
parameter->SetGuidance ("y");
fpCommand->SetParameter (parameter);
parameter = new G4UIparameter ("z", 'd', omitable = true);
parameter->SetDefaultValue (0);
parameter->SetGuidance ("z");
fpCommand->SetParameter (parameter);
parameter = new G4UIparameter ("unit", 's', omitable = true);
parameter->SetDefaultValue ("m");
@@ -2185,11 +2122,9 @@ G4VisCommandSceneAddText2D::G4VisCommandSceneAddText2D () {
G4UIparameter* parameter;
parameter = new G4UIparameter ("x", 'd', omitable = true);
parameter->SetDefaultValue (0);
parameter->SetGuidance ("x");
fpCommand->SetParameter (parameter);
parameter = new G4UIparameter ("y", 'd', omitable = true);
parameter->SetDefaultValue (0);
parameter->SetGuidance ("y");
fpCommand->SetParameter (parameter);
parameter = new G4UIparameter ("font_size", 'd', omitable = true);
parameter->SetDefaultValue (12);
@@ -2330,55 +2265,34 @@ void G4VisCommandSceneAddTrajectories::SetNewValue (G4UIcommand*,
return;
}
G4bool smooth = false, rich = false;
G4bool smooth = false;
G4bool rich = false;
if (newValue.find("smooth") != std::string::npos) smooth = true;
if (newValue.find("rich") != std::string::npos) rich = true;
if (newValue.size() && !(rich || smooth)) {
if (verbosity >= G4VisManager::errors) {
G4cout << "ERROR: Unrecognised parameter \"" << newValue << "\""
"\n No action taken."
<< G4endl;
}
return;
}
G4UImanager* UImanager = G4UImanager::GetUIpointer();
G4int keepVerbose = UImanager->GetVerboseLevel();
G4int newVerbose = 2;
UImanager->SetVerboseLevel(newVerbose);
G4PropagatorInField* propagatorInField =
G4TransportationManager::GetTransportationManager()->
GetPropagatorInField();
propagatorInField->SetTrajectoryFilter(0); // Switch off smooth trajectories.
static G4IdentityTrajectoryFilter auxiliaryPointsFilter;
G4String defaultTrajectoryType;
G4bool i_mode_found = false;
G4int i_mode = 0;
if (smooth && rich) {
UImanager->ApplyCommand("/tracking/storeTrajectory 3");
propagatorInField->SetTrajectoryFilter(&auxiliaryPointsFilter);
UImanager->ApplyCommand("/tracking/storeTrajectory 4");
defaultTrajectoryType = "G4RichTrajectory configured for smooth steps";
} else if (smooth) {
UImanager->ApplyCommand("/tracking/storeTrajectory 2");
propagatorInField->SetTrajectoryFilter(&auxiliaryPointsFilter);
defaultTrajectoryType = "G4SmoothTrajectory";
} else if (rich) {
UImanager->ApplyCommand("/tracking/storeTrajectory 3");
defaultTrajectoryType = "G4RichTrajectory";
} else {
if (!newValue.empty()) {
std::istringstream iss(newValue);
iss >> i_mode;
if (iss) {
i_mode_found = true;
if (verbosity >= G4VisManager::warnings) {
G4cout <<
"WARNING: Integer parameter " << i_mode << " found."
"\n DEPRECATED - its use in this command will be removed at a future major"
"\n release. Use \"/vis/modeling/trajectories\" commands."
<< G4endl;
}
} else {
if (verbosity >= G4VisManager::errors) {
G4cout << "ERROR: Unrecognised parameter \"" << newValue << "\""
"\n No action taken."
<< G4endl;
}
return;
}
}
UImanager->ApplyCommand("/tracking/storeTrajectory 1");
defaultTrajectoryType = "G4Trajectory";
}
@@ -2403,12 +2317,7 @@ void G4VisCommandSceneAddTrajectories::SetNewValue (G4UIcommand*,
}
}
G4TrajectoriesModel* model = 0;
if (i_mode_found) {
model = new G4TrajectoriesModel(i_mode);
} else {
model = new G4TrajectoriesModel();
}
G4TrajectoriesModel* model = new G4TrajectoriesModel();
const G4String& currentSceneName = pScene -> GetName ();
pScene -> AddEndOfEventModel (model, warn);
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VisCommandsSceneHandler.cc 70646 2013-06-03 15:07:58Z gcosmo $
// /vis/sceneHandler commands - John Allison 10th October 1998
@@ -234,7 +234,7 @@ void G4VisCommandSceneHandlerCreate::SetNewValue (G4UIcommand*,
}
}
if (iGS < 0 || iGS >= nSystems) {
// Invalid command line argument or non.
// Invalid command line argument or none.
// This shouldn't happen!!!!!!
if (verbosity >= G4VisManager::errors) {
G4cout << "ERROR: G4VisCommandSceneHandlerCreate::SetNewValue:"
@@ -25,7 +25,6 @@
//
//
// $Id: G4VisCommands.cc,v 1.24 2009-03-09 12:42:00 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// /vis/set - John Allison 21st March 2012
// Set quantities for use in appropriate future commands.
@@ -280,7 +279,9 @@ G4VisCommandSetTouchable::G4VisCommandSetTouchable ()
fpCommand->SetGuidance
("Please provide a list of space-separated physical volume names and"
"\ncopy number pairs starting at the world volume, e.g:"
"\n/vis/set/touchable World 0 Envelope 0 Shape1 0");
"\n /vis/set/touchable World 0 Envelope 0 Shape1 0"
"\n(To get list of touchables, use \"/vis/drawTree\")"
"\n(To save, use \"/vis/viewer/save\")");
parameter = new G4UIparameter ("list", 's', omitable = false);
parameter->SetGuidance
("List of physical volume names and copy number pairs");
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VisCommandsTouchableSet.cc 76285 2013-11-08 13:01:44Z gcosmo $
// /vis/touchable/set commands - John Allison 8th October 2012
@@ -51,11 +51,11 @@ G4VisCommandsTouchableSet::G4VisCommandsTouchableSet()
fpCommandSetColour->SetGuidance("Set colour of current touchable.");
fpCommandSetColour->SetGuidance
("Use \"/vis/set/touchable\" to set current touchable.");
fpCommandSetColour->SetGuidance
("If \"red\" is a string understood by the vis system it will be taken."
"\n Otherwise the values of \red\", \"green\", etc., are used.");
parameter = new G4UIparameter("red", 's', omitable = true);
parameter->SetDefaultValue("1.");
parameter->SetGuidance
("Red component or a string, e.g., \"blue\", in which case succeeding colour"
"\ncomponents are ignored.");
fpCommandSetColour->SetParameter(parameter);
parameter = new G4UIparameter("green", 'd', omitable = true);
parameter->SetDefaultValue(1.);
@@ -79,8 +79,7 @@ G4VisCommandsTouchableSet::G4VisCommandsTouchableSet()
fpCommandSetForceAuxEdgeVisible = new G4UIcmdWithABool
("/vis/touchable/set/forceAuxEdgeVisible", this);
fpCommandSetForceAuxEdgeVisible->SetGuidance
("Force auxiliary (soft) edges of current touchable to be visible:"
" true/false.");
("Force auxiliary (soft) edges of current touchable to be visible: true/false.");
fpCommandSetForceAuxEdgeVisible->SetGuidance
("Use \"/vis/set/touchable\" to set current touchable.");
fpCommandSetForceAuxEdgeVisible->SetParameterName("forceAuxEdgeVisible", omitable = true);
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VisCommandsViewer.cc 77246 2013-11-22 10:01:21Z gcosmo $
// /vis/viewer commands - John Allison 25th October 1998
@@ -1394,7 +1394,16 @@ void G4VisCommandViewerSave::SetNewValue (G4UIcommand*, G4String newValue) {
}
}
const G4ViewParameters& vp = currentViewer->GetViewParameters();
G4ViewParameters vp = currentViewer->GetViewParameters();
// Concatenate any private vis attributes modifiers...
const std::vector<G4ModelingParameters::VisAttributesModifier>*
privateVAMs = currentViewer->GetPrivateVisAttributesModifiers();
if (privateVAMs) {
std::vector<G4ModelingParameters::VisAttributesModifier>::const_iterator i;
for (i = privateVAMs->begin(); i != privateVAMs->end(); ++i) {
vp.AddVisAttributesModifier(*i);
}
}
const G4Point3D& stp = currentScene->GetStandardTargetPoint();
if (newValue == "G4cout") {
@@ -25,7 +25,6 @@
//
//
// $Id: G4VisCommandsDefault.cc,v 1.4 2007-01-05 16:29:38 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// /vis/default commands - John Allison 30th October 2011
@@ -115,6 +114,7 @@ G4VisCommandViewerDefaultStyle::G4VisCommandViewerDefaultStyle()
fpCommand->SetGuidance
("(Default hidden line drawing is controlled by \"/vis/viewer/default/hiddenEdge\".)");
fpCommand->SetParameterName ("style",omitable = false);
fpCommand->SetCandidates("w wireframe s surface");
}
G4VisCommandViewerDefaultStyle::~G4VisCommandViewerDefaultStyle()
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VisCommandsViewerSet.cc 76477 2013-11-11 10:39:56Z gcosmo $
// /vis/viewer/set commands - John Allison 16th May 2000
@@ -308,7 +308,8 @@ G4VisCommandsViewerSet::G4VisCommandsViewerSet ():
fpCommandProjection = new G4UIcommand("/vis/viewer/set/projection",this);
fpCommandProjection->SetGuidance
("Orthogonal or perspective projection.");
("Set projection style - o[rthogonal] or p[erspective]."
"\nIf p[erspective], also set field half angle.");
parameter = new G4UIparameter("projection",'s',omitable = true);
parameter->SetParameterCandidates("o orthogonal p perspective");
parameter->SetDefaultValue("orthogonal");
@@ -378,6 +379,7 @@ G4VisCommandsViewerSet::G4VisCommandsViewerSet ():
fpCommandStyle->SetGuidance
("(Hidden line drawing is controlled by \"/vis/viewer/set/hiddenEdge\".)");
fpCommandStyle->SetParameterName ("style",omitable = false);
fpCommandStyle->SetCandidates("w wireframe s surface");
fpCommandTargetPoint = new G4UIcmdWith3VectorAndUnit
("/vis/viewer/set/targetPoint", this);
@@ -532,6 +534,15 @@ void G4VisCommandsViewerSet::SetNewValue
currentViewer->GetViewParameters().IsAutoRefresh();
vp = fromViewer->GetViewParameters();
vp.SetAutoRefresh(currentAutoRefresh);
// Concatenate any private vis attributes modifiers...
const std::vector<G4ModelingParameters::VisAttributesModifier>*
privateVAMs = fromViewer->GetPrivateVisAttributesModifiers();
if (privateVAMs) {
std::vector<G4ModelingParameters::VisAttributesModifier>::const_iterator i;
for (i = privateVAMs->begin(); i != privateVAMs->end(); ++i) {
vp.AddVisAttributesModifier(*i);
}
}
if (verbosity >= G4VisManager::confirmations) {
G4cout << "View parameters of viewer \"" << currentViewer->GetName()
<< "\"\n set to those of viewer \"" << fromViewer->GetName()
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VisFeaturesOfDAWNFILE.cc 66373 2012-12-18 09:41:34Z gcosmo $
//
#include "G4VisFeaturesOfDAWNFILE.hh"
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VisFeaturesOfFukuiRenderer.cc 66373 2012-12-18 09:41:34Z gcosmo $
//
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VisFeaturesOfOpenGL.cc 66373 2012-12-18 09:41:34Z gcosmo $
//
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VisFeaturesOfOpenInventor.cc 66373 2012-12-18 09:41:34Z gcosmo $
//
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4VisManager.cc 77479 2013-11-25 10:01:22Z gcosmo $
//
//
// GEANT4 Visualization Manager - John Allison 02/Jan/1996.
@@ -56,7 +56,6 @@
#include "G4RotationMatrix.hh"
#include "G4Polyline.hh"
#include "G4Polyhedron.hh"
#include "G4NURBS.hh"
#include "G4NullModel.hh"
#include "G4ModelingParameters.hh"
#include "G4TransportationManager.hh"
@@ -77,6 +76,11 @@
#include <vector>
#include <sstream>
#ifdef G4MULTITHREADED
#include "G4Threading.hh"
#include "G4AutoLock.hh"
#endif
G4VisManager* G4VisManager::fpInstance = 0;
G4VisManager::Verbosity G4VisManager::fVerbosity = G4VisManager::warnings;
@@ -92,12 +96,14 @@ G4VisManager::G4VisManager (const G4String& verbosityString):
fEventRefreshing (false),
fTransientsDrawnThisRun (false),
fTransientsDrawnThisEvent (false),
fNKeepRequests (0),
fEventKeepingSuspended (false),
fKeptLastEvent (false),
fpRequestedEvent (0),
fpRequestedEvent (0),
fAbortReviewKeptEvents (false),
fIsDrawGroup (false),
fDrawGroupNestingDepth (0)
fDrawGroupNestingDepth (0),
fIgnoreStateChanges (false)
// All other objects use default constructors.
{
fpTrajDrawModelMgr = new G4VisModelManager<G4VTrajectoryModel>("/vis/modeling/trajectories");
@@ -169,8 +175,8 @@ G4VisManager::G4VisManager (const G4String& verbosityString):
// ...
// Make top level command directory...
G4UIcommand* directory;
directory = new G4UIdirectory ("/vis/");
// Vis commands should *not* be broadcast to threads (2nd argument).
G4UIcommand* directory = new G4UIdirectory ("/vis/",false);
directory -> SetGuidance ("Visualization commands.");
fDirectoryList.push_back (directory);
@@ -411,13 +417,13 @@ void G4VisManager::RegisterMessengers () {
RegisterMessenger(new G4VisCommandSceneAddDigis);
RegisterMessenger(new G4VisCommandSceneAddEventID);
RegisterMessenger(new G4VisCommandSceneAddFrame);
RegisterMessenger(new G4VisCommandSceneAddGhosts);
RegisterMessenger(new G4VisCommandSceneAddHits);
RegisterMessenger(new G4VisCommandSceneAddLine);
RegisterMessenger(new G4VisCommandSceneAddLine2D);
RegisterMessenger(new G4VisCommandSceneAddLogicalVolume);
RegisterMessenger(new G4VisCommandSceneAddLogo);
RegisterMessenger(new G4VisCommandSceneAddLogo2D);
RegisterMessenger(new G4VisCommandSceneAddMagneticField);
RegisterMessenger(new G4VisCommandSceneAddPSHits);
RegisterMessenger(new G4VisCommandSceneAddScale);
RegisterMessenger(new G4VisCommandSceneAddText);
@@ -436,6 +442,7 @@ void G4VisManager::RegisterMessengers () {
directory = new G4UIdirectory ("/vis/touchable/");
directory -> SetGuidance ("Operations on touchables.");
fDirectoryList.push_back (directory);
directory = new G4UIdirectory ("/vis/touchable/set/");
directory -> SetGuidance ("Set vis attributes of current touchable.");
fDirectoryList.push_back (directory);
@@ -503,6 +510,7 @@ void G4VisManager::RegisterMessengers () {
void G4VisManager::Enable() {
if (IsValidView ()) {
SetConcreteInstance(this);
if (fVerbosity >= confirmations) {
G4cout << "G4VisManager::Enable: visualization enabled." << G4endl;
}
@@ -647,6 +655,9 @@ void G4VisManager::SelectTrajectoryModel(const G4String& model)
void G4VisManager::BeginDraw (const G4Transform3D& objectTransform)
{
#ifdef G4MULTITHREADED
if (G4Threading::IsWorkerThread()) return;
#endif
fDrawGroupNestingDepth++;
if (fDrawGroupNestingDepth > 1) {
G4Exception
@@ -665,6 +676,9 @@ void G4VisManager::BeginDraw (const G4Transform3D& objectTransform)
void G4VisManager::EndDraw ()
{
#ifdef G4MULTITHREADED
if (G4Threading::IsWorkerThread()) return;
#endif
fDrawGroupNestingDepth--;
if (fDrawGroupNestingDepth != 0) {
if (fDrawGroupNestingDepth < 0) fDrawGroupNestingDepth = 0;
@@ -678,6 +692,9 @@ void G4VisManager::EndDraw ()
void G4VisManager::BeginDraw2D (const G4Transform3D& objectTransform)
{
#ifdef G4MULTITHREADED
if (G4Threading::IsWorkerThread()) return;
#endif
fDrawGroupNestingDepth++;
if (fDrawGroupNestingDepth > 1) {
G4Exception
@@ -696,6 +713,9 @@ void G4VisManager::BeginDraw2D (const G4Transform3D& objectTransform)
void G4VisManager::EndDraw2D ()
{
#ifdef G4MULTITHREADED
if (G4Threading::IsWorkerThread()) return;
#endif
fDrawGroupNestingDepth--;
if (fDrawGroupNestingDepth != 0) {
if (fDrawGroupNestingDepth < 0) fDrawGroupNestingDepth = 0;
@@ -709,6 +729,9 @@ void G4VisManager::EndDraw2D ()
template <class T> void G4VisManager::DrawT
(const T& graphics_primitive, const G4Transform3D& objectTransform) {
#ifdef G4MULTITHREADED
if (G4Threading::IsWorkerThread()) return;
#endif
if (fIsDrawGroup) {
if (objectTransform != fpSceneHandler->GetObjectTransformation()) {
G4Exception
@@ -729,6 +752,9 @@ template <class T> void G4VisManager::DrawT
template <class T> void G4VisManager::DrawT2D
(const T& graphics_primitive, const G4Transform3D& objectTransform) {
#ifdef G4MULTITHREADED
if (G4Threading::IsWorkerThread()) return;
#endif
if (fIsDrawGroup) {
if (objectTransform != fpSceneHandler->GetObjectTransformation()) {
G4Exception
@@ -753,12 +779,6 @@ void G4VisManager::Draw (const G4Circle& circle,
DrawT (circle, objectTransform);
}
void G4VisManager::Draw (const G4NURBS& nurbs,
const G4Transform3D& objectTransform)
{
DrawT (nurbs, objectTransform);
}
void G4VisManager::Draw (const G4Polyhedron& polyhedron,
const G4Transform3D& objectTransform)
{
@@ -801,12 +821,6 @@ void G4VisManager::Draw2D (const G4Circle& circle,
DrawT2D (circle, objectTransform);
}
void G4VisManager::Draw2D (const G4NURBS& nurbs,
const G4Transform3D& objectTransform)
{
DrawT2D (nurbs, objectTransform);
}
void G4VisManager::Draw2D (const G4Polyhedron& polyhedron,
const G4Transform3D& objectTransform)
{
@@ -838,6 +852,9 @@ void G4VisManager::Draw2D (const G4Text& text,
}
void G4VisManager::Draw (const G4VHit& hit) {
#ifdef G4MULTITHREADED
if (G4Threading::IsWorkerThread()) return;
#endif
if (fIsDrawGroup) {
fpSceneHandler -> AddCompound (hit);
} else {
@@ -849,6 +866,9 @@ void G4VisManager::Draw (const G4VHit& hit) {
}
void G4VisManager::Draw (const G4VDigi& digi) {
#ifdef G4MULTITHREADED
if (G4Threading::IsWorkerThread()) return;
#endif
if (fIsDrawGroup) {
fpSceneHandler -> AddCompound (digi);
} else {
@@ -859,17 +879,17 @@ void G4VisManager::Draw (const G4VDigi& digi) {
}
}
void G4VisManager::Draw (const G4VTrajectory& traj,
G4int i_mode) {
void G4VisManager::Draw (const G4VTrajectory& traj) {
#ifdef G4MULTITHREADED
if (G4Threading::IsWorkerThread()) return;
#endif
if (fIsDrawGroup) {
fpSceneHandler -> SetModel (&dummyTrajectoriesModel);
dummyTrajectoriesModel.SetDrawingMode(i_mode);
fpSceneHandler -> AddCompound (traj);
} else {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
fpSceneHandler -> SetModel (&dummyTrajectoriesModel);
dummyTrajectoriesModel.SetDrawingMode(i_mode);
fpSceneHandler -> AddCompound (traj);
}
}
@@ -878,6 +898,9 @@ void G4VisManager::Draw (const G4VTrajectory& traj,
void G4VisManager::Draw (const G4LogicalVolume& logicalVol,
const G4VisAttributes& attribs,
const G4Transform3D& objectTransform) {
#ifdef G4MULTITHREADED
if (G4Threading::IsWorkerThread()) return;
#endif
// Find corresponding solid.
G4VSolid* pSol = logicalVol.GetSolid ();
Draw (*pSol, attribs, objectTransform);
@@ -886,6 +909,9 @@ void G4VisManager::Draw (const G4LogicalVolume& logicalVol,
void G4VisManager::Draw (const G4VSolid& solid,
const G4VisAttributes& attribs,
const G4Transform3D& objectTransform) {
#ifdef G4MULTITHREADED
if (G4Threading::IsWorkerThread()) return;
#endif
if (fIsDrawGroup) {
fpSceneHandler -> PreAddSolid (objectTransform, attribs);
solid.DescribeYourselfTo (*fpSceneHandler);
@@ -904,12 +930,15 @@ void G4VisManager::Draw (const G4VPhysicalVolume& physicalVol,
const G4VisAttributes& attribs,
const G4Transform3D& objectTransform) {
// Find corresponding logical volume and solid.
#ifdef G4MULTITHREADED
if (G4Threading::IsWorkerThread()) return;
#endif
G4LogicalVolume* pLV = physicalVol.GetLogicalVolume ();
G4VSolid* pSol = pLV -> GetSolid ();
Draw (*pSol, attribs, objectTransform);
}
void G4VisManager::CreateSceneHandler (G4String name) {
void G4VisManager::CreateSceneHandler (const G4String& name) {
if (!fInitialised) Initialise ();
if (fpGraphicsSystem) {
G4VSceneHandler* pSceneHandler =
@@ -919,7 +948,7 @@ void G4VisManager::CreateSceneHandler (G4String name) {
fpSceneHandler = pSceneHandler; // Make current.
}
else {
if(fVerbosity >= errors) {
if (fVerbosity >= errors) {
G4cout << "ERROR in G4VisManager::CreateSceneHandler during "
<< fpGraphicsSystem -> GetName ()
<< " scene handler creation.\n No action taken."
@@ -930,7 +959,9 @@ void G4VisManager::CreateSceneHandler (G4String name) {
else PrintInvalidPointers ();
}
void G4VisManager::CreateViewer (G4String name,G4String XGeometry) {
void G4VisManager::CreateViewer
(const G4String& name, const G4String& XGeometry)
{
if (!fInitialised) Initialise ();
@@ -1082,8 +1113,8 @@ void G4VisManager::GeometryHasChanged () {
<< G4endl;
}
}
}
void G4VisManager::NotifyHandlers () {
if (fVerbosity >= confirmations) {
@@ -1113,7 +1144,6 @@ void G4VisManager::NotifyHandlers () {
<< G4endl;
}
}
}
G4bool G4VisManager::FilterTrajectory(const G4VTrajectory& trajectory)
@@ -1152,43 +1182,8 @@ void G4VisManager::DispatchToModel(const G4VTrajectory& trajectory)
assert (0 != trajectoryModel); // Should exist
trajectoryModel->Draw(trajectory, visible);
}
void G4VisManager::DispatchToModel(const G4VTrajectory& trajectory, G4int i_mode)
{
G4bool visible(true);
// See if trajectory passes filter
G4bool passed = FilterTrajectory(trajectory);
if (!passed) {
// Draw invisible trajectory if trajectory failed filter and
// are filtering in soft mode
if (fpTrajFilterMgr->GetMode() == FilterMode::Soft) visible = false;
else {return;}
}
// Go on to draw trajectory
assert (0 != fpTrajDrawModelMgr);
const G4VTrajectoryModel* trajectoryModel = CurrentTrajDrawModel();
assert (0 != trajectoryModel); // Should exist
if (IsValidView()) {
G4TrajectoriesModel* trajectoriesModel =
dynamic_cast<G4TrajectoriesModel*>(fpSceneHandler->GetModel());
if (trajectoriesModel) {
if (trajectoriesModel->IsDrawingModeSet()) {
trajectoryModel->Draw(trajectory, i_mode, visible);
} else {
trajectoryModel->Draw(trajectory, visible);
}
} else {
// Just draw at user's request
trajectoryModel->Draw(trajectory, i_mode, visible);
}
trajectoryModel->Draw(trajectory, visible);
}
}
@@ -1229,8 +1224,9 @@ void G4VisManager::RegisterEndOfRunUserVisAction
G4VUserVisAction* pVisAction,
const G4VisExtent& extent) {
fEndOfRunUserVisActions.push_back(UserVisAction(name,pVisAction));
fUserVisActionExtents[pVisAction] = extent;
if (extent.GetExtentRadius() <= 0.) {
if (extent.GetExtentRadius() > 0.) {
fUserVisActionExtents[pVisAction] = extent;
} else {
if (fVerbosity >= warnings) {
G4cout <<
"WARNING: No extent set for user vis action \"" << name << "\"."
@@ -1534,9 +1530,23 @@ void G4VisManager::PrintInvalidPointers () const {
}
}
#ifdef G4MULTITHREADED
// Start of multithreaded versions of Begin/EndOfRun/Event.
#include "G4Threading.hh"
#include "G4AutoLock.hh"
namespace {
// G4Mutex visBeginOfRunMutex = G4MUTEX_INITIALIZER;
// G4Mutex visBeginOfEventMutex = G4MUTEX_INITIALIZER;
G4Mutex visEndOfEventMutex = G4MUTEX_INITIALIZER;
// G4Mutex visEndOfRunMutex = G4MUTEX_INITIALIZER;
}
void G4VisManager::BeginOfRun ()
{
//G4cout << "G4VisManager::BeginOfRun" << G4endl;
if (fIgnoreStateChanges) return;
if (G4Threading::IsWorkerThread()) return;
fNKeepRequests = 0;
fKeptLastEvent = false;
fEventKeepingSuspended = false;
fTransientsDrawnThisRun = false;
@@ -1545,6 +1555,230 @@ void G4VisManager::BeginOfRun ()
void G4VisManager::BeginOfEvent ()
{
if (fIgnoreStateChanges) return;
}
void G4VisManager::EndOfEvent ()
{
if (fIgnoreStateChanges) return;
if (!GetConcreteInstance()) return;
// Don't call IsValidView unless there is a scene handler. This
// avoids WARNING message at end of event and run when the user has
// not instantiated a scene handler, e.g., in batch mode.
G4bool valid = fpSceneHandler && IsValidView();
if (!valid) return;
G4AutoLock al(&visEndOfEventMutex);
if (!fEventKeepingSuspended) {
G4EventManager* eventManager = G4EventManager::GetEventManager();
// const G4Event* currentEvent = eventManager->GetConstCurrentEvent();
// if (!currentEvent) return;
// G4RunManager* runManager = G4RunManager::GetRunManager();
// const G4Run* currentRun = runManager->GetCurrentRun();
// if (!currentRun) return;
//
// const std::vector<const G4Event*>*
// eventsFromThreads = currentRun->GetEventVector();
// G4int nKeptEvents = eventsFromThreads ? eventsFromThreads->size() : 0;
G4int maxNumberOfKeptEvents = fpScene->GetMaxNumberOfKeptEvents();
if (maxNumberOfKeptEvents > 0 && fNKeepRequests >= maxNumberOfKeptEvents) {
fEventKeepingSuspended = true;
static G4bool warned = false;
if (!warned) {
if (fVerbosity >= warnings) {
G4cout <<
"WARNING: G4VisManager::EndOfEvent: Automatic event keeping suspended."
"\n The number of events exceeds the maximum, "
<< maxNumberOfKeptEvents <<
", that may be kept by \n the vis manager."
<< G4endl;
}
warned = true;
}
} else if (maxNumberOfKeptEvents != 0) {
// G4cout << "Requesting keeping event " << currentEvent->GetEventID() << G4endl;
eventManager->KeepTheCurrentEvent();
fNKeepRequests++;
}
}
}
void G4VisManager::EndOfRun ()
{
if (fIgnoreStateChanges) return;
if (G4Threading::IsWorkerThread()) return;
// Don't call IsValidView unless there is a scene handler. This
// avoids WARNING message at end of event and run when the user has
// not instantiated a scene handler, e.g., in batch mode.
G4bool valid = fpSceneHandler && IsValidView();
if (!valid) return;
// G4AutoLock al(&visEndOfRunMutex);
G4RunManager* runManager = G4RunManager::GetRunManager();
const G4Run* currentRun = runManager->GetCurrentRun();
if (!currentRun) return;
const std::vector<const G4Event*>*
eventsFromThreads = currentRun->GetEventVector();
G4int nKeptEvents = eventsFromThreads ? eventsFromThreads->size() : 0;
if (nKeptEvents) {
if (fVerbosity >= warnings) {
G4cout << "WARNING: " << nKeptEvents;
if (nKeptEvents == 1) G4cout << " event has";
else G4cout << " events have";
G4cout << " been kept for refreshing and/or reviewing." << G4endl;
if (nKeptEvents != fNKeepRequests) {
G4cout << " (Note: ";
if (fNKeepRequests == 0) {
G4cout << "No keep requests were";
} else if (fNKeepRequests == 1) {
G4cout << "Only 1 keep request was";
} else {
G4cout << "Only " << fNKeepRequests << " keep requests were";
}
G4cout << " made by the vis manager.)" << G4endl;
}
G4cout << " \"/vis/reviewKeptEvents\" to review them." << G4endl;
}
}
if (fEventKeepingSuspended && fVerbosity >= warnings) {
G4cout <<
"WARNING: G4VisManager::EndOfRun: Automatic event keeping was suspended."
"\n The number of events in the run exceeded the maximum, "
<< fpScene->GetMaxNumberOfKeptEvents() <<
", that may be\n kept by the vis manager." <<
"\n The number of events kept by the vis manager can be changed with"
"\n \"/vis/scene/endOfEventAction [accumulate|refresh] <N>\", where N"
"\n is the maximum number you wish to allow. N < 0 means \"unlimited\"."
<< G4endl;
}
if (GetConcreteInstance() && eventsFromThreads) {
std::vector<const G4Event*>::const_iterator i;
if (fpScene->GetRefreshAtEndOfEvent()) {
for (i = eventsFromThreads->begin(); i != eventsFromThreads->end(); ++i) {
if (fVerbosity >= confirmations) {
G4cout << "Drawing event " << (*i)->GetEventID() << G4endl;
}
// We are about to draw the event (trajectories, etc.), but first we
// have to clear the previous event(s) if necessary. If this event
// needs to be drawn afresh, e.g., the first event or any event when
// "accumulate" is not requested, the old event has to be cleared.
// We have postponed this so that, for normal viewers like OGL, the
// previous event(s) stay on screen until this new event comes
// along. For a file-writing viewer the geometry has to be drawn.
// See, for example, G4HepRepFileSceneHandler::ClearTransientStore.
// But, for this stop-gap solution...
// Deactivate end-of-event and end-of-run models...
G4Scene* scene = fpSceneHandler->GetScene();
std::vector<G4Scene::Model>& eoeModels = scene->SetEndOfEventModelList();
std::vector<G4Scene::Model> tmpEoeModels = eoeModels;
std::vector<G4Scene::Model>::iterator iEoe;
for (iEoe = eoeModels.begin(); iEoe != eoeModels.end(); ++iEoe) {
iEoe->fActive = false;
}
std::vector<G4Scene::Model>& eorModels = scene->SetEndOfRunModelList();
std::vector<G4Scene::Model> tmpEorModels = eorModels;
std::vector<G4Scene::Model>::iterator iEor;
for (iEor = eoeModels.begin(); iEor != eoeModels.end(); ++iEor) {
iEor->fActive = false;
}
ClearTransientStoreIfMarked();
// ...and restore...
eoeModels = tmpEoeModels;
eorModels = tmpEorModels;
fTransientsDrawnThisEvent = false;
if (fpSceneHandler) fpSceneHandler->SetTransientsDrawnThisEvent(false);
fpSceneHandler->DrawEvent(*i);
// ShowView guarantees the view comes to the screen. No action
// is taken for passive viewers like OGL*X, but it passes control to
// interactive viewers, such OGL*Xm and allows file-writing
// viewers to close the file.
fpViewer->ShowView();
fpSceneHandler->SetMarkForClearingTransientStore(true);
}
} else { // Accumulate events.
// We are about to draw the event (trajectories, etc.), but first we
// have to clear the previous event(s) if necessary. If this event
// needs to be drawn afresh, e.g., the first event or any event when
// "accumulate" is not requested, the old event has to be cleared.
// We have postponed this so that, for normal viewers like OGL, the
// previous event(s) stay on screen until this new event comes
// along. For a file-writing viewer the geometry has to be drawn.
// See, for example, G4HepRepFileSceneHandler::ClearTransientStore.
// But, for this stop-gap solution...
// Deactivate end-of-event and end-of-run models...
G4Scene* scene = fpSceneHandler->GetScene();
std::vector<G4Scene::Model>& eoeModels = scene->SetEndOfEventModelList();
std::vector<G4Scene::Model> tmpEoeModels = eoeModels;
std::vector<G4Scene::Model>::iterator iEoe;
for (iEoe = eoeModels.begin(); iEoe != eoeModels.end(); ++iEoe) {
iEoe->fActive = false;
}
std::vector<G4Scene::Model>& eorModels = scene->SetEndOfRunModelList();
std::vector<G4Scene::Model> tmpEorModels = eorModels;
std::vector<G4Scene::Model>::iterator iEor;
for (iEor = eoeModels.begin(); iEor != eoeModels.end(); ++iEor) {
iEor->fActive = false;
}
ClearTransientStoreIfMarked();
// ...and restore...
eoeModels = tmpEoeModels;
eorModels = tmpEorModels;
fTransientsDrawnThisEvent = false;
if (fpSceneHandler) fpSceneHandler->SetTransientsDrawnThisEvent(false);
for (i = eventsFromThreads->begin(); i != eventsFromThreads->end(); ++i) {
if (fVerbosity >= confirmations) {
G4cout << "Drawing event " << (*i)->GetEventID() << G4endl;
}
fpSceneHandler->DrawEvent(*i);
}
if (fpScene->GetRefreshAtEndOfRun()) {
fpSceneHandler->DrawEndOfRunModels();
fpViewer->ShowView();
// An extra refresh for auto-refresh viewers
if (fpViewer->GetViewParameters().IsAutoRefresh()) {
fpViewer->RefreshView();
}
fpSceneHandler->SetMarkForClearingTransientStore(true);
}
}
}
}
// End of multithreaded versions of Begin/EndOfRun/Event.
#else
// Start of sequential versions of Begin/EndOfRun/Event.
void G4VisManager::BeginOfRun ()
{
if (fIgnoreStateChanges) return;
//G4cout << "G4VisManager::BeginOfRun" << G4endl;
fNKeepRequests = 0;
fKeptLastEvent = false;
fEventKeepingSuspended = false;
fTransientsDrawnThisRun = false;
if (fpSceneHandler) fpSceneHandler->SetTransientsDrawnThisRun(false);
}
void G4VisManager::BeginOfEvent ()
{
if (fIgnoreStateChanges) return;
//G4cout << "G4VisManager::BeginOfEvent" << G4endl;
fTransientsDrawnThisEvent = false;
if (fpSceneHandler) fpSceneHandler->SetTransientsDrawnThisEvent(false);
@@ -1552,21 +1786,26 @@ void G4VisManager::BeginOfEvent ()
void G4VisManager::EndOfEvent ()
{
//G4cout << "G4VisManager::EndOfEvent" << G4endl;
if (fIgnoreStateChanges) return;
if (!GetConcreteInstance()) return;
// Don't call IsValidView unless there is a scene handler. This
// avoids WARNING message at end of event and run when the user has
// not instantiated a scene handler, e.g., in batch mode.
G4bool valid = GetConcreteInstance() && fpSceneHandler && IsValidView();
G4bool valid = fpSceneHandler && IsValidView();
if (!valid) return;
G4RunManager* runManager = G4RunManager::GetRunManager();
const G4Run* currentRun = runManager->GetCurrentRun();
G4EventManager* eventManager = G4EventManager::GetEventManager();
const G4Event* currentEvent = eventManager->GetConstCurrentEvent();
if (!currentEvent) return;
G4RunManager* runManager = G4RunManager::GetRunManager();
const G4Run* currentRun = runManager->GetCurrentRun();
if (!currentRun) return;
//G4cout << "G4VisManager::EndOfEvent" << G4endl;
// We are about to draw the event (trajectories, etc.), but first we
// have to clear the previous event(s) if necessary. If this event
// needs to be drawn afresh, e.g., the first event or any event when
@@ -1596,14 +1835,16 @@ void G4VisManager::EndOfEvent ()
// Unless last event (in which case wait end of run)...
if (eventID < nEventsToBeProcessed - 1) {
// ShowView guarantees the view comes to the screen. No action
// is taken for normal viewers like OGL, but file-writing
// viewers have to close the file.
// is taken for passive viewers like OGL*X, but it passes control to
// interactive viewers, such OGL*Xm and allows file-writing
// viewers to close the file.
fpViewer->ShowView();
fpSceneHandler->SetMarkForClearingTransientStore(true);
} else { // Last event...
// Keep, but only if user has not kept any...
if (!nKeptEvents) {
eventManager->KeepTheCurrentEvent();
eventManager->KeepTheCurrentEvent();
fNKeepRequests++;
fKeptLastEvent = true;
}
}
@@ -1611,7 +1852,7 @@ void G4VisManager::EndOfEvent ()
} else { // Accumulating events...
G4int maxNumberOfKeptEvents = fpScene->GetMaxNumberOfKeptEvents();
if (maxNumberOfKeptEvents > 0 && nKeptEvents >= maxNumberOfKeptEvents) {
if (maxNumberOfKeptEvents > 0 && fNKeepRequests >= maxNumberOfKeptEvents) {
fEventKeepingSuspended = true;
static G4bool warned = false;
if (!warned) {
@@ -1620,32 +1861,95 @@ void G4VisManager::EndOfEvent ()
"WARNING: G4VisManager::EndOfEvent: Automatic event keeping suspended."
"\n The number of events exceeds the maximum, "
<< maxNumberOfKeptEvents <<
", that can be kept by the vis manager."
", that may be kept by\n the vis manager."
<< G4endl;
}
warned = true;
}
} else if (maxNumberOfKeptEvents != 0) {
eventManager->KeepTheCurrentEvent();
// If not disabled nor suspended.
if (GetConcreteInstance() && !fEventKeepingSuspended) {
// G4cout << "Requesting keeping event " << currentEvent->GetEventID() << G4endl;
eventManager->KeepTheCurrentEvent();
fNKeepRequests++;
}
}
}
}
void G4VisManager::EndOfRun ()
{
if (fIgnoreStateChanges) return;
//G4cout << "G4VisManager::EndOfRun" << G4endl;
G4RunManager* runManager = G4RunManager::GetRunManager();
const G4Run* currentRun = runManager->GetCurrentRun();
G4int nKeptEvents = 0;
const std::vector<const G4Event*>* events =
currentRun? currentRun->GetEventVector(): 0;
if (events) nKeptEvents = events->size();
if (nKeptEvents && !fKeptLastEvent) {
if (fVerbosity >= warnings) {
G4cout << "WARNING: " << nKeptEvents;
if (nKeptEvents == 1) G4cout << " event has";
else G4cout << " events have";
G4cout << " been kept for refreshing and/or reviewing." << G4endl;
if (nKeptEvents != fNKeepRequests) {
G4cout << " (Note: ";
if (fNKeepRequests == 0) {
G4cout << "No keep requests were";
} else if (fNKeepRequests == 1) {
G4cout << "Only 1 keep request was";
} else {
G4cout << "Only " << fNKeepRequests << " keep requests were";
}
G4cout << " made by the vis manager.)" << G4endl;
}
G4cout << " \"/vis/reviewKeptEvents\" to review them." << G4endl;
}
// static G4bool warned = false;
// if (!valid && fVerbosity >= warnings && !warned) {
// G4cout <<
// " Only useful if before starting the run:"
// "\n a) trajectories are stored (\"/vis/scene/add/trajectories [smooth|rich]\"), or"
// "\n b) the Draw method of any hits or digis is implemented."
// "\n To view trajectories, hits or digis:"
// "\n open a viewer, draw a volume, \"/vis/scene/add/trajectories\""
// "\n \"/vis/scene/add/hits\" or \"/vis/scene/add/digitisations\""
// "\n and, possibly, \"/vis/viewer/flush\"."
// "\n To see all events: \"/vis/scene/endOfEventAction accumulate\"."
// "\n To see events individually: \"/vis/reviewKeptEvents\"."
// << G4endl;
// warned = true;
// }
}
if (fEventKeepingSuspended && fVerbosity >= warnings) {
G4cout <<
"WARNING: G4VisManager::EndOfRun: Automatic event keeping was suspended."
"\n The number of events in the run exceeded the maximum, "
<< fpScene->GetMaxNumberOfKeptEvents() <<
", that may be\n kept by the vis manager." <<
"\n The number of events kept by the vis manager can be changed with"
"\n \"/vis/scene/endOfEventAction accumulate <N>\", where N is the"
"\n maximum number you wish to allow. N < 0 means \"unlimited\"."
<< G4endl;
}
// Don't call IsValidView unless there is a scene handler. This
// avoids WARNING message at end of event and run when the user has
// not instantiated a scene handler, e.g., in batch mode.
G4bool valid = GetConcreteInstance() && fpSceneHandler && IsValidView();
if (valid) {
G4bool valid = fpSceneHandler && IsValidView();
if (GetConcreteInstance() && valid) {
if (!fpSceneHandler->GetMarkForClearingTransientStore()) {
if (fpScene->GetRefreshAtEndOfRun()) {
fpSceneHandler->DrawEndOfRunModels();
// ShowView guarantees the view comes to the screen. No
// action is taken for normal viewers like OGL, but
// file-writing viewers have to close the file.
// ShowView guarantees the view comes to the screen. No action
// is taken for passive viewers like OGL*X, but it passes control to
// interactive viewers, such OGL*Xm and allows file-writing
// viewers to close the file.
fpViewer->ShowView();
// An extra refresh for auto-refresh viewers
if (fpViewer->GetViewParameters().IsAutoRefresh()) {
@@ -1654,55 +1958,12 @@ void G4VisManager::EndOfRun ()
fpSceneHandler->SetMarkForClearingTransientStore(true);
}
}
if (fEventKeepingSuspended && fVerbosity >= warnings) {
G4cout <<
"WARNING: G4VisManager::EndOfRun: Automatic event keeping has been suspended."
"\n The number of events in the run exceeded the maximum, "
<< fpScene->GetMaxNumberOfKeptEvents() <<
", that can be kept by the vis manager." <<
"\n The number of events kept by the vis manager can be changed with"
"\n \"/vis/scene/endOfEventAction accumulate <N>\", where N is the"
"\n maximum number you wish to allow. N < 0 means \"unlimited\"."
<< G4endl;
}
}
fEventRefreshing = false;
G4RunManager* runManager = G4RunManager::GetRunManager();
const G4Run* currentRun = runManager->GetCurrentRun();
G4int nKeptEvents = 0;
const std::vector<const G4Event*>* events =
currentRun? currentRun->GetEventVector(): 0;
if (events) nKeptEvents = events->size();
if (nKeptEvents && !fKeptLastEvent) {
if (!valid && fVerbosity >= warnings) G4cout << "WARNING: ";
if (fVerbosity >= warnings) {
G4cout << nKeptEvents;
if (nKeptEvents == 1) G4cout << " event has";
else G4cout << " events have";
G4cout << " been kept for refreshing and/or reviewing." << G4endl;
}
static G4bool warned = false;
if (!valid && fVerbosity >= warnings && !warned) {
G4cout <<
" Only useful if before starting the run:"
"\n a) trajectories are stored (\"/vis/scene/add/trajectories [smooth|rich]\"), or"
"\n b) the Draw method of any hits or digis is implemented."
"\n To view trajectories, hits or digis:"
"\n open a viewer, draw a volume, \"/vis/scene/add/trajectories\""
"\n \"/vis/scene/add/hits\" or \"/vis/scene/add/digitisations\""
"\n and, possibly, \"/vis/viewer/flush\"."
"\n To see all events: \"/vis/scene/endOfEventAction accumulate\"."
"\n To see events individually: \"/vis/reviewKeptEvents\"."
<< G4endl;
warned = true;
}
}
}
#endif // End of sequential versions of Begin/EndOfRun/Event.
void G4VisManager::ClearTransientStoreIfMarked(){
// Assumes valid view.
if (fpSceneHandler->GetMarkForClearingTransientStore()) {
@@ -1931,7 +2192,6 @@ G4bool G4VisManager::IsValidView () {
}
}
}
if (isValid) SetConcreteInstance(this);
return isValid;
}
@@ -1944,3 +2204,15 @@ G4VisManager::RegisterModelFactories()
G4cout<<"class. See G4VisExecutive for an example."<<G4endl;
}
}
#ifdef G4MULTITHREADED
void G4VisManager::SetUpForAThread()
{
new G4VisStateDependent(this);
}
#endif
void G4VisManager::IgnoreStateChanges(G4bool val)
{
fIgnoreStateChanges = val;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VisStateDependent.cc 66373 2012-12-18 09:41:34Z gcosmo $
#include "G4VisStateDependent.hh"