Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

WCSimRingFinder Class Reference

#include "WCSimRingFinder.hh"

List of all members.

Public Member Functions

void RunPrintParameters ()
void SetHoughX (Int_t x)
void SetHoughY (Int_t y)
void SetHoughPoints (Int_t n)
void SetConeAngleBins (Int_t bins)
void SetConeAngleMin (Double_t min)
void SetConeAngleMax (Double_t max)
void SetUsingRecoVertex ()
Bool_t UsingRecoVertex ()
std::vector< WCSimRecoRing * > * Run (WCSimRecoVertex *vtx)
std::vector< WCSimRecoRing * > * Run (WCSimRecoEvent *evt, WCSimRecoVertex *vtx)
std::vector< WCSimRecoRing * > * Run (std::vector< WCSimRecoDigit * > *digitlist, WCSimRecoVertex *vtx)
WCSimHoughTransformHoughTransform (WCSimRecoEvent *evt, WCSimRecoVertex *vtx, Double_t angle)
WCSimHoughTransformHoughTransform (std::vector< WCSimRecoDigit * > *digitlist, WCSimRecoVertex *vtx, Double_t angle)
WCSimHoughTransformArrayHoughTransformArray (WCSimRecoEvent *evt, WCSimRecoVertex *vtx)
WCSimHoughTransformArrayHoughTransformArray (std::vector< WCSimRecoDigit * > *digitlist, WCSimRecoVertex *vtx)

Static Public Member Functions

static WCSimRingFinderInstance ()
static void UseRecoVertex ()
static void HoughX (Int_t x)
static void HoughY (Int_t y)
static void HoughPoints (Int_t n)
static void ConeAngleBins (Int_t bins)
static void ConeAngleMin (Double_t min)
static void ConeAngleMax (Double_t max)
static void PrintParameters ()

Private Member Functions

 WCSimRingFinder ()
 ~WCSimRingFinder ()
void Reset ()

Private Attributes

Bool_t fUseVertex
Int_t fHoughX
Int_t fHoughY
Int_t fHoughPoints
Int_t fConeAngleBins
Double_t fConeAngleMin
Double_t fConeAngleMax
WCSimHoughTransformfHoughTransform
WCSimHoughTransformArrayfHoughTransformArray
std::vector< WCSimRecoRing * > * fRingList

Detailed Description

Definition at line 15 of file WCSimRingFinder.hh.


Constructor & Destructor Documentation

WCSimRingFinder::WCSimRingFinder (  )  [private]

Definition at line 77 of file WCSimRingFinder.cc.

References fConeAngleBins, fConeAngleMax, fConeAngleMin, fHoughPoints, fHoughTransform, fHoughTransformArray, fHoughX, fHoughY, fRingList, and fUseVertex.

{
  // use reco vertex
  fUseVertex = 0;

  // default hough transform parameters
  fHoughX = 120;          // bins in phi
  fHoughY = 60;           // bins in cos(theta)
  fHoughPoints = 360;     // hough points

  fConeAngleBins = 30;   // hough angle bins
  fConeAngleMin = 24.5;  // hough cone (min)
  fConeAngleMax = 54.5;  // hough cone (max)
  
  // hough transform object
  fHoughTransform = 0;

  // hough transform array
  fHoughTransformArray = 0;

  // make list of rings
  fRingList = new std::vector<WCSimRecoRing*>;
}

WCSimRingFinder::~WCSimRingFinder (  )  [private]

Definition at line 101 of file WCSimRingFinder.cc.

References fHoughTransform, fHoughTransformArray, and fRingList.

{
  if( fHoughTransform ){
    delete fHoughTransform;
  }

  if( fHoughTransformArray ){
    delete fHoughTransformArray;
  }

  for( UInt_t i=0; i<fRingList->size(); i++ ){
    delete (WCSimRecoRing*)(fRingList->at(i));
  }
 
  fRingList->clear();

  delete fRingList;
}


Member Function Documentation

void WCSimRingFinder::ConeAngleBins ( Int_t  bins  )  [static]

Definition at line 57 of file WCSimRingFinder.cc.

References Instance(), and SetConeAngleBins().

void WCSimRingFinder::ConeAngleMax ( Double_t  max  )  [static]

Definition at line 67 of file WCSimRingFinder.cc.

