Skip to content
Snippets Groups Projects

Modify CaloCellID for pin data decoding

Merged Jean-Francois Marchand requested to merge jmarchan-pinDataDecoding into master
All threads resolved!
1 file
+ 26
2
Compare changes
  • Side-by-side
  • Inline
@@ -183,6 +183,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};
@@ -197,6 +204,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 ) {
@@ -269,15 +283,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
@@ -293,6 +313,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;
}
@@ -303,6 +325,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;
}
@@ -354,7 +378,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