Belle II Software  release-05-01-25
ParticleWeightingAxis Class Reference

Class for handling LookUp tables. More...

#include <ParticleWeightingAxis.h>

Collaboration diagram for ParticleWeightingAxis:

Public Member Functions

 ParticleWeightingAxis ()
 Constructor.
 
std::string getName ()
 Returns name of an axis.
 
void setName (const std::string &name)
 Sets name of an axis. More...
 
int addBin (ParticleWeightingBinLimits *bin)
 Check if bin exists and creates it if not. More...
 
int findBin (ParticleWeightingBinLimits *bin)
 Returns id of bin with given bin limits Returns out-of-range binID if can't find. More...
 
int findBin (double value)
 Returns id of bin containig value. More...
 
void printAxis ()
 Prints axis information to the B2INFO stream.
 

Private Member Functions

bool isOverlappingBin (ParticleWeightingBinLimits *bin)
 Return TRUE if bin exisits or overlaps with existing. More...
 

Private Attributes

BinMap m_unnamedAxis
 Named axis with bins.
 
std::string m_axisName
 Axis name.
 
const int m_outOfRangeBinID = -1
 ID of out-of-range bin.
 

Detailed Description

Class for handling LookUp tables.

Definition at line 36 of file ParticleWeightingAxis.h.

Member Function Documentation

◆ addBin()

int addBin ( ParticleWeightingBinLimits bin)

Check if bin exists and creates it if not.

Returns bin ID Issues fatal error in case of ovarlaping bins.

Parameters
binbin limits
Returns
key ID

Definition at line 48 of file ParticleWeightingAxis.cc.

49 {
50  int existing_id = this->findBin(bin);
51  if (existing_id != m_outOfRangeBinID) {
52  return existing_id;
53  }
54  if (this->isOverlappingBin(bin)) {
55  B2FATAL("Attepting to add overlapping or existing bin");
56  } else {
57  int id = m_unnamedAxis.size() + 1;
58  m_unnamedAxis.insert(std::make_pair(id, bin));
59  return id;
60  }
61 }

◆ findBin() [1/2]

int findBin ( double  value)

Returns id of bin containig value.

Parameters
valuevalue
Returns
key ID

Definition at line 75 of file ParticleWeightingAxis.cc.

◆ findBin() [2/2]

int findBin ( ParticleWeightingBinLimits bin)

Returns id of bin with given bin limits Returns out-of-range binID if can't find.

Parameters
binbin limits
Returns
key ID

Definition at line 64 of file ParticleWeightingAxis.cc.

◆ isOverlappingBin()

bool isOverlappingBin ( ParticleWeightingBinLimits bin)
private

Return TRUE if bin exisits or overlaps with existing.

Parameters
bin- tested bin
Returns
is this bin overlatpping with existing bins or not

Checkin gif lower border is within some bin existing binning: | | new binning: | |

Checking if upper border is within some bin existing binning: | | new binning: | |

Checking if new bin covers exiting bin completely existing binning: | | new binning: | |

Definition at line 16 of file ParticleWeightingAxis.cc.

◆ setName()

void setName ( const std::string &  name)
inline

Sets name of an axis.

Parameters
nameaxis name

Definition at line 67 of file ParticleWeightingAxis.h.


The documentation for this class was generated from the following files:
Belle2::ParticleWeightingAxis::isOverlappingBin
bool isOverlappingBin(ParticleWeightingBinLimits *bin)
Return TRUE if bin exisits or overlaps with existing.
Definition: ParticleWeightingAxis.cc:16
Belle2::ParticleWeightingAxis::m_unnamedAxis
BinMap m_unnamedAxis
Named axis with bins.
Definition: ParticleWeightingAxis.h:38
Belle2::ParticleWeightingAxis::m_outOfRangeBinID
const int m_outOfRangeBinID
ID of out-of-range bin.
Definition: ParticleWeightingAxis.h:42
Belle2::ParticleWeightingAxis::findBin
int findBin(ParticleWeightingBinLimits *bin)
Returns id of bin with given bin limits Returns out-of-range binID if can't find.
Definition: ParticleWeightingAxis.cc:64