Belle II Software  release-08-01-10
MinMax Class Reference

small class for storing min and max. More...

#include <MinMax.h>

Public Member Functions

 MinMax ()
 construtor, starts with max for min and min for max (will later be replaced by valid entries).
 
void reset ()
 reset to start values.
 
bool checkAndReplaceIfMinMax (double newVal)
 checks value and replaces old ones if new one is better. More...
 
double getMin () const
 returns smallest value stored so far.
 
double getMax () const
 returns biggest value stored so far.
 
std::string print () const
 print function returning results for min and max as a string.
 

Protected Attributes

std::pair< double, double > m_minMax
 .first is min, .second is .max.
 

Detailed Description

small class for storing min and max.

Definition at line 23 of file MinMax.h.

Member Function Documentation

◆ checkAndReplaceIfMinMax()

bool checkAndReplaceIfMinMax ( double  newVal)
inline

checks value and replaces old ones if new one is better.

returns true if minMax was updated.

Definition at line 36 of file MinMax.h.

37  {
38  bool wasAdded = false;
39  if (newVal < m_minMax.first) { m_minMax.first = newVal; wasAdded = true; }
40  if (m_minMax.second < newVal) { m_minMax.second = newVal; wasAdded = true; }
41  return wasAdded;
42  }
std::pair< double, double > m_minMax
.first is min, .second is .max.
Definition: MinMax.h:25

The documentation for this class was generated from the following file: