Skip to content

Commit 75e5a3e

Browse files
authored
QC-1233 Allow to select trending point timestamp in (Slice)TrendingTasks (#2423)
This also deprecates the behaviour for old-style validity objects which to my knowledge are not trended anymore and repo-cleaner usually updates them to contain a more realistic validity intervals. Also, if the aggregated quality validity is invalided, it is now replaced with last timestamp of the latest object instead of using the old-style validity, so we will not get the 10-years validity there anymore.
1 parent 6564cc8 commit 75e5a3e

File tree

7 files changed

+24
-6
lines changed

7 files changed

+24
-6
lines changed

Framework/include/QualityControl/SliceTrendingTaskConfig.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ struct SliceTrendingTaskConfig : PostProcessingConfig {
7171

7272
bool producePlotsOnUpdate;
7373
bool resumeTrend;
74+
std::string trendingTimestamp;
7475
std::vector<Plot> plots;
7576
std::vector<DataSource> dataSources;
7677
};

Framework/include/QualityControl/TrendingTaskConfig.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ struct TrendingTaskConfig : PostProcessingConfig {
6262
bool producePlotsOnUpdate{};
6363
bool resumeTrend{};
6464
bool trendIfAllInputs{ false };
65+
std::string trendingTimestamp;
6566
std::vector<Plot> plots;
6667
std::vector<DataSource> dataSources;
6768
};

Framework/src/SliceTrendingTask.cxx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,14 @@ void SliceTrendingTask::finalize(Trigger t, framework::ServiceRegistryRef)
136136
void SliceTrendingTask::trendValues(const Trigger& t,
137137
repository::DatabaseInterface& qcdb)
138138
{
139-
mTime = activity_helpers::isLegacyValidity(t.activity.mValidity)
140-
? t.timestamp / 1000
141-
: t.activity.mValidity.getMax() / 1000; // ROOT expects seconds since epoch.
139+
if (mConfig.trendingTimestamp == "trigger") {
140+
// ROOT expects seconds since epoch.
141+
mTime = t.timestamp / 1000;
142+
} else if (mConfig.trendingTimestamp == "validFrom") {
143+
mTime = t.activity.mValidity.getMin() / 1000;
144+
} else { // validUntil
145+
mTime = t.activity.mValidity.getMax() / 1000;
146+
}
142147
mMetaData.runNumber = t.activity.mId;
143148
for (auto& dataSource : mConfig.dataSources) {
144149
mNumberPads[dataSource.name] = 0;

Framework/src/SliceTrendingTaskConfig.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ SliceTrendingTaskConfig::SliceTrendingTaskConfig(const std::string& id,
2828
{
2929
producePlotsOnUpdate = config.get<bool>("qc.postprocessing." + id + ".producePlotsOnUpdate", true);
3030
resumeTrend = config.get<bool>("qc.postprocessing." + id + ".resumeTrend", false);
31+
trendingTimestamp = config.get<std::string>("qc.postprocessing." + id + ".trendingTimestamp", "validUntil");
3132
for (const auto& plotConfig : config.get_child("qc.postprocessing." + id + ".plots")) {
3233
plots.push_back({ plotConfig.second.get<std::string>("name"),
3334
plotConfig.second.get<std::string>("title", ""),

Framework/src/TrendingTask.cxx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,14 @@ void TrendingTask::finalize(Trigger, framework::ServiceRegistryRef)
174174

175175
bool TrendingTask::trendValues(const Trigger& t, repository::DatabaseInterface& qcdb)
176176
{
177-
mTime = activity_helpers::isLegacyValidity(t.activity.mValidity)
178-
? t.timestamp / 1000
179-
: t.activity.mValidity.getMax() / 1000; // ROOT expects seconds since epoch.
177+
if (mConfig.trendingTimestamp == "trigger") {
178+
// ROOT expects seconds since epoch.
179+
mTime = t.timestamp / 1000;
180+
} else if (mConfig.trendingTimestamp == "validFrom") {
181+
mTime = t.activity.mValidity.getMin() / 1000;
182+
} else { // validUntil
183+
mTime = t.activity.mValidity.getMax() / 1000;
184+
}
180185
mMetaData.runNumber = t.activity.mId;
181186
bool wereAllSourcesInvoked = true;
182187

Framework/src/TrendingTaskConfig.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ TrendingTaskConfig::TrendingTaskConfig(std::string id, const boost::property_tre
2626
producePlotsOnUpdate = config.get<bool>("qc.postprocessing." + id + ".producePlotsOnUpdate", true);
2727
resumeTrend = config.get<bool>("qc.postprocessing." + id + ".resumeTrend", false);
2828
trendIfAllInputs = config.get<bool>("qc.postprocessing." + id + ".trendIfAllInputs", false);
29+
trendingTimestamp = config.get<std::string>("qc.postprocessing." + id + ".trendingTimestamp", "validUntil");
2930

3031
for (const auto& [_, plotConfig] : config.get_child("qc.postprocessing." + id + ".plots")) {
3132
// since QC-1155 we allow for more than one graph in a single plot (canvas). we support both the new and old ways

doc/PostProcessing.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ some additional parameters.
289289
"detectorName": "TST",
290290
"resumeTrend": "false",
291291
"producePlotsOnUpdate": "true",
292+
"trendingTimestamp": "validUntil",
292293
"dataSources": [],
293294
"plots": [],
294295
"initTrigger": [ "once" ],
@@ -391,6 +392,9 @@ To pick up the last existing trend which matches the specified Activity, set `"r
391392

392393
To generate plots only when all input objects are available, set `"trendIfAllInputs"`.
393394

395+
`"trendingTimestamp"` allows to select which timestamp should be used as the trending point.
396+
The available options are `"trigger"` (timestamp provided by the trigger), `"validFrom"` (validity start in activity provided by the trigger), `"validUntil"` (validity end in activity provided by the trigger, default).
397+
394398
### The SliceTrendingTask class
395399
The `SliceTrendingTask` is a complementary task to the standard `TrendingTask`. This task allows the trending of canvas objects that hold multiple histograms (which have to be of the same dimension, e.g. TH1) and the slicing of histograms. The latter option allows the user to divide a histogram into multiple subsections along one or two dimensions which are trended in parallel to each other. The task has specific reductors for `TH1` and `TH2` objects which are `o2::quality_control_modules::common::TH1SliceReductor` and `o2::quality_control_modules::common::TH2SliceReductor`.
396400

0 commit comments

Comments
 (0)