VEyeRecObj.cc
Go to the documentation of this file.
1 #include <cmath>
2 #include <iostream>
3 #include <sstream>
4 #include <utl/AugerUnits.h>
5 #include "ValidationUtil.h"
6 #include "VEyeRecObj.h"
7 
8 using namespace std;
9 using namespace utl;
10 
11 
12 ClassImp(VEyeRecObj);
13 
14 
16  VEye_Id(0),
17  VThetaSDP(-999.),
18  VPhiSDP(-999.),
19  VThetaAxis(-999.),
20  VPhiAxis(-999.),
21  VXMax(-999.),
22  VEem(-999.),
23  VEtot(-999.)
24 {
25 }
26 
27 
28 void
29 VEyeRecObj::SetRecord(const Int_t neye, const Double_t thsdp, const Double_t phsdp,
30  const Double_t thaxi, const Double_t phaxi, const Double_t xmax,
31  const Double_t eem, const Double_t etot)
32 {
33  VEye_Id = neye;
34  VThetaSDP = thsdp;
35  VPhiSDP = phsdp;
36  VThetaAxis = thaxi;
37  VPhiAxis = phaxi;
38  VXMax = xmax;
39  VEem = eem;
40  VEtot = etot;
41 }
42 
43 
44 void
46 {
47  cout << "EyeId " << GetEyeId() << '\n'
48  << "ThetaSDP " << GetThetaSDP() << '\n'
49  << "PhiSDP " << GetPhiSDP() << '\n'
50  << "ThetaAxis " << GetThetaAxis() << '\n'
51  << "PhiAxis " << GetPhiAxis() << '\n'
52  << "Xmax " << GetXMax() << '\n'
53  << "Eem " <<GetEem() << '\n'
54  << "Etot " << GetEtot() << endl;
55 }
56 
57 
58 bool
60 {
61  if (!GetXMax() || !GetEem() || !GetEtot())
62  return false;
63 
64  if (e.GetEyeId() != GetEyeId())
65  return false;
66 
67  const double angleSDP =
70 
71  if (angleSDP > 1e-2*degree)
72  return false;
73 
74  const double angleAxis =
77  if (angleAxis > 1e-2*degree)
78  return false;
79 
80  if (RelativeError(e.GetXMax(), GetXMax()) > 5e-3)
81  return false;
82 
83  if (RelativeError(e.GetEem(), GetEem()) > 5e-3)
84  return false;
85 
86  if (RelativeError(e.GetEtot(), GetEtot()) > 5e-3)
87  return false;
88 
89  return true;
90 }
91 
92 
93 template<typename T>
94 string
95 OutputEqual(const T& x, const T& y)
96 {
97  ostringstream os;
98  os << x << (x == y ? " == " : " != ") << y;
99  return os.str();
100 }
101 
102 
103 bool
104 operator==(const VEyeRecObj& ex, const VEyeRecObj& ey)
105 {
106  cout << "EyeId " << OutputEqual(ex.GetEyeId(), ey.GetEyeId()) << '\n'
107  << "ThetaSDP " << OutputEqual(ex.GetThetaSDP(), ey.GetThetaSDP()) << '\n'
108  << "PhiSDP " << OutputEqual(ex.GetPhiSDP(), ey.GetPhiSDP()) << '\n'
109  << "ThetaAxis " << OutputEqual(ex.GetThetaAxis(), ey.GetThetaAxis()) << '\n'
110  << "PhiAxis " << OutputEqual(ex.GetPhiAxis(), ey.GetPhiAxis()) << '\n'
111  << "Xmax " << OutputEqual(ex.GetXMax(), ey.GetXMax()) << '\n'
112  << "Eem " << OutputEqual(ex.GetEem(), ey.GetEem()) << '\n'
113  << "Etot " << OutputEqual(ex.GetEtot(), ey.GetEtot()) << endl;
114  return (ex.GetEyeId() == ey.GetEyeId() &&
115  ex.GetThetaSDP() == ey.GetThetaSDP() &&
116  ex.GetPhiSDP() == ey.GetPhiSDP() &&
117  ex.GetThetaAxis() == ey.GetThetaAxis() &&
118  ex.GetPhiAxis() == ey.GetPhiAxis() &&
119  ex.GetXMax() == ey.GetXMax() &&
120  ex.GetEem() == ey.GetEem() &&
121  ex.GetEtot() == ey.GetEtot());
122 }
bool Match(const VEyeRecObj &e)
Definition: VEyeRecObj.cc:59
Double_t GetThetaSDP() const
Definition: VEyeRecObj.h:34
Double_t GetEem() const
Definition: VEyeRecObj.h:39
const double degree
double Angle(const double theta1, const double phi1, const double theta2, const double phi2)
string OutputEqual(const T &x, const T &y)
Definition: VEyeRecObj.cc:95
Double_t GetThetaAxis() const
Definition: VEyeRecObj.h:36
Double_t GetPhiAxis() const
Definition: VEyeRecObj.h:37
Double_t VEtot
Definition: VEyeRecObj.h:20
Double_t VXMax
Definition: VEyeRecObj.h:18
Double_t VThetaAxis
Definition: VEyeRecObj.h:16
Int_t GetEyeId() const
Definition: VEyeRecObj.h:33
Double_t VPhiSDP
Definition: VEyeRecObj.h:15
double RelativeError(const double a, const double b)
Double_t GetPhiSDP() const
Definition: VEyeRecObj.h:35
Double_t VPhiAxis
Definition: VEyeRecObj.h:17
Int_t VEye_Id
Definition: VEyeRecObj.h:13
bool operator==(const TimeStamp &ts, const TimeRange &tr)
Definition: TimeRange.h:97
void SetRecord(const Int_t neye, const Double_t thsdp, const Double_t phsdp, const Double_t thaxi, const Double_t phaxi, const Double_t xmax, const Double_t eem, const Double_t etot)
Definition: VEyeRecObj.cc:29
Double_t VEem
Definition: VEyeRecObj.h:19
Double_t GetEtot() const
Definition: VEyeRecObj.h:40
void Dump()
Definition: VEyeRecObj.cc:45
Double_t GetXMax() const
Definition: VEyeRecObj.h:38
Double_t VThetaSDP
Definition: VEyeRecObj.h:14

, generated on Tue Sep 26 2023.