FairRoot/PandaRoot
Public Member Functions | Public Attributes | List of all members
PndSdsIdealPixelClusterFinder Class Reference

#include <PndSdsIdealPixelClusterFinder.h>

Inheritance diagram for PndSdsIdealPixelClusterFinder:
PndSdsPixelClusterFinder

Public Member Functions

 PndSdsIdealPixelClusterFinder ()
 
virtual ~PndSdsIdealPixelClusterFinder ()
 
std::vector< std::vector< Int_t > > GetClusters (std::vector< PndSdsDigiPixel > hits)
 
Int_t MoveHit (std::vector< Int_t > *hitVector, Int_t index) const
 
bool IsInRange (PndSdsDigiPixel hit1, PndSdsDigiPixel hit2) const
 
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
 

Detailed Description

PndSdsIdealPixelClusterFinder.h Ideal cluster finder using MCtruth information.

Definition at line 11 of file PndSdsIdealPixelClusterFinder.h.

Constructor & Destructor Documentation

PndSdsIdealPixelClusterFinder::PndSdsIdealPixelClusterFinder ( )
inline
virtual PndSdsIdealPixelClusterFinder::~PndSdsIdealPixelClusterFinder ( )
inlinevirtual

Definition at line 18 of file PndSdsIdealPixelClusterFinder.h.

18 {};

Member Function Documentation

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

Implements PndSdsPixelClusterFinder.

Definition at line 4 of file PndSdsIdealPixelClusterFinder.cxx.

References PndSdsPixelClusterFinder::fHits, PndSdsPixelClusterFinder::fVerbose, i, IsInRange(), MoveHit(), PndSdsPixelClusterFinder::Print(), PndSdsPixelClusterFinder::PrintResult(), and push_back().

Referenced by PndSdsIdealClusterTask::Exec().

5 {
6  if (fVerbose > 1)
7  Print();
8  std::vector<Int_t> posHits; // stores the position of the hits in the TClonesArray (only this information is stored)
9  for (UInt_t i = 0; i < fHits.size(); i++) posHits.push_back(i);
10  std::vector< std::vector< Int_t> > result;
11  Int_t sizeTempHits = posHits.size();
12  // Int_t actHit = 0;
13 
14  while (sizeTempHits != 0){
15  std::vector<Int_t> tempInt;
16  if (fHits[posHits[0]].GetCharge() == 0){ //if the hit has no charge it is deleted out of posHits
17  if (fVerbose > 2){
18  std::cout << "Charge too low for pixel: " << std::endl;
19  fHits[posHits[0]].Print();
20  }
21  MoveHit(&posHits,0);
22  }
23  else {
24  tempInt.push_back(MoveHit(&posHits,0)); //Move the first hit of the remaining hits into the new cluster
25  result.push_back(tempInt);
26 
27  sizeTempHits = posHits.size();
28  for (Int_t j = 0; j < sizeTempHits; j++){
29  if (fHits[posHits[j]].GetCharge() == 0){
30  MoveHit(&posHits,j);
31  if (fVerbose > 2){
32  std::cout << "Charge too low for pixel: " << std::endl;
33  fHits[posHits[0]].Print();
34  }
35  j--;
36  }
37  else{
38  if (fHits[(*(result.end()-1))[0]].GetSensorID() == fHits[posHits[j]].GetSensorID()){
39  if (IsInRange(fHits[(*(result.end()-1))[0] ], fHits[posHits[j]])) {
40  (result.end()-1)->push_back(MoveHit(&posHits,j)); // the hit position is added to the current cluster
41  j--;
42  if (fVerbose > 2)
43  std::cout << "Hit added to cluster: " << result.size()-1 << std::endl;
44  }
45  }
46 
47  }
48  sizeTempHits = posHits.size();
49  }
50  }
51  }
52  if (fVerbose > 1)
53  PrintResult(result);
54  return result;
55 }
void PrintResult(std::vector< std::vector< Int_t > > clusters)
bool IsInRange(PndSdsDigiPixel hit1, PndSdsDigiPixel hit2) const
Int_t i
Definition: run_full.C:25
labels push_back("electron")
Int_t MoveHit(std::vector< Int_t > *hitVector, Int_t index) const
std::vector< PndSdsDigiPixel > fHits
bool PndSdsIdealPixelClusterFinder::IsInRange ( PndSdsDigiPixel  hit1,
PndSdsDigiPixel  hit2 
) const

Definition at line 67 of file PndSdsIdealPixelClusterFinder.cxx.

References PndSdsDigi::GetIndex().

Referenced by GetClusters().

68 {
69  return (hit1.GetIndex(0) == hit2.GetIndex(0)); // two hits are in range if they come from the same MC hit
70 }
Int_t GetIndex(int i=0) const
Definition: PndSdsDigi.h:63
Int_t PndSdsIdealPixelClusterFinder::MoveHit ( std::vector< Int_t > *  hitVector,
Int_t  index 
) const

Definition at line 57 of file PndSdsIdealPixelClusterFinder.cxx.

Referenced by GetClusters().

58 {
59  Int_t result = -1;
60  if (index < (Int_t)hitVector->size()){
61  result = (*hitVector)[index];
62  hitVector->erase(hitVector->begin()+index);
63  }
64  return result;
65 }
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 GetClusters(), and PndSdsSimplePixelClusterFinder::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
void PndSdsPixelClusterFinder::SetVerbose ( Int_t  level)
inlineinherited

Member Data Documentation

PndSdsChargeConversion* PndSdsPixelClusterFinder::fChargeConverter
inherited
std::vector<PndSdsDigiPixel> PndSdsPixelClusterFinder::fHits
inherited
Int_t PndSdsPixelClusterFinder::fVerbose
inherited

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