Belle II Software  release-06-01-15
BeamBGTypes.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 
11 #include <framework/dataobjects/BackgroundMetaData.h>
12 #include <string>
13 #include <map>
14 
15 namespace Belle2 {
20  namespace background {
21 
27  class BeamBGTypes {
28 
29  public:
34  {
45  m_tags["Touschek_LER_far"] = BackgroundMetaData::bg_Touschek_LER_far;
46  m_tags["Touschek_HER_far"] = BackgroundMetaData::bg_Touschek_HER_far;
53  m_tags["BHWideLargeAngle"] = BackgroundMetaData::bg_BHWideLargeAngle;
59  }
60 
66  BackgroundMetaData::BG_TAG getTag(const std::string& bgType)
67  {
68  return m_tags[bgType];
69  }
70 
76  std::string getType(BackgroundMetaData::BG_TAG bgTag) const
77  {
78  if (bgTag == 0) return "";
79  for (auto tag : m_tags) {
80  if (bgTag == tag.second) return tag.first;
81  }
82  return "";
83  }
84 
90  std::string getType(unsigned int bgTag) const
91  {
92  if (bgTag == 0) return "";
93  for (auto tag : m_tags) {
94  if (bgTag == tag.second) return tag.first;
95  }
96  return "";
97  }
98 
103  std::string getBGTypes() const
104  {
105  std::string types;
106  for (auto tag : m_tags) {
107  if (tag.first != "other" && tag.second != 0) types += tag.first + ", ";
108  }
109  types += "other";
110  return types;
111  }
112 
113  private:
114 
115  std::map<std::string, BackgroundMetaData::BG_TAG> m_tags;
117  };
118 
119  } // background
121 } // Belle2
122 
BG_TAG
Enum for background tags.
@ bg_RBB_HER_far
Radiative Bhabha far HER.
@ bg_BHWide_LER
Wide angle radiative Bhabha LER.
@ bg_BHWideLargeAngle
Large angle radiative Bhabha.
@ bg_RBB_LER
Radiative Bhabha LER.
@ bg_Touschek_HER_far
Touschek far HER.
@ bg_Brems_LER
bremsstrahlung LER
@ bg_InjectionLER
injection background LER
@ bg_BHWide_HER
Wide angle radiative Bhabha HER.
@ bg_SynchRad_HER
Synchrotron radiation HER.
@ bg_Brems_HER
bremsstrahlung HER
@ bg_Touschek_LER_far
Touschek far LER.
@ bg_BHWide
Wide angle radiative Bhabha.
@ bg_RBB_HER
Radiative Bhabha HER.
@ bg_SynchRad_LER
Synchrotron radiation LER.
@ bg_InjectionHER
injection background HER
@ bg_RBB_LER_far
Radiative Bhabha far LER.
@ bg_other
Other type of background.
@ bg_RBB_gamma
Gammas from radiative Bhabha.
Class to define BG types and to convert between BG types and tags or v.v.
Definition: BeamBGTypes.h:27
std::string getBGTypes() const
Return all defined BG types as a string.
Definition: BeamBGTypes.h:103
std::string getType(BackgroundMetaData::BG_TAG bgTag) const
Return BG type for a given BG tag.
Definition: BeamBGTypes.h:76
std::string getType(unsigned int bgTag) const
Return BG type for a given number.
Definition: BeamBGTypes.h:90
std::map< std::string, BackgroundMetaData::BG_TAG > m_tags
a map of BG tags
Definition: BeamBGTypes.h:115
BackgroundMetaData::BG_TAG getTag(const std::string &bgType)
Return BG tag for a given BG type.
Definition: BeamBGTypes.h:66
Abstract base class for different kinds of events.