79 const uint16_t numModules = config.
modules.size();
80 const uint16_t numComp = config.
components.size();
81 const uint16_t numCrobPerComp = config.
components.at(0).feb2module.size();
85 const uint16_t numElinksPerCrob = 42;
86 const uint16_t numChanPerAsic = 128;
87 const uint16_t numElinksPerComp = numCrobPerComp * numElinksPerCrob;
90 int32_t febBaseIdx = 0;
91 for (uint16_t compIdx = 0; compIdx < numComp; compIdx++) {
92 const auto& component = config.
components.at(compIdx);
93 uint16_t equipment = component.equipmentId;
94 fReadoutConfig[equipment].resize(numElinksPerComp);
95 const int32_t numFebsPerCrob = component.FEBsPerCrob();
96 for (uint16_t crobIdx = 0; crobIdx < numCrobPerComp; crobIdx++) {
97 for (uint16_t elinkIdx = 0; elinkIdx < numElinksPerCrob; elinkIdx++) {
99 int32_t moduleAddress = -1;
100 uint16_t asicInModule = 0;
101 bool isPulser =
false;
103 uint16_t elinkId = numElinksPerCrob * crobIdx + elinkIdx;
104 const auto& elinks = config.
GetElinks(component.GetFEBType());
105 const auto& elink = elinks.at(elinkId);
107 int16_t feb = elink.toFeb;
113 int16_t moduleIdx = component.feb2module[crobIdx][feb];
115 if (moduleIdx == -1) {
119 isPulser = component.febIsPulser.at(crobIdx).at(feb);
121 assert(moduleIdx < numModules);
122 const auto&
module = config.modules.at(moduleIdx);
123 moduleAddress =
module.address;
124 bool moduleType =
module.type;
125 int16_t moduleSide = component.feb2moduleSide[crobIdx][feb];
126 int16_t febType = (moduleType == 0 ? moduleSide : !moduleSide);
127 uint32_t asicIndex = (febType == 0 ? elink.toAsicFebA : elink.toAsicFebB);
130 asicInModule = (moduleSide == 1 ? asicInFeb : numAsicsPerMod - 1 - asicInFeb);
133 const int32_t febId = feb + febBaseIdx;
134 auto mapIt = chanMaskSet.
values.find(febId);
135 if (mapIt != chanMaskSet.
values.end()) {
136 const auto& mask = mapIt->second;
138 for (uint32_t chan = 0; chan < numChanPerAsic; chan++) {
139 const uint32_t chanInFeb = chan + numChanPerAsic * asicInFeb;
140 if (mask.Contains(chanInFeb)) {
141 std::vector<bool>& chanMask = fMaskMap[equipment][elinkIdx];
142 if (chanMask.empty()) {
143 chanMask.resize(numChanPerAsic,
false);
145 chanMask[chan] =
true;
150 fReadoutConfig[equipment][elinkIdx] = {moduleAddress, asicInModule, isPulser};
154 febBaseIdx += numCrobPerComp * numFebsPerCrob;
172 std::vector<bool> result;
173 auto equipIter = fMaskMap.find(equipmentId);
174 if (equipIter != fMaskMap.end()) {
175 auto elinkMap = equipIter->second;
176 auto elinkIter = elinkMap.find(elinkId);
177 if (elinkIter != elinkMap.end()) {
178 result = elinkIter->second;
187 auto equipIter = fAdcCutMap.find(equipmentId);
188 if (equipIter != fAdcCutMap.end()) {
189 auto elinkMap = equipIter->second;
190 auto elinkIter = elinkMap.find(elinkId);
191 if (elinkIter != elinkMap.end()) {
192 result = elinkIter->second;