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
13 changes: 4 additions & 9 deletions EventFiltering/Zorro.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in EventFiltering/Zorro.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/workflow-file]

Name of a workflow file must match the name of the main struct in it (without the PWG prefix). (Class implementation files should be in "Core" directories.)

Check failure on line 1 in EventFiltering/Zorro.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Provide mandatory file documentation.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand All @@ -8,7 +8,7 @@
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
//

Check failure on line 11 in EventFiltering/Zorro.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \author is missing, incorrect or misplaced.

Check failure on line 11 in EventFiltering/Zorro.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \brief is missing, incorrect or misplaced.

Check failure on line 11 in EventFiltering/Zorro.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \file is missing, incorrect or misplaced.

#include "Zorro.h"

Expand All @@ -18,6 +18,7 @@
#include <CommonConstants/LHCConstants.h>
#include <CommonDataFormat/IRFrame.h>
#include <CommonDataFormat/InteractionRecord.h>
#include <CommonUtils/StringUtils.h>
#include <Framework/HistogramRegistry.h>
#include <Framework/HistogramSpec.h>
#include <Framework/Logger.h>
Expand Down Expand Up @@ -188,7 +189,7 @@
metadata["runNumber"] = std::to_string(runNumber);
mRunDuration = mCCDB->getRunDuration(runNumber, true);
int64_t runTs = (mRunDuration.first / 2 + mRunDuration.second / 2);
auto ctp = ccdb->getForTimeStamp<std::vector<Long64_t>>("CTP/Calib/OrbitReset", runTs);

Check failure on line 192 in EventFiltering/Zorro.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
mOrbitResetTimestamp = (*ctp)[0];
mScalers = mCCDB->getSpecific<TH1D>(mBaseCCDBPath + "FilterCounters", runTs, metadata);
mSelections = mCCDB->getSpecific<TH1D>(mBaseCCDBPath + "SelectionCounters", runTs, metadata);
Expand All @@ -198,24 +199,18 @@
mLastSelectedIdx = 0;
mTOIs.clear();
mTOIidx.clear();
while (!tois.empty()) {
size_t pos = tois.find(",");
pos = (pos == std::string::npos) ? tois.size() : pos;
std::string token = tois.substr(0, pos);
// Trim leading and trailing whitespaces from the token
token.erase(0, token.find_first_not_of(" "));
token.erase(token.find_last_not_of(" ") + 1);
std::vector<std::string> tokens = o2::utils::Str::tokenize(tois, ','); // tokens are trimmed
for (auto const& token : tokens) {
int bin = findBin(mSelections, token) - 2;
mTOIs.push_back(token);
mTOIidx.push_back(bin);
tois = tois.erase(0, pos + 1);
}
mTOIcounts.resize(mTOIs.size(), 0);
LOGF(info, "Zorro initialized for run %d, triggers of interest:", runNumber);
for (size_t i{0}; i < mTOIs.size(); ++i) {
LOGF(info, ">>> %s : %i", mTOIs[i].data(), mTOIidx[i]);
}
mZorroSummary.setupTOIs(mTOIs.size(), tois);
mZorroSummary.setupTOIs(mTOIs.size(), mTOIs);
std::vector<double> toiCounters(mTOIs.size(), 0.);
for (size_t i{0}; i < mTOIs.size(); ++i) {
toiCounters[i] = mSelections->GetBinContent(mTOIidx[i] + 2);
Expand All @@ -240,8 +235,8 @@
mLastBCglobalId = bcGlobalId;
for (size_t i = mLastSelectedIdx; i < mBCranges.size(); i++) {
if (!mBCranges[i].isOutside(bcFrame)) {
for (int iMask{0}; iMask < 2; ++iMask) {

Check failure on line 238 in EventFiltering/Zorro.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
for (int iTOI{0}; iTOI < 64; ++iTOI) {

Check failure on line 239 in EventFiltering/Zorro.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
if (mZorroHelpers->at(i).selMask[iMask] & (1ull << iTOI)) {
mLastResult.set(iMask * 64 + iTOI, 1);
if (mAnalysedTriggers && !mAccountedBCranges[i]) {
Expand Down
12 changes: 9 additions & 3 deletions EventFiltering/ZorroSummary.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,18 @@
ZorroSummary(const char* name, const char* objTitle) : TNamed(name, objTitle) {}
virtual ~ZorroSummary() = default; // NOLINT: Making this override breaks compilation for unknown reason
virtual void Copy(TObject& c) const; // NOLINT: Making this override breaks compilation for unknown reason
virtual Long64_t Merge(TCollection* list);

Check failure on line 32 in EventFiltering/ZorroSummary.h

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.

void setupTOIs(int ntois, const std::string& toinames)
void setupTOIs(int ntois, const std::vector<std::string>& toinames)
{
mNtois = ntois;
mTOInames = toinames;
if (toinames.size() == 0) {
return;
}
mTOInames = toinames[0];
for (size_t i = 1; i < toinames.size(); i++) {
mTOInames += "," + toinames[i];
}
}
void setupRun(int runNumber, double tvxCountes, const std::vector<double>& toiCounters)
{
Expand All @@ -44,7 +50,7 @@
mRunNumber = runNumber;
mTVXcounters[runNumber] = tvxCountes;
mTOIcounters[runNumber] = toiCounters;
mAnalysedTOIcounters.try_emplace(runNumber, std::vector<ULong64_t>(mNtois, 0ull));

Check failure on line 53 in EventFiltering/ZorroSummary.h

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
mCurrentAnalysedTOIcounters = &mAnalysedTOIcounters[runNumber];
}
double getNormalisationFactor(int toiId) const;
Expand All @@ -56,7 +62,7 @@
mCurrentAnalysedTOIcounters->at(toiId)++;
}

std::string getTOInames() const { return mTOInames; }
const auto& getTOInames() const { return mTOInames; }
const auto& getTOIcounters() const { return mTOIcounters; }
const auto& getTVXcounters() const { return mTVXcounters; }
const auto& getAnalysedTOIcounters() const { return mAnalysedTOIcounters; }
Expand Down
Loading