diff --git a/examples/basic/B1/B1/.README.txt b/examples/basic/B1/B1/.README.txt
new file mode 100644
index 0000000..7f471b1
--- /dev/null
+++ b/examples/basic/B1/B1/.README.txt
@@ -0,0 +1,197 @@
+
+///\file "B1/.README.txt"
+///\brief Example B1 README page
+
+/*! \page ExampleB1 Example B1
+
+ This example demonstrates a very simple application where an energy
+ deposit is accounted in user actions and their associated objects
+ and a dose in a selected volume is calculated.
+
+\section B1_s1 GEOMETRY DEFINITION
+
+ The geometry is constructed in the B1DetectorConstruction class.
+ The setup consists of a an envelope of box shape containing two
+ volumes: a spherical cone and a trapezoid.
+
+ In this example we use some common materials materials for medical
+ applications. The envelope is made of water and the two inner volumes
+ are made from tissue and bone materials.
+ The materials are created with the help of the G4NistManager class,
+ which allows to build a material from the NIST database using their
+ names. Available materials and their compositions can be found in
+
+ the Geant4 User's Guide for Application Developers, Appendix 10:
+ Geant4 Materials Database
+ .
+
+\section B1_s2 PHYSICS LIST
+
+ The particle's type and the physic processes which will be available
+ in this example are set in the QBBC physics list. This physics list
+ requires data files for electromagnetic and hadronic processes.
+ See more on installation of the datasets in
+
+ Geant4 Installation Guide, Chapter 3.3: Note On Geant4 Datasets .
+ The following datasets: G4LEDATA, G4LEVELGAMMADATA, G4NEUTRONXSDATA,
+ G4SAIDXSDATA and G4ENSDFSTATEDATA are mandatory for this example.
+
+ In addition the build-in interactive command:
+\verbatim
+/process/(in)activate processName
+\endverbatim
+ allows to activate/inactivate the processes one by one.
+
+\section B1_s3 ACTION INITALIZATION
+
+ A newly introduced class, B1ActionInitialization, instantiates and registers
+ to Geant4 kernel all user action classes.
+
+ While in sequential mode the action classes are instatiated just once,
+ via invoking the method:
+ B1ActionInitialization::Build()
+ in multi-threading mode the same method is invoked for each thread worker
+ and so all user action classes are defined thread-local.
+
+ A run action class is instantiated both thread-local
+ and global that's why its instance is created also in the method
+ B1ActionInitialization::BuildForMaster()
+ which is invoked only in multi-threading mode.
+
+\section B1_s4 PRIMARY GENERATOR
+
+ The primary generator is defined in the B1PrimaryGeneratorAction class.
+ The default kinematics is a 6 MeV gamma, randomly distributed in front
+ of the envelope across 80% of the transverse (X,Y) envelope size.
+ This default setting can be changed via the Geant4 built-in commands
+ of the G4ParticleGun class.
+
+\section B1_s5 DETECTOR RESPONSE
+
+ This example demonstrates a simple scoring implemented directly
+ in the user action classes. Alternative ways of scoring via Geant4 classes
+ can be found in the other examples.
+
+ The energy deposited is collected step by step for a selected volume
+ in B1SteppingAction and accumulated event by event in B1EventAction.
+
+ At end of event, the value acummulated in B1EventAction is added in B1RunAction
+ and summed over the whole run (see B1EventAction::EndOfevent()).
+
+ Total dose deposited is computed at B1RunAction::EndOfRunAction(),
+ and printed together with informations about the primary particle.
+ In multi-threading mode the energy accumulated in G4Accumulable objects per
+ workers is merged to the master in B1RunAction::EndOfRunAction() and the final
+ result is printed on the screen.
+
+ G4Accumulable type instead of G4double type is used for the B1RunAction
+ data members in order to facilitate merging of the values accumulated on workers
+ to the master. Currently the accumulables have to be registered to G4AccumulablesManager
+ and G4AccumulablesManager::Merge() has to be called from the users code. This is planned
+ to be further simplified with a closer integration of G4Accumulable classes in
+ the Geant4 kernel next year.
+
+ An example of creating and computing new units (e.g., dose) is also shown
+ in the class constructor.
+
+
+
+The following paragraphs are common to all basic examples
+
+\section B1_A VISUALISATION
+
+ The visualization manager is set via the G4VisExecutive class
+ in the main() function in exampleB1.cc.
+ The initialisation of the drawing is done via a set of /vis/ commands
+ in the macro vis.mac. This macro is automatically read from
+ the main function when the example is used in interactive running mode.
+
+ By default, vis.mac opens an OpenGL viewer (/vis/open OGL).
+ The user can change the initial viewer by commenting out this line
+ and instead uncommenting one of the other /vis/open statements, such as
+ HepRepFile or DAWNFILE (which produce files that can be viewed with the
+ HepRApp and DAWN viewers, respectively). Note that one can always
+ open new viewers at any time from the command line. For example, if
+ you already have a view in, say, an OpenGL window with a name
+ "viewer-0", then
+\verbatim
+/vis/open DAWNFILE
+\endverbatim
+ then to get the same view
+\verbatim
+/vis/viewer/copyView viewer-0
+\endverbatim
+ or to get the same view *plus* scene-modifications
+\verbatim
+/vis/viewer/set/all viewer-0
+\endverbatim
+ then to see the result
+\verbatim
+/vis/viewer/flush
+\endverbatim
+
+ The DAWNFILE, HepRepFile drivers are always available
+ (since they require no external libraries), but the OGL driver requires
+ that the Geant4 libraries have been built with the OpenGL option.
+
+ From Release 9.6 the vis.mac macro in example B1 has additional commands
+ that demonstrate additional functionality of the vis system, such as
+ displaying text, axes, scales, date, logo and shows how to change
+ viewpoint and style. Consider copying these to other examples or
+ your application. To see even more commands use help or
+ ls or browse the available UI commands in the Application
+ Developers Guide, Section 7.1.
+
+ For more information on visualization, including information on how to
+ install and run DAWN, OpenGL and HepRApp, see the visualization tutorials,
+ for example,\n
+ -
+ OpenGL Tutorial
+ -
+ DAWN Tutorial
+ -
+ HepRApp Tutorial
+
+ The tracks are automatically drawn at the end of each event, accumulated
+ for all events and erased at the beginning of the next run.
+
+
+\section B1_B USER INTERFACES
+
+ The user command interface is set via the G4UIExecutive class
+ in the main() function in exampleB1.cc
+ The selection of the user command interface is then done automatically
+ according to the Geant4 configuration or it can be done explicitly via
+ the third argument of the G4UIExecutive constructor (see exampleB4a.cc).
+
+\section B1_C HOW TO RUN
+
+ - Execute exampleB1 in the 'interactive mode' with visualization
+\verbatim
+% exampleB1
+and type in the commands from run1.mac line by line:
+Idle> /control/verbose 2
+Idle> /tracking/verbose 1
+Idle> /run/beamOn 10
+Idle> ...
+Idle> exit
+\endverbatim
+ or
+\verbatim
+Idle> /control/execute run1.mac
+....
+Idle> exit
+\endverbatim
+
+ - Execute exampleB1 in the 'batch' mode from macro files
+ (without visualization)
+\verbatim
+% exampleB1 run2.mac
+% exampleB1 exampleB1.in > exampleB1.out
+\endverbatim
+
+*/
+
+
diff --git a/examples/basic/B1/B1/CMakeLists.txt b/examples/basic/B1/B1/CMakeLists.txt
new file mode 100644
index 0000000..f299313
--- /dev/null
+++ b/examples/basic/B1/B1/CMakeLists.txt
@@ -0,0 +1,72 @@
+#----------------------------------------------------------------------------
+# Setup the project
+cmake_minimum_required(VERSION 3.8...3.18)
+if(${CMAKE_VERSION} VERSION_LESS 3.12)
+ cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
+endif()
+project(B1)
+
+#----------------------------------------------------------------------------
+# 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(exampleB1 exampleB1.cc ${sources} ${headers})
+target_link_libraries(exampleB1 ${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(EXAMPLEB1_SCRIPTS
+ exampleB1.in
+ exampleB1.out
+ init_vis.mac
+ run1.mac
+ run2.mac
+ vis.mac
+ )
+
+foreach(_script ${EXAMPLEB1_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(B1 DEPENDS exampleB1)
+
+#----------------------------------------------------------------------------
+# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
+#
+install(TARGETS exampleB1 DESTINATION bin)
diff --git a/examples/basic/B1/B1/GNUmakefile b/examples/basic/B1/B1/GNUmakefile
new file mode 100644
index 0000000..763f9ef
--- /dev/null
+++ b/examples/basic/B1/B1/GNUmakefile
@@ -0,0 +1,21 @@
+# --------------------------------------------------------------
+# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
+# --------------------------------------------------------------
+
+name := exampleB1
+G4TARGET := $(name)
+G4EXLIB := true
+
+ifndef G4INSTALL
+ G4INSTALL = ../../..
+endif
+
+.PHONY: all
+all: lib bin
+
+include $(G4INSTALL)/config/binmake.gmk
+
+visclean:
+ rm -f g4*.prim g4*.eps g4*.wrl
+ rm -f .DAWN_*
+
diff --git a/examples/basic/B1/B1/History b/examples/basic/B1/B1/History
new file mode 100644
index 0000000..6b1d365
--- /dev/null
+++ b/examples/basic/B1/B1/History
@@ -0,0 +1,103 @@
+-------------------------------------------------------------------
+
+ =========================================================
+ Geant4 - an Object-Oriented Toolkit for Simulation in HEP
+ =========================================================
+
+ Example B1 History file
+ -----------------------
+This file should be used by the G4 example coordinator to briefly
+summarize all major modifications introduced in the code and keep
+track of all tags.
+
+ ----------------------------------------------------------
+ * Reverse chronological order (last date on top), please *
+ ----------------------------------------------------------
+
+02/11/20 B.Morgan (exampleB1-V10-06-01)
+- Support same CMake version range as core Geant4
+
+30/06/20 G. Cosmo (exampleB1-V10-06-00)
+- Migrated to use G4RunManagerFactory, therefore implicitly enabling
+ tasking by default in MT builds.
+
+21/11/19 G. Cosmo (exampleB1-V10-05-00)
+- Use default MixMax random engine.
+
+26/09/16 I. Hrivnacova (exampleB1-V10-02-01)
+- Updated for renaming G4Parameter in G4Accumulable
+
+20/09/16 J. Allison (exampleB1-V10-02-00)
+- vis.mac: Added this to make "Envelope" transparent blue:
+ # "Envelope" is transparent blue to represent water
+ /vis/geometry/set/colour Envelope 0 0 0 1 .3
+
+02/11/15 I. Hrivnacova (exampleB1-V10-01-03)
+- B1Run class replaced with a code based on G4Parameter
+
+04/05/15 I. Hrivnacova (exampleB1-V10-01-02)
+- Coding guidelines: removed empty lines
+
+23/04/15 mma (exampleB1-V10-01-01)
+- RunAction : come back to previous formula
+
+21/04/15 mma (exampleB1-V10-01-00)
+- RunAction : correct calculation of rmsEdep
+
+29/11/14 I. Hrivnacova
+- Use G4endl instead of \n in G4cout;
+ this makes each new line in the output on threads preceded with
+ G4WTN >
+
+06/11/14 I. Hrivnacova
+- Removed G4UI_USE/G4VIS_USE tests and init.mac macro (not needed)
+- Moved G4UIExecutive at the beginning of main() in all examples
+- Perform run initialization in macros instead of main()
+
+28/10/13 I. Hrivnacova (exampleB1-V09-06-06)
+- Removed SetNumberOfThreads(4) from main (use Geant4 default)
+
+26/10/13 mma (exampleB1-V09-06-05)
+- Use /run/printProgress. Cleanup in EventAction
+
+08/10/13 I. Hrivnacova (exampleB1-V09-06-04)
+- Removed B1EventInformation for keeping maximum simplicity
+- Improved documentation (added paragraph on Run::Merge())
+- Code clean-up
+
+09/06/13 I. Hrivnacova (exampleB1-V09-06-03)
+- clarify local names in user actions
+
+05/06/13 mma (exampleB1-V09-06-02)
+- add section about ACTION INITALIZATION to README and .README
+- update section DETECTOR RESPONSE
+
+05/05/13 I. Hrivnacova (exampleB1-V09-06-01)
+- Migration for MT (by Makoto):
+ Added B1ActionInitialization, B1EventInformation and B1Run classes
+ and updated actions classes accordingly.
+ README files still need to be updated.
+
+15/01/13 I. Hrivnacova (exampleB1-V09-06-00)
+- Tag for a test only (g4svn update with svn 1.7.x)
+
+13/11/12 I. Hrivnacova (exampleB1-V09-05-03)
+- Use QBBC physics list instead of QGSP_BIC_EMY, which becomes
+ obsolete
+
+02/11/12 J. Allison (exampleB1-V09-05-01 and 02)
+- README: Improved.
+
+02/11/12 J. Allison (exampleB1-V09-05-00)
+- vis.mac: Improved view and added text, scale, logo etc. to scene.
+
+14/11/11 I. Hrivnacova
+- The first tagged version of the new B1 example
+ (tagged in basic)
+
+31/10/11 I. Hrivnacova
+- change volume names
+- scoring in 1 volume only, with new scheme
+
+05/09/11 M. Maire, P. Gueye
+- Created.
diff --git a/examples/basic/B1/B1/README b/examples/basic/B1/B1/README
new file mode 100644
index 0000000..47bf50f
--- /dev/null
+++ b/examples/basic/B1/B1/README
@@ -0,0 +1,172 @@
+-------------------------------------------------------------------
+
+ =========================================================
+ Geant4 - an Object-Oriented Toolkit for Simulation in HEP
+ =========================================================
+
+ Example B1
+ -----------
+
+ This example demonstrates a very simple application where an energy
+ deposit is accounted in user actions and their associated objects
+ and a dose in a selected volume is calculated.
+
+
+ 1- GEOMETRY DEFINITION
+
+ The geometry is constructed in the B1DetectorConstruction class.
+ The setup consists of a an envelope of box shape containing two
+ volumes: a spherical cone and a trapezoid.
+
+ In this example we use some common materials materials for medical
+ applications. The envelope is made of water and the two inner volumes
+ are made from tissue and bone materials.
+ The materials are created with the help of the G4NistManager class,
+ which allows to build a material from the NIST database using their
+ names. All available materials can be found in the Geant4 User's Guide
+ for Application Developers, Appendix 10: Geant4 Materials Database.
+
+ 2- PHYSICS LIST
+
+ The particle's type and the physic processes which will be available
+ in this example are set in the QBBC physics list. This physics list
+ requires data files for electromagnetic and hadronic processes.
+ See more on installation of the datasets in Geant4 Installation Guide,
+ Chapter 3.3: Note On Geant4 Datasets:
+ http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides
+ /InstallationGuide/html/ch03s03.html
+ The following datasets: G4LEDATA, G4LEVELGAMMADATA, G4NEUTRONXSDATA,
+ G4SAIDXSDATA and G4ENSDFSTATEDATA are mandatory for this example.
+
+ In addition the build-in interactive command:
+ /process/(in)activate processName
+ allows to activate/inactivate the processes one by one.
+
+ 3- ACTION INITALIZATION
+
+ A newly introduced class, B1ActionInitialization, instantiates and registers
+ to Geant4 kernel all user action classes.
+
+ While in sequential mode the action classes are instatiated just once,
+ via invoking the method:
+ B1ActionInitialization::Build()
+ in multi-threading mode the same method is invoked for each thread worker
+ and so all user action classes are defined thread-local.
+
+ A run action class is instantiated both thread-local
+ and global that's why its instance is created also in the method
+ B1ActionInitialization::BuildForMaster()
+ which is invoked only in multi-threading mode.
+
+ 4- PRIMARY GENERATOR
+
+ The primary generator is defined in the B1PrimaryGeneratorAction class.
+ The default kinematics is a 6 MeV gamma, randomly distributed in front
+ of the envelope across 80% of the transverse (X,Y) envelope size.
+ This default setting can be changed via the Geant4 built-in commands
+ of the G4ParticleGun class.
+
+ 5- DETECTOR RESPONSE
+
+ This example demonstrates a simple scoring implemented directly
+ in the user action classes. Alternative ways of scoring via Geant4 classes
+ can be found in the other examples.
+
+ The energy deposited is collected step by step for a selected volume
+ in B1SteppingAction and accumulated event by event in B1EventAction.
+
+ At end of event, the value acummulated in B1EventAction is added in B1RunAction
+ and summed over the whole run (see B1EventAction::EndOfevent()).
+
+ Total dose deposited is computed at B1RunAction::EndOfRunAction(),
+ and printed together with informations about the primary particle.
+ In multi-threading mode the energy accumulated in G4Accumulable objects per
+ workers is merged to the master in B1RunAction::EndOfRunAction() and the final
+ result is printed on the screen.
+
+ G4Parameter type instead of G4double type is used for the B1RunAction
+ data members in order to facilitate merging of the values accumulated on workers
+ to the master. Currently the accumulables have to be registered to G4AccumulablesManager
+ and G4AccumulablesManager::Merge() has to be called from the users code. This is planned
+ to be further simplified with a closer integration of G4Accumulable classes in
+ the Geant4 kernel next year.
+
+ An example of creating and computing new units (e.g., dose) is also shown
+ in the class constructor.
+
+ The following paragraphs are common to all basic examples
+
+ A- VISUALISATION
+
+ The visualization manager is set via the G4VisExecutive class
+ in the main() function in exampleB1.cc.
+ The initialisation of the drawing is done via a set of /vis/ commands
+ in the macro vis.mac. This macro is automatically read from
+ the main function when the example is used in interactive running mode.
+
+ By default, vis.mac opens an OpenGL viewer (/vis/open OGL).
+ The user can change the initial viewer by commenting out this line
+ and instead uncommenting one of the other /vis/open statements, such as
+ HepRepFile or DAWNFILE (which produce files that can be viewed with the
+ HepRApp and DAWN viewers, respectively). Note that one can always
+ open new viewers at any time from the command line. For example, if
+ you already have a view in, say, an OpenGL window with a name
+ "viewer-0", then
+ /vis/open DAWNFILE
+ then to get the same view
+ /vis/viewer/copyView viewer-0
+ or to get the same view *plus* scene-modifications
+ /vis/viewer/set/all viewer-0
+ then to see the result
+ /vis/viewer/flush
+
+ The DAWNFILE, HepRepFile drivers are always available
+ (since they require no external libraries), but the OGL driver requires
+ that the Geant4 libraries have been built with the OpenGL option.
+
+ From Release 9.6 the vis.mac macro in example B1 has additional commands
+ that demonstrate additional functionality of the vis system, such as
+ displaying text, axes, scales, date, logo and shows how to change
+ viewpoint and style. Consider copying these to other examples or
+ your application. To see even more commands use help or
+ ls or browse the available UI commands in the Application
+ Developers Guide, Section 7.1.
+
+ For more information on visualization, including information on how to
+ install and run DAWN, OpenGL and HepRApp, see the visualization tutorials,
+ for example,
+ http://geant4.slac.stanford.edu/Presentations/vis/G4[VIS]Tutorial/G4[VIS]Tutorial.html
+ (where [VIS] can be replaced by DAWN, OpenGL and HepRApp)
+
+ The tracks are automatically drawn at the end of each event, accumulated
+ for all events and erased at the beginning of the next run.
+
+ B- USER INTERFACES
+
+ The user command interface is set via the G4UIExecutive class
+ in the main() function in exampleB1.cc
+ The selection of the user command interface is then done automatically
+ according to the Geant4 configuration or it can be done explicitly via
+ the third argument of the G4UIExecutive constructor (see exampleB4a.cc).
+
+ C- HOW TO RUN
+
+ - Execute exampleB1 in the 'interactive mode' with visualization:
+ % ./exampleB1
+ and type in the commands from run1.mac line by line:
+ Idle> /control/verbose 2
+ Idle> /tracking/verbose 1
+ Idle> /run/beamOn 10
+ Idle> ...
+ Idle> exit
+ or
+ Idle> /control/execute run1.mac
+ ....
+ Idle> exit
+
+ - Execute exampleB1 in the 'batch' mode from macro files
+ (without visualization)
+ % ./exampleB1 run2.mac
+ % ./exampleB1 exampleB1.in > exampleB1.out
+
+
diff --git a/examples/basic/B1/B1/exampleB1.cc b/examples/basic/B1/B1/exampleB1.cc
new file mode 100644
index 0000000..f5dcbe5
--- /dev/null
+++ b/examples/basic/B1/B1/exampleB1.cc
@@ -0,0 +1,109 @@
+//
+// ********************************************************************
+// * 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 "B1DetectorConstruction.hh"
+#include "B1ActionInitialization.hh"
+
+#include "G4RunManagerFactory.hh"
+
+#include "G4UImanager.hh"
+#include "QBBC.hh"
+
+#include "G4VisExecutive.hh"
+#include "G4UIExecutive.hh"
+
+#include "Randomize.hh"
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+int main(int argc,char** argv)
+{
+ // Detect interactive mode (if no arguments) and define UI session
+ //
+ G4UIExecutive* ui = 0;
+ if ( argc == 1 ) {
+ ui = new G4UIExecutive(argc, argv);
+ }
+
+ // Optionally: choose a different Random engine...
+ // G4Random::setTheEngine(new CLHEP::MTwistEngine);
+
+ // Construct the default run manager
+ //
+ auto* runManager =
+ G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
+
+ // Set mandatory initialization classes
+ //
+ // Detector construction
+ runManager->SetUserInitialization(new B1DetectorConstruction());
+
+ // Physics list
+ G4VModularPhysicsList* physicsList = new QBBC;
+ physicsList->SetVerboseLevel(1);
+ runManager->SetUserInitialization(physicsList);
+
+ // User action initialization
+ runManager->SetUserInitialization(new B1ActionInitialization());
+
+ // Initialize visualization
+ //
+ G4VisManager* visManager = new G4VisExecutive;
+ // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
+ // G4VisManager* 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.....
diff --git a/examples/basic/B1/B1/exampleB1.in b/examples/basic/B1/B1/exampleB1.in
new file mode 100644
index 0000000..11f4c83
--- /dev/null
+++ b/examples/basic/B1/B1/exampleB1.in
@@ -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
diff --git a/examples/basic/B1/B1/include/B1ActionInitialization.hh b/examples/basic/B1/B1/include/B1ActionInitialization.hh
new file mode 100644
index 0000000..aad2a1e
--- /dev/null
+++ b/examples/basic/B1/B1/include/B1ActionInitialization.hh
@@ -0,0 +1,51 @@
+//
+// ********************************************************************
+// * 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 B1ActionInitialization.hh
+/// \brief Definition of the B1ActionInitialization class
+
+#ifndef B1ActionInitialization_h
+#define B1ActionInitialization_h 1
+
+#include "G4VUserActionInitialization.hh"
+
+/// Action initialization class.
+
+class B1ActionInitialization : public G4VUserActionInitialization
+{
+ public:
+ B1ActionInitialization();
+ virtual ~B1ActionInitialization();
+
+ virtual void BuildForMaster() const;
+ virtual void Build() const;
+};
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+#endif
+
+
diff --git a/examples/basic/B1/B1/include/B1DetectorConstruction.hh b/examples/basic/B1/B1/include/B1DetectorConstruction.hh
new file mode 100644
index 0000000..8758fac
--- /dev/null
+++ b/examples/basic/B1/B1/include/B1DetectorConstruction.hh
@@ -0,0 +1,58 @@
+//
+// ********************************************************************
+// * 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 B1DetectorConstruction.hh
+/// \brief Definition of the B1DetectorConstruction class
+
+#ifndef B1DetectorConstruction_h
+#define B1DetectorConstruction_h 1
+
+#include "G4VUserDetectorConstruction.hh"
+#include "globals.hh"
+
+class G4VPhysicalVolume;
+class G4LogicalVolume;
+
+/// Detector construction class to define materials and geometry.
+
+class B1DetectorConstruction : public G4VUserDetectorConstruction
+{
+ public:
+ B1DetectorConstruction();
+ virtual ~B1DetectorConstruction();
+
+ virtual G4VPhysicalVolume* Construct();
+
+ G4LogicalVolume* GetScoringVolume() const { return fScoringVolume; }
+
+ protected:
+ G4LogicalVolume* fScoringVolume;
+};
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+#endif
+
diff --git a/examples/basic/B1/B1/include/B1EventAction.hh b/examples/basic/B1/B1/include/B1EventAction.hh
new file mode 100644
index 0000000..14a1727
--- /dev/null
+++ b/examples/basic/B1/B1/include/B1EventAction.hh
@@ -0,0 +1,61 @@
+//
+// ********************************************************************
+// * 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 B1EventAction.hh
+/// \brief Definition of the B1EventAction class
+
+#ifndef B1EventAction_h
+#define B1EventAction_h 1
+
+#include "G4UserEventAction.hh"
+#include "globals.hh"
+
+class B1RunAction;
+
+/// Event action class
+///
+
+class B1EventAction : public G4UserEventAction
+{
+ public:
+ B1EventAction(B1RunAction* runAction);
+ virtual ~B1EventAction();
+
+ virtual void BeginOfEventAction(const G4Event* event);
+ virtual void EndOfEventAction(const G4Event* event);
+
+ void AddEdep(G4double edep) { fEdep += edep; }
+
+ private:
+ B1RunAction* fRunAction;
+ G4double fEdep;
+};
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+#endif
+
+
diff --git a/examples/basic/B1/B1/include/B1PrimaryGeneratorAction.hh b/examples/basic/B1/B1/include/B1PrimaryGeneratorAction.hh
new file mode 100644
index 0000000..1bb418c
--- /dev/null
+++ b/examples/basic/B1/B1/include/B1PrimaryGeneratorAction.hh
@@ -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 B1PrimaryGeneratorAction.hh
+/// \brief Definition of the B1PrimaryGeneratorAction class
+
+#ifndef B1PrimaryGeneratorAction_h
+#define B1PrimaryGeneratorAction_h 1
+
+#include "G4VUserPrimaryGeneratorAction.hh"
+#include "G4ParticleGun.hh"
+#include "globals.hh"
+
+class G4ParticleGun;
+class G4Event;
+class G4Box;
+
+/// 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 B1PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
+{
+ public:
+ B1PrimaryGeneratorAction();
+ virtual ~B1PrimaryGeneratorAction();
+
+ // method from the base class
+ virtual void GeneratePrimaries(G4Event*);
+
+ // method to access particle gun
+ const G4ParticleGun* GetParticleGun() const { return fParticleGun; }
+
+ private:
+ G4ParticleGun* fParticleGun; // pointer a to G4 gun class
+ G4Box* fEnvelopeBox;
+};
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+#endif
diff --git a/examples/basic/B1/B1/include/B1RunAction.hh b/examples/basic/B1/B1/include/B1RunAction.hh
new file mode 100644
index 0000000..8a09221
--- /dev/null
+++ b/examples/basic/B1/B1/include/B1RunAction.hh
@@ -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 B1RunAction.hh
+/// \brief Definition of the B1RunAction class
+
+#ifndef B1RunAction_h
+#define B1RunAction_h 1
+
+#include "G4UserRunAction.hh"
+#include "G4Accumulable.hh"
+#include "globals.hh"
+
+class G4Run;
+
+/// 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 B1RunAction : public G4UserRunAction
+{
+ public:
+ B1RunAction();
+ virtual ~B1RunAction();
+
+ // virtual G4Run* GenerateRun();
+ virtual void BeginOfRunAction(const G4Run*);
+ virtual void EndOfRunAction(const G4Run*);
+
+ void AddEdep (G4double edep);
+
+ private:
+ G4Accumulable fEdep;
+ G4Accumulable fEdep2;
+};
+
+#endif
+
diff --git a/examples/basic/B1/B1/include/B1SteppingAction.hh b/examples/basic/B1/B1/include/B1SteppingAction.hh
new file mode 100644
index 0000000..72561ea
--- /dev/null
+++ b/examples/basic/B1/B1/include/B1SteppingAction.hh
@@ -0,0 +1,59 @@
+//
+// ********************************************************************
+// * 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 B1SteppingAction.hh
+/// \brief Definition of the B1SteppingAction class
+
+#ifndef B1SteppingAction_h
+#define B1SteppingAction_h 1
+
+#include "G4UserSteppingAction.hh"
+#include "globals.hh"
+
+class B1EventAction;
+
+class G4LogicalVolume;
+
+/// Stepping action class
+///
+
+class B1SteppingAction : public G4UserSteppingAction
+{
+ public:
+ B1SteppingAction(B1EventAction* eventAction);
+ virtual ~B1SteppingAction();
+
+ // method from the base class
+ virtual void UserSteppingAction(const G4Step*);
+
+ private:
+ B1EventAction* fEventAction;
+ G4LogicalVolume* fScoringVolume;
+};
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+#endif
diff --git a/examples/basic/B1/B1/init_vis.mac b/examples/basic/B1/B1/init_vis.mac
new file mode 100644
index 0000000..8e46032
--- /dev/null
+++ b/examples/basic/B1/B1/init_vis.mac
@@ -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
diff --git a/examples/basic/B1/B1/run1.mac b/examples/basic/B1/B1/run1.mac
new file mode 100644
index 0000000..8eb85c1
--- /dev/null
+++ b/examples/basic/B1/B1/run1.mac
@@ -0,0 +1,30 @@
+# Macro file for example B1
+#
+# Can be run in batch, without graphic
+# or interactively: Idle> /control/execute run1.mac
+#
+# Change the default number of workers (in multi-threading mode)
+#/run/numberOfThreads 4
+#
+# Initialize kernel
+/run/initialize
+#
+/control/verbose 2
+/run/verbose 2
+/event/verbose 0
+/tracking/verbose 1
+#
+# gamma 6 MeV to the direction (0.,0.,1.)
+#
+/gun/particle gamma
+/gun/energy 6 MeV
+#
+/run/beamOn 5
+#
+# proton 210 MeV to the direction (0.,0.,1.)
+#
+/gun/particle proton
+/gun/energy 210 MeV
+/tracking/verbose 2
+#
+/run/beamOn 1
diff --git a/examples/basic/B1/B1/run2.mac b/examples/basic/B1/B1/run2.mac
new file mode 100644
index 0000000..76b9b20
--- /dev/null
+++ b/examples/basic/B1/B1/run2.mac
@@ -0,0 +1,27 @@
+# Macro file for example B1
+#
+# To be run preferably in batch, without graphics:
+# % exampleB1 run2.mac
+#
+#/run/numberOfThreads 4
+/run/initialize
+#
+/control/verbose 2
+/run/verbose 2
+#
+# gamma 6 MeV to the direction (0.,0.,1.)
+# 10000 events
+#
+/gun/particle gamma
+/gun/energy 6 MeV
+#
+/run/printProgress 100
+/run/beamOn 1000
+#
+# proton 210 MeV to the direction (0.,0.,1.)
+# 1000 events
+#
+/gun/particle proton
+/gun/energy 210 MeV
+#
+/run/beamOn 1000
diff --git a/examples/basic/B1/B1/src/B1ActionInitialization.cc b/examples/basic/B1/B1/src/B1ActionInitialization.cc
new file mode 100644
index 0000000..90f9fd6
--- /dev/null
+++ b/examples/basic/B1/B1/src/B1ActionInitialization.cc
@@ -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 B1ActionInitialization.cc
+/// \brief Implementation of the B1ActionInitialization class
+
+#include "B1ActionInitialization.hh"
+#include "B1PrimaryGeneratorAction.hh"
+#include "B1RunAction.hh"
+#include "B1EventAction.hh"
+#include "B1SteppingAction.hh"
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+B1ActionInitialization::B1ActionInitialization()
+ : G4VUserActionInitialization()
+{}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+B1ActionInitialization::~B1ActionInitialization()
+{}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+void B1ActionInitialization::BuildForMaster() const
+{
+ B1RunAction* runAction = new B1RunAction;
+ SetUserAction(runAction);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+void B1ActionInitialization::Build() const
+{
+ SetUserAction(new B1PrimaryGeneratorAction);
+
+ B1RunAction* runAction = new B1RunAction;
+ SetUserAction(runAction);
+
+ B1EventAction* eventAction = new B1EventAction(runAction);
+ SetUserAction(eventAction);
+
+ SetUserAction(new B1SteppingAction(eventAction));
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
diff --git a/examples/basic/B1/B1/src/B1DetectorConstruction.cc b/examples/basic/B1/B1/src/B1DetectorConstruction.cc
new file mode 100644
index 0000000..bbd060b
--- /dev/null
+++ b/examples/basic/B1/B1/src/B1DetectorConstruction.cc
@@ -0,0 +1,202 @@
+//
+// * *
+// * 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 B1DetectorConstruction.cc
+/// \brief Implementation of the B1DetectorConstruction class
+
+#include "B1DetectorConstruction.hh"
+
+#include "G4RunManager.hh"
+#include "G4NistManager.hh"
+#include "G4Box.hh"
+#include "G4Cons.hh"
+#include "G4Orb.hh"
+#include "G4Sphere.hh"
+#include "G4Trd.hh"
+#include "G4LogicalVolume.hh"
+#include "G4PVPlacement.hh"
+#include "G4SystemOfUnits.hh"
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+B1DetectorConstruction::B1DetectorConstruction()
+: G4VUserDetectorConstruction(),
+ fScoringVolume(0)
+{ }
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+B1DetectorConstruction::~B1DetectorConstruction()
+{ }
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4VPhysicalVolume* B1DetectorConstruction::Construct()
+{
+ // Get nist material manager
+ G4NistManager* nist = G4NistManager::Instance();
+
+ // Shielding parameters
+ //
+ G4double shield_sizeXYZ = 25*mm;
+ G4Material* shield_mat = nist->FindOrBuildMaterial("G4_Al");
+
+ // Option to switch on/off checking of volumes overlaps
+ //
+ G4bool checkOverlaps = true;
+
+ //
+ // World
+ //
+ G4double world_sizeXYZ = 10*shield_sizeXYZ;
+ G4double atomicNumber = 1.;
+ G4double massOfMole = 1.008*g/mole;
+ G4double density = 1.e-25*g/cm3;
+ G4double temperature = 2.73*kelvin;
+ G4double pressure = 3.e-18*pascal;
+ G4Material* Vacuum =
+ new G4Material ("Vacuum", atomicNumber, massOfMole, density, kStateGas, temperature, pressure);
+
+ G4Box* solidWorld =
+ new G4Box("World", //its name
+ world_sizeXYZ, world_sizeXYZ, world_sizeXYZ); //its size
+
+ G4LogicalVolume* logicWorld =
+ new G4LogicalVolume(solidWorld, //its solid
+ Vacuum, //its material
+ "World"); //its name
+
+ G4VPhysicalVolume* physWorld =
+ new G4PVPlacement(0, //no rotation
+ G4ThreeVector(), //at (0,0,0)
+ logicWorld, //its logical volume
+ "World", //its name
+ 0, //its mother volume
+ false, //no boolean operation
+ 0, //copy number
+ checkOverlaps); //overlaps checking
+
+
+ //
+ // Envelope
+ //
+
+ G4double env_sizeXYZ = 5*shield_sizeXYZ;
+ G4Box* solidEnv =
+ new G4Box("Envelope",
+ 0.5*env_sizeXYZ, 0.5*env_sizeXYZ, 0.5*env_sizeXYZ);
+
+ G4LogicalVolume* logicEnv =
+ new G4LogicalVolume(solidEnv,
+ Vacuum,
+ "Envelope");
+
+ new G4PVPlacement(0,
+ G4ThreeVector(),
+ logicEnv,
+ "Envelope",
+ logicWorld,
+ false,
+ 0,
+ checkOverlaps);
+
+
+
+ //
+ // Shielding
+ //
+ G4Box* solidShield =
+ new G4Box("Shielding", //its name
+ shield_sizeXYZ, shield_sizeXYZ, shield_sizeXYZ); //its size
+
+ G4LogicalVolume* logicShield =
+ new G4LogicalVolume(solidShield, //its solid
+ shield_mat, //its material
+ "Shielding"); //its name
+
+ new G4PVPlacement(0, //no rotation
+ G4ThreeVector(), //at (0,0,0)
+ logicShield, //its logical volume
+ "Shielding", //its name
+ logicEnv, //its mother volume
+ false, //no boolean operation
+ 0, //copy number
+ checkOverlaps); //overlaps checking
+
+ //
+ // Cavity
+ //
+ G4double cavity_sizeXYZ = 11*mm;
+
+ G4Box* solidCavity =
+ new G4Box("Cavity", cavity_sizeXYZ, cavity_sizeXYZ, cavity_sizeXYZ);
+
+ G4LogicalVolume* logicCavity =
+ new G4LogicalVolume(solidCavity, //its solid
+ Vacuum, //its material
+ "Cavity"); //its name
+
+ new G4PVPlacement(0, //no rotation
+ G4ThreeVector(), //at (0,0,0)
+ logicCavity, //its logical volume
+ "Cavity", //its name
+ logicShield, //its mother volume
+ false, //no boolean operation
+ 0, //copy number
+ checkOverlaps); //overlaps checking
+
+ //
+ // Scintillator
+ //
+ G4Material* scint_mat = nist->FindOrBuildMaterial("G4_PLASTIC_SC_VINYLTOLUENE");
+ G4double scint_sizeXYZ = 10*mm;
+
+ G4Box* solidScint =
+ new G4Box("Scintillator", scint_sizeXYZ, scint_sizeXYZ, scint_sizeXYZ); //its name and size
+
+ G4LogicalVolume* logicScint =
+ new G4LogicalVolume(solidScint, //its solid
+ scint_mat, //its material
+ "Scintillator"); //its name
+
+ new G4PVPlacement(0, //no rotation
+ G4ThreeVector(), //at (0,0,0)
+ logicScint, //its logical volume
+ "Scintillator", //its name
+ logicCavity, //its mother volume
+ false, //no boolean operation
+ 0, //copy number
+ checkOverlaps); //overlaps checking
+
+ // Set Cavity as scoring volume
+ //
+ fScoringVolume = logicScint;
+
+ //
+ //always return the physical World
+ //
+ return physWorld;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
diff --git a/examples/basic/B1/B1/src/B1EventAction.cc b/examples/basic/B1/B1/src/B1EventAction.cc
new file mode 100644
index 0000000..e57ff7f
--- /dev/null
+++ b/examples/basic/B1/B1/src/B1EventAction.cc
@@ -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 B1EventAction.cc
+/// \brief Implementation of the B1EventAction class
+
+#include "B1EventAction.hh"
+#include "B1RunAction.hh"
+
+#include "G4Event.hh"
+#include "G4RunManager.hh"
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+B1EventAction::B1EventAction(B1RunAction* runAction)
+: G4UserEventAction(),
+ fRunAction(runAction),
+ fEdep(0.)
+{}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+B1EventAction::~B1EventAction()
+{}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+void B1EventAction::BeginOfEventAction(const G4Event*)
+{
+ fEdep = 0.;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+void B1EventAction::EndOfEventAction(const G4Event*)
+{
+ // accumulate statistics in run action
+ fRunAction->AddEdep(fEdep);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
diff --git a/examples/basic/B1/B1/src/B1PrimaryGeneratorAction.cc b/examples/basic/B1/B1/src/B1PrimaryGeneratorAction.cc
new file mode 100644
index 0000000..f3b05b4
--- /dev/null
+++ b/examples/basic/B1/B1/src/B1PrimaryGeneratorAction.cc
@@ -0,0 +1,114 @@
+//
+// ********************************************************************
+// * 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 B1PrimaryGeneratorAction.cc
+/// \brief Implementation of the B1PrimaryGeneratorAction class
+
+#include "B1PrimaryGeneratorAction.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"
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+B1PrimaryGeneratorAction::B1PrimaryGeneratorAction()
+: G4VUserPrimaryGeneratorAction(),
+ fParticleGun(0),
+ fEnvelopeBox(0)
+{
+ G4int n_particle = 1;
+ fParticleGun = new G4ParticleGun(n_particle);
+
+ // default particle kinematic
+ G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
+ G4String particleName;
+ G4ParticleDefinition* particle
+ = particleTable->FindParticle(particleName="gamma");
+ fParticleGun->SetParticleDefinition(particle);
+ fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
+ fParticleGun->SetParticleEnergy(6.*MeV);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+B1PrimaryGeneratorAction::~B1PrimaryGeneratorAction()
+{
+ delete fParticleGun;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+void B1PrimaryGeneratorAction::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(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("B1PrimaryGeneratorAction::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(x0,y0,z0));
+
+ fParticleGun->GeneratePrimaryVertex(anEvent);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
diff --git a/examples/basic/B1/B1/src/B1RunAction.cc b/examples/basic/B1/B1/src/B1RunAction.cc
new file mode 100644
index 0000000..9d25cea
--- /dev/null
+++ b/examples/basic/B1/B1/src/B1RunAction.cc
@@ -0,0 +1,163 @@
+//
+// ********************************************************************
+// * 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 B1RunAction.cc
+/// \brief Implementation of the B1RunAction class
+
+#include "B1RunAction.hh"
+#include "B1PrimaryGeneratorAction.hh"
+#include "B1DetectorConstruction.hh"
+// #include "B1Run.hh"
+
+#include "G4RunManager.hh"
+#include "G4Run.hh"
+#include "G4AccumulableManager.hh"
+#include "G4LogicalVolumeStore.hh"
+#include "G4LogicalVolume.hh"
+#include "G4UnitsTable.hh"
+#include "G4SystemOfUnits.hh"
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+B1RunAction::B1RunAction()
+: G4UserRunAction(),
+ fEdep(0.),
+ fEdep2(0.)
+{
+ // 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......
+
+B1RunAction::~B1RunAction()
+{}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+void B1RunAction::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 B1RunAction::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 B1DetectorConstruction* detectorConstruction
+ = static_cast
+ (G4RunManager::GetRunManager()->GetUserDetectorConstruction());
+ G4double mass = detectorConstruction->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 B1PrimaryGeneratorAction* generatorAction
+ = static_cast
+ (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 B1RunAction::AddEdep(G4double edep)
+{
+ fEdep += edep;
+ fEdep2 += edep*edep;
+}
+
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
diff --git a/examples/basic/B1/B1/src/B1SteppingAction.cc b/examples/basic/B1/B1/src/B1SteppingAction.cc
new file mode 100644
index 0000000..619b116
--- /dev/null
+++ b/examples/basic/B1/B1/src/B1SteppingAction.cc
@@ -0,0 +1,77 @@
+//
+// ********************************************************************
+// * 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 B1SteppingAction.cc
+/// \brief Implementation of the B1SteppingAction class
+
+#include "B1SteppingAction.hh"
+#include "B1EventAction.hh"
+#include "B1DetectorConstruction.hh"
+
+#include "G4Step.hh"
+#include "G4Event.hh"
+#include "G4RunManager.hh"
+#include "G4LogicalVolume.hh"
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+B1SteppingAction::B1SteppingAction(B1EventAction* eventAction)
+: G4UserSteppingAction(),
+ fEventAction(eventAction),
+ fScoringVolume(0)
+{}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+B1SteppingAction::~B1SteppingAction()
+{}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+void B1SteppingAction::UserSteppingAction(const G4Step* step)
+{
+ if (!fScoringVolume) {
+ const B1DetectorConstruction* detectorConstruction
+ = static_cast
+ (G4RunManager::GetRunManager()->GetUserDetectorConstruction());
+ fScoringVolume = detectorConstruction->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......
+
diff --git a/examples/basic/B1/B1/vis.mac b/examples/basic/B1/B1/vis.mac
new file mode 100644
index 0000000..d25e2a0
--- /dev/null
+++ b/examples/basic/B1/B1/vis.mac
@@ -0,0 +1,116 @@
+# Macro file for the visualization setting in the initialization phase
+# of the B1 example when running in interactive mode
+#
+
+# Use these open statements to open selected visualization
+#
+# Use this open statement to create an OpenGL view:
+# /vis/open OGL 600x600-0+0
+#
+# Use this open statement to create an OpenInventor view:
+#/vis/open OI
+#
+# Use this open statement to create a .prim file suitable for
+# viewing in DAWN:
+/vis/open DAWNFILE
+#
+# Use this open statement to create a .heprep file suitable for
+# viewing in HepRApp:
+#/vis/open HepRepFile
+#
+# Use this open statement to create a .wrl file suitable for
+# viewing in a VRML viewer:
+#/vis/open VRML2FILE
+#
+# 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 ! ! exampleB1
+# or, if your system does not support right-adjustment
+#/vis/scene/add/text2D 0 -.9 24 ! ! exampleB1
+/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
diff --git a/examples/basic/B1/src/B1DetectorConstruction.cc b/examples/basic/B1/src/B1DetectorConstruction.cc
index d0090ca..0c52fcc 100644
--- a/examples/basic/B1/src/B1DetectorConstruction.cc
+++ b/examples/basic/B1/src/B1DetectorConstruction.cc
@@ -57,9 +57,9 @@ B1DetectorConstruction::~B1DetectorConstruction()
G4VPhysicalVolume* B1DetectorConstruction::Construct()
{
// Get nist material manager
- G4NistManager* nist = G4NistManager::Instance();
+ G4NistManager* nist = G4NistManager::Instance();
- // Envelope parameters
+ // Envelope parameters
//
G4double env_sizeXY = 20*cm, env_sizeZ = 30*cm;
G4Material* env_mat = nist->FindOrBuildMaterial("G4_WATER");
@@ -69,7 +69,7 @@ G4VPhysicalVolume* B1DetectorConstruction::Construct()
G4bool checkOverlaps = true;
//
- // World
+ // World (Volume of air that envelope and other shapes are inside of)
//
G4double world_sizeXY = 1.2*env_sizeXY;
G4double world_sizeZ = 1.2*env_sizeZ;
@@ -95,7 +95,7 @@ G4VPhysicalVolume* B1DetectorConstruction::Construct()
checkOverlaps); //overlaps checking
//
- // Envelope
+ // Envelope (Inside world, made of water)
//
G4Box* solidEnv =
new G4Box("Envelope", //its name
@@ -110,7 +110,7 @@ G4VPhysicalVolume* B1DetectorConstruction::Construct()
G4ThreeVector(), //at (0,0,0)
logicEnv, //its logical volume
"Envelope", //its name
- logicWorld, //its mother volume
+ logicWorld, //its mother volume (world, the envelope is in the world volume)
false, //no boolean operation
0, //copy number
checkOverlaps); //overlaps checking
@@ -127,20 +127,20 @@ G4VPhysicalVolume* B1DetectorConstruction::Construct()
G4double shape1_hz = 3.*cm;
G4double shape1_phimin = 0.*deg, shape1_phimax = 360.*deg;
G4Cons* solidShape1 =
- new G4Cons("Shape1",
+ new G4Cons("Shape1", //its name
shape1_rmina, shape1_rmaxa, shape1_rminb, shape1_rmaxb, shape1_hz,
- shape1_phimin, shape1_phimax);
+ shape1_phimin, shape1_phimax); //its size
G4LogicalVolume* logicShape1 =
new G4LogicalVolume(solidShape1, //its solid
- shape1_mat, //its material
+ shape1_mat, //its material (tissue)
"Shape1"); //its name
new G4PVPlacement(0, //no rotation
pos1, //at position
logicShape1, //its logical volume
"Shape1", //its name
- logicEnv, //its mother volume
+ logicEnv, //its mother volume (envelope!)
false, //no boolean operation
0, //copy number
checkOverlaps); //overlaps checking
@@ -162,14 +162,14 @@ G4VPhysicalVolume* B1DetectorConstruction::Construct()
G4LogicalVolume* logicShape2 =
new G4LogicalVolume(solidShape2, //its solid
- shape2_mat, //its material
+ shape2_mat, //its material (bone)
"Shape2"); //its name
new G4PVPlacement(0, //no rotation
pos2, //at position
logicShape2, //its logical volume
"Shape2", //its name
- logicEnv, //its mother volume
+ logicEnv, //its mother volume (envelope)
false, //no boolean operation
0, //copy number
checkOverlaps); //overlaps checking
diff --git a/examples/basic/B1/src/ShieldingGeometry.cc b/examples/basic/B1/src/ShieldingGeometry.cc
new file mode 100644
index 0000000..a0edb68
--- /dev/null
+++ b/examples/basic/B1/src/ShieldingGeometry.cc
@@ -0,0 +1,180 @@
+//
+// ********************************************************************
+// * 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 B1DetectorConstruction.cc
+/// \brief Implementation of the B1DetectorConstruction class
+
+#include "B1DetectorConstruction.hh"
+
+#include "G4RunManager.hh"
+#include "G4NistManager.hh"
+#include "G4Box.hh"
+#include "G4Cons.hh"
+#include "G4Orb.hh"
+#include "G4Sphere.hh"
+#include "G4Trd.hh"
+#include "G4LogicalVolume.hh"
+#include "G4PVPlacement.hh"
+#include "G4SystemOfUnits.hh"
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+B1DetectorConstruction::B1DetectorConstruction()
+: G4VUserDetectorConstruction(),
+ fScoringVolume(0)
+{ }
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+B1DetectorConstruction::~B1DetectorConstruction()
+{ }
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4VPhysicalVolume* B1DetectorConstruction::Construct()
+{
+ // Get nist material manager
+ G4NistManager* nist = G4NistManager::Instance();
+
+ // Shielding parameters
+ //
+ G4double shield_sizeXYZ = 25*mm;
+ G4Material* shield_mat = nist->FindOrBuildMaterial("G4_Al");
+
+ // Option to switch on/off checking of volumes overlaps
+ //
+ G4bool checkOverlaps = true;
+
+ //
+ // World
+ //
+ G4double world_sizeXYZ = 1.2*shield_sizeXYZ;
+ G4double atomicNumber = 1.;
+ G4double massOfMole = 1.008*g/mole;
+ G4double density = 1.e-25*g/cm3;
+ G4double temperature = 2.73*kelvin;
+ G4double pressure = 3.e-18*pascal;
+ G4Material* Vacuum =
+ new G4Material ("Vacuum", atomicNumber, massOfMole, density, kStateGas, temperature, pressure);
+ G4Material* world_mat = nist->FindOrBuildMaterial("G4_Vacuum");
+
+ G4Box* solidWorld =
+ new G4Box("World", //its name
+ world_sizeXYZ, world_sizeXYZ, world_sizeXYZ); //its size
+
+ G4LogicalVolume* logicWorld =
+ new G4LogicalVolume(solidWorld, //its solid
+ world_mat, //its material
+ "World"); //its name
+
+ G4VPhysicalVolume* physWorld =
+ new G4PVPlacement(0, //no rotation
+ G4ThreeVector(), //at (0,0,0)
+ logicWorld, //its logical volume
+ "World", //its name
+ 0, //its mother volume
+ false, //no boolean operation
+ 0, //copy number
+ checkOverlaps); //overlaps checking
+
+ //
+ // Shielding
+ //
+ G4Box* solidShield =
+ new G4Box("Shielding", //its name
+ shield_sizeXYZ, shield_sizeXYZ, shield_sizeXYZ); //its size
+
+ G4LogicalVolume* logicShield =
+ new G4LogicalVolume(solidShield, //its solid
+ shield_mat, //its material
+ "Shielding"); //its name
+
+ new G4PVPlacement(0, //no rotation
+ G4ThreeVector(), //at (0,0,0)
+ logicShield, //its logical volume
+ "Shielding", //its name
+ logicWorld, //its mother volume
+ false, //no boolean operation
+ 0, //copy number
+ checkOverlaps); //overlaps checking
+
+ //
+ // Cavity
+ //
+ G4Material* cavity_mat = nist->FindOrBuildMaterial("Vacuum");
+ G4Double cavity_sizeXYZ = 11*mm;
+
+ G4Box* solidCavity =
+ new G4Box("Cavity", cavity_sizeXYZ, cavity_sizeXYZ, cavity_sizeXYZ);
+
+ G4LogicalVolume* logicCavity =
+ new G4LogicalVolume(solidCavity, //its solid
+ cavity_mat, //its material
+ "Cavity"); //its name
+
+ new G4PVPlacement(0, //no rotation
+ G4ThreeVector(), //at (0,0,0)
+ logicCavity, //its logical volume
+ "Cavity", //its name
+ logicShield, //its mother volume
+ false, //no boolean operation
+ 0, //copy number
+ checkOverlaps); //overlaps checking
+
+ //
+ // Scintillator
+ //
+ G4Material* scint_mat = nist->FindOrBuildMaterial("G4_PLASTIC_SC_VINYLTOLUENE");
+ G4Double scint_sizeXYZ = 10*mm;
+
+ G4Box* solidScint =
+ new G4Box("Scintillator", scint_sizeXYZ, scint_sizeXYZ, scint_sizeXYZ); //its name and size
+
+ G4LogicalVolume* logicScint =
+ new G4LogicalVolume(solidScint, //its solid
+ scint_mat, //its material
+ "Scintillator"); //its name
+
+ new G4PVPlacement(0, //no rotation
+ G4ThreeVector(), //at (0,0,0)
+ logicScint, //its logical volume
+ "Scintillator", //its name
+ logicCavity, //its mother volume
+ false, //no boolean operation
+ 0, //copy number
+ checkOverlaps); //overlaps checking
+
+ // Set Cavity as scoring volume
+ //
+ fScoringVolume = logicScint;
+
+ //
+ //always return the physical World
+ //
+ return physWorld;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......