Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possibility to include SDHCalContent and AprilContent #26

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build/
lib/
31 changes: 30 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,44 @@ FIND_PACKAGE( DD4hep REQUIRED )
FIND_PACKAGE( ROOT REQUIRED )
FIND_PACKAGE( MarlinTrk REQUIRED )

OPTION( USE_SDHCALCONTENT "Use SDHCALContent" OFF )
OPTION( USE_APRILCONTENT "Use APRILContent" OFF )

FOREACH( pkg PandoraSDK Marlin MarlinUtil LCContent DD4hep ROOT MarlinTrk )
FOREACH( pkg PandoraSDK Marlin MarlinUtil LCContent DD4hep ROOT MarlinTrk )
IF( ${pkg}_FOUND )
INCLUDE_DIRECTORIES( SYSTEM ${${pkg}_INCLUDE_DIRS} )
LINK_LIBRARIES( ${${pkg}_LIBRARIES} )
ADD_DEFINITIONS ( ${${pkg}_DEFINITIONS} )
ENDIF()
ENDFOREACH()

IF( USE_SDHCALCONTENT )
FIND_PACKAGE( SDHCALContent REQUIRED )
IF( SDHCALContent_FOUND )
INCLUDE_DIRECTORIES( SYSTEM ${SDHCALContent_INCLUDE_DIRS} )
LINK_LIBRARIES( ${SDHCALContent_LIBRARIES} )
ADD_DEFINITIONS ( ${SDHCALContent_DEFINITIONS} )
ADD_DEFINITIONS( "-DSDHCALCONTENT" )
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ADD_DEFINITIONS( "-DSDHCALCONTENT" )
ADD_DEFINITIONS( "SDHCALCONTENT" )

Cmake will add the -D where necessary

ENDIF()
ENDIF()

IF( USE_APRILCONTENT )
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
FIND_PACKAGE( APRILContent REQUIRED )
FIND_PACKAGE( mlpack REQUIRED )
IF( APRILContent_FOUND )
INCLUDE_DIRECTORIES( SYSTEM ${APRILContent_INCLUDE_DIRS} )
LINK_LIBRARIES( ${APRILContent_LIBRARIES} )
ADD_DEFINITIONS ( ${APRILContent_DEFINITIONS} )
ADD_DEFINITIONS( "-DAPRILCONTENT" )
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ADD_DEFINITIONS( "-DAPRILCONTENT" )
ADD_DEFINITIONS( "APRILCONTENT" )

ENDIF()
IF( mlpack_FOUND )
INCLUDE_DIRECTORIES( SYSTEM ${mlpack_INCLUDE_DIRS} )
LINK_LIBRARIES( ${mlpack_LIBRARIES} )
ADD_DEFINITIONS ( ${mlpack_DEFINITIONS} )
ENDIF()
ENDIF()

IF( PANDORA_MONITORING )
FIND_PACKAGE( PandoraMonitoring 03.00.00 REQUIRED )
IF( PandoraMonitoring_FOUND )
Expand Down
18 changes: 18 additions & 0 deletions cmake/Findmlpack.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
IF(NOT DEFINED mlpack_DIR)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mlpack should come with a cmake config file, so this findmlpack should not be needed
https://github.com/mlpack/mlpack/blob/master/CMake/mlpack-config.cmake.in

MESSAGE(STATUS "Warning: it is mandorary to define mlpack_DIR.")
Copy link
Contributor Author

@andresailer andresailer Mar 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
MESSAGE(STATUS "Warning: it is mandorary to define mlpack_DIR.")
MESSAGE(FATAL_ERROR "It is mandatory to define mlpack_DIR.")

ENDIF()

IF (NOT DEFINED mlpack_INCLUDE_DIRS)
SET(mlpack_INCLUDE_DIRS ${mlpack_DIR}/include)
ENDIF()

# Check mlpack core header file
FIND_PATH(mlpack_CORE_HPP_DIR NAMES core.hpp HINTS ${mlpack_INCLUDE_DIRS}/mlpack)

# Check mlpack library
#FIND_LIBRARY(mlpack_LIBRARIES NAMES mlpack HINTS ${mlpack_DIR}/*)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(mlpack DEFAULT_MSG mlpack_CORE_HPP_DIR)

IF(NOT mlpack_FOUND)
MESSAGE(FATAL_ERROR "The mlpack package not found.")
ENDIF()
14 changes: 12 additions & 2 deletions src/DDPandoraPFANewProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@
#include "marlin/Global.h"
#include "marlin/Exceptions.h"


#include "Api/PandoraApi.h"

#include "LCContent.h"
#include "LCPlugins/LCSoftwareCompensation.h"

#ifdef SDHCALCONTENT
#include "SDHCALContent.h"
#endif

#ifdef APRILCONTENT
#include "APRILContent.h"
#endif

#include "DDExternalClusteringAlgorithm.h"
#include "DDPandoraPFANewProcessor.h"

Expand All @@ -29,7 +36,6 @@

#include "DDBFieldPlugin.h"


#include <cstdlib>

DDPandoraPFANewProcessor aDDPandoraPFANewProcessor;
Expand Down Expand Up @@ -296,6 +302,10 @@ pandora::StatusCode DDPandoraPFANewProcessor::RegisterUserComponents() const
PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, LCContent::RegisterAlgorithms(*m_pPandora));
PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, LCContent::RegisterBasicPlugins(*m_pPandora));

#ifdef SDHCALCONTENT
PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, SDHCALContent::RegisterEnergyCorrections(*m_pPandora));
#endif

if(m_settings.m_useDD4hepField)
{
dd4hep::Detector& mainDetector = dd4hep::Detector::getInstance();
Expand Down
Loading