Skip to content
Snippets Groups Projects

Modify CaloCellID for pin data decoding

Merged Jean-Francois Marchand requested to merge jmarchan-pinDataDecoding into master
1 file
+ 26
2
Compare changes
  • Side-by-side
  • Inline
@@ -179,6 +179,13 @@ namespace LHCb::Detector::Calo {
static constexpr auto rows = std::array{12, 12, 12};
};
template <>
struct Constants<CellCode::Index::EcalCalo, Area::PinArea> {
static constexpr auto global_offset = offsetAfter<Constants<CellCode::Index::EcalCalo, Area::Inner>>();
static constexpr auto id0 = std::array{0, 0};
static constexpr auto cols = std::array{4, 4, 4};
static constexpr auto rows = std::array{4, 4, 4};
};
template <>
struct Constants<CellCode::Index::HcalCalo, Area::Outer> {
static constexpr auto global_offset = offsetAfter<Constants<CellCode::Index::EcalCalo, Area::Inner>>();
static constexpr auto id0 = std::array{3, 0};
@@ -193,6 +200,13 @@ namespace LHCb::Detector::Calo {
static constexpr auto cols = std::array{14, 4, 14};
static constexpr auto rows = std::array{12, 4, 12};
};
template <>
struct Constants<CellCode::Index::HcalCalo, Area::PinArea> {
static constexpr auto global_offset = offsetAfter<Constants<CellCode::Index::HcalCalo, Area::Inner>>();
static constexpr auto id0 = std::array{0, 0};
static constexpr auto cols = std::array{4, 4, 4};
static constexpr auto rows = std::array{4, 4, 4};
};
template <CellCode::Index calo, Area area>
constexpr inline bool valid( int row, int col ) {
@@ -265,15 +279,21 @@ namespace LHCb::Detector::Calo {
if ( id < Constants<CellCode::Index::EcalCalo, Area::Inner>::global_offset ) {
return cellID<CellCode::Index::EcalCalo, Area::Middle>( id );
}
if ( id < Constants<CellCode::Index::HcalCalo, Area::Outer>::global_offset ) {
if ( id < Constants<CellCode::Index::EcalCalo, Area::PinArea>::global_offset ) {
return cellID<CellCode::Index::EcalCalo, Area::Inner>( id );
}
if ( id < Constants<CellCode::Index::HcalCalo, Area::Outer>::global_offset ) {
return cellID<CellCode::Index::EcalCalo, Area::PinArea>( id );
}
if ( id < Constants<CellCode::Index::HcalCalo, Area::Inner>::global_offset ) {
return cellID<CellCode::Index::HcalCalo, Area::Outer>( id );
}
if ( id < offsetAfter<Constants<CellCode::Index::HcalCalo, Area::Inner>>() ) {
return cellID<CellCode::Index::HcalCalo, Area::Middle>( id );
}
if ( id < offsetAfter<Constants<CellCode::Index::HcalCalo, Area::PinArea>>() ) {
return cellID<CellCode::Index::HcalCalo, Area::PinArea>( id );
}
return CellID{};
}
} // namespace DenseIndex::details
@@ -289,6 +309,8 @@ namespace LHCb::Detector::Calo {
return index<CellCode::Index::EcalCalo, Area::Middle>( id.row(), id.col() );
case Area::Inner:
return index<CellCode::Index::EcalCalo, Area::Inner>( id.row(), id.col() );
case Area::PinArea:
return index<CellCode::Index::EcalCalo, Area::PinArea>( id.row(), id.col() );
default:
return -1;
}
@@ -299,6 +321,8 @@ namespace LHCb::Detector::Calo {
case Area::Middle: // empty on purpose...
case Area::Inner:
return index<CellCode::Index::HcalCalo, Area::Inner>( id.row(), id.col() );
case Area::PinArea:
return index<CellCode::Index::HcalCalo, Area::PinArea>( id.row(), id.col() );
default:
return -1;
}
@@ -350,7 +374,7 @@ namespace LHCb::Detector::Calo {
constexpr operator CellID() const { return DenseIndex::details::toCellID( m_idx ); }
static constexpr int max() {
return DenseIndex::details::offsetAfter<
DenseIndex::details::Constants<CellCode::Index::HcalCalo, DenseIndex::details::Area::Inner>>();
DenseIndex::details::Constants<CellCode::Index::HcalCalo, DenseIndex::details::Area::PinArea>>();
}
};
Loading