Project
Loading...
Searching...
No Matches
PadParameters.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 O2_TRD_PADPARAMETERS_H
13#define O2_TRD_PADPARAMETERS_H
14
16// TRD pad calibrations base class //
17// 2019 - Ported from various bits of AliRoot (SHTM) //
18// This is analagous to the old CalROC but templatized so can store unsigned//
19// int(CalROC) and char SingleChamberStatus amongst others.
20// Most things were stored in AliTRDcalROC,AliTRDcalPad, AliTRDcalDet //
22
23//
24#include <vector>
25
28#include "Framework/Logger.h"
29
30namespace o2
31{
32namespace trd
33{
34
35template <class T>
37{
38 public:
39 PadParameters() = default;
40 PadParameters(int iDet);
41 void init(int iDet);
42
43 int getChannel(int col, int row) const;
44 T getValue(int ich) const { return mData[ich]; };
45 T getValue(int col, int row) const { return getValue(getChannel(col, row)); };
46 void setValue(int ich, T value) { mData[ich] = value; }
47 void setValue(int col, int row, T value) { setValue(getChannel(col, row), value); }
48
49 private:
50 std::vector<T> mData{};
51 ClassDefNV(PadParameters, 1);
52};
53
54template <class T>
56{
57 init(iDet);
58}
59
60template <class T>
62{
64 auto nChannels = constants::NCOLUMN * nRows;
65 mData.resize(nChannels);
66}
67
68template <class T>
70{
71 if (mData.empty()) {
72 LOG(error) << "Pad parameters not initialized";
73 } else if (mData.size() == constants::NROWC0 * constants::NCOLUMN) {
74 return row + col * constants::NROWC0;
75 } else if (mData.size() == constants::NROWC1 * constants::NCOLUMN) {
76 return row + col * constants::NROWC1;
77 } else {
78 LOG(error) << "Wrong number of channels set: " << mData.size();
79 }
80 return -1;
81}
82
83} // namespace trd
84} // namespace o2
85#endif
Global TRD definitions and constants.
uint32_t col
Definition RawData.h:4
T getValue(int ich) const
int getChannel(int col, int row) const
T getValue(int col, int row) const
void setValue(int ich, T value)
void setValue(int col, int row, T value)
GLsizei const GLfloat * value
Definition glcorearb.h:819
constexpr int NCOLUMN
the number of pad columns for each chamber
Definition Constants.h:41
constexpr int NROWC0
the number of pad rows for chambers of type C0 (installed in stack 2)
Definition Constants.h:42
constexpr int NROWC1
the number of pad rows for chambers of type C1 (installed in stacks 0, 1, 3 and 4)
Definition Constants.h:43
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
static int getStack(int det)
constexpr size_t nChannels
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::vector< int > row