References Instance(), and SetConeAngleMax().

void WCSimRingFinder::ConeAngleMin ( Double_t  min  )  [static]

Definition at line 62 of file WCSimRingFinder.cc.

References Instance(), and SetConeAngleMin().

void WCSimRingFinder::HoughPoints ( Int_t  n  )  [static]

Definition at line 52 of file WCSimRingFinder.cc.

References Instance(), and SetHoughPoints().

WCSimHoughTransform * WCSimRingFinder::HoughTransform ( WCSimRecoEvent evt,
WCSimRecoVertex vtx,
Double_t  angle 
)

Definition at line 241 of file WCSimRingFinder.cc.

References WCSimRecoEvent::GetFilterDigitList().

{
  // get filter digit list
  // =====================
  std::vector<WCSimRecoDigit*>* myFilterDigitList = (std::vector<WCSimRecoDigit*>*)(myEvent->GetFilterDigitList());

  // run Hough Transform
  // ===================
  return (WCSimHoughTransform*)(this->HoughTransform(myFilterDigitList,myVertex,myAngle));
}

WCSimHoughTransform * WCSimRingFinder::HoughTransform ( std::vector< WCSimRecoDigit * > *  digitlist,
WCSimRecoVertex vtx,
Double_t  angle 
)

Definition at line 252 of file WCSimRingFinder.cc.

References fHoughPoints, fHoughTransform, fHoughX, fHoughY, WCSimHoughTransform::Fill(), WCSimGeometry::FindCircle(), WCSimRecoVertex::GetX(), WCSimRecoDigit::GetX(), WCSimRecoVertex::GetY(), WCSimRecoDigit::GetY(), WCSimRecoVertex::GetZ(), WCSimRecoDigit::GetZ(), and WCSimHoughTransform::Reset().

{
  std::cout << " *** WCSimRingFinder::HoughTransform(...) *** " << std::endl;
  std::cout << "  calculate Hough Transform for cone angle: " << myAngle << std::endl;  
  
  // make new Hough Transform (if necessary)
  // =======================================
  if( fHoughTransform==0 ){
    fHoughTransform = new WCSimHoughTransform(fHoughX,fHoughY);
  }

  // reset Hough Transform
  // =====================
  fHoughTransform->Reset();

  // perform Hough Transform
  // =======================
  for( UInt_t idigit=0; idigit<myFilterDigitList->size(); idigit++ ){
    WCSimRecoDigit* myDigit = (WCSimRecoDigit*)(myFilterDigitList->at(idigit));

    Double_t x = myDigit->GetX();
    Double_t y = myDigit->GetY();
    Double_t z = myDigit->GetZ();

    Double_t vx = myVertex->GetX();
    Double_t vy = myVertex->GetY();
    Double_t vz = myVertex->GetZ();

    Double_t omega = 0.0;
    Double_t rx = 0.0;
    Double_t ry = 0.0;
    Double_t rz = 0.0;
    Double_t nx = 0.0;
    Double_t ny = 0.0;
    Double_t nz = 0.0;
    Double_t r = 0.0;

    Double_t weight = 1.0;

    for( Int_t n=0; n<fHoughPoints; n++ ){
      omega = 360.0*((double)n/(double)fHoughPoints);

      WCSimGeometry::FindCircle(x, y, z,
                                vx, vy, vz,
                                myAngle, omega,
                                rx, ry, rz,
                                nx, ny, nz, r);

      fHoughTransform->Fill(nx,ny,nz,weight);
    }
  }

  // return result of Hough Transform
  // ================================
  return fHoughTransform;
}

WCSimHoughTransformArray * WCSimRingFinder::HoughTransformArray ( WCSimRecoEvent evt,
WCSimRecoVertex vtx 
)

Definition at line 309 of file WCSimRingFinder.cc.

References WCSimRecoEvent::GetFilterDigitList().

Referenced by Run().

{
  // get filter digit list
  // =====================
  std::vector<WCSimRecoDigit*>* myFilterDigitList = (std::vector<WCSimRecoDigit*>*)(myEvent->GetFilterDigitList());

  // run Hough Transform
  // ===================
  return (WCSimHoughTransformArray*)(this->HoughTransformArray(myFilterDigitList,myVertex));
}

