Belle II Software  release-05-02-19
ParticleWeightingKeyMap.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2018 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Ilya Komarov *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 #include <map>
13 #include <vector>
14 #include <string>
15 #include <analysis/dbobjects/ParticleWeightingAxis.h>
16 
17 
18 namespace Belle2 {
29  typedef std::pair<std::vector<int>, int> MultiDimBin;
30 
34  typedef std::map<std::string, ParticleWeightingBinLimits*> NDBin;
35 
39  class ParticleWeightingKeyMap {
40 
44  std::map<std::string, ParticleWeightingAxis*> m_axes;
48  std::vector<MultiDimBin> m_bins;
49 
53  const int m_outOfRangeBin = -1;
54 
55  public:
56 
61 
65  void addAxis(const std::string& name);
66 
73  int addKey(NDBin bin, int key_ID);
74 
80  double addKey(NDBin bin);
81 
82 
88  double getKey(std::map<std::string, double> values) const;
89 
94  std::vector<std::string> getNames() const;
95 
99  void printKeyMap() const;
100 
101  };
102 
104 } // Belle2 namespace
105 
106 
Belle2::MultiDimBin
std::pair< std::vector< int >, int > MultiDimBin
Multidimensional bin: first element contains combination of bin IDs from 1D axis, second elements con...
Definition: ParticleWeightingKeyMap.h:37
Belle2::ParticleWeightingKeyMap::getKey
double getKey(std::map< std::string, double > values) const
Get global bin ID for given observable values.
Definition: ParticleWeightingKeyMap.cc:75
Belle2::ParticleWeightingKeyMap::m_axes
std::map< std::string, ParticleWeightingAxis * > m_axes
Axes mapped with their names.
Definition: ParticleWeightingKeyMap.h:52
Belle2::ParticleWeightingKeyMap::ParticleWeightingKeyMap
ParticleWeightingKeyMap()
Constructor.
Definition: ParticleWeightingKeyMap.h:68
Belle2::ParticleWeightingKeyMap::addAxis
void addAxis(const std::string &name)
Add axis.
Definition: ParticleWeightingKeyMap.cc:18
Belle2::ParticleWeightingKeyMap::getNames
std::vector< std::string > getNames() const
Get vector of names ParticleWeightingKeyMap.
Definition: ParticleWeightingKeyMap.cc:100
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ParticleWeightingKeyMap::m_outOfRangeBin
const int m_outOfRangeBin
We assign unique bin ID for out-of-range bin.
Definition: ParticleWeightingKeyMap.h:61
Belle2::NDBin
std::map< std::string, ParticleWeightingBinLimits * > NDBin
N-dim bin: pairs of bin limits with name of the axis variable.
Definition: ParticleWeightingKeyMap.h:42
Belle2::ParticleWeightingKeyMap::addKey
int addKey(NDBin bin, int key_ID)
Adding predefined ID to the table.
Definition: ParticleWeightingKeyMap.cc:27
Belle2::ParticleWeightingKeyMap::printKeyMap
void printKeyMap() const
Print content of the key map.
Definition: ParticleWeightingKeyMap.cc:110
Belle2::ParticleWeightingKeyMap::m_bins
std::vector< MultiDimBin > m_bins
Vector of keys.
Definition: ParticleWeightingKeyMap.h:56