Project
Loading...
Searching...
No Matches
testElectronicMapperString.cxx
Go to the documentation of this file.
1
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3
// All rights not expressly granted are reserved.
4
//
5
// This software is distributed under the terms of the GNU General Public
6
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7
//
8
// In applying this license CERN does not waive the privileges and immunities
9
// granted to it by virtue of its status as an Intergovernmental Organization
10
// or submit itself to any jurisdiction.
11
12
#define BOOST_TEST_MODULE Test MCHWorkflow MapperString
13
#define BOOST_TEST_MAIN
14
#define BOOST_TEST_DYN_LINK
15
16
#include <boost/test/unit_test.hpp>
17
#include "
MapCRU.h
"
18
#include "
MapFEC.h
"
19
#include <sstream>
20
#include <string>
21
22
// clang-format off
23
// solarId feeId cruLink
24
// # # 0..11
25
std::string
cruString
= R
"(
26
1 0 0
27
20 3 11
28
)";
29
std::string
cruString2
= R
"(
30
1 0 0 anything
31
20 3 11 anything extra will not matter
32
)";
33
// clang-format on
34
35
// clang-format off
36
// solarId groupId de dsid0 dsid1 dsid2 dsid3 dsid4
37
// index=0 index=1 index=2 index=3 index=4
38
std::string
fecString
= R
"(
39
1 0 819 108 0 107 0 106
40
1 1 919 1133 0 1134 0 0
41
)";
42
// clang-format on
43
44
using namespace
o2::mch::raw
;
45
46
BOOST_AUTO_TEST_CASE
(DefautCtorCreatesAnEmptyMap)
47
{
48
MapCRU
cru(
""
);
49
BOOST_CHECK_EQUAL
(cru.
size
(), 0);
50
}
51
52
BOOST_AUTO_TEST_CASE
(ReadMapCRUSize)
53
{
54
MapCRU
cru(
cruString
);
55
BOOST_CHECK_EQUAL
(cru.
size
(), 2);
56
}
57
58
BOOST_AUTO_TEST_CASE
(GetSolarId)
59
{
60
MapCRU
cru(
cruString
);
61
FeeLinkId
fl(3, 11);
62
auto
solarId = cru(fl);
63
BOOST_CHECK_EQUAL
(solarId.has_value(),
true
);
64
BOOST_CHECK_EQUAL
(solarId.value(), 20);
65
}
66
67
BOOST_AUTO_TEST_CASE
(GetSolarIdIsOKEvenIfLineContainsMoreInformation)
68
{
69
MapCRU
cru(
cruString2
);
70
FeeLinkId
fl(3, 11);
71
auto
solarId = cru(fl);
72
BOOST_CHECK_EQUAL
(solarId.has_value(),
true
);
73
BOOST_CHECK_EQUAL
(solarId.value(), 20);
74
}
75
76
BOOST_AUTO_TEST_CASE
(ObjectFromStringShouldHaveFiveFEC)
77
{
78
MapFEC
fec(
fecString
);
79
BOOST_CHECK_EQUAL
(fec.
size
(), 5);
80
}
81
82
BOOST_AUTO_TEST_CASE
(RequestingInvalidLinkMustYieldInvalidDeDs)
83
{
84
MapFEC
fec(
fecString
);
85
auto
dsDetId = fec(
DsElecId
(2, 0, 0));
86
BOOST_CHECK_EQUAL
(dsDetId.has_value(),
false
);
87
}
88
89
BOOST_AUTO_TEST_CASE
(RequestingInvalidDsAddressMustYieldInvalidDeDs)
90
{
91
MapFEC
fec(
fecString
);
92
auto
dsDetId = fec(
DsElecId
(1, 6, 0));
93
BOOST_CHECK_EQUAL
(dsDetId.has_value(),
false
);
94
}
95
96
BOOST_AUTO_TEST_CASE
(GetValidDeDs)
97
{
98
MapFEC
fec(
fecString
);
99
uint16_t solarId = 1;
100
uint8_t elinkGroupId = 1;
101
uint8_t elinkIndex = 2;
102
auto
dsDetId = fec(
DsElecId
(solarId, elinkGroupId, elinkIndex));
103
BOOST_CHECK_EQUAL
(dsDetId.has_value(),
true
);
104
BOOST_CHECK_EQUAL
(dsDetId->deId(), 919);
105
BOOST_CHECK_EQUAL
(dsDetId->dsId(), 1134);
106
}
MapCRU.h
MapFEC.h
o2::mch::raw::DsElecId
Definition
DsElecId.h:24
o2::mch::raw::FeeLinkId
Definition
FeeLinkId.h:22
o2::mch::raw::MapCRU
Definition
MapCRU.h:25
o2::mch::raw::MapCRU::size
size_t size() const
Definition
MapCRU.cxx:88
o2::mch::raw::MapFEC
Definition
MapFEC.h:24
o2::mch::raw::MapFEC::size
size_t size() const
Definition
MapFEC.cxx:55
o2::mch::raw
Definition
pedestal-decoding-workflow.cxx:58
o2::BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(FlatHisto)
Definition
testFlatHisto.cxx:28
cruString
std::string cruString
Definition
testElectronicMapperString.cxx:25
cruString2
std::string cruString2
Definition
testElectronicMapperString.cxx:29
fecString
std::string fecString
Definition
testElectronicMapperString.cxx:38
BOOST_CHECK_EQUAL
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())
Detectors
MUON
MCH
Raw
ElecMap
src
testElectronicMapperString.cxx
Generated on Tue Feb 25 2025 23:16:23 for Project by
1.9.8