FairRoot/PandaRoot
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
PndMvdTopixClusterFinder Class Reference

#include <PndMvdTopixClusterFinder.h>

Public Member Functions

 PndMvdTopixClusterFinder ()
 
 PndMvdTopixClusterFinder (int maxrows, int maxcols, double radius)
 
virtual ~PndMvdTopixClusterFinder ()
 
std::vector< std::vector< Int_t > > GetClusters (std::vector< PndSdsDigiTopix4 > &hits)
 
virtual void SetMaxCols (Int_t col)
 
virtual void SetMaxRows (Int_t row)
 
virtual void SetRadius (Double_t rad)
 

Protected Attributes

Int_t fcols
 
Int_t frows
 
Double_t fradius
 

Private Member Functions

Int_t MoveHit (std::vector< Int_t > *hitVector, Int_t index) const
 
bool IsInRange (PndSdsDigiPixel *hit1, PndSdsDigiPixel *hit2) const
 

Detailed Description

PndMvdTopixClusterFinder.h Simple cluster finder for pixel detectors.

It takes the first hit in the DigiArray and moves it into a new cluster. Then it looks through the remaining hits in the DigiArray if there are hits which are in the area around the first hit and moves them into the cluster. The radius is given by the first parameter. Then it takes the new hits in the cluster and looks if there are other hits which are in the range of these hits and moves them into the cluster, too. This process is repeated until no hits around the cluster are found The the first hit of the remaining DigiHits is taken to create a new hit and the cluster search process is started again.

params: Number of columns in a front-end Number of rows in a front-end Range as Int_t at which a pixel belongs to a cluster or not params are taken from parameter database

Definition at line 24 of file PndMvdTopixClusterFinder.h.

Constructor & Destructor Documentation

PndMvdTopixClusterFinder::PndMvdTopixClusterFinder ( )
inline
PndMvdTopixClusterFinder::PndMvdTopixClusterFinder ( int  maxrows,
int  maxcols,
double  radius 
)
inline
virtual PndMvdTopixClusterFinder::~PndMvdTopixClusterFinder ( )
inlinevirtual

Definition at line 29 of file PndMvdTopixClusterFinder.h.

29 {};

Member Function Documentation

std::vector< std::vector< Int_t > > PndMvdTopixClusterFinder::GetClusters ( std::vector< PndSdsDigiTopix4 > &  hits)

Main method which searches for the clusters. It returns a matrix of ints where a column corresponds to a cluster and an integer to a hit in the DigiArray

Definition at line 9 of file PndMvdTopixClusterFinder.cxx.

References i, IsInRange(), MoveHit(), and push_back().

Referenced by PndMQTopix4DigiToHit::Run().

9  {
10 // fHits = hits;
11 
12 // LOG(INFO) << "HitsIn Cluster Finder!" << std::endl;
13  std::vector<Int_t> posHits;
14  for (UInt_t i = 0; i < hits.size(); i++){
15 // LOG(INFO) << i << " : " << hits[i];
16 // LOG(INFO) << i << " : " << hits[i].GetTimeStamp();
17  posHits.push_back(i);
18  }
19  std::vector<std::vector<Int_t> > result;
20  Int_t sizeTempHits = posHits.size();
21  //Int_t actHit = 0;
22  while (sizeTempHits != 0) {
23  std::vector<Int_t> tempInt;
24  tempInt.push_back(MoveHit(&posHits, 0));
25  result.push_back(tempInt);
26  Int_t sizeResultI = (result.end() - 1)->size(); // size of last vector in array
27  for (Int_t i = 0; i < sizeResultI; i++) {
28  sizeTempHits = posHits.size();
29  for (Int_t j = 0; j < sizeTempHits; j++) {
30  if (hits[(*(result.end() - 1))[i]].GetSensorID() == hits[posHits[j]].GetSensorID()) {
31  if (IsInRange(&hits[(*(result.end() - 1))[i]], &hits[posHits[j]])) {
32  (result.end() - 1)->push_back(MoveHit(&posHits, j));
33  j--;
34  }
35  }
36  sizeTempHits = posHits.size();
37  }
38  sizeResultI = (result.end() - 1)->size();
39  }
40  }
41  return result;
42 }
Int_t i
Definition: run_full.C:25
labels push_back("electron")
Int_t MoveHit(std::vector< Int_t > *hitVector, Int_t index) const
bool IsInRange(PndSdsDigiPixel *hit1, PndSdsDigiPixel *hit2) const
CbmHit * hits[nHits]
Definition: RiemannTest.C:19
bool PndMvdTopixClusterFinder::IsInRange ( PndSdsDigiPixel hit1,
PndSdsDigiPixel hit2 
) const
private

