Skip to content

Commit eb76bd4

Browse files
authored
TPC QC Tracks workflow including json configs (#313)
* TPC QC Tracks workflow including json configs o This is the QualityControl part of the TPC QC task for the tracks o It implements the workflow for the O2 TPC QC Tracks task o It can be run with the also provided json configs, either: - using the availble TPC track reader and the sampled json - piped to a TPC reco workflow using the direct json * TPC QC tracks workflow: gsl/span, minor changes o gsl/span is used instead of a vector for the TPC tracks o some minor changes requested by Jens * TPC QC Tracks workflow: switch back to vector
1 parent e7bce0a commit eb76bd4

6 files changed

Lines changed: 290 additions & 1 deletion

File tree

Modules/TPC/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
add_library(QcTPC)
44

5-
target_sources(QcTPC PRIVATE src/PID.cxx)
5+
target_sources(QcTPC PRIVATE src/PID.cxx
6+
src/Tracks.cxx)
67

78
target_include_directories(
89
QcTPC
@@ -19,6 +20,7 @@ target_link_libraries(QcTPC
1920

2021
add_root_dictionary(QcTPC
2122
HEADERS include/TPC/PID.h
23+
include/TPC/Tracks.h
2224
LINKDEF include/TPC/LinkDef.h
2325
BASENAME QcTPC)
2426

@@ -66,4 +68,6 @@ install(TARGETS QcTPC ${EXE_NAMES}
6668

6769
install(FILES run/tpcQCPID_sampled.json
6870
run/tpcQCPID_direct.json
71+
run/tpcQCTracks_sampled.json
72+
run/tpcQCTracks_direct.json
6973
DESTINATION etc)

Modules/TPC/include/TPC/LinkDef.h

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

66
#pragma link C++ class o2::quality_control_modules::tpc::PID+;
7+
#pragma link C++ class o2::quality_control_modules::tpc::Tracks+;
78
#endif

Modules/TPC/include/TPC/Tracks.h

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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 Tracks.h
13+
/// \author Stefan Heckel, sheckel@cern.ch
14+
///
15+
16+
#ifndef QC_MODULE_TPC_Tracks_H
17+
#define QC_MODULE_TPC_Tracks_H
18+
19+
// O2 includes
20+
#include "TPCQC/Tracks.h"
21+
22+
// QC includes
23+
#include "QualityControl/TaskInterface.h"
24+
25+
using namespace o2::quality_control::core;
26+
27+
namespace o2::quality_control_modules::tpc
28+
{
29+
30+
/// \brief Quality Control DPL Task for QC Module TPC for track related observables
31+
/// \author Stefan Heckel
32+
33+
class Tracks /*final*/ : public TaskInterface // todo add back the "final" when doxygen is fixed
34+
{
35+
public:
36+
/// \brief Constructor
37+
Tracks() = default;
38+
/// Destructor
39+
~Tracks() override = default;
40+
41+
// Definition of the methods for the template method pattern
42+
void initialize(o2::framework::InitContext& ctx) override;
43+
void startOfActivity(Activity& activity) override;
44+
void startOfCycle() override;
45+
void monitorData(o2::framework::ProcessingContext& ctx) override;
46+
void endOfCycle() override;
47+
void endOfActivity(Activity& activity) override;
48+
void reset() override;
49+
50+
private:
51+
o2::tpc::qc::Tracks mQCTracks{}; ///< TPC QC class from o2
52+
};
53+
54+
} // namespace o2::quality_control_modules::tpc
55+
56+
#endif // QC_MODULE_TPC_Tracks_H
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"qc": {
3+
"config": {
4+
"database": {
5+
"implementation": "CCDB",
6+
"host": "ccdb-test.cern.ch:8080",
7+
"username": "not_applicable",
8+
"password": "not_applicable",
9+
"name": "not_applicable"
10+
},
11+
"Activity": {
12+
"number": "42",
13+
"type": "2"
14+
},
15+
"monitoring": {
16+
"url": "infologger:///debug?qc"
17+
},
18+
"consul": {
19+
"url": "http://consul-test.cern.ch:8500"
20+
},
21+
"conditionDB": {
22+
"url": "ccdb-test.cern.ch:8080"
23+
}
24+
},
25+
"tasks": {
26+
"Tracks": {
27+
"active": "true",
28+
"className": "o2::quality_control_modules::tpc::Tracks",
29+
"moduleName": "QcTPC",
30+
"detectorName": "TPC",
31+
"cycleDurationSeconds": "10",
32+
"maxNumberCycles": "-1",
33+
"dataSource_comment": "The other type of dataSource is \"direct\", see basic-no-sampling.json.",
34+
"dataSource": {
35+
"type": "direct",
36+
"query": "inputTracks:TPC/TRACKS/0"
37+
},
38+
"taskParameters": {
39+
"myOwnKey": "myOwnValue"
40+
},
41+
"location": "remote"
42+
}
43+
},
44+
"checks": {
45+
"QcCheck": {
46+
"active": "true",
47+
"className": "o2::quality_control_modules::skeleton::SkeletonCheck",
48+
"moduleName": "QcSkeleton",
49+
"policy": "OnAny",
50+
"dataSource": [{
51+
"type": "Task",
52+
"name": "Tracks",
53+
"MOs": ["example"]
54+
}]
55+
}
56+
}
57+
},
58+
"dataSamplingPolicies": [
59+
60+
]
61+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"qc": {
3+
"config": {
4+
"database": {
5+
"implementation": "CCDB",
6+
"host": "ccdb-test.cern.ch:8080",
7+
"username": "not_applicable",
8+
"password": "not_applicable",
9+
"name": "not_applicable"
10+
},
11+
"Activity": {
12+
"number": "42",
13+
"type": "2"
14+
},
15+
"monitoring": {
16+
"url": "infologger:///debug?qc"
17+
},
18+
"consul": {
19+
"url": "http://consul-test.cern.ch:8500"
20+
},
21+
"conditionDB": {
22+
"url": "ccdb-test.cern.ch:8080"
23+
}
24+
},
25+
"tasks": {
26+
"Tracks": {
27+
"active": "true",
28+
"className": "o2::quality_control_modules::tpc::Tracks",
29+
"moduleName": "QcTPC",
30+
"detectorName": "TPC",
31+
"cycleDurationSeconds": "10",
32+
"maxNumberCycles": "-1",
33+
"dataSource_comment": "The other type of dataSource is \"direct\", see basic-no-sampling.json.",
34+
"dataSource": {
35+
"type": "dataSamplingPolicy",
36+
"name": "tpc-tracks"
37+
},
38+
"taskParameters": {
39+
"myOwnKey": "myOwnValue"
40+
},
41+
"location": "remote"
42+
}
43+
},
44+
"checks": {
45+
"QcCheck": {
46+
"active": "true",
47+
"className": "o2::quality_control_modules::skeleton::SkeletonCheck",
48+
"moduleName": "QcSkeleton",
49+
"policy": "OnAny",
50+
"dataSource": [{
51+
"type": "Task",
52+
"name": "Tracks",
53+
"MOs": ["example"]
54+
}]
55+
}
56+
}
57+
},
58+
"dataSamplingPolicies": [
59+
{
60+
"id": "tpc-tracks",
61+
"active": "true",
62+
"machines": [],
63+
"query": "inputTracks:TPC/TRACKS/0",
64+
"samplingConditions": [
65+
{
66+
"condition": "random",
67+
"fraction": "0.9",
68+
"seed": "1234"
69+
}
70+
],
71+
"blocking": "false"
72+
}
73+
]
74+
}

Modules/TPC/src/Tracks.cxx

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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 Tracks.cxx
13+
/// \author Stefan Heckel, sheckel@cern.ch
14+
///
15+
16+
// root includes
17+
#include <TCanvas.h>
18+
#include <TH1.h>
19+
#include <TH2.h>
20+
//#include <gsl/span>
21+
22+
// O2 includes
23+
#include "Framework/ProcessingContext.h"
24+
#include "DataFormatsTPC/TrackTPC.h"
25+
26+
// QC includes
27+
#include "QualityControl/QcInfoLogger.h"
28+
#include "TPC/Tracks.h"
29+
30+
namespace o2::quality_control_modules::tpc
31+
{
32+
33+
void Tracks::initialize(o2::framework::InitContext& /*ctx*/)
34+
{
35+
QcInfoLogger::GetInstance() << "initialize TPC Tracks QC task" << AliceO2::InfoLogger::InfoLogger::endm;
36+
37+
mQCTracks.initializeHistograms();
38+
39+
for (auto& hist : mQCTracks.getHistograms1D()) {
40+
getObjectsManager()->startPublishing(&hist);
41+
getObjectsManager()->addMetadata(hist.GetName(), "custom", "34");
42+
}
43+
44+
for (auto& hist2 : mQCTracks.getHistograms2D()) {
45+
getObjectsManager()->startPublishing(&hist2);
46+
getObjectsManager()->addMetadata(hist2.GetName(), "custom", "42");
47+
}
48+
}
49+
50+
void Tracks::startOfActivity(Activity& /*activity*/)
51+
{
52+
QcInfoLogger::GetInstance() << "startOfActivity" << AliceO2::InfoLogger::InfoLogger::endm;
53+
mQCTracks.resetHistograms();
54+
}
55+
56+
void Tracks::startOfCycle()
57+
{
58+
QcInfoLogger::GetInstance() << "startOfCycle" << AliceO2::InfoLogger::InfoLogger::endm;
59+
}
60+
61+
void Tracks::monitorData(o2::framework::ProcessingContext& ctx)
62+
{
63+
using TrackType = std::vector<o2::tpc::TrackTPC>;
64+
auto tracks = ctx.inputs().get<TrackType>("inputTracks");
65+
//using TracksType = gsl::span<o2::tpc::TrackTPC>;
66+
//const auto tracks = ctx.inputs().get<TracksType>("inputTracks");
67+
QcInfoLogger::GetInstance() << "monitorData: " << tracks.size() << AliceO2::InfoLogger::InfoLogger::endm;
68+
69+
for (auto const& track : tracks) {
70+
mQCTracks.processTrack(track);
71+
}
72+
//mQCTracks.processAllTracks(tracks);
73+
}
74+
75+
void Tracks::endOfCycle()
76+
{
77+
QcInfoLogger::GetInstance() << "endOfCycle" << AliceO2::InfoLogger::InfoLogger::endm;
78+
}
79+
80+
void Tracks::endOfActivity(Activity& /*activity*/)
81+
{
82+
QcInfoLogger::GetInstance() << "endOfActivity" << AliceO2::InfoLogger::InfoLogger::endm;
83+
}
84+
85+
void Tracks::reset()
86+
{
87+
// clean all the monitor objects here
88+
89+
QcInfoLogger::GetInstance() << "Resetting the histogram" << AliceO2::InfoLogger::InfoLogger::endm;
90+
mQCTracks.resetHistograms();
91+
}
92+
93+
} // namespace o2::quality_control_modules::tpc

0 commit comments

Comments
 (0)