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

#include <PndSdsSimplePixelClusterFinder.h>

Inheritance diagram for PndSdsSimplePixelClusterFinder:
PndSdsPixelClusterFinder PndLmdSimplePixelClusterFinder PndMvdSimplePixelClusterFinder

Public Member Functions

 PndSdsSimplePixelClusterFinder ()
 
virtual ~PndSdsSimplePixelClusterFinder ()
 
std::vector< std::vector< Int_t > > GetClusters (std::vector< PndSdsDigiPixel > hits)
 
virtual void SetMaxCols (Int_t col)
 
virtual void SetMaxRows (Int_t row)
 
virtual void SetRadius (Double_t rad)
 
void Print ()
 
void Print (std::vector< PndSdsDigiPixel > hits)
 
void PrintResult (std::vector< std::vector< Int_t > > clusters)
 
void SetVerbose (Int_t level)
 
 ClassDef (PndSdsPixelClusterFinder, 2)
 

Public Attributes

std::vector< PndSdsDigiPixelfHits
 
Int_t fVerbose
 
PndSdsChargeConversionfChargeConverter
 

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

PndSdsSimplePixelClusterFinder.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 21 of file PndSdsSimplePixelClusterFinder.h.

Constructor & Destructor Documentation

PndSdsSimplePixelClusterFinder::PndSdsSimplePixelClusterFinder ( )
inline
virtual PndSdsSimplePixelClusterFinder::~PndSdsSimplePixelClusterFinder ( )
inlinevirtual

Definition at line 29 of file PndSdsSimplePixelClusterFinder.h.

29 {};

Member Function Documentation

PndSdsPixelClusterFinder::ClassDef ( PndSdsPixelClusterFinder  ,
 
)
inherited
std::vector< std::vector< Int_t > > PndSdsSimplePixelClusterFinder::GetClusters ( std::vector< PndSdsDigiPixel hits)
virtual

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

Implements PndSdsPixelClusterFinder.

Definition at line 6 of file PndSdsSimplePixelClusterFinder.cxx.

References PndSdsChargeConversion::DigiValueToCharge(), PndSdsPixelClusterFinder::fChargeConverter, PndSdsPixelClusterFinder::fHits, PndSdsPixelClusterFinder::fVerbose, hits, i, IsInRange(), MoveHit(), PndSdsPixelClusterFinder::PrintResult(), and push_back().

7 {
8  fHits = hits;
9 // if (fVerbose > 1) Print();
10  std::vector<Int_t> posHits;
11  for (UInt_t i = 0; i < fHits.size(); i++) posHits.push_back(i);
12  std::vector< std::vector< Int_t> > result;
13  Int_t sizeTempHits = posHits.size();
14  //Int_t actHit = 0;
15  while (sizeTempHits != 0){
16  std::vector<Int_t> tempInt;
17  if (fChargeConverter->DigiValueToCharge(fHits[posHits[0]]) == 0){
18  MoveHit(&posHits,0);
19  sizeTempHits = posHits.size();
20  }
21  else {
22  tempInt.push_back(MoveHit(&posHits,0));
23  result.push_back(tempInt);
24  Int_t sizeResultI = (result.end()-1)->size(); // size of last vector in array
25  for (Int_t i = 0; i < sizeResultI; i++){
26  sizeTempHits = posHits.size();
27  for (Int_t j = 0; j < sizeTempHits; j++){
28  if (fChargeConverter->DigiValueToCharge(fHits[posHits[j]]) == 0){
29  MoveHit(&posHits,j);
30  if (fVerbose > 1)
31  std::cout << "Charge too low!" << std::endl;
32  j--;
33  }
34  else{
35  if (fHits[(*(result.end()-1))[i]].GetSensorID() == fHits[posHits[j]].GetSensorID()){
36  if (IsInRange(fHits[(*(result.end()-1))[i]], fHits[posHits[j]])) {
37  (result.end()-1)->push_back(MoveHit(&posHits,j));
38  j--;
39  if (fVerbose > 1)
40  std::cout << "Hit added to cluster: " << result.size()-1 << std::endl;
41  }
42  }
43 
44  }
45  sizeTempHits = posHits.size();
46  }
47  sizeResultI = (result.end()-1)->size();
48  }
49  }
50  }
51  if (fVerbose > 1) PrintResult(result);
52  return result;
53 }
void PrintResult(std::vector< std::vector< Int_t > > clusters)
Int_t i
Definition: run_full.C:25
labels push_back("electron")
bool IsInRange(PndSdsDigiPixel hit1, PndSdsDigiPixel hit2) const
virtual Double_t DigiValueToCharge(Double_t digi)=0
Converts a given digitized charge into charge in electrons.
PndSdsChargeConversion * fChargeConverter
std::vector< PndSdsDigiPixel > fHits
Int_t MoveHit(std::vector< Int_t > *hitVector, Int_t index) const
CbmHit * hits[nHits]
Definition: RiemannTest.C:19
bool PndSdsSimplePixelClusterFinder::IsInRange ( PndSdsDigiPixel  hit1,
PndSdsDigiPixel  hit2 
) const
private

