CbmRoot
Loading...
Searching...
No Matches
compareTrdDigi.h
Go to the documentation of this file.
1/* Copyright (C) 2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Florian Uhlig [committer], Pascal Raisig */
4
5#ifndef COMPARETRDDIGI_H
6#define COMPARETRDDIGI_H 1
7
8#include "gtest/gtest.h"
9
10void compareTrdDigiDataMembers(CbmTrdDigi& test, int32_t padChNr, ECbmModuleId systemid, uint64_t time, double charge)
11{
12 int32_t retValInt {-222};
13 double retValDouble {-222.};
15
16 retValInt = test.GetAddressChannel();
17 EXPECT_EQ(padChNr, retValInt);
18
19 retValInt = test.GetAddressModule();
20 EXPECT_EQ((int32_t) systemid, retValInt);
21
22 // GetAddress() returns the full Address part of the fInfo data member. However, since Module-5 translated via CbmTrdAddress corresponds to the value 0 it should return the setted channel number.
23 retValInt = test.GetAddress();
24 EXPECT_EQ(padChNr, retValInt);
25
26 retVal = test.GetSystem();
27 EXPECT_EQ(systemid, retVal);
28
29 retValDouble = test.GetTime();
30 EXPECT_FLOAT_EQ(static_cast<double>(time), retValDouble);
31
32 retValDouble = test.GetCharge();
33 EXPECT_FLOAT_EQ(static_cast<double>(charge), retValDouble);
34}
35
36void compareTrdDigiDataMembers(CbmTrdDigi& test, int32_t padChNr, ECbmModuleId systemid, uint64_t time,
37 CbmTrdDigi::eTriggerType triggerType, double charge)
38{
39 int32_t retValInt {-222};
40 double retValDouble {-222.};
42
43 retValInt = test.GetAddressChannel();
44 EXPECT_EQ(padChNr, retValInt);
45
46 retValInt = test.GetAddressModule();
47 EXPECT_EQ((int32_t) systemid, retValInt);
48
49 // GetAddress() returns the full Address part of the fInfo data member. However, since Module-5 translated via CbmTrdAddress corresponds to the value 0 it should return the setted channel number.
50 retValInt = test.GetAddress();
51 EXPECT_EQ(padChNr, retValInt);
52
53 retVal = test.GetSystem();
54 EXPECT_EQ(systemid, retVal);
55
56 retValDouble = test.GetTime();
57 EXPECT_FLOAT_EQ(static_cast<double>(time), retValDouble);
58
59 retValDouble = test.GetCharge();
60 EXPECT_FLOAT_EQ(static_cast<double>(charge), retValDouble);
61
62 retValInt = test.GetTriggerType();
63 EXPECT_EQ(static_cast<int32_t>(triggerType), retValInt);
64}
65
66#endif // COMPARETRDDIGI_H
ECbmModuleId
Definition CbmDefs.h:39
@ kNotExist
If not found.
int32_t GetAddressModule() const
Getter module address in the experiment.
int32_t GetAddress() const
Address getter for module in the format defined by CbmTrdDigi (format of CbmTrdAddress can be accesse...
Definition CbmTrdDigi.h:112
int32_t GetTriggerType() const
Channel trigger type. SPADIC specific see CbmTrdTriggerType.
Definition CbmTrdDigi.h:163
int32_t GetAddressChannel() const
Getter read-out id.
static ECbmModuleId GetSystem()
Definition CbmTrdDigi.h:138
double GetTime() const
Getter for physical time [ns]. Accounts for clock representation of each ASIC. In SPADIC case physica...
Definition CbmTrdDigi.h:153
double GetCharge() const
Common purpose charge getter.
void compareTrdDigiDataMembers(CbmTrdDigi &test, int32_t padChNr, ECbmModuleId systemid, uint64_t time, double charge)