Belle II Software  release-05-02-19
Pixel.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Martin Ritter *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #ifndef PXD_PIXEL_H
12 #define PXD_PIXEL_H
13 
14 #include <pxd/dataobjects/PXDRawHit.h>
15 #include <pxd/dataobjects/PXDDigit.h>
16 
17 namespace Belle2 {
23  namespace PXD {
39  class Pixel {
40  public:
42  explicit Pixel(unsigned int index = 0): m_index(index), m_u(0), m_v(0),
43  m_charge(0) {}
45  Pixel(const PXDDigit* digit, unsigned int index): m_index(index),
46  m_u(digit->getUCellID()), m_v(digit->getVCellID()),
47  m_charge(digit->getCharge()) {}
49  Pixel(const PXDRawHit* rawhit, unsigned int index): m_index(index),
50  m_u(rawhit->getColumn()), m_v(rawhit->getRow()),
51  m_charge(rawhit->getCharge()) {}
52 
54  Pixel(unsigned int index, unsigned short u, unsigned short v, float charge):
55  m_index(index), m_u(u), m_v(v), m_charge(charge) {}
56 
58  bool operator<(const Pixel& b) const { return m_v < b.m_v || (m_v == b.m_v && m_u < b.m_u); }
60  bool operator<=(const Pixel& b) const { return m_v < b.m_v || (m_v == b.m_v && m_u <= b.m_u); }
62  bool operator>(const Pixel& b) const { return b < *this; }
64  bool operator>=(const Pixel& b) const { return b <= *this; }
66  bool operator==(const Pixel& b) const { return m_v == b.m_v && m_u == b.m_u; }
67 
69  unsigned short getU() const { return m_u; }
71  unsigned short getV() const { return m_v; }
73  float getCharge() const { return m_charge; }
75  unsigned int getIndex() const { return m_index; }
77  void setCharge(float newCharge) { m_charge = newCharge; }
78 
79  private:
81  unsigned int m_index;
83  unsigned short m_u;
85  unsigned short m_v;
87  float m_charge;
88  };
89 
90  } // PXD namespace
92 } // Belle2 namespace
93 
94 #endif //PXD_PIXEL_H
Belle2::PXD::Pixel::operator==
bool operator==(const Pixel &b) const
Equality operator.
Definition: Pixel.h:74
Belle2::PXD::Pixel::getCharge
float getCharge() const
Return the Charge of the Pixel.
Definition: Pixel.h:81
Belle2::PXD::Pixel::m_charge
float m_charge
Charge of the pixel.
Definition: Pixel.h:95
Belle2::PXD::Pixel::Pixel
Pixel(unsigned int index=0)
Construct using only an index, used for testing.
Definition: Pixel.h:50
Belle2::PXD::Pixel::operator<
bool operator<(const Pixel &b) const
Comparison operator, sorting by row,column in ascending order.
Definition: Pixel.h:66
Belle2::PXD::Pixel
Class to represent one pixel, used in clustering for fast access.
Definition: Pixel.h:47
Belle2::PXD::Pixel::setCharge
void setCharge(float newCharge)
Adjust the charge of a pixel.
Definition: Pixel.h:85
Belle2::PXDRawHit
The PXD Raw Hit class This class stores information about PXD Pixel hits and makes them available in ...
Definition: PXDRawHit.h:36
Belle2::PXD::Pixel::m_index
unsigned int m_index
Index of the corresponding PXDDigit in the StoreArray.
Definition: Pixel.h:89
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::PXD::Pixel::operator<=
bool operator<=(const Pixel &b) const
Comparison operator, sorting by row,column in ascending order.
Definition: Pixel.h:68
Belle2::PXD::Pixel::getIndex
unsigned int getIndex() const
Return the Index of the digit.
Definition: Pixel.h:83
Belle2::PXD::Pixel::operator>=
bool operator>=(const Pixel &b) const
Comparison operator, sorting by row,column in ascending order.
Definition: Pixel.h:72
Belle2::PXD::Pixel::getV
unsigned short getV() const
Return the CellID in v.
Definition: Pixel.h:79
Belle2::PXD::Pixel::operator>
bool operator>(const Pixel &b) const
Comparison operator, sorting by row,column in ascending order.
Definition: Pixel.h:70
Belle2::PXD::Pixel::getU
unsigned short getU() const
Return the CellID in u.
Definition: Pixel.h:77
Belle2::PXD::Pixel::m_u
unsigned short m_u
Cell ID in u.
Definition: Pixel.h:91
Belle2::PXD::Pixel::m_v
unsigned short m_v
Cell ID in v.
Definition: Pixel.h:93