Definition at line 54 of file PndMvdTopixClusterFinder.cxx.

References Double_t, fcols, fradius, frows, PndSdsDigi::GetFE(), PndSdsDigiPixel::GetPixelColumn(), PndSdsDigiPixel::GetPixelRow(), and CAMath::Sqrt().

Referenced by GetClusters().

55 {
56  Double_t result1, result2;
57  Int_t col1 = hit1->GetPixelColumn() + (Int_t)((hit1->GetFE()%10) * fcols);
58  Int_t col2 = hit2->GetPixelColumn() + (Int_t)((hit2->GetFE()%10) * fcols);
59  Int_t row1 = hit1->GetPixelRow() + (Int_t)((hit1->GetFE()/10) * frows);
60  Int_t row2 = hit2->GetPixelRow() + (Int_t)((hit2->GetFE()/10) * frows);
61 
62  result1 = (col1-col2);
63  result1 *= result1;
64  result2 = (row1-row2);
65  result2 *= result2;
66  result1 += result2;
67 
68  return (TMath::Sqrt(result1) < fradius);
69 }
Int_t GetPixelRow() const
static T Sqrt(const T &x)
Definition: PndCAMath.h:37
Int_t GetPixelColumn() const
Int_t GetFE() const
Definition: PndSdsDigi.h:57
Double_t
Int_t PndMvdTopixClusterFinder::MoveHit ( std::vector< Int_t > *  hitVector,
Int_t  index 
) const
private

Definition at line 44 of file PndMvdTopixClusterFinder.cxx.

Referenced by GetClusters().

45 {
46  Int_t result = -1;
47  if (index < (Int_t)hitVector->size()){
48  result = (*hitVector)[index];
49  hitVector->erase(hitVector->begin()+index);
50  }
51  return result;
52 }
virtual void PndMvdTopixClusterFinder::SetMaxCols ( Int_t  col)
inlinevirtual

Definition at line 35 of file PndMvdTopixClusterFinder.h.

References col, and fcols.

35 { fcols = col; }
int col
Definition: anaLmdDigi.C:67
virtual void PndMvdTopixClusterFinder::SetMaxRows ( Int_t  row)
inlinevirtual

Definition at line 36 of file PndMvdTopixClusterFinder.h.

References frows, and row.

36 { frows = row; }
int row
Definition: anaLmdDigi.C:67
virtual void PndMvdTopixClusterFinder::SetRadius ( Double_t  rad)
inlinevirtual

Definition at line 37 of file PndMvdTopixClusterFinder.h.

References fradius.

37 { fradius = rad; }

Member Data Documentation

Int_t PndMvdTopixClusterFinder::fcols
protected

Definition at line 40 of file PndMvdTopixClusterFinder.h.

Referenced by IsInRange(), and SetMaxCols().

Double_t PndMvdTopixClusterFinder::fradius
protected

Definition at line 42 of file PndMvdTopixClusterFinder.h.

Referenced by IsInRange(), and SetRadius().

Int_t PndMvdTopixClusterFinder::frows
protected

Definition at line 41 of file PndMvdTopixClusterFinder.h.

Referenced by IsInRange(), and SetMaxRows().


The documentation for this class was generated from the following files: