Skip to content

Commit e571f86

Browse files
authored
Daq task dplrawparser (#492)
* Can print RDH and page info. * Clean up some old plots. * Update and new plots * Add per detector plot * remove header DPLRawParser.h inclusion from DaqTask header to avoid dictionary generation problems on linux * move EverIncreasingGraph to Common.
1 parent 15c06ee commit e571f86

10 files changed

Lines changed: 324 additions & 197 deletions

File tree

Framework/readout.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@
3636
},
3737
"location": "remote",
3838
"taskParameters": {
39-
"printHeaders": "false", "": "set to true to print all headers, it will slow down the QC",
40-
"printPayload": "false", "": "hex or bin (anything else means no), it will slow down the QC"
39+
"": "All the printing options might significantly slow down your QC",
40+
"printInputHeader": "false", "": "set to true to print all headers",
41+
"printInputPayload": "false", "": "hex or bin (anything else means no)",
42+
"printPageInfo": "false", "": "set to true to print information about pages",
43+
"printRDH": "false", "": "set to true to print the RDHs"
4144
}
4245
}
4346
}
@@ -51,7 +54,7 @@
5154
"samplingConditions": [
5255
{
5356
"condition": "random",
54-
"fraction": "0.1",
57+
"fraction": "1",
5558
"seed": "1441"
5659
}
5760
],

Modules/Common/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ target_sources(QcCommon
1515
src/TH1Reductor.cxx
1616
src/TH2Reductor.cxx
1717
src/THnSparse5Reductor.cxx
18-
src/QualityReductor.cxx)
18+
src/QualityReductor.cxx
19+
src/EverIncreasingGraph.cxx)
1920

2021
target_include_directories(
2122
QcCommon
@@ -37,6 +38,7 @@ add_root_dictionary(QcCommon
3738
include/Common/TH2Reductor.h
3839
include/Common/THnSparse5Reductor.h
3940
include/Common/QualityReductor.h
41+
include/Common/EverIncreasingGraph.h
4042
LINKDEF include/Common/LinkDef.h
4143
BASENAME QcCommon)
4244

Modules/Daq/include/Daq/EverIncreasingGraph.h renamed to Modules/Common/include/Common/EverIncreasingGraph.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
#include "QualityControl/CheckInterface.h"
2020

21-
namespace o2::quality_control_modules::daq
21+
namespace o2::quality_control_modules::common
2222
{
2323

2424
/// \brief Check whether a plot is empty or not.
@@ -41,6 +41,6 @@ class EverIncreasingGraph : public o2::quality_control::checker::CheckInterface
4141
ClassDefOverride(EverIncreasingGraph, 1);
4242
};
4343

44-
} // namespace o2::quality_control_modules::daq
44+
} // namespace o2::quality_control_modules::common
4545

4646
#endif // QC_MODULE_DAQ_EVERINCREASINGRAPH_H

Modules/Common/include/Common/LinkDef.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
#pragma link C++ class o2::quality_control_modules::common::TH2Reductor + ;
1010
#pragma link C++ class o2::quality_control_modules::common::THnSparse5Reductor + ;
1111
#pragma link C++ class o2::quality_control_modules::common::QualityReductor + ;
12+
#pragma link C++ class o2::quality_control_modules::common::EverIncreasingGraph + ;
1213
#endif
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
///
12+
/// \file EverIncreasingGraph.cxx
13+
/// \author Barthelemy von Haller
14+
///
15+
16+
#include "Common/EverIncreasingGraph.h"
17+
18+
#include "QualityControl/MonitorObject.h"
19+
#include "QualityControl/Quality.h"
20+
#include "QualityControl/QcInfoLogger.h"
21+
22+
// ROOT
23+
#include <TGraph.h>
24+
#include <TH1.h>
25+
#include <TList.h>
26+
#include <TPaveText.h>
27+
28+
using namespace std;
29+
30+
namespace o2::quality_control_modules::common
31+
{
32+
void EverIncreasingGraph::configure(std::string /*name*/) {}
33+
34+
Quality EverIncreasingGraph::check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap)
35+
{
36+
auto mo = moMap->begin()->second;
37+
Quality result = Quality::Good;
38+
auto* g = dynamic_cast<TGraph*>(mo->getObject());
39+
if (g == nullptr) {
40+
return Quality::Null;
41+
}
42+
43+
// simplistic and inefficient way to check that points are always increasing
44+
int nbPoints = g->GetN();
45+
double lastY = std::numeric_limits<double>::lowest();
46+
for (int i = 1; i < nbPoints; i++) {
47+
double x, y;
48+
g->GetPoint(i, x, y);
49+
if (y < lastY) {
50+
result = Quality::Bad;
51+
break;
52+
}
53+
lastY = y;
54+
}
55+
56+
return result;
57+
}
58+
59+
std::string EverIncreasingGraph::getAcceptedType() { return "TGraph"; }
60+
61+
void EverIncreasingGraph::beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult)
62+
{
63+
ILOG(Info, Support) << "EverIncreasingGraph::Beautify" << ENDM;
64+
65+
if (checkResult == Quality::Null || checkResult == Quality::Medium) {
66+
return;
67+
}
68+
69+
auto* g = dynamic_cast<TGraph*>(mo->getObject());
70+
if (!g) {
71+
ILOG(Error, Support) << "MO should be a graph" << ENDM;
72+
return;
73+
}
74+
75+
auto* paveText = new TPaveText(0.3, 0.8, 0.7, 0.95, "NDC");
76+
if (checkResult == Quality::Good) {
77+
paveText->SetFillColor(kGreen);
78+
paveText->AddText("No anomalies");
79+
} else if (checkResult == Quality::Bad) {
80+
paveText->SetFillColor(kRed);
81+
paveText->AddText("Values are not always increasing");
82+
}
83+
g->GetListOfFunctions()->AddLast(paveText);
84+
}
85+
86+
} // namespace o2::quality_control_modules::common