WCSimHoughTransformArray * WCSimRingFinder::HoughTransformArray ( std::vector< WCSimRecoDigit * > *  digitlist,
WCSimRecoVertex vtx 
)

Definition at line 320 of file WCSimRingFinder.cc.

References fConeAngleBins, fConeAngleMax, fConeAngleMin, fHoughPoints, fHoughTransformArray, fHoughX, fHoughY, WCSimHoughTransform::Fill(), WCSimGeometry::FindCircle(), WCSimHoughTransformArray::GetConeAngle(), WCSimHoughTransformArray::GetConeAngleBins(), WCSimHoughTransformArray::GetHoughTransform(), WCSimRecoVertex::GetX(), WCSimRecoDigit::GetX(), WCSimRecoVertex::GetY(), WCSimRecoDigit::GetY(), WCSimRecoVertex::GetZ(), WCSimRecoDigit::GetZ(), and WCSimHoughTransformArray::Reset().

{
  std::cout << " *** WCSimRingFinder::HoughTransformArray(...) *** " << std::endl;
  
  // make new Hough Transform array (if necessary)
  // =============================================
  if( fHoughTransformArray==0 ){
    fHoughTransformArray = new WCSimHoughTransformArray( fConeAngleBins,fConeAngleMin,fConeAngleMax,
                                                         fHoughX,fHoughY);
  }

  // reset Hough Transform array
  // ===========================
  fHoughTransformArray->Reset();

  // perform Hough Transform
  // =======================
  for( UInt_t idigit=0; idigit<myFilterDigitList->size(); idigit++ ){
    WCSimRecoDigit* myDigit = (WCSimRecoDigit*)(myFilterDigitList->at(idigit));

    Double_t x = myDigit->GetX();
    Double_t y = myDigit->GetY();
    Double_t z = myDigit->GetZ();

    Double_t vx = myVertex->GetX();
    Double_t vy = myVertex->GetY();
    Double_t vz = myVertex->GetZ();

    Double_t omega = 0.0;
    Double_t rx = 0.0;
    Double_t ry = 0.0;
    Double_t rz = 0.0;
    Double_t nx = 0.0;
    Double_t ny = 0.0;
    Double_t nz = 0.0;
    Double_t r = 0.0;

    Double_t weight = 1.0;

    for( Int_t n=0; n<fHoughPoints; n++ ){
      omega = 360.0*((double)n/(double)fHoughPoints);

      for( Int_t nAngle=0; nAngle<fHoughTransformArray->GetConeAngleBins(); nAngle++ ){
        Double_t myAngle = fHoughTransformArray->GetConeAngle(nAngle);
        WCSimHoughTransform* myHoughTransform = (WCSimHoughTransform*)(fHoughTransformArray->GetHoughTransform(nAngle));
        
        WCSimGeometry::FindCircle(x, y, z,
                                  vx, vy, vz,
                                  myAngle, omega,
                                  rx, ry, rz,
                                  nx, ny, nz, r);

        myHoughTransform->Fill(nx,ny,nz,weight);
      }
    }
  }

  // return result of Hough Transform
  // ================================
  return fHoughTransformArray;
}

void WCSimRingFinder::HoughX ( Int_t  x  )  [static]

Definition at line 42 of file WCSimRingFinder.cc.

References Instance(), and SetHoughX().

void WCSimRingFinder::HoughY ( Int_t  y  )  [static]

Definition at line 47 of file WCSimRingFinder.cc.

References Instance(), and SetHoughY().

WCSimRingFinder * WCSimRingFinder::Instance (  )  [static]

Definition at line 20 of file WCSimRingFinder.cc.

Referenced by ConeAngleBins(), ConeAngleMax(), ConeAngleMin(), HoughPoints(), HoughX(), HoughY(), PrintParameters(), WCSimRecoAB::RunRecoRings(), and UseRecoVertex().

{
  if( !fgRingFinder ){
    fgRingFinder = new WCSimRingFinder();
  }

  if( !fgRingFinder ){
    assert(fgRingFinder);
  }

  if( fgRingFinder ){

  }

  return fgRingFinder;
}

void WCSimRingFinder::PrintParameters (  )  [static]

Definition at line 72 of file WCSimRingFinder.cc.

References Instance(), and RunPrintParameters().

Referenced by main().

