Import Geant4 11.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2023-12-08 10:43:34 +01:00
parent dd1f179cda
commit 860a2b92bf
3962 changed files with 139318 additions and 164259 deletions
@@ -0,0 +1,102 @@
///\file "visualization/vtk/.README.txt"
///\brief Example vtk README page
/*! \page Examplevtk Example vtk
This example demonstrates VTK visualisation driver. The code is based on
the basic/B1 example, although the geometry has been modified. The physical
example is a concerete dump, so a cuboid with a cylindrical hole removed.
VTK is a graphical pipeline (https://book.vtk.org/en/latest/VTKBook/04Chapter4.html#pipeline-design-and-implementation)
based renderer.
VTK has some visualisation commands which are not applicable to all viewers,
which currently include cutters, clippers and geometry overlays. The VTK commands
are in vtk.mac and you can explore apply different VTK only commands.
A- VISUALISATION
================
This example is really for demonstration of VTK and so the easiest way to start with
\verbatim
% G4VIS_DEFAULT_DRIVER=VtkQt ./exampleVtk
\endverbatim
or
\verbatim
% G4UI_USE_TCSH=1 G4VIS_DEFAULT_DRIVER=VtkNative ./exampleVtk
\endverbatim
The event loop for the UI can be blocked by the VtkNative window. So if input events
are captured by VTK, then the easiest way to exit from the viewer is to hit the 'q' button,
then you are returned to the shell UI. To restart interaction then issue the command
\verbatim
Idle> /vis/vtk/startInteractor
\endverbatim
B- USER INTERFACES
==================
VTK can be used in conjunction with all UI systems. If a shell UI is used event loop for the UI can be blocked
by the VtkNative window. So if input events are captured by VTK, then the easiest way to
exit from the viewer is to hit the 'q' button, then you are returned to the shell UI.
To restart interaction then issue the command
\verbatim
Idle> /vis/vtk/startInteractor
\endverbatim
C- HOW TO RUN
=============
Starting with VTK
\verbatim
% G4VIS_DEFAULT_DRIVER=VtkQt ./exampleVtk
\endverbatim
Executing VTK specific commands
\verbatim
Idle> /control/execute vtk.mac
\endverbatim
There are various pipelines and the state of the pipelines can be
displayed by issuing this command
\verbatim
/vis/vtk/printDebug
\endverbatim
Pipelines can be switched during operation. This is performed by calling
\verbatim
/vis/vtk/set/polyhedronPipeline (append/tensor/bake/separate)
\endverbatim
and then a subsequent
\verbatim
/vis/viewer/flush
\endverbatim
There is significantly different performance between these pipelines. Append, tensor
and bake are all designed for large models and high performance. Separate creates
a pipeline for each polyhedron, each pipeline will ultimately end with a draw call.
In general with modern pipelined shaders draw calls should be kept to a minimum.
For debugging the VTK viewer it is possible to place a head up display (HUD) which
gives key information on the viewer performance. The HUD is enabled by issuing
\verbatim
/vis/vtk/set/hud 1
\endverbatim
Stewart Boogert
7th November 2023
*/
@@ -0,0 +1,67 @@
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 3.16...3.27)
project(vtk)
#----------------------------------------------------------------------------
# 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
# Setup include directory for this project
#
include(${Geant4_USE_FILE})
include_directories(${PROJECT_SOURCE_DIR}/include)
#----------------------------------------------------------------------------
# Locate sources and headers for this project
# NB: headers are included so they will show up in IDEs
#
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(exampleVtk exampleVtk.cc ${sources} ${headers})
target_link_libraries(exampleVtk ${Geant4_LIBRARIES})
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build B1. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
set(EXAMPLEVTK_SCRIPTS
init_vis.mac
vis.mac
vtk.mac
DumpOverlayExampleDrawing.png
)
foreach(_script ${EXAMPLEVTK_SCRIPTS})
configure_file(
${PROJECT_SOURCE_DIR}/${_script}
${PROJECT_BINARY_DIR}/${_script}
COPYONLY
)
endforeach()
#----------------------------------------------------------------------------
# For internal Geant4 use - but has no effect if you build this
# example standalone
#
add_custom_target(vtk DEPENDS exampleVtk)
#----------------------------------------------------------------------------
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
#
install(TARGETS exampleVtk DESTINATION bin)
Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

