Belle II Software light-2406-ragdoll
ParticleExtraInfoMap.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 <TObject.h>
11#include <map>
12#include <vector>
13#include <string>
14
15namespace Belle2 {
29 class ParticleExtraInfoMap : public TObject {
30 public:
32 typedef std::map<std::string, unsigned int> IndexMap;
33
34 ParticleExtraInfoMap(): TObject() { }
35
37 const IndexMap& getMap(unsigned int mapID) const { return m_maps[mapID]; }
38
40 unsigned int getIndex(unsigned int mapID, const std::string& name) const;
41
46 unsigned int getMapForNewVar(const std::string& name);
47
52 unsigned int getMapForNewVar(const std::string& name, unsigned int oldMapID, unsigned int insertIndex);
53
55 unsigned int getNMaps() const { return m_maps.size(); }
56
57 private:
59 static bool isCompatible(const IndexMap& oldMap, const IndexMap& map, unsigned int insertIndex);
60
61 std::vector<IndexMap> m_maps;
64 };
66}
Internal class to store string -> index maps for extra info stored in Particle.
ClassDef(ParticleExtraInfoMap, 1)
Internal class to store string -> index maps for user-defined variables in Particle.
unsigned int getMapForNewVar(const std::string &name)
Return map ID to a map that has 'name' as first entry.
unsigned int getIndex(unsigned int mapID, const std::string &name) const
Find index for name in the given map, or return 0 if not found.
static bool isCompatible(const IndexMap &oldMap, const IndexMap &map, unsigned int insertIndex)
check if all entries in 'oldMap' prior to insertIndex are found in 'map' (with same idx).
std::vector< IndexMap > m_maps
List of string -> index maps.
unsigned int getNMaps() const
How many maps do we use?
const IndexMap & getMap(unsigned int mapID) const
Return reference to map with given ID.
std::map< std::string, unsigned int > IndexMap
string -> index map.
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24