Belle II Software  release-06-02-00
KLMTriggerParameters.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 
12 #include <framework/logging/Logger.h>
13 #include <klm/dataobjects/eklm/EKLMElementNumbers.h>
14 
15 /* ROOT headers. */
16 #include <TObject.h>
17 
18 /* C++ headers. */
19 #include <string>
20 
21 namespace Belle2 {
30  class KLMTriggerParameters : public TObject {
31 
32  public:
33 
38  {
39  }
40 
46  KLMTriggerParameters(unsigned int nLayers, const std::string& whichLayers) :
47  m_nLayers{nLayers},
48  m_whichLayers{whichLayers}
49  {
50  }
51 
56  {
57  }
58 
63  void setNLayers(unsigned int nLayers)
64  {
65  // Reject values that exceed the number of layers in backward EKLM,
66  // since it is the part with the smallest number of layers.
67  unsigned int threshold{static_cast<unsigned int>(EKLMElementNumbers::Instance().getMaximalDetectorLayerNumber(EKLMElementNumbers::c_BackwardSection))};
68  if (nLayers > threshold)
69  B2FATAL("The value passed to 'setNLayers' exceed the maximum allowed number of layers."
70  << LogVar("nLayers", nLayers)
71  << LogVar("layers threshold", threshold));
72  m_nLayers = nLayers;
73  }
74 
79  void setWhichLayers(const std::string& whichLayers)
80  {
81  if (whichLayers.empty())
82  B2FATAL("The string passed to 'setWhichLayers' is empty."
83  << LogVar("string", whichLayers));
84  m_whichLayers = whichLayers;
85  }
86 
90  unsigned int getNLayers() const
91  {
92  return m_nLayers;
93  }
94 
98  std::string getWhichLayers() const
99  {
100  return m_whichLayers;
101  }
102 
103  private:
104 
108  unsigned int m_nLayers{0};
109 
113  std::string m_whichLayers;
114 
119 
120  };
121 
123 }
int getMaximalDetectorLayerNumber(int section) const
Get maximal detector layer number.
static const EKLMElementNumbers & Instance()
Instantiation.
DBObject containing parameters used in KLMTrigger module.
KLMTriggerParameters(unsigned int nLayers, const std::string &whichLayers)
Constructor.
std::string m_whichLayers
Pattern of layers used in the trigger logic.
void setWhichLayers(const std::string &whichLayers)
Set the pattern of layers used in the trigger logic.
void setNLayers(unsigned int nLayers)
Set the number of layers used in the trigger logic.
unsigned int getNLayers() const
Get the number of layers used in the trigger logic.
ClassDef(KLMTriggerParameters, 1)
Class version.
unsigned int m_nLayers
Number of layers used in the trigger logic.
std::string getWhichLayers() const
Get the pattern of layers used in the trigger logic.
KLMTriggerParameters()
Default constructor.
Class to store variables with their name which were sent to the logging service.
Abstract base class for different kinds of events.