Project
Loading...
Searching...
No Matches
LabeledDigit.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_LABELEDDIGIT_H_
13#define ALICEO2_EMCAL_LABELEDDIGIT_H_
14
15#include <iosfwd>
16#include <cmath>
17#include "Rtypes.h"
22
23#include <boost/serialization/base_object.hpp> // for base_object
24
25namespace o2
26{
27
28namespace emcal
29{
33
35{
36 public:
37 LabeledDigit() = default;
38
40 LabeledDigit(Short_t tower, Double_t amplitudeGeV, Double_t time, o2::emcal::MCLabel label);
41 LabeledDigit(Short_t tower, uint16_t noiseLG, uint16_t noiseHG, Double_t time, o2::emcal::MCLabel label);
42
43 ~LabeledDigit() = default; // override
44
45 void setDigit(Digit d) { mDigit = d; }
46 Digit getDigit() const { return mDigit; }
47
48 void addLabel(o2::emcal::MCLabel l) { mLabels.push_back(l); }
49 Int_t getNumberOfLabels() const { return mLabels.size(); }
50 std::vector<o2::emcal::MCLabel> getLabels() const { return mLabels; }
51
52 bool operator<(const LabeledDigit& other) const { return getTimeStamp() < other.getTimeStamp(); }
53 bool operator>(const LabeledDigit& other) const { return getTimeStamp() > other.getTimeStamp(); }
54 bool operator==(const LabeledDigit& other) const { return (getTimeStamp() == other.getTimeStamp()); }
55
57 {
58 return (getTower() == other.getTower() && std::abs(getTimeStamp() - other.getTimeStamp()) < constants::EMCAL_TIMESAMPLE);
59 }
60
61 LabeledDigit& operator+=(const LabeledDigit& other); // Adds energy of other digit to this digit, combines lists of labels
62 friend LabeledDigit operator+(LabeledDigit lhs, const LabeledDigit& rhs) // Adds energy of two digits, combines lists of labels
63 {
64 lhs += rhs;
65 return lhs;
66 }
67
68 void setTimeStamp(Double_t time) { mDigit.setTimeStamp(time); }
69 Double_t getTimeStamp() const { return mDigit.getTimeStamp(); }
70
71 void setTower(Short_t tower) { mDigit.setTower(tower); }
72 Short_t getTower() const { return mDigit.getTower(); }
73
74 void setAmplitude(Double_t amplitude) { mDigit.setAmplitude(amplitude); } // GeV
75 Double_t getAmplitude() const { return mDigit.getAmplitude(); }
76
77 void setEnergy(Double_t energy) { setAmplitude(energy); }
78 Double_t getEnergy() { return getAmplitude(); }
79
80 void setAmplitudeADC(Short_t amplitude, ChannelType_t ctype = ChannelType_t::HIGH_GAIN) { mDigit.setAmplitudeADC(amplitude, ctype); }
81 Int_t getAmplitudeADC(ChannelType_t ctype = ChannelType_t::HIGH_GAIN) const { return mDigit.getAmplitudeADC(ctype); }
82
83 void setType(ChannelType_t ctype) { mDigit.setType(ctype); }
84 ChannelType_t getType() const { return mDigit.getType(); }
85
86 void setHighGain() { mDigit.setHighGain(); }
87 Bool_t getHighGain() const { return mDigit.getHighGain(); }
88
89 void setLowGain() { mDigit.setLowGain(); }
90 Bool_t getLowGain() const { return mDigit.getLowGain(); }
91
92 void setTRU() { mDigit.setTRU(); }
93 Bool_t getTRU() const { return mDigit.getTRU(); }
94
95 void setLEDMon() { mDigit.setLEDMon(); }
96 Bool_t getLEDMon() const { return mDigit.getLEDMon(); }
97
98 void PrintStream(std::ostream& stream) const;
99
100 private:
102
103 Digit mDigit;
104 std::vector<o2::emcal::MCLabel> mLabels;
105
106 ClassDefNV(LabeledDigit, 1);
107};
108
109std::ostream& operator<<(std::ostream& stream, const LabeledDigit& dig);
110} // namespace emcal
111} // namespace o2
112#endif
int16_t time
Definition RawEventData.h:4
EMCAL digit implementation.
Definition Digit.h:34
void setTRU()
Definition Digit.h:80
Bool_t getLowGain() const
Definition Digit.h:78
void setHighGain()
Definition Digit.h:74
void setLEDMon()
Definition Digit.h:83
void setAmplitude(Double_t amplitude)
Definition Digit.h:61
void setLowGain()
Definition Digit.h:77
Short_t getTower() const
Definition Digit.h:59
Bool_t getHighGain() const
Definition Digit.h:75
Int_t getAmplitudeADC(ChannelType_t ctype) const
Definition Digit.cxx:66
Double_t getAmplitude() const
Definition Digit.cxx:101
void setTower(Short_t tower)
Definition Digit.h:58
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
Bool_t getLEDMon() const
Definition Digit.h:84
void setAmplitudeADC(Short_t amplitude, ChannelType_t ctype=ChannelType_t::HIGH_GAIN)
Definition Digit.cxx:37
EMCAL labeled digit implementation.
Double_t getAmplitude() const
void PrintStream(std::ostream &stream) const
void setTower(Short_t tower)
bool operator==(const LabeledDigit &other) const
friend LabeledDigit operator+(LabeledDigit lhs, const LabeledDigit &rhs)
Bool_t getLEDMon() const
Double_t getTimeStamp() const
ChannelType_t getType() const
bool canAdd(const LabeledDigit other)
void addLabel(o2::emcal::MCLabel l)
void setEnergy(Double_t energy)
std::vector< o2::emcal::MCLabel > getLabels() const
bool operator<(const LabeledDigit &other) const
Bool_t getHighGain() const
bool operator>(const LabeledDigit &other) const
friend class boost::serialization::access
Bool_t getTRU() const
void setType(ChannelType_t ctype)
Int_t getNumberOfLabels() const
void setTimeStamp(Double_t time)
LabeledDigit & operator+=(const LabeledDigit &other)
void setAmplitude(Double_t amplitude)
Bool_t getLowGain() const
Short_t getTower() const
void setAmplitudeADC(Short_t amplitude, ChannelType_t ctype=ChannelType_t::HIGH_GAIN)
Int_t getAmplitudeADC(ChannelType_t ctype=ChannelType_t::HIGH_GAIN) const
Monte-Carlo label for EMCAL clusters / digits.
Definition MCLabel.h:28
GLuint GLsizei const GLchar * label
Definition glcorearb.h:2519
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
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
VectorOfTObjectPtrs other