Belle II Software development
ROIrawID.h
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
9#pragma once
10
11#include <stdint.h>
12
13namespace Belle2 {
24 class ROIrawID {
25
26 public:
27 // typedef unsigned long baseType;
28 typedef uint64_t baseType;
29 enum {
30 UnusedBits = 21,
31 SystemFlagBits = 1,
32 DHHIDBits = 6,
33 MinVBits = 10,
34 MinUBits = 8,
35 MaxVBits = 10,
36 MaxUBits = 8,
37 Bits = UnusedBits + SystemFlagBits + DHHIDBits + MinVBits + MinUBits + MaxVBits + MaxUBits,
38
39// the following are unused atm, might be used for consistency checks
40// MaxSystemFlag = (1 << SystemFlagBits) - 1,
41// MaxDHHID = (1 << DHHIDBits) - 1,
42// MaxMinV = (1 << MinVBits) - 1,
43// MaxMinU = (1 << MinUBits) - 1,
44// MaxMaxV = (1 << MaxVBits) - 1,
45// MaxMaxU = (1 << MaxUBits) - 1,
46 };
47
48
49 explicit ROIrawID(baseType id = 0)
50 {
51 m_rawID.id = id;
52 }
54 ROIrawID(baseType SystemFlag, baseType DHHID, baseType MinV, baseType MinU, baseType MaxV, baseType MaxU)
55 {
56
57 m_rawID.parts.unused = 0;
58 m_rawID.parts.systemFlag = SystemFlag;
59 m_rawID.parts.DHHID = DHHID;
60 m_rawID.parts.minV = MinV;
61 m_rawID.parts.minU = MinU;
62 m_rawID.parts.maxV = MaxV;
63 m_rawID.parts.maxU = MaxU;
64 }
66 baseType getSystemFlag() const {return m_rawID.parts.systemFlag;}
67 baseType getDHHID() const {return m_rawID.parts.DHHID;}
68 baseType getMinVid() const {return m_rawID.parts.minV;}
69 baseType getMinUid() const {return m_rawID.parts.minU;}
70 baseType getMaxVid() const {return m_rawID.parts.maxV;}
71 baseType getMaxUid() const {return m_rawID.parts.maxU;}
72 baseType getID() const {return m_rawID.id;}
74 baseType getBigEndian() const;
77 void setSystemFlag(baseType SystemFlag) {m_rawID.parts.systemFlag = SystemFlag;}
78 void setDHHID(baseType DHHID) {m_rawID.parts.DHHID = DHHID;}
79 void setMinVid(baseType MinV) {m_rawID.parts.minV = MinV;}
80 void setMinUid(baseType MinU) {m_rawID.parts.minU = MinU;}
81 void setMaxVid(baseType MaxV) {m_rawID.parts.maxV = MaxV;}
82 void setMaxUid(baseType MaxU) {m_rawID.parts.maxU = MaxU;}
83 void setID(baseType id) {m_rawID.id = id;}
86 ~ROIrawID() {};
87
88 inline bool operator()(const ROIrawID& roi1, const ROIrawID& roi2) const
89 {
90 if (roi1.getDHHID() == roi2.getDHHID())
91 return roi1.getID() < roi2.getID();
92 else return roi1.getDHHID() < roi2.getDHHID();
93 }
95 private:
96
97 union {
98baseType id: Bits;
99 struct {
100baseType maxU: MaxUBits;
101baseType maxV: MaxVBits;
102baseType minU: MinUBits;
103baseType minV: MinVBits;
104baseType DHHID: DHHIDBits;
105baseType systemFlag: SystemFlagBits;
106baseType unused: UnusedBits;
107 } parts;
108
112 };
114}
ROIrawID.
Definition: ROIrawID.h:24
baseType getID() const
get ROIrawID
Definition: ROIrawID.h:72
baseType getMinUid() const
get minimum U
Definition: ROIrawID.h:69
void setMinVid(baseType MinV)
set minimum V
Definition: ROIrawID.h:79
baseType getDHHID() const
get DHH ID
Definition: ROIrawID.h:67
bool operator()(const ROIrawID &roi1, const ROIrawID &roi2) const
operator used to order the ROIs (ascending DHHID)
Definition: ROIrawID.h:88
void setSystemFlag(baseType SystemFlag)
set system flag
Definition: ROIrawID.h:77
uint64_t baseType
base type
Definition: ROIrawID.h:28
baseType getMaxUid() const
get maximum U
Definition: ROIrawID.h:71
void setMinUid(baseType MinU)
set minimum U
Definition: ROIrawID.h:80
union Belle2::ROIrawID::@301 m_rawID
raw ID
void setMaxUid(baseType MaxU)
set maximum U
Definition: ROIrawID.h:82
void setID(baseType id)
set ROIrawID
Definition: ROIrawID.h:83
baseType getMaxVid() const
get maximum V
Definition: ROIrawID.h:70
ROIrawID(baseType id=0)
constructor setting the id
Definition: ROIrawID.h:49
void setDHHID(baseType DHHID)
set DHH ID
Definition: ROIrawID.h:78
ROIrawID(baseType SystemFlag, baseType DHHID, baseType MinV, baseType MinU, baseType MaxV, baseType MaxU)
constructor
Definition: ROIrawID.h:54
void setMaxVid(baseType MaxV)
set maximum V
Definition: ROIrawID.h:81
baseType getMinVid() const
get minimum V
Definition: ROIrawID.h:68
baseType getBigEndian() const
get bigEndian
Definition: ROIrawID.cc:13
baseType getSystemFlag() const
get system flag
Definition: ROIrawID.h:66
Abstract base class for different kinds of events.