1+ // Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+ // See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+ // All rights not expressly granted are reserved.
4+ //
5+ // This software is distributed under the terms of the GNU General Public
6+ // License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+ //
8+ // In applying this license CERN does not waive the privileges and immunities
9+ // granted to it by virtue of its status as an Intergovernmental Organization
10+ // or submit itself to any jurisdiction.
11+ //
12+
13+ #ifndef EVENTFILTERING_ZORROSUMMARY_H_
14+ #define EVENTFILTERING_ZORROSUMMARY_H_
15+
16+ #include < TNamed.h>
17+
18+ #include < string>
19+ #include < unordered_map>
20+ #include < vector>
21+
22+ class ZorroSummary : public TNamed
23+ {
24+ public:
25+ ZorroSummary () = default ;
26+ ZorroSummary (const char * name, const char * objTitle) : TNamed(name, objTitle) {}
27+ virtual ~ZorroSummary () = default ; // NOLINT: Making this override breaks compilation for unknown reason
28+ virtual void Copy (TObject& c) const ; // NOLINT: Making this override breaks compilation for unknown reason
29+ virtual Long64_t Merge (TCollection* list);
30+
31+ void setupTOIs (int ntois, const std::string& toinames)
32+ {
33+ mNtois = ntois;
34+ mTOInames = toinames;
35+ }
36+ void setupRun (int runNumber, double tvxCountes, const std::vector<double >& toiCounters)
37+ {
38+ if (mRunNumber == runNumber) {
39+ return ;
40+ }
41+ mRunNumber = runNumber;
42+ mTVXcounters [runNumber] = tvxCountes;
43+ mTOIcounters [runNumber] = toiCounters;
44+ if (mAnalysedTOIcounters .find (runNumber) == mAnalysedTOIcounters .end ()) {
45+ mAnalysedTOIcounters [runNumber] = std::vector<ULong64_t>(mNtois , 0ull );
46+ }
47+ mCurrentAnalysedTOIcounters = &mAnalysedTOIcounters [runNumber];
48+ }
49+ double getNormalisationFactor (int toiId) const ;
50+ void increaseTOIcounter (int runNumber, int toiId)
51+ {
52+ if (runNumber != mRunNumber ) {
53+ return ;
54+ }
55+ mCurrentAnalysedTOIcounters ->at (toiId)++;
56+ }
57+
58+ std::string getTOInames () const { return mTOInames ; }
59+ const auto & getTOIcounters () const { return mTOIcounters ; }
60+ const auto & getTVXcounters () const { return mTVXcounters ; }
61+ const auto & getAnalysedTOIcounters () const { return mAnalysedTOIcounters ; }
62+
63+ private:
64+ int mRunNumber = 0 ; // ! Run currently being analysed
65+ std::vector<ULong64_t>* mCurrentAnalysedTOIcounters = nullptr ; // ! Analysed TOI counters for the current run
66+
67+ int mNtois = 0 ;
68+ std::string mTOInames ;
69+ std::unordered_map<int , std::vector<ULong64_t>> mAnalysedTOIcounters ;
70+ std::unordered_map<int , std::vector<double >> mTOIcounters ;
71+ std::unordered_map<int , double > mTVXcounters ;
72+
73+ ClassDef (ZorroSummary, 1 );
74+ };
75+
76+ #endif // EVENTFILTERING_ZORROSUMMARY_H_
0 commit comments