Skip to content

Commit 92c372d

Browse files
initial ft0 calibration task with checker (#723)
* initial ft0 calibration task with checker * retrigger build Co-authored-by: Barthélémy von Haller <barthelemy.von.haller@gmail.com>
1 parent c8cad1e commit 92c372d

11 files changed

Lines changed: 442 additions & 115 deletions

Modules/FT0/CMakeLists.txt

Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@ target_sources(O2QcFT0 PRIVATE src/BasicDigitQcTask.cxx
77
src/ChannelsCheck.cxx
88
src/DigitsCheck.cxx
99
src/MergedTreeCheck.cxx
10-
src/TreeReaderPostProcessing.cxx)
10+
src/TreeReaderPostProcessing.cxx
11+
src/CalibrationTask.cxx
12+
src/ChannelTimeCalibrationCheck.cxx)
1113

1214
target_include_directories(
1315
O2QcFT0
1416
PUBLIC $<INSTALL_INTERFACE:include>
1517
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
1618
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
1719

18-
target_link_libraries(O2QcFT0 PUBLIC O2QualityControl O2::DataFormatsFT0)
19-
20+
target_link_libraries(O2QcFT0 PUBLIC O2QualityControl O2::DataFormatsFT0 O2::FITCalibration)
2021

2122
install(TARGETS O2QcFT0
2223
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
@@ -32,29 +33,32 @@ add_root_dictionary(O2QcFT0
3233
include/FT0/Utilities.h
3334
include/FT0/MergedTreeCheck.h
3435
include/FT0/TreeReaderPostProcessing.h
36+
include/FT0/CalibrationTask.h
37+
include/FT0/ChannelTimeCalibrationCheck.h
3538
LINKDEF include/FT0/LinkDef.h
3639
BASENAME O2QcFT0)
3740

3841
# ---- Executables ----
39-
40-
set(EXE_SRCS
41-
src/runDataProducer.cxx )
42-
set(EXE_NAMES
43-
o2-qc-ft0-data-producer)
44-
45-
list(LENGTH EXE_SRCS count)
46-
math(EXPR count "${count}-1")
47-
foreach(i RANGE ${count})
48-
list(GET EXE_SRCS ${i} src)
49-
list(GET EXE_NAMES ${i} name)
50-
add_executable(${name} ${src})
51-
target_link_libraries(${name} PRIVATE O2QualityControl O2QcFT0 O2::DataFormatsFT0)
52-
endforeach()
53-
54-
install(
55-
TARGETS o2-qc-ft0-data-producer
56-
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
57-
)
42+
# keep commented as an example
43+
44+
#set(EXE_SRCS
45+
# src/runDataProducer.cxx )
46+
#set(EXE_NAMES
47+
# o2-qc-ft0-data-producer)
48+
#
49+
#list(LENGTH EXE_SRCS count)
50+
#math(EXPR count "${count}-1")
51+
#foreach(i RANGE ${count})
52+
# list(GET EXE_SRCS ${i} src)
53+
# list(GET EXE_NAMES ${i} name)
54+
# add_executable(${name} ${src})
55+
# target_link_libraries(${name} PRIVATE O2QualityControl O2QcFT0 O2::DataFormatsFT0 O2::FITCalibration)
56+
#endforeach()
57+
58+
#install(
59+
# TARGETS o2-qc-ft0-data-producer
60+
# RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
61+
#)
5862

5963

6064
# ---- Test(s) ----
@@ -74,3 +78,17 @@ foreach(test ${TEST_SRCS})
7478
set_tests_properties(${test_name} PROPERTIES TIMEOUT 20)
7579
endforeach()
7680

81+
# ----- Configs -------
82+
install(FILES
83+
ft0-calibration-config.json
84+
ft0-multinode-config.json
85+
ft0-postprocessing-config.json
86+
ft0-basic-config.json
87+
DESTINATION etc)
88+
89+
get_property(dirs
90+
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
91+
PROPERTY INCLUDE_DIRECTORIES)
92+
foreach(dir ${dirs})
93+
message(STATUS "dir='${dir}'")
94+
endforeach()
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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?METRIC"
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+
"CalibrationTask": {
27+
"active": "true",
28+
"className": "o2::quality_control_modules::ft0::CalibrationTask",
29+
"moduleName": "QcFT0",
30+
"detectorName": "FT0",
31+
"mergingMode": "entire",
32+
"cycleDurationSeconds": "5",
33+
"maxNumberCycles": "-1",
34+
"dataSource": {
35+
"type": "dataSamplingPolicy",
36+
"name": "ft0-digits"
37+
},
38+
"taskParameters": {"CCDBUrl": "http://ccdb-test.cern.ch:8080"}
39+
}
40+
},
41+
"checks": {
42+
"CalibratedChannelTimeCheck": {
43+
"active": "true",
44+
"className": "o2::quality_control_modules::ft0::ChannelTimeCalibrationCheck",
45+
"moduleName": "QcFT0",
46+
"policy": "OnAny",
47+
"detectorName": "FT0",
48+
"dataSource": [{
49+
"type": "Task",
50+
"name": "CalibrationTask",
51+
"MOs": ["Calibrated_time_per_channel"]
52+
}],
53+
"checkParameters": {"MeanWarning": 3, "MeanError": 5, "RMSWarning": 999, "RMSError": 999, "MinEntries": 0}
54+
}
55+
}
56+
},
57+
"dataSamplingPolicies": [
58+
{
59+
"id": "ft0-digits",
60+
"active": "true",
61+
"machines": [],
62+
"query": "digits:FT0/DIGITSBC/0;channels:FT0/DIGITSCH/0",
63+
"samplingConditions": [
64+
{
65+
"condition": "random",
66+
"fraction": "0.1",
67+
"seed": "1234"
68+
}
69+
],
70+
"blocking": "false"
71+
}
72+
]
73+
}
File renamed without changes.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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 CalibrationTask.h
13+
/// \author Milosz Filus
14+
15+
#ifndef QUALITYCONTROL_FT0_CALIBRATIONTASK_H
16+
#define QUALITYCONTROL_FT0_CALIBRATIONTASK_H
17+
18+
#include "QualityControl/TaskInterface.h"
19+
#include <memory>
20+
#include "TH1.h"
21+
#include "TH2.h"
22+
#include "TTree.h"
23+
#include "TFile.h"
24+
#include "TGraph.h"
25+
#include "TMultiGraph.h"
26+
#include "Rtypes.h"
27+
#include "FT0Calibration/FT0ChannelTimeCalibrationObject.h"
28+
29+
using namespace o2::quality_control::core;
30+
31+
namespace o2::quality_control_modules::ft0
32+
{
33+
34+
class CalibrationTask final : public TaskInterface
35+
{
36+
public:
37+
/// \brief Constructor
38+
CalibrationTask() = default;
39+
/// Destructor
40+
~CalibrationTask() override;
41+
42+
// Definition of the methods for the template method pattern
43+
void initialize(o2::framework::InitContext& ctx) override;
44+
void startOfActivity(Activity& activity) override;
45+
void startOfCycle() override;
46+
void monitorData(o2::framework::ProcessingContext& ctx) override;
47+
void endOfCycle() override;
48+
void endOfActivity(Activity& activity) override;
49+
void reset() override;
50+
51+
private:
52+
static constexpr int CHANNEL_TIME_HISTOGRAM_RANGE = 200;
53+
static constexpr const char* CCDB_PARAM_KEY = "CCDBUrl";
54+
55+
// Object which will be published
56+
std::unique_ptr<TH1F> mNotCalibratedChannelTimeHistogram;
57+
std::unique_ptr<TH1F> mCalibratedChannelTimeHistogram;
58+
std::unique_ptr<TGraph> mChannelTimeCalibrationObjectGraph;
59+
std::unique_ptr<TH2F> mCalibratedTimePerChannelHistogram;
60+
std::unique_ptr<TH2F> mNotCalibratedTimePerChannelHistogram;
61+
o2::ft0::FT0ChannelTimeCalibrationObject* mCurrentChannelTimeCalibrationObject;
62+
};
63+
64+
} // namespace o2::quality_control_modules::ft0
65+
66+
#endif //QUALITYCONTROL_FT0_CALIBRATIONTASK_H
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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 ChannelTimeCalibrationCheck.h
13+
/// \author Milosz Filus
14+
15+
#ifndef QC_MODULE_FT0_FT0CalibrationCheck_H
16+
#define QC_MODULE_FT0_FT0CalibrationCheck_H
17+
18+
// Quality Control
19+
#include "QualityControl/CheckInterface.h"
20+
21+
namespace o2::quality_control_modules::ft0
22+
{
23+
24+
/// \brief
25+
///
26+
class ChannelTimeCalibrationCheck : public o2::quality_control::checker::CheckInterface
27+
{
28+
public:
29+
/// Default constructor
30+
ChannelTimeCalibrationCheck() = default;
31+
/// Destructor
32+
~ChannelTimeCalibrationCheck() override = default;
33+
34+
// Override interface
35+
void configure(std::string name) override;
36+
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
37+
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult) override;
38+
ClassDefOverride(ChannelTimeCalibrationCheck, 1);
39+
40+
private:
41+
static constexpr const char* MEAN_WARNING_KEY = "MeanWarning";
42+
static constexpr const char* MEAN_ERROR_KEY = "MeanError";
43+
static constexpr const char* RMS_WARNING_KEY = "RMSWarning";
44+
static constexpr const char* RMS_ERROR_KEY = "RMSError";
45+
static constexpr const char* MIN_ENTRIES_KEY = "MinEntries";
46+
47+
private:
48+
double mMeanWarning;
49+
double mMeanError;
50+
double mRMSWarning;
51+
double mRMSError;
52+
int mMinEntries;
53+
};
54+
55+
} // namespace o2::quality_control_modules::ft0
56+
57+
#endif

Modules/FT0/include/FT0/LinkDef.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@
1111
#pragma link C++ class o2::quality_control_modules::ft0::ChannelsCheck + ;
1212
#pragma link C++ class o2::quality_control_modules::ft0::MergedTreeCheck + ;
1313
#pragma link C++ class o2::quality_control_modules::ft0::TreeReaderPostProcessing + ;
14+
#pragma link C++ class o2::quality_control_modules::ft0::CalibrationTask + ;
15+
#pragma link C++ class o2::quality_control_modules::ft0::ChannelTimeCalibrationCheck + ;
1416

1517
#endif

0 commit comments

Comments
 (0)