Import Geant4 9.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 17:01:34 +02:00
parent b1eb5424d2
commit e2d2f9810a
10384 changed files with 698580 additions and 628834 deletions
@@ -0,0 +1,25 @@
//$Id$
///\file "persistency/gdml/.README"
///\brief Examples gdml README page
/*! \page Examples_gdml Category "persistency/gdml"
This directory contains a set of examples showing the usage of the GDML
plugin module in Geant4.
- \link ExampleG01 G01 \endlink Simple example for importing and exporting simple GDML files.
- \link ExampleG02 G02 \endlink Sample application showing how to import/export different
geometry setups, including STEP Tools files and structures
integrating them in a real simulation application.
- \link ExampleG03 G03 \endlink Simple example showing how to import extensions to the GDML
schema.
- \link ExampleG04 G04 \endlink Simple example showing how to associate detector sensitivity
to a logical-volume, making use of the auxiliary-information.
See the README file inside each example for more detail.
*/
@@ -0,0 +1,8 @@
#---Adding all GDML examples subdirectories explicitly
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
add_subdirectory(G01)
add_subdirectory(G02)
add_subdirectory(G03)
add_subdirectory(G04)
@@ -0,0 +1,59 @@
//$Id$
///\file "persistency/gdml/G01/.README"
///\brief Example G01 README page
/*! \page ExampleG01 Example G01
\section G01_s1 GDML READ/WRITE
This example demonstrates the usage of the GDML reader and writer. It allows
to export geometry descriptions in an application independent format (GDML,
Geometry Description Markup Language).
The GDML files can be then used to interchange geometries between different
applications and users.
The detector construction consists of a call to GDMLProcessor which parses a
GDML file and returns the pointer to the world volume. The user can also write
her/his own GDML file and use it as the primary input format for her/his Geant4
application.
Several simple GDML files are provided:
- axes.gdml, showing loading and orientation of Cartesian axes;
- solids.gdml, list of all supported solids with placement;
- scale.gdml, a simple diamond structure made of extruded solids;
- divisionvol.gdml, a divided box;
- parameterized.gdml, a parameterised box;
- pTube.gdml, a parameterised tube;
- auxiliary.gdml, showing association of volume with auxiliary information;
- etc...
\section G01_s2 HOW TO BUILD THE EXAMPLE ?
- You need to have built the persistency/gdml module by having
set the -DGEANT4_USE_GDML=ON flag during the CMAKE configuration step,
as well as the -DXERCESC_ROOT_DIR=<path_to_xercesc> flag pointing to
the path where the XercesC XML parser package is installed in your system.
- Compile and link to generate the executable (in your CMAKE build directory):
\verbatim
make
\endverbatim
- Execute the application.
- For reading and visualize interactively a GDML file:
\verbatim
load_gdml [GDML-file-in].gdml
\endverbatim
- For reading, writing and visualize interactively a GDML file:
\verbatim
load_gdml [GDML-file-in].gdml [GDML-file-out].gdml
\endverbatim
- For reading, writing a GDML file and running in batch a macro:
\verbatim
load_gdml [GDML-file-in].gdml [GDML-file-out].gdml [macro].in
\endverbatim
*/
@@ -1,12 +1,64 @@
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(G01)
set(name load_gdml)
project(${name})
find_package(Geant4 REQUIRED)
#----------------------------------------------------------------------------
# Find Geant4 package, activating all available Vis drivers by default
# You can set WITH_GEANT4_VIS to OFF via the command line or ccmake/cmake-gui
# to build a batch mode only executable
#
option(WITH_GEANT4_VIS "Build example with Geant4 Vis drivers" ON)
if(WITH_GEANT4_VIS)
find_package(Geant4 REQUIRED gdml vis_all)
else()
find_package(Geant4 REQUIRED gdml)
endif()
#----------------------------------------------------------------------------
# Setup Geant4 include directories and compile definitions
#
include(${Geant4_USE_FILE})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${Geant4_INCLUDE_DIR})
file(GLOB sources ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc)
#----------------------------------------------------------------------------
# Locate sources and headers for this project
#
include_directories(${PROJECT_SOURCE_DIR}/include
${Geant4_INCLUDE_DIR})
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
#----------------------------------------------------------------------------
# Add the executable, and link it to the Geant4 libraries
#
add_executable(load_gdml load_gdml.cc ${sources} ${headers})
target_link_libraries(load_gdml ${Geant4_LIBRARIES} )
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build G01. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
set(G01_SCRIPTS
assembly.gdml auxiliary.gdml axes.gdml divisionvol.gdml entity.gdml g01.in g01.out loop.gdml matricesandloops.gdml opticalsurfaces.gdml parameterized.gdml pTube.gdml replicated.gdml scale.gdml solids.gdml tess.gdml vis.mac
)
foreach(_script ${G01_SCRIPTS})
configure_file(
${PROJECT_SOURCE_DIR}/${_script}
${PROJECT_BINARY_DIR}/${_script}
COPYONLY
)
endforeach()
#----------------------------------------------------------------------------
# Add program to the project targets
# (this avoids the need of typing the program name after make)
#
add_custom_target(G01 DEPENDS load_gdml)
#----------------------------------------------------------------------------
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
#
install(TARGETS load_gdml DESTINATION bin)
add_executable(${name} EXCLUDE_FROM_ALL ${name}.cc ${sources})
target_link_libraries(${name} ${Geant4_LIBRARIES})
@@ -16,6 +16,17 @@ committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
October 19th, 2012 Ben Morgan
- Simplify CMake syntax to find Geant4 with gdml support
July 25th, 2012 Witek Pokorski G01-V09-05-02
- a few more cosmetic changes to comply to coding convetions
July 25th, 2012 Witek Pokorski G01-V09-05-01
- making a number of cosmetic changes to comply to coding conventions
April 4th, 2012 Witek Pokorski G01-V09-05-00
- Added missing unit in opticalsurfaces.gdml
November 17th, 2010 Gabriele Cosmo G01-V09-03-07
- Added commented command for de-activating names stripping while reading.
@@ -31,16 +31,13 @@ Several simple GDML files are provided:
HOW TO BUILD THE EXAMPLE ?
- You need to have built the persistency/gdml plugin module by having
set G4LIB_BUILD_GDML variable in your environment.
It is also required you specify the path where the XercesC XML parser
package is installed in your system, through the variable XERCESCROOT.
Note: if you are using dynamic libraries, you should add and
$XERCESCROOT/lib paths to the LD_LIBRARY_PATH directory (or
equivalent on your system).
- You need to have built the persistency/gdml module by having
set the -DGEANT4_USE_GDML=ON flag during the CMAKE configuration step,
as well as the -DXERCESC_ROOT_DIR=<path_to_xercesc> flag pointing to
the path where the XercesC XML parser package is installed in your system.
- Compile and link to generate the executable:
% gmake
- Compile and link to generate the executable (in your CMAKE build directory):
% make
- Execute the application.
o For reading and visualize interactively a GDML file:
+22 -47
View File
@@ -1,13 +1,13 @@
Usage: load_gdml <intput_gdml_file:mandatory> <output_gdml_file:optional>
G4GDML: Reading 'solids.gdml'...
G4GDML: Reading '/build/cdash/G4/release/09-06-cand-00_branch/examples/extended/persistency/gdml/G01/solids.gdml'...
G4GDML: Reading definitions...
G4GDML: Reading materials...
G4GDML: Reading solids...
G4GDML: Reading structure...
G4GDML: Reading setup...
G4GDML: Reading 'solids.gdml' done!
G4GDML: Reading '/build/cdash/G4/release/09-06-cand-00_branch/examples/extended/persistency/gdml/G01/solids.gdml' done!
Stripping off GDML names of materials, solids and volumes ...
############################################
@@ -15,7 +15,7 @@ Stripping off GDML names of materials, solids and volumes ...
############################################
*************************************************************
Geant4 version Name: geant4-09-05-ref-00 (2-December-2011)
Geant4 version Name: geant4-09-06-ref-00 (30-November-2012)
Copyright : Geant4 Collaboration
Reference : NIM A 506 (2003), 250-303
WWW : http://cern.ch/geant4
@@ -126,9 +126,7 @@ Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolu
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 684 0.1 268 1e+03 0 2.7e+03 2.7e+03 vol1001_PV Transportation
2 1.28e+03 0.1 328 1e+03 0 595 3.29e+03 World_PV Transportation
3 5e+03 0.1 700 1e+03 0 3.74e+03 7.03e+03 OutOfWorld Transportation
1 5e+03 0.1 700 1e+03 0 7.03e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
@@ -176,9 +174,7 @@ Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolu
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 684 0.1 268 1e+03 0 2.7e+03 2.7e+03 vol1001_PV Transportation
2 1.28e+03 0.1 328 1e+03 0 595 3.29e+03 World_PV Transportation
3 5e+03 0.1 700 1e+03 0 3.74e+03 7.03e+03 OutOfWorld Transportation
1 5e+03 0.1 700 1e+03 0 7.03e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
@@ -226,9 +222,7 @@ Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolu
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 684 0.1 268 1e+03 0 2.7e+03 2.7e+03 vol1001_PV Transportation
2 1.28e+03 0.1 328 1e+03 0 595 3.29e+03 World_PV Transportation
3 5e+03 0.1 700 1e+03 0 3.74e+03 7.03e+03 OutOfWorld Transportation
1 5e+03 0.1 700 1e+03 0 7.03e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
@@ -276,9 +270,7 @@ Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolu
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 684 0.1 268 1e+03 0 2.7e+03 2.7e+03 vol1001_PV Transportation
2 1.28e+03 0.1 328 1e+03 0 595 3.29e+03 World_PV Transportation
3 5e+03 0.1 700 1e+03 0 3.74e+03 7.03e+03 OutOfWorld Transportation
1 5e+03 0.1 700 1e+03 0 7.03e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
@@ -326,9 +318,7 @@ Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolu
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 684 0.1 268 1e+03 0 2.7e+03 2.7e+03 vol1001_PV Transportation
2 1.28e+03 0.1 328 1e+03 0 595 3.29e+03 World_PV Transportation
3 5e+03 0.1 700 1e+03 0 3.74e+03 7.03e+03 OutOfWorld Transportation
1 5e+03 0.1 700 1e+03 0 7.03e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
@@ -376,9 +366,7 @@ Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolu
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 684 0.1 268 1e+03 0 2.7e+03 2.7e+03 vol1001_PV Transportation
2 1.28e+03 0.1 328 1e+03 0 595 3.29e+03 World_PV Transportation
3 5e+03 0.1 700 1e+03 0 3.74e+03 7.03e+03 OutOfWorld Transportation
1 5e+03 0.1 700 1e+03 0 7.03e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
@@ -422,7 +410,7 @@ Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolu
Run terminated.
Run Summary
Number of events processed : 20
User=0.01s Real=0.02s Sys=0s
User=0.01s Real=0.01s Sys=0s
/gun/direction 0 0 -1
/run/beamOn 20
@@ -505,9 +493,7 @@ Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolu
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 684 0.1 268 1e+03 0 2.7e+03 2.7e+03 vol1001_PV Transportation
2 1.28e+03 0.1 328 1e+03 0 595 3.29e+03 World_PV Transportation
3 5e+03 0.1 700 1e+03 0 3.74e+03 7.03e+03 OutOfWorld Transportation
1 5e+03 0.1 700 1e+03 0 7.03e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
@@ -555,9 +541,7 @@ Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolu
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 684 0.1 268 1e+03 0 2.7e+03 2.7e+03 vol1001_PV Transportation
2 1.28e+03 0.1 328 1e+03 0 595 3.29e+03 World_PV Transportation
3 5e+03 0.1 700 1e+03 0 3.74e+03 7.03e+03 OutOfWorld Transportation
1 5e+03 0.1 700 1e+03 0 7.03e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
@@ -605,9 +589,7 @@ Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolu
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 684 0.1 268 1e+03 0 2.7e+03 2.7e+03 vol1001_PV Transportation
2 1.28e+03 0.1 328 1e+03 0 595 3.29e+03 World_PV Transportation
3 5e+03 0.1 700 1e+03 0 3.74e+03 7.03e+03 OutOfWorld Transportation
1 5e+03 0.1 700 1e+03 0 7.03e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
@@ -655,9 +637,7 @@ Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolu
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 684 0.1 268 1e+03 0 2.7e+03 2.7e+03 vol1001_PV Transportation
2 1.28e+03 0.1 328 1e+03 0 595 3.29e+03 World_PV Transportation
3 5e+03 0.1 700 1e+03 0 3.74e+03 7.03e+03 OutOfWorld Transportation
1 5e+03 0.1 700 1e+03 0 7.03e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
@@ -705,9 +685,7 @@ Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolu
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 684 0.1 268 1e+03 0 2.7e+03 2.7e+03 vol1001_PV Transportation
2 1.28e+03 0.1 328 1e+03 0 595 3.29e+03 World_PV Transportation
3 5e+03 0.1 700 1e+03 0 3.74e+03 7.03e+03 OutOfWorld Transportation
1 5e+03 0.1 700 1e+03 0 7.03e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
@@ -755,9 +733,7 @@ Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolu
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 684 0.1 268 1e+03 0 2.7e+03 2.7e+03 vol1001_PV Transportation
2 1.28e+03 0.1 328 1e+03 0 595 3.29e+03 World_PV Transportation
3 5e+03 0.1 700 1e+03 0 3.74e+03 7.03e+03 OutOfWorld Transportation
1 5e+03 0.1 700 1e+03 0 7.03e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
@@ -801,7 +777,7 @@ Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolu
Run terminated.
Run Summary
Number of events processed : 20
User=0.02s Real=0.02s Sys=0.01s
User=0s Real=0.01s Sys=0s
/tracking/verbose 0
/gun/direction 0.3 0.2 1
/run/beamOn 20
@@ -841,7 +817,7 @@ Start Run processing.
Run terminated.
Run Summary
Number of events processed : 20
User=0s Real=0s Sys=0s
User=0.01s Real=0s Sys=0s
/gun/direction 0.3 -0.2 1
/run/beamOn 20
@@ -880,7 +856,7 @@ Start Run processing.
Run terminated.
Run Summary
Number of events processed : 20
User=0s Real=0s Sys=0s
User=0s Real=0.01s Sys=0s
/gun/direction -0.3 0.2 0.6
/run/beamOn 20
@@ -919,15 +895,14 @@ Start Run processing.
Run terminated.
Run Summary
Number of events processed : 20
User=0.01s Real=0s Sys=0s
User=0s Real=0s Sys=0s
G4 kernel has come to Quit state.
UserDetectorConstruction deleted.
UserPhysicsList deleted.
UserPrimaryGenerator deleted.
G4 kernel has come to Quit state.
EventManager deleted.
UImanager deleted.
Units table cleared.
StateManager deleted.
RunManagerKernel is deleted.
RunManager is deleting.
RunManager is deleted.
@@ -23,34 +23,38 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G01/include/G01DetectorConstruction.hh
/// \brief Definition of the G01DetectorConstruction class
//
// $Id: DetectorConstruction.hh,v 1.1 2010-10-11 08:40:51 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
#ifndef _DETECTORCONSTRUCTION_H_
#define _DETECTORCONSTRUCTION_H_
#ifndef _G01DETECTORCONSTRUCTION_H_
#define _G01DETECTORCONSTRUCTION_H_
#include "G4VUserDetectorConstruction.hh"
class DetectorConstruction : public G4VUserDetectorConstruction
/// Detector construction allowing to use the geometry read from the GDML file
class G01DetectorConstruction : public G4VUserDetectorConstruction
{
public:
DetectorConstruction(G4VPhysicalVolume *setWorld = 0)
G01DetectorConstruction(G4VPhysicalVolume *setWorld = 0)
{
World = setWorld;
fWorld = setWorld;
}
G4VPhysicalVolume *Construct()
{
return World;
return fWorld;
}
private:
G4VPhysicalVolume *World;
G4VPhysicalVolume *fWorld;
};
#endif
@@ -23,24 +23,28 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G01/include/G01PhysicsList.hh
/// \brief Definition of the G01PhysicsList class
//
// $Id: PhysicsList.hh,v 1.2 2008-11-10 15:39:34 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
#ifndef _PHYSICSLIST_H_
#define _PHYSICSLIST_H_
#ifndef _G01PHYSICSLIST_H_
#define _G01PHYSICSLIST_H_
#include "G4VUserPhysicsList.hh"
#include "G4ParticleTypes.hh"
#include "globals.hh"
class PhysicsList : public G4VUserPhysicsList
/// Minimal physics list just to demonstrate the use of GDML geometries
class G01PhysicsList : public G4VUserPhysicsList
{
public:
PhysicsList();
~PhysicsList();
G01PhysicsList();
~G01PhysicsList();
protected:
@@ -23,14 +23,17 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G01/include/G01PrimaryGeneratorAction.hh
/// \brief Definition of the G01PrimaryGeneratorAction class
//
//
// $Id: PrimaryGeneratorAction.hh,v 1.2 2008-11-10 15:39:34 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
#ifndef _PRIMARYGENERATORACTION_H_
#define _PRIMARYGENERATORACTION_H_
#ifndef _G01PRIMARYGENERATORACTION_H_
#define _G01PRIMARYGENERATORACTION_H_
#include "G4VUserPrimaryGeneratorAction.hh"
@@ -39,18 +42,20 @@
class G4Event;
class G4ParticleGun;
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
/// Minimal primary generator action to demonstrate the use of GDML geometries
class G01PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PrimaryGeneratorAction();
~PrimaryGeneratorAction();
G01PrimaryGeneratorAction();
~G01PrimaryGeneratorAction();
void GeneratePrimaries(G4Event* anEvent);
private:
G4ParticleGun* particleGun;
G4ParticleGun* fParticleGun;
};
#endif
@@ -23,9 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G01/load_gdml.cc
/// \brief Main program of the persistency/gdml/G01 example
//
// $Id: load_gdml.cc,v 1.13 2010-11-17 10:55:11 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
// --------------------------------------------------------------
@@ -41,9 +43,9 @@
#include "G4LogicalVolumeStore.hh"
#include "G4TransportationManager.hh"
#include "PrimaryGeneratorAction.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "G01PrimaryGeneratorAction.hh"
#include "G01DetectorConstruction.hh"
#include "G01PhysicsList.hh"
#ifdef G4VIS_USE
#include "G4VisExecutive.hh"
@@ -85,17 +87,17 @@ int main(int argc,char **argv)
G4RunManager* runManager = new G4RunManager;
runManager->SetUserInitialization(new DetectorConstruction(
runManager->SetUserInitialization(new G01DetectorConstruction(
parser.GetWorldVolume()));
runManager->SetUserInitialization(new PhysicsList);
runManager->SetUserAction(new PrimaryGeneratorAction);
runManager->SetUserInitialization(new G01PhysicsList);
runManager->SetUserAction(new G01PrimaryGeneratorAction);
runManager->Initialize();
if (argc>=3)
{
parser.Write(argv[2], G4TransportationManager::GetTransportationManager()->
GetNavigatorForTracking()->GetWorldVolume()->GetLogicalVolume());
GetNavigatorForTracking()->GetWorldVolume()->GetLogicalVolume());
}
G4UImanager* UImanager = G4UImanager::GetUIpointer();
@@ -12,7 +12,7 @@
4.0 -9.4
5.0 -11.1"/>
<matrix name="RINDEX" coldim="2" values="1.65 1.58" />
<matrix name="RINDEX" coldim="2" values="1.65*eV 1.58" />
</define>
<materials>
@@ -23,33 +23,45 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G01/src/G01PhysicsList.cc
/// \brief Implementation of the G01PhysicsList class
//
// $Id: PhysicsList.cc,v 1.1 2010-10-11 08:40:51 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
#include "PhysicsList.hh"
#include "G01PhysicsList.hh"
PhysicsList::PhysicsList()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G01PhysicsList::G01PhysicsList()
{
}
PhysicsList::~PhysicsList()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G01PhysicsList::~G01PhysicsList()
{
}
void PhysicsList::ConstructParticle()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G01PhysicsList::ConstructParticle()
{
G4Geantino::GeantinoDefinition();
}
void PhysicsList::ConstructProcess()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G01PhysicsList::ConstructProcess()
{
AddTransportation();
}
void PhysicsList::SetCuts()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G01PhysicsList::SetCuts()
{
G4int temp = GetVerboseLevel();
SetVerboseLevel(0);
@@ -23,37 +23,46 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G01/src/G01PrimaryGeneratorAction.cc
/// \brief Implementation of the G01PrimaryGeneratorAction class
//
// $Id: PrimaryGeneratorAction.cc,v 1.1 2010-10-11 08:40:51 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
#include "PrimaryGeneratorAction.hh"
#include "G01PrimaryGeneratorAction.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
PrimaryGeneratorAction::PrimaryGeneratorAction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G01PrimaryGeneratorAction::G01PrimaryGeneratorAction()
{
G4int n_particle = 1;
particleGun = new G4ParticleGun(n_particle);
fParticleGun = new G4ParticleGun(n_particle);
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
particleGun->SetParticleDefinition(
fParticleGun->SetParticleDefinition(
particleTable->FindParticle(particleName="geantino"));
particleGun->SetParticleEnergy(1.0*GeV);
particleGun->SetParticlePosition(G4ThreeVector(-2.0*m, 0.1, 0.1));
fParticleGun->SetParticleEnergy(1.0*GeV);
fParticleGun->SetParticlePosition(G4ThreeVector(-2.0*m, 0.1, 0.1));
}
PrimaryGeneratorAction::~PrimaryGeneratorAction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G01PrimaryGeneratorAction::~G01PrimaryGeneratorAction()
{
delete particleGun;
delete fParticleGun;
}
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G01PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
G4int i = anEvent->GetEventID() % 3;
G4ThreeVector v(1.0,0.0,0.0);
@@ -68,6 +77,6 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
v.setZ(0.1);
break;
}
particleGun->SetParticleMomentumDirection(v);
particleGun->GeneratePrimaryVertex(anEvent);
fParticleGun->SetParticleMomentumDirection(v);
fParticleGun->GeneratePrimaryVertex(anEvent);
}
@@ -0,0 +1,58 @@
//$Id$
///\file "persistency/gdml/G02/.README"
///\brief Example G02 README page
/*! \page ExampleG02 Example G02
\section G02_s1 EXAMPLE OF USE GDML READER/WRITER IN DETECTOR CONSTRUCTION
In this directory you can find a example showing how to use GDML module for
reading and writing. It is also shown how to Read STEP Tools files.
In this example the DetectorConstruction consists of a Simple Detector, then
this Detector is filled/written in GDML.
The different options for writing and reading GDML files are shown in the
Detector Construction: writing modular files, using different schema location,
setting parameters for names in GDML file, etc.
For more information, please, refer to the GDML Documentation.
The Geometry is a Simple Detector Box with 4 Subdetectors.
This setup shows how to use Reflection Factory, Assembly of Volumes and
Parameterisation.
Using commands or macros it possible to read or write GDML file.
\section G02_s2 HOW TO BUILD THE EXAMPLE ?
- You need to have built the persistency/gdml module by having
set the -DGEANT4_USE_GDML=ON flag during the CMAKE configuration step,
as well as the -DXERCESC_ROOT_DIR=<path_to_xercesc> flag pointing to
the path where the XercesC XML parser package is installed in your system.
- Compile and link to generate the executable (in your CMAKE build directory):
\verbatim
% make
\endverbatim
- Execute the application:
\verbatim
% geotest [macro-file].mac
\endverbatim
You can run this application with the following macro file:
- write_gdml.mac : This macro will write the Geometry defined in file
"test.gdml" and output to a new file wtest.gdml
To change this name you can use command :
/mydet/writeFile FileName.gdml
- read_gdml.mac : This macro will read the Geometry from file "test.gdml"
To change this name you can use command :
/mydet/readFile FileName.gdml
- read_step.mac : This macro will read the STEP Tool files "mbb.geom" and
"mbb.tree" and load them in memory.
To change this name you can use command :
/mydet/StepFile FileName
*/
@@ -0,0 +1,64 @@
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(G02)
#----------------------------------------------------------------------------
# Find Geant4 package, activating all available Vis drivers by default
# You can set WITH_GEANT4_VIS to OFF via the command line or ccmake/cmake-gui
# to build a batch mode only executable
#
option(WITH_GEANT4_VIS "Build example with Geant4 Vis drivers" ON)
if(WITH_GEANT4_VIS)
find_package(Geant4 REQUIRED gdml vis_all)
else()
find_package(Geant4 REQUIRED gdml)
endif()
#----------------------------------------------------------------------------
# Setup Geant4 include directories and compile definitions
#
include(${Geant4_USE_FILE})
#----------------------------------------------------------------------------
# Locate sources and headers for this project
#
include_directories(${PROJECT_SOURCE_DIR}/include
${Geant4_INCLUDE_DIR})
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
#----------------------------------------------------------------------------
# Add the executable, and link it to the Geant4 libraries
#
add_executable(geotest geotest.cc ${sources} ${headers})
target_link_libraries(geotest ${Geant4_LIBRARIES} )
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build G02. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
set(G02_SCRIPTS
read_gdml.mac read_step.mac test.gdml vis.mac write_gdml.mac
)
foreach(_script ${G02_SCRIPTS})
configure_file(
${PROJECT_SOURCE_DIR}/${_script}
${PROJECT_BINARY_DIR}/${_script}
COPYONLY
)
endforeach()
#----------------------------------------------------------------------------
# Add program to the project targets
# (this avoids the need of typing the program name after make)
#
add_custom_target(G02 DEPENDS geotest)
#----------------------------------------------------------------------------
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
#
install(TARGETS geotest DESTINATION bin)
@@ -17,6 +17,9 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
July 27th, 2011 Witek Pokorski G02-V09-05-00
- Cosmetic changes to comply to coding conventions
November 10th, 2011 Gabriele Cosmo G02-V09-04-01
- Changed from no longer supported physics-list QGSP-BERT-EMV to QGSP-BERT.
+6 -12
View File
@@ -20,22 +20,16 @@ $Id: README,v 1.2 2008-11-13 16:44:29 gcosmo Exp $
HOW TO BUILD THE EXAMPLE ?
- You need to have built the persistency/gdml plugin module along with the
Geant4 libraries, by having set the G4LIB_BUILD_GDML variable in your
environment.
It is also required to specify the path where the XercesC XML parser
package is installed in your system, through the variable XERCESCROOT.
- You need to have built the persistency/gdml module by having
set the -DGEANT4_USE_GDML=ON flag during the CMAKE configuration step,
as well as the -DXERCESC_ROOT_DIR=<path_to_xercesc> flag pointing to
the path where the XercesC XML parser package is installed in your system.
- Compile and link to generate the executable:
% gmake
- Compile and link to generate the executable (in your CMAKE build directory):
% make
- Execute the application:
% geotest [macro-file].mac
Note: if you are using dynamic libraries, you should add and
$XERCESCROOT/lib paths to the LD_LIBRARY_PATH directory (or
equivalent on your system).
You can run this application with the following macro file:
@@ -23,9 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G02/geotest.cc
/// \brief Main program of the persistency/gdml/G02 example
//
// $Id: geotest.cc,v 1.5 2010-11-30 10:53:38 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
// --------------------------------------------------------------
@@ -45,9 +47,9 @@
// Example includes
//
#include "DetectorConstruction.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "G02DetectorConstruction.hh"
#include "G02PrimaryGeneratorAction.hh"
#include "G02RunAction.hh"
#ifdef G4VIS_USE
#include "G4VisExecutive.hh"
@@ -66,11 +68,11 @@ int main(int argc, char** argv)
// Set mandatory initialization and user action classes
//
DetectorConstruction* detector = new DetectorConstruction;
G02DetectorConstruction* detector = new G02DetectorConstruction;
runManager->SetUserInitialization(detector);
runManager->SetUserInitialization(new QGSP_BERT);
runManager->SetUserAction(new PrimaryGeneratorAction);
RunAction* runAction = new RunAction;
runManager->SetUserAction(new G02PrimaryGeneratorAction);
G02RunAction* runAction = new G02RunAction;
runManager->SetUserAction(runAction);
// Initialisation of runManager via macro for the interactive mode
@@ -23,11 +23,13 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G02/include/G02ChamberParameterisation.hh
/// \brief Definition of the G02ChamberParameterisation class
//
// $Id: ChamberParameterisation.hh,v 1.1 2008-08-27 10:30:18 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Class ChamberParameterisation
// $Id$
//
// Class G02ChamberParameterisation
//
// A parameterisation that describes a series of boxes along Z
// The boxes have equal width; their lengths are a linear equation.
@@ -35,8 +37,8 @@
//
// ----------------------------------------------------------------------------
#ifndef ChamberParameterisation_H
#define ChamberParameterisation_H 1
#ifndef G02ChamberParameterisation_H
#define G02ChamberParameterisation_H 1
#include "globals.hh"
#include "G4VPVParameterisation.hh"
@@ -60,18 +62,20 @@ class G4Polyhedra;
// ----------------------------------------------------------------------------
class ChamberParameterisation : public G4VPVParameterisation
/// Chamber parametrisation used in the GDML read/write example
class G02ChamberParameterisation : public G4VPVParameterisation
{
public:
ChamberParameterisation(G4int NoChambers,
G02ChamberParameterisation(G4int NoChambers,
G4double startZ,
G4double spacing,
G4double widthChamber,
G4double lengthInitial,
G4double lengthFinal );
virtual ~ChamberParameterisation();
virtual ~G02ChamberParameterisation();
void ComputeTransformation (const G4int copyNo,
G4VPhysicalVolume* physVol) const;
@@ -23,18 +23,20 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G02/include/G02DetectorConstruction.hh
/// \brief Definition of the G02DetectorConstruction class
//
// $Id: DetectorConstruction.hh,v 1.1 2008-08-27 10:30:18 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Class DetectorConstruction
// $Id$
//
// Class G02DetectorConstruction
//
// A detector construction class loading the geometry from GDML files.
//
// ----------------------------------------------------------------------------
#ifndef DetectorConstruction_H
#define DetectorConstruction_H 1
#ifndef G02DetectorConstruction_H
#define G02DetectorConstruction_H 1
#include "G4VUserDetectorConstruction.hh"
@@ -44,18 +46,20 @@
#include "globals.hh"
class DetectorMessenger;
class G02DetectorMessenger;
// ----------------------------------------------------------------------------
class DetectorConstruction : public G4VUserDetectorConstruction
/// Detector construction used in GDML read/write example
class G02DetectorConstruction : public G4VUserDetectorConstruction
{
public:
// Constructor and destructor
//
DetectorConstruction();
~DetectorConstruction();
G02DetectorConstruction();
~G02DetectorConstruction();
// Construction of SubDetectors
//
@@ -81,29 +85,29 @@ class DetectorConstruction : public G4VUserDetectorConstruction
private:
G4Material* Air ;
G4Material* Aluminum ;
G4Material* Pb;
G4Material* Xenon;
G4Material* fAir ;
G4Material* fAluminum ;
G4Material* fPb;
G4Material* fXenon;
// GDMLparser
//
G4GDMLParser parser;
G4GDMLParser fParser;
// Reading and Writing Settings
//
G4String fReadFile;
G4String fWriteFile;
G4String fStepFile;
G4int writingChoice;
G4int fWritingChoice;
// Detector Messenger
//
DetectorMessenger* detectorMessenger;
G02DetectorMessenger* fDetectorMessenger;
// World Dimentions
//
G4double expHall_x;
G4double fExpHall_x;
};
// ----------------------------------------------------------------------------
@@ -23,47 +23,51 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G02/include/G02DetectorMessenger.hh
/// \brief Definition of the G02DetectorMessenger class
//
// $Id: DetectorMessenger.hh,v 1.1 2008-08-27 10:30:18 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Class DetectorMessenger
// $Id$
//
// Class G02DetectorMessenger
//
// Utility messenger for defining run-time commands relative to the example.
//
// ----------------------------------------------------------------------------
#ifndef DetectorMessenger_h
#define DetectorMessenger_h 1
#ifndef G02DetectorMessenger_h
#define G02DetectorMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class DetectorConstruction;
class G02DetectorConstruction;
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
// ----------------------------------------------------------------------------
class DetectorMessenger: public G4UImessenger
/// Detector messenger class used in GDML read/write example
class G02DetectorMessenger: public G4UImessenger
{
public:
DetectorMessenger( DetectorConstruction* );
~DetectorMessenger();
G02DetectorMessenger( G02DetectorConstruction* );
~G02DetectorMessenger();
void SetNewValue( G4UIcommand*, G4String );
void SetNewValue( G4UIcommand*, G4int );
private:
DetectorConstruction* theDetector;
G4UIdirectory* theDetectorDir;
G4UIcmdWithAString* theReadCommand;
G4UIcmdWithAString* theWriteCommand;
G4UIcmdWithAString* theStepCommand;
G02DetectorConstruction* fTheDetector;
G4UIdirectory* fTheDetectorDir;
G4UIcmdWithAString* fTheReadCommand;
G4UIcmdWithAString* fTheWriteCommand;
G4UIcmdWithAString* fTheStepCommand;
};
// ----------------------------------------------------------------------------
@@ -23,18 +23,20 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G02/include/G02PrimaryGeneratorAction.hh
/// \brief Definition of the G02PrimaryGeneratorAction class
//
// $Id: PrimaryGeneratorAction.hh,v 1.1 2008-08-27 10:30:18 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Class PrimaryGeneratorAction
// $Id$
//
// Class G02PrimaryGeneratorAction
//
// Simple primary-generator action class.
//
// ----------------------------------------------------------------------------
#ifndef PrimaryGeneratorAction_h
#define PrimaryGeneratorAction_h 1
#ifndef G02PrimaryGeneratorAction_h
#define G02PrimaryGeneratorAction_h 1
#include "G4ParticleTable.hh"
#include "G4ParticleGun.hh"
@@ -44,14 +46,16 @@
// ----------------------------------------------------------------------------
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
/// Primary generator action used in GDML read/write example
class G02PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
// Constructor and destructor
//
PrimaryGeneratorAction();
~PrimaryGeneratorAction();
G02PrimaryGeneratorAction();
~G02PrimaryGeneratorAction();
// Used by Geant4 to generate the primary particles of the event
//
@@ -59,8 +63,8 @@ class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
private:
G4ParticleGun* particleGun;
G4ParticleTable * particleTable;
G4ParticleGun* fParticleGun;
G4ParticleTable * fParticleTable;
};
// ----------------------------------------------------------------------------
@@ -23,18 +23,20 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G02/include/G02RunAction.hh
/// \brief Definition of the G02RunAction class
//
// $Id: RunAction.hh,v 1.2 2008-12-18 12:57:10 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Class RunAction
// $Id$
//
// Class G02RunAction
//
// Simple run action class.
//
// ----------------------------------------------------------------------------
#ifndef RunAction_h
#define RunAction_h 1
#ifndef G02RunAction_h
#define G02RunAction_h 1
#include <iostream>
@@ -45,12 +47,14 @@ class G4Run;
// ----------------------------------------------------------------------------
class RunAction : public G4UserRunAction
/// Run action used in GDML read/write example
class G02RunAction : public G4UserRunAction
{
public:
RunAction();
~RunAction();
G02RunAction();
~G02RunAction();
void BeginOfRunAction(const G4Run*);
void EndOfRunAction(const G4Run*);
@@ -1,95 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: DetectorMessenger.cc,v 1.3 2008-12-18 12:57:06 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Class DetectorMessenger implementation
//
// ----------------------------------------------------------------------------
#include "globals.hh"
#include "DetectorMessenger.hh"
#include "DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
// ----------------------------------------------------------------------------
DetectorMessenger::DetectorMessenger( DetectorConstruction* myDet )
: theDetector( myDet )
{
theDetectorDir = new G4UIdirectory( "/mydet/" );
theDetectorDir->SetGuidance("Detector control.");
theReadCommand = new G4UIcmdWithAString("/mydet/readFile", this);
theReadCommand ->SetGuidance("READ GDML file with given name");
theReadCommand ->SetParameterName("FileRead", false);
theReadCommand ->SetDefaultValue("test.gdml");
theReadCommand ->AvailableForStates(G4State_PreInit);
theWriteCommand = new G4UIcmdWithAString("/mydet/writeFile", this);
theWriteCommand ->SetGuidance("WRITE geometry to GDML file with given name");
theWriteCommand ->SetParameterName("FileWrite", false);
theWriteCommand ->SetDefaultValue("wtest.gdml");
theWriteCommand ->AvailableForStates(G4State_PreInit);
theStepCommand = new G4UIcmdWithAString("/mydet/StepFile", this);
theStepCommand ->SetGuidance("Read STEP Tools files (name without extension)");
theStepCommand ->SetParameterName("STEPFile", false);
theStepCommand ->SetDefaultValue("mbb");
theStepCommand ->AvailableForStates(G4State_PreInit);
}
// ----------------------------------------------------------------------------
DetectorMessenger::~DetectorMessenger()
{
delete theReadCommand;
delete theWriteCommand;
delete theStepCommand;
delete theDetectorDir;
}
// ----------------------------------------------------------------------------
void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if ( command == theReadCommand )
{
theDetector->SetReadFile(newValue );
}
if ( command == theWriteCommand )
{
theDetector->SetWriteFile(newValue );
}
if ( command == theStepCommand )
{
theDetector->SetStepFile(newValue );
}
}
@@ -23,24 +23,26 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G02/src/G02ChamberParameterisation.cc
/// \brief Implementation of the G02ChamberParameterisation class
//
// $Id: ChamberParameterisation.cc,v 1.2 2008-12-18 12:57:02 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Class ChamberParameterisation implementation
// $Id$
//
// Class G02ChamberParameterisation implementation
//
// ----------------------------------------------------------------------------
#include "ChamberParameterisation.hh"
#include "G02ChamberParameterisation.hh"
#include "G4ThreeVector.hh"
#include "G4Box.hh"
#include "G4VPhysicalVolume.hh"
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ChamberParameterisation::
ChamberParameterisation( G4int NoChambers,
G02ChamberParameterisation::
G02ChamberParameterisation( G4int NoChambers,
G4double startZ, // Z of center of first
G4double spacingZ, // Z spacing of centers
G4double widthChamber,
@@ -58,21 +60,21 @@ ChamberParameterisation( G4int NoChambers,
fHalfLengthIncr = 0.5 * (lengthFinal-lengthInitial)/NoChambers;
if (spacingZ < widthChamber)
{
G4Exception("ExN02ChamberParameterisation::ChamberParameterisation()",
G4Exception("ExN02G02ChamberParameterisation::G02ChamberParameterisation()",
"InvalidSetup", FatalException,
"Invalid construction: Width>Spacing");
}
}
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ChamberParameterisation::~ChamberParameterisation()
G02ChamberParameterisation::~G02ChamberParameterisation()
{}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ChamberParameterisation::
void G02ChamberParameterisation::
ComputeTransformation (const G4int copyNo, G4VPhysicalVolume* physVol) const
{
G4double Zposition = fStartZ + (copyNo+1) * fSpacing;
@@ -81,9 +83,9 @@ ComputeTransformation (const G4int copyNo, G4VPhysicalVolume* physVol) const
physVol->SetRotation(0);
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ChamberParameterisation::
void G02ChamberParameterisation::
ComputeDimensions (G4Box& trackerChamber, const G4int copyNo,
const G4VPhysicalVolume*) const
{
@@ -93,4 +95,4 @@ ComputeDimensions (G4Box& trackerChamber, const G4int copyNo,
trackerChamber.SetZHalfLength(fHalfWidth);
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -22,16 +22,18 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//g
/// \file persistency/gdml/G02/src/G02DetectorConstruction.cc
/// \brief Implementation of the G02DetectorConstruction class
//
//
// $Id: DetectorConstruction.cc,v 1.8 2009-04-24 15:47:13 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// Class DetectorConstruction implementation
// Class G02DetectorConstruction implementation
//
// ----------------------------------------------------------------------------
#include "DetectorConstruction.hh"
#include "G02DetectorConstruction.hh"
// Geant4 includes
//
@@ -67,53 +69,56 @@
// Volume parameterisations
//
#include "ChamberParameterisation.hh"
#include "G02ChamberParameterisation.hh"
// Messenger
//
#include "DetectorMessenger.hh"
#include "G02DetectorMessenger.hh"
// GDML parser include
//
#include "G4GDMLParser.hh"
// ----------------------------------------------------------------------------
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
// Constructor
//
DetectorConstruction::DetectorConstruction()
: Air(0), Aluminum(0), Pb(0), Xenon(0)
G02DetectorConstruction::G02DetectorConstruction()
: fAir(0), fAluminum(0), fPb(0), fXenon(0)
{
expHall_x=5.*m;
fExpHall_x=5.*m;
fReadFile ="test.gdml";
fWriteFile="wtest.gdml";
fStepFile ="mbb";
writingChoice=1;
fWritingChoice=1;
detectorMessenger = new DetectorMessenger( this );
fDetectorMessenger = new G02DetectorMessenger( this );
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
// Destructor
//
DetectorConstruction::~DetectorConstruction()
G02DetectorConstruction::~G02DetectorConstruction()
{
if(detectorMessenger) delete detectorMessenger;
if(fDetectorMessenger) delete fDetectorMessenger;
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
// Constructs geometries and materials
//
G4VPhysicalVolume* DetectorConstruction::Construct()
G4VPhysicalVolume* G02DetectorConstruction::Construct()
{
// Writing or Reading of Geometry using G4GDML
G4VPhysicalVolume* fWorldPhysVol;
if(writingChoice==0)
if(fWritingChoice==0)
{
// **** LOOK HERE*** FOR READING GDML FILES
//
@@ -121,15 +126,15 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
// ACTIVATING OVERLAP CHECK when read volumes are placed.
// Can take long time in case of complex geometries
//
// parser.SetOverlapCheck(true);
// fParser.SetOverlapCheck(true);
parser.Read(fReadFile);
fParser.Read(fReadFile);
// READING GDML FILES OPTION: 2nd Boolean argument "Validate".
// Flag to "false" disables check with the Schema when reading GDML file.
// See the GDML Documentation for more information.
//
// parser.Read(fReadFile,false);
// fParser.Read(fReadFile,false);
// Prints the material information
//
@@ -137,9 +142,9 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
// Giving World Physical Volume from GDML Parser
//
fWorldPhysVol = parser.GetWorldVolume();
fWorldPhysVol = fParser.GetWorldVolume();
}
else if(writingChoice==1)
else if(fWritingChoice==1)
{
// **** LOOK HERE*** FOR WRITING GDML FILES
// Detector Construction and WRITING to GDML
@@ -167,11 +172,11 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
//
// or
//
// parser.Write(fWriteFile, fWorldPhysVol, false);
// fParser.Write(fWriteFile, fWorldPhysVol, false);
// Writing Geometry to GDML File
//
parser.Write(fWriteFile, fWorldPhysVol);
fParser.Write(fWriteFile, fWorldPhysVol);
// OPTION: SPECIFYING THE SCHEMA LOCATION
//
@@ -185,7 +190,7 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
// You can change the Schema path by adding a parameter to the Write
// command, as follows:
//
// parser.Write(fWriteFile, fWorldPhysVol, "your-path-to-schema/gdml.xsd");
// fParser.Write(fWriteFile, fWorldPhysVol, "your-path-to-schema/gdml.xsd");
}
else // Demonstration how to Read STEP files using GDML
{
@@ -195,23 +200,23 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
// Arbitrary values that should enclose any reasonable geometry
//
const G4double expHall_y = expHall_x/50.;
const G4double expHall_z = expHall_x/50.;
const G4double expHall_y = fExpHall_x/50.;
const G4double expHall_z = fExpHall_x/50.;
// Create the hall
//
G4Box * experimentalHallBox
= new G4Box("ExpHallBox",expHall_x/50.,expHall_y,expHall_z);
= new G4Box("ExpHallBox",fExpHall_x/50.,expHall_y,expHall_z);
G4LogicalVolume * experimentalHallLV
= new G4LogicalVolume(experimentalHallBox, Air,"ExpHallLV");
= new G4LogicalVolume(experimentalHallBox, fAir,"ExpHallLV");
fWorldPhysVol
= new G4PVPlacement(0, G4ThreeVector(0.0,0.0,0.0),
experimentalHallLV, "ExpHallPhys", 0, false, 0);
// DetectorConstruction via reading STEP File
// G02DetectorConstruction via reading STEP File
//
G4LogicalVolume* LogicalVolST
= parser.ParseST(fStepFile,Air,Aluminum);
= fParser.ParseST(fStepFile,fAir,fAluminum);
// Placement inside of the hall
//
@@ -227,11 +232,11 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
return fWorldPhysVol;
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
// Utility to build and list necessary materials
//
void DetectorConstruction::ListOfMaterials()
void G02DetectorConstruction::ListOfMaterials()
{
G4double a; // atomic mass
G4double z; // atomic number
@@ -258,23 +263,23 @@ void DetectorConstruction::ListOfMaterials()
// Air
//
density = 1.29*mg/cm3;
Air = new G4Material(name="Air", density, ncomponents=2);
Air->AddElement(elN, fractionmass=0.7);
Air->AddElement(elO, fractionmass=0.3);
fAir = new G4Material(name="Air", density, ncomponents=2);
fAir->AddElement(elN, fractionmass=0.7);
fAir->AddElement(elO, fractionmass=0.3);
// Aluminum
//
density = 2.70*g/cm3;
Aluminum = new G4Material(name="Aluminum", density, ncomponents=1);
Aluminum->AddElement(elAl, fractionmass=1.0);
fAluminum = new G4Material(name="Aluminum", density, ncomponents=1);
fAluminum->AddElement(elAl, fractionmass=1.0);
// Lead
//
Pb = new G4Material("Lead", z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
fPb = new G4Material("Lead", z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
// Xenon gas
//
Xenon = new G4Material("XenonGas", z=54., a=131.29*g/mole,
fXenon = new G4Material("XenonGas", z=54., a=131.29*g/mole,
density= 5.458*mg/cm3, kStateGas,
temperature= 293.15*kelvin, pressure= 1*atmosphere);
@@ -283,7 +288,7 @@ void DetectorConstruction::ListOfMaterials()
G4cout << *(G4Material::GetMaterialTable() ) << G4endl;
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
// Detector Construction
//
@@ -291,27 +296,27 @@ void DetectorConstruction::ListOfMaterials()
// SubDetectors1 and 2 show how to use Reflection Factory and Assembly
// SubDetectors 3 and 4 show how to use Parameterisation
//
G4VPhysicalVolume* DetectorConstruction::ConstructDetector()
G4VPhysicalVolume* G02DetectorConstruction::ConstructDetector()
{
// Arbitary values that should enclose any reasonable geometry
//
const G4double expHall_y = expHall_x;
const G4double expHall_z = expHall_x;
const G4double expHall_y = fExpHall_x;
const G4double expHall_z = fExpHall_x;
// Create the hall
//
G4Box * experimentalHallBox =
new G4Box("ExpHallBox", expHall_x, expHall_y, expHall_z);
new G4Box("ExpHallBox", fExpHall_x, expHall_y, expHall_z);
G4LogicalVolume * experimentalHallLV =
new G4LogicalVolume(experimentalHallBox, Air, "ExpHallLV");
new G4LogicalVolume(experimentalHallBox, fAir, "ExpHallLV");
G4PVPlacement * experimentalHallPhys =
new G4PVPlacement(0, G4ThreeVector(0.0,0.0,0.0), experimentalHallLV,
"ExpHallPhys", 0, false, 0);
// DetectorConstruction
// G02DetectorConstruction
const G4double det_x = expHall_x*0.8;
const G4double det_y = expHall_x*0.7;
const G4double det_x = fExpHall_x*0.8;
const G4double det_y = fExpHall_x*0.7;
const G4double det_z = det_y;
// Create the detector box
@@ -319,28 +324,28 @@ G4VPhysicalVolume* DetectorConstruction::ConstructDetector()
G4Box * detectorBox =
new G4Box("detectorBox", det_x, det_y, det_z);
G4LogicalVolume * detectorLV =
new G4LogicalVolume(detectorBox, Air, "detLV");
new G4LogicalVolume(detectorBox, fAir, "detLV");
// G4PVPlacement * detectorPhys =
new G4PVPlacement(0, G4ThreeVector(0.0,0.0,0.0), detectorLV,
"detPhys", experimentalHallLV, false, 0);
// Create the Control room box
//
const G4double room_x = expHall_x/20.;
const G4double room_x = fExpHall_x/20.;
const G4double room_y = room_x;
const G4double room_z = room_x;
G4Box * roomBox =
new G4Box("roomBox", room_x, room_y, room_z);
G4LogicalVolume * roomLV =
new G4LogicalVolume(roomBox, Air, "roomLV");
new G4LogicalVolume(roomBox, fAir, "roomLV");
// G4PVPlacement * roomPhys =
new G4PVPlacement(0, G4ThreeVector(expHall_x-room_x-10.,0.0,0.0), roomLV,
new G4PVPlacement(0, G4ThreeVector(fExpHall_x-room_x-10.,0.0,0.0), roomLV,
"roomPhys", experimentalHallLV, false, 0);
// SubDetector1
//
const G4double bigL=expHall_x/5.+50.;
const G4double bigL=fExpHall_x/5.+50.;
G4LogicalVolume* subDetectorLV1 = ConstructSubDetector1();
// G4PVPlacement * detPhys1 =
new G4PVPlacement(0, G4ThreeVector(bigL,0.0,0.0), subDetectorLV1,
@@ -384,13 +389,13 @@ G4VPhysicalVolume* DetectorConstruction::ConstructDetector()
return experimentalHallPhys;
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
// SubDetector1
//
G4LogicalVolume* DetectorConstruction::ConstructSubDetector1()
G4LogicalVolume* G02DetectorConstruction::ConstructSubDetector1()
{
const G4double sub_x = expHall_x/5.;
const G4double sub_x = fExpHall_x/5.;
const G4double sub_y = sub_x;
// Create the hall
@@ -398,7 +403,7 @@ G4LogicalVolume* DetectorConstruction::ConstructSubDetector1()
G4Tubs * subTub =
new G4Tubs("subTub", 0., sub_x, sub_y, -90.*deg, 180*deg);
G4LogicalVolume * subTubLV =
new G4LogicalVolume(subTub, Pb, "tubLV");
new G4LogicalVolume(subTub, fPb, "tubLV");
G4LogicalVolume *AssemblyLV = ConstructAssembly();
// G4PVPlacement * detAss =
new G4PVPlacement(0, G4ThreeVector(sub_x/3,0.0,0.0), AssemblyLV,
@@ -406,13 +411,13 @@ G4LogicalVolume* DetectorConstruction::ConstructSubDetector1()
return subTubLV;
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
// SubDetector2
//
G4LogicalVolume* DetectorConstruction::ConstructSubDetector2()
G4LogicalVolume* G02DetectorConstruction::ConstructSubDetector2()
{
const G4double sub_x = expHall_x/10.;
const G4double sub_x = fExpHall_x/10.;
const G4double sub_y = sub_x*2.;
const G4double sub_z = sub_x;
@@ -421,18 +426,18 @@ G4LogicalVolume* DetectorConstruction::ConstructSubDetector2()
G4Box * detHallBox =
new G4Box("detHallBox", sub_x, sub_y, sub_z);
G4LogicalVolume * detHallLV =
new G4LogicalVolume(detHallBox, Aluminum, "detHallLV");
new G4LogicalVolume(detHallBox, fAluminum, "detHallLV");
return detHallLV;
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
// Assembly
//
G4LogicalVolume* DetectorConstruction::ConstructAssembly()
G4LogicalVolume* G02DetectorConstruction::ConstructAssembly()
{
const G4double big_x = expHall_x/17;
const G4double big_x = fExpHall_x/17;
const G4double big_y = big_x;
const G4double big_z = big_x;
@@ -441,7 +446,7 @@ G4LogicalVolume* DetectorConstruction::ConstructAssembly()
G4Box * OuterBox =
new G4Box("OuterBox", big_x, big_y, big_z);
G4LogicalVolume * OuterBoxLV =
new G4LogicalVolume(OuterBox, Air, "OuterBoxLV");
new G4LogicalVolume(OuterBox, fAir, "OuterBoxLV");
// G4PVPlacement * OuterBoxPhys =
new G4PVPlacement(0, G4ThreeVector(0.0,0.0,0.0), OuterBoxLV,
"OuterBoxPhys", 0, false, 0);
@@ -455,15 +460,15 @@ G4LogicalVolume* DetectorConstruction::ConstructAssembly()
G4Box * BigBox =
new G4Box("BBox", bigL, bigL, bigL);
G4LogicalVolume * BigBoxLV =
new G4LogicalVolume(BigBox, Aluminum, "AlBigBoxLV");
new G4LogicalVolume(BigBox, fAluminum, "AlBigBoxLV");
G4Box * MedBox =
new G4Box("MBox", medL, medL, medL);
G4LogicalVolume * MedBoxLV1 =
new G4LogicalVolume(MedBox, Aluminum, "AlMedBoxLV1");
new G4LogicalVolume(MedBox, fAluminum, "AlMedBoxLV1");
G4Box * SmallBox =
new G4Box("SBox", smalL, smalL, smalL);
G4LogicalVolume * SmallBoxLV =
new G4LogicalVolume(SmallBox, Aluminum, "AlSmaBoxLV");
new G4LogicalVolume(SmallBox, fAluminum, "AlSmaBoxLV");
const G4double bigPlace=bigL+10.;
const G4double medPlace=medL+10.;
@@ -485,7 +490,7 @@ G4LogicalVolume* DetectorConstruction::ConstructAssembly()
G4ReflectedSolid * ReflBig =
new G4ReflectedSolid("Refll_Big", BigTube, transform);
G4LogicalVolume * ReflBigLV =
new G4LogicalVolume(ReflBig, Xenon, "ReflBigAl");
new G4LogicalVolume(ReflBig, fXenon, "ReflBigAl");
new G4PVPlacement(0, G4ThreeVector(0.,0.0,0.0), ReflBigLV,
"AlPhysBigTube", SmallBoxLV, false, 0);
//
@@ -529,13 +534,13 @@ G4LogicalVolume* DetectorConstruction::ConstructAssembly()
return OuterBoxLV;
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
// Parameterised Chamber
//
G4LogicalVolume* DetectorConstruction::ConstructParametrisationChamber()
G4LogicalVolume* G02DetectorConstruction::ConstructParametrisationChamber()
{
const G4double chamber_x = expHall_x/12.;
const G4double chamber_x = fExpHall_x/12.;
const G4double chamber_y = chamber_x;
const G4double chamber_z = chamber_x;
@@ -544,7 +549,7 @@ G4LogicalVolume* DetectorConstruction::ConstructParametrisationChamber()
G4Box * paramChamberBox =
new G4Box("ChamberBox", chamber_x, chamber_y, chamber_z);
G4LogicalVolume * paramChamberLV =
new G4LogicalVolume(paramChamberBox, Air, "ChamberLV");
new G4LogicalVolume(paramChamberBox, fAir, "ChamberLV");
// Parametrisation Chamber (taken from N02 novice example)
//
@@ -560,14 +565,14 @@ G4LogicalVolume* DetectorConstruction::ConstructParametrisationChamber()
G4Box *solidChamber =
new G4Box("chamber", 10*cm, 10*cm, 1*cm);
G4LogicalVolume* logicChamber =
new G4LogicalVolume(solidChamber, Aluminum, "Chamber", 0, 0, 0);
new G4LogicalVolume(solidChamber, fAluminum, "Chamber", 0, 0, 0);
G4double firstPosition = -trackerSize + 0.5*ChamberWidth;
G4double firstLength = fTrackerLength/10;
G4double lastLength = fTrackerLength;
G4VPVParameterisation* chamberParam =
new ChamberParameterisation( NbOfChambers, // NoChambers
new G02ChamberParameterisation( NbOfChambers, // NoChambers
firstPosition, // Z of center of first
ChamberSpacing, // Z spacing of centers
ChamberWidth, // Width Chamber
@@ -583,32 +588,32 @@ G4LogicalVolume* DetectorConstruction::ConstructParametrisationChamber()
return paramChamberLV;
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
// SetReadFile
//
void DetectorConstruction::SetReadFile( const G4String& File )
void G02DetectorConstruction::SetReadFile( const G4String& File )
{
fReadFile=File;
writingChoice=0;
fWritingChoice=0;
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
// SetWriteFile
//
void DetectorConstruction::SetWriteFile( const G4String& File )
void G02DetectorConstruction::SetWriteFile( const G4String& File )
{
fWriteFile=File;
writingChoice=1;
fWritingChoice=1;
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
// SetStepFile
//
void DetectorConstruction::SetStepFile( const G4String& File )
void G02DetectorConstruction::SetStepFile( const G4String& File )
{
fStepFile=File;
writingChoice=3;
fWritingChoice=3;
}
@@ -0,0 +1,97 @@
//
// ********************************************************************
// * 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 persistency/gdml/G02/src/G02DetectorMessenger.cc
/// \brief Implementation of the G02DetectorMessenger class
//
//
// $Id$
//
// Class G02DetectorMessenger implementation
//
// ----------------------------------------------------------------------------
#include "globals.hh"
#include "G02DetectorMessenger.hh"
#include "G02DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G02DetectorMessenger::G02DetectorMessenger( G02DetectorConstruction* myDet )
: fTheDetector( myDet )
{
fTheDetectorDir = new G4UIdirectory( "/mydet/" );
fTheDetectorDir->SetGuidance("Detector control.");
fTheReadCommand = new G4UIcmdWithAString("/mydet/readFile", this);
fTheReadCommand ->SetGuidance("READ GDML file with given name");
fTheReadCommand ->SetParameterName("FileRead", false);
fTheReadCommand ->SetDefaultValue("test.gdml");
fTheReadCommand ->AvailableForStates(G4State_PreInit);
fTheWriteCommand = new G4UIcmdWithAString("/mydet/writeFile", this);
fTheWriteCommand ->SetGuidance("WRITE geometry to GDML file with given name");
fTheWriteCommand ->SetParameterName("FileWrite", false);
fTheWriteCommand ->SetDefaultValue("wtest.gdml");
fTheWriteCommand ->AvailableForStates(G4State_PreInit);
fTheStepCommand = new G4UIcmdWithAString("/mydet/StepFile", this);
fTheStepCommand ->SetGuidance("Read STEP Tools files (name without extension)");
fTheStepCommand ->SetParameterName("STEPFile", false);
fTheStepCommand ->SetDefaultValue("mbb");
fTheStepCommand ->AvailableForStates(G4State_PreInit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G02DetectorMessenger::~G02DetectorMessenger()
{
delete fTheReadCommand;
delete fTheWriteCommand;
delete fTheStepCommand;
delete fTheDetectorDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G02DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if ( command == fTheReadCommand )
{
fTheDetector->SetReadFile(newValue );
}
if ( command == fTheWriteCommand )
{
fTheDetector->SetWriteFile(newValue );
}
if ( command == fTheStepCommand )
{
fTheDetector->SetStepFile(newValue );
}
}
@@ -23,52 +23,55 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G02/src/G02PrimaryGeneratorAction.cc
/// \brief Implementation of the G02PrimaryGeneratorAction class
//
// $Id: PrimaryGeneratorAction.cc,v 1.2 2008-12-18 12:57:08 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Class PrimaryGeneratorAction implementation
// $Id$
//
// Class G02PrimaryGeneratorAction implementation
//
// ----------------------------------------------------------------------------
#include "PrimaryGeneratorAction.hh"
#include "G02PrimaryGeneratorAction.hh"
#include "globals.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::PrimaryGeneratorAction()
G02PrimaryGeneratorAction::G02PrimaryGeneratorAction()
{
// Particle gun and particle table
//
particleGun = new G4ParticleGun();
particleTable = G4ParticleTable::GetParticleTable();
fParticleGun = new G4ParticleGun();
fParticleTable = G4ParticleTable::GetParticleTable();
// Default particle
//
particleGun->SetParticleDefinition(particleTable->FindParticle("geantino"));
particleGun->SetParticleEnergy( 1.0*MeV );
fParticleGun->SetParticleDefinition(fParticleTable->FindParticle("geantino"));
fParticleGun->SetParticleEnergy( 1.0*MeV );
G4ThreeVector err1=G4ThreeVector(-1260,-560,40); // outside
G4ThreeVector err2=G4ThreeVector(100,-240,120); // inside
G4ThreeVector err2v=(err2-err1).unit();
particleGun->SetParticleMomentumDirection(err2v);
particleGun->SetParticlePosition(err1);
fParticleGun->SetParticleMomentumDirection(err2v);
fParticleGun->SetParticlePosition(err1);
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::~PrimaryGeneratorAction()
G02PrimaryGeneratorAction::~G02PrimaryGeneratorAction()
{
delete particleGun;
delete fParticleGun;
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
void G02PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
particleGun->GeneratePrimaryVertex(anEvent);
fParticleGun->GeneratePrimaryVertex(anEvent);
}
@@ -23,11 +23,13 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G02/src/G02RunAction.cc
/// \brief Implementation of the G02RunAction class
//
// $Id: RunAction.cc,v 1.1 2008-11-20 15:41:54 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Class RunAction implementation
// $Id$
//
// Class G02RunAction implementation
//
// ----------------------------------------------------------------------------
@@ -36,35 +38,35 @@
#include "globals.hh"
#include "Randomize.hh"
#include "RunAction.hh"
#include "G02RunAction.hh"
#include "G4Run.hh"
#include "G4UImanager.hh"
#include "G4VVisManager.hh"
#include "G4VisAttributes.hh"
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::RunAction()
G02RunAction::G02RunAction()
{
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::~RunAction()
G02RunAction::~G02RunAction()
{
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::BeginOfRunAction(const G4Run* aRun)
void G02RunAction::BeginOfRunAction(const G4Run* aRun)
{
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::EndOfRunAction(const G4Run*)
void G02RunAction::EndOfRunAction(const G4Run*)
{
if (G4VVisManager::GetConcreteInstance())
{
@@ -0,0 +1,50 @@
//$Id$
///\file "persistency/gdml/G03/.README"
///\brief Example G03 README page
/*! \page ExampleG03 Example G03
\section G03_s1 EXAMPLE OF DEFINITION OF A GDML EXTENSION WITH ASSOCIATED READER AND WRITER
In this directory you can find an example showing how to extend the GDML
schema and plug-in a custom reader and writer to the system for handling
the extension.
For more information, please, refer to the GDML Documentation.
The Geometry is a Simple Box to which it is assigned a color as
visualization attribute.
The entity "color" is defined as part of the "extension" tag and properly
implemented in the GDML schema extension placed inside the directory
SimpleExtensionSchema.
The GDML file implenting the geometry with colors extension is
color_extension.gdml, in which the standard "gdml" tag has been replaced
by the "gdml_simple_extension" tag, with relative location for the new schema.
The GDML file is automatically loaded by the program.
It is also possible to use UI commands or macros as arguments to read any
standard GDML file.
\section G03_s2 HOW TO BUILD THE EXAMPLE ?
- You need to have built the persistency/gdml module by having
set the -DGEANT4_USE_GDML=ON flag during the CMAKE configuration step,
as well as the -DXERCESC_ROOT_DIR=<path_to_xercesc> flag pointing to
the path where the XercesC XML parser package is installed in your system.
- Compile and link to generate the executable (in your CMAKE build directory)::
\verbatim
% make
\endverbatim
- Execute the application for reading and visualizing the setup:
\verbatim
% gdml_ext read_ext.mac
\endverbatim
- Execute the application for also writing the setup:
\verbatim
% gdml_ext [write_ext.mac]
\endverbatim
*/
@@ -0,0 +1,64 @@
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(G03)
#----------------------------------------------------------------------------
# Find Geant4 package, activating all available Vis drivers by default
# You can set WITH_GEANT4_VIS to OFF via the command line or ccmake/cmake-gui
# to build a batch mode only executable
#
option(WITH_GEANT4_VIS "Build example with Geant4 Vis drivers" ON)
if(WITH_GEANT4_VIS)
find_package(Geant4 REQUIRED gdml vis_all)
else()
find_package(Geant4 REQUIRED gdml)
endif()
#----------------------------------------------------------------------------
# Setup Geant4 include directories and compile definitions
#
include(${Geant4_USE_FILE})
#----------------------------------------------------------------------------
# Locate sources and headers for this project
#
include_directories(${PROJECT_SOURCE_DIR}/include
${Geant4_INCLUDE_DIR})
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
#----------------------------------------------------------------------------
# Add the executable, and link it to the Geant4 libraries
#
add_executable(gdml_ext gdml_ext.cc ${sources} ${headers})
target_link_libraries(gdml_ext ${Geant4_LIBRARIES} )
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build G03. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
set(G03_SCRIPTS
color_extension.gdml read_ext.mac vis.mac write_ext.mac
)
foreach(_script ${G03_SCRIPTS})
configure_file(
${PROJECT_SOURCE_DIR}/${_script}
${PROJECT_BINARY_DIR}/${_script}
COPYONLY
)
endforeach()
#----------------------------------------------------------------------------
# Add program to the project targets
# (this avoids the need of typing the program name after make)
#
add_custom_target(G03 DEPENDS gdml_ext)
#----------------------------------------------------------------------------
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
#
install(TARGETS gdml_ext DESTINATION bin)
@@ -17,6 +17,9 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
July 27th, 2012 Witek Pokorski G03-V09-05-00
- Adding cmake and cosmetic changes to comply to coding conventions
November 10th, 2011 Gabriele Cosmo G03-V09-04-00
- Changed from no longer supported physics-list QGSP-BERT-EMV to QGSP-BERT.
@@ -23,14 +23,13 @@ $Id: README,v 1.2 2009-04-15 13:26:26 gcosmo Exp $
HOW TO BUILD THE EXAMPLE ?
- You need to have built the persistency/gdml plugin module along with the
Geant4 libraries, by having set the G4LIB_BUILD_GDML variable in your
environment.
It is also required to specify the path where the XercesC XML parser
package is installed in your system, through the variable XERCESCROOT.
- You need to have built the persistency/gdml module by having
set the -DGEANT4_USE_GDML=ON flag during the CMAKE configuration step,
as well as the -DXERCESC_ROOT_DIR=<path_to_xercesc> flag pointing to
the path where the XercesC XML parser package is installed in your system.
- Compile and link to generate the executable:
% gmake
- Compile and link to generate the executable (in your CMAKE build directory):
% make
- Execute the application for reading and visualizing the setup:
% gdml_ext read_ext.mac
@@ -23,9 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G03/gdml_ext.cc
/// \brief Main program of the persistency/gdml/G03 example
//
// $Id: gdml_ext.cc,v 1.7 2010-11-07 13:31:07 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
// --------------------------------------------------------------
@@ -45,9 +47,9 @@
// Example includes
//
#include "DetectorConstruction.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "G03DetectorConstruction.hh"
#include "G03PrimaryGeneratorAction.hh"
#include "G03RunAction.hh"
#ifdef G4VIS_USE
#include "G4VisExecutive.hh"
@@ -66,11 +68,11 @@ int main(int argc, char** argv)
// Set mandatory initialization and user action classes
//
DetectorConstruction* detector = new DetectorConstruction;
G03DetectorConstruction* detector = new G03DetectorConstruction;
runManager->SetUserInitialization(detector);
runManager->SetUserInitialization(new QGSP_BERT);
runManager->SetUserAction(new PrimaryGeneratorAction);
RunAction* runAction = new RunAction;
runManager->SetUserAction(new G03PrimaryGeneratorAction);
G03RunAction* runAction = new G03RunAction;
runManager->SetUserAction(runAction);
// Initialisation of runManager via macro for the interactive mode
@@ -23,31 +23,35 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: ColorReader.hh,v 1.3 2009-04-24 15:54:21 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
/// \file persistency/gdml/G03/include/G03ColorReader.hh
/// \brief Definition of the G03ColorReader class
//
//
// class ColorReader
// $Id$
//
//
// class G03ColorReader
//
// Custom reader for handling "color" tags extensions in GDML.
// -------------------------------------------------------------------------
#ifndef ColorReader_H
#define ColorReader_H 1
#ifndef G03ColorReader_H
#define G03ColorReader_H 1
#include <map>
#include "G4GDMLReadStructure.hh"
class G4VisAttributes;
class ColorReader : public G4GDMLReadStructure
/// GDML reader for the color attributes
class G03ColorReader : public G4GDMLReadStructure
{
public:
ColorReader();
~ColorReader();
G03ColorReader();
~G03ColorReader();
void ExtensionRead(const xercesc::DOMElement* const element);
void ColorRead(const xercesc::DOMElement* const element);
@@ -60,7 +64,7 @@ class ColorReader : public G4GDMLReadStructure
private:
std::map<G4String, G4VisAttributes*> attribs;
std::map<G4String, G4VisAttributes*> fAttribs;
};
#endif
@@ -23,18 +23,20 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: ColorWriter.hh,v 1.2 2009-04-24 15:54:21 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
/// \file persistency/gdml/G03/include/G03ColorWriter.hh
/// \brief Definition of the G03ColorWriter class
//
//
// class ColorWriter
// $Id$
//
//
// class G03ColorWriter
//
// Custom writer for handling "color" tags extensions in GDML.
// -------------------------------------------------------------------------
#ifndef ColorWriter_H
#define ColorWriter_H 1
#ifndef G03ColorWriter_H
#define G03ColorWriter_H 1
#include <vector>
#include "G4GDMLWriteStructure.hh"
@@ -42,13 +44,15 @@
class G4LogicalVolume;
class G4VisAttributes;
class ColorWriter : public G4GDMLWriteStructure
/// GDML writer for the color attributes
class G03ColorWriter : public G4GDMLWriteStructure
{
public:
ColorWriter();
~ColorWriter();
G03ColorWriter();
~G03ColorWriter();
void AddExtension(xercesc::DOMElement* volumeElement,
const G4LogicalVolume* const vol);
@@ -60,7 +64,7 @@ class ColorWriter : public G4GDMLWriteStructure
private:
std::vector<const G4VisAttributes*> attribs;
std::vector<const G4VisAttributes*> fAttribs;
};
#endif
@@ -23,36 +23,38 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G03/include/G03DetectorConstruction.hh
/// \brief Definition of the G03DetectorConstruction class
//
// $Id: DetectorConstruction.hh,v 1.2 2009-04-15 13:26:26 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Class DetectorConstruction
// $Id$
//
// Class G03DetectorConstruction
//
// A detector construction class loading the geometry from GDML files.
//
// ----------------------------------------------------------------------------
#ifndef DetectorConstruction_H
#define DetectorConstruction_H 1
#ifndef G03DetectorConstruction_H
#define G03DetectorConstruction_H 1
#include "globals.hh"
#include "G4VUserDetectorConstruction.hh"
#include "G4GDMLParser.hh"
class G4Material;
class DetectorMessenger;
class G03DetectorMessenger;
// ----------------------------------------------------------------------------
/// Detector construction for the GDML extensions example
class DetectorConstruction : public G4VUserDetectorConstruction
class G03DetectorConstruction : public G4VUserDetectorConstruction
{
public:
// Constructor and destructor
//
DetectorConstruction();
~DetectorConstruction();
G03DetectorConstruction();
~G03DetectorConstruction();
// Construction of Detector
//
@@ -69,31 +71,31 @@ class DetectorConstruction : public G4VUserDetectorConstruction
private:
G4Material* Air ;
G4Material* Aluminum ;
G4Material* Pb;
G4Material* Xenon;
G4Material* fAir ;
G4Material* fAluminum ;
G4Material* fPb;
G4Material* fXenon;
// Extended reader
//
G4GDMLReadStructure* reader;
G4GDMLReadStructure* fReader;
// Extended writer
//
G4GDMLWriteStructure* writer;
G4GDMLWriteStructure* fWriter;
// GDMLparser
//
G4GDMLParser* parser;
G4GDMLParser* fParser;
// Read/write Settings
//
G4String fReadFile, fWriteFile;
G4bool writingChoice;
G4bool fWritingChoice;
// Detector Messenger
//
DetectorMessenger* detectorMessenger;
G03DetectorMessenger* fDetectorMessenger;
};
// ----------------------------------------------------------------------------
@@ -23,43 +23,45 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G03/include/G03DetectorMessenger.hh
/// \brief Definition of the G03DetectorMessenger class
//
// $Id: DetectorMessenger.hh,v 1.2 2009-04-15 13:26:26 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Class DetectorMessenger
// $Id$
//
// Class G03DetectorMessenger
//
// Utility messenger for defining run-time commands relative to the example.
//
// ----------------------------------------------------------------------------
#ifndef DetectorMessenger_h
#define DetectorMessenger_h 1
#ifndef G03DetectorMessenger_h
#define G03DetectorMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class DetectorConstruction;
class G03DetectorConstruction;
class G4UIdirectory;
class G4UIcmdWithAString;
// ----------------------------------------------------------------------------
/// Detector messenger for the GDML extensions example
class DetectorMessenger: public G4UImessenger
class G03DetectorMessenger: public G4UImessenger
{
public:
DetectorMessenger( DetectorConstruction* );
~DetectorMessenger();
G03DetectorMessenger( G03DetectorConstruction* );
~G03DetectorMessenger();
void SetNewValue( G4UIcommand*, G4String );
private:
DetectorConstruction *theDetector;
G4UIdirectory *theDetectorDir;
G4UIcmdWithAString *theReadCommand, *theWriteCommand;
G03DetectorConstruction *fTheDetector;
G4UIdirectory *fTheDetectorDir;
G4UIcmdWithAString *fTheReadCommand, *fTheWriteCommand;
};
// ----------------------------------------------------------------------------
@@ -23,18 +23,20 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G03/include/G03PrimaryGeneratorAction.hh
/// \brief Definition of the G03PrimaryGeneratorAction class
//
// $Id: PrimaryGeneratorAction.hh,v 1.1 2008-11-20 15:41:54 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Class PrimaryGeneratorAction
// $Id$
//
// Class G03PrimaryGeneratorAction
//
// Simple primary-generator action class.
//
// ----------------------------------------------------------------------------
#ifndef PrimaryGeneratorAction_h
#define PrimaryGeneratorAction_h 1
#ifndef G03PrimaryGeneratorAction_h
#define G03PrimaryGeneratorAction_h 1
#include "G4ParticleTable.hh"
#include "G4ParticleGun.hh"
@@ -42,16 +44,16 @@
#include "G4VUserPrimaryGeneratorAction.hh"
// ----------------------------------------------------------------------------
/// Primary generator action for the GDML extension example
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
class G03PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
// Constructor and destructor
//
PrimaryGeneratorAction();
~PrimaryGeneratorAction();
G03PrimaryGeneratorAction();
~G03PrimaryGeneratorAction();
// Used by Geant4 to generate the primary particles of the event
//
@@ -59,8 +61,8 @@ class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
private:
G4ParticleGun* particleGun;
G4ParticleTable * particleTable;
G4ParticleGun* fParticleGun;
G4ParticleTable * fParticleTable;
};
// ----------------------------------------------------------------------------
@@ -23,18 +23,20 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G03/include/G03RunAction.hh
/// \brief Definition of the G03RunAction class
//
// $Id: RunAction.hh,v 1.2 2008-12-18 12:57:00 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Class RunAction
// $Id$
//
// Class G03RunAction
//
// Simple run action class.
//
// ----------------------------------------------------------------------------
#ifndef RunAction_h
#define RunAction_h 1
#ifndef G03RunAction_h
#define G03RunAction_h 1
#include <iostream>
@@ -43,14 +45,14 @@
class G4Run;
// ----------------------------------------------------------------------------
/// Run action for the GDML extension example
class RunAction : public G4UserRunAction
class G03RunAction : public G4UserRunAction
{
public:
RunAction();
~RunAction();
G03RunAction();
~G03RunAction();
void BeginOfRunAction(const G4Run*);
void EndOfRunAction(const G4Run*);
@@ -23,29 +23,37 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: ColorReader.cc,v 1.4 2009-04-24 15:54:21 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
/// \file persistency/gdml/G03/src/G03ColorReader.cc
/// \brief Implementation of the G03ColorReader class
//
// $Id$
//
// --------------------------------------------------------------------
#include "ColorReader.hh"
#include "G03ColorReader.hh"
#include "G4LogicalVolume.hh"
#include "G4VisAttributes.hh"
ColorReader::ColorReader()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G03ColorReader::G03ColorReader()
: G4GDMLReadStructure()
{
}
ColorReader::~ColorReader()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G03ColorReader::~G03ColorReader()
{
std::map<G4String, G4VisAttributes*>::iterator pos;
for (pos=attribs.begin(); pos!=attribs.end(); pos++)
for (pos=fAttribs.begin(); pos!=fAttribs.end(); pos++)
{ delete pos->second; }
}
void ColorReader::ExtensionRead(const xercesc::DOMElement* const extElement)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G03ColorReader::ExtensionRead(const xercesc::DOMElement* const extElement)
{
G4cout << "G4GDML: Reading GDML extension..." << G4endl;
@@ -62,13 +70,15 @@ void ColorReader::ExtensionRead(const xercesc::DOMElement* const extElement)
else
{
G4String error_msg = "Unknown tag in structure: " + tag;
G4Exception("ColorReader::ExtensionRead()",
G4Exception("G03ColorReader::ExtensionRead()",
"ReadError", FatalException, error_msg);
}
}
}
void ColorReader::VolumeRead(const xercesc::DOMElement* const volumeElement)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G03ColorReader::VolumeRead(const xercesc::DOMElement* const volumeElement)
{
G4VSolid* solidPtr = 0;
G4Material* materialPtr = 0;
@@ -107,7 +117,9 @@ void ColorReader::VolumeRead(const xercesc::DOMElement* const volumeElement)
Volume_contentRead(volumeElement);
}
void ColorReader::ColorRead(const xercesc::DOMElement* const colorElement)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G03ColorReader::ColorRead(const xercesc::DOMElement* const colorElement)
{
G4String name;
G4VisAttributes* color = 0;
@@ -145,22 +157,24 @@ void ColorReader::ColorRead(const xercesc::DOMElement* const colorElement)
G4cout << "Color attribute (R,G,B,A) is: "
<< r << ", " << g << ", " << b << ", " << a << " !" << G4endl;
color = new G4VisAttributes(G4Color(r,g,b,a));
attribs.insert(std::make_pair(name,color));
fAttribs.insert(std::make_pair(name,color));
}
G4VisAttributes* ColorReader::GetVisAttribute(const G4String& ref)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VisAttributes* G03ColorReader::GetVisAttribute(const G4String& ref)
{
G4VisAttributes* col = 0;
std::map<G4String, G4VisAttributes*>::iterator pos = attribs.find(ref);
std::map<G4String, G4VisAttributes*>::iterator pos = fAttribs.find(ref);
if (pos != attribs.end())
if (pos != fAttribs.end())
{
col = pos->second;
}
else
{
G4String err_mess = "Attribute: " + ref + " NOT found !";
G4Exception("ColorReader::GetVisAttribute()",
G4Exception("G03ColorReader::GetVisAttribute()",
"ReadError", FatalException, err_mess);
}
return col;
@@ -23,33 +23,43 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: ColorWriter.cc,v 1.2 2009-04-24 15:54:21 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
/// \file persistency/gdml/G03/src/G03ColorWriter.cc
/// \brief Implementation of the G03ColorWriter class
//
// $Id$
//
// --------------------------------------------------------------------
#include "ColorWriter.hh"
#include "G03ColorWriter.hh"
#include "G4LogicalVolume.hh"
#include "G4VisAttributes.hh"
ColorWriter::ColorWriter()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G03ColorWriter::G03ColorWriter()
: G4GDMLWriteStructure()
{
}
ColorWriter::~ColorWriter()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G03ColorWriter::~G03ColorWriter()
{
}
void ColorWriter::AddExtension(xercesc::DOMElement* volumeElement,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G03ColorWriter::AddExtension(xercesc::DOMElement* volumeElement,
const G4LogicalVolume* const vol)
{
const G4VisAttributes* vis = vol->GetVisAttributes();
if (vis) { ColorWrite(volumeElement, vis); }
}
void ColorWriter::ExtensionWrite(xercesc::DOMElement* element)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G03ColorWriter::ExtensionWrite(xercesc::DOMElement* element)
{
G4cout << "G4GDML: Writing GDML extension..." << G4endl;
@@ -59,7 +69,9 @@ void ColorWriter::ExtensionWrite(xercesc::DOMElement* element)
element->appendChild(extElement);
}
void ColorWriter::ColorWrite(xercesc::DOMElement* volumeElement,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G03ColorWriter::ColorWrite(xercesc::DOMElement* volumeElement,
const G4VisAttributes* const att)
{
G4bool book = BookAttribute(att);
@@ -88,14 +100,16 @@ void ColorWriter::ColorWrite(xercesc::DOMElement* volumeElement,
<< r << ", " << g << ", " << b << ", " << a << " !" << G4endl;
}
G4bool ColorWriter::BookAttribute(const G4VisAttributes* const ref)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool G03ColorWriter::BookAttribute(const G4VisAttributes* const ref)
{
G4bool booking = true;
std::vector<const G4VisAttributes*>::const_iterator pos =
std::find(attribs.begin(), attribs.end(), ref);
std::find(fAttribs.begin(), fAttribs.end(), ref);
if (pos != attribs.end()) { booking = false; }
else { attribs.push_back(ref); }
if (pos != fAttribs.end()) { booking = false; }
else { fAttribs.push_back(ref); }
return booking;
}
@@ -23,15 +23,17 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G03/src/G03DetectorConstruction.cc
/// \brief Implementation of the G03DetectorConstruction class
//
// $Id: DetectorConstruction.cc,v 1.3 2009-04-15 13:26:26 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Class DetectorConstruction implementation
// $Id$
//
// Class G03DetectorConstruction implementation
//
// ----------------------------------------------------------------------------
#include "DetectorConstruction.hh"
#include "G03DetectorConstruction.hh"
// Geant4 includes
//
@@ -41,57 +43,53 @@
// Messenger
//
#include "DetectorMessenger.hh"
#include "G03DetectorMessenger.hh"
// Color extension include for reading
//
#include "ColorReader.hh"
#include "G03ColorReader.hh"
// Color extension include for writing
//
#include "ColorWriter.hh"
#include "G03ColorWriter.hh"
// ----------------------------------------------------------------------------
//
// Constructor
//
DetectorConstruction::DetectorConstruction()
: Air(0), Aluminum(0), Pb(0), Xenon(0)
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G03DetectorConstruction::G03DetectorConstruction()
: fAir(0), fAluminum(0), fPb(0), fXenon(0)
{
fReadFile = "color_extension.gdml";
fWriteFile = "color_extension_test.gdml";
writingChoice = 1;
fWritingChoice = 1;
detectorMessenger = new DetectorMessenger( this );
fDetectorMessenger = new G03DetectorMessenger( this );
reader = new ColorReader;
writer = new ColorWriter;
parser = new G4GDMLParser(reader, writer);
fReader = new G03ColorReader;
fWriter = new G03ColorWriter;
fParser = new G4GDMLParser(fReader, fWriter);
}
// ----------------------------------------------------------------------------
//
// Destructor
//
DetectorConstruction::~DetectorConstruction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G03DetectorConstruction::~G03DetectorConstruction()
{
delete detectorMessenger;
delete reader;
delete writer;
delete parser;
delete fDetectorMessenger;
delete fReader;
delete fWriter;
delete fParser;
}
// ----------------------------------------------------------------------------
//
// Constructs geometries and materials
//
G4VPhysicalVolume* DetectorConstruction::Construct()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* G03DetectorConstruction::Construct()
{
// Reading of Geometry from GDML
G4VPhysicalVolume* fWorldPhysVol;
parser->Read(fReadFile,false);
fParser->Read(fReadFile,false);
//
// 2nd Boolean argument "Validate" set to false.
// Disabling Schema validation for reading extended GDML file.
@@ -102,22 +100,20 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
// Giving World Physical Volume from GDML Parser
//
fWorldPhysVol = parser->GetWorldVolume();
fWorldPhysVol = fParser->GetWorldVolume();
if(writingChoice!=0)
if(fWritingChoice!=0)
{
parser->Write(fWriteFile, fWorldPhysVol, true,
fParser->Write(fWriteFile, fWorldPhysVol, true,
"./SimpleExtensionSchema/SimpleExtension.xsd");
}
return fWorldPhysVol;
}
// ----------------------------------------------------------------------------
//
// Utility to build and list necessary materials
//
void DetectorConstruction::ListOfMaterials()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G03DetectorConstruction::ListOfMaterials()
{
G4double a; // atomic mass
G4double z; // atomic number
@@ -144,23 +140,23 @@ void DetectorConstruction::ListOfMaterials()
// Air
//
density = 1.29*mg/cm3;
Air = new G4Material(name="Air", density, ncomponents=2);
Air->AddElement(elN, fractionmass=0.7);
Air->AddElement(elO, fractionmass=0.3);
fAir = new G4Material(name="Air", density, ncomponents=2);
fAir->AddElement(elN, fractionmass=0.7);
fAir->AddElement(elO, fractionmass=0.3);
// Aluminum
//
density = 2.70*g/cm3;
Aluminum = new G4Material(name="Aluminum", density, ncomponents=1);
Aluminum->AddElement(elAl, fractionmass=1.0);
fAluminum = new G4Material(name="Aluminum", density, ncomponents=1);
fAluminum->AddElement(elAl, fractionmass=1.0);
// Lead
//
Pb = new G4Material("Lead", z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
fPb = new G4Material("Lead", z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
// Xenon gas
//
Xenon = new G4Material("XenonGas", z=54., a=131.29*g/mole,
fXenon = new G4Material("XenonGas", z=54., a=131.29*g/mole,
density= 5.458*mg/cm3, kStateGas,
temperature= 293.15*kelvin, pressure= 1*atmosphere);
@@ -169,23 +165,18 @@ void DetectorConstruction::ListOfMaterials()
G4cout << *(G4Material::GetMaterialTable() ) << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// ----------------------------------------------------------------------------
//
// SetReadFile
//
void DetectorConstruction::SetReadFile( const G4String& fname )
void G03DetectorConstruction::SetReadFile( const G4String& fname )
{
fReadFile=fname;
writingChoice=0;
fWritingChoice=0;
}
// ----------------------------------------------------------------------------
//
// SetWriteFile
//
void DetectorConstruction::SetWriteFile( const G4String& fname )
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G03DetectorConstruction::SetWriteFile( const G4String& fname )
{
fWriteFile=fname;
writingChoice=1;
fWritingChoice=1;
}
@@ -23,61 +23,63 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G03/src/G03DetectorMessenger.cc
/// \brief Implementation of the G03DetectorMessenger class
//
// $Id: DetectorMessenger.cc,v 1.3 2009-04-15 13:26:26 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Class DetectorMessenger implementation
// $Id$
//
// Class G03DetectorMessenger implementation
//
// ----------------------------------------------------------------------------
#include "globals.hh"
#include "DetectorMessenger.hh"
#include "DetectorConstruction.hh"
#include "G03DetectorMessenger.hh"
#include "G03DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorMessenger::DetectorMessenger( DetectorConstruction* myDet )
: theDetector( myDet )
G03DetectorMessenger::G03DetectorMessenger( G03DetectorConstruction* myDet )
: fTheDetector( myDet )
{
theDetectorDir = new G4UIdirectory( "/mydet/" );
theDetectorDir->SetGuidance("Detector control.");
fTheDetectorDir = new G4UIdirectory( "/mydet/" );
fTheDetectorDir->SetGuidance("Detector control.");
theReadCommand = new G4UIcmdWithAString("/mydet/readFile", this);
theReadCommand ->SetGuidance("READ GDML file with given name");
theReadCommand ->SetParameterName("FileRead", false);
theReadCommand ->SetDefaultValue("color_extension.gdml");
theReadCommand ->AvailableForStates(G4State_PreInit);
fTheReadCommand = new G4UIcmdWithAString("/mydet/readFile", this);
fTheReadCommand ->SetGuidance("READ GDML file with given name");
fTheReadCommand ->SetParameterName("FileRead", false);
fTheReadCommand ->SetDefaultValue("color_extension.gdml");
fTheReadCommand ->AvailableForStates(G4State_PreInit);
theWriteCommand = new G4UIcmdWithAString("/mydet/writeFile", this);
theWriteCommand ->SetGuidance("WRITE GDML file with given name");
theWriteCommand ->SetParameterName("FileWrite", false);
theWriteCommand ->SetDefaultValue("color_extension_test.gdml");
theWriteCommand ->AvailableForStates(G4State_PreInit);
fTheWriteCommand = new G4UIcmdWithAString("/mydet/writeFile", this);
fTheWriteCommand ->SetGuidance("WRITE GDML file with given name");
fTheWriteCommand ->SetParameterName("FileWrite", false);
fTheWriteCommand ->SetDefaultValue("color_extension_test.gdml");
fTheWriteCommand ->AvailableForStates(G4State_PreInit);
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorMessenger::~DetectorMessenger()
G03DetectorMessenger::~G03DetectorMessenger()
{
delete theReadCommand;
delete theWriteCommand;
delete theDetectorDir;
delete fTheReadCommand;
delete fTheWriteCommand;
delete fTheDetectorDir;
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
void G03DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if ( command == theReadCommand )
if ( command == fTheReadCommand )
{
theDetector->SetReadFile(newValue);
fTheDetector->SetReadFile(newValue);
}
if ( command == theWriteCommand )
if ( command == fTheWriteCommand )
{
theDetector->SetWriteFile(newValue);
fTheDetector->SetWriteFile(newValue);
}
}
@@ -23,52 +23,55 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G03/src/G03PrimaryGeneratorAction.cc
/// \brief Implementation of the G03PrimaryGeneratorAction class
//
// $Id: PrimaryGeneratorAction.cc,v 1.2 2008-12-18 12:57:16 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Class PrimaryGeneratorAction implementation
// $Id$
//
// Class G03PrimaryGeneratorAction implementation
//
// ----------------------------------------------------------------------------
#include "PrimaryGeneratorAction.hh"
#include "G03PrimaryGeneratorAction.hh"
#include "globals.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::PrimaryGeneratorAction()
G03PrimaryGeneratorAction::G03PrimaryGeneratorAction()
{
// Particle gun and particle table
//
particleGun = new G4ParticleGun();
particleTable = G4ParticleTable::GetParticleTable();
fParticleGun = new G4ParticleGun();
fParticleTable = G4ParticleTable::GetParticleTable();
// Default particle
//
particleGun->SetParticleDefinition(particleTable->FindParticle("geantino"));
particleGun->SetParticleEnergy( 1.0*MeV );
fParticleGun->SetParticleDefinition(fParticleTable->FindParticle("geantino"));
fParticleGun->SetParticleEnergy( 1.0*MeV );
G4ThreeVector err1=G4ThreeVector(-1260,-560,40); // outside
G4ThreeVector err2=G4ThreeVector(100,-240,120); // inside
G4ThreeVector err2v=(err2-err1).unit();
particleGun->SetParticleMomentumDirection(err2v);
particleGun->SetParticlePosition(err1);
fParticleGun->SetParticleMomentumDirection(err2v);
fParticleGun->SetParticlePosition(err1);
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::~PrimaryGeneratorAction()
G03PrimaryGeneratorAction::~G03PrimaryGeneratorAction()
{
delete particleGun;
delete fParticleGun;
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
void G03PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
particleGun->GeneratePrimaryVertex(anEvent);
fParticleGun->GeneratePrimaryVertex(anEvent);
}
@@ -23,11 +23,13 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G03/src/G03RunAction.cc
/// \brief Implementation of the G03RunAction class
//
// $Id: RunAction.cc,v 1.1 2008-08-27 10:30:18 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Class RunAction implementation
// $Id$
//
// Class G03RunAction implementation
//
// ----------------------------------------------------------------------------
@@ -36,35 +38,35 @@
#include "globals.hh"
#include "Randomize.hh"
#include "RunAction.hh"
#include "G03RunAction.hh"
#include "G4Run.hh"
#include "G4UImanager.hh"
#include "G4VVisManager.hh"
#include "G4VisAttributes.hh"
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::RunAction()
G03RunAction::G03RunAction()
{
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::~RunAction()
G03RunAction::~G03RunAction()
{
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::BeginOfRunAction(const G4Run* aRun)
void G03RunAction::BeginOfRunAction(const G4Run* aRun)
{
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::EndOfRunAction(const G4Run*)
void G03RunAction::EndOfRunAction(const G4Run*)
{
if (G4VVisManager::GetConcreteInstance())
{
@@ -0,0 +1,40 @@
//$Id$
///\file "persistency/gdml/G04/.README"
///\brief Example G04 README page
/*! \page ExampleG04 Example G04
\section G04_s1 GDML DETECTOR SENSITIVITY
This example demonstrates the usage of the GDML auxiliary information for
associating a sensitive detector to a volume.
The detector construction consists of a call to GDMLProcessor which parses a
GDML file and returns the pointer to the world volume. The user can also write
her/his own GDML file and use it as the primary input format for her/his Geant4
application.
A simple GDML files is provided:
- auxiliary.gdml, showing association of a volume with the auxiliary
information, related to the sensitive detector.
\section G04_s2 HOW TO BUILD THE EXAMPLE ?
- You need to have built the persistency/gdml module by having
set the -DGEANT4_USE_GDML=ON flag during the CMAKE configuration step,
as well as the -DXERCESC_ROOT_DIR=<path_to_xercesc> flag pointing to
the path where the XercesC XML parser package is installed in your system.
- Compile and link to generate the executable (in your CMAKE build directory):
\verbatim
% make
\endverbatim
- Execute the application for parsing interactively the GDML file:
\verbatim
% gdml_det auxiliary.gdml
\endverbatim
*/
@@ -1,12 +1,64 @@
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(G04)
set(name gdml_det)
project(${name})
find_package(Geant4 REQUIRED)
#----------------------------------------------------------------------------
# Find Geant4 package, activating all available Vis drivers by default
# You can set WITH_GEANT4_VIS to OFF via the command line or ccmake/cmake-gui
# to build a batch mode only executable
#
option(WITH_GEANT4_VIS "Build example with Geant4 Vis drivers" ON)
if(WITH_GEANT4_VIS)
find_package(Geant4 REQUIRED gdml vis_all)
else()
find_package(Geant4 REQUIRED gdml)
endif()
#----------------------------------------------------------------------------
# Setup Geant4 include directories and compile definitions
#
include(${Geant4_USE_FILE})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${Geant4_INCLUDE_DIR})
file(GLOB sources ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc)
#----------------------------------------------------------------------------
# Locate sources and headers for this project
#
include_directories(${PROJECT_SOURCE_DIR}/include
${Geant4_INCLUDE_DIR})
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
#----------------------------------------------------------------------------
# Add the executable, and link it to the Geant4 libraries
#
add_executable(gdml_det gdml_det.cc ${sources} ${headers})
target_link_libraries(gdml_det ${Geant4_LIBRARIES} )
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build G04. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
set(G04_SCRIPTS
auxiliary.gdml g04.mac vis.mac
)
foreach(_script ${G04_SCRIPTS})
configure_file(
${PROJECT_SOURCE_DIR}/${_script}
${PROJECT_BINARY_DIR}/${_script}
COPYONLY
)
endforeach()
#----------------------------------------------------------------------------
# Add program to the project targets
# (this avoids the need of typing the program name after make)
#
add_custom_target(G04 DEPENDS gdml_det)
#----------------------------------------------------------------------------
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
#
install(TARGETS gdml_det DESTINATION bin)
add_executable(${name} EXCLUDE_FROM_ALL ${name}.cc ${sources})
target_link_libraries(${name} ${Geant4_LIBRARIES})
@@ -17,6 +17,9 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
July 31st, 2012 W. Pokorski (G04-V09-05-00)
- adding CMake file + cosmetic changes
November 9th, 2010 J.Allison (G04-V09-03-03)
- Removed unnecessary #include "G4UIsession.hh".
@@ -22,12 +22,12 @@ A simple GDML files is provided:
HOW TO BUILD THE EXAMPLE ?
- You need to have built the persistency/gdml plugin module by having
set G4LIB_BUILD_GDML variable in your environment.
It is also required you specify the path where the XercesC XML parser
package is installed in your system, through the variable XERCESCROOT.
- Compile and link to generate the executable:
- You need to have built the persistency/gdml module by having
set the -DGEANT4_USE_GDML=ON flag during the CMAKE configuration step,
as well as the -DXERCESC_ROOT_DIR=<path_to_xercesc> flag pointing to
the path where the XercesC XML parser package is installed in your system.
- Compile and link to generate the executable (in your CMAKE build directory):
% make
- Execute the application.
@@ -1,754 +0,0 @@
Usage: gdml_det <intput_gdml_file:mandatory>
G4GDML: Reading 'auxiliary.gdml'...
G4GDML: Reading definitions...
G4GDML: Reading materials...
G4GDML: Reading solids...
G4GDML: Reading structure...
G4GDML: Reading setup...
G4GDML: Reading 'auxiliary.gdml' done!
Stripping off GDML names of materials, solids and volumes ...
############################################
!!! WARNING - FPE detection is activated !!!
############################################
*************************************************************
Geant4 version Name: geant4-09-05-ref-00 (2-December-2011)
Copyright : Geant4 Collaboration
Reference : NIM A 506 (2003), 250-303
WWW : http://cern.ch/geant4
*************************************************************
Found 1 volume(s) with auxiliary information.
Volume Boxvol has the following list of auxiliary information:
--> Type: SensDet Value: Tracker
--> Type: Color Value: Blue
Volume Boxvol has the following list of auxiliary information:
Attaching sensitive detector Tracker to volume Boxvol
Visualization Manager instantiating with verbosity "warnings (3)"...
Visualization Manager initialising...
Registering graphics systems...
You have successfully registered the following graphics systems.
Current available graphics systems are:
ASCIITree (ATree)
DAWNFILE (DAWNFILE)
G4HepRep (HepRepXML)
G4HepRepFile (HepRepFile)
RayTracer (RayTracer)
VRML1FILE (VRML1FILE)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)
OpenGLStoredX (OGL)
OpenGLImmediateX (OGLI)
OpenGLStoredX (OGLS)
OpenGLImmediateX (OGLIX)
OpenGLStoredX (OGLSX)
Registering model factories...
You have successfully registered the following model factories.
Registered model factories:
generic
drawByCharge
drawByParticleID
drawByOriginVolume
drawByAttribute
Registered filter factories:
chargeFilter
particleFilter
originVolumeFilter
attributeFilter
Some /vis commands (optionally) take a string to specify colour.
Available colours:
black, blue, cyan, gray, green, grey, magenta, red, white, yellow
/run/verbose 2
/run/beamOn 20
Region <DefaultRegionForTheWorld> -- -- appears in <World_PV> world volume
This region is in the mass world.
Root logical volume(s) : World
Pointers : G4VUserRegionInformation[0], G4UserLimits[0], G4FastSimulationManager[0], G4UserSteppingAction[0]
Materials : Air
Production cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
Region <DefaultRegionForParallelWorld> -- -- is not associated to any world.
Root logical volume(s) :
Pointers : G4VUserRegionInformation[0], G4UserLimits[0], G4FastSimulationManager[0], G4UserSteppingAction[0]
Materials :
Production cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
========= Table of registered couples ==============================
Index : 0 used in the geometry : Yes recalculation needed : No
Material : Air
Range cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
Energy thresholds : gamma -1 MeV e- -1 MeV e+ -1 MeV proton -1 MeV
Region(s) which use this couple :
DefaultRegionForTheWorld
====================================================================
Start closing geometry.
G4GeometryManager::ReportVoxelStats -- Voxel Statistics
Total memory consumed for geometry optimisation: 0 kByte
Total CPU time elapsed for geometry optimisation: 0 seconds
Start Run processing.
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -614 0.1 0.1 1e+03 0 1.39e+03 1.39e+03 Boxvol_PV Transportation
2 614 0.1 0.1 1e+03 0 1.23e+03 2.61e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 0.1 1e+03 0 4.39e+03 7e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -535 147 0.1 1e+03 0 1.47e+03 1.47e+03 Boxvol_PV Transportation
2 579 258 0.1 1e+03 0 1.12e+03 2.59e+03 World_PV Transportation
Processing hits ....
3 5e+03 700 0.1 1e+03 0 4.44e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -676 0.1 133 1e+03 0 1.33e+03 1.33e+03 Boxvol_PV Transportation
2 498 0.1 250 1e+03 0 1.18e+03 2.51e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 700 1e+03 0 4.52e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -614 0.1 0.1 1e+03 0 1.39e+03 1.39e+03 Boxvol_PV Transportation
2 614 0.1 0.1 1e+03 0 1.23e+03 2.61e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 0.1 1e+03 0 4.39e+03 7e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -535 147 0.1 1e+03 0 1.47e+03 1.47e+03 Boxvol_PV Transportation
2 579 258 0.1 1e+03 0 1.12e+03 2.59e+03 World_PV Transportation
Processing hits ....
3 5e+03 700 0.1 1e+03 0 4.44e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -676 0.1 133 1e+03 0 1.33e+03 1.33e+03 Boxvol_PV Transportation
2 498 0.1 250 1e+03 0 1.18e+03 2.51e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 700 1e+03 0 4.52e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -614 0.1 0.1 1e+03 0 1.39e+03 1.39e+03 Boxvol_PV Transportation
2 614 0.1 0.1 1e+03 0 1.23e+03 2.61e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 0.1 1e+03 0 4.39e+03 7e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -535 147 0.1 1e+03 0 1.47e+03 1.47e+03 Boxvol_PV Transportation
2 579 258 0.1 1e+03 0 1.12e+03 2.59e+03 World_PV Transportation
Processing hits ....
3 5e+03 700 0.1 1e+03 0 4.44e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -676 0.1 133 1e+03 0 1.33e+03 1.33e+03 Boxvol_PV Transportation
2 498 0.1 250 1e+03 0 1.18e+03 2.51e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 700 1e+03 0 4.52e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -614 0.1 0.1 1e+03 0 1.39e+03 1.39e+03 Boxvol_PV Transportation
2 614 0.1 0.1 1e+03 0 1.23e+03 2.61e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 0.1 1e+03 0 4.39e+03 7e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -535 147 0.1 1e+03 0 1.47e+03 1.47e+03 Boxvol_PV Transportation
2 579 258 0.1 1e+03 0 1.12e+03 2.59e+03 World_PV Transportation
Processing hits ....
3 5e+03 700 0.1 1e+03 0 4.44e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -676 0.1 133 1e+03 0 1.33e+03 1.33e+03 Boxvol_PV Transportation
2 498 0.1 250 1e+03 0 1.18e+03 2.51e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 700 1e+03 0 4.52e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -614 0.1 0.1 1e+03 0 1.39e+03 1.39e+03 Boxvol_PV Transportation
2 614 0.1 0.1 1e+03 0 1.23e+03 2.61e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 0.1 1e+03 0 4.39e+03 7e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -535 147 0.1 1e+03 0 1.47e+03 1.47e+03 Boxvol_PV Transportation
2 579 258 0.1 1e+03 0 1.12e+03 2.59e+03 World_PV Transportation
Processing hits ....
3 5e+03 700 0.1 1e+03 0 4.44e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -676 0.1 133 1e+03 0 1.33e+03 1.33e+03 Boxvol_PV Transportation
2 498 0.1 250 1e+03 0 1.18e+03 2.51e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 700 1e+03 0 4.52e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -614 0.1 0.1 1e+03 0 1.39e+03 1.39e+03 Boxvol_PV Transportation
2 614 0.1 0.1 1e+03 0 1.23e+03 2.61e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 0.1 1e+03 0 4.39e+03 7e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -535 147 0.1 1e+03 0 1.47e+03 1.47e+03 Boxvol_PV Transportation
2 579 258 0.1 1e+03 0 1.12e+03 2.59e+03 World_PV Transportation
Processing hits ....
3 5e+03 700 0.1 1e+03 0 4.44e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -676 0.1 133 1e+03 0 1.33e+03 1.33e+03 Boxvol_PV Transportation
2 498 0.1 250 1e+03 0 1.18e+03 2.51e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 700 1e+03 0 4.52e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -614 0.1 0.1 1e+03 0 1.39e+03 1.39e+03 Boxvol_PV Transportation
2 614 0.1 0.1 1e+03 0 1.23e+03 2.61e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 0.1 1e+03 0 4.39e+03 7e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -535 147 0.1 1e+03 0 1.47e+03 1.47e+03 Boxvol_PV Transportation
2 579 258 0.1 1e+03 0 1.12e+03 2.59e+03 World_PV Transportation
Processing hits ....
3 5e+03 700 0.1 1e+03 0 4.44e+03 7.03e+03 OutOfWorld Transportation
Run terminated.
Run Summary
Number of events processed : 20
User=0s Real=0.01s Sys=0s
/gun/direction 0 0 -1
/run/beamOn 20
Region <DefaultRegionForTheWorld> -- -- appears in <World_PV> world volume
This region is in the mass world.
Root logical volume(s) : World
Pointers : G4VUserRegionInformation[0], G4UserLimits[0], G4FastSimulationManager[0], G4UserSteppingAction[0]
Materials : Air
Production cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
Region <DefaultRegionForParallelWorld> -- -- is not associated to any world.
Root logical volume(s) :
Pointers : G4VUserRegionInformation[0], G4UserLimits[0], G4FastSimulationManager[0], G4UserSteppingAction[0]
Materials :
Production cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
========= Table of registered couples ==============================
Index : 0 used in the geometry : Yes recalculation needed : No
Material : Air
Range cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
Energy thresholds : gamma -1 MeV e- -1 MeV e+ -1 MeV proton -1 MeV
Region(s) which use this couple :
DefaultRegionForTheWorld
====================================================================
Start Run processing.
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -614 0.1 0.1 1e+03 0 1.39e+03 1.39e+03 Boxvol_PV Transportation
2 614 0.1 0.1 1e+03 0 1.23e+03 2.61e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 0.1 1e+03 0 4.39e+03 7e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -535 147 0.1 1e+03 0 1.47e+03 1.47e+03 Boxvol_PV Transportation
2 579 258 0.1 1e+03 0 1.12e+03 2.59e+03 World_PV Transportation
Processing hits ....
3 5e+03 700 0.1 1e+03 0 4.44e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -676 0.1 133 1e+03 0 1.33e+03 1.33e+03 Boxvol_PV Transportation
2 498 0.1 250 1e+03 0 1.18e+03 2.51e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 700 1e+03 0 4.52e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -614 0.1 0.1 1e+03 0 1.39e+03 1.39e+03 Boxvol_PV Transportation
2 614 0.1 0.1 1e+03 0 1.23e+03 2.61e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 0.1 1e+03 0 4.39e+03 7e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -535 147 0.1 1e+03 0 1.47e+03 1.47e+03 Boxvol_PV Transportation
2 579 258 0.1 1e+03 0 1.12e+03 2.59e+03 World_PV Transportation
Processing hits ....
3 5e+03 700 0.1 1e+03 0 4.44e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -676 0.1 133 1e+03 0 1.33e+03 1.33e+03 Boxvol_PV Transportation
2 498 0.1 250 1e+03 0 1.18e+03 2.51e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 700 1e+03 0 4.52e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -614 0.1 0.1 1e+03 0 1.39e+03 1.39e+03 Boxvol_PV Transportation
2 614 0.1 0.1 1e+03 0 1.23e+03 2.61e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 0.1 1e+03 0 4.39e+03 7e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -535 147 0.1 1e+03 0 1.47e+03 1.47e+03 Boxvol_PV Transportation
2 579 258 0.1 1e+03 0 1.12e+03 2.59e+03 World_PV Transportation
Processing hits ....
3 5e+03 700 0.1 1e+03 0 4.44e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -676 0.1 133 1e+03 0 1.33e+03 1.33e+03 Boxvol_PV Transportation
2 498 0.1 250 1e+03 0 1.18e+03 2.51e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 700 1e+03 0 4.52e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -614 0.1 0.1 1e+03 0 1.39e+03 1.39e+03 Boxvol_PV Transportation
2 614 0.1 0.1 1e+03 0 1.23e+03 2.61e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 0.1 1e+03 0 4.39e+03 7e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -535 147 0.1 1e+03 0 1.47e+03 1.47e+03 Boxvol_PV Transportation
2 579 258 0.1 1e+03 0 1.12e+03 2.59e+03 World_PV Transportation
Processing hits ....
3 5e+03 700 0.1 1e+03 0 4.44e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -676 0.1 133 1e+03 0 1.33e+03 1.33e+03 Boxvol_PV Transportation
2 498 0.1 250 1e+03 0 1.18e+03 2.51e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 700 1e+03 0 4.52e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -614 0.1 0.1 1e+03 0 1.39e+03 1.39e+03 Boxvol_PV Transportation
2 614 0.1 0.1 1e+03 0 1.23e+03 2.61e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 0.1 1e+03 0 4.39e+03 7e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -535 147 0.1 1e+03 0 1.47e+03 1.47e+03 Boxvol_PV Transportation
2 579 258 0.1 1e+03 0 1.12e+03 2.59e+03 World_PV Transportation
Processing hits ....
3 5e+03 700 0.1 1e+03 0 4.44e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -676 0.1 133 1e+03 0 1.33e+03 1.33e+03 Boxvol_PV Transportation
2 498 0.1 250 1e+03 0 1.18e+03 2.51e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 700 1e+03 0 4.52e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -614 0.1 0.1 1e+03 0 1.39e+03 1.39e+03 Boxvol_PV Transportation
2 614 0.1 0.1 1e+03 0 1.23e+03 2.61e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 0.1 1e+03 0 4.39e+03 7e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -535 147 0.1 1e+03 0 1.47e+03 1.47e+03 Boxvol_PV Transportation
2 579 258 0.1 1e+03 0 1.12e+03 2.59e+03 World_PV Transportation
Processing hits ....
3 5e+03 700 0.1 1e+03 0 4.44e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -676 0.1 133 1e+03 0 1.33e+03 1.33e+03 Boxvol_PV Transportation
2 498 0.1 250 1e+03 0 1.18e+03 2.51e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 700 1e+03 0 4.52e+03 7.03e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -614 0.1 0.1 1e+03 0 1.39e+03 1.39e+03 Boxvol_PV Transportation
2 614 0.1 0.1 1e+03 0 1.23e+03 2.61e+03 World_PV Transportation
Processing hits ....
3 5e+03 0.1 0.1 1e+03 0 4.39e+03 7e+03 OutOfWorld Transportation
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -2e+03 0.1 0.1 1e+03 0 0 0 World_PV initStep
1 -535 147 0.1 1e+03 0 1.47e+03 1.47e+03 Boxvol_PV Transportation
2 579 258 0.1 1e+03 0 1.12e+03 2.59e+03 World_PV Transportation
Processing hits ....
3 5e+03 700 0.1 1e+03 0 4.44e+03 7.03e+03 OutOfWorld Transportation
Run terminated.
Run Summary
Number of events processed : 20
User=0.01s Real=0.01s Sys=0s
/tracking/verbose 0
/gun/direction 0.3 0.2 1
/run/beamOn 20
Region <DefaultRegionForTheWorld> -- -- appears in <World_PV> world volume
This region is in the mass world.
Root logical volume(s) : World
Pointers : G4VUserRegionInformation[0], G4UserLimits[0], G4FastSimulationManager[0], G4UserSteppingAction[0]
Materials : Air
Production cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
Region <DefaultRegionForParallelWorld> -- -- is not associated to any world.
Root logical volume(s) :
Pointers : G4VUserRegionInformation[0], G4UserLimits[0], G4FastSimulationManager[0], G4UserSteppingAction[0]
Materials :
Production cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
========= Table of registered couples ==============================
Index : 0 used in the geometry : Yes recalculation needed : No
Material : Air
Range cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
Energy thresholds : gamma -1 MeV e- -1 MeV e+ -1 MeV proton -1 MeV
Region(s) which use this couple :
DefaultRegionForTheWorld
====================================================================
Start Run processing.
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Run terminated.
Run Summary
Number of events processed : 20
User=0s Real=0s Sys=0s
/gun/direction 0.3 -0.2 1
/run/beamOn 20
Region <DefaultRegionForTheWorld> -- -- appears in <World_PV> world volume
This region is in the mass world.
Root logical volume(s) : World
Pointers : G4VUserRegionInformation[0], G4UserLimits[0], G4FastSimulationManager[0], G4UserSteppingAction[0]
Materials : Air
Production cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
Region <DefaultRegionForParallelWorld> -- -- is not associated to any world.
Root logical volume(s) :
Pointers : G4VUserRegionInformation[0], G4UserLimits[0], G4FastSimulationManager[0], G4UserSteppingAction[0]
Materials :
Production cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
========= Table of registered couples ==============================
Index : 0 used in the geometry : Yes recalculation needed : No
Material : Air
Range cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
Energy thresholds : gamma -1 MeV e- -1 MeV e+ -1 MeV proton -1 MeV
Region(s) which use this couple :
DefaultRegionForTheWorld
====================================================================
Start Run processing.
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Run terminated.
Run Summary
Number of events processed : 20
User=0s Real=0s Sys=0s
/gun/direction -0.3 0.2 0.6
/run/beamOn 20
Region <DefaultRegionForTheWorld> -- -- appears in <World_PV> world volume
This region is in the mass world.
Root logical volume(s) : World
Pointers : G4VUserRegionInformation[0], G4UserLimits[0], G4FastSimulationManager[0], G4UserSteppingAction[0]
Materials : Air
Production cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
Region <DefaultRegionForParallelWorld> -- -- is not associated to any world.
Root logical volume(s) :
Pointers : G4VUserRegionInformation[0], G4UserLimits[0], G4FastSimulationManager[0], G4UserSteppingAction[0]
Materials :
Production cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
========= Table of registered couples ==============================
Index : 0 used in the geometry : Yes recalculation needed : No
Material : Air
Range cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
Energy thresholds : gamma -1 MeV e- -1 MeV e+ -1 MeV proton -1 MeV
Region(s) which use this couple :
DefaultRegionForTheWorld
====================================================================
Start Run processing.
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Processing hits ....
Run terminated.
Run Summary
Number of events processed : 20
User=0s Real=0s Sys=0s
Graphics systems deleted.
Visualization Manager deleting...
UserDetectorConstruction deleted.
UserPhysicsList deleted.
UserPrimaryGenerator deleted.
G4 kernel has come to Quit state.
G4SDManager deleted.
EventManager deleted.
UImanager deleted.
Units table cleared.
StateManager deleted.
RunManagerKernel is deleted.
RunManager is deleting.
@@ -23,9 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G04/gdml_det.cc
/// \brief Main program of the persistency/gdml/G04 example
//
// $Id: gdml_det.cc,v 1.3 2010-11-09 10:34:35 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
// --------------------------------------------------------------
@@ -42,10 +44,10 @@
#include "G4TransportationManager.hh"
#include "G4SDManager.hh"
#include "PrimaryGeneratorAction.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "SensitiveDetector.hh"
#include "G04PrimaryGeneratorAction.hh"
#include "G04DetectorConstruction.hh"
#include "G04PhysicsList.hh"
#include "G04SensitiveDetector.hh"
#ifdef G4VIS_USE
#include "G4VisExecutive.hh"
@@ -77,10 +79,10 @@ int main(int argc,char **argv)
G4RunManager* runManager = new G4RunManager;
runManager->SetUserInitialization(new DetectorConstruction(
runManager->SetUserInitialization(new G04DetectorConstruction(
parser.GetWorldVolume()));
runManager->SetUserInitialization(new PhysicsList);
runManager->SetUserAction(new PrimaryGeneratorAction);
runManager->SetUserInitialization(new G04PhysicsList);
runManager->SetUserAction(new G04PrimaryGeneratorAction);
runManager->Initialize();
@@ -93,7 +95,7 @@ int main(int argc,char **argv)
G4SDManager* SDman = G4SDManager::GetSDMpointer();
G4String trackerChamberSDname = "Tracker";
SensitiveDetector* aTrackerSD = new SensitiveDetector(trackerChamberSDname);
G04SensitiveDetector* aTrackerSD = new G04SensitiveDetector(trackerChamberSDname);
SDman->AddNewDetector( aTrackerSD );
///////////////////////////////////////////////////////////////////////
@@ -23,34 +23,38 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G04/include/G04DetectorConstruction.hh
/// \brief Definition of the G04DetectorConstruction class
//
// $Id: DetectorConstruction.hh,v 1.2 2008-11-10 15:39:34 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
#ifndef _DETECTORCONSTRUCTION_H_
#define _DETECTORCONSTRUCTION_H_
#ifndef _G04DETECTORCONSTRUCTION_H_
#define _G04DETECTORCONSTRUCTION_H_
#include "G4VUserDetectorConstruction.hh"
class DetectorConstruction : public G4VUserDetectorConstruction
/// Detector construction for laoding GDML geometry
class G04DetectorConstruction : public G4VUserDetectorConstruction
{
public:
DetectorConstruction(G4VPhysicalVolume *setWorld = 0)
G04DetectorConstruction(G4VPhysicalVolume *setWorld = 0)
{
World = setWorld;
fWorld = setWorld;
}
G4VPhysicalVolume *Construct()
{
return World;
return fWorld;
}
private:
G4VPhysicalVolume *World;
G4VPhysicalVolume *fWorld;
};
#endif
@@ -23,24 +23,28 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G04/include/G04PhysicsList.hh
/// \brief Definition of the G04PhysicsList class
//
// $Id: PhysicsList.hh,v 1.1 2010-10-11 08:40:51 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
#ifndef _PHYSICSLIST_H_
#define _PHYSICSLIST_H_
#ifndef _G04PHYSICSLIST_H_
#define _G04PHYSICSLIST_H_
#include "G4VUserPhysicsList.hh"
#include "G4ParticleTypes.hh"
#include "globals.hh"
class PhysicsList : public G4VUserPhysicsList
/// Physics list for the GDML senstive detector example
class G04PhysicsList : public G4VUserPhysicsList
{
public:
PhysicsList();
~PhysicsList();
G04PhysicsList();
~G04PhysicsList();
protected:
@@ -23,14 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G04/include/G04PrimaryGeneratorAction.hh
/// \brief Definition of the G04PrimaryGeneratorAction class
//
// $Id: PrimaryGeneratorAction.hh,v 1.1 2010-10-11 08:40:51 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
#ifndef _PRIMARYGENERATORACTION_H_
#define _PRIMARYGENERATORACTION_H_
#ifndef _G04PRIMARYGENERATORACTION_H_
#define _G04PRIMARYGENERATORACTION_H_
#include "G4VUserPrimaryGeneratorAction.hh"
@@ -39,18 +41,20 @@
class G4Event;
class G4ParticleGun;
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
/// Primary generator action for GDML sensitive detector example
class G04PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PrimaryGeneratorAction();
~PrimaryGeneratorAction();
G04PrimaryGeneratorAction();
~G04PrimaryGeneratorAction();
void GeneratePrimaries(G4Event* anEvent);
private:
G4ParticleGun* particleGun;
G4ParticleGun* fParticleGun;
};
#endif
@@ -23,23 +23,27 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G04/include/G04SensitiveDetector.hh
/// \brief Definition of the G04SensitiveDetector class
//
// $Id: SensitiveDetector.hh,v 1.1 2010-10-11 08:40:51 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
#ifndef SensitiveDetector_h
#define SensitiveDetector_h 1
#ifndef G04SensitiveDetector_h
#define G04SensitiveDetector_h 1
#include "G4VSensitiveDetector.hh"
class G4Step;
class SensitiveDetector : public G4VSensitiveDetector
/// Sensitive detector to be attached to the GDML geometry
class G04SensitiveDetector : public G4VSensitiveDetector
{
public:
SensitiveDetector(const G4String&);
~SensitiveDetector();
G04SensitiveDetector(const G4String&);
~G04SensitiveDetector();
void Initialize(G4HCofThisEvent*);
G4bool ProcessHits(G4Step*, G4TouchableHistory*);
@@ -23,33 +23,45 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G04/src/G04PhysicsList.cc
/// \brief Implementation of the G04PhysicsList class
//
// $Id: PhysicsList.cc,v 1.2 2008-11-10 15:39:34 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
#include "PhysicsList.hh"
#include "G04PhysicsList.hh"
PhysicsList::PhysicsList()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G04PhysicsList::G04PhysicsList()
{
}
PhysicsList::~PhysicsList()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G04PhysicsList::~G04PhysicsList()
{
}
void PhysicsList::ConstructParticle()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G04PhysicsList::ConstructParticle()
{
G4Geantino::GeantinoDefinition();
}
void PhysicsList::ConstructProcess()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G04PhysicsList::ConstructProcess()
{
AddTransportation();
}
void PhysicsList::SetCuts()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G04PhysicsList::SetCuts()
{
G4int temp = GetVerboseLevel();
SetVerboseLevel(0);
@@ -23,37 +23,46 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G04/src/G04PrimaryGeneratorAction.cc
/// \brief Implementation of the G04PrimaryGeneratorAction class
//
// $Id: PrimaryGeneratorAction.cc,v 1.2 2008-11-10 15:39:34 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
#include "PrimaryGeneratorAction.hh"
#include "G04PrimaryGeneratorAction.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
PrimaryGeneratorAction::PrimaryGeneratorAction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G04PrimaryGeneratorAction::G04PrimaryGeneratorAction()
{
G4int n_particle = 1;
particleGun = new G4ParticleGun(n_particle);
fParticleGun = new G4ParticleGun(n_particle);
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
particleGun->SetParticleDefinition(
fParticleGun->SetParticleDefinition(
particleTable->FindParticle(particleName="geantino"));
particleGun->SetParticleEnergy(1.0*GeV);
particleGun->SetParticlePosition(G4ThreeVector(-2.0*m, 0.1, 0.1));
fParticleGun->SetParticleEnergy(1.0*GeV);
fParticleGun->SetParticlePosition(G4ThreeVector(-2.0*m, 0.1, 0.1));
}
PrimaryGeneratorAction::~PrimaryGeneratorAction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G04PrimaryGeneratorAction::~G04PrimaryGeneratorAction()
{
delete particleGun;
delete fParticleGun;
}
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G04PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
G4int i = anEvent->GetEventID() % 3;
G4ThreeVector v(1.0,0.0,0.0);
@@ -68,6 +77,6 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
v.setZ(0.1);
break;
}
particleGun->SetParticleMomentumDirection(v);
particleGun->GeneratePrimaryVertex(anEvent);
fParticleGun->SetParticleMomentumDirection(v);
fParticleGun->GeneratePrimaryVertex(anEvent);
}
@@ -23,41 +23,49 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file persistency/gdml/G04/src/G04SensitiveDetector.cc
/// \brief Implementation of the G04SensitiveDetector class
//
// $Id: SensitiveDetector.cc,v 1.2 2010-10-21 13:13:55 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
#include "SensitiveDetector.hh"
#include "G04SensitiveDetector.hh"
#include "G4HCofThisEvent.hh"
#include "G4Step.hh"
#include "G4ThreeVector.hh"
#include "G4SDManager.hh"
#include "G4ios.hh"
SensitiveDetector::SensitiveDetector(const G4String& name)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G04SensitiveDetector::G04SensitiveDetector(const G4String& name)
: G4VSensitiveDetector(name)
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SensitiveDetector::~SensitiveDetector()
G04SensitiveDetector::~G04SensitiveDetector()
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SensitiveDetector::Initialize(G4HCofThisEvent*)
void G04SensitiveDetector::Initialize(G4HCofThisEvent*)
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool SensitiveDetector::ProcessHits(G4Step*, G4TouchableHistory*)
G4bool G04SensitiveDetector::ProcessHits(G4Step*, G4TouchableHistory*)
{
G4cout << "Processing hits ...." << G4endl;
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SensitiveDetector::EndOfEvent(G4HCofThisEvent*)
void G04SensitiveDetector::EndOfEvent(G4HCofThisEvent*)
{
}