Belle II Software  release-08-01-10
ParticleWeightingKeyMap.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 #include <map>
11 #include <vector>
12 #include <string>
13 #include <analysis/dbobjects/ParticleWeightingAxis.h>
14 
15 
16 namespace Belle2 {
27  typedef std::pair<std::vector<int>, int> MultiDimBin;
28 
32  typedef std::map<std::string, ParticleWeightingBinLimits*> NDBin;
33 
38 
42  std::map<std::string, ParticleWeightingAxis*> m_axes;
46  std::vector<MultiDimBin> m_bins;
47 
51  const int m_outOfRangeBin = -1;
52 
53  public:
54 
59 
63  void addAxis(const std::string& name);
64 
71  int addKey(NDBin bin, int key_ID);
72 
78  double addKey(NDBin bin);
79 
80 
86  double getKey(std::map<std::string, double> values) const;
87 
92  std::vector<std::string> getNames() const;
93 
97  void printKeyMap() const;
98 
99  };
100 
102 } // Belle2 namespace
103 
104 
std::map< std::string, ParticleWeightingAxis * > m_axes
Axes mapped with their names.
const int m_outOfRangeBin
We assign unique bin ID for out-of-range bin.
double getKey(std::map< std::string, double > values) const
Get global bin ID for given observable values.
std::vector< MultiDimBin > m_bins
Vector of keys.
void printKeyMap() const
Print content of the key map.
int addKey(NDBin bin, int key_ID)
Adding predefined ID to the table.
std::vector< std::string > getNames() const
Get vector of names ParticleWeightingKeyMap.
void addAxis(const std::string &name)
Add axis.
std::map< std::string, ParticleWeightingBinLimits * > NDBin
N-dim bin: pairs of bin limits with name of the axis variable.
std::pair< std::vector< int >, int > MultiDimBin
Multidimensional bin: first element contains combination of bin IDs from 1D axis, second elements con...
Abstract base class for different kinds of events.