Belle II Software  release-08-01-10
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  m_tags["Brems_dynamic_LER"] = BackgroundMetaData::bg_Brems_dynamic_LER;
61  m_tags["Brems_dynamic_HER"] = BackgroundMetaData::bg_Brems_dynamic_HER;
62  m_tags["Coulomb_base_LER"] = BackgroundMetaData::bg_Coulomb_base_LER;
63  m_tags["Coulomb_dynamic_LER"] = BackgroundMetaData::bg_Coulomb_dynamic_LER;
64  m_tags["Coulomb_base_HER"] = BackgroundMetaData::bg_Coulomb_base_HER;
65  m_tags["Coulomb_dynamic_HER"] = BackgroundMetaData::bg_Coulomb_dynamic_HER;
67  }
68 
74  BackgroundMetaData::BG_TAG getTag(const std::string& bgType)
75  {
76  return m_tags[bgType];
77  }
78 
84  std::string getType(BackgroundMetaData::BG_TAG bgTag) const
85  {
86  if (bgTag == 0) return "";
87  for (auto tag : m_tags) {
88  if (bgTag == tag.second) return tag.first;
89  }
90  return "";
91  }
92 
98  std::string getType(unsigned int bgTag) const
99  {
100  if (bgTag == 0) return "";
101  for (auto tag : m_tags) {
102  if (bgTag == tag.second) return tag.first;
103  }
104  return "";
105  }
106 
111  std::string getBGTypes() const
112  {
113  std::string types;
114  for (auto tag : m_tags) {
115  if (tag.first != "other" && tag.second != 0) types += tag.first + ", ";
116  }
117  types += "other";
118  return types;
119  }
120 
121  private:
122 
123  std::map<std::string, BackgroundMetaData::BG_TAG> m_tags;
125  };
126 
127  } // background
129 } // Belle2
130 
BG_TAG
Enum for background tags.
@ bg_RBB_HER_far
Radiative Bhabha far HER.
@ bg_BHWide_LER
Wide angle radiative Bhabha LER.
@ bg_Coulomb_dynamic_LER
Coulomb dynamic LER.
@ bg_Coulomb_dynamic_HER
Coulomb dynamic HER.
@ bg_BHWideLargeAngle
Large angle radiative Bhabha.
@ bg_RBB_LER
Radiative Bhabha LER.
@ bg_Brems_base_HER
bremsstrahlung base HER
@ bg_Touschek_HER_far
Touschek far HER.
@ bg_Brems_LER
bremsstrahlung LER
@ bg_InjectionLER
injection background LER
@ bg_Brems_dynamic_HER
bremsstrahlung dynamic HER
@ bg_BHWide_HER
Wide angle radiative Bhabha HER.
@ bg_Coulomb_base_HER
Coulomb base HER.
@ bg_SynchRad_HER
Synchrotron radiation HER.
@ bg_Coulomb_base_LER
Coulomb base LER.
@ bg_Brems_HER
bremsstrahlung HER
@ bg_Brems_dynamic_LER
bremsstrahlung dynamic LER
@ 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_Brems_base_LER
bremsstrahlung base LER
@ 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:111
std::string getType(BackgroundMetaData::BG_TAG bgTag) const
Return BG type for a given BG tag.
Definition: BeamBGTypes.h:84
std::string getType(unsigned int bgTag) const
Return BG type for a given number.
Definition: BeamBGTypes.h:98
std::map< std::string, BackgroundMetaData::BG_TAG > m_tags
a map of BG tags
Definition: BeamBGTypes.h:123
BackgroundMetaData::BG_TAG getTag(const std::string &bgType)
Return BG tag for a given BG type.
Definition: BeamBGTypes.h:74
Abstract base class for different kinds of events.