Belle II Software development
SVDModeByte.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#include <svd/dataobjects/SVDModeByte.h>
9#include <gtest/gtest.h>
10#include <string>
11#include <cstdint>
12
13using namespace std;
14
15namespace Belle2 {
20 namespace SVD {
21
23 TEST(SVDModeByte, Constructor)
24 {
25 // Default construct
26 SVDModeByte s0;
27 SVDModeByte s_def(151);
30 SVDModeByte s_num(2, 0, 2, 7);
31
32 EXPECT_EQ(s0, s_def);
33 EXPECT_EQ(s_def, s_en);
34 EXPECT_EQ(s_en, s_num);
35 // Empty
36 EXPECT_EQ(uint8_t(151), s0.getID());
37 EXPECT_EQ((string)s0, "0-suppr/global/6 samples/???");
38 // Malformed
39 s0.setTriggerBin(3);
40 EXPECT_EQ((string)s0, "0-suppr/global/6 samples/3");
41 s0.setDAQMode(1);
42 EXPECT_EQ((string)s0, "0-suppr/global/3 samples/3");
43 }
44
46 TEST(SVDModeByte, getters)
47 {
48 // Construct
49 SVDModeByte s(3, 1, 1, 3);
50 EXPECT_EQ(s.getTriggerBin(), 3);
51 EXPECT_EQ(s.getDAQMode(), SVDDAQModeType::daq_3samples);
52 EXPECT_EQ(s.getEventType(), SVDEventType::local_run);
53 EXPECT_EQ(s.getRunType(), SVDRunType::zero_suppressed_timefit);
54 // Default
55 SVDModeByte s0;
56 EXPECT_EQ(s0.getTriggerBin(), 7);
58 }
59 }
61} // Belle2::SVD namespace
Class to store SVD mode information.
Definition SVDModeByte.h:69
void setTriggerBin(baseType triggerBin)
Set the triggerBin id.
baseType getID() const
Get the unique id.
void setDAQMode(baseType daqMode)
Set the daqMode id.
baseType getTriggerBin() const
Get the triggerBin id.
baseType getDAQMode() const
Get the daqMode id.
constexpr uint8_t daq_3samples
three samples per strip
Definition SVDModeByte.h:59
constexpr uint8_t daq_6samples
six samples per strip
Definition SVDModeByte.h:60
constexpr uint8_t global_run
global run
Definition SVDModeByte.h:47
constexpr uint8_t local_run
local run - should never happen
Definition SVDModeByte.h:48
constexpr uint8_t zero_suppressed
Definition SVDModeByte.h:36
constexpr uint8_t zero_suppressed_timefit
Definition SVDModeByte.h:37
Namespace to encapsulate code needed for simulation and reconstrucion of the SVD.
TEST(SVDModeByte, Constructor)
Check that both constructors yield the same result.
Abstract base class for different kinds of events.
STL namespace.