Skip to content
Snippets Groups Projects

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

1 file
+ 26
18
Compare changes
  • Side-by-side
  • Inline
@@ -60,32 +60,40 @@ namespace LHCb::Detector::detail {
{"RichPmtPixelXSize", "RhPMTPixelXSize"},
{"RichPmtPixelYSize", "RhPMTPixelYSize"},
{"RichGrandPmtPixelXSize", "RhGrandPMTPixelXSize"},
{"RichGrandPmtPixelYSize", "RhGrandPMTPixelYSize"}};
{"RichGrandPmtPixelYSize", "RhGrandPMTPixelYSize"},
{"RichPmtAnodeXSize", "RhPMTAnodeXSize"},
{"RichPmtAnodeYSize", "RhPMTAnodeYSize"},
{"RichGrandPmtAnodeXSize", "RhGrandPMTAnodeXSize"},
{"RichGrandPmtAnodeYSize", "RhGrandPMTAnodeYSize"},
{"Rich1PmtDetPlaneZInPmtPanel", "Rh1PMTDetPlaneZLocationInPhDetSupFrame"},
{"Rich2PmtDetPlaneZInPmtPanel", "Rh2MixedPMTDetPlaneZLocationInPMTPanel"}};
const auto mapped_name = name_map.find( name );
if ( mapped_name != name_map.end() ) { name = mapped_name->second; }
// // Another work around for DetDesc parameters I have not yet located the
// // equivalent of in dd4hep. So for now document them here with their values.
// using MissingMap = std::unordered_map<std::string, TYPE>;
// static const MissingMap missing_map = {{"RichPmtQWToSiMaxDist", TYPE( 10 )},
// {"'RichPmtSiliconDetectorLocalZlocation", TYPE( -4.05 )}};
// const auto missing_name = missing_map.find( name );
// if ( missing_name != missing_map.end() ) { return missing_name->second; }
// Convert inconvenient DD4HEP API to dispatch via template type
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>;
static const ScaleMap scale_map = {
{"Rh1QuartzWindowZSize", TYPE( LHCb::Detector::detail::DD4hepToLHCbCm )}, // cm -> mm
{"Rh2QuartzWindowSizeZ", TYPE( LHCb::Detector::detail::DD4hepToLHCbCm )}, // cm -> mm
{"RhPMTPixelXSize", TYPE( LHCb::Detector::detail::DD4hepToLHCbCm )}, // cm -> mm
{"RhPMTPixelYSize", TYPE( LHCb::Detector::detail::DD4hepToLHCbCm )}, // cm -> mm
{"RhGrandPMTPixelXSize", TYPE( LHCb::Detector::detail::DD4hepToLHCbCm )}, // cm -> mm
{"RhGrandPMTPixelYSize", TYPE( LHCb::Detector::detail::DD4hepToLHCbCm )}, // cm -> mm
};
const auto scale = scale_map.find( name );
const auto F = ( scale == scale_map.end() ? TYPE( 1 ) : scale->second );
const TYPE cmTOmm = LHCb::Detector::detail::DD4hepToLHCbCm; // cm -> mm
static const ScaleMap scale_map = {{"Rh1QuartzWindowZSize", cmTOmm},
{"Rh2QuartzWindowSizeZ", cmTOmm},
{"RhPMTPixelXSize", cmTOmm},
{"RhPMTPixelYSize", cmTOmm},
{"RhGrandPMTPixelXSize", cmTOmm},
{"RhGrandPMTPixelYSize", cmTOmm},
{"RhPMTAnodeXSize", cmTOmm},
{"RhPMTAnodeYSize", cmTOmm},
{"RhGrandPMTAnodeXSize", cmTOmm},
{"RhGrandPMTAnodeYSize", cmTOmm},
{"Rh1PMTDetPlaneZLocationInPhDetSupFrame", cmTOmm},
{"Rh2MixedPMTDetPlaneZLocationInPMTPanel", cmTOmm},
{"Rh1PhDetSupXSize", cmTOmm},
{"Rh1PhDetSupYSize", cmTOmm},
{"Rh2PDPanelSizeX", cmTOmm},
{"Rh2PDPanelSizeY", cmTOmm}};
const auto scale = scale_map.find( name );
const auto F = ( scale == scale_map.end() ? TYPE( 1 ) : scale->second );
// floating point types
if constexpr ( std::is_same_v<double, TYPE> ) {
return F * static_cast<TYPE>( dd4hep::_toDouble( name.c_str() ) );
Loading