Skip to content

Commit

Permalink
[EMCAL-684] Add mapping for FEC index (#5576)
Browse files Browse the repository at this point in the history
* [EMCAL-684] Add mapping for FEC index

FEC index in supermodule is encoded based
on the DDL (FEC) in the RDH, the FEC index
in the ALTRO channel and the branch index.
A mapping function in the MappingHandler
calculates the absolute FEC index based on
the parameters specified above.

* Add braces to if statement

Co-authored-by: Ruben Shahoyan <shahor02@users.noreply.github.com>
  • Loading branch information
mfasDa and shahor02 authored Mar 1, 2021
1 parent 2dfd8e2 commit ee4f8a4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Detectors/EMCAL/base/include/EMCALBase/Mapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,12 @@ class MappingHandler
/// \throw DDLInvalid if DDL is invalid for EMCAL
Mapper& getMappingForDDL(int ddl);

/// \brief Get FEC index for channel based on DDL and information in the channel header
/// \param ddl Absolute DDL index
/// \param channelFEC FEC index in channel header
/// \param branch Branch index (0 or 1) in DDL
int getFEEForChannelInDDL(int dll, int channelFEC, int branch);

private:
std::array<Mapper, 4> mMappings; ///< Mapping container

Expand Down
13 changes: 12 additions & 1 deletion Detectors/EMCAL/base/src/Mapper.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,19 @@ Mapper& MappingHandler::getMappingForDDL(int ddl)
return mMappings[sideID * NDDLSM + ddlInSM];
}

int MappingHandler::getFEEForChannelInDDL(int ddl, int channelFEC, int branch)
{
int ddlInSupermodule = ddl % 2;
int fecID = ddlInSupermodule ? 20 : 0;
if (branch) {
fecID += 10;
}
fecID += channelFEC;
return fecID;
}

std::ostream& o2::emcal::operator<<(std::ostream& stream, const Mapper::ChannelID& channel)
{
stream << "Row " << static_cast<int>(channel.mRow) << ", Column " << static_cast<int>(channel.mColumn) << ", type " << o2::emcal::channelTypeToString(channel.mChannelType);
return stream;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class Channel
/// \throw HadrwareAddressError in case the hardware address is not initialized
int getBranchIndex() const;

/// \brief Provide the front-end card index for the current hardware address
/// \brief Provide the front-end card index (0-9) in branch for the current hardware address
/// \return Front-end card index for the current hardware address
/// \throw HadrwareAddressError in case the hardware address is not initialized
int getFECIndex() const;
Expand Down

0 comments on commit ee4f8a4

Please sign in to comment.