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
10 changes: 5 additions & 5 deletions Framework/script/o2-qc-batch-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fi
if [ -z "$JSON_DIR" ]
then
echo "JSON_DIR must be set when calling o2-qc-batch-test.sh"
exit 1
exit 2
fi

# make sure the CCDB is available otherwise we bail (no failure)
Expand All @@ -64,22 +64,22 @@ code=$(curl -L ccdb-test.cern.ch:8080/qc/TST/MO/BatchTestTask${UNIQUE_ID}/exampl
if (( $code != 200 )); then
echo "Error, monitor object of the QC Task could not be found."
delete_data
exit 2
exit 3
fi
# try to check that we got a valid root object
root -b -l -q -e 'TFile f("/tmp/batch_test_obj${UNIQUE_ID}.root"); f.Print();'
if (( $? != 0 )); then
echo "Error, monitor object of the QC Task is invalid."
delete_data
exit 2
exit 4
fi
# try if it is a non empty histogram
entries=`root -b -l -q -e 'TFile f("/tmp/batch_test_obj${UNIQUE_ID}.root"); TH1F *h = (TH1F*)f.Get("ccdb_object"); cout << h->GetEntries() << endl;' | tail -n 1`
if [ $entries -lt 150 ] 2>/dev/null
then
echo "The histogram of the QC Task has less than 150 (75%) of expected samples."
delete_data
exit 2
exit 5
fi

# check QualityObject
Expand All @@ -88,7 +88,7 @@ code=$(curl -L ccdb-test.cern.ch:8080/qc/TST/QO/BatchTestCheck${UNIQUE_ID}/`date
if (( $code != 200 )); then
echo "Error, quality object of the QC Task could not be found."
delete_data
exit 2
exit 6
fi

echo "Batch test was passed."
Expand Down
4 changes: 3 additions & 1 deletion Modules/Common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ configure_file("include/Common/Version.h.in"
add_library(O2QcCommon)

target_sources(O2QcCommon
PRIVATE src/WorstOfAllAggregator.cxx
PRIVATE src/IncreasingEntries.cxx
src/WorstOfAllAggregator.cxx
src/TRFCollectionTask.cxx
src/TRFCollectionTaskConfig.cxx
src/NonEmpty.cxx
Expand Down Expand Up @@ -44,6 +45,7 @@ add_root_dictionary(O2QcCommon
include/Common/THnSparse5Reductor.h
include/Common/QualityReductor.h
include/Common/EverIncreasingGraph.h
include/Common/IncreasingEntries.h
LINKDEF include/Common/LinkDef.h
BASENAME O2QcCommon)

Expand Down
51 changes: 51 additions & 0 deletions Modules/Common/include/Common/IncreasingEntries.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// 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 IncreasingEntries.h
/// \author My Name
///

#ifndef QC_MODULE_COMMON_COMMONINCREASINGENTRIES_H
#define QC_MODULE_COMMON_COMMONINCREASINGENTRIES_H

#include "QualityControl/CheckInterface.h"
#include <TPaveText.h>

namespace o2::quality_control_modules::common
{

/// \brief Example QC Check
/// \author My Name
class IncreasingEntries : public o2::quality_control::checker::CheckInterface
{
public:
/// Default constructor
IncreasingEntries() = default;
/// Destructor
~IncreasingEntries() override = default;

// Override interface
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;

private:
std::map<std::string, double> mLastEntries;
std::shared_ptr<TPaveText> mPaveText;

ClassDefOverride(IncreasingEntries, 2);
};

} // namespace o2::quality_control_modules::common

#endif // QC_MODULE_COMMON_COMMONINCREASINGENTRIES_H
2 changes: 2 additions & 0 deletions Modules/Common/include/Common/LinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@
#pragma link C++ class o2::quality_control_modules::common::EverIncreasingGraph + ;
#pragma link C++ class o2::quality_control_modules::common::TRFCollectionTask + ;
#pragma link C++ class o2::quality_control_modules::common::WorstOfAllAggregator + ;
#pragma link C++ class o2::quality_control_modules::common::IncreasingEntries + ;

#endif
75 changes: 75 additions & 0 deletions Modules/Common/src/IncreasingEntries.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// 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 IncreasingEntries.cxx
/// \author My Name
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be filled on the next occasion

///

#include "Common/IncreasingEntries.h"
#include "QualityControl/MonitorObject.h"
#include "QualityControl/Quality.h"
#include "QualityControl/QcInfoLogger.h"
// ROOT
#include <TH1.h>
#include <TList.h>

#include <DataFormatsQualityControl/FlagReasons.h>

using namespace std;
using namespace o2::quality_control;

namespace o2::quality_control_modules::common
{

void IncreasingEntries::configure()
{
mPaveText = make_shared<TPaveText>(1, 0.125, 0.6, 0, "NDC");
mPaveText->AddText("Number of Entries has not changed");
mPaveText->AddText("in the past cycle");
mPaveText->SetFillColor(kRed);
mPaveText->SetMargin(0);
}

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

for (auto& [moName, mo] : *moMap) {

TH1* histo = dynamic_cast<TH1*>(mo->getObject());
if (histo == nullptr) {
continue;
}

double previousNumberEntries = mLastEntries.count(moName) > 0 ? mLastEntries.at(moName) : 0;
double currentNumberEntries = histo->GetEntries();

if (previousNumberEntries == currentNumberEntries) {
result = Quality::Bad;
result.addReason(FlagReasonFactory::Unknown(),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NoDetectorData could have been used perhaps

"Number of entries stopped increasing.");
histo->GetListOfFunctions()->Add(mPaveText->Clone());
}

mLastEntries[moName] = currentNumberEntries;
}
return result;
}

std::string IncreasingEntries::getAcceptedType() { return "TH1"; }

void IncreasingEntries::beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult)
{
// as we want to add the text on the faulty histo we cannot do it here.
}

} // namespace o2::quality_control_modules::common
18 changes: 17 additions & 1 deletion doc/DevelopersTips.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,4 +327,20 @@ The config files on EPNs are merged to build a humongous config file used for th
The common part is stored here: https://github.com/AliceO2Group/O2DPG/blob/master/DATA/production/qc-sync/qc-global.json
The config file to use for each detector are defined here: https://github.com/AliceO2Group/O2DPG/blob/3dacaf525309b6e8cb4b4e2b7ea357ed65a95094/DATA/production/qc-workflow.sh


## run locally multi-node
Terminal 1
```bash
cd sw/BUILD/QualityControl-latest/QualityControl
export JSON_DIR=${PWD}/tests
export UNIQUE_PORT_1=12345
export UNIQUE_PORT_2=12346
o2-qc-run-producer --producers 2 --message-amount 1500 --message-rate 10 -b | o2-qc --config json://${JSON_DIR}/multinode-test.json -b --local --host localhost --run
```
Terminal 2
```bash
cd sw/BUILD/QualityControl-latest/QualityControl
export JSON_DIR=${PWD}/tests
export UNIQUE_PORT_1=12345
export UNIQUE_PORT_2=12346
o2-qc --config json://${JSON_DIR}/multinode-test.json -b --remote --run
```