CbmRoot
_GTestCbmPixelHit.cxx
Go to the documentation of this file.
1 #include "CbmPixelHit.h"
2 
3 #include <TVector3.h>
4 
5 #include <gtest/gtest-spi.h>
6 #include <gtest/gtest.h>
7 
8 #include "comparePixelHit.h"
9 
10 TEST(_GTestCbmPixelHit, CheckDefaultConstructor) {
11  CbmPixelHit test;
12  {
13  SCOPED_TRACE("CheckDefaultConstructor");
15  test, kPIXELHIT, 0., 0., -1, -1, nullptr, -1., -1., 0., 0., 0., 0., 0.);
16  }
17 }
18 
19 TEST(_GTestCbmPixelHit, CheckStandardConstructor) {
20  CbmPixelHit test {-1, 0., 0., 0., 0., 0., 0., 0., -1};
21  {
22  SCOPED_TRACE("CheckStandardConstructor");
24  test, kPIXELHIT, 0., 0., -1, -1, nullptr, -1., -1., 0., 0., 0., 0., 0.);
25  }
26 }
27 
28 TEST(_GTestCbmPixelHit, CheckStandardConstructorWithTime) {
29  CbmPixelHit test {-1, 0., 0., 0., 0., 0., 0., 0., -1, -2., -2.};
30  {
31  SCOPED_TRACE("CheckStandardConstructorWithTime");
33  test, kPIXELHIT, 0., 0., -1, -1, nullptr, -2., -2., 0., 0., 0., 0., 0.);
34  }
35 }
36 
37 TEST(_GTestCbmPixelHit, CheckStandardConstructorTVector3) {
38  TVector3 pos {
39  0.,
40  0.,
41  0.,
42  };
43  TVector3 poserror {
44  0.,
45  0.,
46  0.,
47  };
48  CbmPixelHit test {-1, pos, poserror, 0., -1};
49  {
50  SCOPED_TRACE("CheckStandardConstructor");
52  test, kPIXELHIT, 0., 0., -1, -1, nullptr, -1., -1., 0., 0., 0., 0., 0.);
53  }
54 }
55 
56 TEST(_GTestCbmPixelHit, CheckStandardConstructorTVector3WithTime) {
57  TVector3 pos {
58  0.,
59  0.,
60  0.,
61  };
62  TVector3 poserror {
63  0.,
64  0.,
65  0.,
66  };
67  CbmPixelHit test {-1, pos, poserror, 0., -1, -2., -2};
68  {
69  SCOPED_TRACE("CheckStandardConstructorWithTime");
71  test, kPIXELHIT, 0., 0., -1, -1, nullptr, -2., -2., 0., 0., 0., 0., 0.);
72  }
73 }
74 
75 TEST(_GTestCbmPixelHit, CheckSetters) {
76  CbmPixelHit test;
77  {
78  SCOPED_TRACE("CheckSetters: Initial Test");
80  test, kPIXELHIT, 0., 0., -1, -1, nullptr, -1., -1., 0., 0., 0., 0., 0.);
81  }
82 
83  test.SetX(-11.);
84  {
85  SCOPED_TRACE("CheckSetters: SetX");
87  test, kPIXELHIT, 0., 0., -1, -1, nullptr, -1., -1., -11., 0., 0., 0., 0.);
88  }
89 
90  test.SetDx(-12.);
91  {
92  SCOPED_TRACE("CheckSetters: SetDx");
94  kPIXELHIT,
95  0.,
96  0.,
97  -1,
98  -1,
99  nullptr,
100  -1.,
101  -1.,
102  -11.,
103  -12.,
104  0.,
105  0.,
106  0.);
107  }
108 
109  test.SetY(-13.);
110  {
111  SCOPED_TRACE("CheckSetters: SetY");
113  kPIXELHIT,
114  0.,
115  0.,
116  -1,
117  -1,
118  nullptr,
119  -1.,
120  -1.,
121  -11.,
122  -12.,
123  -13.,
124  0.,
125  0.);
126  }
127 
128  test.SetDy(-14.);
129  {
130  SCOPED_TRACE("CheckSetters: SetDy");
132  kPIXELHIT,
133  0.,
134  0.,
135  -1,
136  -1,
137  nullptr,
138  -1.,
139  -1.,
140  -11.,
141  -12.,
142  -13.,
143  -14.,
144  0.);
145  }
146 
147  test.SetDxy(-15.);
148  {
149  SCOPED_TRACE("CheckSetters: SetDxy");
151  kPIXELHIT,
152  0.,
153  0.,
154  -1,
155  -1,
156  nullptr,
157  -1.,
158  -1.,
159  -11.,
160  -12.,
161  -13.,
162  -14.,
163  -15.);
164  }
165 
166  TVector3 pos {-21., -22., -23.};
167  test.SetPosition(pos);
168  {
169  SCOPED_TRACE("CheckSetters: SetPosition");
171  kPIXELHIT,
172  -23.,
173  0.,
174  -1,
175  -1,
176  nullptr,
177  -1.,
178  -1.,
179  -21.,
180  -12.,
181  -22.,
182  -14.,
183  -15.);
184  }
185 
186  TVector3 poserror {-31., -32., -33.};
187  test.SetPositionError(poserror);
188  {
189  SCOPED_TRACE("CheckSetters: SetPosition");
191  kPIXELHIT,
192  -23.,
193  -33.,
194  -1,
195  -1,
196  nullptr,
197  -1.,
198  -1.,
199  -21.,
200  -31.,
201  -22.,
202  -32.,
203  -15.);
204  }
205 
206  TVector3 pos1;
207  test.Position(pos1);
208  EXPECT_FLOAT_EQ(pos1.X(), pos.X());
209  EXPECT_FLOAT_EQ(pos1.Y(), pos.Y());
210  EXPECT_FLOAT_EQ(pos1.Z(), pos.Z());
211 
212  TVector3 poserror1;
213  test.PositionError(poserror1);
214  EXPECT_FLOAT_EQ(poserror1.X(), poserror.X());
215  EXPECT_FLOAT_EQ(poserror1.Y(), poserror.Y());
216  EXPECT_FLOAT_EQ(poserror1.Z(), poserror.Z());
217 }
218 
219 TEST(_GTestCbmPixelHit, CheckToString) {
220  CbmPixelHit test;
221  EXPECT_STREQ(
222  "CbmPixelHit: address=-1 pos=(0,0,0) err=(0,0,0) dxy=0 refId=-1\n",
223  test.ToString().c_str());
224 }
CbmPixelHit::SetY
void SetY(Double_t y)
Definition: CbmPixelHit.h:103
CbmPixelHit::Position
void Position(TVector3 &pos) const
Copies hit position to pos.
Definition: CbmPixelHit.cxx:64
comparePixelHit.h
CbmPixelHit::SetDy
void SetDy(Double_t dy)
Definition: CbmPixelHit.h:105
comparePixelHitDataMembers
void comparePixelHitDataMembers(CbmPixelHit &test, HitType type, Double_t z, Double_t dz, Int_t refid, Int_t address, CbmMatch *match, Double_t time, Double_t errortime, Double_t x, Double_t dx, Double_t y, Double_t dy, Double_t dxy)
Definition: comparePixelHit.h:9
CbmPixelHit::SetPositionError
void SetPositionError(const TVector3 &dpos)
Definition: CbmPixelHit.cxx:78
CbmPixelHit::SetDx
void SetDx(Double_t dx)
Definition: CbmPixelHit.h:104
CbmPixelHit.h
kPIXELHIT
@ kPIXELHIT
Definition: CbmHit.h:18
CbmPixelHit::SetX
void SetX(Double_t x)
Definition: CbmPixelHit.h:102
CbmPixelHit::ToString
virtual std::string ToString() const
Inherited from CbmBaseHit.
Definition: CbmPixelHit.cxx:56
TEST
TEST(_GTestCbmPixelHit, CheckDefaultConstructor)
Definition: _GTestCbmPixelHit.cxx:10
CbmPixelHit::SetPosition
void SetPosition(const TVector3 &pos)
Sets position of the hit.
Definition: CbmPixelHit.cxx:72
pos
TVector3 pos
Definition: CbmMvdSensorDigiToHitTask.cxx:60
CbmPixelHit
Definition: CbmPixelHit.h:21
CbmPixelHit::SetDxy
void SetDxy(Double_t dxy)
Definition: CbmPixelHit.h:106
CbmPixelHit::PositionError
void PositionError(TVector3 &dpos) const
Copies hit position error to pos.
Definition: CbmPixelHit.cxx:68