@@ -0,0 +1,17 @@
# Category exam-ext-vis-vtk History
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top).
It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2023-11-14 I. Hrivnacova (exam-ext-vis-vtk-V11-01-02)
- Fixes for Doxygen:
Move class description comments after namespace
## 2023-11-07 Stewart Boogert (exam-ext-vis-vtk-V11-01-01)
- Matching Doxygen and README files
## 2023-09-27 Stewart Boogert (exam-ext-vis-vtk-V11-01-00)
- Start of vtk specific example demonstrating new features only available in VTK viewer
@@ -0,0 +1,86 @@
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Example vtk
-----------
This example demonstrates VTK visualisation driver. The code is based on
the basic/B1 example, although the geometry has been modified. The physical
example is a concerete dump, so a cuboid with a cylindrical hole removed.
VTK is a graphical pipeline (https://book.vtk.org/en/latest/VTKBook/04Chapter4.html#pipeline-design-and-implementation)
based renderer.
VTK has some visualisation commands which are not applicable to all viewers,
which currently include cutters, clippers and geometry overlays. The VTK commands
are in vtk.mac and you can explore apply different VTK only commands.
A- VISUALISATION
================
This example is really for demonstration of VTK and so the easiest way to start with
% G4VIS_DEFAULT_DRIVER=VtkQt ./exampleVtk
or
% G4UI_USE_TCSH=1 G4VIS_DEFAULT_DRIVER=VtkNative ./exampleVtk
The event loop for the UI can be blocked by the VtkNative window. So if input events
are captured by VTK, then the easiest way to exit from the viewer is to hit the 'q' button,
then you are returned to the shell UI. To restart interaction then issue the command
Idle> /vis/vtk/startInteractor
B- USER INTERFACE
=================
VTK can be used in conjunction with all UI systems. If a shell UI is used event loop for the UI can be blocked
by the VtkNative window. So if input events are captured by VTK, then the easiest way to
exit from the viewer is to hit the 'q' button, then you are returned to the shell UI.
To restart interaction then issue the command
Idle> /vis/vtk/startInteractor
C- HOW TO RUN
=============
Starting with VTK
% G4VIS_DEFAULT_DRIVER=VtkQt ./exampleVtk
Executing VTK specific commands
Idle> /control/execute vtk.mac
There are various pipelines and the state of the pipelines can be
displayed by issuing this command
Idle> /vis/vtk/printDebug
Pipelines can be switched during operation. This is performed by calling
Idle> /vis/vtk/set/polyhedronPipeline (append/tensor/bake/separate)
and then a subsequent
Idle> /vis/viewer/flush
There is significantly different performance between these pipelines. Append, tensor
and bake are all designed for large models and high performance. Separate creates
a pipeline for each polyhedron, each pipeline will ultimately end with a draw call.
In general with modern pipelined shaders draw calls should be kept to a minimum.
For debugging the VTK viewer it is possible to place a head up display (HUD) which
gives key information on the viewer performance. The HUD is enabled by issuing
Idle> /vis/vtk/set/hud 1
Stewart Boogert
7th November 2023
@@ -0,0 +1,118 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file exampleB1.cc
/// \brief Main program of the B1 example
#include "DetectorConstruction.hh"
#include "ActionInitialization.hh"
#include "G4RunManagerFactory.hh"
#include "G4SteppingVerbose.hh"
#include "G4UImanager.hh"
#include "QBBC.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#include "Randomize.hh"
#include "G4ScoringManager.hh"
using namespace VtkVis;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv)
{
// Detect interactive mode (if no arguments) and define UI session
//
G4UIExecutive* ui = nullptr;
if ( argc == 1 ) { ui = new G4UIExecutive(argc, argv); }
// Optionally: choose a different Random engine...
// G4Random::setTheEngine(new CLHEP::MTwistEngine);
//use G4SteppingVerboseWithUnits
G4int precision = 4;
G4SteppingVerbose::UseBestUnit(precision);
// Construct the default run manager
//
auto* runManager =
G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
G4ScoringManager* scoringManager = G4ScoringManager::GetScoringManager();
// Set mandatory initialization classes
//
// Detector construction
runManager->SetUserInitialization(new DetectorConstruction());
// Physics list
G4VModularPhysicsList* physicsList = new QBBC;
physicsList->SetVerboseLevel(1);
runManager->SetUserInitialization(physicsList);
// User action initialization
runManager->SetUserInitialization(new ActionInitialization());
// Initialize visualization with the default graphics system
auto visManager = new G4VisExecutive(argc, argv);
// Constructors can also take optional arguments:
// - a graphics system of choice, eg. "OGL"
// - and a verbosity argument - see /vis/verbose guidance.
// auto visManager = new G4VisExecutive(argc, argv, "OGL", "Quiet");
// auto visManager = new G4VisExecutive("Quiet");
visManager->Initialize();
// Get the pointer to the User Interface manager
G4UImanager* UImanager = G4UImanager::GetUIpointer();
// Process macro or start UI session
//
if ( ! ui ) {
// batch mode
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
}
else {
// interactive mode
UImanager->ApplyCommand("/control/execute init_vis.mac");
ui->SessionStart();
delete ui;
}
// Job termination
// Free the store: user actions, physics_list and detector_description are
// owned and deleted by the run manager, so they should not be deleted
// in the main() program !
delete visManager;
delete runManager;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -0,0 +1,16 @@
# Macro file for example B1 test
/run/initialize
# gamma 6 MeV
/gun/particle gamma
/gun/energy 6 MeV
#
/run/printProgress 100
/run/beamOn 1000
#
# proton 210 MeV
/gun/particle proton
/gun/energy 210 MeV
#
/run/beamOn 1000
@@ -0,0 +1,54 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file B1/include/ActionInitialization.hh
/// \brief Definition of the B1::ActionInitialization class
#ifndef B1ActionInitialization_h
#define B1ActionInitialization_h 1
#include "G4VUserActionInitialization.hh"
namespace VtkVis
{
/// Action initialization class.
class ActionInitialization : public G4VUserActionInitialization
{
public:
ActionInitialization() = default;
~ActionInitialization() override = default;
void BuildForMaster() const override;
void Build() const override;
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,62 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file B1/include/DetectorConstruction.hh
/// \brief Definition of the B1::DetectorConstruction class
#ifndef B1DetectorConstruction_h
#define B1DetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
class G4VPhysicalVolume;
class G4LogicalVolume;
namespace VtkVis
{
/// Detector construction class to define materials and geometry.
class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
DetectorConstruction() = default;
~DetectorConstruction() override = default;
G4VPhysicalVolume* Construct() override;
G4LogicalVolume* GetScoringVolume() const { return fScoringVolume; }
protected:
G4LogicalVolume* fScoringVolume = nullptr;
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,65 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file B1/include/EventAction.hh
/// \brief Definition of the B1::EventAction class
#ifndef B1EventAction_h
#define B1EventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
namespace VtkVis
{
class RunAction;
/// Event action class
class EventAction : public G4UserEventAction
{
public:
EventAction(RunAction* runAction);
~EventAction() override = default;
void BeginOfEventAction(const G4Event* event) override;
void EndOfEventAction(const G4Event* event) override;
void AddEdep(G4double edep) { fEdep += edep; }
private:
RunAction* fRunAction = nullptr;
G4double fEdep = 0.;
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,70 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file B1/include/PrimaryGeneratorAction.hh
/// \brief Definition of the B1::PrimaryGeneratorAction class
#ifndef B1PrimaryGeneratorAction_h
#define B1PrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "G4ParticleGun.hh"
#include "globals.hh"
class G4ParticleGun;
class G4Event;
class G4Box;
namespace VtkVis
{
/// The primary generator action class with particle gun.
///
/// The default kinematic is a 6 MeV gamma, randomly distribued
/// in front of the phantom across 80% of the (X,Y) phantom size.
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PrimaryGeneratorAction();
~PrimaryGeneratorAction() override;
// method from the base class
void GeneratePrimaries(G4Event*) override;
// method to access particle gun
const G4ParticleGun* GetParticleGun() const { return fParticleGun; }
private:
G4ParticleGun* fParticleGun = nullptr; // pointer a to G4 gun class
G4Box* fEnvelopeBox = nullptr;
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,67 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file B1/include/RunAction.hh
/// \brief Definition of the B1::RunAction class
#ifndef B1RunAction_h
#define B1RunAction_h 1
#include "G4UserRunAction.hh"
#include "G4Accumulable.hh"
#include "globals.hh"
class G4Run;
namespace VtkVis
{
/// Run action class
///
/// In EndOfRunAction(), it calculates the dose in the selected volume
/// from the energy deposit accumulated via stepping and event actions.
/// The computed dose is then printed on the screen.
class RunAction : public G4UserRunAction
{
public:
RunAction();
~RunAction() override = default;
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
void AddEdep (G4double edep);
private:
G4Accumulable<G4double> fEdep = 0.;
G4Accumulable<G4double> fEdep2 = 0.;
};
}
#endif
@@ -0,0 +1,63 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file B1/include/SteppingAction.hh
/// \brief Definition of the B1::SteppingAction class
#ifndef B1SteppingAction_h
#define B1SteppingAction_h 1
#include "G4UserSteppingAction.hh"
#include "globals.hh"
class G4LogicalVolume;
namespace VtkVis
{
class EventAction;
/// Stepping action class
class SteppingAction : public G4UserSteppingAction
{
public:
SteppingAction(EventAction* eventAction);
~SteppingAction() override = default;
// method from the base class
void UserSteppingAction(const G4Step*) override;
private:
EventAction* fEventAction = nullptr;
G4LogicalVolume* fScoringVolume = nullptr;
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,16 @@
# Macro file for the initialization of example B1
# in interactive session
#
# Set some default verbose
/control/verbose 2
/control/saveHistory
/run/verbose 2
#
# Change the default number of threads (in multi-threaded mode)
#/run/numberOfThreads 4
#
# Initialize kernel
/run/initialize
#
# Visualization setting
/control/execute vis.mac
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file B1/src/ActionInitialization.cc
/// \brief Implementation of the B1::ActionInitialization class
#include "ActionInitialization.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
#include "SteppingAction.hh"
namespace VtkVis
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ActionInitialization::BuildForMaster() const
{
auto runAction = new RunAction;
SetUserAction(runAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ActionInitialization::Build() const
{
SetUserAction(new PrimaryGeneratorAction);
auto runAction = new RunAction;
SetUserAction(runAction);
auto eventAction = new EventAction(runAction);
SetUserAction(eventAction);
SetUserAction(new SteppingAction(eventAction));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -0,0 +1,140 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file B1/src/DetectorConstruction.cc
/// \brief Implementation of the B1::DetectorConstruction class
#include <cmath>
#include "DetectorConstruction.hh"
#include "G4RunManager.hh"
#include "G4NistManager.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4SubtractionSolid.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4SystemOfUnits.hh"
namespace VtkVis
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction::Construct()
{
// Get nist material manager
G4NistManager* nist = G4NistManager::Instance();
// Envelope parameters
//
G4double env_sizeXY = 10*m, env_sizeZ = 10*m;
G4Material* env_mat = nist->FindOrBuildMaterial("G4_Galactic");
// Option to switch on/off checking of volumes overlaps
//
G4bool checkOverlaps = true;
//
// World
//
G4double world_sizeXY = 1.2*env_sizeXY;
G4double world_sizeZ = 1.2*env_sizeZ;
G4Material* world_mat = nist->FindOrBuildMaterial("G4_AIR");
auto solidWorld = new G4Box("World", // its name
0.5 * world_sizeXY, 0.5 * world_sizeXY, 0.5 * world_sizeZ); // its size
auto logicWorld = new G4LogicalVolume(solidWorld, // its solid
world_mat, // its material
"World"); // its name
auto physWorld = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(), // at (0,0,0)
logicWorld, // its logical volume
"World", // its name
nullptr, // its mother volume
false, // no boolean operation
0, // copy number
checkOverlaps); // overlaps checking
//
// Envelope
//
auto solidEnv = new G4Box("Envelope", // its name
0.5 * env_sizeXY, 0.5 * env_sizeXY, 0.5 * env_sizeZ); // its size
auto logicEnv = new G4LogicalVolume(solidEnv, // its solid
env_mat, // its material
"Envelope"); // its name
new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(), // at (0,0,0)
logicEnv, // its logical volume
"Envelope", // its name
logicWorld, // its mother volume
false, // no boolean operation
0, // copy number
checkOverlaps); // overlaps checking
auto dumpPos = G4ThreeVector(0, 0, 0);
auto dumpMat = nist->FindOrBuildMaterial("G4_CONCRETE");
auto dumpShape1 = new G4Box("dumpShape1", 1*m, 1*m, 0.5*m);
auto dumpCutoutPos = G4ThreeVector(0, 0, -5.1*cm);
auto dumpCutoutShape = new G4Tubs("DumpCutoutShape", 0*cm, 10*cm, 90/2*cm, 0, 2*M_PI);
auto dumpShape2 = new G4SubtractionSolid("dumpShape2",dumpShape1, dumpCutoutShape, 0,
dumpCutoutPos);
auto dumpLogical = new G4LogicalVolume(dumpShape2,
dumpMat, // its material
"dump");
// its name
new G4PVPlacement(nullptr, // no rotation
dumpPos, // at position
dumpLogical, // its logical volume
"dump", // its name
logicEnv, // its mother volume
false, // no boolean operation
0, // copy number
checkOverlaps); // overlaps checking
fScoringVolume = dumpLogical;
//
//always return the physical World
//
return physWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -0,0 +1,62 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file B1/src/EventAction.cc
/// \brief Implementation of the B1::EventAction class
#include "EventAction.hh"
#include "RunAction.hh"
#include "G4Event.hh"
#include "G4RunManager.hh"
namespace VtkVis
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventAction::EventAction(RunAction* runAction)
: fRunAction(runAction)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::BeginOfEventAction(const G4Event*)
{
fEdep = 0.;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::EndOfEventAction(const G4Event*)
{
// accumulate statistics in run action
fRunAction->AddEdep(fEdep);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -0,0 +1,117 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file B1/src/PrimaryGeneratorAction.cc
/// \brief Implementation of the B1::PrimaryGeneratorAction class
#include "PrimaryGeneratorAction.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4LogicalVolume.hh"
#include "G4Box.hh"
#include "G4RunManager.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
#include "Randomize.hh"
namespace VtkVis
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::PrimaryGeneratorAction()
{
G4int n_particle = 1;
fParticleGun = new G4ParticleGun(n_particle);
// default particle kinematic
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
G4ParticleDefinition* particle
= particleTable->FindParticle(particleName="e-");
fParticleGun->SetParticleDefinition(particle);
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
fParticleGun->SetParticleEnergy(16.5*GeV);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::~PrimaryGeneratorAction()
{
delete fParticleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
//this function is called at the begining of ecah event
//
// In order to avoid dependence of PrimaryGeneratorAction
// on DetectorConstruction class we get Envelope volume
// from G4LogicalVolumeStore.
G4double envSizeXY = 0;
G4double envSizeZ = 0;
if (!fEnvelopeBox)
{
G4LogicalVolume* envLV
= G4LogicalVolumeStore::GetInstance()->GetVolume("Envelope");
if ( envLV ) fEnvelopeBox = dynamic_cast<G4Box*>(envLV->GetSolid());
}
if ( fEnvelopeBox ) {
envSizeXY = fEnvelopeBox->GetXHalfLength()*2.;
envSizeZ = fEnvelopeBox->GetZHalfLength()*2.;
}
else {
G4ExceptionDescription msg;
msg << "Envelope volume of box shape not found.\n";
msg << "Perhaps you have changed geometry.\n";
msg << "The gun will be place at the center.";
G4Exception("PrimaryGeneratorAction::GeneratePrimaries()",
"MyCode0002",JustWarning,msg);
}
G4double size = 0.8;
G4double x0 = size * envSizeXY * (G4UniformRand()-0.5);
G4double y0 = size * envSizeXY * (G4UniformRand()-0.5);
G4double z0 = 0.5*envSizeZ;
fParticleGun->SetParticlePosition(G4ThreeVector(0,0,-z0));
fParticleGun->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -0,0 +1,156 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file B1/src/RunAction.cc
/// \brief Implementation of the B1::RunAction class
#include "RunAction.hh"
#include "PrimaryGeneratorAction.hh"
#include "DetectorConstruction.hh"
// #include "Run.hh"
#include "G4RunManager.hh"
#include "G4Run.hh"
#include "G4AccumulableManager.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4LogicalVolume.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
namespace VtkVis
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::RunAction()
{
// add new units for dose
//
const G4double milligray = 1.e-3*gray;
const G4double microgray = 1.e-6*gray;
const G4double nanogray = 1.e-9*gray;
const G4double picogray = 1.e-12*gray;
new G4UnitDefinition("milligray", "milliGy" , "Dose", milligray);
new G4UnitDefinition("microgray", "microGy" , "Dose", microgray);
new G4UnitDefinition("nanogray" , "nanoGy" , "Dose", nanogray);
new G4UnitDefinition("picogray" , "picoGy" , "Dose", picogray);
// Register accumulable to the accumulable manager
G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance();
accumulableManager->RegisterAccumulable(fEdep);
accumulableManager->RegisterAccumulable(fEdep2);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::BeginOfRunAction(const G4Run*)
{
// inform the runManager to save random number seed
G4RunManager::GetRunManager()->SetRandomNumberStore(false);
// reset accumulables to their initial values
G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance();
accumulableManager->Reset();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::EndOfRunAction(const G4Run* run)
{
G4int nofEvents = run->GetNumberOfEvent();
if (nofEvents == 0) return;
// Merge accumulables
G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance();
accumulableManager->Merge();
// Compute dose = total energy deposit in a run and its variance
//
G4double edep = fEdep.GetValue();
G4double edep2 = fEdep2.GetValue();
G4double rms = edep2 - edep*edep/nofEvents;
if (rms > 0.) rms = std::sqrt(rms); else rms = 0.;
const auto detConstruction = static_cast<const DetectorConstruction*>(
G4RunManager::GetRunManager()->GetUserDetectorConstruction());
G4double mass = detConstruction->GetScoringVolume()->GetMass();
G4double dose = edep/mass;
G4double rmsDose = rms/mass;
// Run conditions
// note: There is no primary generator action object for "master"
// run manager for multi-threaded mode.
const auto generatorAction = static_cast<const PrimaryGeneratorAction*>(
G4RunManager::GetRunManager()->GetUserPrimaryGeneratorAction());
G4String runCondition;
if (generatorAction)
{
const G4ParticleGun* particleGun = generatorAction->GetParticleGun();
runCondition += particleGun->GetParticleDefinition()->GetParticleName();
runCondition += " of ";
G4double particleEnergy = particleGun->GetParticleEnergy();
runCondition += G4BestUnit(particleEnergy,"Energy");
}
// Print
//
if (IsMaster()) {
G4cout
<< G4endl
<< "--------------------End of Global Run-----------------------";
}
else {
G4cout
<< G4endl
<< "--------------------End of Local Run------------------------";
}
G4cout
<< G4endl
<< " The run consists of " << nofEvents << " "<< runCondition
<< G4endl
<< " Cumulated dose per run, in scoring volume : "
<< G4BestUnit(dose,"Dose") << " rms = " << G4BestUnit(rmsDose,"Dose")
<< G4endl
<< "------------------------------------------------------------"
<< G4endl
<< G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::AddEdep(G4double edep)
{
fEdep += edep;
fEdep2 += edep*edep;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -0,0 +1,73 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file B1/src/SteppingAction.cc
/// \brief Implementation of the B1::SteppingAction class
#include "SteppingAction.hh"
#include "EventAction.hh"
#include "DetectorConstruction.hh"
#include "G4Step.hh"
#include "G4Event.hh"
#include "G4RunManager.hh"
#include "G4LogicalVolume.hh"
namespace VtkVis
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::SteppingAction(EventAction* eventAction)
: fEventAction(eventAction)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SteppingAction::UserSteppingAction(const G4Step* step)
{
if (!fScoringVolume) {
const auto detConstruction = static_cast<const DetectorConstruction*>(
G4RunManager::GetRunManager()->GetUserDetectorConstruction());
fScoringVolume = detConstruction->GetScoringVolume();
}
// get volume of the current step
G4LogicalVolume* volume
= step->GetPreStepPoint()->GetTouchableHandle()
->GetVolume()->GetLogicalVolume();
// check if we are in scoring volume
if (volume != fScoringVolume) return;
// collect energy deposited in this step
G4double edepStep = step->GetTotalEnergyDeposit();
fEventAction->AddEdep(edepStep);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
+126
View File
@@ -0,0 +1,126 @@
# Macro file for the visualization setting in the initialization phase
# of the B1 example when running in interactive mode
#
/vis/open Vtk
# Specify a viewer, e.g., /vis/open OGL, or allow a system choice:
/vis/open
# This chooses a graphics system (in order of priority):
# - by argument in G4VisExecutive construction.
# - by environment variable, G4VIS_DEFAULT_DRIVER.
# - by information in ~/.g4session.
# - by mode (batch/interactive) and if interactive, by your build flags.
# See "Choosing a graphics viewer" in the Application Guide for details.
# For example, with environment variable G4VIS_DEFAULT_DRIVER:
# The format is <graphics-system> [<window-size-hint>]. Set this, e.g:
# (bash) export G4VIS_DEFAULT_DRIVER=TSG
# (tcsh) setenv G4VIS_DEFAULT_DRIVER OI
# or on the command line, precede the app invocation, e.g:
# G4VIS_DEFAULT_DRIVER=Vtk ./<application-name>
# The window-size-hint can optionally be added, e.g:
# (bash) export G4VIS_DEFAULT_DRIVER="OGLSX 1000x1000-0+0"
# Other suggestions for G4VIS_DEFAULT_DRIVER (see list of registered
# graphics systems printed at the start):
# DAWNFILE: to create a .prim file suitable for viewing in DAWN.
# HepRepFile: to create a .heprep file suitable for viewing in HepRApp.
# VRML2FILE: to create a .wrl file suitable for viewing in a VRML viewer.
# "TSG_OFFSCREEN 1200x1200": to create an image file with TSG.
# See the tsg_offscreen.mac in examples/basic/B1 for more commands
# to change the file format, file name, picture size, etc.
# Disable auto refresh and quieten vis messages whilst scene and
# trajectories are established:
/vis/viewer/set/autoRefresh false
/vis/verbose errors
#
# Draw geometry:
/vis/drawVolume
#
# Specify view angle:
/vis/viewer/set/viewpointVector -1 0 0
/vis/viewer/set/lightsVector -1 0 0
#
# Specify style (surface, wireframe, auxiliary edges,...)
/vis/viewer/set/style wireframe
/vis/viewer/set/auxiliaryEdge true
/vis/viewer/set/lineSegmentsPerCircle 100
#
# Draw smooth trajectories at end of event, showing trajectory points
# as markers 2 pixels wide:
/vis/scene/add/trajectories smooth
/vis/modeling/trajectories/create/drawByCharge
/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true
/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2
# (if too many tracks cause core dump => /tracking/storeTrajectory 0)
#
# Draw hits at end of event:
#/vis/scene/add/hits
#
# To draw only gammas:
#/vis/filtering/trajectories/create/particleFilter
#/vis/filtering/trajectories/particleFilter-0/add gamma
#
# To invert the above, drawing all particles except gammas,
# keep the above two lines but also add:
#/vis/filtering/trajectories/particleFilter-0/invert true
#
# Many other options are available with /vis/modeling and /vis/filtering.
# For example, to select colour by particle ID:
#/vis/modeling/trajectories/create/drawByParticleID
#/vis/modeling/trajectories/drawByParticleID-0/default/setDrawStepPts true
# To select or override default colours (note: e+ is blue by default):
#/vis/modeling/trajectories/list
#/vis/modeling/trajectories/drawByParticleID-0/set e+ yellow
#
# To superimpose all of the events from a given run:
/vis/scene/endOfEventAction accumulate
#
# Decorations
# Name
/vis/set/textColour green
/vis/set/textLayout right
/vis/scene/add/text2D 0.9 -.9 24 ! ! VTK-example
# or, if your system does not support right-adjustment
#/vis/scene/add/text2D 0 -.9 24 ! ! VTK-example
/vis/set/textLayout # Revert to normal (left adjusted) layout
/vis/set/textColour # Revert to default text colour (blue)
#
# Axes, scale, etc.
/vis/scene/add/scale # Simple scale line
/vis/scene/add/axes # Simple axes: x=red, y=green, z=blue.
/vis/scene/add/eventID # Drawn at end of event
/vis/scene/add/date # Date stamp
/vis/scene/add/logo2D # Simple logo
/vis/scene/add/logo # 3D logo
#
# Frame
/vis/set/colour red
/vis/set/lineWidth 2
/vis/scene/add/frame # Simple frame around the view
/vis/set/colour # Revert to default colour (white)
/vis/set/lineWidth # Revert to default line width (1.)
#
# Attach text to one edge of Shape1, with a small, fixed offset
/vis/scene/add/text 0 6 -4 cm 18 4 4 Shape1
# Attach text to one corner of Shape2, with a small, fixed offset
/vis/scene/add/text 6 7 10 cm 18 4 4 Shape2
#
# To get nice view
# Make the "World" box invisible
/vis/geometry/set/visibility World 0 false
# "Envelope" is transparent blue to represent water
/vis/geometry/set/colour Envelope 0 0 0 1 .3
/vis/viewer/set/style surface
/vis/viewer/set/hiddenMarker true
/vis/viewer/set/viewpointThetaPhi 120 150
#
# Re-establish auto refreshing and verbosity:
/vis/viewer/set/autoRefresh true
/vis/verbose warnings
#
# For file-based drivers, use this to create an empty detector view:
#/vis/viewer/flush
@@ -0,0 +1,55 @@
/vis/viewer/set/background white
# export screen shot
#/vis/vtk/export bmp exampleVtk
# export screen shot
#/vis/vtk/export ps exampleVtk
# export screen shot
#/vis/vtk/export jpg exampleVtk
# export screen shot
#/vis/vtk/export png exampleVtk
# export screen shot
#/vis/vtk/export tiff exampleVtk
# export to VTP file
/vis/vtk/export vtp exampleVtk
# export to VRML file
/vis/vtk/export vrml exampleVtk
# export to OBJ file
/vis/vtk/export obj exampleVtkObj
# set cutter
/vis/vtk/set/cutter
/vis/vtk/exportCutter exampleVtkCutter.vtp
# set clipper
/vis/vtk/set/clipper
# set hud
/vis/vtk/set/hud 1
# set orientation widget
/vis/vtk/set/orientation 1
# add overlay
# 477 511 -2m -2m
# 870 117 2m 2m
/vis/vtk/add/imageOverlay DumpOverlayExampleDrawing.png 425 370 707 87 -1000 -1000 1000 1000 0 0 0 0 0 0
# 117 511 -0.5m -2m
# 314 117 0.5m 2m
/vis/vtk/add/imageOverlay DumpOverlayExampleDrawing.png 165 370 307 97 -500 -1000 500 1000 0 -90 0 0 0 0
# dump vtk viewer state
/vis/vtk/printDebug
# append pipeline
/vis/vtk/set/polyhedronPipeline tensor
/vis/viewer/refresh
/vis/vtk/printDebug
# define scoring mesh
/score/create/boxMesh boxMesh
/score/mesh/boxSize 20. 20. 200. cm
/score/mesh/nBin 50 50 50
/score/quantity/energyDeposit edepScorer MeV
/score/filter/particle elecFilter e-
/score/close