19#include <fmt/format.h>
27int getStripId(
int deId,
int columnId,
int lineId,
int stripId,
int cathode)
29 return stripId | (cathode << 4) | (lineId << 5) | (columnId << 7) | (deId << 10);
32std::array<int, 4> GlobalMapper::getStripGeom(
int deId,
int columnId,
int lineId,
int stripId,
int cathode)
const
35 int offsetNB = 32 * columnId;
39 int pitch =
static_cast<int>(mMapping.
getStripSize(stripId, cathode, columnId, deId));
44 ypos += pitch * (16 * lineId + stripId);
50 xpos += pitch * stripId;
53 int nLines = lastLine - firstLine + 1;
54 ypos += 16 * firstLine;
55 ywidth = (nLines == 3) ? 48 : 64;
56 if (columnId == 6 && stripId >= 8) {
76 return {mScaleFactor * xpos, mScaleFactor * ypos, mScaleFactor * xwidth, mScaleFactor * ywidth};
79ExtendedMappingInfo GlobalMapper::buildExtendedInfo(
int deId,
int columnId,
int lineId,
int stripId,
int cathode)
const
81 ExtendedMappingInfo info;
82 info.id =
getStripId(deId, columnId, lineId, stripId, cathode);
83 auto locId =
static_cast<int>(mCrateMapper.
deLocalBoardToRO(deId, columnId, lineId));
86 auto crateId = (locId >> 4) % 8;
87 auto locInCrate = (locId & 0xF);
90 info.columnId = columnId;
92 info.stripId = stripId;
93 info.cathode = cathode;
94 info.locIdDcs = fmt::format(
"{}{}{}{}", crateId,
side, (locInCrate >= 8 ?
"1" :
"0"), locInCrate);
95 auto geom = getStripGeom(deId, columnId, lineId, stripId, cathode);
98 info.xwidth = geom[2];
99 info.ywidth = geom[3];
105 std::vector<ExtendedMappingInfo> out;
111 for (
int istrip = 0; istrip < nStrips; ++istrip) {
112 auto info = buildExtendedInfo(ide, icol, firstLine, istrip, 1);
113 out.emplace_back(info);
117 for (
int iline = firstLine; iline <= lastLine; ++iline) {
118 for (
int istrip = 0; istrip < 16; ++istrip) {
119 auto info = buildExtendedInfo(ide, icol, iline, istrip, 0);
120 out.emplace_back(info);
130 std::map<int, std::vector<std::pair<int, int>>> out;
131 std::pair<int, int> tmp;
135 bool isCutLow = (iline != 0);
137 auto info = buildExtendedInfo(ide, icol, iline, 0, 0);
138 out[ide].emplace_back(info.xpos, info.ypos);
140 tmp = {info.xpos + info.xwidth, info.ypos};
144 info = buildExtendedInfo(ide, icol, iline, 15, 0);
145 out[ide].emplace_back(info.xpos, info.ypos + info.ywidth);
149 out[ide].emplace_back(info.xpos + info.xwidth, info.ypos + info.ywidth);
150 info = buildExtendedInfo(ide, 1, 3, 15, 0);
152 out[ide].emplace_back(info.xpos, info.ypos + info.ywidth);
155 info = buildExtendedInfo(ide, 6, 0, 15, 0);
156 out[ide].emplace_back(info.xpos + info.xwidth, info.ypos + info.ywidth);
158 info = buildExtendedInfo(ide, 6, 0, 0, 0);
159 out[ide].emplace_back(info.xpos + info.xwidth, info.ypos);
163 info = buildExtendedInfo(ide, 1, 0, 0, 0);
164 out[ide].emplace_back(info.xpos, info.ypos);
166 out[ide].emplace_back(tmp);
169 out[ide].emplace_back(out[ide].front());
Useful detector parameters for MID.
Useful geometrical parameters for MID.
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.
std::map< int, std::vector< std::pair< int, int > > > buildDEGeom() const
Build the geometry for the Detection elements.
std::vector< ExtendedMappingInfo > buildStripsInfo() const
Build the strips info.
int getNStripsNBP(int column, int deId) const
int getFirstColumn(int deId) const
int getLastBoardBP(int column, int deId) const
int getFirstBoardBP(int column, int deId) const
double getStripSize(int strip, int cathode, int column, int deId) const
constexpr int NDetectionElements
Number of RPCs.
constexpr int NRPCLines
Number of RPC lines.
std::string getDEName(int deId)
bool isRightSide(int deId)
bool isShortRPC(int deId)
int getStripId(int deId, int columnId, int lineId, int stripId, int cathode)
Gets the unique strip ID.
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...