Add option to output detector description as GDML #1
@@ -68,23 +68,6 @@ add_executable(musrSim musrSim.cc ${sources} ${headers})
|
||||
#EchoString("Kamil ${root_flags} Kamil")
|
||||
#target_link_libraries(musrSim ${Geant4_LIBRARIES} ${root_flags})
|
||||
target_link_libraries(musrSim ${Geant4_LIBRARIES} ${ROOT_LIBRARIES})
|
||||
#----------------------------------------------------------------------------
|
||||
# Copy all scripts to the build directory, i.e. the directory in which we
|
||||
# build B1. This is so that we can run the executable directly because it
|
||||
# relies on these scripts being in the current working directory.
|
||||
#
|
||||
set(EXAMPLEB1_SCRIPTS
|
||||
run/101.mac
|
||||
run/102.mac
|
||||
)
|
||||
|
||||
foreach(_script ${EXAMPLEB1_SCRIPTS})
|
||||
configure_file(
|
||||
${PROJECT_SOURCE_DIR}/${_script}
|
||||
${PROJECT_BINARY_DIR}/${_script}
|
||||
COPYONLY
|
||||
)
|
||||
endforeach()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# For internal Geant4 use - but has no effect if you build this
|
||||
|
||||
+240
-243
@@ -1,269 +1,266 @@
|
||||
# - Find ROOT instalation
|
||||
# This module tries to find the ROOT installation on your system.
|
||||
# It tries to find the root-config script which gives you all the needed information.
|
||||
# If the system variable ROOTSYS is set this is straight forward.
|
||||
# If not the module uses the pathes given in ROOT_CONFIG_SEARCHPATH.
|
||||
# If you need an other path you should add this path to this varaible.
|
||||
# The root-config script is then used to detect basically everything else.
|
||||
# This module defines a number of key variables and macros.
|
||||
# - Finds ROOT instalation
|
||||
# This module sets up ROOT information
|
||||
# It defines:
|
||||
# ROOT_FOUND If the ROOT is found
|
||||
# ROOT_INCLUDE_DIR PATH to the include directory
|
||||
# ROOT_INCLUDE_DIRS PATH to the include directories (not cached)
|
||||
# ROOT_LIBRARIES Most common libraries
|
||||
# ROOT_<name>_LIBRARY Full path to the library <name>
|
||||
# ROOT_LIBRARY_DIR PATH to the library directory
|
||||
# ROOT_DEFINITIONS Compiler definitions and flags
|
||||
# ROOT_LINK_FLAGS Linker flags
|
||||
#
|
||||
# The modern CMake 3 imported targets are also created:
|
||||
# ROOT::Libraries (Most common libraries)
|
||||
# ROOT::<name> (The library with name)
|
||||
#
|
||||
# Updated by K. Smith (ksmith37@nd.edu) to properly handle
|
||||
# dependencies in ROOT_GENERATE_DICTIONARY
|
||||
# Updated by H. Schreiner (hschrein@cern.ch) to support CMake 3 syntax
|
||||
|
||||
# F.Uhlig@gsi.de (fairroot.gsi.de)
|
||||
find_program(ROOT_CONFIG_EXECUTABLE root-config
|
||||
PATHS $ENV{ROOTSYS}/bin)
|
||||
|
||||
if(ROOT_CONFIG_EXECUTABLE)
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --prefix
|
||||
OUTPUT_VARIABLE ROOTSYS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
MESSAGE(STATUS "Looking for Root...")
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --version
|
||||
OUTPUT_VARIABLE ROOT_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
SET(ROOT_CONFIG_SEARCHPATH
|
||||
${SIMPATH}/tools/root/bin
|
||||
$ENV{ROOTSYS}/bin
|
||||
)
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --incdir
|
||||
OUTPUT_VARIABLE ROOT_INCLUDE_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
set(ROOT_INCLUDE_DIRS ${ROOT_INCLUDE_DIR})
|
||||
|
||||
SET(ROOT_DEFINITIONS "")
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --libdir
|
||||
OUTPUT_VARIABLE ROOT_LIBRARY_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
set(ROOT_LIBRARY_DIRS ${ROOT_LIBRARY_DIR})
|
||||
|
||||
SET(ROOT_INSTALLED_VERSION_TOO_OLD FALSE)
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --cflags
|
||||
OUTPUT_VARIABLE ROOT_DEFINITIONS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REGEX REPLACE "(^|[ ]*)-I[^ ]*" "" ROOT_DEFINITIONS ${ROOT_DEFINITIONS})
|
||||
set(ROOT_DEF_LIST ${ROOT_DEFINITIONS})
|
||||
separate_arguments(ROOT_DEF_LIST)
|
||||
|
||||
SET(ROOT_CONFIG_EXECUTABLE ROOT_CONFIG_EXECUTABLE-NOTFOUND)
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --ldflags
|
||||
OUTPUT_VARIABLE ROOT_LINK_FLAGS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
set(ROOT_LINK_LIST ${ROOT_LINK_FLAGS})
|
||||
separate_arguments(ROOT_LINK_LIST)
|
||||
|
||||
FIND_PROGRAM(ROOT_CONFIG_EXECUTABLE NAMES root-config PATHS
|
||||
${ROOT_CONFIG_SEARCHPATH}
|
||||
NO_DEFAULT_PATH)
|
||||
# Needed because ROOT on Mac does not use Mac conventions
|
||||
set(CMAKE_SHARED_LIBRARY_SUFFIX .so)
|
||||
|
||||
file(GLOB ROOT_LIBFILELIST
|
||||
LIST_DIRECTORIES false
|
||||
RELATIVE "${ROOT_LIBRARY_DIR}"
|
||||
"${ROOT_LIBRARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}*${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
|
||||
IF (${ROOT_CONFIG_EXECUTABLE} MATCHES "ROOT_CONFIG_EXECUTABLE-NOTFOUND")
|
||||
MESSAGE( FATAL_ERROR "ROOT not installed in the searchpath and ROOTSYS is not set. Please
|
||||
set ROOTSYS or add the path to your ROOT installation in the Macro FindROOT.cmake in the
|
||||
subdirectory cmake/modules.")
|
||||
ELSE (${ROOT_CONFIG_EXECUTABLE} MATCHES "ROOT_CONFIG_EXECUTABLE-NOTFOUND")
|
||||
STRING(REGEX REPLACE "(^.*)/bin/root-config" "\\1" test ${ROOT_CONFIG_EXECUTABLE})
|
||||
SET( ENV{ROOTSYS} ${test})
|
||||
set( ROOTSYS ${test})
|
||||
ENDIF (${ROOT_CONFIG_EXECUTABLE} MATCHES "ROOT_CONFIG_EXECUTABLE-NOTFOUND")
|
||||
if(NOT ROOT_LIBFILELIST)
|
||||
message(FATAL_ERROR "ROOT libraries not found at ${ROOT_LIBRARY_DIR}")
|
||||
endif()
|
||||
|
||||
|
||||
IF (ROOT_CONFIG_EXECUTABLE)
|
||||
|
||||
SET(ROOT_FOUND FALSE)
|
||||
set(ROOT_ALLLIBS "")
|
||||
foreach(_file ${ROOT_LIBFILELIST})
|
||||
string(REGEX REPLACE "^${CMAKE_SHARED_LIBRARY_PREFIX}" "" _newer ${_file})
|
||||
string(REGEX REPLACE "${CMAKE_SHARED_LIBRARY_SUFFIX}$" "" _newest ${_newer})
|
||||
list(APPEND ROOT_ALLLIBS ${_newest})
|
||||
endforeach()
|
||||
|
||||
EXEC_PROGRAM(${ROOT_CONFIG_EXECUTABLE} ARGS "--version" OUTPUT_VARIABLE ROOTVERSION)
|
||||
set(ROOT_CORELIBS Core RIO Net Hist Graf Graf3d Gpad Tree Rint Postscript Matrix Physics MathCore Thread MultiProc)
|
||||
|
||||
MESSAGE(STATUS "Looking for Root... - found $ENV{ROOTSYS}/bin/root")
|
||||
MESSAGE(STATUS "Looking for Root... - version ${ROOTVERSION} ")
|
||||
add_library(ROOT::Libraries INTERFACE IMPORTED)
|
||||
|
||||
# we need at least version 5.00/00
|
||||
IF (NOT ROOT_MIN_VERSION)
|
||||
SET(ROOT_MIN_VERSION "5.00/00")
|
||||
ENDIF (NOT ROOT_MIN_VERSION)
|
||||
|
||||
# now parse the parts of the user given version string into variables
|
||||
STRING(REGEX REPLACE "^([0-9]+)\\.[0-9][0-9]+\\/[0-9][0-9]+" "\\1" req_root_major_vers "${ROOT_MIN_VERSION}")
|
||||
STRING(REGEX REPLACE "^[0-9]+\\.([0-9][0-9])+\\/[0-9][0-9]+.*" "\\1" req_root_minor_vers "${ROOT_MIN_VERSION}")
|
||||
STRING(REGEX REPLACE "^[0-9]+\\.[0-9][0-9]+\\/([0-9][0-9]+)" "\\1" req_root_patch_vers "${ROOT_MIN_VERSION}")
|
||||
|
||||
# and now the version string given by qmake
|
||||
STRING(REGEX REPLACE "^([0-9]+)\\.[0-9][0-9]+\\/[0-9][0-9]+.*" "\\1" found_root_major_vers "${ROOTVERSION}")
|
||||
STRING(REGEX REPLACE "^[0-9]+\\.([0-9][0-9])+\\/[0-9][0-9]+.*" "\\1" found_root_minor_vers "${ROOTVERSION}")
|
||||
STRING(REGEX REPLACE "^[0-9]+\\.[0-9][0-9]+\\/([0-9][0-9]+).*" "\\1" found_root_patch_vers "${ROOTVERSION}")
|
||||
set(ROOT_LIBRARIES)
|
||||
foreach(_cpt ${ROOT_ALLLIBS})
|
||||
find_library(ROOT_${_cpt}_LIBRARY ${_cpt} HINTS ${ROOT_LIBRARY_DIR})
|
||||
if(ROOT_${_cpt}_LIBRARY)
|
||||
mark_as_advanced(ROOT_${_cpt}_LIBRARY)
|
||||
add_library(ROOT::${_cpt} SHARED IMPORTED)
|
||||
set_target_properties(ROOT::${_cpt} PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${ROOT_INCLUDE_DIRS}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
IMPORTED_LOCATION "${ROOT_${_cpt}_LIBRARY}"
|
||||
INTERFACE_COMPILE_OPTIONS "$<$<BUILD_INTERFACE:$<COMPILE_LANGUAGE:CXX>>:${ROOT_DEF_LIST}>"
|
||||
INTERFACE_LINK_LIBRARIES "${ROOT_LINK_LIST}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
IF (found_root_major_vers LESS 5)
|
||||
MESSAGE( FATAL_ERROR "Invalid ROOT version \"${ROOTERSION}\", at least major version 4 is required, e.g. \"5.00/00\"")
|
||||
ENDIF (found_root_major_vers LESS 5)
|
||||
set(targetlist)
|
||||
foreach(_cpt ${ROOT_CORELIBS} ${ROOT_FIND_COMPONENTS})
|
||||
if(ROOT_${_cpt}_LIBRARY)
|
||||
list(APPEND ROOT_LIBRARIES "${ROOT_${_cpt}_LIBRARY}")
|
||||
list(REMOVE_ITEM ROOT_FIND_COMPONENTS ${_cpt})
|
||||
list(APPEND targetlist ROOT::${_cpt})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# compute an overall version number which can be compared at once
|
||||
MATH(EXPR req_vers "${req_root_major_vers}*10000 + ${req_root_minor_vers}*100 + ${req_root_patch_vers}")
|
||||
MATH(EXPR found_vers "${found_root_major_vers}*10000 + ${found_root_minor_vers}*100 + ${found_root_patch_vers}")
|
||||
|
||||
IF (found_vers LESS req_vers)
|
||||
SET(ROOT_FOUND FALSE)
|
||||
SET(ROOT_INSTALLED_VERSION_TOO_OLD TRUE)
|
||||
ELSE (found_vers LESS req_vers)
|
||||
SET(ROOT_FOUND TRUE)
|
||||
ENDIF (found_vers LESS req_vers)
|
||||
set_target_properties(ROOT::Libraries PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${ROOT_INCLUDE_DIRS}")
|
||||
set_target_properties(ROOT::Libraries PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES "${targetlist}")
|
||||
unset(targetlist)
|
||||
|
||||
ENDIF (ROOT_CONFIG_EXECUTABLE)
|
||||
list(REMOVE_DUPLICATES ROOT_LIBRARIES)
|
||||
|
||||
|
||||
IF (ROOT_FOUND)
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --features
|
||||
OUTPUT_VARIABLE _root_options
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
foreach(_opt ${_root_options})
|
||||
set(ROOT_${_opt}_FOUND TRUE)
|
||||
endforeach()
|
||||
endif()
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(ROOT DEFAULT_MSG ROOT_CONFIG_EXECUTABLE
|
||||
ROOTSYS ROOT_VERSION ROOT_INCLUDE_DIR ROOT_LIBRARIES ROOT_LIBRARY_DIR)
|
||||
|
||||
# ask root-config for the library dir
|
||||
# Set ROOT_LIBRARY_DIR
|
||||
mark_as_advanced(ROOT_CONFIG_EXECUTABLE)
|
||||
|
||||
EXEC_PROGRAM( ${ROOT_CONFIG_EXECUTABLE}
|
||||
ARGS "--libdir"
|
||||
OUTPUT_VARIABLE ROOT_LIBRARY_DIR_TMP )
|
||||
include(CMakeParseArguments)
|
||||
find_program(ROOTCINT_EXECUTABLE rootcint PATHS $ENV{ROOTSYS}/bin)
|
||||
find_program(GENREFLEX_EXECUTABLE genreflex PATHS $ENV{ROOTSYS}/bin)
|
||||
find_package(GCCXML)
|
||||
|
||||
IF(EXISTS "${ROOT_LIBRARY_DIR_TMP}")
|
||||
SET(ROOT_LIBRARY_DIR ${ROOT_LIBRARY_DIR_TMP} )
|
||||
ELSE(EXISTS "${ROOT_LIBRARY_DIR_TMP}")
|
||||
MESSAGE("Warning: ROOT_CONFIG_EXECUTABLE reported ${ROOT_LIBRARY_DIR_TMP} as library path,")
|
||||
MESSAGE("Warning: but ${ROOT_LIBRARY_DIR_TMP} does NOT exist, ROOT must NOT be installed correctly.")
|
||||
ENDIF(EXISTS "${ROOT_LIBRARY_DIR_TMP}")
|
||||
|
||||
# ask root-config for the binary dir
|
||||
EXEC_PROGRAM(${ROOT_CONFIG_EXECUTABLE}
|
||||
ARGS "--bindir"
|
||||
OUTPUT_VARIABLE root_bins )
|
||||
SET(ROOT_BINARY_DIR ${root_bins})
|
||||
if(EXISTS "$ENV{ROOTSYS}/cmake/modules/RootNewMacros.cmake")
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} $ENV{ROOTSYS}/cmake/modules)
|
||||
include(RootNewMacros)
|
||||
elseif(EXISTS "${ROOTSYS}/cmake/modules/RootNewMacros.cmake")
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ROOTSYS}/cmake/modules)
|
||||
include(RootNewMacros)
|
||||
else()
|
||||
#----------------------------------------------------------------------------
|
||||
# function ROOT_GENERATE_DICTIONARY( dictionary
|
||||
# header1 header2 ...
|
||||
# LINKDEF linkdef1 ...
|
||||
# OPTIONS opt1...)
|
||||
function(ROOT_GENERATE_DICTIONARY dictionary)
|
||||
CMAKE_PARSE_ARGUMENTS(ARG "" "" "LINKDEF;OPTIONS" "" ${ARGN})
|
||||
#---Get the list of include directories------------------
|
||||
get_directory_property(incdirs INCLUDE_DIRECTORIES)
|
||||
set(includedirs)
|
||||
foreach( d ${incdirs})
|
||||
set(includedirs ${includedirs} -I${d})
|
||||
endforeach()
|
||||
#---Get the list of header files-------------------------
|
||||
set(headerfiles)
|
||||
foreach(fp ${ARG_UNPARSED_ARGUMENTS})
|
||||
if(${fp} MATCHES "[*?]") # Is this header a globbing expression?
|
||||
file(GLOB files ${fp})
|
||||
foreach(f ${files})
|
||||
if(NOT f MATCHES LinkDef) # skip LinkDefs from globbing result
|
||||
set(headerfiles ${headerfiles} ${f})
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
find_file(headerFile ${fp} PATHS ${incdirs})
|
||||
set(headerfiles ${headerfiles} ${headerFile})
|
||||
unset(headerFile CACHE)
|
||||
endif()
|
||||
endforeach()
|
||||
#---Get LinkDef.h file------------------------------------
|
||||
set(linkdefs)
|
||||
foreach( f ${ARG_LINKDEF})
|
||||
find_file(linkFile ${f} PATHS ${incdirs})
|
||||
set(linkdefs ${linkdefs} ${linkFile})
|
||||
unset(linkFile CACHE)
|
||||
endforeach()
|
||||
#---call rootcint------------------------------------------
|
||||
add_custom_command(OUTPUT ${dictionary}.cxx ${dictionary}.h
|
||||
COMMAND ${ROOTCINT_EXECUTABLE} -cint -f ${dictionary}.cxx
|
||||
-c ${ARG_OPTIONS} ${includedirs} ${headerfiles} ${linkdefs}
|
||||
DEPENDS ${headerfiles} ${linkdefs} VERBATIM)
|
||||
endfunction()
|
||||
|
||||
# ask root-config for the include dir
|
||||
EXEC_PROGRAM( ${ROOT_CONFIG_EXECUTABLE}
|
||||
ARGS "--incdir"
|
||||
OUTPUT_VARIABLE root_headers )
|
||||
SET(ROOT_INCLUDE_DIR ${root_headers})
|
||||
# CACHE INTERNAL "")
|
||||
#----------------------------------------------------------------------------
|
||||
# function REFLEX_GENERATE_DICTIONARY(dictionary
|
||||
# header1 header2 ...
|
||||
# SELECTION selectionfile ...
|
||||
# OPTIONS opt1...)
|
||||
function(REFLEX_GENERATE_DICTIONARY dictionary)
|
||||
CMAKE_PARSE_ARGUMENTS(ARG "" "" "SELECTION;OPTIONS" "" ${ARGN})
|
||||
#---Get the list of header files-------------------------
|
||||
set(headerfiles)
|
||||
foreach(fp ${ARG_UNPARSED_ARGUMENTS})
|
||||
file(GLOB files ${fp})
|
||||
if(files)
|
||||
foreach(f ${files})
|
||||
set(headerfiles ${headerfiles} ${f})
|
||||
endforeach()
|
||||
else()
|
||||
set(headerfiles ${headerfiles} ${fp})
|
||||
endif()
|
||||
endforeach()
|
||||
#---Get Selection file------------------------------------
|
||||
if(IS_ABSOLUTE ${ARG_SELECTION})
|
||||
set(selectionfile ${ARG_SELECTION})
|
||||
else()
|
||||
set(selectionfile ${CMAKE_CURRENT_SOURCE_DIR}/${ARG_SELECTION})
|
||||
endif()
|
||||
#---Get the list of include directories------------------
|
||||
get_directory_property(incdirs INCLUDE_DIRECTORIES)
|
||||
set(includedirs)
|
||||
foreach( d ${incdirs})
|
||||
set(includedirs ${includedirs} -I${d})
|
||||
endforeach()
|
||||
#---Get preprocessor definitions--------------------------
|
||||
get_directory_property(defs COMPILE_DEFINITIONS)
|
||||
foreach( d ${defs})
|
||||
set(definitions ${definitions} -D${d})
|
||||
endforeach()
|
||||
#---Nanes and others---------------------------------------
|
||||
set(gensrcdict ${dictionary}.cpp)
|
||||
if(MSVC)
|
||||
set(gccxmlopts "--gccxmlopt=\"--gccxml-compiler cl\"")
|
||||
else()
|
||||
#set(gccxmlopts "--gccxmlopt=\'--gccxml-cxxflags -m64 \'")
|
||||
set(gccxmlopts)
|
||||
endif()
|
||||
#set(rootmapname ${dictionary}Dict.rootmap)
|
||||
#set(rootmapopts --rootmap=${rootmapname} --rootmap-lib=${libprefix}${dictionary}Dict)
|
||||
#---Check GCCXML and get path-----------------------------
|
||||
if(GCCXML)
|
||||
get_filename_component(gccxmlpath ${GCCXML} PATH)
|
||||
else()
|
||||
message(WARNING "GCCXML not found. Install and setup your environment to find 'gccxml' executable")
|
||||
endif()
|
||||
#---Actual command----------------------------------------
|
||||
add_custom_command(OUTPUT ${gensrcdict} ${rootmapname}
|
||||
COMMAND ${GENREFLEX_EXECUTABLE} ${headerfiles} -o ${gensrcdict} ${gccxmlopts} ${rootmapopts} --select=${selectionfile}
|
||||
--gccxmlpath=${gccxmlpath} ${ARG_OPTIONS} ${includedirs} ${definitions}
|
||||
DEPENDS ${headerfiles} ${selectionfile})
|
||||
endfunction()
|
||||
endif()
|
||||
|
||||
# ask root-config for the library varaibles
|
||||
EXEC_PROGRAM( ${ROOT_CONFIG_EXECUTABLE}
|
||||
# ARGS "--noldflags --noauxlibs --libs"
|
||||
ARGS "--glibs"
|
||||
OUTPUT_VARIABLE root_flags )
|
||||
|
||||
# STRING(REGEX MATCHALL "([^ ])+" root_libs_all ${root_flags})
|
||||
# STRING(REGEX MATCHALL "-L([^ ])+" root_library ${root_flags})
|
||||
# REMOVE_FROM_LIST(root_flags "${root_libs_all}" "${root_library}")
|
||||
|
||||
SET(ROOT_LIBRARIES ${root_flags})
|
||||
|
||||
# Make variables changeble to the advanced user
|
||||
MARK_AS_ADVANCED( ROOT_LIBRARY_DIR ROOT_INCLUDE_DIR ROOT_DEFINITIONS)
|
||||
|
||||
# Set ROOT_INCLUDES
|
||||
SET( ROOT_INCLUDES ${ROOT_INCLUDE_DIR})
|
||||
|
||||
SET(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${ROOT_LIBRARY_DIR})
|
||||
|
||||
#######################################
|
||||
#
|
||||
# Check the executables of ROOT
|
||||
# ( rootcint )
|
||||
#
|
||||
#######################################
|
||||
|
||||
FIND_PROGRAM(ROOT_CINT_EXECUTABLE
|
||||
NAMES rootcint
|
||||
PATHS ${ROOT_BINARY_DIR}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
ENDIF (ROOT_FOUND)
|
||||
mark_as_advanced(ROOTCINT_EXECUTABLE GENREFLEX_EXECUTABLE)
|
||||
|
||||
|
||||
|
||||
###########################################
|
||||
#
|
||||
# Macros for building ROOT dictionary
|
||||
#
|
||||
###########################################
|
||||
|
||||
MACRO (ROOT_GENERATE_DICTIONARY_OLD )
|
||||
|
||||
set(INFILES "")
|
||||
|
||||
foreach (_current_FILE ${ARGN})
|
||||
|
||||
IF (${_current_FILE} MATCHES "^.*\\.h$")
|
||||
IF (${_current_FILE} MATCHES "^.*Link.*$")
|
||||
set(LINKDEF_FILE ${_current_FILE})
|
||||
ELSE (${_current_FILE} MATCHES "^.*Link.*$")
|
||||
set(INFILES ${INFILES} ${_current_FILE})
|
||||
ENDIF (${_current_FILE} MATCHES "^.*Link.*$")
|
||||
ELSE (${_current_FILE} MATCHES "^.*\\.h$")
|
||||
IF (${_current_FILE} MATCHES "^.*\\.cxx$")
|
||||
set(OUTFILE ${_current_FILE})
|
||||
ELSE (${_current_FILE} MATCHES "^.*\\.cxx$")
|
||||
set(INCLUDE_DIRS ${INCLUDE_DIRS} -I${_current_FILE})
|
||||
ENDIF (${_current_FILE} MATCHES "^.*\\.cxx$")
|
||||
ENDIF (${_current_FILE} MATCHES "^.*\\.h$")
|
||||
|
||||
endforeach (_current_FILE ${ARGN})
|
||||
|
||||
# MESSAGE("INFILES: ${INFILES}")
|
||||
# MESSAGE("OutFILE: ${OUTFILE}")
|
||||
# MESSAGE("LINKDEF_FILE: ${LINKDEF_FILE}")
|
||||
# MESSAGE("INCLUDE_DIRS: ${INCLUDE_DIRS}")
|
||||
|
||||
STRING(REGEX REPLACE "(^.*).cxx" "\\1.h" bla "${OUTFILE}")
|
||||
# MESSAGE("BLA: ${bla}")
|
||||
SET (OUTFILES ${OUTFILE} ${bla})
|
||||
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${OUTFILES}
|
||||
COMMAND ${ROOT_CINT_EXECUTABLE}
|
||||
ARGS -f ${OUTFILE} -c -DHAVE_CONFIG_H ${INCLUDE_DIRS} ${INFILES} ${LINKDEF_FILE} DEPENDS ${INFILES})
|
||||
|
||||
# MESSAGE("ROOT_CINT_EXECUTABLE has created the dictionary ${OUTFILE}")
|
||||
|
||||
ENDMACRO (ROOT_GENERATE_DICTIONARY_OLD)
|
||||
|
||||
###########################################
|
||||
#
|
||||
# Macros for building ROOT dictionary
|
||||
#
|
||||
###########################################
|
||||
|
||||
MACRO (ROOT_GENERATE_DICTIONARY INFILES LINKDEF_FILE OUTFILE INCLUDE_DIRS_IN)
|
||||
|
||||
set(INCLUDE_DIRS)
|
||||
|
||||
foreach (_current_FILE ${INCLUDE_DIRS_IN})
|
||||
set(INCLUDE_DIRS ${INCLUDE_DIRS} -I${_current_FILE})
|
||||
endforeach (_current_FILE ${INCLUDE_DIRS_IN})
|
||||
|
||||
|
||||
# MESSAGE("INFILES: ${INFILES}")
|
||||
# MESSAGE("OutFILE: ${OUTFILE}")
|
||||
# MESSAGE("LINKDEF_FILE: ${LINKDEF_FILE}")
|
||||
# MESSAGE("INCLUDE_DIRS: ${INCLUDE_DIRS}")
|
||||
|
||||
STRING(REGEX REPLACE "^(.*)\\.(.*)$" "\\1.h" bla "${OUTFILE}")
|
||||
# MESSAGE("BLA: ${bla}")
|
||||
SET (OUTFILES ${OUTFILE} ${bla})
|
||||
|
||||
|
||||
if (CMAKE_SYSTEM_NAME MATCHES Linux)
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${OUTFILES}
|
||||
COMMAND LD_LIBRARY_PATH=${ROOT_LIBRARY_DIR} ROOTSYS=${ROOTSYS} ${ROOT_CINT_EXECUTABLE}
|
||||
ARGS -f ${OUTFILE} -c -DHAVE_CONFIG_H ${INCLUDE_DIRS} ${INFILES} ${LINKDEF_FILE} DEPENDS ${INFILES} ${LINKDEF_FILE})
|
||||
else (CMAKE_SYSTEM_NAME MATCHES Linux)
|
||||
if (CMAKE_SYSTEM_NAME MATCHES Darwin)
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${OUTFILES}
|
||||
COMMAND DYLD_LIBRARY_PATH=${ROOT_LIBRARY_DIR} ROOTSYS=${ROOTSYS} ${ROOT_CINT_EXECUTABLE}
|
||||
ARGS -f ${OUTFILE} -c -DHAVE_CONFIG_H ${INCLUDE_DIRS} ${INFILES} ${LINKDEF_FILE} DEPENDS ${INFILES} ${LINKDEF_FILE})
|
||||
endif (CMAKE_SYSTEM_NAME MATCHES Darwin)
|
||||
endif (CMAKE_SYSTEM_NAME MATCHES Linux)
|
||||
|
||||
ENDMACRO (ROOT_GENERATE_DICTIONARY)
|
||||
|
||||
MACRO (GENERATE_ROOT_TEST_SCRIPT SCRIPT_FULL_NAME)
|
||||
|
||||
get_filename_component(path_name ${SCRIPT_FULL_NAME} PATH)
|
||||
get_filename_component(file_extension ${SCRIPT_FULL_NAME} EXT)
|
||||
get_filename_component(file_name ${SCRIPT_FULL_NAME} NAME_WE)
|
||||
set(shell_script_name "${file_name}.sh")
|
||||
|
||||
#MESSAGE("PATH: ${path_name}")
|
||||
#MESSAGE("Ext: ${file_extension}")
|
||||
#MESSAGE("Name: ${file_name}")
|
||||
#MESSAGE("Shell Name: ${shell_script_name}")
|
||||
|
||||
string(REPLACE ${PROJECT_SOURCE_DIR}
|
||||
${PROJECT_BINARY_DIR} new_path ${path_name}
|
||||
# Modern add dictionary command
|
||||
# Call with the name of the output dictionary
|
||||
# Followed by sources (usually header files)
|
||||
# with an optional LinkDef.h at the end
|
||||
#
|
||||
# Add the created dictionary target to the linked libraries
|
||||
# root_add_dictionary(MyDict MyClass.h LinkDef.h)
|
||||
function(root_add_dictionary OUTNAME)
|
||||
add_custom_command(
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${OUTNAME}.cxx"
|
||||
COMMAND "${ROOTCINT_EXECUTABLE}" -v4 -f "${CMAKE_CURRENT_BINARY_DIR}/${OUTNAME}.cxx" ${ARGN}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
DEPENDS ${ARN}
|
||||
)
|
||||
|
||||
#MESSAGE("New PATH: ${new_path}")
|
||||
|
||||
file(MAKE_DIRECTORY ${new_path}/data)
|
||||
|
||||
CONVERT_LIST_TO_STRING(${LD_LIBRARY_PATH})
|
||||
set(MY_LD_LIBRARY_PATH ${output})
|
||||
set(my_script_name ${SCRIPT_FULL_NAME})
|
||||
|
||||
if(CMAKE_SYSTEM MATCHES Darwin)
|
||||
configure_file(${PROJECT_SOURCE_DIR}/cmake/scripts/root_macro_macos.sh.in
|
||||
${new_path}/${shell_script_name}
|
||||
)
|
||||
else(CMAKE_SYSTEM MATCHES Darwin)
|
||||
configure_file(${PROJECT_SOURCE_DIR}/cmake/scripts/root_macro.sh.in
|
||||
${new_path}/${shell_script_name}
|
||||
)
|
||||
endif(CMAKE_SYSTEM MATCHES Darwin)
|
||||
|
||||
EXEC_PROGRAM(/bin/chmod ARGS "u+x ${new_path}/${shell_script_name}")
|
||||
|
||||
ENDMACRO (GENERATE_ROOT_TEST_SCRIPT)
|
||||
add_library(${OUTNAME} STATIC "${CMAKE_CURRENT_BINARY_DIR}/${OUTNAME}.cxx")
|
||||
target_link_libraries(${OUTNAME} PUBLIC ROOT::Libraries)
|
||||
endfunction()
|
||||
|
||||
@@ -1,168 +0,0 @@
|
||||
# - Finds ROOT instalation
|
||||
# This module sets up ROOT information
|
||||
# It defines:
|
||||
# ROOT_FOUND If the ROOT is found
|
||||
# ROOT_INCLUDE_DIR PATH to the include directory
|
||||
# ROOT_LIBRARIES Most common libraries
|
||||
# ROOT_LIBRARY_DIR PATH to the library directory
|
||||
|
||||
|
||||
find_program(ROOT_CONFIG_EXECUTABLE root-config
|
||||
PATHS $ENV{ROOTSYS}/bin)
|
||||
|
||||
if(NOT ROOT_CONFIG_EXECUTABLE)
|
||||
set(ROOT_FOUND FALSE)
|
||||
else()
|
||||
set(ROOT_FOUND TRUE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --prefix
|
||||
OUTPUT_VARIABLE ROOTSYS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --version
|
||||
OUTPUT_VARIABLE ROOT_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --incdir
|
||||
OUTPUT_VARIABLE ROOT_INCLUDE_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --libs
|
||||
OUTPUT_VARIABLE ROOT_LIBRARIES
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
#defined by fada, 2012-05-22
|
||||
set(ROOTSYS c:/root)
|
||||
set(ROOT_VERSION 5.34/02)
|
||||
set(ROOT_INCLUDE_DIR ${ROOTSYS}/include)
|
||||
set(ROOT_LIBRARY_DIR ${ROOTSYS}/lib)
|
||||
set(ROOT_LIBRARIES -LIBPATH:${ROOT_LIBRARY_DIR} libGpad.lib libHist.lib libGraf.lib libGraf3d.lib libTree.lib libRint.lib libPostscript.lib libMatrix.lib libPhysics.lib libMathCore.lib libRIO.lib libNet.lib libThread.lib libCore.lib libCint.lib)
|
||||
|
||||
#set(ROOT_LIBRARIES ${ROOT_LIBRARIES} -lThread -lMinuit -lHtml -lVMC -lEG -lGeom -lTreePlayer -lXMLIO -lProof)
|
||||
#set(ROOT_LIBRARIES ${ROOT_LIBRARIES} -lProofPlayer -lMLP -lSpectrum -lEve -lRGL -lGed -lXMLParser -lPhysics)
|
||||
set(ROOT_LIBRARY_DIR ${ROOTSYS}/lib)
|
||||
|
||||
# Make variables changeble to the advanced user
|
||||
mark_as_advanced(ROOT_CONFIG_EXECUTABLE)
|
||||
|
||||
if(NOT ROOT_FIND_QUIETLY)
|
||||
message(STATUS "Found ROOT ${ROOT_VERSION} in ${ROOTSYS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
include(CMakeParseArguments)
|
||||
find_program(ROOTCINT_EXECUTABLE rootcint PATHS $ENV{ROOTSYS}/bin)
|
||||
find_program(GENREFLEX_EXECUTABLE genreflex PATHS $ENV{ROOTSYS}/bin)
|
||||
find_package(GCCXML)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# function ROOT_GENERATE_DICTIONARY( dictionary
|
||||
# header1 header2 ...
|
||||
# LINKDEF linkdef1 ...
|
||||
# OPTIONS opt1...)
|
||||
function(ROOT_GENERATE_DICTIONARY dictionary)
|
||||
CMAKE_PARSE_ARGUMENTS(ARG "" "" "LINKDEF;OPTIONS" "" ${ARGN})
|
||||
#---Get the list of header files-------------------------
|
||||
set(headerfiles)
|
||||
foreach(fp ${ARG_UNPARSED_ARGUMENTS})
|
||||
file(GLOB files ${fp})
|
||||
if(files)
|
||||
foreach(f ${files})
|
||||
if(NOT f MATCHES LinkDef)
|
||||
set(headerfiles ${headerfiles} ${f})
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
set(headerfiles ${headerfiles} ${fp})
|
||||
endif()
|
||||
endforeach()
|
||||
#---Get the list of include directories------------------
|
||||
get_directory_property(incdirs INCLUDE_DIRECTORIES)
|
||||
set(includedirs)
|
||||
foreach( d ${incdirs})
|
||||
set(includedirs ${includedirs} -I${d})
|
||||
endforeach()
|
||||
#---Get LinkDef.h file------------------------------------
|
||||
set(linkdefs)
|
||||
foreach( f ${ARG_LINKDEF})
|
||||
if( IS_ABSOLUTE ${f})
|
||||
set(linkdefs ${linkdefs} ${f})
|
||||
else()
|
||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/inc/${f})
|
||||
set(linkdefs ${linkdefs} ${CMAKE_CURRENT_SOURCE_DIR}/inc/${f})
|
||||
else()
|
||||
set(linkdefs ${linkdefs} ${CMAKE_CURRENT_SOURCE_DIR}/${f})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
#---call rootcint------------------------------------------
|
||||
add_custom_command(OUTPUT ${dictionary}.cxx ${dictionary}.h
|
||||
COMMAND ${ROOTCINT_EXECUTABLE} -cint -f ${dictionary}.cxx
|
||||
-c ${ARG_OPTIONS} ${includedirs} ${headerfiles} ${linkdefs}
|
||||
DEPENDS ${headerfiles} ${linkdefs})
|
||||
endfunction()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# function REFLEX_GENERATE_DICTIONARY(dictionary
|
||||
# header1 header2 ...
|
||||
# SELECTION selectionfile ...
|
||||
# OPTIONS opt1...)
|
||||
function(REFLEX_GENERATE_DICTIONARY dictionary)
|
||||
CMAKE_PARSE_ARGUMENTS(ARG "" "" "SELECTION;OPTIONS" "" ${ARGN})
|
||||
#---Get the list of header files-------------------------
|
||||
set(headerfiles)
|
||||
foreach(fp ${ARG_UNPARSED_ARGUMENTS})
|
||||
file(GLOB files ${fp})
|
||||
if(files)
|
||||
foreach(f ${files})
|
||||
set(headerfiles ${headerfiles} ${f})
|
||||
endforeach()
|
||||
else()
|
||||
set(headerfiles ${headerfiles} ${fp})
|
||||
endif()
|
||||
endforeach()
|
||||
#---Get Selection file------------------------------------
|
||||
if(IS_ABSOLUTE ${ARG_SELECTION})
|
||||
set(selectionfile ${ARG_SELECTION})
|
||||
else()
|
||||
set(selectionfile ${CMAKE_CURRENT_SOURCE_DIR}/${ARG_SELECTION})
|
||||
endif()
|
||||
#---Get the list of include directories------------------
|
||||
get_directory_property(incdirs INCLUDE_DIRECTORIES)
|
||||
set(includedirs)
|
||||
foreach( d ${incdirs})
|
||||
set(includedirs ${includedirs} -I${d})
|
||||
endforeach()
|
||||
#---Get preprocessor definitions--------------------------
|
||||
get_directory_property(defs COMPILE_DEFINITIONS)
|
||||
foreach( d ${defs})
|
||||
set(definitions ${definitions} -D${d})
|
||||
endforeach()
|
||||
#---Nanes and others---------------------------------------
|
||||
set(gensrcdict ${dictionary}.cpp)
|
||||
if(MSVC)
|
||||
set(gccxmlopts "--gccxmlopt=\"--gccxml-compiler cl\"")
|
||||
else()
|
||||
#set(gccxmlopts "--gccxmlopt=\'--gccxml-cxxflags -m64 \'")
|
||||
set(gccxmlopts)
|
||||
endif()
|
||||
#set(rootmapname ${dictionary}Dict.rootmap)
|
||||
#set(rootmapopts --rootmap=${rootmapname} --rootmap-lib=${libprefix}${dictionary}Dict)
|
||||
#---Check GCCXML and get path-----------------------------
|
||||
if(GCCXML)
|
||||
get_filename_component(gccxmlpath ${GCCXML} PATH)
|
||||
else()
|
||||
message(WARNING "GCCXML not found. Install and setup your environment to find 'gccxml' executable")
|
||||
endif()
|
||||
#---Actual command----------------------------------------
|
||||
add_custom_command(OUTPUT ${gensrcdict} ${rootmapname}
|
||||
COMMAND ${GENREFLEX_EXECUTABLE} ${headerfiles} -o ${gensrcdict} ${gccxmlopts} ${rootmapopts} --select=${selectionfile}
|
||||
--gccxmlpath=${gccxmlpath} ${ARG_OPTIONS} ${includedirs} ${definitions}
|
||||
DEPENDS ${headerfiles} ${selectionfile})
|
||||
endfunction()
|
||||
|
||||
@@ -1,266 +0,0 @@
|
||||
# - Finds ROOT instalation
|
||||
# This module sets up ROOT information
|
||||
# It defines:
|
||||
# ROOT_FOUND If the ROOT is found
|
||||
# ROOT_INCLUDE_DIR PATH to the include directory
|
||||
# ROOT_INCLUDE_DIRS PATH to the include directories (not cached)
|
||||
# ROOT_LIBRARIES Most common libraries
|
||||
# ROOT_<name>_LIBRARY Full path to the library <name>
|
||||
# ROOT_LIBRARY_DIR PATH to the library directory
|
||||
# ROOT_DEFINITIONS Compiler definitions and flags
|
||||
# ROOT_LINK_FLAGS Linker flags
|
||||
#
|
||||
# The modern CMake 3 imported targets are also created:
|
||||
# ROOT::Libraries (Most common libraries)
|
||||
# ROOT::<name> (The library with name)
|
||||
#
|
||||
# Updated by K. Smith (ksmith37@nd.edu) to properly handle
|
||||
# dependencies in ROOT_GENERATE_DICTIONARY
|
||||
# Updated by H. Schreiner (hschrein@cern.ch) to support CMake 3 syntax
|
||||
|
||||
find_program(ROOT_CONFIG_EXECUTABLE root-config
|
||||
PATHS $ENV{ROOTSYS}/bin)
|
||||
|
||||
if(ROOT_CONFIG_EXECUTABLE)
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --prefix
|
||||
OUTPUT_VARIABLE ROOTSYS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --version
|
||||
OUTPUT_VARIABLE ROOT_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --incdir
|
||||
OUTPUT_VARIABLE ROOT_INCLUDE_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
set(ROOT_INCLUDE_DIRS ${ROOT_INCLUDE_DIR})
|
||||
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --libdir
|
||||
OUTPUT_VARIABLE ROOT_LIBRARY_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
set(ROOT_LIBRARY_DIRS ${ROOT_LIBRARY_DIR})
|
||||
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --cflags
|
||||
OUTPUT_VARIABLE ROOT_DEFINITIONS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REGEX REPLACE "(^|[ ]*)-I[^ ]*" "" ROOT_DEFINITIONS ${ROOT_DEFINITIONS})
|
||||
set(ROOT_DEF_LIST ${ROOT_DEFINITIONS})
|
||||
separate_arguments(ROOT_DEF_LIST)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --ldflags
|
||||
OUTPUT_VARIABLE ROOT_LINK_FLAGS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
set(ROOT_LINK_LIST ${ROOT_LINK_FLAGS})
|
||||
separate_arguments(ROOT_LINK_LIST)
|
||||
|
||||
# Needed because ROOT on Mac does not use Mac conventions
|
||||
set(CMAKE_SHARED_LIBRARY_SUFFIX .so)
|
||||
|
||||
file(GLOB ROOT_LIBFILELIST
|
||||
LIST_DIRECTORIES false
|
||||
RELATIVE "${ROOT_LIBRARY_DIR}"
|
||||
"${ROOT_LIBRARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}*${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
|
||||
if(NOT ROOT_LIBFILELIST)
|
||||
message(FATAL_ERROR "ROOT libraries not found at ${ROOT_LIBRARY_DIR}")
|
||||
endif()
|
||||
|
||||
set(ROOT_ALLLIBS "")
|
||||
foreach(_file ${ROOT_LIBFILELIST})
|
||||
string(REGEX REPLACE "^${CMAKE_SHARED_LIBRARY_PREFIX}" "" _newer ${_file})
|
||||
string(REGEX REPLACE "${CMAKE_SHARED_LIBRARY_SUFFIX}$" "" _newest ${_newer})
|
||||
list(APPEND ROOT_ALLLIBS ${_newest})
|
||||
endforeach()
|
||||
|
||||
set(ROOT_CORELIBS Core RIO Net Hist Graf Graf3d Gpad Tree Rint Postscript Matrix Physics MathCore Thread MultiProc)
|
||||
|
||||
add_library(ROOT::Libraries INTERFACE IMPORTED)
|
||||
|
||||
set(ROOT_LIBRARIES)
|
||||
foreach(_cpt ${ROOT_ALLLIBS})
|
||||
find_library(ROOT_${_cpt}_LIBRARY ${_cpt} HINTS ${ROOT_LIBRARY_DIR})
|
||||
if(ROOT_${_cpt}_LIBRARY)
|
||||
mark_as_advanced(ROOT_${_cpt}_LIBRARY)
|
||||
add_library(ROOT::${_cpt} SHARED IMPORTED)
|
||||
set_target_properties(ROOT::${_cpt} PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${ROOT_INCLUDE_DIRS}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
IMPORTED_LOCATION "${ROOT_${_cpt}_LIBRARY}"
|
||||
INTERFACE_COMPILE_OPTIONS "$<$<BUILD_INTERFACE:$<COMPILE_LANGUAGE:CXX>>:${ROOT_DEF_LIST}>"
|
||||
INTERFACE_LINK_LIBRARIES "${ROOT_LINK_LIST}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(targetlist)
|
||||
foreach(_cpt ${ROOT_CORELIBS} ${ROOT_FIND_COMPONENTS})
|
||||
if(ROOT_${_cpt}_LIBRARY)
|
||||
list(APPEND ROOT_LIBRARIES "${ROOT_${_cpt}_LIBRARY}")
|
||||
list(REMOVE_ITEM ROOT_FIND_COMPONENTS ${_cpt})
|
||||
list(APPEND targetlist ROOT::${_cpt})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set_target_properties(ROOT::Libraries PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${ROOT_INCLUDE_DIRS}")
|
||||
set_target_properties(ROOT::Libraries PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES "${targetlist}")
|
||||
unset(targetlist)
|
||||
|
||||
list(REMOVE_DUPLICATES ROOT_LIBRARIES)
|
||||
|
||||
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --features
|
||||
OUTPUT_VARIABLE _root_options
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
foreach(_opt ${_root_options})
|
||||
set(ROOT_${_opt}_FOUND TRUE)
|
||||
endforeach()
|
||||
endif()
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(ROOT DEFAULT_MSG ROOT_CONFIG_EXECUTABLE
|
||||
ROOTSYS ROOT_VERSION ROOT_INCLUDE_DIR ROOT_LIBRARIES ROOT_LIBRARY_DIR)
|
||||
|
||||
mark_as_advanced(ROOT_CONFIG_EXECUTABLE)
|
||||
|
||||
include(CMakeParseArguments)
|
||||
find_program(ROOTCINT_EXECUTABLE rootcint PATHS $ENV{ROOTSYS}/bin)
|
||||
find_program(GENREFLEX_EXECUTABLE genreflex PATHS $ENV{ROOTSYS}/bin)
|
||||
find_package(GCCXML)
|
||||
|
||||
if(EXISTS "$ENV{ROOTSYS}/cmake/modules/RootNewMacros.cmake")
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} $ENV{ROOTSYS}/cmake/modules)
|
||||
include(RootNewMacros)
|
||||
elseif(EXISTS "${ROOTSYS}/cmake/modules/RootNewMacros.cmake")
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ROOTSYS}/cmake/modules)
|
||||
include(RootNewMacros)
|
||||
else()
|
||||
#----------------------------------------------------------------------------
|
||||
# function ROOT_GENERATE_DICTIONARY( dictionary
|
||||
# header1 header2 ...
|
||||
# LINKDEF linkdef1 ...
|
||||
# OPTIONS opt1...)
|
||||
function(ROOT_GENERATE_DICTIONARY dictionary)
|
||||
CMAKE_PARSE_ARGUMENTS(ARG "" "" "LINKDEF;OPTIONS" "" ${ARGN})
|
||||
#---Get the list of include directories------------------
|
||||
get_directory_property(incdirs INCLUDE_DIRECTORIES)
|
||||
set(includedirs)
|
||||
foreach( d ${incdirs})
|
||||
set(includedirs ${includedirs} -I${d})
|
||||
endforeach()
|
||||
#---Get the list of header files-------------------------
|
||||
set(headerfiles)
|
||||
foreach(fp ${ARG_UNPARSED_ARGUMENTS})
|
||||
if(${fp} MATCHES "[*?]") # Is this header a globbing expression?
|
||||
file(GLOB files ${fp})
|
||||
foreach(f ${files})
|
||||
if(NOT f MATCHES LinkDef) # skip LinkDefs from globbing result
|
||||
set(headerfiles ${headerfiles} ${f})
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
find_file(headerFile ${fp} PATHS ${incdirs})
|
||||
set(headerfiles ${headerfiles} ${headerFile})
|
||||
unset(headerFile CACHE)
|
||||
endif()
|
||||
endforeach()
|
||||
#---Get LinkDef.h file------------------------------------
|
||||
set(linkdefs)
|
||||
foreach( f ${ARG_LINKDEF})
|
||||
find_file(linkFile ${f} PATHS ${incdirs})
|
||||
set(linkdefs ${linkdefs} ${linkFile})
|
||||
unset(linkFile CACHE)
|
||||
endforeach()
|
||||
#---call rootcint------------------------------------------
|
||||
add_custom_command(OUTPUT ${dictionary}.cxx ${dictionary}.h
|
||||
COMMAND ${ROOTCINT_EXECUTABLE} -cint -f ${dictionary}.cxx
|
||||
-c ${ARG_OPTIONS} ${includedirs} ${headerfiles} ${linkdefs}
|
||||
DEPENDS ${headerfiles} ${linkdefs} VERBATIM)
|
||||
endfunction()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# function REFLEX_GENERATE_DICTIONARY(dictionary
|
||||
# header1 header2 ...
|
||||
# SELECTION selectionfile ...
|
||||
# OPTIONS opt1...)
|
||||
function(REFLEX_GENERATE_DICTIONARY dictionary)
|
||||
CMAKE_PARSE_ARGUMENTS(ARG "" "" "SELECTION;OPTIONS" "" ${ARGN})
|
||||
#---Get the list of header files-------------------------
|
||||
set(headerfiles)
|
||||
foreach(fp ${ARG_UNPARSED_ARGUMENTS})
|
||||
file(GLOB files ${fp})
|
||||
if(files)
|
||||
foreach(f ${files})
|
||||
set(headerfiles ${headerfiles} ${f})
|
||||
endforeach()
|
||||
else()
|
||||
set(headerfiles ${headerfiles} ${fp})
|
||||
endif()
|
||||
endforeach()
|
||||
#---Get Selection file------------------------------------
|
||||
if(IS_ABSOLUTE ${ARG_SELECTION})
|
||||
set(selectionfile ${ARG_SELECTION})
|
||||
else()
|
||||
set(selectionfile ${CMAKE_CURRENT_SOURCE_DIR}/${ARG_SELECTION})
|
||||
endif()
|
||||
#---Get the list of include directories------------------
|
||||
get_directory_property(incdirs INCLUDE_DIRECTORIES)
|
||||
set(includedirs)
|
||||
foreach( d ${incdirs})
|
||||
set(includedirs ${includedirs} -I${d})
|
||||
endforeach()
|
||||
#---Get preprocessor definitions--------------------------
|
||||
get_directory_property(defs COMPILE_DEFINITIONS)
|
||||
foreach( d ${defs})
|
||||
set(definitions ${definitions} -D${d})
|
||||
endforeach()
|
||||
#---Nanes and others---------------------------------------
|
||||
set(gensrcdict ${dictionary}.cpp)
|
||||
if(MSVC)
|
||||
set(gccxmlopts "--gccxmlopt=\"--gccxml-compiler cl\"")
|
||||
else()
|
||||
#set(gccxmlopts "--gccxmlopt=\'--gccxml-cxxflags -m64 \'")
|
||||
set(gccxmlopts)
|
||||
endif()
|
||||
#set(rootmapname ${dictionary}Dict.rootmap)
|
||||
#set(rootmapopts --rootmap=${rootmapname} --rootmap-lib=${libprefix}${dictionary}Dict)
|
||||
#---Check GCCXML and get path-----------------------------
|
||||
if(GCCXML)
|
||||
get_filename_component(gccxmlpath ${GCCXML} PATH)
|
||||
else()
|
||||
message(WARNING "GCCXML not found. Install and setup your environment to find 'gccxml' executable")
|
||||
endif()
|
||||
#---Actual command----------------------------------------
|
||||
add_custom_command(OUTPUT ${gensrcdict} ${rootmapname}
|
||||
COMMAND ${GENREFLEX_EXECUTABLE} ${headerfiles} -o ${gensrcdict} ${gccxmlopts} ${rootmapopts} --select=${selectionfile}
|
||||
--gccxmlpath=${gccxmlpath} ${ARG_OPTIONS} ${includedirs} ${definitions}
|
||||
DEPENDS ${headerfiles} ${selectionfile})
|
||||
endfunction()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(ROOTCINT_EXECUTABLE GENREFLEX_EXECUTABLE)
|
||||
|
||||
|
||||
# Modern add dictionary command
|
||||
# Call with the name of the output dictionary
|
||||
# Followed by sources (usually header files)
|
||||
# with an optional LinkDef.h at the end
|
||||
#
|
||||
# Add the created dictionary target to the linked libraries
|
||||
# root_add_dictionary(MyDict MyClass.h LinkDef.h)
|
||||
function(root_add_dictionary OUTNAME)
|
||||
add_custom_command(
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${OUTNAME}.cxx"
|
||||
COMMAND "${ROOTCINT_EXECUTABLE}" -v4 -f "${CMAKE_CURRENT_BINARY_DIR}/${OUTNAME}.cxx" ${ARGN}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
DEPENDS ${ARN}
|
||||
)
|
||||
add_library(${OUTNAME} STATIC "${CMAKE_CURRENT_BINARY_DIR}/${OUTNAME}.cxx")
|
||||
target_link_libraries(${OUTNAME} PUBLIC ROOT::Libraries)
|
||||
endfunction()
|
||||
+5
-1
@@ -1148,6 +1148,10 @@ in order to simulate optical photons:
|
||||
(Note that the simulation can also be terminated gently by creating a file
|
||||
``RUNNUMBER.stop'' in the working directory, where RUNNUMBER matches the
|
||||
run number specified in the name of the macro file.)
|
||||
|
||||
\item{\bf /musr/command writeFile \emph{filename.gdml}}\\
|
||||
When set, enables exporting the detector geometry description to \emph{filename.gdml}.
|
||||
This will fail, if \emph{filename.gdml} already exists.
|
||||
\end{description}
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\section{Output root tree variables}
|
||||
@@ -1655,4 +1659,4 @@ Nucl. Inst. and Meth. in Phys. Res. A {\bf 610} (2009), 374-377.
|
||||
|
||||
\end{thebibliography}
|
||||
|
||||
\end{document}
|
||||
\end{document}
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G4FieldManager.hh"
|
||||
#include "G4OpticalSurface.hh"
|
||||
#include "G4GDMLParser.hh"
|
||||
#include <map>
|
||||
|
||||
class G4Tubs;
|
||||
@@ -48,15 +49,11 @@ class musrMuEnergyLossLandau;
|
||||
class musrDetectorConstruction : public G4VUserDetectorConstruction
|
||||
{
|
||||
public:
|
||||
|
||||
musrDetectorConstruction(G4String steeringFileName);
|
||||
~musrDetectorConstruction();
|
||||
|
||||
public:
|
||||
|
||||
G4VPhysicalVolume* Construct();
|
||||
|
||||
|
||||
void UpdateGeometry();
|
||||
void SetInputParameterFileName(G4String fileName) {parameterFileName=fileName;};
|
||||
void ReportGeometryProblem(char myString[501]);
|
||||
@@ -66,6 +63,9 @@ public:
|
||||
G4VPhysicalVolume* FindPhysicalVolume(G4String PhysicalVolumeName);
|
||||
void SetColourOfLogicalVolume(G4LogicalVolume* pLogVol,char* colour);
|
||||
|
||||
// Reading/writing GDML
|
||||
void SetWriteFile(const G4String& fname);
|
||||
|
||||
private:
|
||||
G4String parameterFileName; // name of the file with the geometry parameters
|
||||
G4bool checkOverlap; // parameter to check ovelaping volumes
|
||||
@@ -82,9 +82,14 @@ private:
|
||||
std::map<std::string,G4MaterialPropertiesTable*> materialPropertiesTableMap;
|
||||
std::map<std::string,G4MaterialPropertiesTable*>::iterator itMPT;
|
||||
|
||||
|
||||
private:
|
||||
void DefineMaterials();
|
||||
|
||||
// GDML Parser
|
||||
G4GDMLParser* fParser;
|
||||
|
||||
// Read/write settings
|
||||
G4String fWriteFile;
|
||||
G4bool fWriteChoice;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -44,7 +44,7 @@ class musrDetectorMessenger: public G4UImessenger
|
||||
musrDetectorMessenger(musrDetectorConstruction*);
|
||||
~musrDetectorMessenger();
|
||||
|
||||
void SetNewValue(G4UIcommand*, G4String);
|
||||
virtual void SetNewValue(G4UIcommand*, G4String);
|
||||
|
||||
private:
|
||||
musrDetectorConstruction* myDetector;
|
||||
@@ -59,9 +59,6 @@ class musrDetectorMessenger: public G4UImessenger
|
||||
G4UIcmdWithAnInteger* HowOftenToPrintEventCmd;
|
||||
G4UIcmdWithAnInteger* RndmEventToSaveSeedsCmd;
|
||||
G4UIcmdWithoutParameter* UpdateCmd;
|
||||
|
||||
public:
|
||||
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -75,23 +75,34 @@
|
||||
#include "musrErrorMessage.hh"
|
||||
#include "musrSteppingAction.hh"
|
||||
|
||||
#include "G4GDMLParser.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
musrDetectorConstruction::musrDetectorConstruction(G4String steeringFileName)
|
||||
:checkOverlap(true), aScintSD(0)
|
||||
: G4VUserDetectorConstruction(),
|
||||
checkOverlap(true),
|
||||
aScintSD(0),
|
||||
detectorMessenger(0)
|
||||
{
|
||||
parameterFileName = steeringFileName;
|
||||
fWriteChoice = false;
|
||||
|
||||
DefineMaterials();
|
||||
|
||||
detectorMessenger = new musrDetectorMessenger(this);
|
||||
|
||||
fParser = new G4GDMLParser();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
musrDetectorConstruction::~musrDetectorConstruction()
|
||||
{
|
||||
delete detectorMessenger;
|
||||
delete detectorMessenger;
|
||||
delete fParser;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -527,6 +538,100 @@ G4VPhysicalVolume* musrDetectorConstruction::Construct() {
|
||||
G4Tubs* solidOuterDetTube2 = new G4Tubs("SolidOuterDetTube2",x4*CLHEP::mm,x5*CLHEP::mm,x6*CLHEP::mm,x7*CLHEP::deg,x8*CLHEP::deg);
|
||||
solid = new G4SubtractionSolid(solidName, solidOuterDetTube2, solidInnerDetBox2);
|
||||
}
|
||||
else if (strcmp(tmpString2,"boxtubehole")==0){
|
||||
// Create a box, from which center a tube is cut out.
|
||||
// x1,x2,x3=box half-widths; x4,x5,x6,x7,x8 define the tube.
|
||||
sscanf(&line[0],"%*s %*s %*s %s %lf %lf %lf %lf %lf %lf %lf %lf %s",
|
||||
name,&x1,&x2,&x3,&x4,&x5,&x6,&x7,&x8,material);
|
||||
sscanf(&line[0],"%*s %*s %*s %*s %*g %*g %*g %*g %*g %*g %*g %*g %*s %lf %lf %lf %s %s %s %d %s",
|
||||
&posx,&posy,&posz,mothersName,rotMatrix,sensitiveDet,&volumeID,actualFieldName);
|
||||
solidName+=name;
|
||||
G4double roundingErr=0.01*CLHEP::mm; // to avoid some displaying problems of the subtracted volumes
|
||||
G4Box* solidOuterDetBox2 = new G4Box("SolidInnerDetBox2",x1*CLHEP::mm,x2*CLHEP::mm,x3*CLHEP::mm);
|
||||
G4Tubs* solidInnerDetTube2 = new G4Tubs("SolidOuterDetTube2",x4*CLHEP::mm,x5*CLHEP::mm,x6*CLHEP::mm + roundingErr,x7*CLHEP::deg,x8*CLHEP::deg);
|
||||
solid = new G4SubtractionSolid(solidName, solidOuterDetBox2, solidInnerDetTube2);
|
||||
}
|
||||
else if (strcmp(tmpString2,"gasketDAC")==0){
|
||||
// DAC gasket = box, central through-hole (sample placement), top cone, bottom cone (2 diamonds).
|
||||
// x1 : gasket outer radius
|
||||
// x2 : gasket HALF-thickness (half of the original thickness)
|
||||
// x3 : sample-hole radius (= disc inner radius)
|
||||
// x4 : culet radius -> flat floor of the indentation (narrow end, deep) require x4 > x3
|
||||
// x5 : surface radius -> wide end at the face require x5 > x4
|
||||
// x6 : indentation depth per side require x6 < x2
|
||||
// x7,x8 : start / delta phi (use 0 and 360)
|
||||
sscanf(&line[0],"%*s %*s %*s %s %lf %lf %lf %lf %lf %lf %lf %lf %s",
|
||||
name,&x1,&x2,&x3,&x4,&x5,&x6,&x7,&x8,material);
|
||||
sscanf(&line[0],"%*s %*s %*s %*s %*g %*g %*g %*g %*g %*g %*g %*g %*s %lf %lf %lf %s %s %s %d %s",
|
||||
&posx,&posy,&posz,mothersName,rotMatrix,sensitiveDet,&volumeID,actualFieldName);
|
||||
solidName+=name;
|
||||
G4double roundingErr = 0.01*CLHEP::mm; // avoid coincident faces in the boolean ops
|
||||
// (0) gasket disc (hole built in as the inner radius)
|
||||
G4Tubs* gDisc = new G4Tubs("gDisc",
|
||||
x3*CLHEP::mm, x1*CLHEP::mm,
|
||||
x2*CLHEP::mm,
|
||||
x7*CLHEP::deg, x8*CLHEP::deg);
|
||||
// solid = gDisc;
|
||||
// (1) top removal: narrow (culet) at the deep end, wide at the +Z face
|
||||
G4Cons* coneTop = new G4Cons("coneTop",
|
||||
0., x4*CLHEP::mm, // Rmin1,Rmax1 (deep, narrow)
|
||||
0., x5*CLHEP::mm, // Rmin2,Rmax2 (face, wide)
|
||||
x6*CLHEP::mm + roundingErr,
|
||||
0.*CLHEP::deg, 360.*CLHEP::deg);
|
||||
G4ThreeVector posTop(0., 0., (x2 - x6)*CLHEP::mm);
|
||||
G4SubtractionSolid* g1 = new G4SubtractionSolid("g1", gDisc, coneTop, 0, posTop);
|
||||
|
||||
// (2) bottom removal: mirror (radii swapped, wide at the -Z face)
|
||||
G4Cons* coneBot = new G4Cons("coneBot",
|
||||
0., x5*CLHEP::mm, // Rmin1,Rmax1 (face, wide)
|
||||
0., x4*CLHEP::mm, // Rmin2,Rmax2 (deep, narrow)
|
||||
x6*CLHEP::mm + roundingErr,
|
||||
0.*CLHEP::deg, 360.*CLHEP::deg);
|
||||
G4ThreeVector posBot(0., 0., -(x2 - x6)*CLHEP::mm);
|
||||
solid = new G4SubtractionSolid(solidName, g1, coneBot, 0, posBot);
|
||||
}
|
||||
else if (strcmp(tmpString2,"gasketDAC2")==0){
|
||||
// TUBE with a blind cone cut into EACH +-z face (solid web of thickness L),
|
||||
// then a SAMPLE cavity (radius x3) cut from -L/4 to +L/4 in the centre of the web.
|
||||
// x1 = tube outer radius
|
||||
// x2 = tube HALF-height (along z)
|
||||
// x3 = sample-cavity radius (independent of the cone tips)
|
||||
// x4 = cone inner-tip radius, x5 = cone radius at each face
|
||||
// x6 = L (web thickness; sample cavity spans the central L/2; require x6 < 2*x2)
|
||||
sscanf(&line[0],"%*s %*s %*s %s %lf %lf %lf %lf %lf %lf %s %lf %lf %lf %s %s",
|
||||
name,&x1,&x2,&x3,&x4,&x5,&x6,material,&posx,&posy,&posz,mothersName,rotMatrix);
|
||||
sscanf(&line[0],"%*s %*s %*s %*s %*g %*g %*g %*g %*g %*g %*s %*g %*g %*g %*s %*s %s %d %s",sensitiveDet,&volumeID,actualFieldName);
|
||||
solidName+=name;
|
||||
G4double roundingErr=0.01*CLHEP::mm; // avoid coincident faces in the subtraction
|
||||
G4Tubs* GPS_SolidDetBox = new G4Tubs("GPS_SolidDetTube",
|
||||
0., x1*CLHEP::mm, // rMin, rMax
|
||||
x2*CLHEP::mm, // half-height along z
|
||||
0.*CLHEP::deg, 360.*CLHEP::deg);
|
||||
// each cone spans from |z| = L/2 (inner) to |z| = x2 (face)
|
||||
G4double h0 = 0.5*(x2 - 0.5*x6)*CLHEP::mm; // base half-height
|
||||
G4double c0 = 0.5*(x2 + 0.5*x6)*CLHEP::mm; // base centre |z|
|
||||
G4double H = h0 + 0.5*roundingErr; // pokes the outer face out by roundingErr
|
||||
// top cone: narrow (x4) at +L/2, wide (x5) at the +z face
|
||||
G4Cons* GPS_SolidDetConsTop = new G4Cons("GPS_SolidDetConsTop",
|
||||
0., x4*CLHEP::mm, // Rmin1,Rmax1 at the inner end (+L/2)
|
||||
0., x5*CLHEP::mm, // Rmin2,Rmax2 at the +z face
|
||||
H, 0., 360.);
|
||||
G4ThreeVector consShiftTop(0., 0., c0 + 0.5*roundingErr);
|
||||
G4SubtractionSolid* GPS_box1 = new G4SubtractionSolid("GPS_box1", GPS_SolidDetBox, GPS_SolidDetConsTop, 0, consShiftTop);
|
||||
// bottom cone: wide (x5) at the -z face, narrow (x4) at -L/2
|
||||
G4Cons* GPS_SolidDetConsBot = new G4Cons("GPS_SolidDetConsBot",
|
||||
0., x5*CLHEP::mm, // Rmin1,Rmax1 at the -z face
|
||||
0., x4*CLHEP::mm, // Rmin2,Rmax2 at the inner end (-L/2)
|
||||
H, 0., 360.);
|
||||
G4ThreeVector consShiftBot(0., 0., -(c0 + 0.5*roundingErr));
|
||||
G4SubtractionSolid* GPS_box2 = new G4SubtractionSolid("GPS_box2", GPS_box1, GPS_SolidDetConsBot, 0, consShiftBot);
|
||||
// sample cavity: cylinder of radius x3, spanning -L/4 .. +L/4 (length L/2), centred at z=0
|
||||
G4Tubs* GPS_SolidDetSample = new G4Tubs("GPS_SolidDetSample",
|
||||
0., x3*CLHEP::mm, // rMin, rMax = sample radius (independent of cones)
|
||||
0.5*x6*CLHEP::mm + roundingErr, // half-height = L/2
|
||||
0.*CLHEP::deg, 360.*CLHEP::deg);
|
||||
solid = new G4SubtractionSolid(solidName, GPS_box2, GPS_SolidDetSample, 0, G4ThreeVector(0.,0.,0.));
|
||||
}
|
||||
else if (strcmp(tmpString2,"boxbox")==0){
|
||||
// Create a box, from which center a box is cut out.
|
||||
// x1,x2,x3=box half-widths of the inner box (opening); x4,x5,x6 define the big box.
|
||||
@@ -1549,13 +1654,23 @@ G4VPhysicalVolume* musrDetectorConstruction::Construct() {
|
||||
sscanf(&line[0],"%*s %*s %lf",&musrMuEnergyLossLandau::landauSigma);
|
||||
cout << "landauSigma = " << musrMuEnergyLossLandau::landauSigma << endl;
|
||||
}
|
||||
// FIXME: Would be better and much cleaner to handle this in musrDetectorMessenger
|
||||
else if (strcmp(tmpString1, "writeFile") == 0) {
|
||||
sscanf(&line[0],"%*s %*s %s", tmpString2);
|
||||
SetWriteFile(tmpString2);
|
||||
}
|
||||
|
||||
else ReportGeometryProblem(line);
|
||||
|
||||
}
|
||||
}
|
||||
fclose(fSteeringFile);
|
||||
// G4cout<< "musrDetectorConstruction.cc: pointerToWorldVolume="<<pointerToWorldVolume<<G4endl;
|
||||
|
||||
if (fWriteChoice) {
|
||||
fParser->SetSDExport(true);
|
||||
fParser->Write(fWriteFile, pointerToWorldVolume);
|
||||
}
|
||||
|
||||
return pointerToWorldVolume;
|
||||
}
|
||||
|
||||
@@ -1600,6 +1715,9 @@ void musrDetectorConstruction::DefineMaterials()
|
||||
G4Element* Al = man->FindOrBuildElement("Al");
|
||||
G4Element* Mg = man->FindOrBuildElement("Mg");
|
||||
|
||||
// Element required for DAC
|
||||
G4Element* Be = man->FindOrBuildElement("Be");
|
||||
|
||||
// compounds required for MCP Macor
|
||||
G4Material* MgO = new G4Material("MgO", 3.60*CLHEP::g/CLHEP::cm3, ncomponents=2);
|
||||
MgO->AddElement(Mg, natoms=1);
|
||||
@@ -1637,6 +1755,16 @@ void musrDetectorConstruction::DefineMaterials()
|
||||
Myl->AddElement(H, natoms= 8);
|
||||
Myl->AddElement(O, natoms= 4);
|
||||
|
||||
// Elements required for Anvil cells
|
||||
G4Material* diamond =
|
||||
new G4Material("Diamond", 3.52*CLHEP::g/CLHEP::cm3, ncomponents=1);
|
||||
diamond->AddElement(C, 1);
|
||||
|
||||
// Copper-beryllium
|
||||
G4Material* CuBe = new G4Material("CuBe", density= 8.25*CLHEP::g/CLHEP::cm3, ncomponents=2);
|
||||
CuBe->AddElement(Cu, fractionmass = 98.0*CLHEP::perCent);
|
||||
CuBe->AddElement(Be, fractionmass = 2.0*CLHEP::perCent);
|
||||
|
||||
// Brass
|
||||
G4Material* brass = new G4Material("Brass", density= 8.40*CLHEP::g/CLHEP::cm3, ncomponents=2);
|
||||
brass -> AddElement(Zn, fractionmass = 30*CLHEP::perCent);
|
||||
@@ -2000,3 +2128,8 @@ void musrDetectorConstruction::SetColourOfLogicalVolume(G4LogicalVolume* pLogVol
|
||||
}
|
||||
}
|
||||
|
||||
void musrDetectorConstruction::SetWriteFile(const G4String& fname)
|
||||
{
|
||||
fWriteFile = fname;
|
||||
fWriteChoice = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user