void WCSimRingFinder::Reset (  )  [private]

Definition at line 135 of file WCSimRingFinder.cc.

{

  return;
}

std::vector< WCSimRecoRing * > * WCSimRingFinder::Run ( WCSimRecoVertex vtx  ) 

Definition at line 141 of file WCSimRingFinder.cc.

References fRingList, WCSimRecoVertex::GetConeAngle(), WCSimRecoVertex::GetDirX(), WCSimRecoVertex::GetDirY(), WCSimRecoVertex::GetDirZ(), WCSimRecoVertex::GetX(), WCSimRecoVertex::GetY(), and WCSimRecoVertex::GetZ().

Referenced by Run(), and WCSimRecoAB::RunRecoRings().

{
  std::cout << " *** WCSimRingFinder::Run(Vertex) *** " << std::endl;

  // reset ring list
  // ===============  
  for( UInt_t i=0; i<fRingList->size(); i++ ){
    delete (WCSimRecoRing*)(fRingList->at(i));
  }
 
  // clear ring list
  // ===============
  fRingList->clear();  

  // Make new ring, using vertex
  // ===========================
  WCSimRecoRing* myRing = new WCSimRecoRing(myVertex->GetX(),
                                            myVertex->GetY(),
                                            myVertex->GetZ(),   
                                            myVertex->GetDirX(),
                                            myVertex->GetDirY(),
                                            myVertex->GetDirZ(),
                                            myVertex->GetConeAngle(), 
                                            0.0); // height of hough peak

  fRingList->push_back(myRing);

  // Return Ring List
  // ================
  return fRingList;
}

std::vector< WCSimRecoRing * > * WCSimRingFinder::Run ( WCSimRecoEvent evt,
WCSimRecoVertex vtx 
)

Definition at line 173 of file WCSimRingFinder.cc.

References WCSimRecoEvent::GetFilterDigitList(), and Run().

{
  // get filter digit list
  // =====================
  std::vector<WCSimRecoDigit*>* myFilterDigitList = (std::vector<WCSimRecoDigit*>*)(myEvent->GetFilterDigitList());

  // run vertex finder
  // =================
  return (std::vector<WCSimRecoRing*>*)(this->Run(myFilterDigitList,myVertex));
}

std::vector< WCSimRecoRing * > * WCSimRingFinder::Run ( std::vector< WCSimRecoDigit * > *  digitlist,
WCSimRecoVertex vtx 
)

Definition at line 184 of file WCSimRingFinder.cc.

References WCSimHoughTransformArray::FindPeak(), fRingList, fUseVertex, WCSimRecoVertex::GetX(), WCSimRecoVertex::GetY(), WCSimRecoVertex::GetZ(), HoughTransformArray(), and Run().

{
  std::cout << " *** WCSimRingFinder::Run(...) *** " << std::endl;

  // override 
  // ========
  if( fUseVertex ){
    std::cout << "  --- reconstruct ring from vertex --- " << std::endl;
    return this->Run(myVertex);
  }

  // reset ring list
  // ===============  
  for( UInt_t i=0; i<fRingList->size(); i++ ){
    delete (WCSimRecoRing*)(fRingList->at(i));
  }
 
  // clear ring list
  // ===============
  fRingList->clear();

  // apply Hough Transform
  // =====================
  WCSimHoughTransformArray* myHoughTransformArray = (WCSimHoughTransformArray*)(this->HoughTransformArray(myDigitList,myVertex));
  
  // Find Hough Peak
  // ===============
  Double_t houghVtxX = myVertex->GetX();
  Double_t houghVtxY = myVertex->GetY();
  Double_t houghVtxZ = myVertex->GetZ();

  Double_t houghDirX = 0.0;
  Double_t houghDirY = 0.0;
  Double_t houghDirZ = 0.0;
  Double_t houghAngle = 0.0;
  Double_t houghHeight = 0.0;
 
  myHoughTransformArray->FindPeak(houghDirX,houghDirY,houghDirZ,
                                  houghAngle,houghHeight);
  
  // Make New Ring
  // =============
  std::cout << "  found new ring: (vx,vy,vz)=(" << houghVtxX << "," << houghVtxY << "," << houghVtxZ << ") " << std::endl
            << "                  (px,py,pz)=(" << houghDirX << "," << houghDirY << "," << houghDirZ << ") " << std::endl
            << "                   angle=" << houghAngle << " height=" << houghHeight << std::endl;

  WCSimRecoRing* myRing = new WCSimRecoRing(houghVtxX,houghVtxY,houghVtxZ,
                                            houghDirX,houghDirY,houghDirZ,
                                            houghAngle,houghHeight);

  fRingList->push_back(myRing);

  // Return Ring List
  // ================
  return fRingList;
}

