Project
Loading...
Searching...
No Matches
BaselineParam.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 <TH1.h>
13#include <TFile.h>
14#include <TDirectory.h>
15#include "Framework/Logger.h"
17
18using namespace o2::zdc;
19
21{
22 modified.fill(false);
23 for (int i = 0; i < NChannels; i++) {
24 baseline[i] = -std::numeric_limits<float>::infinity();
25 }
26}
27
28void BaselineParam::setCalib(uint32_t ich, float val, bool ismodified)
29{
30 if (ich >= NChannels) {
31 LOG(fatal) << __func__ << " channel " << ich << " not in allowed range";
32 return;
33 }
34 baseline[ich] = val;
35 modified[ich] = ismodified;
36}
37
38float BaselineParam::getCalib(uint32_t ich) const
39{
40 if (ich < NChannels) {
41 return baseline[ich];
42 } else {
43 LOG(fatal) << __func__ << " channel " << ich << " not in allowed range";
44 return 0;
45 }
46}
47
48void BaselineParam::print(bool printall) const
49{
50 for (Int_t ich = 0; ich < NChannels; ich++) {
51 if (baseline[ich] < ADCMin || baseline[ich] > ADCMax) {
52 LOG(warn) << ChannelNames[ich] << (modified[ich] ? " NEW" : " OLD") << " Baseline = " << baseline[ich] << " OUT OF RANGE";
53 } else {
54 if (printall) {
55 LOG(info) << ChannelNames[ich] << (modified[ich] ? " NEW" : " OLD") << " Baseline = " << baseline[ich];
56 }
57 }
58 }
59}
Baseline calibration data.
int32_t i
GLuint GLfloat * val
Definition glcorearb.h:1582
constexpr int NChannels
Definition Constants.h:65
constexpr int ADCMin
Definition Constants.h:76
constexpr std::string_view ChannelNames[]
Definition Constants.h:147
constexpr int ADCMax
Definition Constants.h:76
float baseline[NChannels]
void print(bool printall=true) const
float getCalib(uint32_t ich) const
void setCalib(uint32_t ich, float val, bool ismodified=true)
std::array< bool, NChannels > modified
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"