forked from AliceO2Group/O2Physics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathZorroSummary.h
More file actions
83 lines (72 loc) · 2.79 KB
/
ZorroSummary.h
File metadata and controls
83 lines (72 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// 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.
//
#ifndef EVENTFILTERING_ZORROSUMMARY_H_
#define EVENTFILTERING_ZORROSUMMARY_H_
#include <TNamed.h>
#include <Rtypes.h>
#include <RtypesCore.h>
#include <string>
#include <unordered_map>
#include <vector>
class ZorroSummary : public TNamed
{
public:
ZorroSummary() = default;
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);
void setupTOIs(int ntois, const std::vector<std::string>& toinames)
{
mNtois = ntois;
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)
{
if (mRunNumber == runNumber) {
return;
}
mRunNumber = runNumber;
mTVXcounters[runNumber] = tvxCountes;
mTOIcounters[runNumber] = toiCounters;
mAnalysedTOIcounters.try_emplace(runNumber, std::vector<ULong64_t>(mNtois, 0ull));
mCurrentAnalysedTOIcounters = &mAnalysedTOIcounters[runNumber];
}
double getNormalisationFactor(int toiId) const;
void increaseTOIcounter(int runNumber, int toiId)
{
if (runNumber != mRunNumber) {
return;
}
mCurrentAnalysedTOIcounters->at(toiId)++;
}
const auto& getTOInames() const { return mTOInames; }
const auto& getTOIcounters() const { return mTOIcounters; }
const auto& getTVXcounters() const { return mTVXcounters; }
const auto& getAnalysedTOIcounters() const { return mAnalysedTOIcounters; }
private:
int mRunNumber = 0; //! Run currently being analysed
std::vector<ULong64_t>* mCurrentAnalysedTOIcounters = nullptr; //! Analysed TOI counters for the current run
int mNtois = 0;
std::string mTOInames;
std::unordered_map<int, std::vector<ULong64_t>> mAnalysedTOIcounters;
std::unordered_map<int, std::vector<double>> mTOIcounters;
std::unordered_map<int, double> mTVXcounters;
ClassDef(ZorroSummary, 1);
};
#endif // EVENTFILTERING_ZORROSUMMARY_H_