From 0009882edc24ed550c580a8bdf0e30fd918568f7 Mon Sep 17 00:00:00 2001 From: Markus Frank <Markus.Frank@cern.ch> Date: Mon, 21 Nov 2016 18:08:25 +0100 Subject: [PATCH] Improve generic conditions data binding --- DDCore/include/DD4hep/Alignments.h | 4 +-- DDCore/include/DD4hep/Dictionary.h | 1 + DDCore/src/Alignments.cpp | 33 ++++++++++------------ DDCore/src/Evaluator/setStdMath.cpp | 22 +++++++-------- DDCore/src/Printout.cpp | 4 +++ DDSegmentation/src/MegatileLayerGridXY.cpp | 4 +-- cmake/run_test.sh | 7 ++--- 7 files changed, 37 insertions(+), 38 deletions(-) diff --git a/DDCore/include/DD4hep/Alignments.h b/DDCore/include/DD4hep/Alignments.h index 218ce7370..7a0668411 100644 --- a/DDCore/include/DD4hep/Alignments.h +++ b/DDCore/include/DD4hep/Alignments.h @@ -103,7 +103,7 @@ namespace DD4hep { /// Constructor to be used when reading the already parsed object template <typename Q> Alignment(const Handle<Q>& e) : Handle<Object>(e) {} /// Object constructor for pure alignment objects -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__clang__) Alignment(const std::string& name) ; #else template <typename Q=Interna::AlignmentNamedObject> Alignment(const std::string& name); @@ -166,7 +166,7 @@ namespace DD4hep { /// Constructor to be used when reading the already parsed object template <typename Q> AlignmentCondition(const Handle<Q>& e) : Handle<Object>(e) {} /// Object constructor for pure alignment objects -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__clang__) AlignmentCondition(const std::string& name) ; #else template <typename Q=Object> AlignmentCondition(const std::string& name); diff --git a/DDCore/include/DD4hep/Dictionary.h b/DDCore/include/DD4hep/Dictionary.h index 82258f7f4..956246a85 100644 --- a/DDCore/include/DD4hep/Dictionary.h +++ b/DDCore/include/DD4hep/Dictionary.h @@ -24,6 +24,7 @@ #pragma GCC diagnostic ignored "-Wdeprecated" #pragma GCC diagnostic ignored "-Wunused" #endif + // Framework include files #include "XML/Evaluator.h" #include "DD4hep/DetAlign.h" diff --git a/DDCore/src/Alignments.cpp b/DDCore/src/Alignments.cpp index 6a05bd070..21722e7c3 100644 --- a/DDCore/src/Alignments.cpp +++ b/DDCore/src/Alignments.cpp @@ -22,35 +22,32 @@ using namespace std; using namespace DD4hep::Alignments; - /// Namespace for the AIDA detector description toolkit namespace DD4hep { /// Namespace for the alignment part of the AIDA detector description toolkit namespace Alignments { -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__clang__) /// Initializing constructor to create a new object (Specialized for AlignmentNamedObject) - Alignment::Alignment(const string& nam) { - assign(new Interna::AlignmentNamedObject(nam, "alignment"), nam, "alignment"); - } + Alignment::Alignment(const string& nam) + { assign(new Interna::AlignmentNamedObject(nam, "alignment"), nam, "alignment"); } + /// Initializing constructor to create a new object (Specialized for AlignmentConditionObject) - AlignmentCondition::AlignmentCondition(const string& nam) { - assign(new AlignmentCondition::Object(nam, "alignment"), nam, "alignment"); - } + AlignmentCondition::AlignmentCondition(const string& nam) + { assign(new AlignmentCondition::Object(nam, "alignment"), nam, "alignment"); } #else + /// Initializing constructor to create a new object (Specialized for AlignmentData) + template <> Alignment::Alignment<AlignmentData>(const string& nam) + { assign(new AlignmentData(), nam, "alignment"); } + /// Initializing constructor to create a new object (Specialized for AlignmentNamedObject) - template <> Alignment::Alignment<AlignmentData>(const string& nam) { - assign(new Alignment::Object(), nam, "alignment"); - } - /// Initializing constructor to create a new object (Specialized for AlignmentNamedObject) - template <> Alignment::Alignment<Interna::AlignmentNamedObject>(const string& nam) { - assign(new Interna::AlignmentNamedObject(nam, "alignment"), nam, "alignment"); - } + template <> Alignment::Alignment<Interna::AlignmentNamedObject>(const string& nam) + { assign(new Interna::AlignmentNamedObject(nam, "alignment"), nam, "alignment"); } + /// Initializing constructor to create a new object (Specialized for AlignmentConditionObject) - template <> AlignmentCondition::AlignmentCondition<Interna::AlignmentConditionObject>(const string& nam) { - assign(new Object(nam, "alignment"), nam, "alignment"); - } + template <> AlignmentCondition::AlignmentCondition<Interna::AlignmentConditionObject>(const string& nam) + { assign(new Object(nam, "alignment"), nam, "alignment"); } #endif } /* End namespace Aligments */ } /* End namespace DD4hep */ diff --git a/DDCore/src/Evaluator/setStdMath.cpp b/DDCore/src/Evaluator/setStdMath.cpp index f772d97d4..e88a784c6 100644 --- a/DDCore/src/Evaluator/setStdMath.cpp +++ b/DDCore/src/Evaluator/setStdMath.cpp @@ -16,7 +16,7 @@ static double eval_fmod (double a, double b) { return std::fmod(a,b); } static double eval_min (double a, double b) { return (a < b) ? a : b; } static double eval_max (double a, double b) { return (a > b) ? a : b; } static double eval_sqrt (double a) { return std::sqrt(a); } -static double eval_cbrt (double a) { return ::cbrt(a); } +static double eval_cbrt (double a) { return ::cbrt(a); } static double eval_pow (double a, double b) { return std::pow(a,b); } static double eval_sin (double a) { return std::sin(a); } static double eval_cos (double a) { return std::cos(a); } @@ -29,27 +29,27 @@ static double eval_sinh (double a) { return std::sinh(a); } static double eval_cosh (double a) { return std::cosh(a); } static double eval_tanh (double a) { return std::tanh(a); } static double eval_exp (double a) { return std::exp(a); } -static double eval_exp2 (double a) { return ::exp2(a); } +static double eval_exp2 (double a) { return ::exp2(a); } //static double eval_exp10(double a) { return ::exp10(a); } static double eval_exp10(double a) { return ::pow(10.,a) ; } -static double eval_expm1(double a) { return ::expm1(a); } +static double eval_expm1(double a) { return ::expm1(a); } static double eval_log (double a) { return std::log(a); } -static double eval_logb (double a) { return ::logb(a); } +static double eval_logb (double a) { return ::logb(a); } static double eval_log10(double a) { return std::log10(a); } -static double eval_log1p(double a) { return ::log1p(a); } -static double eval_hypot(double a, double b) { return ::hypot(a,b); } -static double eval_erf (double a) { return ::erf(a); } -static double eval_erfc (double a) { return ::erfc(a); } -static double eval_gamma(double a) { return ::gamma(a); } +static double eval_log1p(double a) { return ::log1p(a); } +static double eval_hypot(double a, double b) { return ::hypot(a,b); } +static double eval_erf (double a) { return ::erf(a); } +static double eval_erfc (double a) { return ::erfc(a); } +static double eval_gamma(double a) { return ::tgamma(a); } static double eval_double(double a) { return a; } static double eval_int (double a) { return (double)int(a); } static double eval_nint (double a) { return std::floor(a); } static double eval_floor(double a) { return std::floor(a); } -static double eval_round(double a) { return ::round(a); } +static double eval_round(double a) { return ::round(a); } static double eval_ceil (double a) { return std::ceil(a); } static double eval_isnan(double a) { return std::isnan(a); } static double eval_isinf(double a) { return std::isinf(a); } -static double eval_nearbyint(double a) { return ::nearbyint(a); } +static double eval_nearbyint(double a) { return ::nearbyint(a); } namespace XmlTools { diff --git a/DDCore/src/Printout.cpp b/DDCore/src/Printout.cpp index 59ce77b5d..9b29dd48d 100644 --- a/DDCore/src/Printout.cpp +++ b/DDCore/src/Printout.cpp @@ -18,6 +18,10 @@ #include <cstring> #include <cstdarg> #include <stdexcept> +// Disable some diagnostics for ROOT dictionaries +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wvarargs" +#endif using namespace std; diff --git a/DDSegmentation/src/MegatileLayerGridXY.cpp b/DDSegmentation/src/MegatileLayerGridXY.cpp index cbe1cebb0..ad4854d07 100644 --- a/DDSegmentation/src/MegatileLayerGridXY.cpp +++ b/DDSegmentation/src/MegatileLayerGridXY.cpp @@ -9,8 +9,8 @@ #include "DDSegmentation/MegatileLayerGridXY.h" #undef NDEBUG +#include <cmath> #include <cassert> - #include <algorithm> namespace DD4hep { @@ -73,7 +73,7 @@ namespace DD4hep { cellPosition.X = cellIndexX * (_currentSegInfo.megaTileSizeX / _currentSegInfo.nCellsX ) + _currentSegInfo.megaTileOffsetX; cellPosition.Y = cellIndexY * (_currentSegInfo.megaTileSizeY / _currentSegInfo.nCellsY ) + _currentSegInfo.megaTileOffsetY; - if ( std::fabs( cellPosition.X )>10000e0 || std::fabs( cellPosition.Y )>10000e0 ) { + if ( fabs( cellPosition.X )>10000e0 || fabs( cellPosition.Y )>10000e0 ) { std::cout << "crazy cell position: " << cellPosition.X << " " << cellPosition.Y << std::endl; std::cout << "layer, wafer, cellx,y indices: " << layerIndex << " " << waferIndex << " " << cellIndexX << " " << cellIndexY << std::endl; diff --git a/cmake/run_test.sh b/cmake/run_test.sh index a4e69f81b..fa8772271 100755 --- a/cmake/run_test.sh +++ b/cmake/run_test.sh @@ -9,10 +9,7 @@ # ---- initialize DD4hep for this shell . @CMAKE_INSTALL_PREFIX@/bin/thisdd4hep.sh -if [ @USE_DYLD@ ]; -then - export DYLD_LIBRARY_PATH=${DD4HEP_LIBRARY_PATH}:${DYLD_LIBRARY_PATH}; -fi; + #----- parse command line - first argument is the # test to run command=$1 @@ -24,4 +21,4 @@ for i in "$@" ; do fi done echo "---running test : '" ${command} ${theargs} "'" -exec ${command} ${theargs} +${command} ${theargs} -- GitLab