Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Framework/include/QualityControl/SliceTrendingTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,12 @@ class SliceTrendingTask : public PostProcessingInterface
void finalize(Trigger, framework::ServiceRegistryRef) final;

private:
static constexpr size_t MaxRunNumberStringLength = 6;
struct MetaData {
// we store run numbers both as an integer and as a string to allow users to select whether they need
// a trend in integer or label domain (the latter will contain evenly-spaced data points)
Int_t runNumber = 0;
char runNumberStr[MaxRunNumberStringLength + 1] = { 0 }; // 6 characters + null terminator
};
struct TitleSettings {
std::string observableX;
Expand Down
6 changes: 5 additions & 1 deletion Framework/include/QualityControl/TrendingTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,15 @@ class TrendingTask : public PostProcessingInterface
void finalize(Trigger, framework::ServiceRegistryRef) override;

private:
static constexpr size_t MaxRunNumberStringLength = 6;
struct {
// we store run numbers both as an integer and as a string to allow users to select whether they need
// a trend in integer or label domain (the latter will contain evenly-spaced data points)
Long64_t runNumber = 0;
char runNumberStr[MaxRunNumberStringLength + 1] = { 0 }; // 6 characters + null terminator
static const char* getBranchLeafList()
{
return "runNumber/L";
return "runNumber/L:runNumberStr/C";
}
} mMetaData;

Expand Down
2 changes: 2 additions & 0 deletions Framework/src/SliceTrendingTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ void SliceTrendingTask::trendValues(const Trigger& t,
mTime = t.activity.mValidity.getMax() / 1000;
}
mMetaData.runNumber = t.activity.mId;
std::snprintf(mMetaData.runNumberStr, MaxRunNumberStringLength + 1, "%d", t.activity.mId);

for (auto& dataSource : mConfig.dataSources) {
mNumberPads[dataSource.name] = 0;
mSources[dataSource.name]->clear();
Expand Down
3 changes: 2 additions & 1 deletion Framework/src/TrendingTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,9 @@ bool TrendingTask::trendValues(const Trigger& t, repository::DatabaseInterface&
mTime = t.activity.mValidity.getMax() / 1000;
}
mMetaData.runNumber = t.activity.mId;
bool wereAllSourcesInvoked = true;
std::snprintf(mMetaData.runNumberStr, MaxRunNumberStringLength + 1, "%d", t.activity.mId);

bool wereAllSourcesInvoked = true;
for (auto& dataSource : mConfig.dataSources) {
if (!reductor_helpers::updateReductor(mReductors[dataSource.name].get(), t, dataSource, qcdb, *this)) {
wereAllSourcesInvoked = false;
Expand Down
6 changes: 3 additions & 3 deletions Modules/Common/src/TH1SliceReductor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ void TH1SliceReductor::GetTH1StatsY(TH1* hist, float stats[3],

// Safety measures.
if (lowerBin <= 0 || upperBin <= 0) {
ILOG(Error, Support) << "Error: Negative bin in TH1ReducterTPC::GetTH1StatsY" << ENDM;
ILOG(Error, Support) << "Error: Negative bin in TH1SliceReductor::GetTH1StatsY" << ENDM;
exit(0);
}
if (upperBin < lowerBin) {
ILOG(Error, Support) << "Error: Upper bin smaller than lower bin in TH1ReducterTPC::GetTH1StatsY" << ENDM;
ILOG(Error, Support) << "Error: Upper bin smaller than lower bin in TH1SliceReductor::GetTH1StatsY" << ENDM;
exit(0);
}
if (nTotalBins < iterateBins) {
ILOG(Error, Support) << "Error: Bin region bigger than total amount of bins TH1ReducterTPC::GetTH1StatsY" << ENDM;
ILOG(Error, Support) << "Error: Bin region bigger than total amount of bins TH1SliceReductor::GetTH1StatsY" << ENDM;
exit(0);
}

Expand Down
2 changes: 1 addition & 1 deletion doc/PostProcessing.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ In such case, to reduce a Monitor Object or Quality Object, one has to inherit R

All the values are stored in a **TTree**.
Each data source forms a separate branch, with its leaves being the individual values.
Additionally added columns include a `time` branch and a `metadata` branch (now consisting only of `runNumber`).
Additionally added columns include a `time` branch and a `metadata` branch, consisting of `runNumber` (integer) and `runNumberStr` (string/label).

The TTree is stored back to the **QC database** each time it is updated.
In addition, the class exposes the [`TTree::Draw`](https://root.cern/doc/master/classTTree.html#a73450649dc6e54b5b94516c468523e45) interface, which allows to instantaneously generate **plots** with trends, correlations or histograms that are also sent to the QC database.
Expand Down