Public Member Functions | Private Member Functions | Private Attributes | List of all members
hough::IslandsTH2 Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N21-03-06/HoughTransform/IslandsTH2.h"

Inheritance diagram for hough::IslandsTH2:

Public Member Functions

 IslandsTH2 (const char *n, const char *t, const TH2 *h, double q, bool wrapx, bool wrapy)
 
unsigned int Nislands () const
 
void LabelIslands (const TH2 *h)
 

Private Member Functions

void Mark (const TH2 *h, int i, int j, int isl_indx, double th)
 
int Neighbor (int i, int d, int imx, bool wrap)
 

Private Attributes

double fPco
 Number of sigma above average peak height to use for peak threshold. More...
 
bool fWrapX
 Wrap around the x boundaries? More...
 
bool fWrapY
 Wrap around the y boundaries? More...
 
int fNx
 Number of bins along x. More...
 
int fNy
 Number of bins along y. More...
 
unsigned int fNislands
 Number of islands found. More...
 

Detailed Description

Definition at line 12 of file IslandsTH2.h.

Constructor & Destructor Documentation

hough::IslandsTH2::IslandsTH2 ( const char *  n,
const char *  t,
const TH2 *  h,
double  q,
bool  wrapx,
bool  wrapy 
)

Definition at line 13 of file IslandsTH2.cxx.

18  :
19  TH2S(n,
20  t,
21  h->GetNbinsX(),
22  h->GetXaxis()->GetXmin(),
23  h->GetXaxis()->GetXmax(),
24  h->GetNbinsY(),
25  h->GetYaxis()->GetXmin(),
26  h->GetYaxis()->GetXmax()),
27  fPco(q),
28  fWrapX(wrapx),
29  fWrapY(wrapy),
30  fNx(h->GetNbinsX()),
31  fNy(h->GetNbinsY()),
32  fNislands(0)
33  { }
bool fWrapY
Wrap around the y boundaries?
Definition: IslandsTH2.h:28
double fPco
Number of sigma above average peak height to use for peak threshold.
Definition: IslandsTH2.h:26
int fNx
Number of bins along x.
Definition: IslandsTH2.h:29
unsigned int fNislands
Number of islands found.
Definition: IslandsTH2.h:31
bool fWrapX
Wrap around the x boundaries?
Definition: IslandsTH2.h:27
int fNy
Number of bins along y.
Definition: IslandsTH2.h:30

Member Function Documentation

void hough::IslandsTH2::LabelIslands ( const TH2 *  h)

Definition at line 37 of file IslandsTH2.cxx.

References a, b, fNislands, fNx, fNy, fPco, MECModelEnuComparisons::i, calib::j, Mark(), genie::units::nb, and std::sqrt().

Referenced by hough::Hough2P::FindPeaks(), and Nislands().

38  {
39 
40  int a;
41  int b;
42  double Pave = 0.0; // average peak height
43  double Ps = 0.0; // standard deviation of average peak height
44  double th = 0.0; // threshold to use for peak cutoff
45  int nb = 0; // number of bins counted for avergae peak height
46 
47  // calculate average peak height to determine threshold
48  // empty bins are NOT counted
49  for (a = 1; a <= fNx; ++a) {
50  for (b = 1; b <= fNy; ++b) {
51  if (h->GetBinContent(a,b) != 0) {
52  Pave += h->GetBinContent(a,b);
53  Ps += (h->GetBinContent(a,b))*(h->GetBinContent(a,b));
54  nb++;
55  } // end if
56  } // end for b
57  } // end for a
58 
59  Pave = Pave/nb;
60  Ps = sqrt(Ps/nb - Pave*Pave);
61 
62  th = Pave + fPco*Ps;
63 
64 
65  int i;
66  int j;
67  for (i=1; i<=fNx; ++i) {
68  for (j=1; j<=fNy; ++j) {
69  if (this->GetBinContent(i,j) == 0 && h->GetBinContent(i,j) >= th) {
70  ++fNislands;
71  this->Mark(h,i,j,fNislands,th);
72  } // end if
73  } // end for j
74  } // end for i
75 
76  } // end LabelIslands
T sqrt(T number)
Definition: d0nt_math.hpp:156
double fPco
Number of sigma above average peak height to use for peak threshold.
Definition: IslandsTH2.h:26
void Mark(const TH2 *h, int i, int j, int isl_indx, double th)
Definition: IslandsTH2.cxx:96
const double a
int fNx
Number of bins along x.
Definition: IslandsTH2.h:29
const double j
Definition: BetheBloch.cxx:29
unsigned int fNislands
Number of islands found.
Definition: IslandsTH2.h:31
int fNy
Number of bins along y.
Definition: IslandsTH2.h:30
const hit & b
Definition: hits.cxx:21
static const double nb
Definition: Units.h:89
void hough::IslandsTH2::Mark ( const TH2 *  h,
int  i,
int  j,
int  isl_indx,
double  th 
)
private

