Centrality Framework
Loading...
Searching...
No Matches
BordersFinder.hpp
1
7
8#ifndef CENTRALITY_BORDERSFINDER_H
9#define CENTRALITY_BORDERSFINDER_H
10
11#include "TH1.h"
12
13namespace Centrality {
14
15class BordersFinder {
16
17 public:
18 BordersFinder() = default;
19
20 void FindBorders();
21 void SaveBorders(const std::string& filename, const std::string& getter_name);
22
23 void SetHisto(const TH1F& h) { histo_ = h; }
24 TH1F& GetHisto() { return histo_; }// not const to use Draw etc
25
26 void SetRanges(const std::vector<double>& ranges) { ranges_ = ranges; }
27 void SetRanges(int n, double min, double max) {
28 ranges_.clear();
29 for (int i = 0; i <= n; ++i) {
30 ranges_.push_back(min + i * (max - min) / n);
31 }
32 }
36 void SetBorders(const std::vector<double>& borders) { borders_ = borders; }
37
38 void SetLimits(double xLo, double xHi) {
39 xLo_ = xLo;
40 xHi_ = xHi;
41 applyLimits_ = true;
42 }
43
44 void IsSpectator(bool is = true) { isSpectator_ = is; }
45
46 [[nodiscard]] const std::vector<double>& GetRanges() const { return ranges_; }
47 [[nodiscard]] const std::vector<double>& GetBorders() const { return borders_; }
48 [[nodiscard]] bool GetIsSpectator() const { return isSpectator_; }
49
50 private:
51 TH1F histo_;
52
53 std::vector<double> ranges_{};
54 std::vector<double> borders_{};
55
56 bool isSpectator_{false};
57
58 bool applyLimits_{false};
59 double xLo_{-1};
60 double xHi_{-1};
61};
62}// namespace Centrality
63
64#endif//CENTRALITY_BORDERSFINDER_H
void SetBorders(const std::vector< double > &borders)
Definition BordersFinder.hpp:36