CbmRoot
Loading...
Searching...
No Matches
_GTestCbmStripHit.cxx
Go to the documentation of this file.
1/* Copyright (C) 2016-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Florian Uhlig [committer] */
4
5#include "CbmStripHit.h"
6
7#include <TVector3.h>
8
9#include <gtest/gtest-spi.h>
10#include <gtest/gtest.h>
11
12#include "compareStripHit.h"
13
14TEST(_GTestCbmStripHit, CheckDefaultConstructor)
15{
16 CbmStripHit test;
17 {
18 SCOPED_TRACE("CheckDefaultConstructor");
19 compareStripHitDataMembers(test, kSTRIPHIT, 0., 0., -1, -1, nullptr, -1., -1., 0., 0., 0., 0.);
20 }
21}
22
23TEST(_GTestCbmStripHit, CheckStandardConstructor)
24{
25 CbmStripHit test {-1, 0., 0., 0., 0., 0., 0., -1};
26 {
27 SCOPED_TRACE("CheckStandardConstructor");
28 compareStripHitDataMembers(test, kSTRIPHIT, 0., 0., -1, -1, nullptr, -1., -1., 0., 0., 0., 0.);
29 }
30}
31
32TEST(_GTestCbmStripHit, CheckStandardConstructorWithTime)
33{
34 CbmStripHit test {-1, 0., 0., 0., 0., 0., 0., -1, -2., -2.};
35 {
36 SCOPED_TRACE("CheckStandardConstructorWithTime");
37 compareStripHitDataMembers(test, kSTRIPHIT, 0., 0., -1, -1, nullptr, -2., -2., 0., 0., 0., 0.);
38 }
39}
40
41TEST(_GTestCbmStripHit, CheckStandardConstructorTVector3)
42{
43 TVector3 pos {
44 0.,
45 0.,
46 0.,
47 };
48 TVector3 poserror {
49 0.,
50 0.,
51 0.,
52 };
53 CbmStripHit test {-1, pos, poserror, -1};
54 {
55 SCOPED_TRACE("CheckStandardConstructor");
56 compareStripHitDataMembers(test, kSTRIPHIT, 0., 0., -1, -1, nullptr, -1., -1., 0., 0., 0., 0.);
57 }
58}
59
60TEST(_GTestCbmStripHit, CheckStandardConstructorTVector3WithTime)
61{
62 TVector3 pos {
63 0.,
64 0.,
65 0.,
66 };
67 TVector3 poserror {
68 0.,
69 0.,
70 0.,
71 };
72 CbmStripHit test {-1, pos, poserror, -1, -2., -2};
73 {
74 SCOPED_TRACE("CheckStandardConstructorWithTime");
75 compareStripHitDataMembers(test, kSTRIPHIT, 0., 0., -1, -1, nullptr, -2., -2., 0., 0., 0., 0.);
76 }
77}
78
79TEST(_GTestCbmStripHit, CheckSetters)
80{
81 CbmStripHit test;
82 {
83 SCOPED_TRACE("CheckSetters: Initial Test");
84 compareStripHitDataMembers(test, kSTRIPHIT, 0., 0., -1, -1, nullptr, -1., -1., 0., 0., 0., 0.);
85 }
86
87 test.SetU(-11.);
88 {
89 SCOPED_TRACE("CheckSetters: SetU");
90 compareStripHitDataMembers(test, kSTRIPHIT, 0., 0., -1, -1, nullptr, -1., -1., -11., 0., 0., 0.);
91 }
92
93 test.SetDu(-12.);
94 {
95 SCOPED_TRACE("CheckSetters: SetDu");
96 compareStripHitDataMembers(test, kSTRIPHIT, 0., 0., -1, -1, nullptr, -1., -1., -11., -12., 0., 0.);
97 }
98
99 test.SetPhi(-13.);
100 {
101 SCOPED_TRACE("CheckSetters: SetPhi");
102 compareStripHitDataMembers(test, kSTRIPHIT, 0., 0., -1, -1, nullptr, -1., -1., -11., -12., -13., 0.);
103 }
104
105 test.SetDphi(-14.);
106 {
107 SCOPED_TRACE("CheckSetters: SetDphi");
108 compareStripHitDataMembers(test, kSTRIPHIT, 0., 0., -1, -1, nullptr, -1., -1., -11., -12., -13., -14.);
109 }
110}
111
112TEST(_GTestCbmMatch, CheckToString)
113{
114 CbmStripHit test;
115 EXPECT_STREQ("CbmStripHit: address=-1 pos=(0,0,0) err=(0,0,0) refId=-1\n", test.ToString().c_str());
116}
@ kSTRIPHIT
Definition CbmHit.h:24
TEST(_GTestCbmStripHit, CheckDefaultConstructor)
void SetDu(double du)
Definition CbmStripHit.h:81
virtual std::string ToString() const
Inherited from CbmBaseHit.
void SetU(double u)
Definition CbmStripHit.h:79
void SetDphi(double dphi)
Definition CbmStripHit.h:82
void SetPhi(double phi)
Definition CbmStripHit.h:80
void compareStripHitDataMembers(CbmStripHit &test, HitType type, double z, double dz, int32_t refid, int32_t address, CbmMatch *match, double time, double errortime, double u, double du, double phi, double dphi)