15#ifndef O2_MCH_CONTOUR_SEGMENTTREE_H
16#define O2_MCH_CONTOUR_SEGMENTTREE_H
121 int mid((
b + e) / 2);
140 throw std::invalid_argument(
"must get at least two values");
150 : mInterval(
i), mMidpoint(
m), mCardinality(0), mIsPotent(false), mLeftChild(nullptr), mRightChild(nullptr)
168 if (
interval().isFullyContainedIn(
i) && !isPotent()) {
169 if (edgeStack.empty()) {
172 auto& back = edgeStack.back();
183 right()->contribution(
i, edgeStack);
191 std::cout <<
msg <<
"(" <<
i <<
") into mInterval=" << node.
interval() <<
" midpoint=" << node.
midpoint();
192 std::cout <<
" isFullyContained=" << node.
interval().isFullyContainedIn(
i) <<
" cardinality=" << node.
cardinality()
193 << (node.
goLeft(
i) ?
" -L- " :
" -R- ");
196 std::cout <<
" WARNING BEGIN=MID";
199 std::cout <<
" WARNING END=MID";
207 increaseCardinality();
210 left()->insertInterval(
i);
213 right()->insertInterval(
i);
223 decreaseCardinality();
225 if (cardinality() > 0) {
229 left()->deleteInterval(
i);
232 right()->deleteInterval(
i);
241 if (
left() ==
nullptr) {
244 if (
left()->cardinality() > 0 &&
right()->cardinality() > 0) {
255 right()->decreaseCardinality();
256 increaseCardinality();
263 right()->increaseCardinality();
264 decreaseCardinality();
275 auto r =
right()->getNodeList();
276 l.insert(l.end(),
r.begin(),
r.end());
284 return std::count_if(
v.begin(),
v.end(), [](
const Node<T>* node) { return node->isLeaf(); });
301 os << (*node.
left());
302 os << (*node.
right());
void insertInterval(Interval< T > i)
bool goLeft(const Interval< T > &i) const
void increaseCardinality()
std::vector< const Node * > getNodeList() const
void deleteInterval(Interval< T > i)
Node & setLeft(Node *left)
void setCardinality(int c)
Node & setRight(Node *right)
void contribution(Interval< T > i, std::vector< o2::mch::contour::impl::Interval< T > > &edgeStack)
bool goRight(const Interval< T > &i) const
void decreaseCardinality()
Node(Interval< T > i, T midpoint)
Interval< T > interval() const
GLboolean GLboolean GLboolean b
GLenum GLsizei GLsizei GLint * values
GLubyte GLubyte GLubyte GLubyte w
bool isActive(const Node< T > &node)
void dump(const char *msg, const Node< T > &node, const Interval< T > &i)
Interval< T > interval(const VerticalEdge< T > &edge)
Node< T > * buildNode(const std::vector< T > &values, int b, int e)
bool isStrictlyBelow(double a, double b)
bool areEqual(double a, double b)
int numberOfLeaves(const Node< T > &rootNode)
std::ostream & operator<<(std::ostream &os, const ManhattanEdge< T > &edge)
Node< T > * createSegmentTree(std::vector< T > values)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
uint64_t const void const *restrict const msg