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 25 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 57 of file PndFtsHoughSpacePeak.h.

Referenced by replaceBins().

58 {
59  fBins.insert(binNumber);
60  fHitIds.insert(hitIdx);
61 }

◆ binsOverlapWith()

Bool_t PndFtsHoughSpacePeak::binsOverlapWith ( const PndFtsHoughSpacePeak toCheck)
inline

Definition at line 78 of file PndFtsHoughSpacePeak.h.

References getBins().

Referenced by getHitIds().

79 {
80  // return kTRUE iif toAdd has bins in common with this
81  const std::set<Int_t> binsToSearch = toCheck.getBins();
82  // try to find elements from toAdd in this
83  for (std::set<Int_t>::iterator it = binsToSearch.begin(); it != binsToSearch.end(); ++it) {
84  std::set<Int_t>::iterator itFind = fBins.find(*it);
85  if (itFind != fBins.end())
86  return kTRUE; // element from binsToSearch was found in this
87  }
88  return kFALSE; // none of the elements from binsToSearch was found in this
89 }
const std::set< Int_t > & getBins() const

◆ getBins()

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

Definition at line 42 of file PndFtsHoughSpacePeak.h.

Referenced by binsOverlapWith(), and mergeWith().

42 { return fBins; };

◆ getHeight()

Int_t PndFtsHoughSpacePeak::getHeight ( ) const
inline

Definition at line 40 of file PndFtsHoughSpacePeak.h.

40 { return fHeight; };

◆ getHitIds()

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

Definition at line 43 of file PndFtsHoughSpacePeak.h.

References binsOverlapWith(), and mergeWith().

Referenced by mergeWith().

43 { return fHitIds; };

◆ isFinished()

Bool_t PndFtsHoughSpacePeak::isFinished ( ) const
inline

Definition at line 39 of file PndFtsHoughSpacePeak.h.

39 { return fFinished; };

◆ mergeWith()

void PndFtsHoughSpacePeak::mergeWith ( const PndFtsHoughSpacePeak toAdd)
inline

Definition at line 91 of file PndFtsHoughSpacePeak.h.

References getBins(), and getHitIds().

Referenced by getHitIds().

92 {
93  // merge bins
94  const std::set<Int_t> binsToMerge = toAdd.getBins();
95  fBins.insert(binsToMerge.begin(), binsToMerge.end());
96  // merge hit indices
97  const std::set<Int_t> hitsToMerge = toAdd.getHitIds();
98  fHitIds.insert(hitsToMerge.begin(), hitsToMerge.end());
99 }
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 63 of file PndFtsHoughSpacePeak.h.

References addBin(), and resetBins().

64 {
65  resetBins();
66  addBin(firstBin, firstHitIdx);
67  fHeight = height;
68 }
void addBin(Int_t binNumber, Int_t hitIdx)

◆ resetBins()

void PndFtsHoughSpacePeak::resetBins ( )
inline

Definition at line 70 of file PndFtsHoughSpacePeak.h.

References noVal.

Referenced by replaceBins().

71 {
72  fBins.clear();
73  fHitIds.clear();
74  fFinished = kFALSE;
75  fHeight = noVal;
76 }
static const Int_t noVal

◆ setFinished()

void PndFtsHoughSpacePeak::setFinished ( Bool_t  newVal)
inline

Definition at line 37 of file PndFtsHoughSpacePeak.h.

37 { fFinished = newVal; };

Member Data Documentation

◆ noVal

const Int_t PndFtsHoughSpacePeak::noVal = -1
static

Definition at line 27 of file PndFtsHoughSpacePeak.h.

Referenced by resetBins().


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