compareHit.h 1.01 KB
Newer Older
1
2
3
4
5
6
7
#ifndef COMPAREHIT_H
#define COMPAREHIT_H 1

#include "CbmHit.h"
#include "CbmMatch.h"

#include "compareMatch.h"
Administrator's avatar
Administrator committed
8
#include "gtest/gtest.h"
9

10
11
12
void compareHitDataMembers(CbmHit& test, HitType type, Double_t z, Double_t dz, Int_t refid, Int_t address,
                           CbmMatch* match, Double_t time, Double_t errortime)
{
Administrator's avatar
Administrator committed
13
14
  Int_t retValInt {-111};
  Float_t retValFloat {-111.};
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

  EXPECT_EQ(type, test.GetType());

  retValFloat = test.GetZ();
  EXPECT_FLOAT_EQ(z, retValFloat);

  retValFloat = test.GetDz();
  EXPECT_FLOAT_EQ(dz, retValFloat);

  retValInt = test.GetRefId();
  EXPECT_EQ(refid, retValInt);

  retValInt = test.GetAddress();
  EXPECT_EQ(address, retValInt);

30
31
  if (match != nullptr) { compareMatchDataMembers(*test.GetMatch(), match->GetNofLinks(), match->GetTotalWeight()); }
  else {
32
33
34
    EXPECT_EQ(match, test.GetMatch());
  }

Administrator's avatar
Administrator committed
35
36
  retValFloat = test.GetTime();
  EXPECT_FLOAT_EQ(time, retValFloat);
37
38
39
40
41

  retValFloat = test.GetTimeError();
  EXPECT_FLOAT_EQ(errortime, retValFloat);
}

42
#endif  // COMPAREHIT_H