11#define BOOST_TEST_MODULE Test EMCAL Base
12#define BOOST_TEST_MAIN
13#define BOOST_TEST_DYN_LINK
14#include <boost/test/unit_test.hpp>
15#include <fmt/format.h>
22#include "RStringView.h"
44 const char* aliceO2env = std::getenv(
"O2_ROOT");
45 std::string inputDir =
" ";
47 inputDir = aliceO2env;
49 inputDir +=
"/share/Detectors/EMC/files/";
51 std::vector<char> sides = {
'A',
'C'};
52 for (
auto side : sides) {
53 for (
int iddl = 0; iddl < 2; iddl++) {
54 std::string mappingbase = fmt::format(
"RCU{}{}.data", iddl,
side);
55 std::cout <<
"Test mapping " << mappingbase << std::endl;
56 std::string mappingfile = inputDir + mappingbase;
63 for (
const auto& chan : refmapping) {
67 if (!chan.mAmbiguous) {
73 if (mappingbase ==
"RCU0A.data") {
90 std::vector<refchannel> mapping;
91 std::ifstream in(mappingfile.data());
94 std::getline(in, tmpstr);
95 std::getline(in, tmpstr);
98 while (std::getline(in, tmpstr)) {
99 std::stringstream addressdecoder(tmpstr);
105 auto channelPresent = std::find_if(mapping.begin(), mapping.end(), [
row,
col, caloflag](
const refchannel&
test) {
106 return row == test.mRow && col == test.mCol && caloflag == test.mCellType;
108 bool ambiguous =
false;
109 if (channelPresent != mapping.end()) {
111 channelPresent->mAmbiguous = ambiguous;
Error handling requests for unknown hardware addresses.
Exception handling invalid channel ID.
ALTRO mapping for calorimeters.
uint8_t getRow(unsigned int hardawareaddress) const
Get channel row for a given hardware address.
ChannelType_t getChannelType(unsigned int hardawareaddress) const
Get channel type for a given hardware address.
uint8_t getColumn(unsigned int hardawareaddress) const
Get channel column for a given hardware address.
unsigned int getHardwareAddress(uint8_t row, uint8_t col, ChannelType_t channeltype) const
Get the hardware address for a channel.
GLuint GLuint64EXT address
ChannelType_t intToChannelType(int chantype)
Convert integer number to channel type object.
@ HIGH_GAIN
High gain channel.
FIXME: do not use data model tables.
BOOST_AUTO_TEST_CASE(Mapper_test)
std::vector< refchannel > loadReferenceMapping(const std::string_view filename)
Load reference mapping from mapping file.
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())