Skip to content

Commit

Permalink
QC-1233 Allow to select trending point timestamp in (Slice)TrendingTasks
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
knopers8 committed Sep 19, 2024
1 parent 3e09ce1 commit 984a41c
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 6 deletions.
1 change: 1 addition & 0 deletions Framework/include/QualityControl/SliceTrendingTaskConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ struct SliceTrendingTaskConfig : PostProcessingConfig {

bool producePlotsOnUpdate;
bool resumeTrend;
std::string trendingTimestamp;
std::vector<Plot> plots;
std::vector<DataSource> dataSources;
};
Expand Down
1 change: 1 addition & 0 deletions Framework/include/QualityControl/TrendingTaskConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ struct TrendingTaskConfig : PostProcessingConfig {
bool producePlotsOnUpdate{};
bool resumeTrend{};
bool trendIfAllInputs{ false };
std::string trendingTimestamp;
std::vector<Plot> plots;
std::vector<DataSource> dataSources;
};
Expand Down
11 changes: 8 additions & 3 deletions Framework/src/SliceTrendingTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,14 @@ void SliceTrendingTask::finalize(Trigger t, framework::ServiceRegistryRef)
void SliceTrendingTask::trendValues(const Trigger& t,
repository::DatabaseInterface& qcdb)
{
mTime = activity_helpers::isLegacyValidity(t.activity.mValidity)
? t.timestamp / 1000
: t.activity.mValidity.getMax() / 1000; // ROOT expects seconds since epoch.
if (mConfig.trendingTimestamp == "trigger") {
// ROOT expects seconds since epoch.
mTime = t.timestamp / 1000;
} else if (mConfig.trendingTimestamp == "validFrom") {
mTime = t.activity.mValidity.getMin() / 1000;
} else { // validUntil
mTime = t.activity.mValidity.getMax() / 1000;
}
mMetaData.runNumber = t.activity.mId;
for (auto& dataSource : mConfig.dataSources) {
mNumberPads[dataSource.name] = 0;
Expand Down
1 change: 1 addition & 0 deletions Framework/src/SliceTrendingTaskConfig.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ SliceTrendingTaskConfig::SliceTrendingTaskConfig(const std::string& id,
{
producePlotsOnUpdate = config.get<bool>("qc.postprocessing." + id + ".producePlotsOnUpdate", true);
resumeTrend = config.get<bool>("qc.postprocessing." + id + ".resumeTrend", false);
trendingTimestamp = config.get<std::string>("qc.postprocessing." + id + ".trendingTimestamp", "validUntil");
for (const auto& plotConfig : config.get_child("qc.postprocessing." + id + ".plots")) {
plots.push_back({ plotConfig.second.get<std::string>("name"),
plotConfig.second.get<std::string>("title", ""),
Expand Down
11 changes: 8 additions & 3 deletions Framework/src/TrendingTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,14 @@ void TrendingTask::finalize(Trigger, framework::ServiceRegistryRef)

bool TrendingTask::trendValues(const Trigger& t, repository::DatabaseInterface& qcdb)
{
mTime = activity_helpers::isLegacyValidity(t.activity.mValidity)
? t.timestamp / 1000
: t.activity.mValidity.getMax() / 1000; // ROOT expects seconds since epoch.
if (mConfig.trendingTimestamp == "trigger") {
// ROOT expects seconds since epoch.
mTime = t.timestamp / 1000;
} else if (mConfig.trendingTimestamp == "validFrom") {
mTime = t.activity.mValidity.getMin() / 1000;
} else { // validUntil
mTime = t.activity.mValidity.getMax() / 1000;
}
mMetaData.runNumber = t.activity.mId;
bool wereAllSourcesInvoked = true;

Expand Down
1 change: 1 addition & 0 deletions Framework/src/TrendingTaskConfig.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ TrendingTaskConfig::TrendingTaskConfig(std::string id, const boost::property_tre
producePlotsOnUpdate = config.get<bool>("qc.postprocessing." + id + ".producePlotsOnUpdate", true);
resumeTrend = config.get<bool>("qc.postprocessing." + id + ".resumeTrend", false);
trendIfAllInputs = config.get<bool>("qc.postprocessing." + id + ".trendIfAllInputs", false);
trendingTimestamp = config.get<std::string>("qc.postprocessing." + id + ".trendingTimestamp", "validUntil");

for (const auto& [_, plotConfig] : config.get_child("qc.postprocessing." + id + ".plots")) {
// since QC-1155 we allow for more than one graph in a single plot (canvas). we support both the new and old ways
Expand Down
4 changes: 4 additions & 0 deletions doc/PostProcessing.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ some additional parameters.
"detectorName": "TST",
"resumeTrend": "false",
"producePlotsOnUpdate": "true",
"trendingTimestamp": "validUntil",
"dataSources": [],
"plots": [],
"initTrigger": [ "once" ],
Expand Down Expand Up @@ -391,6 +392,9 @@ To pick up the last existing trend which matches the specified Activity, set `"r

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

`"trendingTimestamp"` allows to select which timestamp should be used as the trending point.
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).

### The SliceTrendingTask class
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`.

Expand Down

0 comments on commit 984a41c

Please sign in to comment.