Project
Loading...
Searching...
No Matches
testTriggerSTUDCS.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 EMCAL Calib
13#define BOOST_TEST_MAIN
14#define BOOST_TEST_DYN_LINK
15#include <boost/test/unit_test.hpp>
17
18#include <algorithm>
19
20namespace o2
21{
22
23namespace emcal
24{
25
31{
32 testobject.setGammaHigh(0, 0);
33 testobject.setGammaHigh(1, 0);
34 testobject.setGammaHigh(2, 115);
35 testobject.setGammaLow(0, 0);
36 testobject.setGammaLow(1, 0);
37 testobject.setGammaLow(2, 51);
38 testobject.setJetHigh(0, 0);
39 testobject.setJetHigh(1, 0);
40 testobject.setJetHigh(2, 255);
41 testobject.setJetLow(0, 0);
42 testobject.setJetLow(1, 0);
43 testobject.setJetLow(2, 204);
44 testobject.setPatchSize(2);
45 testobject.setFw(0x2A012);
46 testobject.setMedianMode(0);
47 testobject.setRegion(0xffffffff);
48 for (int i = 0; i < 4; i++) {
49 testobject.setPHOSScale(i, 0);
50 }
51}
52
53BOOST_AUTO_TEST_CASE(TriggerSTUDCS_test)
54{
55
57 TriggerSTUDCS testobject;
58 ConfigureReference(testobject);
59
60 std::array<int, 3> Ghigh = {0, 0, 115};
61 std::array<int, 3> Glow = {0, 0, 51};
62 std::array<int, 3> Jhigh = {0, 0, 255};
63 std::array<int, 3> Jlow = {0, 0, 204};
64 int PatchSize = 2;
65 int Fw = 0x2A012;
66 int MedianMode = 0;
67 int Region = 0xffffffff;
68 int RawData = 1;
69
70 BOOST_CHECK_EQUAL(testobject.getRegion(), Region);
71 BOOST_CHECK_EQUAL(testobject.getFw(), Fw);
72 BOOST_CHECK_EQUAL(testobject.getPatchSize(), PatchSize);
73 BOOST_CHECK_EQUAL(testobject.getMedianMode(), MedianMode);
74 BOOST_CHECK_EQUAL(testobject.getRawData(), RawData);
75
76 for (int itrig = 0; itrig < 3; itrig++) {
77 BOOST_CHECK_EQUAL(testobject.getGammaHigh(itrig), Ghigh[itrig]);
78 BOOST_CHECK_EQUAL(testobject.getJetHigh(itrig), Jhigh[itrig]);
79 BOOST_CHECK_EQUAL(testobject.getGammaLow(itrig), Glow[itrig]);
80 BOOST_CHECK_EQUAL(testobject.getJetLow(itrig), Jlow[itrig]);
81 }
82
86 BOOST_CHECK_EQUAL(testobject == testobject, true);
87
91 TriggerSTUDCS test1, test2;
92 ConfigureReference(test1);
94 BOOST_CHECK_EQUAL(test1 == test2, true);
95
97 TriggerSTUDCS test3(test1);
98 BOOST_CHECK_EQUAL(test3 == test1, true);
99
101 TriggerSTUDCS test4 = test1;
102 BOOST_CHECK_EQUAL(test4 == test1, true);
103
111 ref.setRegion(0xffffff7f);
112 BOOST_CHECK_EQUAL(ref == testobject, false);
113 ref.setGammaHigh(2, 77);
114 ref.setGammaLow(2, 51);
115 ref.setJetHigh(2, 191);
116 ref.setJetLow(2, 128);
117 ref.setPatchSize(0);
118 ref.setFw(0x1A012);
119 ref.setMedianMode(1);
120 ref.setPHOSScale(0, 1);
121 ref.setPHOSScale(1, 2);
122 ref.setPHOSScale(2, 1);
123 ref.setPHOSScale(3, 0);
124 BOOST_CHECK_EQUAL(ref == testobject, false);
125
130 std::string reference = std::string("PatchSize: 2, GetRawData: 1, Region: 0xffffffff (b'11111111111111111111111111111111), Median: 0, Firmware: 0x2a012\n") + std::string("Gamma High: (0, 0, 115)\nGamma Low: (0, 0, 51)\nJet High: (0, 0, 255)\nJet Low: (0, 0, 204)\n");
131
134 std::stringstream testmaker;
135 testmaker << test;
136 BOOST_CHECK_EQUAL(testmaker.str() == reference, true);
137}
138
139} // namespace emcal
140
141} // namespace o2
int32_t i
CCDB container for STU DCS data in EMCAL.
void setPatchSize(int size)
int getJetHigh(int vzpar) const
void setGammaHigh(int vzpar, int val)
void setPHOSScale(int iscale, int val)
int getJetLow(int vzpar) const
void setJetHigh(int vzpar, int val)
int getGammaLow(int vzpar) const
void setMedianMode(int mode)
void setGammaLow(int vzpar, int val)
void setJetLow(int vzpar, int val)
int getGammaHigh(int vzpar) const
GLint ref
Definition glcorearb.h:291
BOOST_AUTO_TEST_CASE(asynch_schedule_test)
void ConfigureReference(TriggerSTUDCS &testobject)
Apply reference configuration Reference configuration taken from pp 2016.
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
FIXME: do not use data model tables.
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())