NAIA  1.0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
Rich.cpp
Go to the documentation of this file.
1 #include "Containers/Rich.h"
2 
3 namespace NAIA {
4 
5 const std::string RichBase::BranchName = "RichBaseData";
6 const std::string RichPlus::BranchName = "RichPlusData";
7 
8 void RichBaseData::Clear() { m_beta.clear(); }
9 void RichBaseData::Dump() const {}
10 
12  if (!m_beta.empty()) {
13  return m_beta[0].hasBetaLIP;
14  }
15 
16  return false;
17 }
18 
19 bool RichBaseData::IsNaF() const {
20  if (!m_beta.empty()) {
21  return m_beta[0].isNaF;
22  }
23 
24  return false;
25 }
26 
28  if (!m_beta.empty()) {
29  return m_beta[0].beta;
30  }
31 
32  return {};
33 }
34 
36  if (!m_beta.empty()) {
37  return m_beta[0].ebeta;
38  }
39 
40  return {};
41 }
42 
44  if (!m_beta.empty() && m_beta[0].beta.size() > 1) {
45  return std::fabs(m_beta[0].beta.at(Rich::BetaType::CIEMAT) - m_beta[0].beta.at(Rich::BetaType::LIP));
46  }
47 
48  return std::numeric_limits<double>::max();
49 }
50 
51 double RichBaseData::BetaConsistencyTof(const TofBaseData &tofData) const {
52  if (!m_beta.empty() && ContainsKeys(m_beta[0].beta, Rich::BetaType::CIEMAT) &&
54  return std::fabs(m_beta[0].beta.at(Rich::BetaType::CIEMAT) - tofData.Beta.at(Tof::BetaType::BetaH));
55  }
56 
57  return std::numeric_limits<double>::max();
58 }
59 
61  if (m_beta.empty())
62  return -1;
63  float x = m_beta[0].Pos[0];
64  float y = m_beta[0].Pos[1];
65  constexpr int grid_side_length = 11;
66  constexpr int n_tiles = grid_side_length * grid_side_length;
67  constexpr double tile_width = 0.1 + 11.5;
68 
69  if (std::fabs(x) < tile_width * 1.5 && std::fabs(y) < tile_width * 1.5)
70  return 121;
71 
72  int nx = int(x / tile_width + 5.5);
73  int ny = int(y / tile_width + 5.5);
74  int t = ny * grid_side_length + nx;
75  return t > n_tiles ? -1 : t;
76 }
77 
79  if (m_beta.empty())
80  return false;
81 
82  constexpr int nbadtiles = 5; // tiles with bad beta recosntruction
83  std::array<int, nbadtiles> kbadtile = {3, 7, 87, 100, 108};
84 
85  float x = m_beta[0].Pos[0];
86  float y = m_beta[0].Pos[1];
87  float cut_aerogelexternalborder = 3500.; // aerogel external border (r**2)
88  // mdb: Cut particles that are on the outer edge of the aerogel, esp if they fall on small tiles (?)
89  float cut_aerogel_nafborder[2] = {17., 19.}; // aerogel/NaF border ([0]=NaF, [1]=aerogel)
90  // mdb: Also cut particles that fall close to the NaF/aerogel border
91 
92  if (IsNaF()) {
93  if (std::max(std::fabs(x), std::fabs(y)) > cut_aerogel_nafborder[0])
94  return false;
95  } else {
96  if (x * x + y * y > cut_aerogelexternalborder)
97  return false;
98  if (std::max(std::fabs(x), std::fabs(y)) < cut_aerogel_nafborder[1])
99  return false;
100  for (int kbad = 0; kbad < nbadtiles; kbad++) {
101  if (GetTileIndex() == kbadtile[kbad])
102  return false;
103  }
104  }
105  return true;
106 }
107 
108 //=======================================
109 void RichPlusData::Clear() { m_data.clear(); }
110 void RichPlusData::Dump() const {}
111 
112 } // namespace NAIA
void Dump() const
Dump on screen container content.
Definition: Rich.cpp:110
int GetTileIndex() const
Get the ID of the radiator tile where the ring is generated.
Definition: Rich.cpp:60
std::vector< RichAdditionalData > m_data
Definition: Rich.h:239
TofBetaVariable< float > Beta
Beta measurement, one for each type. See Tof::BetaType for list of types.
Definition: Tof.h:49
double BetaConsistencyTof(const TofBaseData &tofData) const
Get the estimator for beta consistency between Rich and Tof.
Definition: Rich.cpp:51
void Clear()
Clear container content.
Definition: Rich.cpp:109
Container class for base Tof info.
Definition: Tof.h:46
static const std::string BranchName
Definition: Rich.h:155
bool HasBetaLIP() const
Returns true if Standalone LIP beta measurement is available.
Definition: Rich.cpp:11
double BetaConsistency() const
Get the estimator for beta consistency between CIEMAT and LIP reconstructions.
Definition: Rich.cpp:43
bool RingGeomTest() const
Checks if the track impact point on the radiator falls on the on the edge of the radiator (absolute o...
Definition: Rich.cpp:78
IHEP reconstruction.
Definition: Utils.h:349
bool IsNaF() const
Returns true if the radiator is NaF; false if it is AGL.
Definition: Rich.cpp:19
static const std::string BranchName
Definition: Rich.h:254
RichBetaVariable< float > GetBetaError() const
Get the Beta error.
Definition: Rich.cpp:35
std::vector< RichBaseDataR > m_beta
Definition: Rich.h:140
RichBetaVariable< float > GetBeta() const
Get the Beta measurements.
Definition: Rich.cpp:27
void Dump() const
Dump on screen container content.
Definition: Rich.cpp:9
Rich container class description.
std::enable_if< std::is_convertible< Key, size_t >::value, bool >::type ContainsKeys(const std::array< T, N > &container, Key key)
Definition: Utils.hpp:53
std::map< Rich::BetaType, T > RichBetaVariable
Definition: Rich.h:29
void Clear()
Clear container content.
Definition: Rich.cpp:8