39 if ((
test && matchMask) || (!
test && !matchMask)) {
60 mIsSaturated[0] =
false;
61 mIsSaturated[1] =
false;
69 assert(plane == 0 || plane == 1);
73 ++mMultiplicity[plane];
76 mIsSaturated[plane] =
true;
85 assert(iPad < mPads.size());
87 mPads.erase(mPads.begin() + iPad);
93 mIsSaturated[0] =
false;
94 mIsSaturated[1] =
false;
95 for (
const auto&
pad : mPads) {
110 return (pad1.plane() < pad2.plane() ||
111 (pad1.plane() == pad2.plane() && (pad1.y() < pad2.y() - precision ||
112 (pad1.y() < pad2.y() + precision && pad1.x() < pad2.x() - precision))));
120 assert(plane == 0 || plane == 1);
121 return mMultiplicity[plane];
133 return std::make_pair(TMath::Min(dim0.first, dim1.first), TMath::Min(dim0.second, dim1.second));
142 assert(plane == 0 || plane == 1);
144 double xmin(std::numeric_limits<float>::max());
145 double ymin(std::numeric_limits<float>::max());
147 if (mMultiplicity[plane] == 0) {
148 return std::make_pair(xmin, ymin);
151 for (
const auto&
pad : mPads) {
153 xmin = TMath::Min(xmin,
pad.
dx());
154 ymin = TMath::Min(ymin,
pad.
dy());
158 return std::make_pair(xmin, ymin);
167 assert(plane == 0 || plane == 1);
169 area[0][0] = std::numeric_limits<float>::max();
170 area[0][1] = -std::numeric_limits<float>::max();
171 area[1][0] = std::numeric_limits<float>::max();
172 area[1][1] = -std::numeric_limits<float>::max();
174 for (
const auto&
pad : mPads) {
193 std::pair<int, int> npad0 =
sizeInPads(0, statusMask);
194 std::pair<int, int> npad1 =
sizeInPads(1, statusMask);
197 if (TMath::Abs(dim0.first - dim1.first) < 1.e-3) {
198 nx = TMath::Max(npad0.first, npad1.first);
200 nx = dim0.first < dim1.first ? npad0.first : npad1.first;
204 if (TMath::Abs(dim0.second - dim1.second) < 1.e-3) {
205 ny = TMath::Max(npad0.second, npad1.second);
207 ny = dim0.second < dim1.second ? npad0.second : npad1.second;
210 return std::make_pair(nx, ny);
218 assert(plane == 0 || plane == 1);
220 if (mMultiplicity[plane] == 0) {
221 return std::make_pair(0, 0);
225 auto cmp = [](
double a,
double b) {
return a <
b - 0.01; };
226 std::set<double,
decltype(
cmp)> padx(
cmp);
227 std::set<double,
decltype(
cmp)> pady(
cmp);
229 for (
const auto&
pad : mPads) {
231 padx.emplace(
pad.
x());
232 pady.emplace(
pad.
y());
236 return std::make_pair(padx.size(), pady.size());
Definition of the cluster used by the original cluster finder algorithm.
Definition of the pad used by the original cluster finder algorithm.
size_t multiplicity() const
return the total number of pads associated to this cluster
bool isSaturated() const
return whether there are saturated pads on both plane or not
void addPad(double x, double y, double dx, double dy, double charge, bool isSaturated, int plane, int digitIdx, int status)
float charge() const
return the total charge of this cluster
PadOriginal & pad(size_t i)
return the ith pad (no bound checking)
void sortPads(double precision)
std::pair< int, int > sizeInPads(int statusMask) const
std::pair< double, double > minPadDimensions(int statusMask, bool matchMask) const
void removePad(size_t iPad)
void area(int plane, double area[2][2]) const
double x() const
return position in x (cm)
double dy() const
return half dimension in y (cm)
bool isSaturated() const
return whether this pad is saturated or not
bool isReal() const
return whether this is a real pad or a virtual pad
int status() const
return the status word
int plane() const
return 0 if bending pad, 1 if non-bending pad or -1 if none (e.g. pixel)
double dx() const
return half dimension in x (cm)
double charge() const
return the charge
double y() const
return position in y (cm)
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
GLenum GLint GLint * precision
bool shouldUsePad(const PadOriginal &pad, int plane, int statusMask, bool matchMask)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
FIXME: do not use data model tables.
char const *restrict const cmp