Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion Modules/EMCAL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

add_library(O2QcEMCAL)

target_sources(O2QcEMCAL PRIVATE src/FECRateVisualization.cxx src/TriggerTask.cxx src/PedestalTask.cxx src/BCTask.cxx src/RawErrorCheck.cxx src/RawTask.cxx src/RawCheck.cxx src/CellTask.cxx src/CellCheck.cxx src/DigitsQcTask.cxx src/DigitCheck.cxx src/OccupancyReductor.cxx src/OccupancyToFECReductor.cxx src/ClusterTask.cxx src/RawErrorTask.cxx src/CalibMonitoringTask.cxx src/SupermoduleProjectorTask.cxx src/BadChannelMapReductor.cxx src/TimeCalibParamReductor.cxx src/SupermoduleProjectionReductor.cxx src/SubdetectorProjectionReductor.cxx src/BCVisualization.cxx src/CalibCheck.cxx src/NumPatchesPerFastORCheck.cxx src/PedestalChannelCheck.cxx src/PayloadPerEventDDLCheck.cxx src/RawErrorCheckAll.cxx src/CellTimeCalibCheck.cxx src/CellAmpCheck.cxx src/TrendGraphCheck.cxx)
target_sources(O2QcEMCAL PRIVATE src/FECRateVisualization.cxx src/TriggerTask.cxx src/PedestalTask.cxx src/BCTask.cxx src/RawErrorCheck.cxx src/RawTask.cxx src/RawCheck.cxx src/CellTask.cxx src/CellCheck.cxx src/DigitsQcTask.cxx src/DigitCheck.cxx src/OccupancyReductor.cxx src/OccupancyToFECReductor.cxx src/ClusterTask.cxx src/RawErrorTask.cxx src/CalibMonitoringTask.cxx src/SupermoduleProjectorTask.cxx src/BadChannelMapReductor.cxx src/TimeCalibParamReductor.cxx src/SupermoduleProjectionReductor.cxx src/SubdetectorProjectionReductor.cxx src/BCVisualization.cxx src/CalibCheck.cxx src/NumPatchesPerFastORCheck.cxx src/PedestalChannelCheck.cxx src/PayloadPerEventDDLCheck.cxx src/RawErrorCheckAll.cxx src/CellTimeCalibCheck.cxx src/CellAmpCheck.cxx src/TrendGraphCheck.cxx src/NumPhysTriggCheck.cxx)

