Public Member Functions | Private Member Functions | Private Attributes

WCSimHoughTransformArray Class Reference

#include "WCSimHoughTransformArray.hh"

List of all members.

Public Member Functions

 WCSimHoughTransformArray (Int_t bins, Double_t min, Double_t max, Int_t xbins, Int_t ybins)
 ~WCSimHoughTransformArray ()
void BuildArray (Int_t bins, Double_t min, Double_t max, Int_t xbins, Int_t ybins)
void PrintArray ()
Int_t GetBins ()
Int_t GetConeAngleBins ()
Double_t GetConeAngleMin ()
Double_t GetConeAngleMax ()
Double_t GetConeAngle (Int_t bin)
Double_t GetAngle (Int_t bin)
Int_t FindBin (Double_t angle)
WCSimHoughTransformGetHoughTransform (Int_t nAngle)
void FindPeak (Int_t &bin, Double_t &height)
void FindPeak (Double_t &phi, Double_t &costheta, Double_t &angle, Double_t &height)
void FindPeak (Double_t &hx, Double_t &hy, Double_t &hz, Double_t &angle, Double_t &height)
void Reset ()

Private Member Functions

void DeleteArray ()

Private Attributes

Int_t fHoughX
Int_t fHoughY
Int_t fConeAngleBins
Double_t fConeAngleMin
Double_t fConeAngleMax
std::vector
< WCSimHoughTransform * > 
fHoughArray

Detailed Description

Definition at line 10 of file WCSimHoughTransformArray.hh.


Constructor & Destructor Documentation

WCSimHoughTransformArray::WCSimHoughTransformArray ( Int_t  bins,
Double_t  min,
Double_t  max,
Int_t  xbins,
Int_t  ybins 
)
WCSimHoughTransformArray::~WCSimHoughTransformArray (  ) 

Definition at line 14 of file WCSimHoughTransformArray.cc.

References DeleteArray().

{
  this->DeleteArray();
}


Member Function Documentation

void WCSimHoughTransformArray::BuildArray ( Int_t  bins,
Double_t  min,
Double_t  max,
Int_t  xbins,
Int_t  ybins 
)

Definition at line 19 of file WCSimHoughTransformArray.cc.

References DeleteArray(), fConeAngleBins, fConeAngleMax, fConeAngleMin, fHoughArray, fHoughX, and fHoughY.

{
  std::cout << " *** WCSimHoughTransformArray::BuildArray() *** " << std::endl;

  // set parameters
  fHoughX = phiBins;
  fHoughY = cosThetaBins;
  fConeAngleBins = coneAngleBins;
  fConeAngleMin = coneAngleMin;
  fConeAngleMax = coneAngleMax;

  std::cout << "  building Hough Transform Array: (bins,min,max)=(" << fConeAngleBins << "," << fConeAngleMin << "," << fConeAngleMax << ") " << std::endl;

  // clear current array
  this->DeleteArray();

  // create new array
  for( Int_t n=0; n<fConeAngleBins; n++ ){
    WCSimHoughTransform* myHoughTransform = new WCSimHoughTransform(fHoughX,fHoughY);
    fHoughArray.push_back(myHoughTransform);
  }

  return;
}

void WCSimHoughTransformArray::DeleteArray (  )  [private]

Definition at line 167 of file WCSimHoughTransformArray.cc.

References fHoughArray.

Referenced by BuildArray(), and ~WCSimHoughTransformArray().

{
  for( UInt_t n=0; n<fHoughArray.size(); n++ ){
    delete (WCSimHoughTransform*)(fHoughArray.at(n));
  }

  fHoughArray.clear();

  return;
}

Int_t WCSimHoughTransformArray::FindBin ( Double_t  angle  ) 

Definition at line 134 of file WCSimHoughTransformArray.cc.

References fConeAngleBins, fConeAngleMax, and fConeAngleMin.

