CbmRoot
Loading...
Searching...
No Matches
compareHit.h
Go to the documentation of this file.
1/* Copyright (C) 2017-2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Florian Uhlig [committer] */
4
5#ifndef COMPAREHIT_H
6#define COMPAREHIT_H 1
7
8#include "CbmHit.h"
9#include "CbmMatch.h"
10
11#include "compareMatch.h"
12#include "gtest/gtest.h"
13
14void compareHitDataMembers(CbmHit& test, HitType type, double z, double dz, int32_t refid, int32_t address,
15 CbmMatch* match, double time, double errortime)
16{
17 int32_t retValInt {-111};
18 float retValFloat {-111.};
19
20 EXPECT_EQ(type, test.GetType());
21
22 retValFloat = test.GetZ();
23 EXPECT_FLOAT_EQ(z, retValFloat);
24
25 retValFloat = test.GetDz();
26 EXPECT_FLOAT_EQ(dz, retValFloat);
27
28 retValInt = test.GetRefId();
29 EXPECT_EQ(refid, retValInt);
30
31 retValInt = test.GetAddress();
32 EXPECT_EQ(address, retValInt);
33
34 if (match != nullptr) { compareMatchDataMembers(*test.GetMatch(), match->GetNofLinks(), match->GetTotalWeight()); }
35 else {
36 EXPECT_EQ(match, test.GetMatch());
37 }
38
39 retValFloat = test.GetTime();
40 EXPECT_FLOAT_EQ(time, retValFloat);
41
42 retValFloat = test.GetTimeError();
43 EXPECT_FLOAT_EQ(errortime, retValFloat);
44}
45
46#endif // COMPAREHIT_H
HitType
Definition CbmHit.h:21
double GetTimeError() const
Definition CbmHit.h:77
double GetDz() const
Definition CbmHit.h:72
double GetTime() const
Definition CbmHit.h:76
int32_t GetAddress() const
Definition CbmHit.h:74
HitType GetType() const
Definition CbmHit.h:70
double GetZ() const
Definition CbmHit.h:71
CbmMatch * GetMatch() const
Definition CbmHit.h:75
int32_t GetRefId() const
Definition CbmHit.h:73
int32_t GetNofLinks() const
Definition CbmMatch.h:42
double GetTotalWeight() const
Definition CbmMatch.h:43
void compareHitDataMembers(CbmHit &test, HitType type, double z, double dz, int32_t refid, int32_t address, CbmMatch *match, double time, double errortime)
Definition compareHit.h:14
void compareMatchDataMembers(CbmMatch &testMatch, int32_t noflinks, double weight)