CbmRoot
Loading...
Searching...
No Matches
compareMvdDigiClasses.h
Go to the documentation of this file.
1/* Copyright (C) 2025 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau [committer] */
4
5#ifndef COMPAREMVDDIGICLASSES_H
6#define COMPAREMVDDIGICLASSES_H 1
7
8#include "CbmMvdDigi.h"
9#include "CbmMvdRawDigi.h"
10#include "gtest/gtest.h"
11
12#include <limits>
13
14void compareMvdDigiDataMembers(CbmMvdDigi& test, int32_t iStation, int32_t iChannelNrX, int32_t iChannelNrY,
15 float charge, float pixelSizeX, float pixelSizeY, double time, int32_t frame,
16 int32_t flag, int32_t refId)
17{
18 int32_t retValInt{-222};
19 double retValDouble{-222.};
20
21 retValInt = test.GetStationNr();
22 EXPECT_EQ(iStation, retValInt);
23
24 retValInt = test.GetPixelX();
25 EXPECT_EQ(iChannelNrX, retValInt);
26
27 retValInt = test.GetPixelY();
28 EXPECT_EQ(iChannelNrY, retValInt);
29
30 retValDouble = test.GetCharge();
31 EXPECT_FLOAT_EQ(charge, retValDouble);
32
33 retValDouble = test.GetPixelSizeX();
34 EXPECT_FLOAT_EQ(pixelSizeX, retValDouble);
35
36 retValDouble = test.GetPixelSizeY();
37 EXPECT_FLOAT_EQ(pixelSizeY, retValDouble);
38
39 retValDouble = test.GetTime();
40 EXPECT_FLOAT_EQ(time, retValDouble);
41
42 retValInt = test.GetFrameNumber();
43 EXPECT_FLOAT_EQ(frame, retValInt);
44
45 retValInt = test.GetFlag();
46 EXPECT_FLOAT_EQ(flag, retValInt);
47
48 retValInt = test.GetRefId();
49 EXPECT_FLOAT_EQ(refId, retValInt);
50}
51
53{
54 compareMvdDigiDataMembers(testA, testB.GetStationNr(), testB.GetPixelX(), testB.GetPixelY(), testB.GetCharge(),
55 testB.GetPixelSizeX(), testB.GetPixelSizeY(), testB.GetTime(), testB.GetFrameNumber(),
56 testB.GetFlag(), testB.GetRefId());
57}
58
59void compareMvdRawDigiDataMembers(CbmMvdRawDigi& test, ECbmModuleId systemid, uint32_t address, uint32_t time,
60 uint32_t frame, uint64_t frameTime, bool compFrameTime = true)
61{
62 uint32_t retValUInt{std::numeric_limits<uint32_t>::max()};
63 uint64_t retValULong{std::numeric_limits<uint64_t>::max()};
65
66 retValUInt = test.GetAddress();
67 EXPECT_EQ(address, retValUInt);
68
69 retVal = test.GetSystem();
70 EXPECT_EQ(systemid, retVal);
71
72 retValUInt = test.GetTime();
73 EXPECT_EQ(time, retValUInt);
74
75 retValUInt = test.GetFrame();
76 EXPECT_FLOAT_EQ(frame, retValUInt);
77
78 if (compFrameTime) {
79 retValULong = test.GetFrameTime();
80 EXPECT_FLOAT_EQ(frameTime, retValULong);
81 }
82}
83
84void compareMvdRawDigis(CbmMvdRawDigi& testA, CbmMvdRawDigi& testB, bool compFrameTime = true)
85{
86 compareMvdRawDigiDataMembers(testA, testB.GetSystem(), testB.GetAddress(), testB.GetTime(), testB.GetFrame(),
87 testB.GetFrameTime(), compFrameTime);
88}
89
90void compareMvdRawDigisConvBack(CbmMvdRawDigi& testA, CbmMvdRawDigi& testB) { compareMvdRawDigis(testA, testB, false); }
91
92#endif // COMPAREMVDDIGICLASSES_H
ECbmModuleId
Enumerator for module Identifiers.
Definition CbmDefs.h:45
@ kNotExist
If not found.
Definition CbmDefs.h:68
double GetTime() const
Definition CbmMvdDigi.h:89
int32_t GetPixelY() const
Definition CbmMvdDigi.h:75
int32_t GetStationNr() const
Definition CbmMvdDigi.h:80
int32_t GetFrameNumber() const
Definition CbmMvdDigi.h:90
double GetPixelSizeY() const
Definition CbmMvdDigi.h:77
double GetPixelSizeX() const
Definition CbmMvdDigi.h:76
int32_t GetPixelX() const
Definition CbmMvdDigi.h:74
int32_t GetFlag() const
Definition CbmMvdDigi.h:79
double GetCharge() const
Definition CbmMvdDigi.h:73
int32_t GetRefId() const
Definition CbmMvdDigi.h:93
uint64_t GetFrameTime() const
static ECbmModuleId GetSystem()
uint32_t GetAddress() const
uint32_t GetFrame() const
uint64_t GetTime() const
void compareMvdDigiDataMembers(CbmMvdDigi &test, int32_t iStation, int32_t iChannelNrX, int32_t iChannelNrY, float charge, float pixelSizeX, float pixelSizeY, double time, int32_t frame, int32_t flag, int32_t refId)
void compareMvdDigis(CbmMvdDigi &testA, CbmMvdDigi &testB)
void compareMvdRawDigiDataMembers(CbmMvdRawDigi &test, ECbmModuleId systemid, uint32_t address, uint32_t time, uint32_t frame, uint64_t frameTime, bool compFrameTime=true)
void compareMvdRawDigisConvBack(CbmMvdRawDigi &testA, CbmMvdRawDigi &testB)
void compareMvdRawDigis(CbmMvdRawDigi &testA, CbmMvdRawDigi &testB, bool compFrameTime=true)