From 766c677c998f23bb2efff330d6741048f5ebe376 Mon Sep 17 00:00:00 2001 From: Michal Mazurek <michal.mazurek@cern.ch> Date: Tue, 14 Dec 2021 13:40:35 +0100 Subject: [PATCH 1/3] Use DD4HEP in a dedicated platform --- Sim/DD4hepCnv/CMakeLists.txt | 2 ++ Sim/GaussCalo/CMakeLists.txt | 6 +++++- Sim/GaussCalo/src/EcalSensDet.cpp | 15 ++++++++++----- Sim/GaussCalo/src/HcalSensDet.cpp | 15 ++++++++++----- Sim/GaussCalo/src/SpdPrsSensDet.cpp | 12 +++++------- 5 files changed, 32 insertions(+), 18 deletions(-) diff --git a/Sim/DD4hepCnv/CMakeLists.txt b/Sim/DD4hepCnv/CMakeLists.txt index 8a6caf2db..2685ee4e0 100644 --- a/Sim/DD4hepCnv/CMakeLists.txt +++ b/Sim/DD4hepCnv/CMakeLists.txt @@ -13,6 +13,7 @@ ################################################################################ gaudi_subdir(DD4hepCnv v1r0) +if(USE_DD4HEP) gaudi_depends_on_subdirs(Sim/GiGaMTFactories Sim/GiGaMTCore Sim/SimInterfaces @@ -39,3 +40,4 @@ gaudi_add_module(DD4hepCnv src/component/*.cpp INCLUDE_DIRS Tools/ClhepTools GiGaMTGeo LbDD4hep DD4hep LINK_LIBRARIES ${GEANT4_LIBS} DD4hep ${DD4hep_COMPONENT_LIBRARIES} ROOT GiGaMTCoreRunLib GiGaMTDD4hepLib GaussTrackerLib) +endif() diff --git a/Sim/GaussCalo/CMakeLists.txt b/Sim/GaussCalo/CMakeLists.txt index f178b4d90..2f58a17c4 100644 --- a/Sim/GaussCalo/CMakeLists.txt +++ b/Sim/GaussCalo/CMakeLists.txt @@ -30,6 +30,10 @@ include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${Geant4_ gaudi_add_module(GaussCalo src/*.cpp INCLUDE_DIRS AIDA GiGaMTFactories DD4hep - LINK_LIBRARIES CaloDetLib MCEvent LHCbKernel GiGaMTCoreTruthLib GaudiAlgLib DD4hep::DDG4) + LINK_LIBRARIES CaloDetLib MCEvent LHCbKernel GiGaMTCoreTruthLib GaudiAlgLib) + +if(USE_DD4HEP) +target_link_libraries(GaussCalo DD4hep::DDG4) +endif() gaudi_env(SET GAUSSCALOOPTS \${GAUSSCALOROOT}/options) diff --git a/Sim/GaussCalo/src/EcalSensDet.cpp b/Sim/GaussCalo/src/EcalSensDet.cpp index 363fb5db3..940550214 100755 --- a/Sim/GaussCalo/src/EcalSensDet.cpp +++ b/Sim/GaussCalo/src/EcalSensDet.cpp @@ -154,8 +154,6 @@ bool EcalSensDet<CELLGETTER>::timing( } #include "CaloSensDetFAC.h" -#include "CellFromLHCbGeo.h" -#include "CellFromDD4hep.h" template <typename CELLGETTER> class EcalSensDetFAC : public CaloSensDetFAC<EcalSensDet<CELLGETTER>> { @@ -194,9 +192,16 @@ class EcalSensDetFAC : public CaloSensDetFAC<EcalSensDet<CELLGETTER>> { } }; -// Declaration of the Tool Factory -typedef EcalSensDetFAC<CellFromLHCbGeo> EcalSensDetLHCbGeoFAC; +#ifndef USE_DD4HEP + +#include "CellFromLHCbGeo.h" +using EcalSensDetLHCbGeoFAC = EcalSensDetFAC<CellFromLHCbGeo>; DECLARE_COMPONENT_WITH_ID(EcalSensDetLHCbGeoFAC, "EcalSensDet") -typedef EcalSensDetFAC<CellFromDD4hep> EcalSensDetDD4hepFAC; +#else + +#include "CellFromDD4hep.h" +using EcalSensDetDD4hepFAC = EcalSensDetFAC<CellFromDD4hep>; DECLARE_COMPONENT_WITH_ID(EcalSensDetDD4hepFAC, "EcalSensDetDD4hep") + +#endif diff --git a/Sim/GaussCalo/src/HcalSensDet.cpp b/Sim/GaussCalo/src/HcalSensDet.cpp index 6b2a5d763..b0225f94d 100755 --- a/Sim/GaussCalo/src/HcalSensDet.cpp +++ b/Sim/GaussCalo/src/HcalSensDet.cpp @@ -144,8 +144,6 @@ bool HcalSensDet<CELLGETTER>::timing( } #include "CaloSensDetFAC.h" -#include "CellFromLHCbGeo.h" -#include "CellFromDD4hep.h" template <typename CELLGETTER> class HcalSensDetFAC : public CaloSensDetFAC<HcalSensDet<CELLGETTER>> { @@ -162,9 +160,16 @@ class HcalSensDetFAC : public CaloSensDetFAC<HcalSensDet<CELLGETTER>> { } }; -// Declaration of the Tool Factory -typedef HcalSensDetFAC<CellFromLHCbGeo> HcalSensDetLHCbGeoFAC; +#ifndef USE_DD4HEP + +#include "CellFromLHCbGeo.h" +using HcalSensDetLHCbGeoFAC = HcalSensDetFAC<CellFromLHCbGeo>; DECLARE_COMPONENT_WITH_ID(HcalSensDetLHCbGeoFAC, "HcalSensDet") -typedef HcalSensDetFAC<CellFromDD4hep> HcalSensDetDD4hepFAC; +#else + +#include "CellFromDD4hep.h" +using HcalSensDetDD4hepFAC = HcalSensDetFAC<CellFromDD4hep>; DECLARE_COMPONENT_WITH_ID(HcalSensDetDD4hepFAC, "HcalSensDetDD4hep") + +#endif diff --git a/Sim/GaussCalo/src/SpdPrsSensDet.cpp b/Sim/GaussCalo/src/SpdPrsSensDet.cpp index e8fc01032..37e7aeafc 100755 --- a/Sim/GaussCalo/src/SpdPrsSensDet.cpp +++ b/Sim/GaussCalo/src/SpdPrsSensDet.cpp @@ -167,8 +167,6 @@ bool SpdPrsSensDet<CELLGETTER>::timing } #include "CaloSensDetFAC.h" -#include "CellFromLHCbGeo.h" -#include "CellFromDD4hep.h" template <typename CELLGETTER> class SpdPrsSensDetFAC @@ -194,9 +192,9 @@ class SpdPrsSensDetFAC }; -// Declaration of the Tool Factory -typedef SpdPrsSensDetFAC<CellFromLHCbGeo> SpdPrsSensDetLHCbGeoFAC; -DECLARE_COMPONENT_WITH_ID( SpdPrsSensDetLHCbGeoFAC, "SpdPrsSensDet" ) +#ifndef USE_DD4HEP +#include "CellFromLHCbGeo.h" -typedef SpdPrsSensDetFAC<CellFromDD4hep> SpdPrsSensDetDD4hepFAC; -DECLARE_COMPONENT_WITH_ID( SpdPrsSensDetDD4hepFAC, "SpdPrsSensDetDD4hep" ) +using SpdPrsSensDetLHCbGeoFAC = SpdPrsSensDetFAC<CellFromLHCbGeo>; +DECLARE_COMPONENT_WITH_ID( SpdPrsSensDetLHCbGeoFAC, "SpdPrsSensDet" ) +#endif -- GitLab From 1267a67d98aca8930bc96aa33a6c77001d918520 Mon Sep 17 00:00:00 2001 From: Michal Mazurek <michal.mazurek@cern.ch> Date: Wed, 15 Dec 2021 17:05:41 +0100 Subject: [PATCH 2/3] Conditional DD4HEP in GaussCalo --- Sim/GaussCalo/CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Sim/GaussCalo/CMakeLists.txt b/Sim/GaussCalo/CMakeLists.txt index 2f58a17c4..c6ee9c1ec 100644 --- a/Sim/GaussCalo/CMakeLists.txt +++ b/Sim/GaussCalo/CMakeLists.txt @@ -20,19 +20,23 @@ gaudi_depends_on_subdirs(Det/CaloDet Sim/GiGaMTCore Sim/GiGaMTFactories) +if(USE_DD4HEP) + AddDD4hepDDG4() +endif() + find_package(AIDA) AddHepMC3() -AddDD4hepDDG4() find_package(Boost) find_package(CLHEP) include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${Geant4_INCLUDE_DIRS}) gaudi_add_module(GaussCalo src/*.cpp - INCLUDE_DIRS AIDA GiGaMTFactories DD4hep + INCLUDE_DIRS AIDA GiGaMTFactories LINK_LIBRARIES CaloDetLib MCEvent LHCbKernel GiGaMTCoreTruthLib GaudiAlgLib) if(USE_DD4HEP) +target_include_directories(GaussCalo DD4hep) target_link_libraries(GaussCalo DD4hep::DDG4) endif() -- GitLab From 9bbe90c242a38d11206e1b265c84fc66d7c587a1 Mon Sep 17 00:00:00 2001 From: Michal Mazurek <michal.mazurek@cern.ch> Date: Thu, 16 Dec 2021 12:47:17 +0100 Subject: [PATCH 3/3] Fix dd4hep include_directories --- Sim/GaussCalo/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sim/GaussCalo/CMakeLists.txt b/Sim/GaussCalo/CMakeLists.txt index c6ee9c1ec..bf4e86b7c 100644 --- a/Sim/GaussCalo/CMakeLists.txt +++ b/Sim/GaussCalo/CMakeLists.txt @@ -22,6 +22,7 @@ gaudi_depends_on_subdirs(Det/CaloDet if(USE_DD4HEP) AddDD4hepDDG4() + include_directories(DD4hep) endif() find_package(AIDA) @@ -36,8 +37,7 @@ gaudi_add_module(GaussCalo LINK_LIBRARIES CaloDetLib MCEvent LHCbKernel GiGaMTCoreTruthLib GaudiAlgLib) if(USE_DD4HEP) -target_include_directories(GaussCalo DD4hep) -target_link_libraries(GaussCalo DD4hep::DDG4) + target_link_libraries(GaussCalo DD4hep::DDG4) endif() gaudi_env(SET GAUSSCALOOPTS \${GAUSSCALOROOT}/options) -- GitLab