Project
Loading...
Searching...
No Matches
PedestalProcessorData.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#ifndef EMCAL_PEDESTAL_PROCESSOR_DATA_H_
12#define EMCAL_PEDESTAL_PROCESSOR_DATA_H_
13#include <array>
14#include <exception>
15#include <iosfwd>
16#include <string>
17#include <tuple>
18#include "MathUtils/Utils.h"
19
20#include "Rtypes.h"
21
22namespace o2::emcal
23{
24
37{
38 private:
39 public:
42 class ChannelIndexException : public std::exception
43 {
44 private:
45 unsigned short mChannelIndex;
46 unsigned short mMaxChannels;
47 std::string mErrorMessage;
48
49 public:
53 ChannelIndexException(unsigned short channelIndex, unsigned short maxChannels) : std::exception(), mChannelIndex(channelIndex), mMaxChannels(maxChannels)
54 {
55 mErrorMessage = "Channel index " + std::to_string(mChannelIndex) + " not found (max " + std::to_string(mMaxChannels) + ")";
56 }
57
59 ~ChannelIndexException() noexcept final = default;
60
63 const char* what() const noexcept final { return mErrorMessage.data(); }
64
67 unsigned short getChannelIndex() const noexcept { return mChannelIndex; }
68
71 unsigned short getMaxChannels() const noexcept { return mMaxChannels; }
72 };
73
74 using ProfileHistFEC = std::array<o2::math_utils::StatAccumulator, 17664>;
75 using ProfileHistLEDMON = std::array<o2::math_utils::StatAccumulator, 480>;
76 using PedestalValue = std::tuple<double, double>;
77
80
83
91
98 void fillADC(unsigned short adc, unsigned short tower, bool lowGain, bool LEDMON);
99
106 PedestalValue getValue(unsigned short tower, bool lowGain, bool LEDMON) const;
107
114 int getEntriesForChannel(unsigned short tower, bool lowGain, bool LEDMON) const;
115
119 void reset();
120
124 const ProfileHistFEC& accessFECData(bool lowGain) const { return lowGain ? mDataFECLG : mDataFECHG; }
125
129 const ProfileHistLEDMON& accessLEDMONData(bool lowGain) const { return lowGain ? mDataLEDMONLG : mDataLEDMONHG; }
130
131 private:
132 ProfileHistFEC mDataFECHG;
133 ProfileHistFEC mDataFECLG;
134 ProfileHistLEDMON mDataLEDMONHG;
135 ProfileHistLEDMON mDataLEDMONLG;
136
137 ClassDefNV(PedestalProcessorData, 1);
138};
139
144PedestalProcessorData operator+(const PedestalProcessorData& lhs, const PedestalProcessorData& rhs);
145
150std::ostream& operator<<(std::ostream& stream, const PedestalProcessorData::ChannelIndexException& ex);
151
152} // namespace o2::emcal
153
154#endif
General auxilliary methods.
Handling access to invalid channel index (out-of-bounds)
unsigned short getChannelIndex() const noexcept
Get channel index raising the exception.
~ChannelIndexException() noexcept final=default
Destructor.
const char * what() const noexcept final
Get error message of the exception.
ChannelIndexException(unsigned short channelIndex, unsigned short maxChannels)
Constructor.
unsigned short getMaxChannels() const noexcept
Get max number for channels for the type the exception was raised.
Exchange container between PedestalProcessorDevice and PedestalAggregatorDevice.
std::array< o2::math_utils::StatAccumulator, 480 > ProfileHistLEDMON
~PedestalProcessorData()=default
Destructor.
int getEntriesForChannel(unsigned short tower, bool lowGain, bool LEDMON) const
Get number of entries for a certain channel.
PedestalProcessorData()=default
Constructor.
const ProfileHistFEC & accessFECData(bool lowGain) const
Provide access to accumulated data for FEC channels.
const ProfileHistLEDMON & accessLEDMONData(bool lowGain) const
Provide access to accumulated data for LEDMON channels.
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::array< o2::math_utils::StatAccumulator, 17664 > ProfileHistFEC
std::tuple< double, double > PedestalValue
PedestalProcessorData & operator+=(const PedestalProcessorData &other)
Accumulation operator.
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
Defining DataPointCompositeObject explicitly as copiable.
std::string to_string(gsl::span< T, Size > span)
Definition common.h:52
VectorOfTObjectPtrs other
ArrayADC adc