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_CPV_DIGIT_H_
13#define ALICEO2_CPV_DIGIT_H_
14
15#include <cmath>
17
18namespace o2
19{
20
21namespace cpv
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(unsigned short cell, float amplitude, int label);
41
42 ~Digit() = default; // override
43
47 inline bool operator<(const Digit& other) const
48 {
49 if (fabs(getTimeStamp() - other.getTimeStamp()) < kTimeGate) {
50 return getAbsId() < other.getAbsId();
51 } else {
52 return getTimeStamp() < other.getTimeStamp();
53 }
54 }
55
59 inline bool operator>(const Digit& other) const
60 {
61 if (fabs(getTimeStamp() - other.getTimeStamp()) <= kTimeGate) {
62 return getAbsId() > other.getAbsId();
63 } else {
64 return getTimeStamp() > other.getTimeStamp();
65 }
66 }
67
71 inline bool operator==(const Digit& other) const
72 {
73 return ((fabs(getTimeStamp() - other.getTimeStamp()) <= kTimeGate) &&
74 getAbsId() == other.getAbsId());
75 }
76
80 bool canAdd(const Digit other) const;
84 Digit& operator+=(const Digit& other); //
85
87 unsigned short getAbsId() const { return mAbsId; }
88 void setAbsId(unsigned short cellId) { mAbsId = cellId; }
89
91 float getAmplitude() const { return mAmplitude; }
92 void setAmplitude(float amplitude) { mAmplitude = amplitude; }
93
96 int getLabel() const { return mLabel; }
97 void setLabel(int l) { mLabel = l; }
98
99 //put all parameters to default
100 void reset()
101 {
102 mAbsId = 0;
103 mLabel = -1;
104 mAmplitude = 0.;
105 }
106
107 void PrintStream(std::ostream& stream) const;
108
109 private:
110 // friend class boost::serialization::access;
111
112 unsigned short mAbsId = 0;
113 int mLabel = -1;
114 float mAmplitude = 0;
115
116 ClassDefNV(Digit, 2);
117};
118
119std::ostream& operator<<(std::ostream& stream, const Digit& dig);
120} // namespace cpv
121} // namespace o2
122#endif
void setAmplitude(float amplitude)
Definition Digit.h:92
void setLabel(int l)
Definition Digit.h:97
float getAmplitude() const
Energy deposited in a cell.
Definition Digit.h:91
bool canAdd(const Digit other) const
Check, if one can add two digits.
Definition Digit.cxx:25
unsigned short getAbsId() const
Absolute sell id.
Definition Digit.h:87
~Digit()=default
bool operator<(const Digit &other) const
Comparison oparator, based on time and absId.
Definition Digit.h:47
bool operator==(const Digit &other) const
Comparison oparator, based on time and absId.
Definition Digit.h:71
Digit & operator+=(const Digit &other)
if addable, adds energy and list of primaries.
Definition Digit.cxx:30
Digit()=default
void reset()
Definition Digit.h:100
int getLabel() const
index of entry in MCLabels array
Definition Digit.h:96
void setAbsId(unsigned short cellId)
Definition Digit.h:88
static constexpr int kTimeGate
Definition Digit.h:32
bool operator>(const Digit &other) const
Comparison oparator, based on time and absId.
Definition Digit.h:59
void PrintStream(std::ostream &stream) const
Definition Digit.cxx:48
GLuint GLsizei const GLchar * label
Definition glcorearb.h:2519
GLuint GLuint stream
Definition glcorearb.h:1806
std::ostream & operator<<(std::ostream &in, const BadChannelMap &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