Belle II Software  release-08-01-10
PXDClusterShapeIndexPar.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 #pragma once
9 
10 #include <TObject.h>
11 #include <map>
12 #include <string>
13 
14 namespace Belle2 {
24  class PXDClusterShapeIndexPar: public TObject {
25  public:
30 
32  void addShape(const std::string& name, int index)
33  {
34  m_shapeIndexMap[index] = name;
35  }
36 
38  int getShapeIndex(const std::string& name) const
39  {
40  for (auto it = m_shapeIndexMap.begin(); it != m_shapeIndexMap.end(); ++it)
41  if (it->second == name)
42  return it->first;
43  return -1;
44  }
45 
47  const std::string& getShapeName(int index) const
48  {
49  return m_shapeIndexMap.at(index);
50  }
51 
53  const std::map<int, std::string>& getIndexMap() const
54  {
55  return m_shapeIndexMap;
56  }
57 
58  private:
60  std::map<int, std::string> m_shapeIndexMap;
61 
63  };
65 } // end of namespace Belle2
The class for PXD cluster shape index payload.
std::map< int, std::string > m_shapeIndexMap
Map of shape names and indexes.
int getShapeIndex(const std::string &name) const
Returns shape index from name.
ClassDef(PXDClusterShapeIndexPar, 1)
ClassDef, must be the last term before the closing {}.
PXDClusterShapeIndexPar()
Default constructor.
void addShape(const std::string &name, int index)
Add shape with name and index
const std::string & getShapeName(int index) const
Returns shape name from index.
const std::map< int, std::string > & getIndexMap() const
Returns shape index from shape string.
Abstract base class for different kinds of events.