Project
Loading...
Searching...
No Matches
testClusterHardware.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
15
16#define BOOST_TEST_MODULE Test TPC DataFormats
17#define BOOST_TEST_MAIN
18#define BOOST_TEST_DYN_LINK
19#include "../include/DataFormatsTPC/ClusterHardware.h"
20#include <boost/test/unit_test.hpp>
21#include <iomanip>
22#include <iostream>
23
24namespace o2
25{
26namespace tpc
27{
28BOOST_AUTO_TEST_CASE(ClusterHardware_test1)
29{
31 float pad = 0;
32 float time = 0;
33 float qTot = 0.0625;
34 int qMax = 1;
35 int flags = 0;
36 int row = 0;
37 float sigmaPad2 = 0;
38 float sigmaTime2 = 0;
39 do {
40 c.setCluster(pad, time, sigmaPad2, sigmaTime2, qMax, qTot, row, flags);
41 BOOST_CHECK_EQUAL(c.getFlags(), flags);
42 } while (++flags < 256);
43 do {
44 c.setCluster(pad, time, sigmaPad2, sigmaTime2, qMax, qTot, row, flags);
45 BOOST_CHECK_EQUAL(c.getRow(), row);
46 } while (++row < 32);
47 do {
48 c.setCluster(pad, time, sigmaPad2, sigmaTime2, qMax, qTot, row, flags);
49 BOOST_CHECK_EQUAL(c.getQTotFloat(), qTot);
50 } while (++qTot <= 1023 * 25);
51 do {
52 c.setCluster(pad, time, sigmaPad2, sigmaTime2, qMax, qTot, row, flags);
53 BOOST_CHECK_EQUAL(c.getQMax(), qMax);
54 } while (++qMax < 1024);
55 for (int i = 0; i < 3; i++) {
56 qTot = i == 0 ? 0.25 : i == 1 ? (1023 * 10) : (1023 * 25 - 0.25);
57 int maxSigma = i <= 1 ? 4 : 2;
58 pad = time = 0;
59 do {
60 sigmaPad2 = sigmaTime2 = 0;
61 c.setCluster(pad, time, sigmaPad2, sigmaTime2, qMax, qTot, row, flags);
62 BOOST_CHECK_EQUAL(c.getPad(), pad);
63 do {
64 break;
65 /*pad = 73.0;//828125;
66 time = 0.0;//601562;
67 sigmaPad2 = 0.458671;
68 sigmaTime2 = 0.432741;
69 qTot = 130.391449;
70 qMax = 41.580238;*/
71 c.setCluster(pad, time, sigmaPad2, sigmaTime2, qMax, qTot, row, flags);
72 BOOST_CHECK_EQUAL(c.getSigmaPad2(), sigmaPad2);
73 } while ((sigmaPad2 += 0.25) <= maxSigma);
74 } while ((pad += 0.5) <= 255);
75 do {
76 break;
77 sigmaPad2 = sigmaTime2 = 0;
78 c.setCluster(pad, time, sigmaPad2, sigmaTime2, qMax, qTot, row, flags);
79 BOOST_CHECK_EQUAL(c.getTimeLocal(), time);
80 do {
81 c.setCluster(pad, time, sigmaPad2, sigmaTime2, qMax, qTot, row, flags);
82 BOOST_CHECK_EQUAL(c.getSigmaTime2(), sigmaTime2);
83 } while ((sigmaTime2 += 0.25) <= maxSigma);
84 } while ((time += 0.5) <= 511);
85 }
86}
87} // namespace tpc
88} // namespace o2
int16_t time
Definition RawEventData.h:4
int32_t i
uint32_t c
Definition RawData.h:2
GLbitfield flags
Definition glcorearb.h:1570
BOOST_AUTO_TEST_CASE(ClusterHardware_test1)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
void setCluster(float pad, float time, float sigmaPad2, float sigmaTime2, float qMax, float qTot, int row, int flags)
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())
std::vector< int > row