Belle II Software  release-08-01-10
PixelMasks.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 <vector>
11 
12 namespace Belle2 {
17  namespace TOP {
18 
22  class PixelMasks {
23 
24  public:
25 
30  explicit PixelMasks(int moduleID);
31 
37  void set(int pixelID, bool value);
38 
43  void setPixelOff(int pixelID) {set(pixelID, false);}
44 
49  int getModuleID() const {return m_moduleID;}
50 
55  unsigned getNumPixels() const {return m_masks.size();}
56 
62  bool isActive(int pixelID) const;
63 
68  const std::vector<bool>& getMasks() const {return m_masks;}
69 
70  private:
71 
72  int m_moduleID = 0;
73  std::vector<bool> m_masks;
75  };
76 
77  //--- inline functions ------------------------------------------------------------
78 
79  inline void PixelMasks::set(int pixelID, bool value)
80  {
81  unsigned k = pixelID - 1;
82  if (k < m_masks.size()) m_masks[k] = value;
83  }
84 
85  inline bool PixelMasks::isActive(int pixelID) const
86  {
87  unsigned k = pixelID - 1;
88  if (k < m_masks.size()) return m_masks[k];
89  return false;
90  }
91 
92  } // namespace TOP
94 } // namespace Belle2
95 
96 
Pixel masks of a single module.
Definition: PixelMasks.h:22
PixelMasks(int moduleID)
Constructor: all pixels are turned on (active)
Definition: PixelMasks.cc:20
void set(int pixelID, bool value)
Sets mask value for a given pixel.
Definition: PixelMasks.h:79
std::vector< bool > m_masks
pixel masks (true for active), index = pixelID -1
Definition: PixelMasks.h:73
int getModuleID() const
Returns slot ID.
Definition: PixelMasks.h:49
unsigned getNumPixels() const
Returns number of pixels.
Definition: PixelMasks.h:55
void setPixelOff(int pixelID)
Turns given pixel off.
Definition: PixelMasks.h:43
const std::vector< bool > & getMasks() const
Returns pixel masks of entire module.
Definition: PixelMasks.h:68
bool isActive(int pixelID) const
Checks if pixel is active.
Definition: PixelMasks.h:85
Abstract base class for different kinds of events.