Skip to content

Commit 03b3b38

Browse files
wiechuladavidrohr
authored andcommitted
Add direct pad-wise setters / getters
1 parent 04c0378 commit 03b3b38

File tree

1 file changed

+32
-2
lines changed
  • Detectors/TPC/base/include/TPCBase

1 file changed

+32
-2
lines changed

Detectors/TPC/base/include/TPCBase/CalDet.h

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,14 @@ class CalDet
6464
///
6565
///
6666
const T getValue(const int sec, const int globalPadInSector) const;
67-
void setValue(const int sec, const int globalPadInSector, const T value);
67+
void setValue(const int sec, const int globalPadInSector, const T& value);
68+
void setValue(const int sec, const int rowInSector, const int padInRow, const T& value);
6869

6970
/// \todo return value of T& not possible if a default value should be returned, e.g. T{}:
7071
/// warning: returning reference to temporary
7172
const T getValue(const ROC roc, const size_t row, const size_t pad) const;
7273
const T getValue(const CRU cru, const size_t row, const size_t pad) const;
74+
const T getValue(const Sector sec, const int rowInSector, const int padInRow) const;
7375

7476
void setName(const std::string_view name) { mName = name.data(); }
7577
const std::string& getName() const { return mName; }
@@ -184,7 +186,7 @@ inline const T CalDet<T>::getValue(const CRU cru, const size_t row, const size_t
184186
}
185187

186188
template <class T>
187-
inline void CalDet<T>::setValue(const int sec, const int globalPadInSector, const T value)
189+
inline void CalDet<T>::setValue(const int sec, const int globalPadInSector, const T& value)
188190
{
189191
assert(mPadSubset == PadSubset::ROC);
190192
int roc = sec;
@@ -197,6 +199,34 @@ inline void CalDet<T>::setValue(const int sec, const int globalPadInSector, cons
197199
mData[roc].setValue(padInROC, value);
198200
}
199201

202+
template <class T>
203+
inline void CalDet<T>::setValue(const int sec, const int rowInSector, const int padInRow, const T& value)
204+
{
205+
assert(mPadSubset == PadSubset::ROC);
206+
int roc = sec;
207+
int rowInROC = rowInSector;
208+
const int rowsInIROC = 63;
209+
if (rowInSector >= rowsInIROC) {
210+
roc += Mapper::getNumberOfIROCs();
211+
rowInROC -= rowsInIROC;
212+
}
213+
mData[roc].setValue(rowInROC, padInRow, value);
214+
}
215+
216+
template <class T>
217+
inline const T CalDet<T>::getValue(const Sector sec, const int rowInSector, const int padInRow) const
218+
{
219+
assert(mPadSubset == PadSubset::ROC);
220+
int roc = sec;
221+
int rowInROC = rowInSector;
222+
const int rowsInIROC = 63;
223+
if (rowInSector >= rowsInIROC) {
224+
roc += Mapper::getNumberOfIROCs();
225+
rowInROC -= rowsInIROC;
226+
}
227+
return mData[roc].getValue(rowInROC, padInRow);
228+
}
229+
200230
#ifndef GPUCA_ALIGPUCODE // hide from GPU standalone compilation
201231

202232
//______________________________________________________________________________

0 commit comments

Comments
 (0)