Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
acdbdb9
Add mHistGateTimeRatio2Ch monitoring object to DigitQcTask
Feb 28, 2023
d272277
Fix build errors
DawidSkora Mar 4, 2023
0630415
Add check for MO TriggersSoftwareVsTCM and improve code
DawidSkora Mar 5, 2023
e56283e
Upload changes during work on TriggersSwVsTcmCheck
DawidSkora Mar 5, 2023
5e45e6d
Fix names and celan up the code
DawidSkora Mar 6, 2023
45e2294
Extend generic check butify function and parametrize EventsInGateTime…
DawidSkora Mar 10, 2023
f126f32
Parametrize title of EventsInGateTime hist
DawidSkora Mar 10, 2023
58e0adf
Parametrize title of EventsInGateTime hist
DawidSkora Mar 10, 2023
12ebf1a
Refactor code and fix TriggersSwVsTcmCheck
DawidSkora Mar 20, 2023
fefd7f6
Fix merge conflict
DawidSkora Apr 1, 2023
34cc680
Enable message box on TriggersSwVsTcmCheck
DawidSkora Apr 6, 2023
664f526
Align code with clang-format
DawidSkora Apr 6, 2023
0d913f7
Fix the filling of the EventInGateTime hist
DawidSkora Apr 11, 2023
008477b
Remove unused import
DawidSkora Apr 11, 2023
a23f2af
Merge branch 'AliceO2Group:master' into master
DawidSkora Apr 13, 2023
c8cdf06
Use DeadChannelMap in GenericCheck
DawidSkora Apr 13, 2023
f4d64ba
Add stub of a BcCheck
DawidSkora Apr 13, 2023
e5c931a
Extend BcCheck
DawidSkora Apr 13, 2023
51e16e0
Fix build errors for BcCheck
DawidSkora Apr 13, 2023
0f0ea4f
Change hist title and add axis label
DawidSkora Apr 16, 2023
2a221f9
Fix MaxTreshold in GenericCheck. Test DeadChannelMap
DawidSkora Apr 16, 2023
e387e56
Change axis labels for EventsInGateTime
DawidSkora Apr 18, 2023
6895da9
Remove unused files
DawidSkora Apr 18, 2023
594a488
Fix clang format error
DawidSkora Apr 18, 2023
f2deb06
Remove unused file
DawidSkora Apr 18, 2023
18f5f32
Introduce BcCheck
DawidSkora Apr 20, 2023
83cd83b
Introduce BcCheck
DawidSkora Apr 20, 2023
15269d5
Save
DawidSkora Apr 21, 2023
fba0e4d
Add metadata to BcVsTriggers and BcVsFeemodules
DawidSkora Apr 25, 2023
c018556
Change approach
DawidSkora Apr 25, 2023
36a3766
Improve and rename BcCheck to OutOfBunchCollFeeModulesCheck
DawidSkora May 15, 2023
59ec16b
Apply clang-format fixes in code
DawidSkora May 16, 2023
953182a
Merge branch 'master' into bc_checks
DawidSkora May 16, 2023
d8d43c1
Merge branch 'AliceO2Group:master' into bc_checks
DawidSkora Jun 4, 2023
cbe4d1a
Provide fix for unreadable metadata key.
DawidSkora Jun 4, 2023
635db6d
Fix clang-format error
DawidSkora Jun 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Modules/FIT/FV0/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ target_sources(O2QcFV0 PRIVATE src/TH1ReductorLaser.cxx
src/CFDEffCheck.cxx
src/PostProcTask.cxx
src/OutOfBunchCollCheck.cxx
src/TriggersSwVsTcmCheck.cxx)
src/TriggersSwVsTcmCheck.cxx
src/OutOfBunchCollFeeModulesCheck.cxx)

