Import Geant4 9.6.0 source tree
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
//$Id$
|
||||
|
||||
///\file "persistency/P01/.README"
|
||||
///\brief Example P01 README page
|
||||
|
||||
/*! \page ExampleP01 Example P01
|
||||
|
||||
|
||||
\section P01_s1 General description
|
||||
|
||||
This example shows how to store produced hits in a file using
|
||||
the 'reflection' technique for persistency provided by the Reflex tool
|
||||
included in ROOT. The Reflex tool allows to create a dictionary for
|
||||
the hit class, making then possible to save hit objects in a .root
|
||||
file. The general simulation setup (geometry, physics list, user
|
||||
actions, etc...) is taken from ExampleN02.
|
||||
|
||||
The provided makefile produces two executables: 'exampleP01' and
|
||||
'readHits'. The first one is the actual Geant4 simulation application
|
||||
with hits persistency. The second one, is just a simple 'reader' for
|
||||
the produced .root file (you need to specify the name of the .root
|
||||
file as argument).
|
||||
|
||||
|
||||
\section P01_s2 Building and running the example
|
||||
|
||||
This examples requires the ROOT toolkit to be installed in the
|
||||
system as well as GCCXML package which is used by the Reflex tool. The
|
||||
provided CMake file checks for the existance of those packages.
|
||||
Once the CMake configuration has been succesfully done, the two executables
|
||||
for this example (exampleP01, readHits) should be build using make
|
||||
(in your CMake build directory):
|
||||
\verbatim
|
||||
make
|
||||
\endverbatim
|
||||
|
||||
When the example is run (using the provided run.mac macro file) ten
|
||||
events are generated and the produced hits will be stored in
|
||||
the hits.root file. In addition, the hits will be printed out on the
|
||||
screen so one can then compare them with the 'reader' output.
|
||||
|
||||
In order to read the persistified hits, a small 'reader' application
|
||||
has been implemented. It is build by the same makefile as the example
|
||||
executable. It can be run in the following way:
|
||||
|
||||
\verbatim
|
||||
<my_binary_directory>/readHits hits.root
|
||||
\endverbatim
|
||||
|
||||
where the argument is the name of the file to be read. All the hits
|
||||
saved in that file will be then read and printed on the screen.
|
||||
|
||||
In addition to that the readHits.C ROOT macro file is provides, which
|
||||
illustrates how one can read the hits file directly from the ROOT
|
||||
prompt.
|
||||
|
||||
\section P01_s3 Remark on dictionary generation
|
||||
|
||||
The dictionary is generated by ${ROOTSYS}/bin/genreflex
|
||||
tool. The header file including headers for all the classes we want to
|
||||
generate the dictionary for should be given as argument. Additionally,
|
||||
a so called selection file (xml) should be provided (with -s flag) to
|
||||
the genreflex tool (see the GNUmakefile). The role of this file is to
|
||||
specify which classes we want to generate the dictionary for. The
|
||||
selection file for our dictionary is in xml/ directory. Please refer
|
||||
to genreflex manual for more details concerning the usage of that
|
||||
tool.
|
||||
|
||||
Concerning generating dictionary for the Geant4 objects, there are
|
||||
also two technical remarks that need to be made here. The gccxml tool
|
||||
(version 0.6.0_patch1) requires all the templated classes to be
|
||||
explicitely used somewhere in the included header files in order for
|
||||
the generation of the dictionary to be possible. For those templated
|
||||
classes for which it is not the case, the problem can be very easily
|
||||
solved by instaciating them in the headerfile which is given to
|
||||
genreflex (see includes/Classes.h) as argument.
|
||||
The second remark is that there is an unfortunate clash of names as
|
||||
far as G4String class is concerned. The header of G4String class
|
||||
defines __G4String which happens to be the name of a variable used
|
||||
within the generated dictionary code. The solution for that is to do
|
||||
#undef __G4String in include/Classes.h file.
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,99 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# Setup the project
|
||||
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
||||
project(P01)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Find Geant4 package, activating all available UI and Vis drivers by default
|
||||
# You can set WITH_GEANT4_UIVIS to OFF via the command line or ccmake/cmake-gui
|
||||
# to build a batch mode only executable
|
||||
#
|
||||
option(WITH_GEANT4_UIVIS "Build example with Geant4 UI and Vis drivers" ON)
|
||||
if(WITH_GEANT4_UIVIS)
|
||||
find_package(Geant4 REQUIRED ui_all vis_all)
|
||||
else()
|
||||
find_package(Geant4 REQUIRED)
|
||||
endif()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Setup Geant4 include directories and compile definitions
|
||||
#
|
||||
include(${Geant4_USE_FILE})
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Find ROOT (required package)
|
||||
#
|
||||
find_package(ROOT QUIET)
|
||||
if(NOT ROOT_FOUND)
|
||||
message(STATUS "G4 Examples: ROOT package not found. --> P01 example disabled")
|
||||
return()
|
||||
endif()
|
||||
if(NOT GCCXML)
|
||||
message(STATUS "G4 Examples: GCCXML not found. --> P01 example disabled")
|
||||
return()
|
||||
endif()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# P01 requires shared libraries
|
||||
#
|
||||
if(BUILD_STATIC_LIBS AND NOT BUILD_SHARED_LIBS )
|
||||
message(STATUS "G4 Examples: Building only Static Libraires. --> P01 example disabled")
|
||||
return()
|
||||
endif()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Locate sources and headers for this project
|
||||
#
|
||||
include_directories(${PROJECT_SOURCE_DIR}/include
|
||||
${Geant4_INCLUDE_DIR}
|
||||
${ROOT_INCLUDE_DIR})
|
||||
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
|
||||
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Generate dictionaries, add ROOT libraries properties
|
||||
#
|
||||
REFLEX_GENERATE_DICTIONARY(ExP01Classes include/ExP01Classes.hh SELECTION xml/selection.xml)
|
||||
add_library(ExP01ClassesDict SHARED ${sources} ExP01Classes.cpp)
|
||||
set(libsuffix .so)
|
||||
set(ROOT_LIBRARY_PROPERTIES ${ROOT_LIBRARY_PROPERTIES} SUFFIX ${libsuffix})
|
||||
set_target_properties(ExP01ClassesDict PROPERTIES ${ROOT_LIBRARY_PROPERTIES})
|
||||
target_link_libraries(ExP01ClassesDict ${Geant4_LIBRARIES} ${ROOT_LIBRARIES} Cintex Reflex)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add the executable, and link it to the Geant4 libraries
|
||||
#
|
||||
add_executable(exampleP01 exampleP01.cc ${sources} ${headers})
|
||||
target_link_libraries(exampleP01 ExP01ClassesDict ${Geant4_LIBRARIES} ${ROOT_LIBRARIES} Cintex)
|
||||
add_executable(readHits readHits.cc ${sources} ${headers})
|
||||
target_link_libraries(readHits ExP01ClassesDict ${Geant4_LIBRARIES} ${ROOT_LIBRARIES} Cintex)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Copy all scripts to the build directory, i.e. the directory in which we
|
||||
# build P01. This is so that we can run the executable directly because it
|
||||
# relies on these scripts being in the current working directory.
|
||||
#
|
||||
set(P01_SCRIPTS
|
||||
run.mac vis.mac
|
||||
)
|
||||
|
||||
foreach(_script ${P01_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(P01 DEPENDS exampleP01 readHits )
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
|
||||
#
|
||||
install(TARGETS exampleP01 DESTINATION bin)
|
||||
install(TARGETS readHits DESTINATION bin)
|
||||
|
||||
@@ -20,7 +20,6 @@ ifndef PLATFORM
|
||||
endif
|
||||
|
||||
CPPFLAGS += -I$(ROOTSYS)/include
|
||||
#EXTRALIBS := -L$(ROOTSYS)/lib -lCore -lTree -lCint -lReflex -lCintex -ldl
|
||||
EXTRALIBS := $(shell $(ROOTSYS)/bin/root-config --libs) -lReflex -lCintex
|
||||
|
||||
DICTIONARYPATH := ${G4WORKDIR}/tmp/${G4SYSTEM}/${G4TARGET}/dictionary
|
||||
@@ -36,19 +35,19 @@ ifndef GCCXMLPATH
|
||||
@echo GCCXMLPATH not defined!
|
||||
endif
|
||||
mkdir -p ${DICTIONARYPATH}
|
||||
${ROOTSYS}/bin/genreflex ${LOCALDIR}/include/Classes.hh \
|
||||
-s ${LOCALDIR}/xml/selection.xml -o ${DICTIONARYPATH}/Classes_rflx.cpp \
|
||||
${ROOTSYS}/bin/genreflex ${LOCALDIR}/include/ExP01Classes.hh \
|
||||
-s ${LOCALDIR}/xml/selection.xml -o ${DICTIONARYPATH}/ExP01Classes_rflx.cpp \
|
||||
--gccxmlpath ${GCCXMLPATH} -Iinclude -I${G4INCLUDE} -I${CLHEP_INCLUDE_DIR}
|
||||
#
|
||||
gcc -o ${G4WORKDIR}/tmp/${G4SYSTEM}/${G4TARGET}/libClassesDict.so -fpic -shared \
|
||||
${DICTIONARYPATH}/Classes_rflx.cpp src/*.cc \
|
||||
$(CXX) -o ${G4WORKDIR}/tmp/${G4SYSTEM}/${G4TARGET}/libExP01ClassesDict.so -fpic -shared \
|
||||
${DICTIONARYPATH}/ExP01Classes_rflx.cpp src/*.cc \
|
||||
-Iinclude -I${ROOTSYS}/include -I${G4INCLUDE} -I${CLHEP_INCLUDE_DIR} \
|
||||
${EXTRALIBS} -L${CLHEP_LIB_DIR} -l${CLHEP_LIB} -L${G4LIB}/${G4SYSTEM} ${LDLIBS2}
|
||||
${EXTRALIBS} -L${G4LIB}/${G4SYSTEM} ${LDLIBS2} ${LOADLIBS}
|
||||
#
|
||||
mkdir -p ${G4WORKDIR}/bin/${G4SYSTEM}
|
||||
gcc -o ${G4WORKDIR}/bin/${G4SYSTEM}/readHits readHits.cc \
|
||||
$(CXX) -o ${G4WORKDIR}/bin/${G4SYSTEM}/readHits readHits.cc \
|
||||
-Iinclude -I${ROOTSYS}/include -I${G4INCLUDE} -I${CLHEP_INCLUDE_DIR} \
|
||||
${EXTRALIBS} -L${CLHEP_LIB_DIR} -l${CLHEP_LIB} -L${G4LIB}/${G4SYSTEM} ${LDLIBS2}
|
||||
${EXTRALIBS} -L${G4LIB}/${G4SYSTEM} ${LDLIBS2} ${LDLIBS3} ${LOADLIBS}
|
||||
|
||||
clean_all: clean
|
||||
@$(RM) hits.root
|
||||
|
||||
@@ -14,7 +14,35 @@ track of all tags.
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
Nvember 14th, 2012 P. Mato (exampleP01-V09-05-08)
|
||||
- Fixed compilation warning
|
||||
|
||||
October 11th, 2012 A. Dotti (exampleP01-V09-05-07)
|
||||
- Adding protection in case GCCXML is not found: disabling
|
||||
example in CMake
|
||||
|
||||
September 25th, 2012 I. Hrivnacova
|
||||
- Taking into account renaming the dictionary also in macros, code
|
||||
and GNUmake build
|
||||
- Fixes in GNUmakefile (was failing when building with internal
|
||||
CLHEP and xerces-c)
|
||||
|
||||
September 25th, 2012 I. Hrivnacova (exampleP01-V09-05-06)
|
||||
- renamed Classes.hh to ExP01Classes.hh
|
||||
|
||||
August 1st, 2012 W. Pokorski (exampleP01-V09-05-05)
|
||||
- cosmetic changes for the examples code review
|
||||
|
||||
June 10th, 2012 P. Mato (exampleP01-V09-05-04)
|
||||
- disable building example if only static libraries are build
|
||||
|
||||
April 10th, 2012 W.Pokorski (exampleP01-V09-05-03)
|
||||
- removing debug printout, small fix in the iterator type
|
||||
|
||||
March 29th, 2012 W.Pokorski (exampleP01-V09-05-01)
|
||||
- fixes in GNUMakefile, CMakeLists.txt, removing G4Exception from the code and
|
||||
adding root macro to read the hits.
|
||||
|
||||
December 1th, 2010 W.Pokorski, I.Hrivnacova (exampleP01-V09-03-02)
|
||||
- Updated setup to use latest version of Root.
|
||||
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
|
||||
This example shows how to store produced hits in a file using
|
||||
the 'reflection' technique for persistency provided by the Reflex tool
|
||||
also included in ROOT. The Reflex tool allows to create a dictionary
|
||||
included in ROOT. The Reflex tool allows to create a dictionary
|
||||
for the hit class, making then possible to save hit objects in a .root
|
||||
file. The general simulation setup (geometry, physics list, user
|
||||
actions, etc...) is taken from ExampleN02.
|
||||
file. The general simulation setup (geometry, physics list, user
|
||||
actions, etc...) is taken from ExampleN02.
|
||||
|
||||
The provided makefile produces two executables: 'persEx02' and
|
||||
The provided makefile produces two executables: 'exampleP01' and
|
||||
'readHits'. The first one is the actual Geant4 simulation application
|
||||
with hits persistency. The second one, is just a simple 'reader' for
|
||||
the produced .root file (you need to specify the name of the .root
|
||||
@@ -26,41 +26,32 @@ file as argument).
|
||||
Building and running the example
|
||||
--------------------------------
|
||||
|
||||
Before buidling and/or running the example you need to set the
|
||||
following environment variables:
|
||||
This examples requires the ROOT toolkit to be installed in the
|
||||
system as well as GCCXML package which is used by the Reflex tool. The
|
||||
provided CMake file checks for the existance of those packages.
|
||||
Once the CMake configuration has been succesfully done, the two executables
|
||||
for this example (exampleP01, readHits) should be build using make (in your
|
||||
CMake build directory):
|
||||
|
||||
ROOTSYS - ROOT installation directory, it is required to run ROOT
|
||||
make
|
||||
|
||||
GCCXMLPATH - gccxml binary directory, it is needed by ROOT for the
|
||||
dictionary generation
|
||||
LD_LIBRARY_PATH - to include the ROOT library path and the path to
|
||||
the dictionary library, i.e., for tcsh UNIX shell:
|
||||
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:$ROOTSYS/lib:
|
||||
$G4WORKDIR/tmp/$G4SYSTEM/exampleP01
|
||||
|
||||
The present version of the example requires that Geant4 headers are
|
||||
installed in a single directory referenced by G4INCLUDE, as the standard
|
||||
Geant4 installation procedure allows to do.
|
||||
|
||||
Once those variables are set (together with the standard Geant4 setup)
|
||||
the example can be build by issueing the 'make' command. The final
|
||||
executable file can be found in the usual directory:
|
||||
|
||||
$G4WORKDIR/bin/$G4SYSTEM/
|
||||
|
||||
Ten events will be generated and the produced hits will be stored in
|
||||
When the example is run (using the provided run.mac macro file) ten
|
||||
events are generated and the produced hits will be stored in
|
||||
the hits.root file. In addition, the hits will be printed out on the
|
||||
screen so one can then compare them with the 'reader' output.
|
||||
|
||||
In order to read the persistified hits, a small 'reader' application
|
||||
has been implemented. It is build by the same makefile as the example
|
||||
executable. It can be run in the following way:
|
||||
has been implemented. It can be run in the following way:
|
||||
|
||||
readHits hits.root
|
||||
<my_binary_directory>/readHits hits.root
|
||||
|
||||
where the argument is the name of the file to be read. All the hits
|
||||
saved in that file will be then read and printed on the screen.
|
||||
|
||||
In addition to that the readHits.C ROOT macro file is provides, which
|
||||
illustrates how one can read the hits file directly from the ROOT
|
||||
prompt.
|
||||
|
||||
|
||||
Remark on dictionary generation
|
||||
-------------------------------
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/exampleP01.cc
|
||||
/// \brief Main program of the persistency/P01 example
|
||||
//
|
||||
// $Id: exampleP01.cc,v 1.4 2010-12-01 14:18:27 witoldp Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/include/ExP01ChamberParameterisation.hh
|
||||
/// \brief Definition of the ExP01ChamberParameterisation class
|
||||
//
|
||||
// $Id: ExP01ChamberParameterisation.hh,v 1.2 2006-06-29 17:38:43 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// A parameterisation that describes a series of boxes along Z
|
||||
@@ -59,6 +61,8 @@ class G4Polyhedra;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
/// Chamber parameterisation for the persistency example
|
||||
|
||||
class ExP01ChamberParameterisation : public G4VPVParameterisation
|
||||
{
|
||||
public:
|
||||
@@ -70,7 +74,7 @@ class ExP01ChamberParameterisation : public G4VPVParameterisation
|
||||
G4double lengthInitial,
|
||||
G4double lengthFinal );
|
||||
|
||||
virtual
|
||||
virtual
|
||||
~ExP01ChamberParameterisation();
|
||||
|
||||
void ComputeTransformation (const G4int copyNo,
|
||||
|
||||
+3
@@ -23,6 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/include/ExP01Classes.hh
|
||||
/// \brief Declaration of the classes for generating dictionaries
|
||||
//
|
||||
#include "ExP01TrackerHit.hh"
|
||||
|
||||
std::vector<ExP01TrackerHit*> a;
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/include/ExP01DetectorConstruction.hh
|
||||
/// \brief Definition of the ExP01DetectorConstruction class
|
||||
//
|
||||
// $Id: ExP01DetectorConstruction.hh,v 1.2 2006-06-29 17:38:46 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -45,6 +47,8 @@ class ExP01DetectorMessenger;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
/// Detector Construction for the persistency example
|
||||
|
||||
class ExP01DetectorConstruction : public G4VUserDetectorConstruction
|
||||
{
|
||||
public:
|
||||
@@ -95,7 +99,7 @@ class ExP01DetectorConstruction : public G4VUserDetectorConstruction
|
||||
G4double fTrackerLength; // Full length of Tracker
|
||||
G4int NbOfChambers; // Nb of chambers in the tracker region
|
||||
G4double ChamberWidth; // width of the chambers
|
||||
G4double ChamberSpacing; // distance between chambers
|
||||
G4double ChamberSpacing; // distance between chambers
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/include/ExP01DetectorMessenger.hh
|
||||
/// \brief Definition of the ExP01DetectorMessenger class
|
||||
//
|
||||
// $Id: ExP01DetectorMessenger.hh,v 1.2 2006-06-29 17:38:49 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -43,6 +45,8 @@ class G4UIcmdWithADoubleAndUnit;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
/// Detector messenger for the persistency example
|
||||
|
||||
class ExP01DetectorMessenger: public G4UImessenger
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/include/ExP01EventAction.hh
|
||||
/// \brief Definition of the ExP01EventAction class
|
||||
//
|
||||
// $Id: ExP01EventAction.hh,v 1.2 2006-06-29 17:38:51 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -39,6 +41,8 @@ class G4Event;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
/// Event action for the persistency example
|
||||
|
||||
class ExP01EventAction : public G4UserEventAction
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/include/ExP01MagneticField.hh
|
||||
/// \brief Definition of the ExP01MagneticField class
|
||||
//
|
||||
// $Id: ExP01MagneticField.hh,v 1.2 2006-06-29 17:38:53 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// A class for control of the Magnetic Field of the detector.
|
||||
@@ -43,6 +45,7 @@ class G4FieldManager;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
/// Magnetic field for the persistency example
|
||||
|
||||
class ExP01MagneticField: public G4UniformMagField
|
||||
{
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/include/ExP01PhysicsList.hh
|
||||
/// \brief Definition of the ExP01PhysicsList class
|
||||
//
|
||||
// $Id: ExP01PhysicsList.hh,v 1.2 2006-06-29 17:38:55 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -38,6 +40,8 @@
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
/// Physics list for the persistency example
|
||||
|
||||
class ExP01PhysicsList: public G4VUserPhysicsList
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/include/ExP01PrimaryGeneratorAction.hh
|
||||
/// \brief Definition of the ExP01PrimaryGeneratorAction class
|
||||
//
|
||||
// $Id: ExP01PrimaryGeneratorAction.hh,v 1.2 2006-06-29 17:38:58 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -40,6 +42,8 @@ class G4ParticleGun;
|
||||
class G4Event;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
/// Primary generator action for the persistency example
|
||||
|
||||
class ExP01PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/include/ExP01RunAction.hh
|
||||
/// \brief Definition of the ExP01RunAction class
|
||||
//
|
||||
// $Id: ExP01RunAction.hh,v 1.2 2006-06-29 17:39:01 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -40,6 +42,8 @@
|
||||
|
||||
class G4Run;
|
||||
|
||||
/// Run action for the persistency example
|
||||
|
||||
class ExP01RunAction : public G4UserRunAction
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/include/ExP01SteppingAction.hh
|
||||
/// \brief Definition of the ExP01SteppingAction class
|
||||
//
|
||||
// $Id: ExP01SteppingAction.hh,v 1.2 2006-06-29 17:39:04 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -37,6 +39,8 @@
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
/// Stepping action for the persistency example
|
||||
|
||||
class ExP01SteppingAction : public G4UserSteppingAction
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/include/ExP01SteppingVerbose.hh
|
||||
/// \brief Definition of the ExP01SteppingVerbose class
|
||||
//
|
||||
// $Id: ExP01SteppingVerbose.hh,v 1.2 2006-06-29 17:39:06 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// This class manages the verbose outputs in G4SteppingManager.
|
||||
// It inherits from G4SteppingVerbose.
|
||||
@@ -43,6 +45,8 @@ class ExP01SteppingVerbose;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
/// Stepping verbose for the persistency example
|
||||
|
||||
class ExP01SteppingVerbose : public G4SteppingVerbose
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/include/ExP01TrackerHit.hh
|
||||
/// \brief Definition of the ExP01TrackerHit class
|
||||
//
|
||||
// $Id: ExP01TrackerHit.hh,v 1.2 2006-06-29 17:39:08 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -40,6 +42,8 @@
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
/// Hit implementation for the persistency example
|
||||
|
||||
class ExP01TrackerHit : public G4VHit
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/include/ExP01TrackerSD.hh
|
||||
/// \brief Definition of the ExP01TrackerSD class
|
||||
//
|
||||
// $Id: ExP01TrackerSD.hh,v 1.2 2006-06-29 17:39:10 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -41,6 +43,8 @@ class G4HCofThisEvent;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
/// Sensitive detector implementation for the ROOT hits persistency example
|
||||
|
||||
class ExP01TrackerSD : public G4VSensitiveDetector
|
||||
{
|
||||
public:
|
||||
@@ -52,8 +56,8 @@ class ExP01TrackerSD : public G4VSensitiveDetector
|
||||
void EndOfEvent(G4HCofThisEvent*);
|
||||
|
||||
private:
|
||||
ExP01TrackerHitsCollection* trackerCollection;
|
||||
|
||||
ExP01TrackerHitsCollection* fTrackerCollection;
|
||||
G4int fHCID;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,7 +23,10 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: RootIO.hh,v 1.4 2010-12-01 14:18:27 witoldp Exp $
|
||||
/// \file persistency/P01/include/RootIO.hh
|
||||
/// \brief Definition of the RootIO class
|
||||
//
|
||||
// $Id$
|
||||
#ifndef INCLUDE_ROOTIO_HH
|
||||
#define INCLUDE_ROOTIO_HH 1
|
||||
|
||||
@@ -34,13 +37,15 @@
|
||||
|
||||
#include "ExP01TrackerHit.hh"
|
||||
|
||||
/** @class rootio rootio.hh include/rootio.hh
|
||||
/** @class RootIO
|
||||
*
|
||||
*
|
||||
* @author Witold POKORSKI
|
||||
* @date 2005-10-27
|
||||
*/
|
||||
|
||||
/// Root IO implementation for the persistency example
|
||||
|
||||
class RootIO
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
// Include files
|
||||
#include "TROOT.h"
|
||||
#include "TFile.h"
|
||||
#include "TSystem.h"
|
||||
#include "TKey.h"
|
||||
//*****************************************************************************
|
||||
// To run this macro in cint do (after replacing the location_of_your_libraries below):
|
||||
// .include $G4INCLUDE
|
||||
// gSystem->Load("libCintex.so");
|
||||
// gSystem->Load("<location_of_your_libraries>/libExP01ClassesDict.so");
|
||||
// ROOT::Cintex::Cintex::Enable();
|
||||
// .L hits.C++
|
||||
// hits();
|
||||
//*****************************************************************************
|
||||
#include "include/ExP01TrackerHit.hh"
|
||||
|
||||
void hits()
|
||||
{
|
||||
TFile fo("hits.root");
|
||||
|
||||
std::vector<ExP01TrackerHit*>* hits;
|
||||
fo.GetListOfKeys()->Print();
|
||||
|
||||
TIter next(fo.GetListOfKeys());
|
||||
TKey *key;
|
||||
double tot_en;
|
||||
while ((key=(TKey*)next()))
|
||||
{
|
||||
fo.GetObject(key->GetName(), hits);
|
||||
|
||||
tot_en = 0;
|
||||
cout << "Collection: " << key->GetName() << endl;
|
||||
cout << "Number of hits: " << hits->size() << endl;
|
||||
for (int i=0;i!=hits->size();i++)
|
||||
{
|
||||
(*hits)[i]->Print();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/readHits.cc
|
||||
/// \brief Main program of the persistency/P01 example
|
||||
//
|
||||
// Include files
|
||||
#include "TROOT.h"
|
||||
#include "TFile.h"
|
||||
@@ -39,7 +42,7 @@ int main(int argc,char** argv)
|
||||
// initialize ROOT
|
||||
TSystem ts;
|
||||
gSystem->Load("libCintex");
|
||||
gSystem->Load("libClassesDict");
|
||||
gSystem->Load("libExP01ClassesDict");
|
||||
// ROOT::Cintex::Cintex::SetDebug(2);
|
||||
ROOT::Cintex::Cintex::Enable();
|
||||
if(argc<2) G4cout << "Missing name of the file to read!" << G4endl;
|
||||
@@ -51,15 +54,15 @@ int main(int argc,char** argv)
|
||||
|
||||
TIter next(fo.GetListOfKeys());
|
||||
TKey *key;
|
||||
double tot_en;
|
||||
//double tot_en;
|
||||
while ((key=(TKey*)next()))
|
||||
{
|
||||
fo.GetObject(key->GetName(), hits);
|
||||
|
||||
tot_en = 0;
|
||||
//tot_en = 0;
|
||||
G4cout << "Collection: " << key->GetName() << G4endl;
|
||||
G4cout << "Number of hits: " << hits->size() << G4endl;
|
||||
for (int i=0;i!=hits->size();i++)
|
||||
for (size_t i=0;i!=hits->size();i++)
|
||||
{
|
||||
(*hits)[i]->Print();
|
||||
}
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/src/ExP01ChamberParameterisation.cc
|
||||
/// \brief Implementation of the ExP01ChamberParameterisation class
|
||||
//
|
||||
// $Id: ExP01ChamberParameterisation.cc,v 1.2 2006-06-29 17:39:15 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -55,7 +57,8 @@ ExP01ChamberParameterisation::ExP01ChamberParameterisation(
|
||||
if( NoChambers > 0 ){
|
||||
fHalfLengthIncr = 0.5 * (lengthFinal-lengthInitial)/NoChambers;
|
||||
if (spacingZ < widthChamber) {
|
||||
G4Exception("ExP01ChamberParameterisation construction: Width>Spacing");
|
||||
G4cout << "ExP01ChamberParameterisation construction: Width>Spacing" << G4endl;
|
||||
exit(1);;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/src/ExP01DetectorConstruction.cc
|
||||
/// \brief Implementation of the ExP01DetectorConstruction class
|
||||
//
|
||||
// $Id: ExP01DetectorConstruction.cc,v 1.2 2006-06-29 17:39:17 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -48,6 +50,7 @@
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Colour.hh"
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -138,11 +141,11 @@ G4VPhysicalVolume* ExP01DetectorConstruction::Construct()
|
||||
physiWorld = new G4PVPlacement(0, // no rotation
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
logicWorld, // its logical volume
|
||||
"World", // its name
|
||||
"World", // its name
|
||||
0, // its mother volume
|
||||
false, // no boolean operations
|
||||
0); // copy number
|
||||
|
||||
|
||||
//------------------------------
|
||||
// Target
|
||||
//------------------------------
|
||||
@@ -152,12 +155,12 @@ G4VPhysicalVolume* ExP01DetectorConstruction::Construct()
|
||||
solidTarget = new G4Box("target",targetSize,targetSize,targetSize);
|
||||
logicTarget = new G4LogicalVolume(solidTarget,TargetMater,"Target",0,0,0);
|
||||
physiTarget = new G4PVPlacement(0, // no rotation
|
||||
positionTarget, // at (x,y,z)
|
||||
logicTarget, // its logical volume
|
||||
"Target", // its name
|
||||
logicWorld, // its mother volume
|
||||
false, // no boolean operations
|
||||
0); // copy number
|
||||
positionTarget, // at (x,y,z)
|
||||
logicTarget, // its logical volume
|
||||
"Target", // its name
|
||||
logicWorld, // its mother volume
|
||||
false, // no boolean operations
|
||||
0); // copy number
|
||||
|
||||
G4cout << "Target is " << fTargetLength/cm << " cm of "
|
||||
<< TargetMater->GetName() << G4endl;
|
||||
@@ -171,12 +174,12 @@ G4VPhysicalVolume* ExP01DetectorConstruction::Construct()
|
||||
solidTracker = new G4Box("tracker",trackerSize,trackerSize,trackerSize);
|
||||
logicTracker = new G4LogicalVolume(solidTracker , Air, "Tracker",0,0,0);
|
||||
physiTracker = new G4PVPlacement(0, // no rotation
|
||||
positionTracker, // at (x,y,z)
|
||||
logicTracker, // its logical volume
|
||||
"Tracker", // its name
|
||||
logicWorld, // its mother volume
|
||||
false, // no boolean operations
|
||||
0); // copy number
|
||||
positionTracker, // at (x,y,z)
|
||||
logicTracker, // its logical volume
|
||||
"Tracker", // its name
|
||||
logicWorld, // its mother volume
|
||||
false, // no boolean operations
|
||||
0); // copy number
|
||||
|
||||
//------------------------------
|
||||
// Tracker segments
|
||||
@@ -193,28 +196,28 @@ G4VPhysicalVolume* ExP01DetectorConstruction::Construct()
|
||||
G4double lastLength = fTrackerLength;
|
||||
|
||||
G4VPVParameterisation* chamberParam = new ExP01ChamberParameterisation(
|
||||
NbOfChambers, // NoChambers
|
||||
firstPosition, // Z of center of first
|
||||
ChamberSpacing, // Z spacing of centers
|
||||
ChamberWidth, // Width Chamber
|
||||
firstLength, // lengthInitial
|
||||
lastLength); // lengthFinal
|
||||
|
||||
NbOfChambers, // NoChambers
|
||||
firstPosition, // Z of center of first
|
||||
ChamberSpacing, // Z spacing of centers
|
||||
ChamberWidth, // Width Chamber
|
||||
firstLength, // lengthInitial
|
||||
lastLength); // lengthFinal
|
||||
|
||||
// dummy value : kZAxis -- modified by parameterised volume
|
||||
//
|
||||
physiChamber = new G4PVParameterised(
|
||||
"Chamber", // their name
|
||||
logicChamber, // their logical volume
|
||||
logicTracker, // Mother logical volume
|
||||
kZAxis, // Are placed along this axis
|
||||
kZAxis, // Are placed along this axis
|
||||
NbOfChambers, // Number of chambers
|
||||
chamberParam); // The parametrisation
|
||||
|
||||
G4cout << "There are " << NbOfChambers << " chambers in the tracker region. "
|
||||
<< "The chambers are " << ChamberWidth/mm << " mm of "
|
||||
<< ChamberMater->GetName() << "\n The distance between chamber is "
|
||||
<< ChamberSpacing/cm << " cm" << G4endl;
|
||||
|
||||
<< ChamberSpacing/cm << " cm" << G4endl;
|
||||
|
||||
//------------------------------------------------
|
||||
// Sensitive detectors
|
||||
//------------------------------------------------
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/src/ExP01DetectorMessenger.cc
|
||||
/// \brief Implementation of the ExP01DetectorMessenger class
|
||||
//
|
||||
// $Id: ExP01DetectorMessenger.cc,v 1.2 2006-06-29 17:39:20 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/src/ExP01EventAction.cc
|
||||
/// \brief Implementation of the ExP01EventAction class
|
||||
//
|
||||
// $Id: ExP01EventAction.cc,v 1.2 2006-06-29 17:39:23 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -70,7 +72,7 @@ void ExP01EventAction::EndOfEventAction(const G4Event* evt)
|
||||
if (event_id < 100 || event_id%100 == 0) {
|
||||
G4cout << ">>> Event " << evt->GetEventID() << G4endl;
|
||||
G4cout << " " << n_trajectories
|
||||
<< " trajectories stored in this event." << G4endl;
|
||||
<< " trajectories stored in this event." << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/src/ExP01MagneticField.cc
|
||||
/// \brief Implementation of the ExP01MagneticField class
|
||||
//
|
||||
// $Id: ExP01MagneticField.cc,v 1.2 2006-06-29 17:39:26 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// User Field class implementation.
|
||||
//
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/src/ExP01PhysicsList.cc
|
||||
/// \brief Implementation of the ExP01PhysicsList class
|
||||
//
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -33,6 +36,7 @@
|
||||
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -193,8 +197,8 @@ void ExP01PhysicsList::ConstructEM()
|
||||
pmanager->AddProcess(new G4MuPairProduction, -1, 4,4);
|
||||
|
||||
} else if ((!particle->IsShortLived()) &&
|
||||
(particle->GetPDGCharge() != 0.0) &&
|
||||
(particle->GetParticleName() != "chargedgeantino")) {
|
||||
(particle->GetPDGCharge() != 0.0) &&
|
||||
(particle->GetParticleName() != "chargedgeantino")) {
|
||||
//all others charged particles except geantino
|
||||
pmanager->AddProcess(new G4hMultipleScattering,-1, 1,1);
|
||||
pmanager->AddProcess(new G4hIonisation, -1, 2,2);
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/src/ExP01PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the ExP01PrimaryGeneratorAction class
|
||||
//
|
||||
// $Id: ExP01PrimaryGeneratorAction.cc,v 1.2 2006-06-29 17:39:32 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -38,6 +40,7 @@
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "globals.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/src/ExP01RunAction.cc
|
||||
/// \brief Implementation of the ExP01RunAction class
|
||||
//
|
||||
// $Id: ExP01RunAction.cc,v 1.2 2006-06-29 17:39:34 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/src/ExP01SteppingAction.cc
|
||||
/// \brief Implementation of the ExP01SteppingAction class
|
||||
//
|
||||
// $Id: ExP01SteppingAction.cc,v 1.2 2006-06-29 17:39:37 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/src/ExP01SteppingVerbose.cc
|
||||
/// \brief Implementation of the ExP01SteppingVerbose class
|
||||
//
|
||||
// $Id: ExP01SteppingVerbose.cc,v 1.2 2006-06-29 17:39:39 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -58,26 +60,26 @@ void ExP01SteppingVerbose::StepInfo()
|
||||
if( verboseLevel >= 3 ){
|
||||
G4cout << G4endl;
|
||||
G4cout << std::setw( 5) << "#Step#" << " "
|
||||
<< std::setw( 6) << "X" << " "
|
||||
<< std::setw( 6) << "Y" << " "
|
||||
<< std::setw( 6) << "Z" << " "
|
||||
<< std::setw( 9) << "KineE" << " "
|
||||
<< std::setw( 9) << "dEStep" << " "
|
||||
<< std::setw(10) << "StepLeng"
|
||||
<< std::setw(10) << "TrakLeng"
|
||||
<< std::setw(10) << "Volume" << " "
|
||||
<< std::setw(10) << "Process" << G4endl;
|
||||
<< std::setw( 6) << "X" << " "
|
||||
<< std::setw( 6) << "Y" << " "
|
||||
<< std::setw( 6) << "Z" << " "
|
||||
<< std::setw( 9) << "KineE" << " "
|
||||
<< std::setw( 9) << "dEStep" << " "
|
||||
<< std::setw(10) << "StepLeng"
|
||||
<< std::setw(10) << "TrakLeng"
|
||||
<< std::setw(10) << "Volume" << " "
|
||||
<< std::setw(10) << "Process" << G4endl;
|
||||
}
|
||||
|
||||
G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " "
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
|
||||
<< std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
|
||||
<< std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
|
||||
<< " ";
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
|
||||
<< std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
|
||||
<< std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
|
||||
<< " ";
|
||||
|
||||
// if( fStepStatus != fWorldBoundary){
|
||||
if( fTrack->GetNextVolume() != 0 ) {
|
||||
@@ -89,7 +91,7 @@ void ExP01SteppingVerbose::StepInfo()
|
||||
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != NULL){
|
||||
G4cout << " "
|
||||
<< std::setw(10) << fStep->GetPostStepPoint()->GetProcessDefinedStep()
|
||||
->GetProcessName();
|
||||
->GetProcessName();
|
||||
} else {
|
||||
G4cout << " UserLimit";
|
||||
}
|
||||
@@ -98,39 +100,39 @@ void ExP01SteppingVerbose::StepInfo()
|
||||
|
||||
if( verboseLevel == 2 ){
|
||||
G4int tN2ndariesTot = fN2ndariesAtRestDoIt +
|
||||
fN2ndariesAlongStepDoIt +
|
||||
fN2ndariesPostStepDoIt;
|
||||
fN2ndariesAlongStepDoIt +
|
||||
fN2ndariesPostStepDoIt;
|
||||
if(tN2ndariesTot>0){
|
||||
G4cout << " :----- List of 2ndaries - "
|
||||
<< "#SpawnInStep=" << std::setw(3) << tN2ndariesTot
|
||||
<< "(Rest=" << std::setw(2) << fN2ndariesAtRestDoIt
|
||||
<< ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
|
||||
<< ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt
|
||||
<< "), "
|
||||
<< "#SpawnTotal=" << std::setw(3) << (*fSecondary).size()
|
||||
<< " ---------------"
|
||||
<< G4endl;
|
||||
G4cout << " :----- List of 2ndaries - "
|
||||
<< "#SpawnInStep=" << std::setw(3) << tN2ndariesTot
|
||||
<< "(Rest=" << std::setw(2) << fN2ndariesAtRestDoIt
|
||||
<< ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
|
||||
<< ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt
|
||||
<< "), "
|
||||
<< "#SpawnTotal=" << std::setw(3) << (*fSecondary).size()
|
||||
<< " ---------------"
|
||||
<< G4endl;
|
||||
|
||||
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
|
||||
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
|
||||
lp1<(*fSecondary).size(); lp1++){
|
||||
G4cout << " : "
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length")
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().y(),"Length")
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().z(),"Length")
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
|
||||
<< std::setw(10)
|
||||
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
|
||||
G4cout << G4endl;
|
||||
}
|
||||
G4cout << " : "
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length")
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().y(),"Length")
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().z(),"Length")
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
|
||||
<< std::setw(10)
|
||||
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
G4cout << " :-----------------------------"
|
||||
<< "----------------------------------"
|
||||
<< "-- EndOf2ndaries Info ---------------"
|
||||
<< G4endl;
|
||||
G4cout << " :-----------------------------"
|
||||
<< "----------------------------------"
|
||||
<< "-- EndOf2ndaries Info ---------------"
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,24 +151,24 @@ G4int prec = G4cout.precision(3);
|
||||
|
||||
G4cout << std::setw( 5) << "Step#" << " "
|
||||
<< std::setw( 6) << "X" << " "
|
||||
<< std::setw( 6) << "Y" << " "
|
||||
<< std::setw( 6) << "Z" << " "
|
||||
<< std::setw( 9) << "KineE" << " "
|
||||
<< std::setw( 9) << "dEStep" << " "
|
||||
<< std::setw(10) << "StepLeng"
|
||||
<< std::setw(10) << "TrakLeng"
|
||||
<< std::setw(10) << "Volume" << " "
|
||||
<< std::setw(10) << "Process" << G4endl;
|
||||
<< std::setw( 6) << "Y" << " "
|
||||
<< std::setw( 6) << "Z" << " "
|
||||
<< std::setw( 9) << "KineE" << " "
|
||||
<< std::setw( 9) << "dEStep" << " "
|
||||
<< std::setw(10) << "StepLeng"
|
||||
<< std::setw(10) << "TrakLeng"
|
||||
<< std::setw(10) << "Volume" << " "
|
||||
<< std::setw(10) << "Process" << G4endl;
|
||||
|
||||
G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " "
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
|
||||
<< std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
|
||||
<< std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
|
||||
<< " ";
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
|
||||
<< std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
|
||||
<< std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
|
||||
<< " ";
|
||||
|
||||
if(fTrack->GetNextVolume()){
|
||||
G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/src/ExP01TrackerHit.cc
|
||||
/// \brief Implementation of the ExP01TrackerHit class
|
||||
//
|
||||
// $Id: ExP01TrackerHit.cc,v 1.2 2006-06-29 17:39:41 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/src/ExP01TrackerSD.cc
|
||||
/// \brief Implementation of the ExP01TrackerSD class
|
||||
//
|
||||
// $Id: ExP01TrackerSD.cc,v 1.3 2010-12-01 14:18:27 witoldp Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -44,8 +46,10 @@
|
||||
ExP01TrackerSD::ExP01TrackerSD(G4String name)
|
||||
:G4VSensitiveDetector(name)
|
||||
{
|
||||
G4String HCname;
|
||||
collectionName.insert(HCname="trackerCollection");
|
||||
G4String HCname = name + "_HC";
|
||||
collectionName.insert(HCname);
|
||||
G4cout << collectionName.size() << " CalorimeterSD name: " << name << " collection Name: " << HCname << G4endl;
|
||||
fHCID = -1;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -59,12 +63,14 @@ ExP01TrackerSD::~ExP01TrackerSD()
|
||||
|
||||
void ExP01TrackerSD::Initialize(G4HCofThisEvent* HCE)
|
||||
{
|
||||
trackerCollection = new ExP01TrackerHitsCollection
|
||||
fTrackerCollection = new ExP01TrackerHitsCollection
|
||||
(SensitiveDetectorName,collectionName[0]);
|
||||
static G4int HCID = -1;
|
||||
if(HCID<0)
|
||||
{ HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); }
|
||||
HCE->AddHitsCollection( HCID, trackerCollection );
|
||||
if (fHCID < 0) {
|
||||
G4cout << "CalorimeterSD::Initialize: " << SensitiveDetectorName << " " << collectionName[0] << G4endl;
|
||||
fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
|
||||
|
||||
}
|
||||
HCE->AddHitsCollection(fHCID, fTrackerCollection);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -81,7 +87,7 @@ G4bool ExP01TrackerSD::ProcessHits(G4Step* aStep,G4TouchableHistory*)
|
||||
->GetReplicaNumber());
|
||||
newHit->SetEdep (edep);
|
||||
newHit->SetPos (aStep->GetPostStepPoint()->GetPosition());
|
||||
trackerCollection->insert( newHit );
|
||||
fTrackerCollection->insert( newHit );
|
||||
|
||||
//newHit->Print();
|
||||
//newHit->Draw();
|
||||
@@ -94,18 +100,18 @@ G4bool ExP01TrackerSD::ProcessHits(G4Step* aStep,G4TouchableHistory*)
|
||||
void ExP01TrackerSD::EndOfEvent(G4HCofThisEvent*)
|
||||
{
|
||||
// storing the hits in ROOT file
|
||||
G4int NbHits = trackerCollection->entries();
|
||||
G4int NbHits = fTrackerCollection->entries();
|
||||
std::vector<ExP01TrackerHit*> hitsVector;
|
||||
|
||||
{
|
||||
G4cout << "\n-------->Storing hits in the ROOT file: in this event there are " << NbHits
|
||||
<< " hits in the tracker chambers: " << G4endl;
|
||||
for (G4int i=0;i<NbHits;i++) (*trackerCollection)[i]->Print();
|
||||
for (G4int i=0;i<NbHits;i++) (*fTrackerCollection)[i]->Print();
|
||||
}
|
||||
|
||||
|
||||
for (G4int i=0;i<NbHits;i++)
|
||||
hitsVector.push_back((*trackerCollection)[i]);
|
||||
hitsVector.push_back((*fTrackerCollection)[i]);
|
||||
|
||||
RootIO::GetInstance()->Write(&hitsVector);
|
||||
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/P01/src/RootIO.cc
|
||||
/// \brief Implementation of the RootIO class
|
||||
//
|
||||
#include <sstream>
|
||||
|
||||
#include "RootIO.hh"
|
||||
@@ -40,11 +43,11 @@ RootIO::RootIO():Nevents(0)
|
||||
{
|
||||
// initialize ROOT
|
||||
TSystem ts;
|
||||
gSystem->Load("libClassesDict");
|
||||
gSystem->Load("libExP01ClassesDict");
|
||||
|
||||
ROOT::Cintex::Cintex::SetDebug(2);
|
||||
ROOT::Cintex::Cintex::SetDebug(0);
|
||||
ROOT::Cintex::Cintex::Enable();
|
||||
gDebug = 1;
|
||||
//gDebug = 1;
|
||||
|
||||
fo = new TFile("hits.root","RECREATE");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user