Skip to content

Commit 2a54e2e

Browse files
committed
Integrate Pythia6 source code and linking
ROOT deprecates support for TPythia6[Decayer]. This commit works around this by moving relevant code from ROOT to AEGIS and by also modifying the CMake files to find and link against Pythia6.
1 parent f33d224 commit 2a54e2e

File tree

5 files changed

+73
-4
lines changed

5 files changed

+73
-4
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
22

33
project(AEGIS)
44

5+
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
6+
57
add_subdirectory(MICROCERN)
68

79
add_subdirectory(TEPEMGEN)

GeneratorParam/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ list(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})
99
#---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS)
1010
find_package(ROOT REQUIRED COMPONENTS EG)
1111

12+
find_package(Pythia6)
13+
1214
#---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
1315
include(${ROOT_USE_FILE})
1416

@@ -21,13 +23,13 @@ endif()
2123

2224
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/.)
2325

24-
set(HEADERS GeneratorParam.h GeneratorParamLibBase.h GeneratorParamMUONlib.h GeneratorParamEMlib.h GeneratorParamEMlibV2.h PythiaDecayerConfig.h ExodusDecayer.h)
26+
set(HEADERS GeneratorParam.h GeneratorParamLibBase.h GeneratorParamMUONlib.h GeneratorParamEMlib.h GeneratorParamEMlibV2.h PythiaDecayerConfig.h ExodusDecayer.h TPythia6Decayer.h TPythia6.h TMCParticle.h)
2527

2628
ROOT_GENERATE_DICTIONARY(G__GeneratorParam ${HEADERS} LINKDEF GeneratorParamLinkDef.h)
2729

2830
#---Create a shared library with geneated dictionary
29-
add_library(GeneratorParam SHARED GeneratorParam.cxx GeneratorParamLibBase.cxx GeneratorParamMUONlib.cxx GeneratorParamEMlib.cxx GeneratorParamEMlibV2.cxx PythiaDecayerConfig.cxx ExodusDecayer.cxx G__GeneratorParam.cxx)
30-
target_link_libraries(GeneratorParam ${ROOT_LIBRARIES} ${VMC_LIBRARIES})
31+
add_library(GeneratorParam SHARED GeneratorParam.cxx GeneratorParamLibBase.cxx GeneratorParamMUONlib.cxx GeneratorParamEMlib.cxx GeneratorParamEMlibV2.cxx PythiaDecayerConfig.cxx ExodusDecayer.cxx TPythia6.cxx TPythia6Decayer.cxx TMCParticle.cxx G__GeneratorParam.cxx)
32+
target_link_libraries(GeneratorParam ${ROOT_LIBRARIES} ${VMC_LIBRARIES} ${PYTHIA6_LIBRARY})
3133

3234

3335
set_target_properties(GeneratorParam

GeneratorParam/GeneratorParamLinkDef.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@
1111
#pragma link C++ class GeneratorParamEMlibV2+;
1212
#pragma link C++ class PythiaDecayerConfig+;
1313
#pragma link C++ class ExodusDecayer+;
14+
#pragma link C++ class TPythia6+;
15+
#pragma link C++ class TPythia6Decayer+;
16+
#pragma link C++ class TMCParticle+;
1417

1518
#endif

GeneratorParam/PythiaDecayerConfig.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
// Allows to force decay channels.
2020
2121

22-
#include <TPythia6.h>
2322
#include <TLorentzVector.h>
2423
#include "ExodusDecayer.h"
2524

25+
class TPythia6;
26+
2627
typedef enum {
2728
kBSemiElectronic,
2829
kSemiElectronic,

cmake/modules/FindPythia6.cmake

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Copyright (C) 1995-2019, Rene Brun and Fons Rademakers.
2+
# All rights reserved.
3+
#
4+
# For the licensing terms see $ROOTSYS/LICENSE.
5+
# For the list of contributors see $ROOTSYS/README/CREDITS.
6+
7+
# File taken from ROOT project
8+
9+
# - Locate pythia6 library
10+
# Defines:
11+
#
12+
# PYTHIA6_FOUND
13+
# PYTHIA6_INCLUDE_DIR
14+
# PYTHIA6_INCLUDE_DIRS (not cached)
15+
# PYTHIA6_LIBRARY
16+
# PYTHIA6_LIBRARY_DIR (not cached)
17+
# PYTHIA6_LIBRARIES (not cached)
18+
19+
set(_pythia6dirs
20+
${PYTHIA6}
21+
$ENV{PYTHIA6}
22+
${PYTHIA6_DIR}
23+
$ENV{PYTHIA6_DIR})
24+
25+
find_path(PYTHIA6_INCLUDE_DIR general_pythia.inc
26+
HINTS ${_pythia6dirs}
27+
PATH_SUFFIXES include
28+
DOC "Specify the Pythia6 include dir here.")
29+
30+
if(PYTHIA6_INCLUDE_DIR)
31+
set(PYTHIA6_INCLUDE_DIRS ${PYTHIA6_INCLUDE_DIR})
32+
endif()
33+
34+
find_library(PYTHIA6_LIBRARY NAMES pythia6 Pythia6
35+
HINTS ${_pythia6dirs}
36+
PATH_SUFFIXES lib
37+
DOC "Specify the Pythia6 library here.")
38+
39+
set(PYTHIA6_LIBRARIES ${PYTHIA6_LIBRARY})
40+
41+
foreach(lib rootinterface pythia6_dummy)
42+
find_library(PYTHIA6_${lib}_LIBRARY NAMES ${lib}
43+
HINTS ${_pythia6dirs}
44+
PATH_SUFFIXES lib
45+
DOC "Specify the Pythia rootinterface library here.")
46+
if(PYTHIA6_${lib}_LIBRARY)
47+
list(APPEND PYTHIA6_LIBRARIES ${PYTHIA6_${lib}_LIBRARY})
48+
endif()
49+
endforeach()
50+
51+
get_filename_component(PYTHIA6_LIBRARY_DIR ${PYTHIA6_LIBRARY} PATH)
52+
53+
# handle the QUIETLY and REQUIRED arguments and set PHOTOS_FOUND to TRUE if
54+
# all listed variables are TRUE
55+
56+
include(FindPackageHandleStandardArgs)
57+
find_package_handle_standard_args(Pythia6 DEFAULT_MSG PYTHIA6_LIBRARY)
58+
59+
mark_as_advanced(PYTHIA6_INCLUDE_DIR
60+
PYTHIA6_LIBRARY
61+
PYTHIA6_rootinterface_LIBRARY)

0 commit comments

Comments
 (0)