Project
Loading...
Searching...
No Matches
PedestalProcessorData.cxx
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#include <iostream>
14
15using namespace o2::emcal;
16
18{
19 for (std::size_t ichan{0}; ichan < mDataFECHG.size(); ++ichan) {
20 mDataFECHG[ichan] += other.mDataFECHG[ichan];
21 mDataFECLG[ichan] += other.mDataFECLG[ichan];
22 }
23 for (std::size_t ichan{0}; ichan < mDataLEDMONHG.size(); ++ichan) {
24 mDataLEDMONHG[ichan] += other.mDataLEDMONHG[ichan];
25 mDataLEDMONLG[ichan] += other.mDataLEDMONLG[ichan];
26 }
27 return *this;
28}
29
30void PedestalProcessorData::fillADC(unsigned short adc, unsigned short tower, bool lowGain, bool LEDMON)
31{
32 auto maxentries = LEDMON ? mDataLEDMONHG.size() : mDataFECHG.size();
33 if (tower >= maxentries) {
34 throw ChannelIndexException(tower, maxentries);
35 }
36 if (LEDMON) {
37 if (lowGain) {
38 mDataLEDMONLG[tower].add(adc);
39 } else {
40 mDataLEDMONHG[tower].add(adc);
41 }
42 } else {
43 if (lowGain) {
44 mDataFECLG[tower].add(adc);
45 } else {
46 mDataFECHG[tower].add(adc);
47 }
48 }
49}
50
52{
53 auto maxentries = LEDMON ? mDataLEDMONHG.size() : mDataFECHG.size();
54 if (tower >= maxentries) {
55 throw ChannelIndexException(tower, maxentries);
56 }
57 float mean, rms;
58 if (LEDMON) {
59 if (lowGain) {
60 return mDataLEDMONLG[tower].getMeanRMS2<double>();
61 } else {
62 return mDataLEDMONHG[tower].getMeanRMS2<double>();
63 }
64 } else {
65 if (lowGain) {
66 return mDataFECLG[tower].getMeanRMS2<double>();
67 } else {
68 return mDataFECHG[tower].getMeanRMS2<double>();
69 }
70 }
71}
72
73int PedestalProcessorData::getEntriesForChannel(unsigned short tower, bool lowGain, bool LEDMON) const
74{
75 auto maxentries = LEDMON ? mDataLEDMONHG.size() : mDataFECHG.size();
76 if (tower >= maxentries) {
77 throw ChannelIndexException(tower, maxentries);
78 }
79 float mean, rms;
80 if (LEDMON) {
81 if (lowGain) {
82 return mDataLEDMONLG[tower].n;
83 } else {
84 return mDataLEDMONHG[tower].n;
85 }
86 } else {
87 if (lowGain) {
88 return mDataFECLG[tower].n;
89 } else {
90 return mDataFECHG[tower].n;
91 }
92 }
93}
94
96{
97 for (auto& acc : mDataFECHG) {
98 acc.clear();
99 }
100 for (auto& acc : mDataFECLG) {
101 acc.clear();
102 }
103 for (auto& acc : mDataLEDMONHG) {
104 acc.clear();
105 }
106 for (auto& acc : mDataLEDMONLG) {
107 acc.clear();
108 }
109}
110
117
119{
120 stream << ex.what();
121 return stream;
122}
Handling access to invalid channel index (out-of-bounds)
const char * what() const noexcept final
Get error message of the exception.
Exchange container between PedestalProcessorDevice and PedestalAggregatorDevice.
int getEntriesForChannel(unsigned short tower, bool lowGain, bool LEDMON) const
Get number of entries for a certain channel.
void fillADC(unsigned short adc, unsigned short tower, bool lowGain, bool LEDMON)
Fill ADC value for certain channel.
PedestalValue getValue(unsigned short tower, bool lowGain, bool LEDMON) const
Get mean ADC and RMS for a certain channel.
std::tuple< double, double > PedestalValue
PedestalProcessorData & operator+=(const PedestalProcessorData &other)
Accumulation operator.
GLuint64EXT * result
Definition glcorearb.h:5662
GLuint GLuint stream
Definition glcorearb.h:1806
Hit operator+(const Hit &lhs, const Hit &rhs)
Creates a new point base on this point but adding the energy loss of the right hand side.
Definition Hit.cxx:44
std::ostream & operator<<(std::ostream &stream, const Cell &cell)
Stream operator for EMCAL cell.
Definition Cell.cxx:355
@ LEDMON
LED monitor channel.
Definition Constants.h:37
VectorOfTObjectPtrs other
ArrayADC adc