19#include "fmt/format.h"
34 LOGP(warning,
"Wrong number of CRU config values {}/{} in line {}", cruDataV.size(),
NConfigValues, cruData);
38 linkOn =
static_cast<decltype(
linkOn)
>(std::stol(cruDataV[0]));
41 itCorr0 = std::stof(cruDataV[5]);
50 {Tags::Unspecified,
"Unspecified"},
51 {Tags::TestWithZS,
"TestWithZS"},
52 {Tags::Pedestals,
"Pedestals"},
53 {Tags::Pulser,
"Pulser"},
54 {Tags::Laser,
"Laser"},
55 {Tags::Cosmics,
"Cosmics"},
56 {Tags::Physics35sigma,
"Physics35sigma"},
57 {Tags::Physics30sigma,
"Physics30sigma"},
58 {Tags::Physics25sigma,
"Physics25sigma"},
59 {Tags::Laser10ADCoff,
"Laser10ADCoff"},
60 {Tags::TestNoFilters,
"TestNoFilter"},
61 {Tags::Physics2025sigma,
"Physics2025sigma"},
62 {Tags::Physics30sigmaPbPb,
"Physics30sigmaPbPb"},
66 {PadConfig::ITfraction,
"ITfraction"},
67 {PadConfig::ITexpLambda,
"ITexpLambda"},
68 {PadConfig::CMkValues,
"CMkValues"},
69 {PadConfig::ThresholdMap,
"ThresholdMap"},
70 {PadConfig::Pedestals,
"Pedestals"},
76 [](
size_t sum,
const auto&
c) {
77 return sum + std::bitset<32>(c.linkOn).count();
83 const auto nEnabled = std::accumulate(
cruConfig.begin(),
cruConfig.end(),
size_t(0), [](
size_t b,
const auto&
c) { return b + (c.cmcEnabled > 0); });
84 if ((nEnabled > 0) && (nEnabled !=
cruConfig.size())) {
85 LOGP(warning,
"CMC not enabled for all CRUs: {} < {}", nEnabled,
cruConfig.size());
93 const auto nEnabled = std::accumulate(
cruConfig.begin(),
cruConfig.end(),
size_t(0), [](
size_t b,
const auto&
c) { return b + (c.itfEnabled); });
94 if ((nEnabled > 0) && (nEnabled !=
cruConfig.size())) {
95 LOGP(warning,
"ITF not enabled for all CRUs: {} < {}", nEnabled,
cruConfig.size());
103 const auto nEnabled = std::accumulate(
cruConfig.begin(),
cruConfig.end(),
size_t(0), [](
size_t b,
const auto&
c) { return b + (c.zsEnabled); });
104 if ((nEnabled > 0) && (nEnabled !=
cruConfig.size())) {
105 LOGP(warning,
"ZS not enabled for all CRUs: {} < {}", nEnabled,
cruConfig.size());
108 return nEnabled > (
cruConfig.size() / 2);
113 const auto nEnabled = std::accumulate(
cruConfig.begin(),
cruConfig.end(),
size_t(0), [](
size_t b,
const auto&
c) { return b + (c.resyncEnabled); });
114 if ((nEnabled > 0) && (nEnabled !=
cruConfig.size())) {
115 LOGP(warning,
"Resync not enabled for all CRUs: {} < {}", nEnabled,
cruConfig.size());
118 return nEnabled > (
cruConfig.size() / 2);
126 for (
int iCRU = 0; iCRU <
cruConfig.size(); ++iCRU) {
130 const int fecOffset = (nFECs + 1) / 2;
132 for (
int iFEC = 0; iFEC < nFECs; ++iFEC) {
133 const int fecTest = (iFEC < fecOffset) ? iFEC : 10 + (iFEC - fecOffset);
134 const int fecBIT = 1 << fecTest;
146 const size_t boxWidth = 80;
156 fmt::print(
"{0:=^{1}}\n",
message, boxWidth);
161 for (
int iCRU = 0; iCRU <
cruConfig.size(); ++iCRU) {
166 const auto nLinkOn = std::bitset<32>(
c.linkOn).count();
168 fmt::print(
"CRU {:3d}: linkOn = {:5x} ({:2}/{:2}), cmcEn = {:5x}, zsOffset = {:5x}, itCorr0 = {:4.2f}, itfEn = {:b}, zsEn = {:b}, resyncEn = {:b}\n",
169 iCRU,
c.linkOn, nLinkOn, nLinks,
c.cmcEnabled,
c.zsOffset,
c.itCorr0,
c.itfEnabled,
c.zsEnabled,
c.resyncEnabled);
175 message =
"| Pad maps summary |";
176 fmt::print(
"{0:=^{1}}\n",
message, boxWidth);
179 fmt::print(
"{}\n",
key);
185 LOGP(info,
"FEEConfig: tag: {}, #active links: {}, CMC enabled: {}, ITF enabled: {}, ZS enabled: {}, resync enabled: {}",
195 for (
int iCRU = 0; iCRU <
cruConfig.size(); ++iCRU) {
199 const int fecOffset = (nFECs + 1) / 2;
200 for (
int iFEC = 0; iFEC < nFECs; ++iFEC) {
202 const int fecTest = (iFEC < fecOffset) ? iFEC : 10 + (iFEC - fecOffset);
203 const int fecBIT = 1 << fecTest;
204 if (
cruConfig.at(iCRU).linkOn & fecBIT) {
209 for (
int iChannel = 0; iChannel < 80; ++iChannel) {
211 const PadROCPos padROCPos = mapper.padROCPos(cru, iFEC, sampaOnFEC, channelOnSAMPA);
220 for (
int iROC = 0; iROC < pedestals.getData().
size(); ++iROC) {
221 const auto& rocPed = pedestals.getCalArray(iROC);
224 for (
int iPad = 0; iPad < rocPed.getData().
size(); ++iPad) {
225 if (rocPed.getValue(iPad) > 1022) {
Frontend electronics configuration values.
unsigned char partition() const
void setValue(const size_t channel, const T &value)
const CalType & getCalArray(size_t position) const
static Mapper & instance(const std::string mappingDir="")
Pad and row inside a ROC.
const ROC & getROC() const
unsigned char getNumberOfFECs() const
GLboolean GLboolean GLboolean b
GLuint GLsizei const GLchar * message
std::tuple< int, int > getSampaInfo(int hwChannel, int cruID)
convert HW mapping to sampa and channel number
Global TPC definitions and constants.
DataT sum(const Vector< DataT, N > &a)
bool resyncEnabled
if resync feature is enabled
bool setValues(std::string_view cruData)
bool itfEnabled
if ion tail filter correction is enabled
bool zsEnabled
if zero suppression is enabled
uint32_t zsOffset
zero suppression offset value used in ITF
float itCorr0
ion tail scaling parameter
uint32_t linkOn
bitmask of active links
static constexpr int NConfigValues
number of configuration values
uint32_t cmcEnabled
if common mode correction is enabled
CalPadMapType padMaps
pad-wise configuration data
std::vector< CRUConfig > cruConfig
CRU configuration values.
bool isITFEnabled() const
static const std::unordered_map< Tags, const std::string > TagNames
CalDet< bool > getDeadChannelMap() const
Dead channel map including deactivated links and single channels.
size_t getNumberActiveLinks() const
bool isResyncEnabled() const
static const std::unordered_map< PadConfig, const std::string > PadConfigNames
bool isCMCEnabled() const
static std::vector< std::string > tokenize(const std::string &src, char delim, bool trimToken=true, bool skipEmpty=true)