Belle II Software development
KLMStripEfficiency.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/* KLM headers. */
12#include <klm/dataobjects/KLMElementNumbers.h>
13
14/* ROOT headers. */
15#include <TObject.h>
16
17/* C++ headers. */
18#include <map>
19#include <limits>
20
21namespace Belle2 {
31 class KLMStripEfficiency: public TObject {
32 public:
33
38 {
39 }
40
45 {
46 }
47
54 void setEfficiency(KLMChannelNumber stripId, float efficiency, float efficiencyError = 0.)
55 {
56 m_efficiency.insert(std::pair<KLMChannelNumber, float>(stripId, efficiency));
57 m_efficiencyError.insert(std::pair<KLMChannelNumber, float>(stripId, efficiencyError));
58 }
59
70 void setBarrelEfficiency(int section, int sector, int layer, int plane, int strip, float efficiency, float efficiencyError = 0.)
71 {
72 const KLMElementNumbers* elementNumbers = &(KLMElementNumbers::Instance());
73 KLMChannelNumber stripId = elementNumbers->channelNumberBKLM(section, sector, layer, plane, strip);
74 setEfficiency(stripId, efficiency, efficiencyError);
75 }
76
87 void setEndcapEfficiency(int section, int sector, int layer, int plane, int strip, float efficiency, float efficiencyError = 0.)
88 {
89 const KLMElementNumbers* elementNumbers = &(KLMElementNumbers::Instance());
90 KLMChannelNumber stripId = elementNumbers->channelNumberEKLM(section, sector, layer, plane, strip);
91 setEfficiency(stripId, efficiency, efficiencyError);
92 }
93
98 float getEfficiency(KLMChannelNumber stripId) const
99 {
100 auto search = m_efficiency.find(stripId);
101 if (search == m_efficiency.end())
102 return std::numeric_limits<float>::quiet_NaN();
103 return search->second;
104 }
105
114 float getBarrelEfficiency(int section, int sector, int layer, int plane, int strip) const
115 {
116 const KLMElementNumbers* elementNumbers = &(KLMElementNumbers::Instance());
117 KLMChannelNumber stripId = elementNumbers->channelNumberBKLM(section, sector, layer, plane, strip);
118 return getEfficiency(stripId);
119 }
120
129 float getEndcapEfficiency(int section, int sector, int layer, int plane, int strip) const
130 {
131 const KLMElementNumbers* elementNumbers = &(KLMElementNumbers::Instance());
132 KLMChannelNumber stripId = elementNumbers->channelNumberEKLM(section, sector, layer, plane, strip);
133 return getEfficiency(stripId);
134 }
135
141 {
142 auto search = m_efficiencyError.find(stripId);
143 if (search == m_efficiencyError.end())
144 return std::numeric_limits<float>::quiet_NaN();
145 return search->second;
146 }
147
156 float getBarrelEfficiencyError(int section, int sector, int layer, int plane, int strip) const
157 {
158 const KLMElementNumbers* elementNumbers = &(KLMElementNumbers::Instance());
159 KLMChannelNumber stripId = elementNumbers->channelNumberBKLM(section, sector, layer, plane, strip);
160 return getEfficiencyError(stripId);
161 }
162
171 float getEndcapEfficiencyError(int section, int sector, int layer, int plane, int strip) const
172 {
173 const KLMElementNumbers* elementNumbers = &(KLMElementNumbers::Instance());
174 KLMChannelNumber stripId = elementNumbers->channelNumberEKLM(section, sector, layer, plane, strip);
175 return getEfficiencyError(stripId);
176 }
177
178 private:
179
181 std::map<KLMChannelNumber, float> m_efficiency;
182
184 std::map<KLMChannelNumber, float> m_efficiencyError;
185
188
189 };
190
192}
KLM element numbers.
KLMChannelNumber channelNumberBKLM(int section, int sector, int layer, int plane, int strip) const
Get channel number for BKLM.
static const KLMElementNumbers & Instance()
Instantiation.
KLMChannelNumber channelNumberEKLM(int section, int sector, int layer, int plane, int strip) const
Get channel number for EKLM.
DBObject used to store the efficiencies of KLM strips.
std::map< KLMChannelNumber, float > m_efficiencyError
KLM strip efficiency error.
float getBarrelEfficiency(int section, int sector, int layer, int plane, int strip) const
Returns efficiency of a given BKLM strip using the geometrical infos.
float getEfficiencyError(KLMChannelNumber stripId) const
Returns error on efficiency of a given KLM strip using directly the stripId.
float getBarrelEfficiencyError(int section, int sector, int layer, int plane, int strip) const
Returns error on efficiency of a given BKLM strip using the geometrical infos.
~KLMStripEfficiency()
Default destructor.
std::map< KLMChannelNumber, float > m_efficiency
KLM strip efficiency.
void setEfficiency(KLMChannelNumber stripId, float efficiency, float efficiencyError=0.)
Set efficiency and relative error for a single KLM strip using directly the stripId.
ClassDef(KLMStripEfficiency, 1)
Class version.
void setEndcapEfficiency(int section, int sector, int layer, int plane, int strip, float efficiency, float efficiencyError=0.)
Set efficiency and relative error for a single EKLM strip using the geometrical infos.
float getEndcapEfficiencyError(int section, int sector, int layer, int plane, int strip) const
Returns error on efficiency of a given EKLM strip using the geometrical infos.
float getEndcapEfficiency(int section, int sector, int layer, int plane, int strip) const
Returns efficiency of a given EKLM strip using the geometrical infos.
void setBarrelEfficiency(int section, int sector, int layer, int plane, int strip, float efficiency, float efficiencyError=0.)
Set efficiency and relative error for a single BKLM strip using the geometrical infos.
float getEfficiency(KLMChannelNumber stripId) const
Returns efficiency of a given KLM strip using directly the stripId.
KLMStripEfficiency()
Default constructor.
uint16_t KLMChannelNumber
Channel number.
Abstract base class for different kinds of events.