Import Geant4 10.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2017-12-08 12:52:30 +01:00
parent 98e455a940
commit fc6af9e721
2166 changed files with 276760 additions and 100873 deletions
+4 -1
View File
@@ -1,4 +1,4 @@
.$Id: History 104290 2017-05-23 13:24:52Z gcosmo $
.$Id: History 106384 2017-10-09 09:34:51Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -20,6 +20,9 @@ committal in the CVS repository !
History file for visualization/HepRep sub-category
--------------------------------------------------
14th September 2017 John Allison (vis-HepRep-V10-03-01)
- G4HepRepMessenger.cc: Fix Coverity warning.
23rd May 2017 John Allison (vis-HepRep-V10-03-00)
- Fixes for gcc-7.1 warnings.
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4HepRepMessenger.cc 66870 2013-01-14 23:38:59Z adotti $
// $Id: G4HepRepMessenger.cc 106384 2017-10-09 09:34:51Z gcosmo $
//
#include "G4HepRepMessenger.hh"
@@ -46,6 +46,7 @@ G4HepRepMessenger::G4HepRepMessenger() :
scale(1.),
suffix (""),
geometry(true),
pointAttributes(false),
solids(true),
invisibles(true) {
+57 -2
View File
@@ -1,4 +1,4 @@
$Id: History 104015 2017-05-08 07:28:08Z gcosmo $
$Id: History 107329 2017-11-08 16:41:26Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -24,8 +24,63 @@ committal in the CVS repository !
History file for visualization category
---------------------------------------
7th November 2017 John Allison (vis-V10-03-10)
- opengl-V10-03-04: Refine content of output of picking.
29th October 2017 John Allison
- visman-V10-03-16: Protect /vis/enable issued before run established.
6th October 2017 John Allison (vis-V10-03-09)
- Needs greps-V10-03-07.
- visman-V10-03-15:
o Improve end of run printing when /vis/disable.
o Initialise G4Colour colour map.
14th September 2017 John Allison
- vis-HepRep-V10-03-01: Fix Coverity warning.
13th September 2017 John Allison (vis-V10-03-08)
- modeling-V10-03-08 and visman-V10-03-14:
Reverted default number of line segments per circle to 24.
(72 lines per circle gives trouble in the Boolean Processor, so until that
is fixed we revert to 24.)
1st September 2017 Laurent Garnier (vis-V10-03-07)
- opengl-V10-03-03: Add patch affecting repaint for external applications. See bugzilla #1959.
21st June 2017 John Allison (vis-V10-03-06)
- visman-V10-03-13: Implement /vis/drawOnlyKeptEvents.
To draw selected events the user should set this flag, then in a user action:
if ( some criterion ) {
G4EventManager::GetEventManager()->KeepTheCurrentEvent();
}
23rd May 2017 John Allison
- VRML-V10-03-01: Fixes for gcc-7.1 warnings.
- gMocren-V10-03-00: Fixes for gcc-7.1 warnings.
- vis-HepRep-V10-03-00: Fixes for gcc-7.1 warnings.
- opengl-V10-03-02: Hopefully fix gcc-7.1 warnings.
- visexternal-V10-03-00: Fix gcc-7.1 warning.
14th May 2017 John Allison
- modeling-V10-03-07: G4GPSModel: Added user-selectable colour.
- visman-V10-03-12: Add user-selected colour to /vis/scene/add/gps.
12th May 2017 John Allison
- visman-V10-03-11:
o Improved guidance.
o /vis/viewer/save: Add .g4view if an extension us not supplied by the user.
o /vis/viewer/set/defaultTextColour: Changed default to blue and opaque to
agree with default text vis attributes.
11th May 2017 John Allison
- visman-V10-03-10: Fixed Windows compilation isse.
10th May 2017 John Allison
- visman-V10-03-09: Needs greps-V10-03-04. Added G4VVisCommand::ConvertToColour.
7th May 2017 John Allison (vis-V10-03-05)
- visman-V10-03-08: Fix /vis/viewer/interpolate for file wring viewers.
- visman-V10-03-08: Fix /vis/viewer/interpolate for file writing viewers.
- DAWN-V10-03-00:
o Expand filename numbering to 4 digits, e.g., g4_0000.prim, g4_0001.prim,...
o You may need
+8 -1
View File
@@ -1,4 +1,4 @@
$Id: History 104288 2017-05-23 13:23:23Z gcosmo $
$Id: History 107329 2017-11-08 16:41:26Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,13 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
7th November 2017 John Allison (opengl-V10-03-04)
- G4OpenGLViewer.cc, G4OpenGLQtViewer.cc:
o Refine content of output of picking.
1st September 2017 Laurent Garnier (opengl-V10-03-03)
- Add patch affecting repaint for external applications. See bugzilla #1959.
23rd May 2017 John Allison (opengl-V10-03-02)
- Hopefully fix gcc-7.1 warnings.
@@ -1,7 +1,7 @@
/****************************************************************************
** Meta object code from reading C++ file 'G4OpenGLQtExportDialog.hh'
**
** Created: Tue May 23 15:27:06 2017
** Created: Thu Nov 9 12:49:26 2017
** by: The Qt Meta Object Compiler version 63 (Qt 4.8.4)
**
** WARNING! All changes made in this file will be lost!
@@ -1,7 +1,7 @@
/****************************************************************************
** Meta object code from reading C++ file 'G4OpenGLQtMovieDialog.hh'
**
** Created: Tue May 23 15:27:06 2017
** Created: Thu Nov 9 12:49:26 2017
** by: The Qt Meta Object Compiler version 63 (Qt 4.8.4)
**
** WARNING! All changes made in this file will be lost!
@@ -1,7 +1,7 @@
/****************************************************************************
** Meta object code from reading C++ file 'G4OpenGLQtViewer.hh'
**
** Created: Tue May 23 15:27:06 2017
** Created: Thu Nov 9 12:49:27 2017
** by: The Qt Meta Object Compiler version 63 (Qt 4.8.4)
**
** WARNING! All changes made in this file will be lost!
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4OpenGLQtViewer.cc 104288 2017-05-23 13:23:23Z gcosmo $
// $Id: G4OpenGLQtViewer.cc 107329 2017-11-08 16:41:26Z gcosmo $
//
//
// G4OpenGLQtViewer : Class to provide Qt specific
@@ -1298,7 +1298,7 @@ void G4OpenGLQtViewer::G4MouseReleaseEvent(QMouseEvent *evnt)
double factorY = ((double)viewport[3]/fGLWidget->height());
fSpinningDelay = fLastEventTime->elapsed();
QPoint delta = (fLastPos3-fLastPos1)*factorX;
// reset cursor state
fGLWidget->setCursor(QCursor(Qt::ArrowCursor));
@@ -1307,7 +1307,7 @@ void G4OpenGLQtViewer::G4MouseReleaseEvent(QMouseEvent *evnt)
return;
}
updatePickInfosWidget(evnt->pos().x()*factorX,evnt->pos().y()*factorY);
} else if (fSpinningDelay < fLaunchSpinDelay ) {
if ((delta.x() == 0) && (delta.y() == 0)) {
return;
@@ -4452,7 +4452,7 @@ void G4OpenGLQtViewer::updatePickInfosWidget(int aX, int aY) {
createPickInfosWidget();
}
const std::vector < G4OpenGLViewerPickMap* > & pickMap = GetPickDetails(aX,aY);
const std::vector < G4OpenGLViewerPickMap* > & pickMapVector = GetPickDetails(aX,aY);
// remove all previous widgets
if (fPickInfosWidget) {
@@ -4475,64 +4475,76 @@ void G4OpenGLQtViewer::updatePickInfosWidget(int aX, int aY) {
fSignalMapperPicking = new QSignalMapper(this);
// parse all pick results
for (unsigned int a=0; a< pickMap.size(); a++) {
G4int nPickedObjectsWithAttributes = 0;
for (unsigned int a=0; a< pickMapVector.size(); a++) {
const auto& pickMap = pickMapVector[a];
// Add a box inside the pick viewer box
std::ostringstream label;
if (pickMap[a]->getAttributes().size() > 0) {
std::string txt = pickMap[a]->getAttributes()[0].data();
std::ostringstream content;
std::string txt = pickMap->getAttributes()[0].data();
if (pickMapVector[a]->getAttributes().size()) {
++nPickedObjectsWithAttributes;
std::size_t pos1 = txt.find(':');
std::string storeKey = txt.substr(0,pos1);
if (storeKey == "G4PhysicalVolumeModel") {
label << "Volume:";
std::size_t pos2 = txt.find(':',pos1+1);
std::size_t pos3 = txt.find('\n',pos2+1);
label << txt.substr(pos2+1,pos3-pos2-1);
} else if (storeKey == "G4TrajectoriesModel") {
label << "Trajectory:";
std::size_t pos2 = txt.find(':',pos1+1);
std::size_t pos3 = txt.find('\n',pos2+1);
label << " Run:" << txt.substr(pos2+1,pos3-pos2-1);
std::size_t pos4 = txt.find(':',pos3+1);
std::size_t pos5 = txt.find('\n',pos4+1);
label << ", Event:" << txt.substr(pos4+1,pos5-pos4-1);
} else {
label << "Hit number:" << a << ", PickName: " << pickMap->getPickName();
// Look for Volumes
std::size_t pos = txt.find("Physical Volume Path (PVPath):") + 31;
if (pos != 31-1) {
std::size_t pos2 = txt.find("\n",pos);
label << "Volume: " + txt.substr(pos,pos2-pos);
} else {
// Look for tracks
if (pickMap[a]->getAttributes().size() > 1) {
std::string txt1 = pickMap[a]->getAttributes()[1].data();
pos = txt.find("Run ID (RunID):") + 16;
if (pos != 16-1) {
std::size_t pos2 = txt.find("\n",pos);
std::size_t posEID = txt.find("Event ID (EventID):",pos2) + 20;
std::size_t posEID2 = txt.find("\n",posEID);
std::size_t posPN = txt1.find("Particle Name (PN):") + 20;
std::size_t posPN2 = txt1.find("\n",posPN);
std::size_t posCh = txt1.find("Charge (Ch):",posPN2) + 13;
std::size_t posCh2 = txt1.find("\n",posCh);
label << "RunID:" << txt.substr(pos,pos2-pos)
<< " EventID:" << txt.substr(posEID,posEID2-posEID)
<< " PN:" << txt1.substr(posPN,posPN2-posPN)
<< " Ch:" << txt1.substr(posCh,posCh2-posCh);
}
} else {
label << "Hit number:" << a << ", PickName: " << pickMap[a]->getPickName();
}
}
} else {
label << "Hit number:" << a << ", PickName: " << pickMap[a]->getPickName();
// Accumulate all content with the same pickname
content << pickMap->print().data();
G4int thisPickName = pickMap->getPickName();
while (++a < pickMapVector.size()) {
const auto& a_pickMap = pickMapVector[a];
if (a_pickMap->getPickName() == thisPickName) {
content << a_pickMap->print().data();
} else {
a--;
break;
}
}
QPushButton* pickCoutButton = new QPushButton(label.str().c_str());
pickCoutButton->setStyleSheet ("text-align: left; padding: 1px; border: 0px;");
pickCoutButton->setIcon(*fTreeIconClosed);
fPickInfosWidget->layout()->addWidget(pickCoutButton);
QStringList newStr;
// Add to stringList
newStr = QStringList(QString(content.str().c_str()).trimmed());
QTextEdit* ed = new QTextEdit();
ed->setFontFamily("Courier");
ed->setFontPointSize(12);
ed->setReadOnly(true);
fPickInfosWidget->layout()->addWidget(ed);
ed->setVisible((false));
ed->append(newStr.join(""));
connect(pickCoutButton, SIGNAL(clicked()), fSignalMapperPicking, SLOT(map()));
fSignalMapperPicking->setMapping(pickCoutButton,fPickInfosWidget->layout()->count()-1);
}
QPushButton* pickCoutButton = new QPushButton(label.str().c_str());
pickCoutButton->setStyleSheet ("text-align: left; padding: 1px; border: 0px;");
pickCoutButton->setIcon(*fTreeIconClosed);
fPickInfosWidget->layout()->addWidget(pickCoutButton);
QStringList newStr;
// Add to stringList
newStr = QStringList(QString(pickMap[a]->print().data()).trimmed());
QTextEdit* ed = new QTextEdit();
ed->setFontFamily("Courier");
ed->setFontPointSize(12);
ed->setReadOnly(true);
fPickInfosWidget->layout()->addWidget(ed);
ed->setVisible((false));
ed->append(newStr.join(""));
connect(pickCoutButton, SIGNAL(clicked()), fSignalMapperPicking, SLOT(map()));
fSignalMapperPicking->setMapping(pickCoutButton,fPickInfosWidget->layout()->count()-1);
}
connect(fSignalMapperPicking, SIGNAL(mapped(int)),this, SLOT(toggleSceneTreeComponentPickingCout(int)));
@@ -4544,31 +4556,30 @@ void G4OpenGLQtViewer::updatePickInfosWidget(int aX, int aY) {
pushUp->setSizePolicy(vPolicy);
fPickInfosWidget->layout()->addWidget(pushUp);
/* // highlight the first one :
// highlight the first one :
// first un-highlight the last selected
changeColorAndTransparency(fLastHighlightName,fLastHighlightColor);
if (pickMap.size() > 0 ) {
if (pickMapVector.size() > 0 ) {
// get the new one
fLastHighlightName = pickMap[0]->getPickName();
fLastHighlightName = pickMapVector[0]->getPickName();
fLastHighlightColor = getColorForPoIndex(fLastHighlightName);
// set the new one
changeColorAndTransparency(fLastHighlightName,G4Color(1,1,1,1));
updateQWidget();
}
*/
QDialog* dial = static_cast<QDialog*> (fUIPickInfosWidget->parent());
if (dial) {
// change name
std::ostringstream oss;
if (pickMap.size() == 0) {
if (nPickedObjectsWithAttributes == 0) {
oss << "No object";
} else if (pickMap.size() == 1) {
} else if (nPickedObjectsWithAttributes == 1) {
oss << "1 object";
} else {
oss << QString::number(pickMap.size()).toStdString() << " objects";
oss << nPickedObjectsWithAttributes << " objects";
}
oss << " selected - " << GetName();
dial->setWindowTitle(oss.str().c_str());
@@ -4633,9 +4644,13 @@ void G4OpenGLQtViewer::tableWidgetViewerSetItemChanged(QTableWidgetItem * item)
}
bool G4OpenGLQtViewer::isCurrentWidget(){
// Prevent from repainting a hidden tab (the current tab name has to be the one of th GL viewer)
if ( GetName() != fUiQt->GetViewerTabWidget()->tabText(fUiQt->GetViewerTabWidget()->currentIndex()).toStdString().c_str()) {
return false;
G4Qt* interactorManager = G4Qt::getInstance ();
if (!interactorManager->IsExternalApp()) {
// Prevent from repainting a hidden tab (the current tab name has to be the one of th GL viewer)
if ( GetName() != fUiQt->GetViewerTabWidget()->tabText(fUiQt->GetViewerTabWidget()->currentIndex()).toStdString().c_str()) {
return false;
}
}
return true;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4OpenGLViewer.cc 103926 2017-05-03 13:43:27Z gcosmo $
// $Id: G4OpenGLViewer.cc 107329 2017-11-08 16:41:26Z gcosmo $
//
//
// Andrew Walkden 27th March 1996
@@ -544,12 +544,11 @@ const std::vector < G4OpenGLViewerPickMap* > & G4OpenGLViewer::GetPickDetails(GL
fIsGettingPickInfos = false;
if (hits < 0) {
G4cout << "Too many hits. Zoom in to reduce overlaps." << G4endl;
goto reset_and_return;
goto restoreMatrices;
}
if (hits > 0) {
GLuint* p = selectBuffer;
for (GLint i = 0; i < hits; ++i) {
G4OpenGLViewerPickMap* pickMap = new G4OpenGLViewerPickMap();
GLuint nnames = *p++;
// This bit of debug code or...
//GLuint zmin = *p++;
@@ -561,31 +560,40 @@ const std::vector < G4OpenGLViewerPickMap* > & G4OpenGLViewer::GetPickDetails(GL
p++;
for (GLuint j = 0; j < nnames; ++j) {
GLuint name = *p++;
pickMap->setHitNumber(i);
pickMap->setSubHitNumber(j);
pickMap->setPickName(name);
std::map<GLuint, G4AttHolder*>::iterator iter =
fOpenGLSceneHandler.fPickMap.find(name);
if (iter != fOpenGLSceneHandler.fPickMap.end()) {
G4AttHolder* attHolder = iter->second;
if(attHolder && attHolder->GetAttDefs().size()) {
for (size_t iAtt = 0; iAtt < attHolder->GetAttDefs().size(); ++iAtt) {
std::map<GLuint, G4AttHolder*>::iterator iter =
fOpenGLSceneHandler.fPickMap.find(name);
if (iter != fOpenGLSceneHandler.fPickMap.end()) {
G4AttHolder* attHolder = iter->second;
if(attHolder && attHolder->GetAttDefs().size()) {
for (size_t iAtt = 0;
iAtt < attHolder->GetAttDefs().size(); ++iAtt) {
std::ostringstream oss;
oss << G4AttCheck(attHolder->GetAttValues()[iAtt],
oss << G4AttCheck(attHolder->GetAttValues()[iAtt],
attHolder->GetAttDefs()[iAtt]);
G4OpenGLViewerPickMap* pickMap = new G4OpenGLViewerPickMap();
// G4cout
// << "i,j, attHolder->GetAttDefs().size(): "
// << i << ',' << j
// << ", " << attHolder->GetAttDefs().size()
// << G4endl;
// G4cout << "G4OpenGLViewer::GetPickDetails: " << oss.str() << G4endl;
pickMap->addAttributes(oss.str());
pickMap->setHitNumber(i);
pickMap->setSubHitNumber(j);
pickMap->setPickName(name);
pickMapVector.push_back(pickMap);
}
}
}
}
pickMapVector.push_back(pickMap);
}
}
reset_and_return:
restoreMatrices:
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
return pickMapVector;
}
@@ -1521,13 +1529,9 @@ void G4OpenGLViewer::setVboDrawer(G4OpenGLVboDrawer* drawer) {
G4String G4OpenGLViewerPickMap::print() {
std::ostringstream txt;
txt << fName;
txt << "Hit: " << fHitNumber << ", Sub-hit: " << fSubHitNumber << ", PickName: " << fPickName << "\n";
for (unsigned int a=0; a<fAttributes.size(); a++) {
txt << fAttributes[a] << "\n";
txt << fAttributes[a];
if (a < fAttributes.size() - 1) txt << "\n";
}
return txt.str();
}
+37 -2
View File
@@ -1,4 +1,4 @@
$Id: History 104163 2017-05-15 06:52:42Z gcosmo $
$Id: History 106957 2017-10-31 08:32:27Z gcosmo $
-------------------------------------------------------------------
@@ -26,6 +26,41 @@ committal in the CVS repository !
History file for visualization management sub-category
------------------------------------------------------
29th October 2017 John Allison (visman-V10-03-16)
- G4VisManager.cc: Protect /vis/enable issued before run established.
6th October 2017 John Allison (visman-V10-03-15)
- Needs greps-V10-03-07.
- G4VisManager:
o Remove
if (!GetConcreteInstance()) return;
from Begin/EndOfRun so that even if the user
/vis/disable
the vis manager will still report fully, for example, with information
about the number of kept events for reviewing or redrawing.
o Introduce InitialiseG4ColourMap, which initialises G4Colour's colour map
and adds Guy Barrand's 65 X11 colours.
o Improve some messages.
- G4VisCommands:
o Change /vis/drawOnlyKeptEvents to /vis/drawOnlyToBeKeptEvents and
improve the guidance for improved clarity.
13th September 2017 John Allison (visman-V10-03-14)
- G4ViewParameters.cc, G4VisCommandsViewerSet.cc:
Reverted default number of line segments per circle to 24.
(72 lines per circle gives trouble in the Boolean Processor, so until that
is fixed we revert to 24.)
21st June 2017 John Allison (visman-V10-03-13)
- Implement /vis/drawOnlyKeptEvents.
To draw selected events the user should set this flag, then in a user action:
if ( some criterion ) {
G4EventManager::GetEventManager()->KeepTheCurrentEvent();
}
15th May 2017 John Allison
- Cosmetic.
14th May 2017 John Allison (visman-V10-03-12)
- Needs modeling-V10-03-07.
- Add user-selected colour to /vis/scene/add/gps.
@@ -33,7 +68,7 @@ History file for visualization management sub-category
12th May 2017 John Allison (visman-V10-03-11)
- Added G4VVisCommand::ConvertToColourGuidance. This avoids having to
repeat it for every command that uses it.
- /vis/viewer/save: Add .g4view if an extension us not supplied by the user.
- /vis/viewer/save: Add .g4view if an extension is not supplied by the user.
- /vis/viewer/set/defaultTextColour: Changed default to blue and opaque to
agree with default text vis attributes.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VVisCommand.hh 104163 2017-05-15 06:52:42Z gcosmo $
// $Id: G4VVisCommand.hh 105349 2017-07-21 12:23:24Z gcosmo $
// Base class for visualization commands - John Allison 9th August 1998
// It is really a messenger - we have one command per messenger.
@@ -71,9 +71,13 @@ protected:
G4double& yval);
// Return false if problem parsing paramString.
const G4String& ConvertToColourGuidance();
void ConvertToColour
(G4Colour& colour,
const G4String& redOrString, G4double green, G4double blue, G4double opacity);
const G4String& redOrString,
G4double green,
G4double blue,
G4double opacity);
// Note: colour is supplied by the caller and becomes the default if the
// remaining parameters cannot be parsed.
// Note: redOrString is either a number or string. If a string it must be
@@ -82,7 +86,6 @@ protected:
// (colour,"red",...,...,0.5): will give the colour red with opacity 0.5 (the
// third and fourth arguments are ignored), or
// (1.,0.,0.,0.5): this also will be red with opacity 0.5.
static const G4String& ConvertToColourGuidance();
// Other utilities.
void UpdateVisManagerScene (const G4String& sceneName = "");
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommands.hh 66373 2012-12-18 09:41:34Z gcosmo $
// $Id: G4VisCommands.hh 106384 2017-10-09 09:34:51Z gcosmo $
// /vis/ top level commands - John Allison 5th February 2001
@@ -49,6 +49,18 @@ private:
G4UIcmdWithABool* fpCommand;
};
class G4VisCommandDrawOnlyToBeKeptEvents: public G4VVisCommand {
public:
G4VisCommandDrawOnlyToBeKeptEvents ();
virtual ~G4VisCommandDrawOnlyToBeKeptEvents ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4VisCommandDrawOnlyToBeKeptEvents (const G4VisCommandDrawOnlyToBeKeptEvents&);
G4VisCommandDrawOnlyToBeKeptEvents& operator = (const G4VisCommandDrawOnlyToBeKeptEvents&);
G4UIcmdWithABool* fpCommand;
};
class G4VisCommandEnable: public G4VVisCommand {
public:
G4VisCommandEnable ();
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisManager.hh 102802 2017-02-22 15:19:00Z gcosmo $
// $Id: G4VisManager.hh 106384 2017-10-09 09:34:51Z gcosmo $
//
//
@@ -174,7 +174,7 @@ public:
public: // With description
void Initialise ();
void Initialize (); // Alias Initialise ().
void Initialize (); // Alias Initialise ()
// Optional registration of user vis actions. Added to scene with
// /vis/scene/add/userAction.
@@ -194,7 +194,6 @@ public: // With description
// or other of the above.
void SetUserActionExtent (const G4VisExtent&); //Legacy: deprecated.
G4bool RegisterGraphicsSystem (G4VGraphicsSystem*);
// Register an individual graphics system. Normally this is done in
// a sub-class implementation of the protected virtual function,
@@ -406,6 +405,7 @@ public: // With description
static Verbosity GetVerbosity ();
G4bool GetTransientsDrawnThisRun () const;
G4bool GetTransientsDrawnThisEvent () const;
G4bool GetDrawEventOnlyIfToBeKept () const;
const G4Event* GetRequestedEvent () const;
G4bool GetAbortReviewKeptEvents () const;
const G4ViewParameters& GetDefaultViewParameters () const;
@@ -427,6 +427,7 @@ public: // With description
void ResetTransientsDrawnFlags ();
void SetTransientsDrawnThisRun (G4bool);
void SetTransientsDrawnThisEvent (G4bool);
void SetDrawEventOnlyIfToBeKept (G4bool);
// If non-zero, requested event is used in G4VSceneHandler::ProcessScene.
void SetRequestedEvent (const G4Event*);
void SetAbortReviewKeptEvents (G4bool);
@@ -489,8 +490,9 @@ private:
(const T& graphics_primitive, const G4Transform3D& objectTransform);
void PrintAvailableModels (Verbosity) const;
void InitialiseG4ColourMap () const;
void PrintAvailableColours (Verbosity) const;
void PrintAvailableUserVisActions (Verbosity) const;
void PrintAvailableUserVisActions (Verbosity) const;
void PrintInvalidPointers () const;
G4bool IsValidView ();
// True if view is valid. Prints messages and sanitises various data.
@@ -522,6 +524,7 @@ private:
G4int fNKeepRequests;
G4bool fEventKeepingSuspended;
G4bool fKeptLastEvent;
G4bool fDrawEventOnlyIfToBeKept;
const G4Event* fpRequestedEvent; // If non-zero, scene handler uses.
G4bool fAbortReviewKeptEvents;
G4ViewParameters fDefaultViewParameters;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisManager.icc 102233 2017-01-13 15:59:06Z gcosmo $
// $Id: G4VisManager.icc 105349 2017-07-21 12:23:24Z gcosmo $
//
//
// GEANT4 Visualization Manager - John Allison 02/Jan/1996.
@@ -87,6 +87,10 @@ inline G4bool G4VisManager::GetTransientsDrawnThisRun() const {
return fTransientsDrawnThisRun;
}
inline G4bool G4VisManager::GetDrawEventOnlyIfToBeKept() const {
return fDrawEventOnlyIfToBeKept;
}
inline const G4Event* G4VisManager::GetRequestedEvent() const {
return fpRequestedEvent;
}
@@ -140,6 +144,10 @@ inline void G4VisManager::SetTransientsDrawnThisEvent (G4bool b) {
fTransientsDrawnThisEvent = b;
}
inline void G4VisManager::SetDrawEventOnlyIfToBeKept (G4bool b) {
fDrawEventOnlyIfToBeKept = b;
}
inline void G4VisManager::SetRequestedEvent (const G4Event* event) {
fpRequestedEvent = event;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VVisCommand.cc 104163 2017-05-15 06:52:42Z gcosmo $
// $Id: G4VVisCommand.cc 105349 2017-07-21 12:23:24Z gcosmo $
// Base class for visualization commands - John Allison 9th August 1998
// It is really a messenger - we have one command per messenger.
@@ -94,10 +94,9 @@ const G4String& G4VVisCommand::ConvertToColourGuidance()
{
static G4String guidance
("Accepts (a) RGB triplet. e.g., \".3 .4 .5\", or"
"\n(b) string such as \"white\", \"black\", \"grey\", \"red\"..."
"\n(c) an additional number for opacity, e.g., \".3 .4 .5 .6\""
"\n or \"grey ! ! .6\" (note \"!\"'s for unused green and blue parameters),"
"\n e.g. \"! ! ! 0.\" for a transparent colour.");
"\n (b) string such as \"white\", \"black\", \"grey\", \"red\"...or"
"\n (c) an additional number for opacity, e.g., \".3 .4 .5 .6\""
"\n or \"grey ! ! .6\" (note \"!\"'s for unused parameters).");
return guidance;
}
@@ -105,12 +104,12 @@ void G4VVisCommand::ConvertToColour
(G4Colour& colour,
const G4String& redOrString, G4double green, G4double blue, G4double opacity)
{
// Note: colour is supplied by the caller and becomes the default if the
// remaining parameters cannot be parsed.
// Note: colour is supplied by the caller and some or all of its components
// may act as default.
//
// Note: redOrString is either a number or string. If a string it must be
// one of the recognised colours.
//
// Thus the arguments can be, for example:
// (colour,"red",...,...,0.5): will give the colour red with opacity 0.5 (the
// third and fourth arguments are ignored), or
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ViewParameters.cc 101035 2016-11-04 08:48:17Z gcosmo $
// $Id: G4ViewParameters.cc 106122 2017-09-13 12:51:53Z gcosmo $
//
//
// John Allison 19th July 1996
@@ -53,7 +53,7 @@ G4ViewParameters::G4ViewParameters ():
fCutawayMode (cutawayUnion),
fCutawayPlanes (),
fExplodeFactor (1.),
fNoOfSides (72),
fNoOfSides (24),
fViewpointDirection (G4Vector3D (0., 0., 1.)), // On z-axis.
fUpVector (G4Vector3D (0., 1., 0.)), // y-axis up.
fFieldHalfAngle (0.), // Orthogonal projection.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommands.cc 93025 2015-09-30 16:02:12Z gcosmo $
// $Id: G4VisCommands.cc 106384 2017-10-09 09:34:51Z gcosmo $
// /vis/ top level commands - John Allison 5th February 2001
@@ -70,11 +70,52 @@ G4String G4VisCommandAbortReviewKeptEvents::GetCurrentValue (G4UIcommand*) {
}
void G4VisCommandAbortReviewKeptEvents::SetNewValue (G4UIcommand*,
G4String newValue) {
G4String newValue) {
fpVisManager->SetAbortReviewKeptEvents(G4UIcommand::ConvertToBool(newValue));
G4cout << "Type \"continue\" to complete the abort." << G4endl;
}
////////////// /vis/drawOnlyToBeKeptEvents /////////////////////////////
G4VisCommandDrawOnlyToBeKeptEvents::G4VisCommandDrawOnlyToBeKeptEvents ()
{
G4bool omitable;
fpCommand = new G4UIcmdWithABool("/vis/drawOnlyToBeKeptEvents", this);
fpCommand -> SetGuidance
("DURING A RUN draw only those events that have been \"to be kept\" by the user"
"\nwith G4EventManager::GetEventManager()->KeepTheCurrentEvent() or"
"\nwith \"/event/keepCurrentEvent\".");
fpCommand -> SetGuidance(
"To draw selected events the user should set this flag, then in a user action:"
"\n if ( some criterion ) {"
"\n G4EventManager::GetEventManager()->KeepTheCurrentEvent();"
"\n }");
fpCommand -> SetParameterName("draw", omitable=true);
fpCommand -> SetDefaultValue(true);
}
G4VisCommandDrawOnlyToBeKeptEvents::~G4VisCommandDrawOnlyToBeKeptEvents () {
delete fpCommand;
}
G4String G4VisCommandDrawOnlyToBeKeptEvents::GetCurrentValue (G4UIcommand*) {
return G4String();
}
void G4VisCommandDrawOnlyToBeKeptEvents::SetNewValue (G4UIcommand*,
G4String newValue) {
fpVisManager->SetDrawEventOnlyIfToBeKept(G4UIcommand::ConvertToBool(newValue));
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
if (verbosity < G4VisManager::warnings) {
if (fpVisManager->GetDrawEventOnlyIfToBeKept()) {
G4cout << "Only events that have been kept will be drawn." << G4endl;
} else {
G4cout << "All events will be drawn." << G4endl;
}
}
}
////////////// /vis/enable ///////////////////////////////////////
G4VisCommandEnable::G4VisCommandEnable () {
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsViewerSet.cc 104163 2017-05-15 06:52:42Z gcosmo $
// $Id: G4VisCommandsViewerSet.cc 106122 2017-09-13 12:51:53Z gcosmo $
// /vis/viewer/set commands - John Allison 16th May 2000
@@ -279,7 +279,7 @@ G4VisCommandsViewerSet::G4VisCommandsViewerSet ():
fpCommandLineSegments->SetGuidance
("Refers to graphical representation of objects with curved lines/surfaces.");
fpCommandLineSegments->SetParameterName("line-segments",omitable = true);
fpCommandLineSegments->SetDefaultValue(72);
fpCommandLineSegments->SetDefaultValue(24);
fpCommandPicking = new G4UIcmdWithABool
("/vis/viewer/set/picking",this);
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VisManager.cc 103926 2017-05-03 13:43:27Z gcosmo $
// $Id: G4VisManager.cc 106957 2017-10-31 08:32:27Z gcosmo $
//
//
// GEANT4 Visualization Manager - John Allison 02/Jan/1996.
@@ -111,6 +111,7 @@ G4VisManager::G4VisManager (const G4String& verbosityString):
fNKeepRequests (0),
fEventKeepingSuspended (false),
fKeptLastEvent (false),
fDrawEventOnlyIfToBeKept (false),
fpRequestedEvent (0),
fAbortReviewKeptEvents (false),
fIsDrawGroup (false),
@@ -350,14 +351,112 @@ void G4VisManager::Initialise () {
G4cout << G4endl;
}
InitialiseG4ColourMap();
if (fVerbosity >= startup) {
PrintAvailableColours (fVerbosity);
G4cout << G4endl;
G4cout <<
"Some /vis commands (optionally) take a string to specify colour."
"\n\"/vis/list\" to see available colours."
<< G4endl;
}
fInitialised = true;
}
void G4VisManager::InitialiseG4ColourMap() const
{
G4Colour::InitialiseColourMap(); // Initialises (if not already initialised)
// our forever 65 named colors taken long time ago from X11.
// Extracted from g4tools/include/tools/colors
// Copyright (C) 2010, Guy Barrand. All rights reserved.
// See the file tools.license for terms.
#define TOOLS_COLORS_STAT(name,r,g,b) \
G4Colour::AddToMap(#name, G4Colour(r,g,b));
//0-9
TOOLS_COLORS_STAT(aquamarine,0.496101F,0.996109F,0.828138F)
TOOLS_COLORS_STAT(mediumaquamarine,0.398444F,0.800793F,0.664073F)
// TOOLS_COLORS_STAT(black,0,0,0) (already defined)
// TOOLS_COLORS_STAT(blue,0,0,1) (already defined)
TOOLS_COLORS_STAT(cadetblue,0.371099F,0.617197F,0.62501F)
TOOLS_COLORS_STAT(cornflowerblue,0.390631F,0.58204F,0.925795F)
TOOLS_COLORS_STAT(darkslateblue,0.281254F,0.238285F,0.542977F)
TOOLS_COLORS_STAT(lightblue,0.675792F,0.843763F,0.898451F)
TOOLS_COLORS_STAT(lightsteelblue,0.68751F,0.765637F,0.867201F)
TOOLS_COLORS_STAT(mediumblue,0,0,0.800793F)
//10-19
TOOLS_COLORS_STAT(mediumslateblue,0.480476F,0.406256F,0.929702F)
TOOLS_COLORS_STAT(midnightblue,0.0976577F,0.0976577F,0.437507F)
TOOLS_COLORS_STAT(navyblue,0,0,0.500008F)
TOOLS_COLORS_STAT(navy,0,0,0.500008F)
TOOLS_COLORS_STAT(skyblue,0.527352F,0.8047F,0.917983F)
TOOLS_COLORS_STAT(slateblue,0.414069F,0.351568F,0.800793F)
TOOLS_COLORS_STAT(steelblue,0.273442F,0.50782F,0.703136F)
TOOLS_COLORS_STAT(coral,0.996109F,0.496101F,0.312505F)
// TOOLS_COLORS_STAT(cyan,0,1,1) (already defined)
TOOLS_COLORS_STAT(firebrick,0.695323F,0.132815F,0.132815F)
//20-29
// TOOLS_COLORS_STAT(brown,0.644541F,0.164065F,0.164065F) (already defined)
TOOLS_COLORS_STAT(gold,0.996109F,0.839857F,0)
TOOLS_COLORS_STAT(goldenrod,0.851575F,0.644541F,0.125002F)
// TOOLS_COLORS_STAT(green,0,1,0) (already defined)
TOOLS_COLORS_STAT(darkgreen,0,0.390631F,0)
TOOLS_COLORS_STAT(darkolivegreen,0.332036F,0.417975F,0.183597F)
TOOLS_COLORS_STAT(forestgreen,0.132815F,0.542977F,0.132815F)
TOOLS_COLORS_STAT(limegreen,0.195315F,0.800793F,0.195315F)
TOOLS_COLORS_STAT(mediumseagreen,0.234379F,0.699229F,0.441413F)
TOOLS_COLORS_STAT(mediumspringgreen,0,0.976577F,0.601572F)
//30-39
TOOLS_COLORS_STAT(palegreen,0.593759F,0.980484F,0.593759F)
TOOLS_COLORS_STAT(seagreen,0.17969F,0.542977F,0.339849F)
TOOLS_COLORS_STAT(springgreen,0,0.996109F,0.496101F)
TOOLS_COLORS_STAT(yellowgreen,0.601572F,0.800793F,0.195315F)
TOOLS_COLORS_STAT(darkslategrey,0.183597F,0.308598F,0.308598F)
TOOLS_COLORS_STAT(dimgrey,0.410163F,0.410163F,0.410163F)
TOOLS_COLORS_STAT(lightgrey,0.824231F,0.824231F,0.824231F)
// TOOLS_COLORS_STAT(grey,0.750011F,0.750011F,0.750011F) (already defined)
TOOLS_COLORS_STAT(khaki,0.937514F,0.898451F,0.546883F)
// TOOLS_COLORS_STAT(magenta,1,0,1) (already defined)
//40-49
TOOLS_COLORS_STAT(maroon,0.68751F,0.187503F,0.375006F)
TOOLS_COLORS_STAT(orange,0.996109F,0.644541F,0)
TOOLS_COLORS_STAT(orchid,0.851575F,0.437507F,0.83595F)
TOOLS_COLORS_STAT(darkorchid,0.597665F,0.195315F,0.796887F)
TOOLS_COLORS_STAT(mediumorchid,0.726574F,0.332036F,0.824231F)
TOOLS_COLORS_STAT(pink,0.996109F,0.750011F,0.792981F)
TOOLS_COLORS_STAT(plum,0.863294F,0.62501F,0.863294F)
// TOOLS_COLORS_STAT(red,1,0,0) (already defined)
TOOLS_COLORS_STAT(indianred,0.800793F,0.35938F,0.35938F)
TOOLS_COLORS_STAT(mediumvioletred,0.777356F,0.0820325F,0.519539F)
//50-59
TOOLS_COLORS_STAT(orangered,0.996109F,0.269535F,0)
TOOLS_COLORS_STAT(violetred,0.812512F,0.125002F,0.562509F)
TOOLS_COLORS_STAT(salmon,0.976577F,0.500008F,0.445319F)
TOOLS_COLORS_STAT(sienna,0.62501F,0.320317F,0.175784F)
TOOLS_COLORS_STAT(tan,0.820325F,0.703136F,0.546883F)
TOOLS_COLORS_STAT(thistle,0.843763F,0.746105F,0.843763F)
TOOLS_COLORS_STAT(turquoise,0.250004F,0.875013F,0.812512F)
TOOLS_COLORS_STAT(darkturquoise,0,0.8047F,0.816419F)
TOOLS_COLORS_STAT(mediumturquoise,0.281254F,0.816419F,0.796887F)
TOOLS_COLORS_STAT(violet,0.929702F,0.50782F,0.929702F)
//60-64
TOOLS_COLORS_STAT(blueviolet,0.539071F,0.167971F,0.882826F)
TOOLS_COLORS_STAT(wheat,0.957046F,0.867201F,0.699229F)
// TOOLS_COLORS_STAT(white,1,1,1) (already defined)
// TOOLS_COLORS_STAT(yellow,1,1,0) (already defined)
TOOLS_COLORS_STAT(greenyellow,0.675792F,0.996109F,0.18359F)
#undef TOOLS_COLORS_STAT
}
void G4VisManager::RegisterMessengers () {
// Instantiate individual messengers/commands (often - but not
@@ -372,6 +471,7 @@ void G4VisManager::RegisterMessengers () {
// Other top level commands...
RegisterMessenger(new G4VisCommandAbortReviewKeptEvents);
RegisterMessenger(new G4VisCommandDrawOnlyToBeKeptEvents);
RegisterMessenger(new G4VisCommandEnable);
RegisterMessenger(new G4VisCommandList);
RegisterMessenger(new G4VisCommandReviewKeptEvents);
@@ -547,8 +647,9 @@ void G4VisManager::Enable() {
G4cout << "G4VisManager::Enable: visualization enabled." << G4endl;
}
if (fVerbosity >= warnings) {
auto nKeptEvents =
G4RunManager::GetRunManager()->GetCurrentRun()->GetEventVector()->size();
G4int nKeptEvents = 0;
const G4Run* run = G4RunManager::GetRunManager()->GetCurrentRun();
if (run) nKeptEvents = run->GetEventVector()->size();
G4cout <<
"There are " << nKeptEvents << " kept events."
"\n \"/vis/reviewKeptEvents\" to review them one by one."
@@ -1761,8 +1862,6 @@ void G4VisManager::BeginOfRun ()
{
if (fIgnoreStateChanges) return;
if (!GetConcreteInstance()) return;
#ifdef G4MULTITHREADED
if (G4Threading::IsWorkerThread()) return;
#endif
@@ -1870,6 +1969,12 @@ void G4VisManager::EndOfEvent ()
const G4Event* currentEvent = eventManager->GetConstCurrentEvent();
if (!currentEvent) return;
// Discard event if fDrawEventOnlyIfToBeKept flag is set unless the
// user has requested the event to be kept.
if (fDrawEventOnlyIfToBeKept) {
if (!currentEvent->ToBeKept()) return;
}
if (G4Threading::IsMultithreadedApplication()) {
#ifdef G4MULTITHREADED
@@ -2043,8 +2148,6 @@ void G4VisManager::EndOfRun ()
{
if (fIgnoreStateChanges) return;
if (!GetConcreteInstance()) return;
#ifdef G4MULTITHREADED
if (G4Threading::IsWorkerThread()) return;
#endif
@@ -2122,7 +2225,7 @@ void G4VisManager::EndOfRun ()
}
G4cout <<
"\n \"/vis/reviewKeptEvents\" to review them one by one."
"\n \"/vis/viewer/flush\" or \"/vis/viewer/rebuild\" to see them accumulated."
"\n \"/vis/enable\", then \"/vis/viewer/flush\" or \"/vis/viewer/rebuild\" to see them accumulated."
<< G4endl;
}
// static G4bool warned = false;
@@ -2328,10 +2431,9 @@ G4bool G4VisManager::IsValidView () {
"WARNING: G4VisManager::IsValidView(): Attempt to draw when no graphics system"
"\n has been instantiated. Use \"/vis/open\" or \"/vis/sceneHandler/create\"."
"\n Alternatively, to avoid this message, suppress instantiation of vis"
"\n manager (G4VisExecutive), possibly by setting G4VIS_NONE, and ensure"
"\n drawing code is executed only if G4VVisManager::GetConcreteInstance()"
"\n is non-zero."
<< G4endl;
"\n manager (G4VisExecutive) and ensure drawing code is executed only if"
"\n G4VVisManager::GetConcreteInstance() is non-zero."
<< G4endl;
}
}
return false;
+7 -1
View File
@@ -1,4 +1,4 @@
$Id: History 104164 2017-05-15 06:53:09Z gcosmo $
$Id: History 106122 2017-09-13 12:51:53Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -20,6 +20,12 @@ committal in the CVS repository !
History file for visualization/modeling
---------------------------------------
13th September 2017 John Allison (modeling-V10-03-08)
- G4ModelingParameters.cc, G4PhysicalVolumeModel.cc:
Reverted default number of line segments per circle to 24.
(72 lines per circle gives trouble in the Boolean Processor, so until that
is fixed we revert to 24.)
14th May 2017 John Allison (modeling-V10-03-07)
- G4GPSModel: Added user-selectable colour.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ModelingParameters.cc 103627 2017-04-19 13:30:26Z gcosmo $
// $Id: G4ModelingParameters.cc 106122 2017-09-13 12:51:53Z gcosmo $
//
//
// John Allison 31st December 1997.
@@ -50,7 +50,7 @@ G4ModelingParameters::G4ModelingParameters ():
fVisibleDensity (0.01 * g / cm3),
fCullCovered (false),
fExplodeFactor (1.),
fNoOfSides (72),
fNoOfSides (24),
fpSectionSolid (0),
fpCutawaySolid (0),
fpEvent (0)
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeModel.cc 103926 2017-05-03 13:43:27Z gcosmo $
// $Id: G4PhysicalVolumeModel.cc 106122 2017-09-13 12:51:53Z gcosmo $
//
//
// John Allison 31st December 1997.
@@ -134,7 +134,7 @@ void G4PhysicalVolumeModel::CalculateExtent ()
false, // Density culling.
0., // Density (not relevant if density culling false).
true, // Cull daughters of opaque mothers.
72); // No of sides (not relevant for this operation).
24); // No of sides (not relevant for this operation).
fpMP = &mParams;
DescribeYourselfTo (bsScene);
G4double radius = bsScene.GetRadius();