Project
Loading...
Searching...
No Matches
IDCAverageGroupBase.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
15
16#ifndef ALICEO2_IDCAVERAGEGROUPBASE_H_
17#define ALICEO2_IDCAVERAGEGROUPBASE_H_
18
19#include <vector>
24#include "TPCBase/Mapper.h"
25#include "TPCBase/Sector.h"
26
27namespace o2::tpc
28{
29
31template <class Type>
33
35class IDCAverageGroupCRU;
36class IDCAverageGroupTPC;
37class IDCAverageGroupDraw;
38
40template <>
41class IDCAverageGroupBase<IDCAverageGroupCRU>
42{
43 public:
51 IDCAverageGroupBase(const unsigned char groupPads, const unsigned char groupRows, const unsigned char groupLastRowsThreshold, const unsigned char groupLastPadsThreshold, const unsigned int groupNotnPadsSectorEdges, const unsigned short cru, const int nThreads)
52 : mIDCsGrouped{groupPads, groupRows, groupLastRowsThreshold, groupLastPadsThreshold, groupNotnPadsSectorEdges, cru}, mRobustAverage(nThreads), mSector{CRU(cru).sector()} {};
53
55 unsigned int getNIntegrationIntervals() const { return mIDCsUngrouped.size() / Mapper::PADSPERREGION[getRegion()]; }
56
58 unsigned int getRegion() const { return mIDCsGrouped.getRegion(); }
59
61 unsigned int getCRU() const { return getRegion() + mSector * Mapper::NREGIONS; }
62
64 Sector getSector() const { return mSector; }
65
68 void setIDCs(const std::vector<float>& idcs);
69
72 void setIDCs(std::vector<float>&& idcs);
73
75 auto getIDCGroupData() && { return std::move(mIDCsGrouped).getData(); }
76
77 const auto& getIDCGroup() const { return mIDCsGrouped; }
78
83 float getUngroupedIDCValGlobal(const unsigned int ugrow, const unsigned int upad, const unsigned int integrationInterval) const { return mIDCsUngrouped[getUngroupedIndexGlobal(ugrow, upad, integrationInterval)]; }
84
89 float getUngroupedIDCValLocal(const unsigned int ulrow, const unsigned int upad, const unsigned int integrationInterval) const { return mIDCsUngrouped[getUngroupedIndex(ulrow, upad, integrationInterval)]; }
90
95 float getUngroupedNormedIDCValLocal(const unsigned int ulrow, const unsigned int upad, const unsigned int integrationInterval) const { return mIDCsUngrouped[getUngroupedIndex(ulrow, upad, integrationInterval)] * Mapper::INVPADAREA[getRegion()]; }
96
100 unsigned int getUngroupedIndex(const unsigned int ulrow, const unsigned int upad, const unsigned int integrationInterval) const { return integrationInterval * Mapper::PADSPERREGION[getRegion()] + Mapper::OFFSETCRULOCAL[getRegion()][ulrow] + upad; }
101
105 unsigned int getUngroupedIndexGlobal(const unsigned int ugrow, const unsigned int upad, const unsigned int integrationInterval) const { return integrationInterval * Mapper::PADSPERREGION[getRegion()] + Mapper::OFFSETCRUGLOBAL[ugrow] + upad; }
106
110 void drawUngroupedIDCs(const unsigned int integrationInterval = 0, const std::string filename = "IDCsUngrouped.pdf") const;
111
115 void drawGroupedIDCs(const unsigned int integrationInterval = 0, const std::string filename = "IDCsGrouped.pdf") const { mIDCsGrouped.draw(integrationInterval, filename); }
116
117 protected:
118 IDCGroup mIDCsGrouped{};
119 std::vector<RobustAverage> mRobustAverage;
120 std::vector<float> mWeightsPad{};
121 std::vector<float> mWeightsRow{};
122 std::vector<float> mIDCsUngrouped{};
123 const Sector mSector{};
124};
125
127template <>
128class IDCAverageGroupBase<IDCAverageGroupTPC>
129{
130 public:
137 IDCAverageGroupBase(const std::array<unsigned char, Mapper::NREGIONS>& groupPads, const std::array<unsigned char, Mapper::NREGIONS>& groupRows, const std::array<unsigned char, Mapper::NREGIONS>& groupLastRowsThreshold, const std::array<unsigned char, Mapper::NREGIONS>& groupLastPadsThreshold, const unsigned int groupNotnPadsSectorEdges, const int nThreads)
138 : mIDCGroupHelperSector(groupPads, groupRows, groupLastRowsThreshold, groupLastPadsThreshold, groupNotnPadsSectorEdges), mRobustAverage(nThreads){};
139
141 unsigned int getNIntegrationIntervals() const { return mIDCsUngrouped.getIDCDelta().size() / Mapper::getNumberOfPadsPerSide(); }
142
144 const auto& getIDCGroupData() const& { return mIDCsGrouped; }
145
147 auto getIDCGroupData() && { return std::move(mIDCsGrouped); }
148
150 const auto& getIDCUngroupData() const& { return mIDCsUngrouped; }
151
153 auto& getIDCGroupHelperSector() const { return mIDCGroupHelperSector; }
154
161 unsigned int getUngroupedIndexGlobal(const unsigned int sector, const unsigned int region, unsigned int urow, unsigned int upad, unsigned int integrationInterval) const { return IDCGroupHelperSector::getUngroupedIndexGlobal(sector, region, urow, upad, integrationInterval); }
162
169 float getGroupedIDCDeltaVal(const unsigned int sector, const unsigned int region, unsigned int urow, unsigned int upad, unsigned int integrationInterval) const { return mIDCsGrouped.getValue(mIDCGroupHelperSector.getIndexUngrouped(sector, region, urow, upad, integrationInterval)); }
170
177 float getUngroupedIDCDeltaVal(const unsigned int sector, const unsigned int region, unsigned int urow, unsigned int upad, unsigned int integrationInterval) const { return mIDCsUngrouped.getValue(getUngroupedIndexGlobal(sector, region, urow, upad, integrationInterval)); }
178
183 void drawGroupedIDCsSector(const unsigned int sector, const unsigned int integrationInterval, const std::string filename = "IDCDeltaGroupedSector.pdf") const { drawIDCDeltaHelper(false, Sector(sector), integrationInterval, true, filename); }
184
189 void drawUngroupedIDCsSector(const unsigned int sector, const unsigned int integrationInterval, const std::string filename = "IDCDeltaUngroupedSector.pdf") const { drawIDCDeltaHelper(false, Sector(sector), integrationInterval, false, filename); }
190
194 void drawGroupedIDCsSide(const unsigned int integrationInterval, const std::string filename = "IDCDeltaGroupedSide.pdf") const { drawIDCDeltaHelper(true, (mSide == Side::A) ? Sector(0) : Sector(Sector::MAXSECTOR - 1), integrationInterval, true, filename); }
195
199 void drawUngroupedIDCsSide(const unsigned int integrationInterval, const std::string filename = "IDCDeltaUngroupedSide.pdf") const { drawIDCDeltaHelper(true, (mSide == Side::A) ? Sector(0) : Sector(Sector::MAXSECTOR - 1), integrationInterval, false, filename); }
200
204 void setIDCs(const IDCDelta<float>& idcs, const Side side);
205
209 void setIDCs(IDCDelta<float>&& idcs, const Side side);
210
212 Side getSide() const { return mSide; }
213
216
217 protected:
218 IDCDelta<float> mIDCsGrouped{};
220 std::vector<RobustAverage> mRobustAverage;
221 std::array<std::vector<float>, Mapper::NREGIONS> mWeightsPad{};
222 std::array<std::vector<float>, Mapper::NREGIONS> mWeightsRow{};
223 IDCDelta<float> mIDCsUngrouped{};
224 Side mSide{};
225
228
230 void drawIDCDeltaHelper(const bool type, const Sector sector, const unsigned int integrationInterval, const bool grouped, const std::string filename) const;
231};
232
233} // namespace o2::tpc
234
235#endif
This file provides the structs for storing the factorized IDC values and fourier coefficients to be s...
helper class for grouping of pads and rows for one sector
class for storing grouped IDCs
uint32_t side
Definition RawData.h:0
class for performing robust averaging and outlier filtering
float getUngroupedIDCValLocal(const unsigned int ulrow, const unsigned int upad, const unsigned int integrationInterval) const
unsigned int getUngroupedIndex(const unsigned int ulrow, const unsigned int upad, const unsigned int integrationInterval) const
float getUngroupedNormedIDCValLocal(const unsigned int ulrow, const unsigned int upad, const unsigned int integrationInterval) const
unsigned int getUngroupedIndexGlobal(const unsigned int ugrow, const unsigned int upad, const unsigned int integrationInterval) const
std::vector< RobustAverage > mRobustAverage
! object for averaging (each thread will get his one object)
void setIDCs(const std::vector< float > &idcs)
float getUngroupedIDCValGlobal(const unsigned int ugrow, const unsigned int upad, const unsigned int integrationInterval) const
void drawUngroupedIDCs(const unsigned int integrationInterval=0, const std::string filename="IDCsUngrouped.pdf") const
void drawGroupedIDCs(const unsigned int integrationInterval=0, const std::string filename="IDCsGrouped.pdf") const
void setIDCs(std::vector< float > &&idcs)
IDCAverageGroupBase(const unsigned char groupPads, const unsigned char groupRows, const unsigned char groupLastRowsThreshold, const unsigned char groupLastPadsThreshold, const unsigned int groupNotnPadsSectorEdges, const unsigned short cru, const int nThreads)
void drawUngroupedIDCsSector(const unsigned int sector, const unsigned int integrationInterval, const std::string filename="IDCDeltaUngroupedSector.pdf") const
void drawIDCDeltaHelper(const bool type, const Sector sector, const unsigned int integrationInterval, const bool grouped, const std::string filename) const
helper function for drawing IDCDelta
std::vector< RobustAverage > mRobustAverage
! object for averaging (each thread will get his one object)
void resetGroupedIDCs()
resetting the grouped IDCs
void resizeGroupedIDCs()
set correct size for grouped IDCs
void drawGroupedIDCsSide(const unsigned int integrationInterval, const std::string filename="IDCDeltaGroupedSide.pdf") const
IDCGroupHelperSector mIDCGroupHelperSector
helper object containing the grouping parameter and methods for accessing data indices
float getGroupedIDCDeltaVal(const unsigned int sector, const unsigned int region, unsigned int urow, unsigned int upad, unsigned int integrationInterval) const
unsigned int getUngroupedIndexGlobal(const unsigned int sector, const unsigned int region, unsigned int urow, unsigned int upad, unsigned int integrationInterval) const
IDCAverageGroupBase(const std::array< unsigned char, Mapper::NREGIONS > &groupPads, const std::array< unsigned char, Mapper::NREGIONS > &groupRows, const std::array< unsigned char, Mapper::NREGIONS > &groupLastRowsThreshold, const std::array< unsigned char, Mapper::NREGIONS > &groupLastPadsThreshold, const unsigned int groupNotnPadsSectorEdges, const int nThreads)
void drawGroupedIDCsSector(const unsigned int sector, const unsigned int integrationInterval, const std::string filename="IDCDeltaGroupedSector.pdf") const
void drawUngroupedIDCsSide(const unsigned int integrationInterval, const std::string filename="IDCDeltaUngroupedSide.pdf") const
float getUngroupedIDCDeltaVal(const unsigned int sector, const unsigned int region, unsigned int urow, unsigned int upad, unsigned int integrationInterval) const
void setIDCs(IDCDelta< float > &&idcs, const Side side)
void setIDCs(const IDCDelta< float > &idcs, const Side side)
Helper class for either perform the grouping or draw the grouping.
Helper class for accessing grouped pads for one sector.
static unsigned int getUngroupedIndexGlobal(const unsigned int sector, const unsigned int region, unsigned int urow, unsigned int upad, unsigned int integrationInterval)
Class to hold grouped IDC values for one CRU for one TF.
Definition IDCGroup.h:35
static const std::vector< unsigned int > OFFSETCRULOCAL[NREGIONS]
row offset in cru for given local pad row
Definition Mapper.h:555
static constexpr float INVPADAREA[NREGIONS]
inverse size of the pad area padwidth*padLength
Definition Mapper.h:536
static constexpr unsigned int NREGIONS
total number of regions in one sector
Definition Mapper.h:527
static constexpr int getNumberOfPadsPerSide()
Definition Mapper.h:374
static constexpr unsigned int PADSPERREGION[NREGIONS]
number of pads per CRU
Definition Mapper.h:530
static constexpr unsigned int OFFSETCRUGLOBAL[PADROWS]
row offset in cru for given global pad row
Definition Mapper.h:579
static constexpr int MAXSECTOR
Definition Sector.h:44
GLint GLint GLsizei GLint GLenum GLenum type
Definition glcorearb.h:275
Global TPC definitions and constants.
Definition SimTraits.h:167
Side
TPC readout sidE.
Definition Defs.h:35
@ A
Definition Defs.h:35
std::string filename()
struct to access and set Delta IDCs