Project
Loading...
Searching...
No Matches
ZDCTowerParam.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 "Framework/Logger.h"
14
15using namespace o2::zdc;
16
18{
19 modified.fill(false);
20}
21
22void ZDCTowerParam::setTowerCalib(uint32_t ich, float val, bool ismodified)
23{
24 bool in_list = false;
25 for (int il = 0; il < ChTowerCalib.size(); il++) {
26 if (ich == ChTowerCalib[il]) {
27 in_list = true;
28 break;
29 }
30 }
31 if (in_list) {
32 tower_calib[ich] = val;
33 modified[ich] = ismodified;
34 } else {
35 LOG(fatal) << __func__ << " channel " << ich << " not in allowed range";
36 }
37}
38
39float ZDCTowerParam::getTowerCalib(uint32_t ich) const
40{
41 if (ich >= 0 && ich < NChannels) {
42 return tower_calib[ich];
43 } else {
44 LOG(fatal) << __func__ << " channel " << ich << " not in allowed range";
45 return 0;
46 }
47}
48
49void ZDCTowerParam::setTowerOffset(uint32_t ich, float val, bool ismodified)
50{
51 bool in_list = false;
52 for (int il = 0; il < ChTowerCalib.size(); il++) {
53 if (ich == ChTowerCalib[il]) {
54 in_list = true;
55 break;
56 }
57 }
58 if (in_list) {
59 tower_offset[ich] = val;
60 modified[ich] = ismodified;
61 } else {
62 LOG(fatal) << __func__ << " channel " << ich << " not in allowed range";
63 for (int il = 0; il < ChTowerCalib.size(); il++) {
64 LOG(info) << __func__ << " channel " << ChTowerCalib[il] << " " << ChannelNames[ChTowerCalib[il]];
65 }
66 }
67}
68
69float ZDCTowerParam::getTowerOffset(uint32_t ich) const
70{
71 if (ich >= 0 && ich < NChannels) {
72 return tower_offset[ich];
73 } else {
74 LOG(fatal) << __func__ << " channel " << ich << " not in allowed range";
75 return 0;
76 }
77}
78
80{
81 for (Int_t ich = 0; ich < NChannels; ich++) {
82 if (tower_calib[ich] > 0) {
83 LOG(info) << ChannelNames[ich] << (modified[ich] ? " NEW" : " OLD") << " calibration factor = " << tower_calib[ich] << " offset = " << tower_offset[ich];
84 }
85 }
86}
ZDC Tower calibration.
GLuint GLfloat * val
Definition glcorearb.h:1582
constexpr std::array< int, 17 > ChTowerCalib
Definition Constants.h:290
constexpr int NChannels
Definition Constants.h:65
constexpr std::string_view ChannelNames[]
Definition Constants.h:147
float getTowerCalib(uint32_t ich) const
void setTowerOffset(uint32_t ich, float val, bool ismodified=true)
float getTowerOffset(uint32_t ich) const
void setTowerCalib(uint32_t ich, float val, bool ismodified=true)
std::array< bool, NChannels > modified
float tower_offset[NChannels]
float tower_calib[NChannels]
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"