15#define BOOST_TEST_MODULE Test MID CrateMapper
16#define BOOST_TEST_DYN_LINK
18#include <boost/test/unit_test.hpp>
20#include <boost/test/data/test_case.hpp>
28BOOST_AUTO_TEST_SUITE(o2_mid_CrateMapper)
33 for (uint8_t icrate = 0; icrate < o2::mid::crateparams::sNCrates; ++icrate) {
34 int crateIdInSide = icrate % (o2::mid::crateparams::sNCrates / 2);
35 for (uint8_t iboard = 0; iboard < o2::mid::crateparams::sMaxNBoardsInCrate; ++iboard) {
36 int boardInSide = iboard % o2::mid::crateparams::sMaxNBoardsInLink;
37 bool exceptionExpected =
false;
38 if ((crateIdInSide == 1 || crateIdInSide == 3) && iboard == 15) {
39 exceptionExpected =
true;
40 }
else if (crateIdInSide == 2 && boardInSide == 7) {
41 exceptionExpected =
true;
42 }
else if (crateIdInSide == 7 && iboard > 8) {
43 exceptionExpected =
true;
45 bool exceptionReceived =
false;
48 }
catch (std::runtime_error except) {
49 exceptionReceived =
true;
52 ss <<
"CrateId: " <<
static_cast<int>(icrate) <<
" boardId: " <<
static_cast<int>(iboard) <<
" exception expected: " << exceptionExpected <<
" received: " << exceptionReceived;
53 BOOST_TEST(exceptionExpected == exceptionReceived, ss.str());
63 for (
int icol = mapping.getFirstColumn(ide); icol < 7; ++icol) {
64 for (
int iline = mapping.getFirstBoardBP(icol, ide); iline <= mapping.getLastBoardBP(icol, ide); ++iline) {
67 }
catch (std::runtime_error except) {
69 ss <<
"DEId: " <<
static_cast<int>(ide) <<
" colId: " <<
static_cast<int>(icol) <<
" lineId: " <<
static_cast<int>(iline) <<
" exception received!";
82 for (
int icol = mapping.getFirstColumn(ide); icol < 7; ++icol) {
83 for (
int iline = mapping.getFirstBoardBP(icol, ide); iline <= mapping.getLastBoardBP(icol, ide); ++iline) {
98BOOST_AUTO_TEST_SUITE_END()
Mapper to convert the RO Ids to a format suitable for O2.
Useful detector parameters for MID.
Structure to store the readout board information.
uint8_t deLocalBoardToRO(uint8_t deId, uint8_t columnId, uint8_t lineId) const
Converts the LOC ID expressed in the offline convention into the readout convention.
uint16_t roLocalBoardToDE(uint8_t uniqueLocId) const
Converts the LOC ID expressed in readout convention into the LOC ID in MT11 right in the offline conv...
bool isRightSide(uint8_t crateId)
Tests if the crate is in the right side.
constexpr int NDetectionElements
Number of RPCs.
int getColumnIdFromFEEId(uint16_t uniqueFEEId)
int getDEIdFromFEEId(uint16_t uniqueFEEId)
int getLineIdFromFEEId(uint16_t uniqueFEEId)
int getDEId(bool isRight, int chamber, int rpc)
uint8_t getCrateId(uint8_t uniqueLocId)
uint8_t makeUniqueLocID(uint8_t crateId, uint8_t locId)
BOOST_AUTO_TEST_CASE(FEEBoardToDE)
BOOST_TEST(digits==digitsD, boost::test_tools::per_element())