target_include_directories(
O2QcFV0
Expand Down Expand Up @@ -37,6 +38,7 @@ add_root_dictionary(O2QcFV0
include/FV0/OutOfBunchCollCheck.h
include/FV0/GenericCheck.h
include/FV0/TriggersSwVsTcmCheck.h
include/FV0/OutOfBunchCollFeeModulesCheck.h
LINKDEF include/FV0/LinkDef.h)

install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/FV0
Expand Down
1 change: 1 addition & 0 deletions Modules/FIT/FV0/include/FV0/LinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#pragma link C++ class o2::quality_control_modules::fv0::OutOfBunchCollCheck + ;
#pragma link C++ class o2::quality_control_modules::fv0::GenericCheck + ;
#pragma link C++ class o2::quality_control_modules::fv0::TriggersSwVsTcmCheck + ;
#pragma link C++ class o2::quality_control_modules::fv0::OutOfBunchCollFeeModulesCheck + ;
//#pragma link C++ class o2::quality_control_modules::fv0::CalibrationTask + ;
//#pragma link C++ class o2::quality_control_modules::fv0::ChannelTimeCalibrationCheck + ;

Expand Down
52 changes: 52 additions & 0 deletions Modules/FIT/FV0/include/FV0/OutOfBunchCollFeeModulesCheck.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Copyright 2023 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

///
/// \file OutOfBunchCollFeeModulesCheck.h
/// \author Dawid Skora dawid.mateusz.skora@cern.ch
///

#ifndef QC_MODULE_FV0_OUTOFBUNCHCOLLFEEMODULESCHECK_H
#define QC_MODULE_FV0_OUTOFBUNCHCOLLFEEMODULESCHECK_H

#include "QualityControl/CheckInterface.h"

#include "FV0Base/Constants.h"
#include "CommonConstants/LHCConstants.h"

#include <string>

namespace o2::quality_control_modules::fv0
{

class OutOfBunchCollFeeModulesCheck : public o2::quality_control::checker::CheckInterface
{
public:
OutOfBunchCollFeeModulesCheck() = default;
~OutOfBunchCollFeeModulesCheck() override = default;

void configure() override;
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
std::string getAcceptedType() override;

ClassDefOverride(OutOfBunchCollFeeModulesCheck, 2);

private:
float mThreshWarning;
float mThreshError;
float mFractionOutOfBunchColl = 0;
constexpr static std::size_t sBCperOrbit = o2::constants::lhc::LHCMaxBunches;
};

} // namespace o2::quality_control_modules::fv0

#endif // QC_MODULE_FV0_OUTOFBUNCHCOLLFEEMODULESCHECK_H
8 changes: 8 additions & 0 deletions Modules/FIT/FV0/include/FV0/PostProcTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include <TH2.h>
#include <TCanvas.h>
#include <TGraph.h>
#include <regex>
#include <array>

class TH1F;
class TCanvas;
Expand Down Expand Up @@ -87,9 +89,15 @@ class PostProcTask final : public quality_control::postprocessing::PostProcessin
// if storage size matters it can be replaced with TH1
// and TH2 can be created based on it on the fly, but only TH1 would be stored
std::unique_ptr<TH2F> mHistBcPattern;
std::unique_ptr<TH2F> mHistBcPatternFee;
std::unique_ptr<TH2F> mHistBcTrgOutOfBunchColl;
std::unique_ptr<TH2F> mHistBcFeeOutOfBunchColl;

uint8_t mTCMhash;
std::array<uint8_t, sNCHANNELS_FV0_PLUSREF> mChID2PMhash; // map chID->hashed PM value
std::map<uint8_t, bool> mMapPMhash2isInner;
std::map<unsigned int, TH1D*> mMapTrgHistBC;
std::map<std::string, uint8_t> mMapFEE2hash;
};

} // namespace o2::quality_control_modules::fv0
Expand Down
160 changes: 160 additions & 0 deletions Modules/FIT/FV0/src/OutOfBunchCollFeeModulesCheck.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
// Copyright 2023 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

///
/// \file OutOfBunchCollFeeModulesCheck.cxx
/// \author Dawid Skora dawid.mateusz.skora@cern.ch
///

#include "FV0/OutOfBunchCollFeeModulesCheck.h"
#include "QualityControl/MonitorObject.h"
#include "QualityControl/Quality.h"
#include "QualityControl/QcInfoLogger.h"
#include "DataFormatsParameters/GRPLHCIFData.h"

// ROOT
#include <TH1.h>
#include <TH2.h>
#include <TPaveText.h>
#include <TLine.h>
#include <TList.h>

#include <map>
#include <DataFormatsQualityControl/FlagReasons.h>

using namespace std;
using namespace o2::quality_control;

