Skip to content
Snippets Groups Projects

Changes to support complete use of RICH PMTs/panels in the reco

3 files
+ 85
76
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -17,7 +17,6 @@
#include <cstdint>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <utility>
namespace LHCb::Detector {
@@ -51,51 +50,7 @@ namespace LHCb::Detector {
// mimic 'param' method from DetDesc
template <typename TYPE>
inline auto param( std::string name ) const {
// temporary work around for different parameter names between DetDesc and dd4hep.
// To be removed once DetDesc is gone, and then the names passed should be updated
// to be the dd4hep ones.
using NameMap = std::unordered_map<std::string, std::string>;
const NameMap name_map = //
{{"Rich1GasQuartzWindowThickness", "Rh1QuartzWindowZSize"},
{"Rich2GasQuartzWindowThickness", "Rh2QuartzWindowSizeZ"},
{"SellC4F10F1Param", "SellC4F10F1"},
{"SellC4F10F2Param", "SellC4F10F2"},
{"SellC4F10E1Param", "SellC4F10E1"},
{"SellC4F10E2Param", "SellC4F10E2"},
{"SellCF4F1Param", "SellCF4F1"},
{"SellCF4F2Param", "SellCF4F2"},
{"SellCF4E1Param", "SellCF4E1"},
{"SellCF4E2Param", "SellCF4E2"},
{"GasMolWeightC4F10Param", "GasMolWeightC4F10"},
{"GasMolWeightCF4Param", "GasMolWeightCF4"},
{"RhoEffectiveSellC4F10Param", "RhoEffectiveSellC4F10"},
{"RhoEffectiveSellCF4Param", "GasRhoCF4atSTP"}, // double check this one
{"SellLorGasFacParam", "SellLorGasFac"}};
const auto mapped_name = name_map.find( name );
if ( mapped_name != name_map.end() ) { name = mapped_name->second; }
// convert template type to irritating dd4hep syntax...
try {
if constexpr ( std::is_arithmetic_v<TYPE> ) {
// deal with really (really) annoying units mis-match between dd4hep and everyone else
// to be removed once the units are corrected 'at source' to be the expected Gaudi ones.
using ScaleMap = std::unordered_map<std::string, TYPE>;
const ScaleMap scale_map = {
{"Rh1QuartzWindowZSize", TYPE( 10 )}, // cm -> mm
{"Rh2QuartzWindowSizeZ", TYPE( 10 )}, // cm -> mm
};
const auto scale = scale_map.find( name );
const auto F = ( scale == scale_map.end() ? TYPE( 1 ) : scale->second );
if constexpr ( std::is_integral_v<TYPE> ) { return F * dd4hep::_toInt( name.c_str() ); }
if constexpr ( std::is_same_v<double, TYPE> ) { return F * dd4hep::_toDouble( name.c_str() ); }
if constexpr ( std::is_same_v<float, TYPE> ) { return F * dd4hep::_toFloat( name.c_str() ); }
}
if constexpr ( std::is_same_v<std::string, TYPE> ) { return dd4hep::_toString( name.c_str() ); }
// compiler error if we get here ...
} catch ( const std::exception& e ) {
std::cerr << "ERROR : Cannot load parameter '" << name << "' as type '" << dd4hep::typeName( typeid( TYPE ) )
<< "' : " << e.what() << std::endl;
throw e;
}
return dd4hep_param<TYPE>( std::move( name ) );
}
};
Loading