25 return mDetElemId == rhs.mDetElemId;
28inline bool Segmentation::operator!=(
const Segmentation& rhs)
const {
return !(rhs == *
this); }
33 swap(
a.mDetElemId,
b.mDetElemId);
34 swap(
a.mPadIndexOffset,
b.mPadIndexOffset);
39inline Segmentation::Segmentation(
const Segmentation&&
seg) : mBending{
std::move(
seg.mBending)}, mNonBending{
std::move(
seg.mNonBending)}, mDetElemId{
seg.mDetElemId}, mPadIndexOffset{
seg.mPadIndexOffset}
49inline int Segmentation::findPadByFEE(
int dualSampaId,
int dualSampaChannel)
const
51 bool isBending = dualSampaId < 1024;
54 catPadIndex = mBending.
findPadByFEE(dualSampaId, dualSampaChannel);
55 if (!mBending.
isValid(catPadIndex)) {
59 catPadIndex = mNonBending.
findPadByFEE(dualSampaId, dualSampaChannel);
60 if (!mNonBending.
isValid(catPadIndex)) {
64 return padC2DE(catPadIndex, isBending);
67inline bool Segmentation::isValid(
int dePadIndex)
const
69 return dePadIndex >= 0 && dePadIndex <
nofPads();
72inline int Segmentation::padC2DE(
int catPadIndex,
bool isBending)
const
77 return catPadIndex + mPadIndexOffset;
80inline void Segmentation::catSegPad(
int dePadIndex,
const CathodeSegmentation*& catseg,
int& padcuid)
const
86 if (dePadIndex < mPadIndexOffset) {
91 catseg = &mNonBending;
92 padcuid = dePadIndex - mPadIndexOffset;
95inline bool Segmentation::findPadPairByPosition(
double x,
double y,
int&
b,
int& nb)
const
101 nb = padC2DE(nb,
false);
105 if (!mNonBending.
isValid(nb)) {
106 b = padC2DE(
b,
true);
109 b = padC2DE(
b,
true);
110 nb = padC2DE(nb,
false);
114template <
typename CALLABLE>
115void Segmentation::forEachPad(CALLABLE&&
func)
const
118 int offset{mPadIndexOffset};
124template <
typename CALLABLE>
125void Segmentation::forEachPadInDualSampa(
int dualSampaId, CALLABLE&&
func)
const
127 bool isBending = dualSampaId < 1024;
131 int offset{mPadIndexOffset};
138template <
typename CALLABLE>
139void Segmentation::forEachPadInArea(
double xmin,
double ymin,
double xmax,
double ymax, CALLABLE&&
func)
const
142 int offset{mPadIndexOffset};
148template <
typename CALLABLE>
149void Segmentation::forEachNeighbouringPad(
int dePadIndex, CALLABLE&&
func)
const
153 catSegPad(dePadIndex, catSeg, catPadIndex);
159 catSeg->forEachNeighbouringPad(catPadIndex, [&
offset, &
func](
int cindex) {
164inline void Segmentation::forEachDualSampa(std::function<
void(
int dualSampaId)>
func)
const
170inline std::string Segmentation::padAsString(
int dePadIndex)
const
177 catSegPad(dePadIndex, catSeg, catPadIndex);
178 auto s = catSeg->padAsString(catPadIndex);
187inline int Segmentation::padDualSampaId(
int dePadIndex)
const
191 catSegPad(dePadIndex, catSeg, catPadIndex);
192 return catSeg->padDualSampaId(catPadIndex);
195inline int Segmentation::padDualSampaChannel(
int dePadIndex)
const
199 catSegPad(dePadIndex, catSeg, catPadIndex);
200 return catSeg->padDualSampaChannel(catPadIndex);
203inline double Segmentation::padPositionX(
int dePadIndex)
const
207 catSegPad(dePadIndex, catSeg, catPadIndex);
208 return catSeg->padPositionX(catPadIndex);
211inline double Segmentation::padPositionY(
int dePadIndex)
const
215 catSegPad(dePadIndex, catSeg, catPadIndex);
216 return catSeg->padPositionY(catPadIndex);
219inline double Segmentation::padSizeX(
int dePadIndex)
const
223 catSegPad(dePadIndex, catSeg, catPadIndex);
224 return catSeg->padSizeX(catPadIndex);
227inline double Segmentation::padSizeY(
int dePadIndex)
const
231 catSegPad(dePadIndex, catSeg, catPadIndex);
232 return catSeg->padSizeY(catPadIndex);
235inline int Segmentation::detElemId()
const {
return mDetElemId; }
o2::mch::mapping::CathodeSegmentation seg
A CathodeSegmentation lets you find pads on a given plane (cathode) of a detection element and then i...
void forEachPad(CALLABLE &&func) const
void forEachPadInDualSampa(int dualSampaId, CALLABLE &&func) const
int nofDualSampas() const
void forEachDualSampa(std::function< void(int dualSampaId)> func) const
Loop over dual sampas of this detection element.
void forEachPadInArea(double xmin, double ymin, double xmax, double ymax, CALLABLE &&func) const
int findPadByPosition(double x, double y) const
int findPadByFEE(int dualSampaId, int dualSampaChannel) const
bool isValid(int catPadIndex) const
Not every integer is a valid catPadIndex. This method will tell if catPadIndex is a valid one.
A Segmentation lets you find pads of a detection element and then inspect those pads.
const CathodeSegmentation & nonBending() const
const CathodeSegmentation & bending() const
bool isBendingPad(int dePadIndex) const
friend void swap(Segmentation &a, Segmentation &b)
bool isValid(int dePadIndex) const
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
void swap(Segmentation &a, Segmentation &b)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Defining DataPointCompositeObject explicitly as copiable.
std::string to_string(gsl::span< T, Size > span)