target_include_directories(
O2QcEMCAL
Expand Down Expand Up @@ -44,6 +44,7 @@ add_root_dictionary(O2QcEMCAL
include/EMCAL/TrendGraphCheck.h
include/EMCAL/DrawGridlines.h
include/EMCAL/FECRateVisualization.h
include/EMCAL/NumPhysTriggCheck.h
LINKDEF include/EMCAL/LinkDef.h)

install(TARGETS O2QcEMCAL
Expand Down
1 change: 1 addition & 0 deletions Modules/EMCAL/include/EMCAL/LinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#pragma link C++ class o2::quality_control_modules::emcal::TriggerTask + ;
#pragma link C++ class o2::quality_control_modules::emcal::NumPatchesPerFastORCheck + ;
#pragma link C++ class o2::quality_control_modules::emcal::PedestalChannelCheck + ;
#pragma link C++ class o2::quality_control_modules::emcal::NumPhysTriggCheck + ;

#pragma link C++ class o2::quality_control_modules::emcal::PayloadPerEventDDLCheck + ;

Expand Down
61 changes: 61 additions & 0 deletions Modules/EMCAL/include/EMCAL/NumPhysTriggCheck.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Copyright 2019-2020 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 NumPhysTriggCheck.h
/// \author Joshua Koenig
///

#ifndef QC_MODULE_EMCAL_EMCALNUMPHYSTRIGCHECK_HH
#define QC_MODULE_EMCAL_EMCALNUMPHYSTRIGCHECK_HH

#include "QualityControl/CheckInterface.h"

namespace o2::quality_control_modules::emcal
{

/// \brief Check whether a plot is empty or not.
///
/// \author Barthelemy von Haller
class NumPhysTriggCheck : public o2::quality_control::checker::CheckInterface
{
public:
/// \brief Default constructor
NumPhysTriggCheck() = default;
/// \brief Destructor
~NumPhysTriggCheck() override = default;

/// \brief Configure checker setting thresholds from taskParameters where specified
void configure() override;

/// \brief Check whether the number of physics triggers for the current trigger falls below a certain threshold copared to the maximum in the time range
/// \param moMap List of histos to check
/// \return Quality of the selection
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;

/// \brief Beautify the monitoring objects
/// \param mo Monitoring object to beautify
/// \param checkResult Quality status of this checker
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;

/// \brief Accept only TH1 histograms as input
/// \return Name of the accepted object: TH1
std::string getAcceptedType() override;

ClassDefOverride(NumPhysTriggCheck, 1);

private:
double mFracToMaxGood = 0.5; ///< Thresholds for minimum fraction of physics triggers compared to maximum
};

} // namespace o2::quality_control_modules::emcal

#endif // QC_MODULE_EMCAL_EMCALNUMPHYSTRIGCHECK_HH
115 changes: 115 additions & 0 deletions Modules/EMCAL/src/NumPhysTriggCheck.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
// Copyright 2019-2020 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.
#include "EMCAL/NumPhysTriggCheck.h"
#include "QualityControl/MonitorObject.h"
#include "QualityControl/Quality.h"
#include "QualityControl/QcInfoLogger.h"
// ROOT
#include <TCanvas.h>
#include <TGraph.h>
#include <TPaveText.h>
#include <TLatex.h>
#include <TList.h>
#include <TLine.h>
#include <TRobustEstimator.h>
#include <ROOT/TSeq.hxx>
#include <iostream>
#include <vector>

using namespace std;

namespace o2::quality_control_modules::emcal
{

void NumPhysTriggCheck::configure()
{
// configure threshold-based checkers for bad quality
auto fracToMaxGood = mCustomParameters.find("FracToMaxGood");
if (fracToMaxGood != mCustomParameters.end()) {
try {
mFracToMaxGood = std::stof(fracToMaxGood->second);
} catch (std::exception& e) {
ILOG(Error, Support) << fmt::format("Value {} not a float", fracToMaxGood->second.data()) << ENDM;
}
}
}

Quality NumPhysTriggCheck::check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap)
{
auto mo = moMap->begin()->second;
Quality result = Quality::Good;

if (mo->getName().find("NPhysTriggersTFSlice") != std::string::npos) {
auto Can = dynamic_cast<TCanvas*>(mo->getObject());
if (Can == nullptr) {
return Quality::Null;
}
TGraph* gr = nullptr;
TList* primitives = Can->GetListOfPrimitives();
for (TObject* obj : *primitives) {
if (obj->InheritsFrom("TGraph")) {
gr = (TGraph*)obj;
break;
}
}
if (gr == nullptr) {
return Quality::Null;
}
if (gr->GetN() == 0) {
return Quality::Bad;
}
double maxVal = 0.;
for (int i = 0; i < gr->GetN(); ++i) {
if (gr->GetPointY(i) > maxVal) {
maxVal = gr->GetPointY(i);
}
}
double currentVal = gr->GetPointY(gr->GetN() - 1);
if (currentVal < mFracToMaxGood * maxVal) {
result = Quality::Bad;
}
}

return result;
}

std::string NumPhysTriggCheck::getAcceptedType() { return "TCanvas"; }

void NumPhysTriggCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult)
{
if (mo->getName().find("NPhysTriggersTFSlice") != std::string::npos) {
auto Can = dynamic_cast<TCanvas*>(mo->getObject());
if (Can == nullptr) {
return;
}

Can->cd();
TPaveText* msg = new TPaveText(0.17, 0.2, 0.5, 0.3, "NDC");
msg->SetName(Form("%s_msg", mo->GetName()));

if (checkResult == Quality::Good) {
//
msg->Clear();
msg->AddText("Data quality: GOOD");
msg->SetFillColor(kGreen);
msg->Draw("same");
Can->Update();
} else if (checkResult == Quality::Bad) {
ILOG(Debug, Devel) << "Quality::Bad << ENDM";
msg->Clear();
msg->AddText("Data quality: BAD");
msg->SetFillColor(kRed);
msg->Draw("same");
Can->Update();
}
}
}
} // namespace o2::quality_control_modules::emcal