{
  if( myAngle>=fConeAngleMin && myAngle<fConeAngleMax ){
    return (Int_t)(fConeAngleBins*(myAngle-fConeAngleMin)/(fConeAngleMax-fConeAngleMin));
  }
  else{
    return -1;
  }
}

void WCSimHoughTransformArray::FindPeak ( Int_t &  bin,
Double_t &  height 
)

Definition at line 44 of file WCSimHoughTransformArray.cc.

References WCSimHoughTransform::FindPeak(), GetBins(), and GetHoughTransform().

Referenced by WCSimRingFinder::Run().

{
  Int_t bestBin = -1;  
  Double_t bestHeight = 0.0;

  Double_t myHeight = 0.0;  
  
  for( Int_t iBin=0; iBin<this->GetBins(); iBin++ ){
    WCSimHoughTransform* myHoughTransform = this->GetHoughTransform(iBin);
    myHoughTransform->FindPeak(myHeight);

    if( myHeight>bestHeight ){
      bestBin = iBin;
      bestHeight = myHeight;
    }
  }

  bin = bestBin;
  height = bestHeight;

  return;
}

void WCSimHoughTransformArray::FindPeak ( Double_t &  hx,
Double_t &  hy,
Double_t &  hz,
Double_t &  angle,
Double_t &  height 
)

Definition at line 98 of file WCSimHoughTransformArray.cc.

References WCSimHoughTransform::FindPeak(), GetAngle(), GetBins(), and GetHoughTransform().

{

  Int_t bestBin = -1;  
  Double_t bestDirX = 0.0;
  Double_t bestDirY = 0.0;
  Double_t bestDirZ = 0.0;
  Double_t bestHeight = 0.0;
    
  Double_t myDirX = 0.0;
  Double_t myDirY = 0.0;
  Double_t myDirZ = 0.0;
  Double_t myHeight = 0.0;

  for( Int_t iBin=0; iBin<this->GetBins(); iBin++ ){
    WCSimHoughTransform* myHoughTransform = this->GetHoughTransform(iBin);
    myHoughTransform->FindPeak(myDirX,myDirY,myDirZ,myHeight);

    if( myHeight>bestHeight ){
      bestBin = iBin;
      bestDirX = myDirX;
      bestDirY = myDirY;
      bestDirZ = myDirZ;
      bestHeight = myHeight;
    }
  }

  angle = this->GetAngle(bestBin);
  hx = bestDirX;
  hy = bestDirY;
  hz = bestDirZ;
  height = bestHeight;

  return;
}

void WCSimHoughTransformArray::FindPeak ( Double_t &  phi,
Double_t &  costheta,
Double_t &  angle,
Double_t &  height 
)

Definition at line 67 of file WCSimHoughTransformArray.cc.

References WCSimHoughTransform::FindPeak(), GetAngle(), GetBins(), and GetHoughTransform().

{
  Int_t bestBin = -1;  
  Double_t bestPhi = 0.0;
  Double_t bestCosTheta = 0.0;
  Double_t bestHeight = 0.0;
    
  Double_t myPhi = 0.0;
  Double_t myCosTheta = 0.0;
  Double_t myHeight = 0.0;  

  for( Int_t iBin=0; iBin<this->GetBins(); iBin++ ){
    WCSimHoughTransform* myHoughTransform = this->GetHoughTransform(iBin);
    myHoughTransform->FindPeak(myPhi,myCosTheta,myHeight);

    if( myHeight>bestHeight ){
      bestBin = iBin;
      bestPhi = myPhi;
      bestCosTheta = myCosTheta;
      bestHeight = myHeight;
    }
  }  

  angle = this->GetAngle(bestBin);
  phi = bestPhi;
  costheta = bestCosTheta;
  height = bestHeight;

  return;
}

Double_t WCSimHoughTransformArray::GetAngle ( Int_t  bin  ) 

Definition at line 144 of file WCSimHoughTransformArray.cc.

