Import Geant4 9.6.0 source tree
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
///\file "visualization/standalone/.README"
|
||||
///\brief Example standalone README page
|
||||
|
||||
/*! \page Examplestandalone Example standalone
|
||||
|
||||
examples/extended/visualization/standalone
|
||||
|
||||
|
||||
This example illustrates how one might use the Geant Visualization
|
||||
System as a "stand alone" graphics library and viewer. It makes use
|
||||
of the "user action" feature of the Geant4 vis manager - for a fuller
|
||||
example of the use of this feature see
|
||||
examples/extended/visualization/userVisAction.
|
||||
|
||||
1) Define a G4VUserVisAction that implements a Draw method. An
|
||||
example is provided - see StandaloneVisAction.hh/cc.
|
||||
StandaloneVisAction::Draw illustrates:
|
||||
a) a simple box;
|
||||
b) a Boolean solid;
|
||||
c) an alternative way of drawing a solid by obtaining the
|
||||
polyhedral representation.
|
||||
The last is included for interest, not as a recommendation.
|
||||
|
||||
2) In the main () program (see standalone.cc), StandaloneVisAction must be instantiated and
|
||||
its pointer registered with the visualization manager. You may
|
||||
optionally specify an extent at this point to assist the viewers to
|
||||
locate the objects.
|
||||
|
||||
3) To visualise, use the usual Geant4 vis commands to create a view
|
||||
and scene, then add the vis action to the scene, optionally with an
|
||||
extent - see standalone.mac.
|
||||
|
||||
Note: The system needs an "extent" in order to point the virtual
|
||||
camera and adjust its field of view, etc. This defines the "standard
|
||||
view". You may zoom, etc., from this standard view.
|
||||
|
||||
|
||||
John Allison
|
||||
11th June 2012
|
||||
*/
|
||||
@@ -0,0 +1,58 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# Setup the project
|
||||
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
||||
project(standalone)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Find Geant4 package, activating all available UI and Vis drivers by default
|
||||
# You can set WITH_GEANT4_UIVIS to OFF via the command line or ccmake/cmake-gui
|
||||
# to build a batch mode only executable
|
||||
#
|
||||
option(WITH_GEANT4_UIVIS "Build example with Geant4 UI and Vis drivers" ON)
|
||||
if(WITH_GEANT4_UIVIS)
|
||||
find_package(Geant4 REQUIRED ui_all vis_all)
|
||||
else()
|
||||
find_package(Geant4 REQUIRED)
|
||||
endif()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Setup Geant4 include directories and compile definitions
|
||||
#
|
||||
include(${Geant4_USE_FILE})
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Locate sources and headers for this project
|
||||
#
|
||||
include_directories(${PROJECT_SOURCE_DIR}/include
|
||||
${Geant4_INCLUDE_DIR})
|
||||
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
|
||||
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add the executable, and link it to the Geant4 libraries
|
||||
#
|
||||
add_executable(standalone standalone.cc ${sources} ${headers})
|
||||
target_link_libraries(standalone ${Geant4_LIBRARIES} )
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Copy all scripts to the build directory, i.e. the directory in which we
|
||||
# build standalone. This is so that we can run the executable directly because it
|
||||
# relies on these scripts being in the current working directory.
|
||||
#
|
||||
set(standalone_SCRIPTS
|
||||
standalone.mac
|
||||
)
|
||||
|
||||
foreach(_script ${standalone_SCRIPTS})
|
||||
configure_file(
|
||||
${PROJECT_SOURCE_DIR}/${_script}
|
||||
${PROJECT_BINARY_DIR}/${_script}
|
||||
COPYONLY
|
||||
)
|
||||
endforeach()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
|
||||
#
|
||||
install(TARGETS standalone DESTINATION bin)
|
||||
|
||||
@@ -16,6 +16,29 @@ track of all tags.
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
25th September 2012 Ivana Hrivnacova
|
||||
- Renamed standalone.g4m in standalone.mac
|
||||
|
||||
11th June 2012 John Allison (exam-ext-vis-standalone-V09-05-02)
|
||||
- standalone.cc: Changed SetUserAction to RegisterRunDurationUserVisAction.
|
||||
- Improved README.
|
||||
- Added .README for doxygen.
|
||||
|
||||
9th April 2012 John Allison (exam-ext-vis-standalone-V09-05-01)
|
||||
- standalone.cc: Corrected vis user action extent.
|
||||
- standalone.g4m: Removed arguments from /vis/scene/add/userAction.
|
||||
- README: Improved.
|
||||
|
||||
21st March 2012 John Allison (exam-ext-vis-standalone-V09-05-00)
|
||||
- Re-tagged with directory specify name.
|
||||
|
||||
21st March 2012 John Allison (exam-ext-vis-V09-05-01)
|
||||
- Minor cosmetic improvements to comments and REAME.
|
||||
|
||||
12th March 2012 John Allison (exam-ext-vis-V09-05-00)
|
||||
- Added README.
|
||||
- Improved standalone.g4m.
|
||||
|
||||
9th November 2010 John Allison (exam-ext-vis-V09-03-00)
|
||||
- Introduced G4UIExecutive.
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
examples/extended/visualization/standalone
|
||||
------------------------------------------
|
||||
|
||||
This example illustrates how one might use the Geant Visualization
|
||||
System as a "stand alone" graphics library and viewer. It makes use
|
||||
of the "user action" feature of the Geant4 vis manager - for a fuller
|
||||
example of the use of this feature see
|
||||
examples/extended/visualization/userVisAction.
|
||||
|
||||
1) Define a G4VUserVisAction that implements a Draw method. An
|
||||
example is provided - see StandaloneVisAction.hh/cc.
|
||||
StandaloneVisAction::Draw illustrates:
|
||||
a) a simple box;
|
||||
b) a Boolean solid;
|
||||
c) an alternative way of drawing a solid by obtaining the
|
||||
polyhedral representation.
|
||||
The last is included for interest, not as a recommendation.
|
||||
|
||||
2) In the main program, StandaloneVisAction must be instantiated and
|
||||
its pointer registered with the visualization manager. You may
|
||||
optionally specify an extent at this point to assist the viewers to
|
||||
locate the objects.
|
||||
|
||||
3) To visualise, use the usual Geant4 vis commands to create a view
|
||||
and scene, then add the vis action to the scene, optionally with an
|
||||
extent - see standalone.mac.
|
||||
|
||||
Note: The system needs an "extent" in order to point the virtual
|
||||
camera and adjust its field of view, etc. This defines the "standard
|
||||
view". You may zoom, etc., from this standard view.
|
||||
|
||||
|
||||
John Allison
|
||||
11th June 2012
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file visualization/standalone/include/StandaloneVisAction.hh
|
||||
/// \brief Definition of the StandaloneVisAction class
|
||||
//
|
||||
// $Id: StandaloneVisAction.hh,v 1.2 2006-06-29 17:45:55 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
|
||||
#ifndef STANDALONEVISACTION_HH
|
||||
#define STANDALONEVISACTION_HH
|
||||
@@ -33,7 +35,7 @@
|
||||
#include "G4VUserVisAction.hh"
|
||||
|
||||
class StandaloneVisAction: public G4VUserVisAction {
|
||||
void Draw();
|
||||
virtual void Draw();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file visualization/standalone/src/StandaloneVisAction.cc
|
||||
/// \brief Implementation of the StandaloneVisAction class
|
||||
//
|
||||
// $Id: StandaloneVisAction.cc,v 1.2 2006-06-29 17:45:58 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
|
||||
#include "StandaloneVisAction.hh"
|
||||
|
||||
@@ -34,6 +36,7 @@
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4SubtractionSolid.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
void StandaloneVisAction::Draw() {
|
||||
G4VVisManager* pVisManager = G4VVisManager::GetConcreteInstance();
|
||||
@@ -41,7 +44,7 @@ void StandaloneVisAction::Draw() {
|
||||
|
||||
// Simple box...
|
||||
pVisManager->Draw(G4Box("box",2*m,2*m,2*m),
|
||||
G4VisAttributes(G4Colour(1,1,0)));
|
||||
G4VisAttributes(G4Colour(1,1,0)));
|
||||
|
||||
// Boolean solid...
|
||||
G4Box boxA("boxA",3*m,3*m,3*m);
|
||||
|
||||
@@ -23,30 +23,33 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file visualization/standalone/standalone.cc
|
||||
/// \brief Main program of the visualization/standalone example
|
||||
//
|
||||
// $Id: standalone.cc,v 1.3 2010-11-09 10:02:45 allison Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4VisExecutive.hh"
|
||||
#include "G4VisExtent.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4UIExecutive.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
#include "StandaloneVisAction.hh"
|
||||
|
||||
int main(int argc,char** argv) {
|
||||
|
||||
G4VisManager* visManager = new G4VisExecutive;
|
||||
visManager->RegisterRunDurationUserVisAction
|
||||
("A standalone example - 3 boxes, 2 with boolean subtracted cutout",
|
||||
new StandaloneVisAction,
|
||||
G4VisExtent(-10*m,10*m,-10*m,10*m,-10*m,10*m));
|
||||
visManager->Initialize ();
|
||||
|
||||
visManager->SetUserAction
|
||||
(new StandaloneVisAction,
|
||||
G4VisExtent(-5*m,5*m,-5*m,5*m,-5*m,5*m)); // 2nd argument optional.
|
||||
|
||||
G4UIExecutive* ui = new G4UIExecutive(argc, argv);
|
||||
G4UImanager* UImanager = G4UImanager::GetUIpointer();
|
||||
UImanager->ApplyCommand ("/control/execute standalone.g4m");
|
||||
UImanager->ApplyCommand ("/control/execute standalone.mac");
|
||||
ui->SessionStart();
|
||||
|
||||
delete ui;
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
/control/verbose 2
|
||||
/vis/verbose p
|
||||
/vis/verbose parameters
|
||||
/vis/open OGL
|
||||
/vis/scene/create
|
||||
#/vis/scene/add/userAction
|
||||
/vis/scene/add/userAction -10 10 -10 10 -10 10 m
|
||||
#/vis/scene/add/axes 0 0 0 10 m
|
||||
#/vis/scene/add/scale 10 m
|
||||
/vis/scene/add/userAction
|
||||
/vis/scene/add/axes
|
||||
/vis/scene/add/scale
|
||||
/vis/sceneHandler/attach
|
||||
/vis/viewer/flush
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/control/verbose 2
|
||||
/vis/verbose parameters
|
||||
/vis/open OGL
|
||||
/vis/scene/create
|
||||
/vis/scene/add/userAction
|
||||
/vis/scene/add/axes
|
||||
/vis/scene/add/scale
|
||||
/vis/sceneHandler/attach
|
||||
/vis/viewer/flush
|
||||
Reference in New Issue
Block a user