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): m_index(index), m_u(0), m_v(0),
40 m_charge(0) {}
42 Pixel(const PXDDigit* digit, unsigned int index): m_index(index),
43 m_u(digit->getUCellID()), m_v(digit->getVCellID()),
44 m_charge(digit->getCharge()) {}
46 Pixel(const PXDRawHit* rawhit, unsigned int index): m_index(index),
47 m_u(rawhit->getColumn()), m_v(rawhit->getRow()),
48 m_charge(rawhit->getCharge()) {}
49
51 Pixel(unsigned int index, unsigned short u, unsigned short v, float charge):
52 m_index(index), m_u(u), m_v(v), m_charge(charge) {}
53
55 bool operator<(const Pixel& b) const { return m_v < b.m_v || (m_v == b.m_v && m_u < b.m_u); }
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 b < *this; }
61 bool operator>=(const Pixel& b) const { return b <= *this; }
63 bool operator==(const Pixel& b) const { return m_v == b.m_v && m_u == b.m_u; }
64
66 unsigned short getU() const { return m_u; }
68 unsigned short getV() const { return m_v; }
70 float getCharge() const { return m_charge; }
72 unsigned int getIndex() const { return m_index; }
74 void setCharge(float newCharge) { m_charge = newCharge; }
75
76 private:
78 unsigned int m_index;
80 unsigned short m_u;
82 unsigned short m_v;
84 float m_charge;
85 };
86
87 } // PXD namespace
89} // 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:59
Pixel(unsigned int index, unsigned short u, unsigned short v, float charge)
Construct using an index, coordinates and charge.
Definition: Pixel.h:51
unsigned short getU() const
Return the CellID in u.
Definition: Pixel.h:66
unsigned int m_index
Index of the corresponding PXDDigit in the StoreArray.
Definition: Pixel.h:78
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:72
bool operator<(const Pixel &b) const
Comparison operator, sorting by row,column in ascending order.
Definition: Pixel.h:55
float m_charge
Charge of the pixel.
Definition: Pixel.h:84
unsigned short m_u
Cell ID in u.
Definition: Pixel.h:80
float getCharge() const
Return the Charge of the Pixel.
Definition: Pixel.h:70
bool operator==(const Pixel &b) const
Equality operator.
Definition: Pixel.h:63
unsigned short m_v
Cell ID in v.
Definition: Pixel.h:82
bool operator<=(const Pixel &b) const
Comparison operator, sorting by row,column in ascending order.
Definition: Pixel.h:57
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:68
void setCharge(float newCharge)
Adjust the charge of a pixel.
Definition: Pixel.h:74
bool operator>=(const Pixel &b) const
Comparison operator, sorting by row,column in ascending order.
Definition: Pixel.h:61
Pixel(const PXDRawHit *rawhit, unsigned int index)
Construct from a given PXDRawHit and its store index.
Definition: Pixel.h:46
Abstract base class for different kinds of events.