Skip to content
Snippets Groups Projects

Add support for RICH readout mapping versions

7 files
+ 153
14
Compare changes
  • Side-by-side
  • Inline
Files
7
@@ -18,6 +18,7 @@
#endif
#include <cassert>
#include <utility>
namespace Rich::Detector {
@@ -27,21 +28,47 @@ namespace Rich::Detector {
using Condition = ParamValidDataObject;
#endif
// tutorial on how to use yaml-cpp can be found at
// https://github.com/jbeder/yaml-cpp/wiki/Tutorial
inline auto condition_param_exists( const Condition& cond, const std::string& paramName ) {
#ifdef USE_DD4HEP
return cond[paramName].IsDefined();
#else
return cond.exists( paramName );
#endif
}
inline auto condition_param_exists( const Condition* cond, const std::string& paramName ) {
assert( cond );
return condition_param_exists( *cond, paramName );
}
template <typename T>
inline auto condition_param( const Condition& cond, const std::string& paramName ) {
#ifdef USE_DD4HEP
// tutorial on how to use yaml-cpp can be found at
// https://github.com/jbeder/yaml-cpp/wiki/Tutorial
return cond[paramName].as<T>();
#else
return cond.param<T>( paramName );
#endif
}
template <typename T>
inline auto condition_param( const Condition* cond, const std::string& paramName ) {
assert( cond );
return condition_param<T>( *cond, paramName );
}
template <typename T>
inline auto condition_param( const Condition& cond, const std::string& paramName, const T def ) {
#ifdef USE_DD4HEP
return cond[paramName].as<T>( def );
#else
return ( condition_param_exists( cond, paramName ) ? cond.param<T>( paramName ) : def );
#endif
}
template <typename T>
inline auto condition_param( const Condition* cond, const std::string& paramName, const T def ) {
assert( cond );
return condition_param<T>( *cond, paramName, std::move( def ) );
}
} // namespace Rich::Detector
Loading