Centrality Framework
Loading...
Searching...
No Matches
Getter.hpp
1
8#ifndef CENTRALITY_GETTER_H
9#define CENTRALITY_GETTER_H
10
11#include "array"
12#include "vector"
13#include <cassert>
14
15#include "TAxis.h"
16#include "TObject.h"
17#include "TRandom.h"
18
19namespace Centrality {
20
21class Getter : public TObject {
22
23 public:
24 Getter() = default;
25
26 double GetCentrality(double value) const;
27 double GetCentrality(double xvalue, double yvalue) const;
28
29 void SetBorders(const std::vector<double>& borders) {
30 borders_ = TAxis(borders.size() - 1, &(borders[0]));
31 isinitialized_ = true;
32 }
33
34 const TAxis& GetBorders() const { return borders_; };
35 const std::vector<double>& GetRanges() const { return ranges_; };
36
37 void SetRanges(const std::vector<double>& ranges) { ranges_ = ranges; }
38 void IsSpectator(bool is = true) { isspectator_ = is; }
39
40 void AddBorder2D(const std::array<double, 2>& border2D) {
41 borders2d_.push_back(border2D);
42 if (!isinitialized2D_) { isinitialized2D_ = true; }
43 }
44
45 const std::vector<std::array<double, 2>>& GetBorders2D() const { return borders2d_; };
46
47 void SetMax(double x, double y) {
48 xmax_ = x;
49 ymax_ = y;
50 }
51
52 static Getter* Create1DGetter(std::vector<double> borders);
53
54 private:
55 TAxis borders_;
56 std::vector<std::array<double, 2>> borders2d_{};
57 std::vector<double> ranges_{};
58
59 double xmax_{1.};
60 double ymax_{1.};
61
62 bool isspectator_{false};
63 bool isinitialized_{false};
64 bool isinitialized2D_{false};
65
66 ClassDef(Getter, 2);
67};
68}// namespace Centrality
69
70#endif//CENTRALITY_GETTER_H
Class to calculate centrality class.
Definition Getter.hpp:21