References GetConeAngle().

Referenced by FindPeak().

{
  return this->GetConeAngle(myBin);
}

Int_t WCSimHoughTransformArray::GetBins (  )  [inline]

Definition at line 21 of file WCSimHoughTransformArray.hh.

References fConeAngleBins.

Referenced by FindPeak().

{ return fConeAngleBins; }

Double_t WCSimHoughTransformArray::GetConeAngle ( Int_t  bin  ) 

Definition at line 149 of file WCSimHoughTransformArray.cc.

References fConeAngleBins, fConeAngleMax, and fConeAngleMin.

Referenced by GetAngle(), WCSimRingFinder::HoughTransformArray(), and PrintArray().

{
  if( fConeAngleBins>0 ){
    return fConeAngleMin + ((double)(myBin+0.5)/(double)fConeAngleBins)*(fConeAngleMax-fConeAngleMin); 
  }
  else{
    return -45.0;
  }
}

Int_t WCSimHoughTransformArray::GetConeAngleBins (  )  [inline]

Definition at line 22 of file WCSimHoughTransformArray.hh.

References fConeAngleBins.

Referenced by WCSimRingFinder::HoughTransformArray().

{ return fConeAngleBins; }

Double_t WCSimHoughTransformArray::GetConeAngleMax (  )  [inline]

Definition at line 24 of file WCSimHoughTransformArray.hh.

References fConeAngleMax.

{ return fConeAngleMax; }

Double_t WCSimHoughTransformArray::GetConeAngleMin (  )  [inline]

Definition at line 23 of file WCSimHoughTransformArray.hh.

References fConeAngleMin.

{ return fConeAngleMin; }

WCSimHoughTransform * WCSimHoughTransformArray::GetHoughTransform ( Int_t  nAngle  ) 

Definition at line 159 of file WCSimHoughTransformArray.cc.

References fConeAngleBins, and fHoughArray.

Referenced by FindPeak(), and WCSimRingFinder::HoughTransformArray().

{
  if( nAngle>=0 && nAngle<fConeAngleBins ){
    return (WCSimHoughTransform*)(fHoughArray.at(nAngle));
  }
  else return 0;
}

void WCSimHoughTransformArray::PrintArray (  ) 

Definition at line 178 of file WCSimHoughTransformArray.cc.

References fConeAngleBins, and GetConeAngle().

{
  std::cout << " *** WCSimHoughTransformArray::PrintArray() *** " << std::endl;

  for( Int_t n=0; n<fConeAngleBins; n++ ){
    std::cout << "  [" << n << "] coneAngle=" << this->GetConeAngle(n) << std::endl; 
  }

  return;
}

void WCSimHoughTransformArray::Reset (  ) 

Definition at line 189 of file WCSimHoughTransformArray.cc.

References fHoughArray, and WCSimHoughTransform::Reset().

Referenced by WCSimRingFinder::HoughTransformArray().

{
  // reset each hough transform
  for( UInt_t n=0; n<fHoughArray.size(); n++ ){
    WCSimHoughTransform* myHoughTransform = (WCSimHoughTransform*)(fHoughArray.at(n));
    myHoughTransform->Reset();
  }
}


Member Data Documentation

Definition at line 46 of file WCSimHoughTransformArray.hh.

Referenced by BuildArray(), FindBin(), GetConeAngle(), and GetConeAngleMax().

Definition at line 45 of file WCSimHoughTransformArray.hh.

Referenced by BuildArray(), FindBin(), GetConeAngle(), and GetConeAngleMin().

Definition at line 48 of file WCSimHoughTransformArray.hh.

Referenced by BuildArray(), DeleteArray(), GetHoughTransform(), and Reset().

Definition at line 42 of file WCSimHoughTransformArray.hh.

Referenced by BuildArray().

Definition at line 43 of file WCSimHoughTransformArray.hh.

Referenced by BuildArray().


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