GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TGriffinAngles.h
Go to the documentation of this file.
1#ifndef TGRIFFINANGLES_H
2#define TGRIFFINANGLES_H
3
4/** \addtogroup Analysis
5 * @{
6 */
7
8////////////////////////////////////////////////////////////////////////////////
9///
10/// \class TGriffinAngles
11///
12/// This class provides the number of angles, their values, and the index a
13/// specific angle is at, as well as how many combinations contribute to this
14/// angle.
15/// It is meant to be used for the angular correlation analysis.
16///
17////////////////////////////////////////////////////////////////////////////////
18
19#include <set>
20#include <map>
21#include <functional>
22
23#include "TNamed.h"
24#include "TGraphErrors.h"
25
26class TGriffinAngles : public TNamed {
27public:
28 explicit TGriffinAngles(double distance = 145., bool folding = false, bool grouping = false, bool addback = true);
29 TGriffinAngles(const TGriffinAngles&) = default;
30 TGriffinAngles(TGriffinAngles&&) noexcept = default;
31 TGriffinAngles& operator=(const TGriffinAngles&) = default;
32 TGriffinAngles& operator=(TGriffinAngles&&) noexcept = default;
33 ~TGriffinAngles() = default;
34
35 double Distance() const { return fDistance; }
36 bool Folding() const { return fFolding; }
37 bool Grouping() const { return fGrouping; }
38 bool Addback() const { return fAddback; }
39
40 int Index(double angle);
41 int NumberOfAngles() const { return fAngles.size(); }
42 double Angle(int index) const
43 {
44 auto it = fAngles.begin();
45 std::advance(it, index);
46 return *it;
47 }
48 double AverageAngle(int index) const;
49 int Count(double angle)
50 {
51 /// If the angle is in our map, report how often it exists, otherwise return zero.
52 if(fAngleCount.count(static_cast<int>(std::round(angle / fRounding))) == 1) { return fAngleCount.at(static_cast<int>(std::round(angle / fRounding))); }
53 return 0;
54 }
55
56 void FoldOrGroup(TGraphErrors* z0, TGraphErrors* z2, TGraphErrors* z4, bool verbose = false) const;
57 std::set<double>::iterator begin() const { return fAngles.begin(); }
58 std::set<double>::iterator end() const { return fAngles.end(); }
59
60 bool ExcludeDetector(int detector) const;
61 bool ExcludeCrystal(int detector, int crystal) const;
62
63 void Print(Option_t* = "") const override;
64
65 static double Rounding() { return fRounding; }
66 static void Rounding(const double& val) { fRounding = val; }
67
68private:
69 double fDistance{145.}; ///< distance of detector from center of array in mmm
70 bool fFolding{false}; ///< flag indicating whether we fold our distribution around 90 degree
71 bool fGrouping{false}; ///< flag indicating whether we group close angles together
72 bool fAddback{true}; ///< flag indicating whether we use addback
73 static double fRounding; ///< we consider any angles whose difference is less than this to be equal
74 std::vector<int> fExcludedDetectors; ///< list of detectors that are excluded in calculating the angles
75 std::vector<int> fExcludedCrystals; ///< list of crystals that are excluded in calculating the angles, the crystals are numbered as 4*(det-1)+cry, so start at 0 and go up to 63
76 std::vector<int> fCustomGrouping; ///< list of custom groups
77 std::set<double> fAngles; ///< set of unique angles, when grouping is used, the largest angle of the group is used!
78 std::map<double, int> fAngleMap; ///< Maps angles to indices. This is fairly straight forward without grouping, but if grouping is used multiple angles can be mapped to the same index.
79 std::map<int, int> fAngleCount; ///< Maps angles (divided by rounding and cast to integers) to number of combinations contributing to it.
80
81 /// \cond CLASSIMP
82 ClassDefOverride(TGriffinAngles, 4) // NOLINT(readability-else-after-return)
83 /// \endcond
84};
85/*! @} */
86#endif
std::set< double > fAngles
set of unique angles, when grouping is used, the largest angle of the group is used!
static void Rounding(const double &val)
TGriffinAngles(TGriffinAngles &&) noexcept=default
bool Addback() const
bool Grouping() const
static double fRounding
we consider any angles whose difference is less than this to be equal
void FoldOrGroup(TGraphErrors *z0, TGraphErrors *z2, TGraphErrors *z4, bool verbose=false) const
bool ExcludeDetector(int detector) const
bool fGrouping
flag indicating whether we group close angles together
double Distance() const
std::set< double >::iterator end() const
std::vector< int > fCustomGrouping
list of custom groups
bool Folding() const
void Print(Option_t *="") const override
double fDistance
distance of detector from center of array in mmm
bool fFolding
flag indicating whether we fold our distribution around 90 degree
bool fAddback
flag indicating whether we use addback
int NumberOfAngles() const
TGriffinAngles(double distance=145., bool folding=false, bool grouping=false, bool addback=true)
TGriffinAngles(const TGriffinAngles &)=default
double Angle(int index) const
int Index(double angle)
std::map< int, int > fAngleCount
Maps angles (divided by rounding and cast to integers) to number of combinations contributing to it.
std::vector< int > fExcludedDetectors
list of detectors that are excluded in calculating the angles
std::map< double, int > fAngleMap
Maps angles to indices. This is fairly straight forward without grouping, but if grouping is used mul...
std::vector< int > fExcludedCrystals
list of crystals that are excluded in calculating the angles, the crystals are numbered as 4*(det-1)+...
static double Rounding()
std::set< double >::iterator begin() const
bool ExcludeCrystal(int detector, int crystal) const
int Count(double angle)
double AverageAngle(int index) const