Belle II Software development
Pixel.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 <pxd/dataobjects/PXDRawHit.h>
12#include <pxd/dataobjects/PXDDigit.h>
13
14namespace Belle2 {
20 namespace PXD {
36 class Pixel {
37 public:
39 explicit Pixel(unsigned int index = 0):
40 m_charge(0), m_index(index), m_u(0), m_v(0) {}
42 Pixel(const PXDDigit* digit, unsigned int index):
43 m_charge(digit->getCharge()), m_index(index),
44 m_u(digit->getUCellID()), m_v(digit->getVCellID())
45 {}
47 Pixel(const PXDRawHit* rawhit, unsigned int index):
48 m_charge(rawhit->getCharge()), m_index(index),
49 m_u(rawhit->getColumn()), m_v(rawhit->getRow())
50 {}
51
53 Pixel(unsigned int index, unsigned short u, unsigned short v, float charge):
54 m_charge(charge), m_index(index), m_u(u), m_v(v) {}
55
57 bool operator<(const Pixel& b) const { return m_v < b.m_v || (m_v == b.m_v && m_u < b.m_u); }
59 bool operator<=(const Pixel& b) const { return m_v < b.m_v || (m_v == b.m_v && m_u <= b.m_u); }
61 bool operator>(const Pixel& b) const { return b < *this; }
63 bool operator>=(const Pixel& b) const { return b <= *this; }
65 bool operator==(const Pixel& b) const { return m_v == b.m_v && m_u == b.m_u; }
66
68 unsigned short getU() const { return m_u; }
70 unsigned short getV() const { return m_v; }
72 float getCharge() const { return m_charge; }
74 unsigned int getIndex() const { return m_index; }
76 void setCharge(float newCharge) { m_charge = newCharge; }
77
78 private:
80 float m_charge;
82 unsigned int m_index;
84 unsigned short m_u;
86 unsigned short m_v;
87 };
88
89 } // PXD namespace
91} // Belle2 namespace
The PXD digit class.
Definition: PXDDigit.h:27
The PXD Raw Hit class This class stores information about PXD Pixel hits and makes them available in ...
Definition: PXDRawHit.h:24
Class to represent one pixel, used in clustering for fast access.
Definition: Pixel.h:36
bool operator>(const Pixel &b) const
Comparison operator, sorting by row,column in ascending order.
Definition: Pixel.h:61
Pixel(unsigned int index, unsigned short u, unsigned short v, float charge)
Construct using an index, coordinates and charge.
Definition: Pixel.h:53
unsigned short getU() const
Return the CellID in u.
Definition: Pixel.h:68
unsigned int m_index
Index of the corresponding PXDDigit in the StoreArray.
Definition: Pixel.h:82
Pixel(const PXDDigit *digit, unsigned int index)
Construct from a given PXDDigit and its store index.
Definition: Pixel.h:42
unsigned int getIndex() const
Return the Index of the digit.
Definition: Pixel.h:74
bool operator<(const Pixel &b) const
Comparison operator, sorting by row,column in ascending order.
Definition: Pixel.h:57
float m_charge
Charge of the pixel.
Definition: Pixel.h:80
unsigned short m_u
Cell ID in u.
Definition: Pixel.h:84
float getCharge() const
Return the Charge of the Pixel.
Definition: Pixel.h:72
bool operator==(const Pixel &b) const
Equality operator.
Definition: Pixel.h:65
unsigned short m_v
Cell ID in v.
Definition: Pixel.h:86
bool operator<=(const Pixel &b) const
Comparison operator, sorting by row,column in ascending order.
Definition: Pixel.h:59
Pixel(unsigned int index=0)
Construct using only an index, used for testing.
Definition: Pixel.h:39
unsigned short getV() const
Return the CellID in v.
Definition: Pixel.h:70
void setCharge(float newCharge)
Adjust the charge of a pixel.
Definition: Pixel.h:76
bool operator>=(const Pixel &b) const
Comparison operator, sorting by row,column in ascending order.
Definition: Pixel.h:63
Pixel(const PXDRawHit *rawhit, unsigned int index)
Construct from a given PXDRawHit and its store index.
Definition: Pixel.h:47
Abstract base class for different kinds of events.