namespace o2::quality_control_modules::fv0
{

void OutOfBunchCollFeeModulesCheck::configure()
{
if (auto param = mCustomParameters.find("thresholdWarning"); param != mCustomParameters.end()) {
mThreshWarning = stof(param->second);
ILOG(Debug, Support) << "configure() : using thresholdWarning = " << mThreshWarning << ENDM;
} else {
mThreshWarning = 1e-3;
ILOG(Debug, Support) << "configure() : using default thresholdWarning = " << mThreshWarning << ENDM;
}

if (auto param = mCustomParameters.find("thresholdError"); param != mCustomParameters.end()) {
mThreshError = stof(param->second);
ILOG(Debug, Support) << "configure() : using thresholdError = " << mThreshError << ENDM;
} else {
mThreshError = 0.1;
ILOG(Debug, Support) << "configure() : using default thresholdError = " << mThreshError << ENDM;
}

if (mThreshError < mThreshWarning) {
ILOG(Debug, Support) << "thresholdError lower than thresholdWarning. Swaping values." << ENDM;
std::swap(mThreshError, mThreshWarning);
}
}

Quality OutOfBunchCollFeeModulesCheck::check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap)
{
Quality result = Quality::Null;

for (auto& [moName, mo] : *moMap) {
(void)moName;
if (mo->getName() == "OutOfBunchColl_BCvsFeeModules") {
auto* histogram = dynamic_cast<TH2*>(mo->getObject());

if (!histogram) {
ILOG(Error, Support) << "check(): MO " << mo->getName() << " not found" << ENDM;
result.addReason(FlagReasonFactory::Unknown(), "MO " + mo->getName() + " not found");
result.set(Quality::Null);
return result;
}

std::vector<float> allCollPerFeeModule(mo->getMetadataMap().size() + 1, 0);
for (auto metainfo : mo->getMetadataMap()) {
int bin = 0;
float value = 0;
try {
bin = std::stoi(metainfo.first);
value = std::stof(metainfo.second);
allCollPerFeeModule[bin] = value;
} catch (const std::invalid_argument& e) {
ILOG(Warning, Support) << "Could not get value for key " << metainfo.first << ENDM;
continue;
}
}

// Calculate out-of-bunch-coll fraction for Fee Modules
for (int binY = 1; binY <= histogram->GetNbinsY(); binY++) {
auto outOfBcCollisions = histogram->Integral(1, sBCperOrbit, binY, binY);
float fraction = 0;
if (allCollPerFeeModule[binY]) {
fraction = outOfBcCollisions / allCollPerFeeModule[binY];
}

if (fraction > mFractionOutOfBunchColl) {
mFractionOutOfBunchColl = fraction;
}
}

// Check the biggest fraction of out-of-bunch-coll
if (mFractionOutOfBunchColl > mThreshError) {
result.set(Quality::Bad);
result.addReason(FlagReasonFactory::Unknown(),
Form("Fraction of out of bunch collisions (%.2e) is above \"Error\" threshold (%.2e)",
mFractionOutOfBunchColl, mThreshError));
} else if (mFractionOutOfBunchColl > mThreshWarning) {
result.set(Quality::Medium);
result.addReason(FlagReasonFactory::Unknown(),
Form("Fraction of out of bunch collisions (%.2e) is above \"Warning\" threshold (%.2e)",
mFractionOutOfBunchColl, mThreshWarning));
} else {
result.set(Quality::Good);
}
}
}

return result;
}

std::string OutOfBunchCollFeeModulesCheck::getAcceptedType() { return "TH2"; }

void OutOfBunchCollFeeModulesCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult)
{
if (mo->getName() == "OutOfBunchColl_BCvsFeeModules") {
auto* histogram = dynamic_cast<TH2*>(mo->getObject());

if (!histogram) {
ILOG(Error, Support) << "beautify(): MO " << mo->getName() << " not found" << ENDM;
return;
}

TPaveText* msg = new TPaveText(0.1, 0.85, 0.9, 0.9, "NDC");
histogram->GetListOfFunctions()->Add(msg);
msg->SetName(Form("%s_msg", mo->GetName()));
msg->Clear();
if (checkResult.isWorseThan(Quality::Good)) {
msg->AddText(checkResult.getReasons()[0].second.c_str());
}
int color = kWhite;
if (checkResult == Quality::Good) {
color = kGreen + 1;
msg->AddText(">> Quality::Good <<");
} else if (checkResult == Quality::Medium) {
color = kOrange - 1;
msg->AddText(">> Quality::Medium <<");
} else if (checkResult == Quality::Bad) {
color = kRed;
msg->AddText(">> Quality::Bad <<");
}
msg->SetFillColor(color);
}
}

} // namespace o2::quality_control_modules::fv0
Loading