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 139 of file PndLmdAlignStructs.h.

Constructor & Destructor Documentation

pixelCluster::pixelCluster ( )
inline

Definition at line 146 of file PndLmdAlignStructs.h.

References _sensorId, centerCol, centerRow, clusterReady, and clusterSize.

146  {
147  _sensorId = -1;
148  centerCol = -1;
149  centerRow = -1; //centerZ=-1;
150  clusterSize = -1;
151  clusterReady = false;
152  }
pixelCluster::pixelCluster ( const pixelHit hit)
inline

Definition at line 154 of file PndLmdAlignStructs.h.

References pixelHit::_sensorId, _sensorId, centerCol, centerRow, clusterReady, clusterSize, and pixelHits.

154  {
155  _sensorId = hit._sensorId;
156  pixelHits.push_back(hit);
157 
158  centerCol = -1;
159  centerRow = -1; //centerZ=-1;
160  clusterSize = -1;
161  clusterReady = false;
162  }
vector< pixelHit > pixelHits
pixelCluster::pixelCluster ( const pixelCluster copy)
inline

Definition at line 164 of file PndLmdAlignStructs.h.

References _sensorId, centerCol, centerRow, clusterReady, clusterSize, i, and pixelHits.

164  {
165  _sensorId = copy._sensorId;
166  for (size_t i = 0; i < copy.pixelHits.size(); i++) {
167  pixelHits.push_back(copy.pixelHits[i]);
168  }
169 
170  centerCol = -1;
171  centerRow = -1; //centerZ=-1;
172  clusterSize = -1;
173  clusterReady = false;
174  }
Int_t i
Definition: run_full.C:25
vector< pixelHit > pixelHits

Member Function Documentation

void pixelCluster::calculateCenter ( )
inline

Definition at line 207 of file PndLmdAlignStructs.h.

References centerCol, centerRow, clusterReady, clusterSize, i, max(), pixelHits, and sqrt().

207  {
208  centerCol = 0;
209  centerRow = 0;
210  for (size_t i = 0; i < pixelHits.size(); i++) {
211  centerCol += pixelHits[i]._col;
212  centerRow += pixelHits[i]._row;
213  }
214  centerCol /= pixelHits.size();
215  centerRow /= pixelHits.size();
216  double tempDistance;
217  //calculate size, go from corner to corner for clusters larger than 2 pixels
218  if (pixelHits.size() == 1) {
219  clusterSize = 1;
220  }
221  else {
222  for (size_t i = 0; i < pixelHits.size(); i++) {
223  for (size_t j = i + 1; j < pixelHits.size(); j++) {
224  double deltax = (pixelHits[i]._col - pixelHits[j]._col);
225  if (deltax > 0) {
226  deltax = deltax + 1;
227  }
228  if (deltax < 0) {
229  deltax = deltax - 1;
230  }
231  double deltay = (pixelHits[i]._row - pixelHits[j]._row);
232  if (deltay > 0) {
233  deltay = deltay + 1;
234  }
235  if (deltay < 0) {
236  deltay = deltay - 1;
237  }
238  tempDistance = sqrt(deltax * deltax + deltay * deltay);
239  clusterSize = max(clusterSize, tempDistance);
240  }
241  }
242  }
243  clusterReady = true;
244  }
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 179 of file PndLmdAlignStructs.h.

References _sensorId, i, and pixelHits.

179  {
180  //first, they must be on same sensor
181  if (_sensorId != other._sensorId) {
182  return false;
183  }
184  double _col1, _col2, _row1, _row2;
185  for (size_t i = 0; i < this->pixelHits.size(); i++) {
186  _col1 = this->pixelHits[i]._col;
187  _row1 = this->pixelHits[i]._row;
188  for (size_t j = 0; j < other.pixelHits.size(); j++) {
189  _col2 = other.pixelHits[j]._col;
190  _row2 = other.pixelHits[j]._row;
191  //check if neighboring, that means distance of pixels is smaller than 1.5 pixels
192  if ((_col2 - _col1) * (_col2 - _col1) + (_row2 - _row1) * (_row2 - _row1) < 2.25) {
193  return true;
194  }
195  }
196  }
197  return false;
198  }
Int_t i
Definition: run_full.C:25
vector< pixelHit > pixelHits
void pixelCluster::merge ( pixelCluster other)
inline

Definition at line 201 of file PndLmdAlignStructs.h.

References i, and pixelHits.

201  {
202  for (size_t i = 0; i < other.pixelHits.size(); i++) {
203  pixelHits.push_back(other.pixelHits[i]);
204  }
205  }
Int_t i
Definition: run_full.C:25
vector< pixelHit > pixelHits
void pixelCluster::printCenter ( )
inline

Definition at line 252 of file PndLmdAlignStructs.h.

References _sensorId, centerCol, centerRow, clusterSize, and pixelHits.

252  {
253  cout << "clusterCenter x:" << centerCol << ", y:" << centerRow << " on sensor " << _sensorId
254  << ", contains " << pixelHits.size() << " pixels and is " << clusterSize
255  << " pixels in diameter." << "\n";
256  }
vector< pixelHit > pixelHits
void pixelCluster::printPixels ( )
inline

Definition at line 246 of file PndLmdAlignStructs.h.

References i, and pixelHits.

246  {
247  for (size_t i = 0; i < pixelHits.size(); i++) {
248  cout << "pixelHit x:" << pixelHits[i]._col << ", y:" << pixelHits[i]._row << " on sensor "
249  << pixelHits[i]._sensorId << "\n";
250  }
251  }
Int_t i
Definition: run_full.C:25
vector< pixelHit > pixelHits

Member Data Documentation

int pixelCluster::_sensorId

Definition at line 140 of file PndLmdAlignStructs.h.

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

double pixelCluster::centerCol

Definition at line 141 of file PndLmdAlignStructs.h.

Referenced by calculateCenter(), pixelCluster(), and printCenter().

double pixelCluster::centerRow

Definition at line 141 of file PndLmdAlignStructs.h.

Referenced by calculateCenter(), pixelCluster(), and printCenter().

bool pixelCluster::clusterReady

Definition at line 144 of file PndLmdAlignStructs.h.

Referenced by calculateCenter(), and pixelCluster().

double pixelCluster::clusterSize

Definition at line 142 of file PndLmdAlignStructs.h.

Referenced by calculateCenter(), pixelCluster(), and printCenter().

vector<pixelHit> pixelCluster::pixelHits

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