Project
Loading...
Searching...
No Matches
IDCGroup.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_TPC_IDCGROUP_H_
17#define ALICEO2_TPC_IDCGROUP_H_
18
19#include <vector>
20#include "Rtypes.h"
22#include "TPCBase/CRU.h"
23
24namespace o2::tpc
25{
26
27enum class PadFlags : unsigned short;
28
29template <class T>
30class CalDet;
31
33
35{
36 public:
43 IDCGroup(const unsigned char groupPads = 4, const unsigned char groupRows = 4, const unsigned char groupLastRowsThreshold = 2, const unsigned char groupLastPadsThreshold = 2, const unsigned int groupNotnPadsSectorEdges = 0, const unsigned short cru = 0)
44 : IDCGroupHelperRegion{groupPads, groupRows, groupLastRowsThreshold, groupLastPadsThreshold, groupNotnPadsSectorEdges, CRU(cru).region()}, mIDCsGrouped(getNIDCsPerIntegrationInterval()), mCRU{cru} {};
45
49 void resize(const unsigned int nIntegrationIntervals) { mIDCsGrouped.resize(getNIDCsPerIntegrationInterval() * nIntegrationIntervals); }
50
55 float operator()(unsigned int glrow, unsigned int pad, unsigned int integrationInterval) const { return mIDCsGrouped[getIndex(glrow, pad, integrationInterval)]; }
56
61 float& operator()(unsigned int glrow, unsigned int pad, unsigned int integrationInterval) { return mIDCsGrouped[getIndex(glrow, pad, integrationInterval)]; }
62
67 void setValUngrouped(unsigned int ulrow, unsigned int upad, unsigned int integrationInterval, const float value) { mIDCsGrouped[getIndexUngrouped(ulrow, upad, integrationInterval)] = value; }
68
73 float getValUngrouped(unsigned int ulrow, unsigned int upad, unsigned int integrationInterval) const { return mIDCsGrouped[getIndexUngrouped(ulrow, upad, integrationInterval)]; }
74
79 float getValUngroupedGlobal(unsigned int ugrow, unsigned int upad, unsigned int integrationInterval) const;
80
82 const auto& getData() const& { return mIDCsGrouped; }
83
85 auto getData() && { return std::move(mIDCsGrouped); }
86
88 void setData(const std::vector<float>& idcs) { mIDCsGrouped = idcs; }
89
91 unsigned int getNIntegrationIntervals() const { return mIDCsGrouped.size() / getNIDCsPerIntegrationInterval(); }
92
95 void dumpToTree(const char* outname = "IDCGroup.root") const;
96
100 void dumpToFile(const char* outFileName = "IDCGroup.root", const char* outName = "IDCGroup") const;
101
105 void draw(const unsigned int integrationInterval = 0, const std::string filename = "IDCsGrouped.pdf") const;
106
108 unsigned short getCRU() const { return mCRU; }
109
110 private:
111 std::vector<float> mIDCsGrouped{};
112 const unsigned short mCRU{};
113
115 static std::vector<float> get1DIDCs(const std::vector<float> idc, const unsigned int nIntervals, const unsigned int nIDCsPerIntegrationInterval, const unsigned short cru, const bool normalize, const CalDet<PadFlags>* flagMap);
116
117 ClassDefNV(IDCGroup, 1)
118};
119
120} // namespace o2::tpc
121
122#endif
helper class for grouping of pads and rows for one region
Helper class for accessing grouped pads for one region.
unsigned int getIndex(const unsigned int glrow, const unsigned int pad, unsigned int integrationInterval) const
unsigned int getNIDCsPerIntegrationInterval() const
unsigned int getIndexUngrouped(const unsigned int ulrow, const unsigned int upad, unsigned int integrationInterval) const
Class to hold grouped IDC values for one CRU for one TF.
Definition IDCGroup.h:35
float getValUngrouped(unsigned int ulrow, unsigned int upad, unsigned int integrationInterval) const
Definition IDCGroup.h:73
float getValUngroupedGlobal(unsigned int ugrow, unsigned int upad, unsigned int integrationInterval) const
Definition IDCGroup.cxx:59
const auto & getData() const &
Definition IDCGroup.h:82
auto getData() &&
Definition IDCGroup.h:85
unsigned short getCRU() const
Definition IDCGroup.h:108
IDCGroup(const unsigned char groupPads=4, const unsigned char groupRows=4, const unsigned char groupLastRowsThreshold=2, const unsigned char groupLastPadsThreshold=2, const unsigned int groupNotnPadsSectorEdges=0, const unsigned short cru=0)
Definition IDCGroup.h:43
void setValUngrouped(unsigned int ulrow, unsigned int upad, unsigned int integrationInterval, const float value)
Definition IDCGroup.h:67
void resize(const unsigned int nIntegrationIntervals)
Definition IDCGroup.h:49
unsigned int getNIntegrationIntervals() const
Definition IDCGroup.h:91
void dumpToFile(const char *outFileName="IDCGroup.root", const char *outName="IDCGroup") const
Definition IDCGroup.cxx:52
float operator()(unsigned int glrow, unsigned int pad, unsigned int integrationInterval) const
Definition IDCGroup.h:55
void setData(const std::vector< float > &idcs)
directly setting grouped IDC values
Definition IDCGroup.h:88
void dumpToTree(const char *outname="IDCGroup.root") const
Definition IDCGroup.cxx:21
float & operator()(unsigned int glrow, unsigned int pad, unsigned int integrationInterval)
Definition IDCGroup.h:61
void draw(const unsigned int integrationInterval=0, const std::string filename="IDCsGrouped.pdf") const
Definition IDCGroup.cxx:40
GLsizei const GLfloat * value
Definition glcorearb.h:819
Global TPC definitions and constants.
Definition SimTraits.h:167
PadFlags
Definition Defs.h:100
std::string filename()