Skip to content
Snippets Groups Projects
Commit 998ac6ea authored by Joseph Boudreau's avatar Joseph Boudreau
Browse files

.

parent b1169820
No related branches found
No related tags found
1 merge request!188.
......@@ -34,6 +34,12 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
else()
message (STATUS "HEPMC3 Disabled in FullSimLight")
endif()
if(FullSimLight_HAS_Pythia)
add_compile_definitions( USE_Pythia )
message (STATUS "Pythia Enabled in FullSimLight")
else()
message (STATUS "Pythia Disabled in FullSimLight")
endif()
else()
# I am called from other project with add_subdirectory().
message( STATUS "Building ${PROJECT_NAME} as part of the root GeoModel project.")
......@@ -43,6 +49,9 @@ else()
if(GEOMODEL_USE_HEPMC3)
add_compile_definitions( USE_HEPMC3 )
endif()
if(GEOMODEL_USE_PYTHIA)
add_compile_definitions( USE_Pythia )
endif()
endif()
......
......@@ -244,6 +244,14 @@ FSLMainWindow::FSLMainWindow(QWidget *parent)
"it.");
ui->groupBox_hepmc3->setTitle("HepMC3 [disabled]");
#endif
#ifndef USE_Pythia
ui->cB_gen_options->setItemData(1, false, Qt::UserRole - 1);
ui->groupBox_pythia->setEnabled(false);
ui->groupBox_pythia->setToolTip(
"Support for Pythia is disabled. Refer to the documentation to enable "
"it.");
ui->groupBox_pythia->setTitle("Pythia [disabled]");
#endif
}
FSLMainWindow::~FSLMainWindow() {
......@@ -907,8 +915,9 @@ void FSLMainWindow::configure_generator() {
else if (generator == "Pythia") {
ui->sB_NOT->setEnabled(true);
#ifdef USE_Pythia
ui->cB_pythia_type_of_eve->setEnabled(true);
#endif
ui->cB_particle->setEnabled(false);
ui->lE_px->setEnabled(false);
ui->lE_py->setEnabled(false);
......@@ -921,14 +930,13 @@ void FSLMainWindow::configure_generator() {
ui->lE_GP->setEnabled(false);
ui->lE_HEPMC3->clear();
ui->lE_GP->clear();
#ifdef USE_Pythia
if (ui->cB_pythia_type_of_eve->currentIndex() == 3) {
pythia_type_of_event = "";
ui->pB_pythia_browse->setEnabled(true);
ui->lE_PCF->setEnabled(true);
}
else {
ui->lE_PCF->clear();
pythia_input_file = "";
......@@ -937,6 +945,7 @@ void FSLMainWindow::configure_generator() {
pythia_type_of_event =
(ui->cB_pythia_type_of_eve->currentText()).toStdString();
}
#endif
particle = "";
particle_energy = "";
......@@ -1122,7 +1131,7 @@ void FSLMainWindow::save_configuration_as() {
save_directory = (QDir::currentPath()).toStdString() + "/";
QString fileName = QFileDialog::getSaveFileName(
this, tr("Save Configuration"), save_directory.c_str(),
this, tr("Save Configuration"), (save_directory+"fsl.json").c_str(),
tr("Configuration Files (*.json)"));
if (fileName.isEmpty()) return;
std::string save_file = fileName.toStdString();
......@@ -1335,6 +1344,7 @@ void FSLMainWindow::load_configuration() {
else if (generator == "Pythia") {
ui->sB_NOT->setEnabled(true);
#ifdef USE_Pythia
ui->cB_gen_options->setCurrentIndex(1);
ui->cB_pythia_type_of_eve->setEnabled(true);
......@@ -1356,7 +1366,7 @@ void FSLMainWindow::load_configuration() {
ui->pB_pythia_browse->setEnabled(true);
ui->lE_PCF->setEnabled(true);
}
#endif
ui->lE_px->clear();
ui->lE_py->clear();
ui->lE_pz->clear();
......@@ -1780,7 +1790,7 @@ void FSLMainWindow::load_configuration_CL(std::string config_file_path) {
else if (generator == "Pythia") {
ui->sB_NOT->setEnabled(true);
#ifdef USE_Pythia
ui->cB_gen_options->setCurrentIndex(1);
ui->cB_pythia_type_of_eve->setEnabled(true);
......@@ -1802,7 +1812,7 @@ void FSLMainWindow::load_configuration_CL(std::string config_file_path) {
ui->pB_pythia_browse->setEnabled(true);
ui->lE_PCF->setEnabled(true);
}
#endif
ui->lE_px->clear();
ui->lE_py->clear();
ui->lE_pz->clear();
......
......@@ -69,6 +69,26 @@ if(HepMC3_FOUND)
add_compile_definitions( USE_HEPMC3 )
endif()
# Support for Pythia event generator
# This is OFF by default, but it can be enbled by the user if used/needed;
# for that, of course, Pythia must be installed on the system.
option(GEOMODEL_USE_PYTHIA "Build GeoModel tools with support for the Pythia event generator (Note: Pythia must be installed on the target machine)" OFF )
if(GEOMODEL_USE_PYTHIA)
find_package(Pythia REQUIRED) # if support for Pythia is enabled, it must be installed.
endif()
if(Pythia_FOUND)
message (STATUS "Found Pythia: ${Pythia_INCLUDE_DIR}")
add_compile_definitions( USE_PYTHIA )
else()
message (STATUS "Pythia not found, will be skipped")
endif()
#----------------------------------------------------------------------------
# Setup Geant4 include directories and compile definitions
......@@ -139,13 +159,6 @@ add_executable(gmgeantino geantinoMaps.cc ${sources} ${headers})
add_executable(gm2gdml geoModel2GDML.cc ${sources} ${headers})
# Support for the Pythia MC generator
find_package(Pythia QUIET) # optional
if(Pythia_FOUND)
target_compile_definitions(fullSimLight PRIVATE USE_PYTHIA)
target_link_libraries(fullSimLight PRIVATE Pythia::Pythia)
endif()
#if(HEPMC3_ROOTIO_USE)
......@@ -223,6 +236,13 @@ if( HepMC3_FOUND)
target_include_directories(gm2gdml PUBLIC ${HEPMC3_INCLUDE_DIR})
endif()
if(Pythia_FOUND)
target_compile_definitions(fullSimLight PRIVATE USE_PYTHIA)
target_link_libraries(fullSimLight PRIVATE Pythia::Pythia)
target_compile_definitions(gmgeantino PRIVATE USE_PYTHIA)
target_link_libraries(gmgeantino PRIVATE Pythia::Pythia)
endif()
# Check if we are building FullSimLight individually,
# or as a part of the main GeoModel.
......
......@@ -5,6 +5,7 @@ include( ${SELF_DIR}/FullSimLightTargets.cmake )
# Set the version of the installed project.
set( FullSimLight_VERSION "@PROJECT_VERSION@" )
set( FullSimLight_HAS_HEPMC3 @GEOMODEL_USE_HEPMC3@ )
set( FullSimLight_HAS_Pythia @GEOMODEL_USE_PYTHIA@ )
# Print some standard messages about the package being found.
include( FindPackageHandleStandardArgs )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment