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_EMCAL_DIGIT_H_
13#define ALICEO2_EMCAL_DIGIT_H_
14
15#include <iosfwd>
16#include <cmath>
17#include "Rtypes.h"
20
21#include <boost/serialization/base_object.hpp> // for base_object
22
23namespace o2
24{
25
26namespace emcal
27{
29
33class Digit : public DigitBase
34{
35 public:
36 Digit() = default;
37
38 Digit(Short_t tower, Double_t amplitudeGeV, Double_t time);
39 Digit(Short_t tower, uint16_t noiseLG, uint16_t noiseHG, double time);
40 ~Digit() = default; // override
41
42 bool operator<(const Digit& other) const { return getTimeStamp() < other.getTimeStamp(); }
43 bool operator>(const Digit& other) const { return getTimeStamp() > other.getTimeStamp(); }
44 bool operator==(const Digit& other) const { return getTimeStamp() == other.getTimeStamp(); }
45
46 bool canAdd(const Digit other)
47 {
48 return (mTower == other.getTower() && std::abs(getTimeStamp() - other.getTimeStamp()) < constants::EMCAL_TIMESAMPLE);
49 }
50
51 Digit& operator+=(const Digit& other); // Adds amplitude of other digits to this digit.
52 friend Digit operator+(Digit lhs, const Digit& rhs) // Adds amplitudes of two digits.
53 {
54 lhs += rhs;
55 return lhs;
56 }
57
58 void setTower(Short_t tower) { mTower = tower; }
59 Short_t getTower() const { return mTower; }
60
61 void setAmplitude(Double_t amplitude) { mAmplitudeGeV = amplitude; }
62 Double_t getAmplitude() const;
63
64 void setEnergy(Double_t energy) { mAmplitudeGeV = energy; }
65 Double_t getEnergy() const { return mAmplitudeGeV; }
66
67 void setAmplitudeADC(Short_t amplitude, ChannelType_t ctype = ChannelType_t::HIGH_GAIN);
68 Int_t getAmplitudeADC(ChannelType_t ctype) const;
69 Int_t getAmplitudeADC() const { return getAmplitudeADC(getType()); };
70
71 void setType(ChannelType_t ctype) {}
72 ChannelType_t getType() const;
73
74 void setHighGain() {}
75 Bool_t getHighGain() const { return (getType() == ChannelType_t::HIGH_GAIN); };
76
77 void setLowGain() {}
78 Bool_t getLowGain() const { return (getType() == ChannelType_t::LOW_GAIN); };
79
80 void setTRU() { mIsTRU = true; }
81 Bool_t getTRU() const { return mIsTRU; }
82
83 void setLEDMon() {}
84 Bool_t getLEDMon() const { return false; }
85
86 void PrintStream(std::ostream& stream) const;
87
88 void setNoiseLG(uint16_t noise) { mNoiseLG = noise; }
89 uint16_t getNoiseLG() const { return mNoiseLG; }
90
91 void setNoiseHG(uint16_t noise) { mNoiseHG = noise; }
92 uint16_t getNoiseHG() const { return mNoiseHG; }
93
94 void setNoiseTRU(uint16_t noise) { mNoiseHG = noise; }
95 uint16_t getNoiseTRU() const { return mNoiseHG; }
96
97 private:
99
100 double mAmplitudeGeV = 0.;
101 Short_t mTower = -1;
102 bool mIsTRU = false;
103 uint16_t mNoiseLG = 0;
104 uint16_t mNoiseHG = 0;
105
106 ClassDefNV(Digit, 3);
107};
108
109std::ostream& operator<<(std::ostream& stream, const Digit& dig);
110} // namespace emcal
111} // namespace o2
112#endif
int16_t time
Definition RawEventData.h:4
EMCAL digit implementation.
Definition Digit.h:34
bool operator>(const Digit &other) const
Definition Digit.h:43
Int_t getAmplitudeADC() const
Definition Digit.h:69
void setNoiseHG(uint16_t noise)
Definition Digit.h:91
void setTRU()
Definition Digit.h:80
bool operator<(const Digit &other) const
Definition Digit.h:42
bool operator==(const Digit &other) const
Definition Digit.h:44
Bool_t getLowGain() const
Definition Digit.h:78
void setHighGain()
Definition Digit.h:74
void setLEDMon()
Definition Digit.h:83
uint16_t getNoiseTRU() const
Definition Digit.h:95
Double_t getEnergy() const
Definition Digit.h:65
void setAmplitude(Double_t amplitude)
Definition Digit.h:61
void setNoiseTRU(uint16_t noise)
Definition Digit.h:94
void setEnergy(Double_t energy)
Definition Digit.h:64
void setLowGain()
Definition Digit.h:77
bool canAdd(const Digit other)
Definition Digit.h:46
Digit & operator+=(const Digit &other)
Definition Digit.cxx:27
friend Digit operator+(Digit lhs, const Digit &rhs)
Definition Digit.h:52
Short_t getTower() const
Definition Digit.h:59
Bool_t getHighGain() const
Definition Digit.h:75
Double_t getAmplitude() const
Definition Digit.cxx:101
void setTower(Short_t tower)
Definition Digit.h:58
Digit(Short_t tower, uint16_t noiseLG, uint16_t noiseHG, double time)
friend class boost::serialization::access
Definition Digit.h:98
uint16_t getNoiseHG() const
Definition Digit.h:92
ChannelType_t getType() const
Definition Digit.cxx:125
Bool_t getTRU() const
Definition Digit.h:81
void setType(ChannelType_t ctype)
Definition Digit.h:71
~Digit()=default
void PrintStream(std::ostream &stream) const
Definition Digit.cxx:140
Bool_t getLEDMon() const
Definition Digit.h:84
void setAmplitudeADC(Short_t amplitude, ChannelType_t ctype=ChannelType_t::HIGH_GAIN)
Definition Digit.cxx:37
void setNoiseLG(uint16_t noise)
Definition Digit.h:88
uint16_t getNoiseLG() const
Definition Digit.h:89
GLuint GLuint stream
Definition glcorearb.h:1806
std::ostream & operator<<(std::ostream &stream, const Cell &cell)
Stream operator for EMCAL cell.
Definition Cell.cxx:355
ChannelType_t
Type of a raw data channel.
Definition Constants.h:33
@ HIGH_GAIN
High gain channel.
Definition Constants.h:35
@ LOW_GAIN
Low gain channel.
Definition Constants.h:34
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
VectorOfTObjectPtrs other