From 5478338baf2cefa2fde66f0c0149c5f968e0df1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Wed, 1 Jun 2022 11:37:53 +0200 Subject: [PATCH] Minor fixes and improvements - Add ENDM - Publish noisy channels as metadata - Use method to fetch bool parameters - Use constexpr - Extend TOF json --- Modules/TOF/src/CheckCompressedData.cxx | 4 +-- Modules/TOF/src/CheckDRMDiagnostics.cxx | 6 ++-- Modules/TOF/src/CheckDiagnostics.cxx | 4 +-- Modules/TOF/src/CheckHitMap.cxx | 2 +- Modules/TOF/src/CheckNoise.cxx | 4 ++- Modules/TOF/src/CheckRawMultiplicity.cxx | 2 +- Modules/TOF/src/CheckRawTime.cxx | 4 +-- Modules/TOF/src/CheckRawToT.cxx | 2 +- Modules/TOF/src/TaskCosmics.cxx | 6 ++-- Modules/TOF/src/TaskRaw.cxx | 36 ++++++++++++------------ Modules/TOF/tofraw.json | 14 +++++++++ 11 files changed, 50 insertions(+), 34 deletions(-) diff --git a/Modules/TOF/src/CheckCompressedData.cxx b/Modules/TOF/src/CheckCompressedData.cxx index d5458271c8..f73723926f 100644 --- a/Modules/TOF/src/CheckCompressedData.cxx +++ b/Modules/TOF/src/CheckCompressedData.cxx @@ -37,7 +37,7 @@ Quality CheckCompressedData::check(std::map mo, Quality ch msg->AddText("Diagnostics above zero"); } } else { - ILOG(Error, Support) << "Did not get correct histo from " << mo->GetName(); + ILOG(Error, Support) << "Did not get correct histo from " << mo->GetName() << ENDM; } } } // namespace o2::quality_control_modules::tof diff --git a/Modules/TOF/src/CheckDRMDiagnostics.cxx b/Modules/TOF/src/CheckDRMDiagnostics.cxx index 7c5c0e30f0..26df9fed00 100644 --- a/Modules/TOF/src/CheckDRMDiagnostics.cxx +++ b/Modules/TOF/src/CheckDRMDiagnostics.cxx @@ -35,7 +35,7 @@ Quality CheckDRMDiagnostics::check(std::map mo, Quality ch if (mo->getName() == "DRMCounter") { auto* h = dynamic_cast(mo->getObject()); if (!h) { - ILOG(Warning, Support) << "Did not get MO for DRMCounter"; + ILOG(Warning, Support) << "Did not get MO for DRMCounter" << ENDM; return; } auto msg = mShifterMessages.MakeMessagePad(h, checkResult); @@ -85,7 +85,7 @@ void CheckDRMDiagnostics::beautify(std::shared_ptr mo, Quality ch msg->AddText("email TOF on-call."); } } else - ILOG(Error, Support) << "Did not get correct histo from " << mo->GetName(); + ILOG(Error, Support) << "Did not get correct histo from " << mo->GetName() << ENDM; } } // namespace o2::quality_control_modules::tof diff --git a/Modules/TOF/src/CheckDiagnostics.cxx b/Modules/TOF/src/CheckDiagnostics.cxx index b48d99b917..d32089031d 100644 --- a/Modules/TOF/src/CheckDiagnostics.cxx +++ b/Modules/TOF/src/CheckDiagnostics.cxx @@ -35,7 +35,7 @@ Quality CheckDiagnostics::check(std::map mo, Quality check msg->AddText("email TOF on-call."); } } else - ILOG(Error, Support) << "Did not get correct histo from " << mo->GetName(); + ILOG(Error, Support) << "Did not get correct histo from " << mo->GetName() << ENDM; } } // namespace o2::quality_control_modules::tof diff --git a/Modules/TOF/src/CheckHitMap.cxx b/Modules/TOF/src/CheckHitMap.cxx index 2a67e67737..fa91cab649 100644 --- a/Modules/TOF/src/CheckHitMap.cxx +++ b/Modules/TOF/src/CheckHitMap.cxx @@ -82,7 +82,7 @@ void CheckHitMap::beautify(std::shared_ptr mo, Quality checkResul // } else if (checkResult == Quality::Bad) { // msg->AddText("Call TOF on-call."); // } else if (checkResult == Quality::Medium) { - // ILOG(Info, Support) << "Quality::medium, setting to yellow"; + // ILOG(Info, Support) << "Quality::medium, setting to yellow" << ENDM; // msg->AddText("IF TOF IN RUN email TOF on-call."); // } } else { diff --git a/Modules/TOF/src/CheckNoise.cxx b/Modules/TOF/src/CheckNoise.cxx index fed87efbea..29334b9b77 100644 --- a/Modules/TOF/src/CheckNoise.cxx +++ b/Modules/TOF/src/CheckNoise.cxx @@ -53,7 +53,9 @@ Quality CheckNoise::check(std::map>* } result = Quality::Medium; locateChannel(i); - mShifterMessages.AddMessage(Form("%i %i %i %i %i %i", locatedSupermodule, locatedLink, locatedTrm, locatedChain, locatedTdc, locatedChannel)); + std::string channelFormat = Form("%i %i %i %i %i %i", locatedSupermodule, locatedLink, locatedTrm, locatedChain, locatedTdc, locatedChannel); + mo->addMetadata(Form("noisyChannel%i"), channelFormat); + mShifterMessages.AddMessage(channelFormat); } } return result; diff --git a/Modules/TOF/src/CheckRawMultiplicity.cxx b/Modules/TOF/src/CheckRawMultiplicity.cxx index bed31e4675..9c067a7870 100644 --- a/Modules/TOF/src/CheckRawMultiplicity.cxx +++ b/Modules/TOF/src/CheckRawMultiplicity.cxx @@ -170,7 +170,7 @@ void CheckRawMultiplicity::beautify(std::shared_ptr mo, Quality c } else if (checkResult == Quality::Bad) { msg->AddText("Call TOF on-call."); } else if (checkResult == Quality::Medium) { - ILOG(Info, Support) << "Quality::medium, setting to yellow"; + ILOG(Info, Support) << "Quality::medium, setting to yellow" << ENDM; msg->AddText("IF TOF IN RUN email TOF on-call."); } } else if (mo->getName() == "Multiplicity/SectorIA" || diff --git a/Modules/TOF/src/CheckRawTime.cxx b/Modules/TOF/src/CheckRawTime.cxx index c1b2f64604..374d7d8169 100644 --- a/Modules/TOF/src/CheckRawTime.cxx +++ b/Modules/TOF/src/CheckRawTime.cxx @@ -64,10 +64,10 @@ Quality CheckRawTime::check(std::map result = Quality::Good; } else { if (mRawTimePeakIntegral / mRawTimeIntegral > mMinPeakRatioIntegral) { - ILOG(Warning, Support) << Form("Raw time: peak/total integral = %5.2f, mean = %5.2f ns -> Check filling scheme...", mRawTimePeakIntegral / mRawTimeIntegral, mRawTimeMean); + ILOG(Warning, Support) << Form("Raw time: peak/total integral = %5.2f, mean = %5.2f ns -> Check filling scheme...", mRawTimePeakIntegral / mRawTimeIntegral, mRawTimeMean) << ENDM; result = Quality::Medium; } else { - ILOG(Warning, Support) << Form("Raw time peak/total integral = %5.2f, mean = %5.2f ns", mRawTimePeakIntegral / mRawTimeIntegral, mRawTimeMean); + ILOG(Warning, Support) << Form("Raw time peak/total integral = %5.2f, mean = %5.2f ns", mRawTimePeakIntegral / mRawTimeIntegral, mRawTimeMean) << ENDM; result = Quality::Bad; } } diff --git a/Modules/TOF/src/CheckRawToT.cxx b/Modules/TOF/src/CheckRawToT.cxx index e0afdd0f92..42c2c8e804 100644 --- a/Modules/TOF/src/CheckRawToT.cxx +++ b/Modules/TOF/src/CheckRawToT.cxx @@ -109,7 +109,7 @@ void CheckRawToT::beautify(std::shared_ptr mo, Quality checkResul } else if (checkResult == Quality::Bad) { msg->AddText("Call TOF on-call."); } else if (checkResult == Quality::Medium) { - ILOG(Info, Support) << "Quality::medium, setting to yellow"; + ILOG(Info, Support) << "Quality::medium, setting to yellow" << ENDM; msg->AddText("IF TOF IN RUN email TOF on-call."); } } else { diff --git a/Modules/TOF/src/TaskCosmics.cxx b/Modules/TOF/src/TaskCosmics.cxx index 6c4841f00d..6c54062878 100644 --- a/Modules/TOF/src/TaskCosmics.cxx +++ b/Modules/TOF/src/TaskCosmics.cxx @@ -62,15 +62,15 @@ void TaskCosmics::initialize(o2::framework::InitContext& /*ctx*/) // Set task parameters from JSON if (auto param = mCustomParameters.find("SelDeltaTSignalRegion"); param != mCustomParameters.end()) { mSelDeltaTSignalRegion = atoi(param->second.c_str()); - ILOG(Info, Support) << "Set SelDeltaTSignalRegion to " << mSelDeltaTSignalRegion << " ps"; + ILOG(Info, Support) << "Set SelDeltaTSignalRegion to " << mSelDeltaTSignalRegion << " ps" << ENDM; } if (auto param = mCustomParameters.find("SelDeltaTBackgroundRegion"); param != mCustomParameters.end()) { mSelDeltaTBackgroundRegion = atoi(param->second.c_str()); - ILOG(Info, Support) << "Set SelDeltaTBackgroundRegion to " << mSelDeltaTBackgroundRegion << " ps"; + ILOG(Info, Support) << "Set SelDeltaTBackgroundRegion to " << mSelDeltaTBackgroundRegion << " ps" << ENDM; } if (auto param = mCustomParameters.find("SelMinLength"); param != mCustomParameters.end()) { mSelMinLength = atoi(param->second.c_str()); - ILOG(Info, Support) << "Set SelMinLength to " << mSelMinLength << " cm"; + ILOG(Info, Support) << "Set SelMinLength to " << mSelMinLength << " cm" << ENDM; } mHistoCrate1.reset(new TH1F("Crate1", "Crate1;Crate of first hit;Counts", 72, 0, 72)); diff --git a/Modules/TOF/src/TaskRaw.cxx b/Modules/TOF/src/TaskRaw.cxx index 231aa0202e..2058958831 100644 --- a/Modules/TOF/src/TaskRaw.cxx +++ b/Modules/TOF/src/TaskRaw.cxx @@ -58,29 +58,30 @@ void RawDataDecoder::rdhHandler(const o2::header::RAWDataHeader* rdh) return; } + constexpr auto rdhCrateWord = 0xFF; if (RDHUtils::getPageCounter(rdh) == 0) { // if RDH open - mCounterRDHOpen.Count(rdh->feeId & 0xFF); + mCounterRDHOpen.Count(rdh->feeId & rdhCrateWord); } - mCounterRDH[rdh->feeId & 0xFF].Count(0); + mCounterRDH[rdh->feeId & rdhCrateWord].Count(0); // Case for the RDH word "fatal" if ((rdh->detectorField & 0x00001000) != 0) { - mCounterRDH[rdh->feeId & 0xFF].Count(1); - // LOG(warn) << "RDH flag \"fatal\" error occurred in crate " << static_cast(rdh->feeId & 0xFF); + mCounterRDH[rdh->feeId & rdhCrateWord].Count(1); + // LOG(warn) << "RDH flag \"fatal\" error occurred in crate " << static_cast(rdh->feeId & rdhCrateWord); } if (rdh->stop) { // if RDH close // Triggers served and received (3 are expected) - const int triggerserved = ((rdh->detectorField >> 24) & 0xFF); - const int triggerreceived = ((rdh->detectorField >> 16) & 0xFF); + const int triggerserved = ((rdh->detectorField >> 24) & rdhCrateWord); + const int triggerreceived = ((rdh->detectorField >> 16) & rdhCrateWord); if (triggerserved < triggerreceived) { // RDH word "trigger error": served < received - mCounterRDH[rdh->feeId & 0xFF].Count(2); + mCounterRDH[rdh->feeId & rdhCrateWord].Count(2); } // Numerator and denominator for the trigger efficiency - mCounterRDHTriggers[0].Add(rdh->feeId & 0xFF, triggerserved); - mCounterRDHTriggers[1].Add(rdh->feeId & 0xFF, triggerreceived); + mCounterRDHTriggers[0].Add(rdh->feeId & rdhCrateWord, triggerserved); + mCounterRDHTriggers[1].Add(rdh->feeId & rdhCrateWord, triggerreceived); } } @@ -351,11 +352,10 @@ void RawDataDecoder::estimateNoise(std::shared_ptr hIndexEOIsNoise) void TaskRaw::initialize(o2::framework::InitContext& /*ctx*/) { // Set task parameters from JSON - if (auto param = mCustomParameters.find("DecoderCONET"); param != mCustomParameters.end()) { - if (param->second == "True") { - ILOG(Info, Support) << "Rig for DecoderCONET"; - mDecoderRaw.setDecoderCONET(kTRUE); - } + bool useConetMode = false; + if (parseBooleanParameter("DecoderCONET", useConetMode)) { + ILOG(Info, Support) << "Set DecoderCONET to " << useConetMode << ENDM; + mDecoderRaw.setDecoderCONET(useConetMode); } if (auto param = mCustomParameters.find("TimeWindowMin"); param != mCustomParameters.end()) { mDecoderRaw.setTimeWindowMin(param->second); @@ -366,10 +366,10 @@ void TaskRaw::initialize(o2::framework::InitContext& /*ctx*/) if (auto param = mCustomParameters.find("NoiseThreshold"); param != mCustomParameters.end()) { mDecoderRaw.setNoiseThreshold(param->second); } - if (auto param = mCustomParameters.find("DebugCrateMultiplicity"); param != mCustomParameters.end()) { - if (param->second == "True") { - mDecoderRaw.setDebugCrateMultiplicity(true); - } + bool usePerCrateHistograms = false; + if (parseBooleanParameter("DebugCrateMultiplicity", usePerCrateHistograms)) { + ILOG(Info, Support) << "Set DebugCrateMultiplicity to " << usePerCrateHistograms << ENDM; + mDecoderRaw.setDebugCrateMultiplicity(usePerCrateHistograms); } // RDH diff --git a/Modules/TOF/tofraw.json b/Modules/TOF/tofraw.json index b05f716038..9d5c236878 100644 --- a/Modules/TOF/tofraw.json +++ b/Modules/TOF/tofraw.json @@ -45,6 +45,20 @@ } }, "checks": { + "CheckNoise": { + "active": "true", + "className": "o2::quality_control_modules::tof::CheckNoise", + "moduleName": "QcTOF", + "policy": "OnAny", + "detectorName": "TOF", + "dataSource": [{ + "type": "Task", + "name": "TaskRaw", + "MOs": [ + "hIndexEOHitRate" + ] + }] + }, "CheckDiagnostics": { "active": "true", "className": "o2::quality_control_modules::tof::CheckDiagnostics",