forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPHData.h
More file actions
126 lines (105 loc) · 3.88 KB
/
PHData.h
File metadata and controls
126 lines (105 loc) · 3.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#ifndef ALICEO2_TRD_PHDATA_H_
#define ALICEO2_TRD_PHDATA_H_
#include <cstdint>
#include "Rtypes.h"
namespace o2::trd
{
/*
This data type is used to send around the information required to fill PH plots per chamber
|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|09|08|07|06|05|04|03|02|01|00|
-------------------------------------------------------------------------------------------------
|type |nNeighb | time bin | detector number | ADC sum for all neigbours |
-------------------------------------------------------------------------------------------------
*/
class PHData
{
public:
enum Origin : uint8_t {
ITSTPCTRD,
TPCTRD,
TRACKLET,
OTHER
};
PHData() = default;
PHData(int adc, int det, int tb, int nb, int type) { set(adc, det, tb, nb, type); }
void set(int adc, int det, int tb, int nb, int type)
{
mData = ((type & 0x3) << 30) | ((nb & 0x7) << 27) | ((tb & 0x1f) << 22) | ((det & 0x3ff) << 12) | (adc & 0xfff);
}
// the ADC sum for given time bin for up to three neighbours
int getADC() const { return mData & 0xfff; }
// the TRD detector number
int getDetector() const { return (mData >> 12) & 0x3ff; }
// the given time bin
int getTimebin() const { return (mData >> 22) & 0x1f; }
// number of neighbouring digits for which the ADC is accumulated
int getNneighbours() const { return (mData >> 27) & 0x7; }
// the origin of this point: digit on ITS-TPC-TRD track, ... (see enum Origin above)
int getType() const { return (mData >> 30) & 0x3; }
private:
uint32_t mData{0}; // see comment above for data content
ClassDefNV(PHData, 1);
};
/*
This data type is used to send around the information required to fill PH plots per chamber
|19|18|17|16|15|14|13|12|11|10|09|08|07|06|05|04|03|02|01|00|
-------------------------------------------------------------
|type |nNeighb | time bin | detector number |
-------------------------------------------------------------
*/
/*
This data type is used to send around the information required to fill PH plots per chamber
|15|14|13|12|11|10|09|08|07|06|05|04|03|02|01|00|
------------------------------------------------
| ADC sum for all neigbours |
------------------------------------------------
*/
class PHDataHD
{
public:
enum Origin : uint8_t {
ITSTPCTRD,
TPCTRD,
TRACKLET,
OTHER
};
PHDataHD() = default;
PHDataHD(int adc, int det, int tb, int nb, int type) { set(adc, det, tb, nb, type); }
void set(int adc, int det, int tb, int nb, int type)
{
mDetector = det;
mTimeBin = tb;
mType = type;
mNNeighbours = nb;
mADC = adc;
}
// the ADC sum for given time bin for up to three neighbours
int getADC() const { return mADC; }
// the TRD detector number
int getDetector() const { return mDetector; }
// the given time bin
int getTimebin() const { return mTimeBin; }
// number of neighbouring digits for which the ADC is accumulated
int getNNeighbours() const { return mNNeighbours; }
// the origin of this point: digit on ITS-TPC-TRD track, ... (see enum Origin above)
int getType() const { return mType; }
private:
uint16_t mDetector{0};
uint8_t mTimeBin{0};
uint8_t mType{0};
uint8_t mNNeighbours{0};
uint16_t mADC{0};
ClassDefNV(PHDataHD, 1);
};
} // namespace o2::trd
#endif // ALICEO2_TRD_PHDATA_H_