Project
Loading...
Searching...
No Matches
testCell.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 Cell
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
30{
32
33 for (short j = 0; j < 17664; j++) {
34 c.setTower(j);
35 BOOST_CHECK_EQUAL(c.getTower(), j);
36 BOOST_CHECK_SMALL(double(c.getTimeStamp()), 0.73);
37 BOOST_CHECK_EQUAL(c.getEnergy(), 0);
38 BOOST_CHECK_EQUAL(c.getHighGain(), true);
39 }
40
41 c.setTower(0);
42 // Test time over the full range
43 std::vector<int> times = {-500, -200, -100, -50, -20, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 50, 100, 200, 500, 900};
44
45 for (auto t : times) {
46 c.setTimeStamp(t);
47 BOOST_CHECK_EQUAL(c.getTower(), 0);
48 BOOST_CHECK_SMALL(double(c.getTimeStamp() - t), 0.73);
49 BOOST_CHECK_EQUAL(c.getEnergy(), 0);
50 BOOST_CHECK_EQUAL(c.getHighGain(), true);
51 }
52
53 c.setTimeStamp(0);
54 std::vector<double> energies = {0.5, 1, 2, 5, 10, 20, 40, 60, 100, 150, 200};
55
56 for (auto e : energies) {
57 c.setEnergy(e);
58 if (e > 16) {
59 c.setLowGain();
60 }
61 BOOST_CHECK_EQUAL(c.getTower(), 0);
62 BOOST_CHECK_SMALL(double(c.getTimeStamp()), 0.73);
63 BOOST_CHECK_SMALL(e - c.getEnergy(), 0.02); // Require 20 MeV resolution
64 if (e > 16) {
65 BOOST_CHECK_EQUAL(c.getLowGain(), true);
66 } else {
67 BOOST_CHECK_EQUAL(c.getHighGain(), true);
68 }
69 }
70
71 c.setEnergy(0);
72
73 c.setLowGain();
74 BOOST_CHECK_EQUAL(c.getTower(), 0);
75 BOOST_CHECK_SMALL(double(c.getTimeStamp()), 0.73);
76 BOOST_CHECK_EQUAL(c.getEnergy(), 0);
77 BOOST_CHECK_EQUAL(c.getHighGain(), false);
78 BOOST_CHECK_EQUAL(c.getLowGain(), true);
79 BOOST_CHECK_EQUAL(c.getLEDMon(), false);
80 BOOST_CHECK_EQUAL(c.getTRU(), false);
81
82 c.setHighGain();
83 BOOST_CHECK_EQUAL(c.getTower(), 0);
84 BOOST_CHECK_SMALL(double(c.getTimeStamp()), 0.73);
85 BOOST_CHECK_EQUAL(c.getEnergy(), 0);
86 BOOST_CHECK_EQUAL(c.getHighGain(), true);
87 BOOST_CHECK_EQUAL(c.getLowGain(), false);
88 BOOST_CHECK_EQUAL(c.getLEDMon(), false);
89 BOOST_CHECK_EQUAL(c.getTRU(), false);
90
91 c.setLEDMon();
92 BOOST_CHECK_EQUAL(c.getTower(), 0);
93 BOOST_CHECK_SMALL(double(c.getTimeStamp()), 0.73);
94 BOOST_CHECK_EQUAL(c.getEnergy(), 0);
95 BOOST_CHECK_EQUAL(c.getLowGain(), false);
96 BOOST_CHECK_EQUAL(c.getHighGain(), false);
97 BOOST_CHECK_EQUAL(c.getLEDMon(), true);
98 BOOST_CHECK_EQUAL(c.getTRU(), false);
99
100 c.setTRU();
101 BOOST_CHECK_EQUAL(c.getTower(), 0);
102 BOOST_CHECK_SMALL(double(c.getTimeStamp()), 0.73);
103 BOOST_CHECK_EQUAL(c.getEnergy(), 0);
104 BOOST_CHECK_EQUAL(c.getLowGain(), false);
105 BOOST_CHECK_EQUAL(c.getHighGain(), false);
106 BOOST_CHECK_EQUAL(c.getLEDMon(), false);
107 BOOST_CHECK_EQUAL(c.getTRU(), true);
108}
109
110} // namespace emcal
111
112} // namespace o2
std::vector< unsigned long > times
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
uint32_t j
Definition RawData.h:0
uint32_t c
Definition RawData.h:2
EMCAL compressed cell information.
Definition Cell.h:57
BOOST_AUTO_TEST_CASE(asynch_schedule_test)
@ HIGH_GAIN
High gain channel.
Definition Constants.h:35
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())