Modules/Daq/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
add_library(QcDaq)
44

5-
target_sources(QcDaq PRIVATE src/DaqTask.cxx src/EverIncreasingGraph.cxx)
5+
target_sources(QcDaq PRIVATE src/DaqTask.cxx)
66

77
target_include_directories(
88
QcDaq
99
PUBLIC $<INSTALL_INTERFACE:include>
1010
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
11-
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
11+
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
12+
)
1213

13-
target_link_libraries(QcDaq PUBLIC QualityControl PRIVATE ROOT::Gpad)
14+
target_link_libraries(QcDaq PUBLIC QualityControl PRIVATE ROOT::Gpad O2::DetectorsRaw)
1415

1516
add_root_dictionary(QcDaq
1617
HEADERS include/Daq/DaqTask.h
17-
include/Daq/EverIncreasingGraph.h
1818
LINKDEF include/Daq/LinkDef.h
1919
BASENAME QcDaq)
2020

Modules/Daq/include/Daq/DaqTask.h

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,21 @@
1717
#define QC_MODULE_DAQ_DAQTASK_H
1818

1919
#include "QualityControl/TaskInterface.h"
20+
#include <Headers/DAQID.h>
21+
#include <map>
2022

2123
class TH1F;
22-
class TGraph;
23-
class TObjString;
24-
class TCanvas;
25-
class TPaveText;
2624

2725
using namespace o2::quality_control::core;
2826

2927
namespace o2::quality_control_modules::daq
3028
{
31-
3229
/// \brief Dataflow task
3330
/// It does only look at the header and plots sizes (e.g. payload).
3431
/// It also can print the headers and the payloads by setting printHeaders to "1"
3532
/// and printPayload to "hex" or "bin" in the config file under "taskParameters".
3633
/// \author Barthelemy von Haller
37-
class DaqTask final : public TaskInterface
34+
class DaqTask final : public o2::quality_control::core::TaskInterface
3835
{
3936
public:
4037
/// \brief Constructor
@@ -44,20 +41,40 @@ class DaqTask final : public TaskInterface
4441

4542
// Definition of the methods for the template method pattern
4643
void initialize(o2::framework::InitContext& ctx) override;
47-
void startOfActivity(Activity& activity) override;
44+
void startOfActivity(o2::quality_control::core::Activity& activity) override;
4845
void startOfCycle() override;
4946
void monitorData(o2::framework::ProcessingContext& ctx) override;
5047
void endOfCycle() override;
51-
void endOfActivity(Activity& activity) override;
48+
void endOfActivity(o2::quality_control::core::Activity& activity) override;
5249
void reset() override;
5350

5451
private:
55-
TH1F* mPayloadSize;
56-
TGraph* mIds;
57-
int mNPoints;
58-
TH1F* mNumberSubblocks;
59-
TH1F* mSubPayloadSize;
60-
// UInt_t mTimeLastRecord;
52+
void printInputPayload(const header::DataHeader* header, const char* payload);
53+
void monitorInputRecord(o2::framework::InputRecord& inputRecord);
54+
void monitorRDHs(o2::framework::InputRecord& inputRecord);
55+
56+
// ** general information
57+
58+
std::map<o2::header::DAQID::ID, std::string> mSystems;
59+
60+
// ** objects we publish **
61+
62+
// Message related
63+
// Block = the whole InputRecord, i.e. the thing we receive and analyse in monitorData(...)
64+
// SubBlock = a single input of the InputRecord
65+
TH1F* mInputRecordPayloadSize = nullptr; // filled w/ the sum of the payload size of all the inputs of an inputrecord
66+
TH1F* mNumberInputs = nullptr; // filled w/ the number of inputs in each InputRecord we encounter
67+
TH1F* mInputSize = nullptr; // filled w/ the size of the inputs in each InputRecord we encounter
68+
TH1F* mNumberRDHs = nullptr; // filled w/ the number of RDHs found in each InputRecord we encounter
69+
70+
// Per link information
71+
72+
// Per detector information
73+
std::map<o2::header::DAQID::ID, TH1F*> mSubSystemsTotalSizes; // filled with the sum of RDH memory sizes per InputRecord
74+
std::map<o2::header::DAQID::ID, TH1F*> mSubSystemsRdhSizes; // filled with the RDH memory sizes for each RDH
75+
// todo : for the next one we need to know the number of links per detector.
76+
// std::map<o2::header::DAQID::ID, TH1F*> mSubSystemsRdhHits; // hits per link split by detector
77+
// todo we could add back the graph for the IDs using the TFID
6178
};
6279

6380
} // namespace o2::quality_control_modules::daq

Modules/Daq/include/Daq/LinkDef.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44
#pragma link off all functions;
55

66
#pragma link C++ class o2::quality_control_modules::daq::DaqTask + ;
7-
#pragma link C++ class o2::quality_control_modules::daq::EverIncreasingGraph + ;
87
#endif

0 commit comments

Comments
 (0)