Skip to content
Open
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
2 changes: 1 addition & 1 deletion Common/Core/Zorro.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
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);
toiCounters[i] = mScalers->GetBinContent(mTOIidx[i] + 2);
}
mZorroSummary.setupRun(runNumber, mInspectedTVX->GetBinContent(1), toiCounters);

Expand All @@ -232,8 +232,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 235 in Common/Core/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 236 in Common/Core/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 (!mAccountedBCranges[i]) {
Expand Down
29 changes: 18 additions & 11 deletions Common/Core/ZorroSummary.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
return n;
}

for (auto* obj : *list) {

Check failure on line 36 in Common/Core/ZorroSummary.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
auto* entry = dynamic_cast<ZorroSummary*>(obj);
if (!entry || entry->getTOInames() != mTOInames) {
continue;
Expand All @@ -56,19 +56,26 @@
return n;
}

double ZorroSummary::getNormalisationFactor(int toiId) const
std::unordered_map<int, std::vector<double>> ZorroSummary::getPerRunNormalisationFactors() const
{
double totalTOI{0.}, totalTVX{0.};
ULong64_t totalAnalysedTOI{0};
for (const auto& [runNumber, toiCounters] : mTOIcounters) {
totalTOI += toiCounters.at(toiId);
}
for (const auto& [runNumber, tvxCounters] : mTVXcounters) {
totalTVX += tvxCounters;
}
std::unordered_map<int, std::vector<double>> runNormalisations;
for (const auto& [runNumber, analysedTOIcounters] : mAnalysedTOIcounters) {
totalAnalysedTOI += analysedTOIcounters.at(toiId);
const double tvxCount = mTVXcounters.at(runNumber);
for (int toiId = 0; toiId < mNtois; ++toiId) {
double toiCount = mTOIcounters.at(runNumber).at(toiId);
ULong64_t analysedTOI = analysedTOIcounters.at(toiId);
runNormalisations[runNumber].push_back(tvxCount * analysedTOI / toiCount);
}
}
return runNormalisations;
}

return totalTVX * totalAnalysedTOI / totalTOI;
double ZorroSummary::getNormalisationFactor(int toiId) const
{
double normalisationFactor{0.};
auto runNormalisations = getPerRunNormalisationFactors();
for (const auto& [runNumber, normalisations] : runNormalisations) {
normalisationFactor += normalisations.at(toiId);
}
return normalisationFactor;
}
2 changes: 2 additions & 0 deletions Common/Core/ZorroSummary.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class ZorroSummary : public TNamed
mCurrentAnalysedTOIcounters = &mAnalysedTOIcounters[runNumber];
}
double getNormalisationFactor(int toiId) const;
std::unordered_map<int, std::vector<double>> getPerRunNormalisationFactors() const;

void increaseTOIcounter(int runNumber, int toiId)
{
if (runNumber != mRunNumber) {
Expand Down
Loading