Definition at line 96 of file IslandsTH2.cxx.

References fNx, fNy, fWrapX, fWrapY, m, getGoodRuns4SAM::n, Neighbor(), and SetBinContent().

Referenced by LabelIslands(), and Nislands().

97  {
98  int m, n;
99  int ix, iy;
100 
101  this->SetBinContent(i,j,isl_indx);
102  for (m=-1; m<=1; ++m) {
103  ix = this->Neighbor(i,m,fNx,fWrapX);
104  if (ix==-1) continue;
105  for (n=-1; n<=1; ++n) {
106  if (m==0 && n==0) continue;
107  iy = this->Neighbor(j,n,fNy,fWrapY);
108  if (iy==-1) continue;
109  if (this->GetBinContent(ix,iy) == 0 && h->GetBinContent(ix,iy) >= th) {
110  this->Mark(h,ix,iy,isl_indx,th);
111  }
112  }
113  }
114  }
int Neighbor(int i, int d, int imx, bool wrap)
Definition: IslandsTH2.cxx:80
bool fWrapY
Wrap around the y boundaries?
Definition: IslandsTH2.h:28
void Mark(const TH2 *h, int i, int j, int isl_indx, double th)
Definition: IslandsTH2.cxx:96
int fNx
Number of bins along x.
Definition: IslandsTH2.h:29
const double j
Definition: BetheBloch.cxx:29
bool fWrapX
Wrap around the x boundaries?
Definition: IslandsTH2.h:27
cout<< "--"<< endl;for(Int_t iP=1;iP<=hyz->GetNbinsX();iP++){for(Int_t iC=1;iC<=hyz->GetNbinsY();iC++){if(hyv->GetBinContent(iP, iC)>-999){goal_hyv-> SetBinContent(iP, iC,-(dy[iP-1][iC-1]))
int fNy
Number of bins along y.
Definition: IslandsTH2.h:30
int hough::IslandsTH2::Neighbor ( int  i,
int  d,
int  imx,
bool  wrap 
)
private

Definition at line 80 of file IslandsTH2.cxx.

References m, and getGoodRuns4SAM::n.

Referenced by Mark(), and Nislands().

81  {
82  int ix = i+m;
83  if (ix==0) {
84  if (wrap) return n;
85  else return -1;
86  }
87  if (ix>n) {
88  if (wrap) return 1;
89  else return -1;
90  }
91  return ix;
92  }
unsigned int hough::IslandsTH2::Nislands ( ) const
inline

Definition at line 20 of file IslandsTH2.h.

References d, fNislands, MECModelEnuComparisons::i, calib::j, LabelIslands(), Mark(), and Neighbor().

Referenced by hough::Hough2P::FindPeaks().

20 { return fNislands; }
unsigned int fNislands
Number of islands found.
Definition: IslandsTH2.h:31

Member Data Documentation

unsigned int hough::IslandsTH2::fNislands
private

Number of islands found.

Definition at line 31 of file IslandsTH2.h.

Referenced by LabelIslands(), and Nislands().

int hough::IslandsTH2::fNx
private

Number of bins along x.

Definition at line 29 of file IslandsTH2.h.

Referenced by LabelIslands(), and Mark().

int hough::IslandsTH2::fNy
private

Number of bins along y.

Definition at line 30 of file IslandsTH2.h.

Referenced by LabelIslands(), and Mark().

double hough::IslandsTH2::fPco
private

Number of sigma above average peak height to use for peak threshold.

Definition at line 26 of file IslandsTH2.h.

Referenced by LabelIslands().

bool hough::IslandsTH2::fWrapX
private

Wrap around the x boundaries?

Definition at line 27 of file IslandsTH2.h.

Referenced by Mark().

bool hough::IslandsTH2::fWrapY
private

Wrap around the y boundaries?

Definition at line 28 of file IslandsTH2.h.

Referenced by Mark().


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