Project
Loading...
Searching...
No Matches
Digit.h
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#ifndef ALICEO2_PHOS_DIGIT_H_
13#define ALICEO2_PHOS_DIGIT_H_
14
15#include <cmath>
17
18namespace o2
19{
20
21namespace phos
22{
25class Hit;
26
28class Digit : public DigitBase
29{
30
31 public:
32 static constexpr int kTimeGate = 25; // Time in ns between digits to be added as one signal.
33 // Should it be readout time (6000 ns???): to be tested
34
35 Digit() = default;
36
40 Digit(short cell, float amplitude, float time, int label);
41
44 Digit(short cell, float amplitude, float time, bool isTrigger2x2, int label);
45
49 Digit(const Hit& hit, int label);
50
51 ~Digit() = default; // override
52
56 void fillFromHit(const Hit& hit);
57
61 inline bool operator<(const Digit& other) const
62 {
63 if (fabs(getTimeStamp() - other.getTimeStamp()) < kTimeGate) {
64 return getAbsId() < other.getAbsId();
65 } else {
66 return getTimeStamp() < other.getTimeStamp();
67 }
68 }
69
73 inline bool operator>(const Digit& other) const
74 {
75 if (fabs(getTimeStamp() - other.getTimeStamp()) <= kTimeGate) {
76 return getAbsId() > other.getAbsId();
77 } else {
78 return getTimeStamp() > other.getTimeStamp();
79 }
80 }
81
85 inline bool operator==(const Digit& other) const
86 {
87 return ((fabs(getTimeStamp() - other.getTimeStamp()) <= kTimeGate) &&
88 getAbsId() == other.getAbsId());
89 }
90
94 bool canAdd(const Digit other) const;
98 Digit& operator+=(const Digit& other); //
99
100 void addEnergyTime(float energy, float time);
101
102 // true if tru and not readount digit
103 bool isTRU() const { return mAbsId >= NREADOUTCHANNELS; }
104
106 short getAbsId() const { return mAbsId; }
107 void setAbsId(short cellId) { mAbsId = cellId; }
108
109 short getTRUId() const { return mAbsId - NREADOUTCHANNELS; }
110 void setTRUId(short cellId) { mAbsId = cellId + NREADOUTCHANNELS; }
111
113 float getAmplitude() const { return mAmplitude; }
114 void setAmplitude(float amplitude) { mAmplitude = amplitude; }
115
117 float getTime() const { return mTime; }
118 void setTime(float time) { mTime = time; }
119
121 bool isHighGain() const { return mIsHighGain; }
122 void setHighGain(Bool_t isHG) { mIsHighGain = isHG; }
123
124 bool is2x2Tile() const { return isTRU() && isHighGain(); }
125
128 int getLabel() const { return mLabel; }
129 void setLabel(int l) { mLabel = l; }
130
131 void reset()
132 {
133 mIsHighGain = true;
134 mAbsId = 0;
135 mLabel = -1;
136 mAmplitude = 0;
137 mTime = 0;
138 }
139
140 void PrintStream(std::ostream& stream) const;
141
142 private:
143 static constexpr short NREADOUTCHANNELS = 14337;
144
145 bool mIsHighGain = true;
146 short mAbsId = 0;
147 int mLabel = -1;
148 float mAmplitude = 0;
149 float mTime = 0.;
150
151 ClassDefNV(Digit, 1);
152};
153
154std::ostream& operator<<(std::ostream& stream, const Digit& dig);
155} // namespace phos
156} // namespace o2
157#endif
int16_t time
Definition RawEventData.h:4
void setAmplitude(float amplitude)
Definition Digit.h:114
void setTRUId(short cellId)
Definition Digit.h:110
static constexpr int kTimeGate
Definition Digit.h:32
short getTRUId() const
Definition Digit.h:109
void fillFromHit(const Hit &hit)
Replace content of this digit with new one, from hit.
Definition Digit.cxx:33
bool operator==(const Digit &other) const
Comparison oparator, based on time and absId.
Definition Digit.h:85
short getAbsId() const
Absolute sell id.
Definition Digit.h:106
void reset()
Definition Digit.h:131
float getAmplitude() const
Energy deposited in a cell.
Definition Digit.h:113
bool canAdd(const Digit other) const
Check, if one can add two digits.
Definition Digit.cxx:40
void setHighGain(Bool_t isHG)
Definition Digit.h:122
bool is2x2Tile() const
Definition Digit.h:124
bool isHighGain() const
Checks if this digit is produced in High Gain or Low Gain channels.
Definition Digit.h:121
void setTime(float time)
Definition Digit.h:118
bool operator>(const Digit &other) const
Comparison oparator, based on time and absId.
Definition Digit.h:73
int getLabel() const
index of entry in MCLabels array
Definition Digit.h:128
bool operator<(const Digit &other) const
Comparison oparator, based on time and absId.
Definition Digit.h:61
Digit & operator+=(const Digit &other)
if addable, adds energy and list of primaries.
Definition Digit.cxx:45
bool isTRU() const
Definition Digit.h:103
void setLabel(int l)
Definition Digit.h:129
~Digit()=default
void addEnergyTime(float energy, float time)
Definition Digit.cxx:67
float getTime() const
time measured in digit w.r.t. photon to PHOS arrival
Definition Digit.h:117
Digit()=default
void setAbsId(short cellId)
Definition Digit.h:107
void PrintStream(std::ostream &stream) const
Definition Digit.cxx:77
PHOS simulation hit information.
Definition Hit.h:25
GLuint GLsizei const GLchar * label
Definition glcorearb.h:2519
GLuint GLuint stream
Definition glcorearb.h:1806
std::ostream & operator<<(std::ostream &in, const BadChannelsMap &bcm)
Printing bad channel map on the stream.
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
VectorOfTObjectPtrs other