Project
Loading...
Searching...
No Matches
SACs.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
16
17#ifndef AliceO2_TPC_SACS_H
18#define AliceO2_TPC_SACS_H
19
20// root includes
21#include "TCanvas.h"
22
23// o2 includes
25#include "DataFormatsTPC/Defs.h"
26
27namespace o2::tpc::qc
28{
29
32class SACs
33{
34 public:
35 SACs() = default;
36
40 auto getSACValue(const unsigned int stack, const unsigned int interval) const { return mSACs[stack][interval]; }
41
44 float getSACZeroVal(const unsigned int stack) const { return mSACZero->getValueIDCZero(getSide(stack), stack % GEMSTACKSPERSIDE); }
45
49 void setSACZeroVal(float factor, const unsigned int stack) const { mSACZero->setValueSACZero(factor, getSide(stack), stack % GEMSTACKSPERSIDE); }
50
54 float getSACOneVal(const Side side, unsigned int integrationInterval) const;
55
59 float getSACDeltaVal(const unsigned int stack, unsigned int interval) const { return mSACDelta->getValue(getSide(stack), getSACDeltaIndex(stack, interval)); }
60
64 unsigned int getSACDeltaIndex(const unsigned int stack, unsigned int interval) const { return stack % GEMSTACKSPERSIDE + GEMSTACKSPERSIDE * interval; }
65
68 int getSACRejection(const unsigned int stack) const { return mIsSACZeroOutlier[stack]; }
69
70 void setSACZero(SACZero* sacZero) { mSACZero = sacZero; }
71 void setSACOne(SACOne* sacOne, const Side side = Side::A) { mSACOne[side] = sacOne; }
72 void setSACZeroMaxDeviation(float maxdeviation) { mSACZeroMaxDeviation = maxdeviation; }
73
74 template <typename T>
75 void setSACDelta(SACDelta<T>* sacDelta)
76 {
77 mSACDelta = sacDelta;
78 }
79
81 void setFourierCoeffSAC(FourierCoeffSAC* fourier) { mFourierSAC = fourier; }
82
83 TCanvas* drawSACTypeSides(const SACType type, const unsigned int integrationInterval, const int minZ = 0, const int maxZ = -1, TCanvas* canv = nullptr);
84 TCanvas* drawSACOneCanvas(int nbins1D, float xMin1D, float xMax1D, int integrationIntervals = -1, TCanvas* outputCanvas = nullptr) const;
85 TCanvas* drawFourierCoeffSAC(Side side, int nbins1D, float xMin1D, float xMax1, TCanvas* outputCanvas = nullptr) const;
86 TCanvas* drawSACZeroScale(TCanvas* outputCanvas = nullptr) const;
87
88 void scaleSAC0(const float factor, const Side side);
89 void setSACZeroScale(const bool rejectOutlier);
90 float getMeanSACZero(const o2::tpc::Side side, bool rejectOutliers);
91
92 void dumpToFile(std::string filename, int type = 0);
93
94 private:
95 std::array<std::vector<int32_t>, o2::tpc::GEMSTACKS> mSACs{};
96 SACZero* mSACZero = nullptr;
97 std::array<SACOne*, SIDES> mSACOne{};
98 SACDelta<unsigned char>* mSACDelta = nullptr;
99 FourierCoeffSAC* mFourierSAC = nullptr;
100 float mScaleSACZeroAside = 1.0;
101 float mScaleSACZeroCside = 1.0;
102 float mSACZeroMaxDeviation = 0.;
103 int mIsSACZeroOutlier[GEMSTACKSPERSIDE * o2::tpc::SECTORSPERSIDE * 2] = {0};
104
106 Side getSide(const unsigned int gemStack) const { return (gemStack < GEMSTACKSPERSIDE) ? Side::A : Side::C; }
107
109 unsigned int getStack(const unsigned int sector, const unsigned int stack) const { return static_cast<unsigned int>(stack + sector * GEMSTACKSPERSECTOR); }
110
111 ClassDefNV(SACs, 2)
112};
113} // namespace o2::tpc::qc
114#endif
This file provides the structs for storing the factorized IDC values and fourier coefficients to be s...
uint32_t side
Definition RawData.h:0
uint32_t stack
Definition RawData.h:1
float getSACDeltaVal(const unsigned int stack, unsigned int interval) const
Definition SACs.h:59
void setSACZeroVal(float factor, const unsigned int stack) const
Definition SACs.h:49
TCanvas * drawSACZeroScale(TCanvas *outputCanvas=nullptr) const
Definition SACs.cxx:170
void setSACOne(SACOne *sacOne, const Side side=Side::A)
Definition SACs.h:71
void setFourierCoeffSAC(FourierCoeffSAC *fourier)
setting the fourier coefficients
Definition SACs.h:81
void dumpToFile(std::string filename, int type=0)
void scaleSAC0(const float factor, const Side side)
Definition SACs.cxx:209
int getSACRejection(const unsigned int stack) const
Definition SACs.h:68
unsigned int getSACDeltaIndex(const unsigned int stack, unsigned int interval) const
Definition SACs.h:64
void setSACZeroScale(const bool rejectOutlier)
Definition SACs.cxx:223
void setSACZero(SACZero *sacZero)
Definition SACs.h:70
float getSACOneVal(const Side side, unsigned int integrationInterval) const
Definition SACs.cxx:25
TCanvas * drawSACOneCanvas(int nbins1D, float xMin1D, float xMax1D, int integrationIntervals=-1, TCanvas *outputCanvas=nullptr) const
Definition SACs.cxx:96
void setSACDelta(SACDelta< T > *sacDelta)
Definition SACs.h:75
void setSACZeroMaxDeviation(float maxdeviation)
Definition SACs.h:72
TCanvas * drawSACTypeSides(const SACType type, const unsigned int integrationInterval, const int minZ=0, const int maxZ=-1, TCanvas *canv=nullptr)
Definition SACs.cxx:30
TCanvas * drawFourierCoeffSAC(Side side, int nbins1D, float xMin1D, float xMax1, TCanvas *outputCanvas=nullptr) const
Definition SACs.cxx:133
auto getSACValue(const unsigned int stack, const unsigned int interval) const
Definition SACs.h:40
float getMeanSACZero(const o2::tpc::Side side, bool rejectOutliers)
Definition SACs.cxx:244
float getSACZeroVal(const unsigned int stack) const
Definition SACs.h:44
GLint GLint GLsizei GLint GLenum GLenum type
Definition glcorearb.h:275
GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat maxZ
Definition glcorearb.h:2910
GLfloat GLfloat minZ
Definition glcorearb.h:2910
constexpr unsigned char SECTORSPERSIDE
Definition Defs.h:40
IDCType
IDC types.
constexpr unsigned short GEMSTACKS
Definition Defs.h:60
Side
TPC readout sidE.
Definition Defs.h:35
@ A
Definition Defs.h:35
@ C
Definition Defs.h:36
constexpr unsigned short GEMSTACKSPERSECTOR
Definition Defs.h:57
constexpr unsigned short GEMSTACKSPERSIDE
Definition Defs.h:59
std::string filename()
float getValue(const Side side, const int index) const
float getValueIDCZero(const Side side, const int stackInSector) const
void setValueSACZero(const float sacZero, const Side side, const unsigned int index)