Belle II Software  release-05-01-25
PXDClusterShapeIndexPar.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Benjamin Schwenker *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <TObject.h>
13 #include <map>
14 #include <string>
15 
16 namespace Belle2 {
26  class PXDClusterShapeIndexPar: public TObject {
27  public:
32 
34  void addShape(const std::string& name, int index)
35  {
36  m_shapeIndexMap[index] = name;
37  }
38 
40  int getShapeIndex(const std::string& name) const
41  {
42  for (auto it = m_shapeIndexMap.begin(); it != m_shapeIndexMap.end(); ++it)
43  if (it->second == name)
44  return it->first;
45  return -1;
46  }
47 
49  const std::string& getShapeName(int index) const
50  {
51  return m_shapeIndexMap.at(index);
52  }
53 
55  const std::map<int, std::string>& getIndexMap() const
56  {
58  }
59 
60  private:
62  std::map<int, std::string> m_shapeIndexMap;
63 
65  };
67 } // end of namespace Belle2
Belle2::PXDClusterShapeIndexPar::addShape
void addShape(const std::string &name, int index)
Add shape with name and index
Definition: PXDClusterShapeIndexPar.h:42
Belle2::PXDClusterShapeIndexPar
The class for PXD cluster shape index payload.
Definition: PXDClusterShapeIndexPar.h:34
Belle2::PXDClusterShapeIndexPar::m_shapeIndexMap
std::map< int, std::string > m_shapeIndexMap
Map of shape names and indexes.
Definition: PXDClusterShapeIndexPar.h:70
Belle2::PXDClusterShapeIndexPar::ClassDef
ClassDef(PXDClusterShapeIndexPar, 1)
ClassDef, must be the last term before the closing {}.
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::PXDClusterShapeIndexPar::getShapeName
const std::string & getShapeName(int index) const
Returns shape name from index.
Definition: PXDClusterShapeIndexPar.h:57
Belle2::PXDClusterShapeIndexPar::PXDClusterShapeIndexPar
PXDClusterShapeIndexPar()
Default constructor.
Definition: PXDClusterShapeIndexPar.h:37
Belle2::PXDClusterShapeIndexPar::getIndexMap
const std::map< int, std::string > & getIndexMap() const
Returns shape index from shape string.
Definition: PXDClusterShapeIndexPar.h:63
Belle2::PXDClusterShapeIndexPar::~PXDClusterShapeIndexPar
~PXDClusterShapeIndexPar()
Destructor.
Definition: PXDClusterShapeIndexPar.h:39
Belle2::PXDClusterShapeIndexPar::getShapeIndex
int getShapeIndex(const std::string &name) const
Returns shape index from name.
Definition: PXDClusterShapeIndexPar.h:48