PandaRoot
PndFtsHoughSpacePeak Class Reference

Class for saving peaks of a Hough space. More...

#include <PndFtsHoughSpacePeak.h>

Inheritance diagram for PndFtsHoughSpacePeak:

Public Member Functions

 PndFtsHoughSpacePeak (Int_t height=noVal, Int_t firstBin=noVal, Int_t firstHitIdx=noVal)
 
 ~PndFtsHoughSpacePeak ()
 
void resetBins ()
 
void replaceBins (Int_t height, Int_t firstBin, Int_t firstHitIdx)
 
void addBin (Int_t binNumber, Int_t hitIdx)
 
void setFinished (Bool_t newVal)
 
Bool_t isFinished () const
 
Int_t getHeight () const
 
const std::set< Int_t > & getBins () const
 
const std::set< Int_t > & getHitIds () const
 
Bool_t binsOverlapWith (const PndFtsHoughSpacePeak &toCheck)
 
void mergeWith (const PndFtsHoughSpacePeak &toAdd)
 

Static Public Attributes

static const Int_t noVal = -1
 

Detailed Description

Class for saving peaks of a Hough space.

Author
Martin J. Galuska <martin [dot] j [dot] galuska (at) physik [dot] uni (minus) giessen [dot] de>

Saves height and globalbin numbers belonging to this peak. TODO Use set/ unordered_set or something else rather than vectors to not store duplicate entries

Created: 25.06.2014

Definition at line 37 of file PndFtsHoughSpacePeak.h.

Constructor & Destructor Documentation

◆ PndFtsHoughSpacePeak()

PndFtsHoughSpacePeak::PndFtsHoughSpacePeak ( Int_t  height = noVal,
Int_t  firstBin = noVal,
Int_t  firstHitIdx = noVal 
)

◆ ~PndFtsHoughSpacePeak()

PndFtsHoughSpacePeak::~PndFtsHoughSpacePeak ( )

Member Function Documentation

◆ addBin()

void PndFtsHoughSpacePeak::addBin ( Int_t  binNumber,
Int_t  hitIdx 
)
inline

Definition at line 69 of file PndFtsHoughSpacePeak.h.

Referenced by replaceBins().

70 {
71  fBins.insert(binNumber);
72  fHitIds.insert(hitIdx);
73 }

◆ binsOverlapWith()

Bool_t PndFtsHoughSpacePeak::binsOverlapWith ( const PndFtsHoughSpacePeak toCheck)
inline

Definition at line 90 of file PndFtsHoughSpacePeak.h.

References getBins().

Referenced by getHitIds().

91 {
92  // return kTRUE iif toAdd has bins in common with this
93  const std::set<Int_t> binsToSearch = toCheck.getBins();
94  // try to find elements from toAdd in this
95  for (std::set<Int_t>::iterator it = binsToSearch.begin(); it != binsToSearch.end(); ++it) {
96  std::set<Int_t>::iterator itFind = fBins.find(*it);
97  if (itFind != fBins.end())
98  return kTRUE; // element from binsToSearch was found in this
99  }
100  return kFALSE; // none of the elements from binsToSearch was found in this
101 }
const std::set< Int_t > & getBins() const

◆ getBins()

const std::set<Int_t>& PndFtsHoughSpacePeak::getBins ( ) const
inline

Definition at line 54 of file PndFtsHoughSpacePeak.h.

Referenced by binsOverlapWith(), and mergeWith().

54 { return fBins; };

◆ getHeight()

Int_t PndFtsHoughSpacePeak::getHeight ( ) const
inline

Definition at line 52 of file PndFtsHoughSpacePeak.h.

52 { return fHeight; };

◆ getHitIds()

const std::set<Int_t>& PndFtsHoughSpacePeak::getHitIds ( ) const
inline

Definition at line 55 of file PndFtsHoughSpacePeak.h.

References binsOverlapWith(), and mergeWith().

Referenced by mergeWith().

55 { return fHitIds; };

◆ isFinished()

Bool_t PndFtsHoughSpacePeak::isFinished ( ) const
inline

Definition at line 51 of file PndFtsHoughSpacePeak.h.

51 { return fFinished; };

◆ mergeWith()

void PndFtsHoughSpacePeak::mergeWith ( const PndFtsHoughSpacePeak toAdd)
inline

Definition at line 103 of file PndFtsHoughSpacePeak.h.

References getBins(), and getHitIds().

Referenced by getHitIds().

104 {
105  // merge bins
106  const std::set<Int_t> binsToMerge = toAdd.getBins();
107  fBins.insert(binsToMerge.begin(), binsToMerge.end());
108  // merge hit indices
109  const std::set<Int_t> hitsToMerge = toAdd.getHitIds();
110  fHitIds.insert(hitsToMerge.begin(), hitsToMerge.end());
111 }
const std::set< Int_t > & getBins() const
const std::set< Int_t > & getHitIds() const

◆ replaceBins()

void PndFtsHoughSpacePeak::replaceBins ( Int_t  height,
Int_t  firstBin,
Int_t  firstHitIdx 
)
inline

Definition at line 75 of file PndFtsHoughSpacePeak.h.

References addBin(), and resetBins().

76 {
77  resetBins();
78  addBin(firstBin, firstHitIdx);
79  fHeight = height;
80 }
void addBin(Int_t binNumber, Int_t hitIdx)

◆ resetBins()

void PndFtsHoughSpacePeak::resetBins ( )
inline

Definition at line 82 of file PndFtsHoughSpacePeak.h.

References noVal.

Referenced by replaceBins().

83 {
84  fBins.clear();
85  fHitIds.clear();
86  fFinished = kFALSE;
87  fHeight = noVal;
88 }
static const Int_t noVal

◆ setFinished()

void PndFtsHoughSpacePeak::setFinished ( Bool_t  newVal)
inline

Definition at line 49 of file PndFtsHoughSpacePeak.h.

49 { fFinished = newVal; };

Member Data Documentation

◆ noVal

const Int_t PndFtsHoughSpacePeak::noVal = -1
static

Definition at line 39 of file PndFtsHoughSpacePeak.h.

Referenced by resetBins().


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