void WCSimRingFinder::RunPrintParameters (  ) 

Definition at line 120 of file WCSimRingFinder.cc.

References fConeAngleBins, fConeAngleMax, fConeAngleMin, fHoughX, fHoughY, and fUseVertex.

Referenced by PrintParameters().

{
  std::cout << " *** WCSimRingFinder::PrintParameters() *** " << std::endl;

  std::cout << "  Ring Finder Parameters: " << std::endl
            << "   UseVertex = " << fUseVertex << std::endl
            << "   HoughX = " << fHoughX << std::endl
            << "   HoughY = " << fHoughY << std::endl
            << "   ConeAngleBins = " << fConeAngleBins << std::endl
            << "   ConeAngleMin = " << fConeAngleMin << std::endl
            << "   ConeAngleMax = " << fConeAngleMax << std::endl;

  return;
}

void WCSimRingFinder::SetConeAngleBins ( Int_t  bins  )  [inline]

Definition at line 35 of file WCSimRingFinder.hh.

References fConeAngleBins.

Referenced by ConeAngleBins().

{ fConeAngleBins = bins; }

void WCSimRingFinder::SetConeAngleMax ( Double_t  max  )  [inline]

Definition at line 37 of file WCSimRingFinder.hh.

References fConeAngleMax.

Referenced by ConeAngleMax().

{ fConeAngleMax = max; }

void WCSimRingFinder::SetConeAngleMin ( Double_t  min  )  [inline]

Definition at line 36 of file WCSimRingFinder.hh.

References fConeAngleMin.

Referenced by ConeAngleMin().

{ fConeAngleMin = min; }

void WCSimRingFinder::SetHoughPoints ( Int_t  n  )  [inline]

Definition at line 34 of file WCSimRingFinder.hh.

References fHoughPoints.

Referenced by HoughPoints().

{ fHoughPoints = n; }

void WCSimRingFinder::SetHoughX ( Int_t  x  )  [inline]

Definition at line 32 of file WCSimRingFinder.hh.

References fHoughX.

Referenced by HoughX().

{ fHoughX = x; }

void WCSimRingFinder::SetHoughY ( Int_t  y  )  [inline]

Definition at line 33 of file WCSimRingFinder.hh.

References fHoughY.

Referenced by HoughY().

{ fHoughY = y; }

void WCSimRingFinder::SetUsingRecoVertex (  )  [inline]

Definition at line 39 of file WCSimRingFinder.hh.

References fUseVertex.

Referenced by UseRecoVertex().

{ fUseVertex = 1; }

void WCSimRingFinder::UseRecoVertex (  )  [static]

Definition at line 37 of file WCSimRingFinder.cc.

References Instance(), and SetUsingRecoVertex().

Referenced by main().

Bool_t WCSimRingFinder::UsingRecoVertex (  )  [inline]

Definition at line 40 of file WCSimRingFinder.hh.

References fUseVertex.

{ return fUseVertex; }


Member Data Documentation

Double_t WCSimRingFinder::fConeAngleMax [private]
Double_t WCSimRingFinder::fConeAngleMin [private]

Definition at line 74 of file WCSimRingFinder.hh.

Referenced by HoughTransform(), WCSimRingFinder(), and ~WCSimRingFinder().

Definition at line 77 of file WCSimRingFinder.hh.

Referenced by HoughTransformArray(), WCSimRingFinder(), and ~WCSimRingFinder().

Int_t WCSimRingFinder::fHoughX [private]
Int_t WCSimRingFinder::fHoughY [private]
std::vector<WCSimRecoRing*>* WCSimRingFinder::fRingList [private]

Definition at line 80 of file WCSimRingFinder.hh.

Referenced by Run(), WCSimRingFinder(), and ~WCSimRingFinder().

Bool_t WCSimRingFinder::fUseVertex [private]

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