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,165 @@
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
include(CMakeDependentOption)
set(name ChargeExchangeMC)
project(${name})
# the project requires Geant4 GDML support!
find_package(Geant4 REQUIRED COMPONENTS gdml)
# if CEXMC_USE_TCSH is 'yes' then tcsh session support will be built
option(CEXMC_USE_TCSH
"Build ${name} with tcsh session support
(requires Geant4 tcsh support)" ON)
if(CEXMC_USE_TCSH)
find_package(Geant4 COMPONENTS ui_tcsh)
if(NOT Geant4_ui_tcsh_FOUND)
message(WARNING
"Could not find Geant4 tcsh binding, skip tcsh session support")
endif()
endif()
# if CEXMC_USE_GUI is 'yes' then GUI session support will be built
option(CEXMC_USE_GUI
"Build ${name} with GUI session support
(requires Geant4 Qt backend)" ON)
if(CEXMC_USE_GUI)
find_package(Geant4 COMPONENTS qt)
if(NOT Geant4_qt_FOUND)
message(WARNING
"Could not find Geant4 Qt backend, skip GUI session support")
endif()
endif()
include(${Geant4_USE_FILE})
set(EXTRA_LIBRARIES )
# if CEXMC_USE_PERSISTENCY is 'yes' then run and events data can be read and
# written; requires boost::serialize headers and library
option(CEXMC_USE_PERSISTENCY
"Build ${name} with data persistency support
(requires Boost Serialization library)" ON)
if(CEXMC_USE_PERSISTENCY)
find_package(Boost COMPONENTS serialization)
if(Boost_SERIALIZATION_FOUND)
add_definitions(-DCEXMC_USE_PERSISTENCY)
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
list(APPEND EXTRA_LIBRARIES ${Boost_LIBRARIES})
message(STATUS
"Library ${Boost_LIBRARIES} was added to the linkage list")
else()
message(WARNING
"Could not find Boost Serialization library, "
"skip data persistency support")
endif()
endif()
# if CEXMC_USE_CUSTOM_FILTER is 'yes' then Custom filter can be used for
# existing events data; requires boost::spirit 2.x headers. Notice: if
# CEXMC_USE_PERSISTENCY is not 'yes' then Custom Filter will not be used anyway
cmake_dependent_option(CEXMC_USE_CUSTOM_FILTER
"Build ${name} with custom filter support
(requires Boost Spirit library)" OFF
"CEXMC_USE_PERSISTENCY" OFF)
if(CEXMC_USE_CUSTOM_FILTER)
add_definitions(-DCEXMC_USE_CUSTOM_FILTER)
endif()
# if CEXMC_DEBUG_CUSTOM_FILTER is 'yes' then AST trees will be printed out
cmake_dependent_option(CEXMC_DEBUG_CUSTOM_FILTER
"Debug custom filter" OFF
"CEXMC_USE_CUSTOM_FILTER" OFF)
if(CEXMC_USE_CUSTOM_FILTER)
add_definitions(-DCEXMC_DEBUG_CF)
endif()
# if CEXMC_USE_QGSP_BIC_EMY is 'yes' then QGSP_BIC_EMY will be used as basic
# physics, otherwise - QGSP_BERT
option(CEXMC_USE_QGSP_BIC_EMY
"Build ${name} with QGSP_BIC_EMY physics list
(default physics list is QGSP_BERT)" OFF)
if(CEXMC_USE_QGSP_BIC_EMY)
add_definitions(-DCEXMC_USE_QGSP_BIC_EMY)
endif()
# if CEXMC_DEBUG_TP is 'yes' then additional info will be printed on track
# points data
option(CEXMC_DEBUG_TP
"Print debug information for track points" OFF)
if(CEXMC_DEBUG_TP)
add_definitions(-DCEXMC_DEBUG_TP)
endif()
# if CEXMC_USE_HISTOGRAMING is 'yes' then ROOT histograming framework will be
# compiled. Notice: if ROOT CERN is not installed in your system then the
# histograming module won't compile anyway
option(CEXMC_USE_HISTOGRAMING
"Build ${name} with histograming support
(requires CERN ROOT libraries)" ON)
if(CEXMC_USE_HISTOGRAMING)
find_package(ROOT QUIET)
if(ROOT_FOUND)
add_definitions(-DCEXMC_USE_ROOT)
include_directories(${ROOT_INCLUDE_DIR})
list(APPEND EXTRA_LIBRARIES ${ROOT_LIBRARIES})
message(STATUS
"Libraries ${ROOT_LIBRARIES} were added to the linkage list")
else()
message(WARNING
"Could not find ROOT package, skip histograming support")
endif()
endif()
# if CEXMC_USE_ROOTQT is 'yes' then it will be possible to see ROOT histograms
# in GUI session mode
cmake_dependent_option(CEXMC_USE_ROOTQT
"Build ${name} with GUI histograming support
(requires CERN ROOT Qt binding)" ON
"CEXMC_USE_HISTOGRAMING" OFF)
if(CEXMC_USE_ROOTQT AND ROOT_FOUND)
find_library(ROOTQT_LIBRARY GQt
PATHS ${ROOT_LIBRARY_DIR} ${ROOT_LIBRARY_DIR}/root
NO_DEFAULT_PATH)
if(ROOTQT_LIBRARY)
add_definitions(-DCEXMC_USE_ROOTQT)
list(APPEND EXTRA_LIBRARIES -lGQt)
message(STATUS "Library -lGQt was added to the linkage list")
else()
message(WARNING
"Could not find ROOT Qt library, skip GUI histograming support")
endif()
endif()
# if CEXMC_USE_GENBOD is 'yes' then original FORTRAN routine GENBOD() will be
# used as phase space generator
option(CEXMC_USE_GENBOD
"Link ${name} with original FORTRAN function GENBOD()
(by default C++ reimplementation of GENBOD() is used)" OFF)
if(CEXMC_USE_GENBOD)
find_program(CERNLIB_CONFIG_EXE cernlib
PATHS $ENV{CERN_ROOT}/bin)
if(CERNLIB_CONFIG_EXE)
execute_process(
COMMAND ${CERNLIB_CONFIG_EXE} geant321 phtools packlib kernlib
OUTPUT_VARIABLE CERNLIB_LIBRARIES
OUTPUT_STRIP_TRAILING_WHITESPACE)
add_definitions(-DCEXMC_USE_GENBOD)
list(APPEND EXTRA_LIBRARIES ${CERNLIB_LIBRARIES})
message(STATUS
"Libraries ${CERNLIB_LIBRARIES} were added to the linkage list")
else()
message(WARNING
"Could not find cernlib, skip original FORTRAN GENBOD() support")
endif()
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${Geant4_INCLUDE_DIR})
file(GLOB sources ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc)
add_executable(${name} EXCLUDE_FROM_ALL ${name}.cc ${sources})
target_link_libraries(${name} ${Geant4_LIBRARIES} ${EXTRA_LIBRARIES})
@@ -6,7 +6,7 @@ CPPFLAGS += -DCEXMC_PROG_NAME=\"$(name)\"
# if CEXMC_USE_PERSISTENCY is 'yes' then run and events data can be read and
# written; requires boost::serialize headers and library
CEXMC_USE_PERSISTENCY := yes
CEXMC_USE_PERSISTENCY := no
# if CEXMC_USE_CUSTOM_FILTER is 'yes' then Custom filter can be used for
# existing events data; requires boost::spirit 2.x headers. Notice: if
# CEXMC_USE_PERSISTENCY is not 'yes' then Custom Filter will not be used anyway
@@ -7,6 +7,26 @@ cirrone@lns.infn.it
History file of the ChargeExchangeMC application
====================================================
02.11.2012 - L.Garnier Tag: ChargeExchangeMC-V09-05-05
- Add "File" menu in gui.mac, Fix bug #1395
02.11.2012 - L.Garnier Tag: ChargeExchangeMC-V09-05-04
- Add icons.mac
25.10.2012, L.Pandola & A.Radkov, Tag: ChargeExchangeMC-V09-05-03
- Fix the CMakeLists.txt file to make Qt optional
18.10.2012, L.Pandola & A.Radkov, Tag: ChargeExchangeMC-V09-05-02
- Add the CMakeLists.txt file (first version, to be checked)
17.10.2012, L.Pandola & A.Radkov, Tag: ChargeExchangeMC-V09-05-01
- Fix to compile the code against Geant4 9.6
- Edit GNUmakefile such that the default version does not
depend on boost
11.10.2012, G.Cosmo, Tag: ChargeExchangeMC-V09-05-00
- Explicit inclusion of units and constants headers.
01.11.2011, G.A.P.Cirrone & A.Radkov, Tag: ChargeExchangeMC-V09-04-05
- Header files added.
@@ -51,7 +51,6 @@
#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/spirit/include/phoenix_function.hpp>
#include <boost/spirit/include/phoenix_fusion.hpp>
#include "CexmcAST.hh"
@@ -66,6 +65,7 @@ namespace CexmcCustomFilter
using boost::spirit::ascii::space_type;
using boost::spirit::ascii::alpha;
using boost::spirit::ascii::alnum;
using boost::spirit::unused_type;
enum Action
@@ -97,9 +97,8 @@ namespace CexmcCustomFilter
struct Compiler
{
template < typename A, typename B = boost::fusion::unused_type,
typename C = boost::fusion::unused_type,
typename D = boost::fusion::unused_type >
template < typename A, typename B = unused_type,
typename C = unused_type, typename D = unused_type >
struct result { typedef void type; };
void operator()( ParseResult & parseResult, Action value ) const;
@@ -192,7 +191,7 @@ namespace CexmcCustomFilter
expression %= or_expr;
identifier %= lexeme[ alpha >> *( alnum | lit( '_' ) ) ];
identifier %= raw[ lexeme[ alpha >> *( alnum | '_' ) ] ];
primary_expr = function1[ _val = _1 ] |
lit( '(' ) >> expression[ op( _val, _1 ) ] >> lit( ')' ) |
@@ -45,6 +45,8 @@
#define CEXMC_ENERGY_DEPOSIT_DIGITIZER_HH
#include <iosfwd>
#include <CLHEP/Units/SystemOfUnits.h>
#include <G4VDigitizerModule.hh>
#include "CexmcEnergyDepositStore.hh"
#include "CexmcSimpleRangeWithValue.hh"
@@ -478,7 +480,7 @@ inline void CexmcEnergyDepositDigitizer::AddCrystalResolutionRange(
/* range boundaries are given in GeV */
crystalResolutionData.push_back( CexmcEnergyRangeWithDoubleValue(
bottom * GeV, top * GeV, value ) );
bottom * CLHEP::GeV, top * CLHEP::GeV, value ) );
}
@@ -1,3 +1,8 @@
# File menu :
/gui/addMenu file File
/gui/addButton file Quit exit
# Run menu :
/gui/addMenu run Run
/gui/addButton run "Collect all events" "/control/execute mac/setup_all_events.mac"
/gui/addButton run "Collect interaction events" "/control/execute mac/setup_interaction_events.mac"
@@ -7,6 +12,7 @@
/gui/addButton run "Run 10 events" "/run/beamOn 10"
/gui/addButton run "Run 100 events" "/run/beamOn 100"
# Viewer menu :
/gui/addMenu viewer Viewer
/gui/addButton viewer "Draw world" "/control/execute mac/visQt.mac"
#/gui/addButton viewer "Draw world (OI)" "/control/execute mac/visOI.mac"
@@ -15,3 +21,6 @@
/gui/addButton viewer "Highlight inner crystals" "/cexmc/vis/hlIC"
/gui/addButton viewer "Unhighlight inner crystals" "/cexmc/vis/hlIC false"
/gui/addButton viewer "Update scene" "/vis/scene/notifyHandlers"
#Add an icon toolbar
/control/execute mac/icons.mac
@@ -0,0 +1,28 @@
#
# This file permits to customize, with commands,
# the icon menu bar of the G4UIQt sessions not yet implemented other UI drivers (geant4-09-05-ref-09)
# It has no effect with G4UIterminal.
# open/save icons
/gui/addIcon "Open macro file" open /control/execute
/gui/addIcon "Save viewer state" save /vis/viewer/save
# Cursors style icons
/gui/addIcon "Move" move
/gui/addIcon "Pick" pick
/gui/addIcon "Zoom out" zoom_out
/gui/addIcon "Zoom in" zoom_in
/gui/addIcon "Rotate" rotate
# Surface Style icons
/gui/addIcon "Hidden line removal" hidden_line_removal
/gui/addIcon "Hidden line removal" hidden_line_and_surface_removal
/gui/addIcon "Hidden line removal" solid
/gui/addIcon "Hidden line removal" wireframe
# Perspective/Ortho icons
/gui/addIcon "Perspective" perspective
/gui/addIcon "Orthographic" ortho
# user define icon (example)
#/gui/addIcon "Change background color" user_icon /vis/viewer/set/background my_picture.jpg
@@ -60,6 +60,8 @@ CexmcCustomFilterEval::CexmcCustomFilterEval( const G4String & sourceFileName,
if ( ! sourceFile )
throw CexmcException( CexmcCFBadSource );
bool commandIsPending( false );
while ( ! sourceFile.eof() )
{
std::string line;
@@ -69,62 +71,75 @@ CexmcCustomFilterEval::CexmcCustomFilterEval( const G4String & sourceFileName,
if ( commentStartPos != std::string::npos )
line.erase( commentStartPos );
command += line;
if ( ! command.empty() )
if ( line.empty() ||
line.find_first_not_of( " \t" ) == std::string::npos )
{
size_t length( command.length() );
if ( command[ length - 1 ] == '\\' )
{
command.erase( length - 1 );
continue;
}
CexmcCustomFilter::ParseResult curParseResult;
std::string::const_iterator begin( command.begin() );
std::string::const_iterator end( command.end() );
try
{
if ( ! CexmcCustomFilter::phrase_parse( begin, end, grammar,
CexmcCustomFilter::space, curParseResult ) ||
begin != end )
{
throw CexmcException( CexmcCFParseError );
}
}
catch ( ... )
if ( commandIsPending )
{
sourceFile.close();
throw;
throw CexmcException( CexmcCFParseError );
}
continue;
}
command += line;
size_t length( command.length() );
if ( command[ length - 1 ] == '\\' )
{
command.erase( length - 1 );
commandIsPending = true;
continue;
}
CexmcCustomFilter::ParseResult curParseResult;
std::string::const_iterator begin( command.begin() );
std::string::const_iterator end( command.end() );
try
{
if ( ! CexmcCustomFilter::phrase_parse( begin, end, grammar,
CexmcCustomFilter::space, curParseResult ) ||
begin != end )
{
throw CexmcException( CexmcCFParseError );
}
}
catch ( ... )
{
sourceFile.close();
throw;
}
#ifdef CEXMC_DEBUG_CF
G4cout << "Parsed expression AST:" << G4endl;
curParseResult.expression.Print();
G4cout << "Parsed expression AST:" << G4endl;
curParseResult.expression.Print();
#endif
switch ( curParseResult.action )
{
case CexmcCustomFilter::KeepTPT :
case CexmcCustomFilter::DeleteTPT :
parseResultTPT.push_back( curParseResult );
break;
case CexmcCustomFilter::KeepEDT :
case CexmcCustomFilter::DeleteEDT :
parseResultEDT.push_back( curParseResult );
break;
default :
break;
}
switch ( curParseResult.action )
{
case CexmcCustomFilter::KeepTPT :
case CexmcCustomFilter::DeleteTPT :
parseResultTPT.push_back( curParseResult );
break;
case CexmcCustomFilter::KeepEDT :
case CexmcCustomFilter::DeleteEDT :
parseResultEDT.push_back( curParseResult );
break;
default :
break;
}
command = "";
commandIsPending = false;
}
sourceFile.close();
if ( commandIsPending )
throw CexmcException( CexmcCFParseError );
}
@@ -72,8 +72,6 @@
#include "CexmcException.hh"
#include "CexmcHistoWidget.hh"
extern TDirectory * gDirectory;
namespace
{
@@ -45,6 +45,7 @@
#include <cmath>
#include <Randomize.hh>
#include <G4PhysicalConstants.hh>
#include <G4SystemOfUnits.hh>
#include "CexmcReimplementedGenbod.hh"
#include "CexmcException.hh"
@@ -63,6 +63,7 @@
#include <G4VisManager.hh>
#include <G4Scene.hh>
#include <G4VModel.hh>
#include <G4Version.hh>
#include "CexmcRunManager.hh"
#include "CexmcRunManagerMessenger.hh"
#include "CexmcRunAction.hh"
@@ -857,7 +858,7 @@ void CexmcRunManager::SaveCurrentTPTEvent(
const CexmcAngularRangeList & angularRanges,
G4bool writeToDatabase )
{
CexmcRun * run( static_cast< const CexmcRun * >( currentRun ) );
CexmcRun * run( static_cast< CexmcRun * >( currentRun ) );
if ( ! run )
return;
@@ -1315,12 +1316,21 @@ void CexmcRunManager::RegisterScenePrimitives( void )
return;
/* G4Scene declarations lack this kind of typedef */
typedef std::vector< G4VModel * > MList;
#if G4VERSION_NUMBER < 960
typedef std::vector< G4VModel * > MList;
#else
typedef std::vector< G4Scene::Model > MList;
#endif
const MList & mList( curScene->GetRunDurationModelList() );
for ( MList::const_iterator k( mList.begin() ); k != mList.end(); ++k )
{
if ( ( *k )->GetGlobalDescription() == CexmcScenePrimitivesDescription )
#if G4VERSION_NUMBER < 960
const G4String & modelDesc( ( *k )->GetGlobalDescription() );
#else
const G4String & modelDesc( k->fpModel->GetGlobalDescription() );
#endif
if ( modelDesc == CexmcScenePrimitivesDescription )
return;
}
@@ -42,6 +42,7 @@
*/
#include <cmath>
#include <G4SystemOfUnits.hh>
#include <G4Polyline.hh>
#include <G4Circle.hh>
#include <G4Polyhedron.hh>