Definition at line 65 of file PndSdsSimplePixelClusterFinder.cxx.

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

Referenced by GetClusters().

66 {
67  Double_t result1, result2;
68  Int_t col1 = hit1.GetPixelColumn() + (Int_t)((hit1.GetFE()%10) * fcols);
69  Int_t col2 = hit2.GetPixelColumn() + (Int_t)((hit2.GetFE()%10) * fcols);
70  Int_t row1 = hit1.GetPixelRow() + (Int_t)((hit1.GetFE()/10) * frows);
71  Int_t row2 = hit2.GetPixelRow() + (Int_t)((hit2.GetFE()/10) * frows);
72  if (fVerbose > 2){
73  std::cout <<" -I- PndSdsSimplePixelClusterFinder::IsInRange():"<<std::endl;
74  std::cout << "Hit1: ";
75  hit1.Print();
76  std::cout << "Hit2: ";
77  hit2.Print();
78  std::cout << "col1: " << col1 << " col2: " << col2 << " row1: " << row1 << " row2: " << row2 << std::endl;
79  std::cout << "col1 - col2: " << (col1-col2) << " row1 - row2 " << (row1-row2) << std::endl;
80  }
81  result1 = (col1-col2);
82  result1 *= result1;
83  result2 = (row1-row2);
84  result2 *= result2;
85  result1 += result2;
86  if (fVerbose > 2)
87  std::cout << "IsInRange result: " << TMath::Sqrt(result1) << " Radius " << fradius << std::endl;
88  return (TMath::Sqrt(result1) < fradius);
89 }
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 PndSdsSimplePixelClusterFinder::MoveHit ( std::vector< Int_t > *  hitVector,
Int_t  index 
) const
private

Definition at line 55 of file PndSdsSimplePixelClusterFinder.cxx.

Referenced by GetClusters().

56 {
57  Int_t result = -1;
58  if (index < (Int_t)hitVector->size()){
59  result = (*hitVector)[index];
60  hitVector->erase(hitVector->begin()+index);
61  }
62  return result;
63 }
void PndSdsPixelClusterFinder::Print ( )
inherited
void PndSdsPixelClusterFinder::Print ( std::vector< PndSdsDigiPixel hits)
inherited

Definition at line 12 of file PndSdsPixelClusterFinder.cxx.

References i.

13 {
14  std::cout << "--------------" << std::endl;
15  for (UInt_t i = 0; i < hits.size(); i++){
16  std::cout << hits[i] << std::endl;
17  }
18 }
Int_t i
Definition: run_full.C:25
CbmHit * hits[nHits]
Definition: RiemannTest.C:19
void PndSdsPixelClusterFinder::PrintResult ( std::vector< std::vector< Int_t > >  clusters)
inherited

Definition at line 25 of file PndSdsPixelClusterFinder.cxx.

References PndSdsPixelClusterFinder::fHits, i, and PndSdsPixelClusterFinder::Print().

Referenced by PndSdsIdealPixelClusterFinder::GetClusters(), and GetClusters().

26 {
27  for (UInt_t i = 0; i < clusters.size(); i++){
28  std::cout << "PndSdsPixelClusterFinder::PrintResult(): Cluster " << i << ": " << std::endl;
29  for (UInt_t j = 0; j < clusters[i].size();j++)
30  fHits[clusters[i][j]].Print();
31  }
32 }
Int_t i
Definition: run_full.C:25
std::vector< PndSdsDigiPixel > fHits
virtual void PndSdsSimplePixelClusterFinder::SetMaxCols ( Int_t  col)
inlinevirtual

Definition at line 35 of file PndSdsSimplePixelClusterFinder.h.

References col, and fcols.

virtual void PndSdsSimplePixelClusterFinder::SetMaxRows ( Int_t  row)
inlinevirtual

Definition at line 36 of file PndSdsSimplePixelClusterFinder.h.

References frows, and row.

virtual void PndSdsSimplePixelClusterFinder::SetRadius ( Double_t  rad)
inlinevirtual

Definition at line 37 of file PndSdsSimplePixelClusterFinder.h.

References fradius.

void PndSdsPixelClusterFinder::SetVerbose ( Int_t  level)
inlineinherited

Member Data Documentation

PndSdsChargeConversion* PndSdsPixelClusterFinder::fChargeConverter
inherited
Int_t PndSdsSimplePixelClusterFinder::fcols
protected
std::vector<PndSdsDigiPixel> PndSdsPixelClusterFinder::fHits
inherited
Double_t PndSdsSimplePixelClusterFinder::fradius
protected
Int_t PndSdsSimplePixelClusterFinder::frows
protected
Int_t PndSdsPixelClusterFinder::fVerbose
inherited

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