FairRoot/PandaRoot
Public Member Functions | Public Attributes | List of all members
pixelCluster Struct Reference

#include <PndLmdAlignStructs.h>

Public Member Functions

 pixelCluster ()
 
 pixelCluster (const pixelHit &hit)
 
 pixelCluster (const pixelCluster &copy)
 
bool isNeighbour (pixelCluster &other)
 
void merge (pixelCluster &other)
 
void calculateCenter ()
 
void printPixels ()
 
void printCenter ()
 

Public Attributes

int _sensorId
 
double centerCol
 
double centerRow
 
double clusterSize
 
vector< pixelHitpixelHits
 
bool clusterReady
 

Detailed Description

Definition at line 55 of file PndLmdAlignStructs.h.

Constructor & Destructor Documentation

pixelCluster::pixelCluster ( )
inline

Definition at line 62 of file PndLmdAlignStructs.h.

62  {
63  _sensorId = -1;
64  centerCol = -1;
65  centerRow = -1; //centerZ=-1;
66  clusterSize = -1;
67  clusterReady = false;
68  }
pixelCluster::pixelCluster ( const pixelHit hit)
inline

Definition at line 70 of file PndLmdAlignStructs.h.

References pixelHit::_sensorId.

70  {
71  _sensorId = hit._sensorId;
72  pixelHits.push_back(hit);
73 
74  centerCol = -1;
75  centerRow = -1; //centerZ=-1;
76  clusterSize = -1;
77  clusterReady = false;
78  }
vector< pixelHit > pixelHits
pixelCluster::pixelCluster ( const pixelCluster copy)
inline

Definition at line 80 of file PndLmdAlignStructs.h.

References _sensorId, i, and pixelHits.

80  {
81  _sensorId = copy._sensorId;
82  for (size_t i = 0; i < copy.pixelHits.size(); i++) {
83  pixelHits.push_back(copy.pixelHits[i]);
84  }
85 
86  centerCol = -1;
87  centerRow = -1; //centerZ=-1;
88  clusterSize = -1;
89  clusterReady = false;
90  }
Int_t i
Definition: run_full.C:25
vector< pixelHit > pixelHits

Member Function Documentation

void pixelCluster::calculateCenter ( )
inline

Definition at line 123 of file PndLmdAlignStructs.h.

References i, max(), and sqrt().

123  {
124  centerCol = 0;
125  centerRow = 0;
126  for (size_t i = 0; i < pixelHits.size(); i++) {
127  centerCol += pixelHits[i]._col;
128  centerRow += pixelHits[i]._row;
129  }
130  centerCol /= pixelHits.size();
131  centerRow /= pixelHits.size();
132  double tempDistance;
133  //calculate size, go from corner to corner for clusters larger than 2 pixels
134  if (pixelHits.size() == 1) {
135  clusterSize = 1;
136  }
137  else {
138  for (size_t i = 0; i < pixelHits.size(); i++) {
139  for (size_t j = i + 1; j < pixelHits.size(); j++) {
140  double deltax = (pixelHits[i]._col - pixelHits[j]._col);
141  if (deltax > 0) {
142  deltax = deltax + 1;
143  }
144  if (deltax < 0) {
145  deltax = deltax - 1;
146  }
147  double deltay = (pixelHits[i]._row - pixelHits[j]._row);
148  if (deltay > 0) {
149  deltay = deltay + 1;
150  }
151  if (deltay < 0) {
152  deltay = deltay - 1;
153  }
154  tempDistance = sqrt(deltax * deltax + deltay * deltay);
155  clusterSize = max(clusterSize, tempDistance);
156  }
157  }
158  }
159  clusterReady = true;
160  }
Int_t i
Definition: run_full.C:25
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition: P4_F32vec4.h:26
vector< pixelHit > pixelHits
bool pixelCluster::isNeighbour ( pixelCluster other)
inline

Definition at line 95 of file PndLmdAlignStructs.h.

References _sensorId, i, and pixelHits.

95  {
96  //first, they must be on same sensor
97  if (_sensorId != other._sensorId) {
98  return false;
99  }
100  double _col1, _col2, _row1, _row2;
101  for (size_t i = 0; i < this->pixelHits.size(); i++) {
102  _col1 = this->pixelHits[i]._col;
103  _row1 = this->pixelHits[i]._row;
104  for (size_t j = 0; j < other.pixelHits.size(); j++) {
105  _col2 = other.pixelHits[j]._col;
106  _row2 = other.pixelHits[j]._row;
107  //check if neighboring, that means distance of pixels is smaller than 1.5 pixels
108  if ((_col2 - _col1) * (_col2 - _col1) + (_row2 - _row1) * (_row2 - _row1) < 2.25) {
109  return true;
110  }
111  }
112  }
113  return false;
114  }
Int_t i
Definition: run_full.C:25
vector< pixelHit > pixelHits
void pixelCluster::merge ( pixelCluster other)
inline

Definition at line 117 of file PndLmdAlignStructs.h.

References i, and pixelHits.

117  {
118  for (size_t i = 0; i < other.pixelHits.size(); i++) {
119  pixelHits.push_back(other.pixelHits[i]);
120  }
121  }
Int_t i
Definition: run_full.C:25
vector< pixelHit > pixelHits
void pixelCluster::printCenter ( )
inline

Definition at line 168 of file PndLmdAlignStructs.h.

168  {
169  cout << "clusterCenter x:" << centerCol << ", y:" << centerRow << " on sensor " << _sensorId
170  << ", contains " << pixelHits.size() << " pixels and is " << clusterSize
171  << " pixels in diameter." << "\n";
172  }
vector< pixelHit > pixelHits
void pixelCluster::printPixels ( )
inline

Definition at line 162 of file PndLmdAlignStructs.h.

References i.

162  {
163  for (size_t i = 0; i < pixelHits.size(); i++) {
164  cout << "pixelHit x:" << pixelHits[i]._col << ", y:" << pixelHits[i]._row << " on sensor "
165  << pixelHits[i]._sensorId << "\n";
166  }
167  }
Int_t i
Definition: run_full.C:25
vector< pixelHit > pixelHits

Member Data Documentation

int pixelCluster::_sensorId

Definition at line 56 of file PndLmdAlignStructs.h.

Referenced by isNeighbour(), and pixelCluster().

double pixelCluster::centerCol

Definition at line 57 of file PndLmdAlignStructs.h.

double pixelCluster::centerRow

Definition at line 57 of file PndLmdAlignStructs.h.

bool pixelCluster::clusterReady

Definition at line 60 of file PndLmdAlignStructs.h.

double pixelCluster::clusterSize

Definition at line 58 of file PndLmdAlignStructs.h.

vector<pixelHit> pixelCluster::pixelHits

Definition at line 59 of file PndLmdAlignStructs.h.

Referenced by isNeighbour(), merge(), and pixelCluster().


The documentation for this struct was generated from the following file: