forked from mcoquet642/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPadROCPos.h
More file actions
108 lines (88 loc) · 2.8 KB
/
PadROCPos.h
File metadata and controls
108 lines (88 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// \file PadROCPos.h
/// \author Jens Wiechula, Jens.Wiechula@ikf.uni-frankfurt.de
#ifndef ALICEO2_TPC_PADROCPOS_H_
#define ALICEO2_TPC_PADROCPOS_H_
#include "DataFormatsTPC/Defs.h"
#include "TPCBase/ROC.h"
#include "TPCBase/PadPos.h"
namespace o2
{
namespace tpc
{
/// \brief Pad and row inside a ROC
///
/// This class encapsulates the pad and row inside a ROC
/// \see TPCBase/PadPos.h
/// \see TPCBase/ROC.h
///
/// origin: TPC
/// \author Jens Wiechula, Jens.Wiechula@ikf.uni-frankfurt.de
class PadROCPos
{
public:
/// default constructor
PadROCPos() = default;
/// constructor from roc, row and pad
/// \param roc ROC number
/// \param rowInROC row in the readout chamber
/// \param padInRow pad in row
PadROCPos(const int roc, const int rowInROC, const int padInRow) : mROC(roc), mPadPos(PadPos(rowInROC, padInRow)) {}
/// constructor from ROC and PadPos types
/// \param roc ROC type
/// \param padPosition row and pad
PadROCPos(const ROC& roc, const PadPos& padPosition) : mROC(roc), mPadPos(padPosition) {}
/// get ROC
/// \return ROC
const ROC& getROC() const { return mROC; }
/// get the sector
/// \return sector
const Sector getSector() const { return mROC.getSector(); }
/// get ROC
/// \return ROC
ROC& getROC() { return mROC; }
/// get ROC type
/// \return ROC type
RocType getROCType() const { return mROC.rocType(); }
/// get pad and row position
/// \return pad and row position
const PadPos& getPadPos() const { return mPadPos; }
/// get the pad row
/// \return pad row
int getRow() const { return mPadPos.getRow(); }
/// get the pad number
/// \return pad number
int getPad() const { return mPadPos.getPad(); }
PadPos& getPadPos() { return mPadPos; }
/// check if is valid
/// @return pad valid
bool isValid() const { return mPadPos.isValid(); }
/// equal operator
bool operator==(const PadROCPos& other) const { return (mROC == other.mROC) && (mPadPos == other.mPadPos); }
/// smaller operator
bool operator<(const PadROCPos& other) const
{
if (mROC < other.mROC) {
return true;
}
if (mROC == other.mROC && mPadPos < other.mPadPos) {
return true;
}
return false;
}
private:
ROC mROC{};
PadPos mPadPos{};
};
} // namespace tpc
} // namespace o2
#endif