29 mInverseMapping.clear();
34void Mapper::init(
const std::string_view
filename)
36 std::ifstream reader(
filename.data());
39 int maxHardwareAddress(-1);
41 std::getline(reader, tmp);
42 std::getline(reader, tmp);
43 maxHardwareAddress = std::stoi(tmp);
44 }
catch (std::invalid_argument& e) {
45 throw FileFormatException(e.what());
46 }
catch (std::out_of_range& e) {
47 throw FileFormatException(e.what());
48 }
catch (std::iostream::failure& e) {
49 throw FileFormatException(e.what());
54 while (getline(reader, tmp)) {
55 std::stringstream addressmapping(tmp);
59 }
catch (std::iostream::failure& e) {
60 throw FileFormatException(e.what());
63 if (
address > maxHardwareAddress) {
64 throw AddressRangeException(
address, maxHardwareAddress);
81 auto res = mMapping.find(hardawareaddress);
82 if (
res == mMapping.end()) {
94 auto found = mInverseMapping.find(channelToFind);
95 if (found == mInverseMapping.end()) {
103 const std::array<char, 2> SIDES = {{
'A',
'C'}};
104 const unsigned int NDDL = 2;
105 for (
unsigned int iside = 0; iside < 2; iside++) {
106 for (
unsigned int iddl = 0; iddl < NDDL; iddl++) {
107 mMappings[iside * NDDL + iddl].setMapping(Form(
"%s/share/Detectors/EMC/files/RCU%d%c.data", gSystem->Getenv(
"O2_ROOT"), iddl, SIDES[iside]));
117 const unsigned int NDDLSM = 2, NSIDES = 2;
118 unsigned int ddlInSM = ddl % NDDLSM,
119 sideID = (ddl / NDDLSM) % NSIDES;
120 unsigned int mappingIndex = sideID * NDDLSM + ddlInSM;
121 if (mappingIndex < 0 || mappingIndex >= mMappings.size()) {
122 std::cout <<
"Access to invalid mapping position for ddl " << ddl << std::endl;
125 return mMappings[mappingIndex];
133 int ddlInSupermodule = ddl % 2;
134 int fecID = ddlInSupermodule ? 20 : 0;
Error handling requests for unknown hardware addresses.
Exception handling invalid channel ID.
Error handling requests to not properly initialized mapping object.
ALTRO mapping for calorimeters.
Mapper()=default
Default constructor.
void setMapping(const std::string_view inputfile)
Initialize with new.
ChannelID getChannelID(unsigned int hardawareaddress) const
Get channel ID params 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.
Error handling for invalid DDL IDs (not in range for EMCAL)
int getFEEForChannelInDDL(unsigned int dll, unsigned int channelFEC, unsigned int branch)
Get FEC index for channel based on DDL and information in the channel header.
Mapper & getMappingForDDL(unsigned int ddl)
Get Mapping for given DDL.
MappingHandler()
Constructor.
GLuint GLuint64EXT address
uint8_t itsSharedClusterMap uint8_t
std::ostream & operator<<(std::ostream &stream, const Cell &cell)
Stream operator for EMCAL cell.
std::string channelTypeToString(ChannelType_t chantype)
Create string representation of the channel type object.
ChannelType_t intToChannelType(int chantype)
Convert integer number to channel type object.
ChannelType_t
Type of a raw data channel.
Mapped information of a channel.
uint8_t mColumn
Column of the channel in module.
ChannelType_t mChannelType
Type of the channel (see o2::emcal::ChannelType for channel type definitions)
uint8_t mRow
Row of the channel in module.