diff --git a/Detectors/TOF/calibration/include/TOFCalibration/TOFFEElightConfig.h b/Detectors/TOF/calibration/include/TOFCalibration/TOFFEElightConfig.h index 4706c29570288..49ed9e456f3e6 100644 --- a/Detectors/TOF/calibration/include/TOFCalibration/TOFFEElightConfig.h +++ b/Detectors/TOF/calibration/include/TOFCalibration/TOFFEElightConfig.h @@ -49,6 +49,16 @@ struct TOFFEEtriggerConfig { //_____________________________________________________________________________ +struct TOFFEEmapHVConfig { + + unsigned int mHVstat[Geo::NPLATES]; // 1 bit per strip status inside 5 modules + TOFFEEmapHVConfig() = default; + + ClassDefNV(TOFFEEmapHVConfig, 1); +}; + +//_____________________________________________________________________________ + struct TOFFEElightConfig { static constexpr int NCHANNELS = 172800; @@ -61,11 +71,13 @@ struct TOFFEElightConfig { // std::array mChannelConfig; TOFFEEchannelConfig mChannelConfig[Geo::kNCrate][Geo::kNTRM - 2][Geo::kNChain][Geo::kNTdc][Geo::kNCh]; // in O2, the number of TRMs is 12, but in the FEE world it is 10 TOFFEEtriggerConfig mTriggerConfig[NTRIGGERMAPS]; + TOFFEEmapHVConfig mHVConfig[Geo::NSECTORS]; TOFFEElightConfig() = default; const TOFFEEchannelConfig* getChannelConfig(int icrate, int itrm, int ichain, int itdc, int ich) const; const TOFFEEtriggerConfig* getTriggerConfig(int idx) const { return idx < NTRIGGERMAPS ? &mTriggerConfig[idx] : nullptr; } - - ClassDefNV(TOFFEElightConfig, 1); + const TOFFEEmapHVConfig* getHVConfig(int isector) const { return (isector < Geo::NSECTORS) ? &mHVConfig[isector] : nullptr; } + unsigned int getHVConfig(int isector, int iplate) const { return (isector < Geo::NSECTORS && iplate < Geo::NPLATES) ? mHVConfig[isector].mHVstat[iplate] : 0; } + ClassDefNV(TOFFEElightConfig, 2); }; } // namespace tof diff --git a/Detectors/TOF/calibration/src/TOFCalibrationLinkDef.h b/Detectors/TOF/calibration/src/TOFCalibrationLinkDef.h index 68380fead30fc..27d24fd187ad2 100644 --- a/Detectors/TOF/calibration/src/TOFCalibrationLinkDef.h +++ b/Detectors/TOF/calibration/src/TOFCalibrationLinkDef.h @@ -44,6 +44,7 @@ #pragma link C++ struct TOFFEEchannelConfig + ; #pragma link C++ struct TOFFEEtriggerConfig + ; +#pragma link C++ struct TOFFEEmapHVConfig + ; #pragma link C++ struct TOFFEElightConfig + ; #pragma link C++ struct TOFFEElightReader + ; diff --git a/Detectors/TOF/calibration/src/TOFFEElightReader.cxx b/Detectors/TOF/calibration/src/TOFFEElightReader.cxx index 4d7fa786e6e25..9f82d787a78f0 100644 --- a/Detectors/TOF/calibration/src/TOFFEElightReader.cxx +++ b/Detectors/TOF/calibration/src/TOFFEElightReader.cxx @@ -93,6 +93,28 @@ int TOFFEElightReader::parseFEElightConfig(bool verbose) } } + const int istripInPlate[Geo::NSECTORS] = {Geo::NSTRIPC, Geo::NSTRIPB, Geo::NSTRIPA, Geo::NSTRIPB, Geo::NSTRIPC}; + const int channelInSector = Geo::NPADS * Geo::NSTRIPXSECTOR; + for (int isector = 0; isector < Geo::NSECTORS; isector++) { + int nstripInPrevPlates = 0; + for (int iplate = 0; iplate < Geo::NPLATES; iplate++) { + unsigned int mask = mFEElightConfig->getHVConfig(isector, iplate); + for (int istrip = 0; istrip < istripInPlate[iplate]; istrip++) { + bool isActive = mask & 1; // check first bit/current_strip + mask /= 2; // move to the next bit/strip + + if (!isActive) { // switch off all channels in this strip + int index0 = isector * channelInSector + (nstripInPrevPlates + istrip) * Geo::NPADS; + int indexF = index0 + Geo::NPADS; + for (int index = index0; index < indexF; index++) { + mFEElightInfo.mChannelEnabled[index] = 0; + } + } + } + nstripInPrevPlates += istripInPlate[iplate]; + } + } + const TOFFEEtriggerConfig* triggerConfig = nullptr; for (Int_t iddl = 0; iddl < TOFFEElightConfig::NTRIGGERMAPS; iddl++) { triggerConfig = mFEElightConfig->getTriggerConfig(iddl);