HoughViewSR Class Reference

#include <HoughViewSR.h>

List of all members.

Public Member Functions

 HoughViewSR ()
 HoughViewSR (TObjArray candclusterhandlelist)
 ~HoughViewSR ()
Double_t GetX0 ()
Double_t GetZ0 ()
const HoughTrackSRGetHoughTrack (Int_t)
Int_t GetNPeak () const
Int_t GetNTrack () const
Int_t GetLargestTrackIndex () const
void SetPeakMin (Int_t)
void SetPeakMinFrac (Double_t)
void SetPeakMinFracZoom (Double_t)
void SetMinInterBinSize (Double_t)
void SetClusterList (TObjArray candclusterlist)
void SetClusterList (TObjArray *candclusterlist, Double_t minPulseHeight)
Int_t Iterate (Int_t imode=0)
void Print (Option_t *option="") const

Private Member Functions

void Init ()
Int_t IterateSingle ()

Private Attributes

Double_t fXZmean [2]
Double_t fXZrms [2]
TObjArray * fClusterList
Int_t fPeakMin
Double_t fPeakMinFrac
Double_t fPeakMinFracZoom
Double_t fMinInterBinSize
TObjArray fHoughTrackList

Detailed Description

Definition at line 23 of file HoughViewSR.h.


Constructor & Destructor Documentation

HoughViewSR::HoughViewSR (  ) 

Definition at line 38 of file HoughViewSR.cxx.

References fMinInterBinSize, fPeakMin, fPeakMinFrac, and fPeakMinFracZoom.

00039 {
00040  // set default values for hough fitter parameters.
00041   // these get reset by AlgTrackSRList 
00042   fPeakMin = 4;
00043   fPeakMinFrac = .5;
00044   fPeakMinFracZoom = .75;
00045   fMinInterBinSize = 0.02;
00046 }

HoughViewSR::HoughViewSR ( TObjArray  candclusterhandlelist  ) 

Definition at line 25 of file HoughViewSR.cxx.

00026 {
00027   // set default values for hough fitter parameters.
00028   // these get reset by AlgTrackSRList
00029   fPeakMin = 4;
00030   fPeakMinFrac = .25;
00031   fPeakMinFracZoom = .75;
00032   fMinInterBinSize = 0.02;
00033   fClusterList = new TObjArray(clusterlist);
00034   Init();
00035 }

HoughViewSR::~HoughViewSR (  ) 

Definition at line 49 of file HoughViewSR.cxx.

References fClusterList, and fHoughTrackList.

00050 {
00051   if (fClusterList) {
00052     delete fClusterList;
00053   }
00054   for (Int_t i=0; i<=fHoughTrackList.GetLast(); i++) {
00055     HoughTrackSR *htrack = dynamic_cast<HoughTrackSR*>(fHoughTrackList.At(i));
00056     if (htrack) delete htrack;
00057   }
00058 }


Member Function Documentation

const HoughTrackSR * HoughViewSR::GetHoughTrack ( Int_t  itrack  ) 

Definition at line 305 of file HoughViewSR.cxx.

References fHoughTrackList.

Referenced by AlgTrackSRList::RunAlg().

00306 {
00307   if (itrack<=fHoughTrackList.GetLast()) {
00308     const HoughTrackSR *houghtrack = dynamic_cast<const HoughTrackSR*>(fHoughTrackList.At(itrack));
00309     return houghtrack;
00310   }
00311   else {
00312     return 0;
00313   }
00314 }

Int_t HoughViewSR::GetLargestTrackIndex (  )  const

Definition at line 317 of file HoughViewSR.cxx.

References fHoughTrackList, HoughTrackSR::GetLargestPeakIndex(), and HoughTrackSR::GetPeakBin().

Referenced by AlgTrackSRList::RunAlg().

00318 {
00319   Int_t itrack = -9999;
00320   Int_t nmaxbin = 0;
00321   for (Int_t i=0; i<=fHoughTrackList.GetLast(); ++i) {
00322     const HoughTrackSR *houghtrack = dynamic_cast<const HoughTrackSR*>(fHoughTrackList.At(i));
00323     if (houghtrack->GetPeakBin(houghtrack->GetLargestPeakIndex())>nmaxbin) {
00324       nmaxbin = houghtrack->GetPeakBin(houghtrack->GetLargestPeakIndex());
00325       itrack = i;
00326     }
00327   }
00328   return itrack;
00329 }

Int_t HoughViewSR::GetNPeak (  )  const

Definition at line 294 of file HoughViewSR.cxx.

References fHoughTrackList, and HoughTrackSR::GetNPeak().

00295 {
00296   Int_t npeak = 0;
00297   for (Int_t i=0; i<=fHoughTrackList.GetLast(); ++i) {
00298     const HoughTrackSR *houghtrack = dynamic_cast<const HoughTrackSR*>(fHoughTrackList.At(i));
00299     npeak += houghtrack->GetNPeak();
00300   }
00301   return npeak;
00302 }

Int_t HoughViewSR::GetNTrack (  )  const

Definition at line 288 of file HoughViewSR.cxx.

References fHoughTrackList.

Referenced by AlgTrackSRList::RunAlg().

00289 {
00290   return fHoughTrackList.GetLast()+1;
00291 }

Double_t HoughViewSR::GetX0 (  ) 

Definition at line 276 of file HoughViewSR.cxx.

References fXZmean.

00277 {
00278   return fXZmean[0];
00279 }

Double_t HoughViewSR::GetZ0 (  ) 

Definition at line 282 of file HoughViewSR.cxx.

References fXZmean.

00283 {
00284   return fXZmean[1];
00285 }

void HoughViewSR::Init ( void   )  [private]

Definition at line 97 of file HoughViewSR.cxx.

References fClusterList, fHoughTrackList, fPeakMin, fPeakMinFrac, fPeakMinFracZoom, fXZmean, fXZrms, TrackClusterSR::GetTPos(), TrackClusterSR::GetZPos(), HoughTrackSR::Iterate(), HoughTrackSR::SetMaxBin(), HoughTrackSR::SetMinInterBinSize(), HoughTrackSR::SetPeakMin(), HoughTrackSR::SetPeakMinFrac(), HoughTrackSR::SetPeakMinFracZoom(), HoughTrackSR::SetX0(), HoughTrackSR::SetXRMS(), HoughTrackSR::SetZ0(), and HoughTrackSR::SetZRMS().

Referenced by SetClusterList().

00098 {
00099   fXZmean[0] = 0.;
00100   fXZmean[1] = 0.;
00101   fXZrms[0] = 0.;
00102   fXZrms[1] = 0.;
00103  // reduce requirement for min peak height for < 5 track clusters 
00104   if(fClusterList->GetLast()<4)fPeakMin=3;
00105   int ncluster=0;
00106   for (int i=0; i<=fClusterList->GetLast(); ++i) {
00107     TrackClusterSR *cluster = dynamic_cast<TrackClusterSR*>(fClusterList->At(i));
00108     
00109     Double_t tpos = cluster->GetTPos();
00110     Double_t zpos = cluster->GetZPos();
00111     ++ncluster;
00112     fXZmean[0] += tpos;
00113     fXZrms[0] += tpos*tpos;
00114     fXZmean[1] += zpos;
00115     fXZrms[1] += zpos*zpos;
00116   }
00117   if (ncluster) {
00118     fXZmean[0] /= (Double_t)ncluster;
00119     fXZmean[1] /= (Double_t)ncluster;
00120     fXZrms[0] /= (Double_t)ncluster;
00121     fXZrms[1] /= (Double_t)ncluster;
00122     fXZrms[0] -= fXZmean[0]*fXZmean[0];
00123     if (fXZrms[0]>0.) {
00124       fXZrms[0] = sqrt(fXZrms[0]);
00125     }
00126     else {
00127       fXZrms[0] = 0.;
00128     }
00129     fXZrms[1] -= fXZmean[1]*fXZmean[1];
00130     if (fXZrms[1]>0.) {
00131       fXZrms[1] = sqrt(fXZrms[1]);
00132     }
00133     else {
00134       fXZrms[1] = 0.;
00135     }
00136   }
00137   HoughTrackSR *houghtrack = new HoughTrackSR(*fClusterList);
00138   houghtrack->SetX0(fXZmean[0]);
00139   houghtrack->SetZ0(fXZmean[1]);
00140   houghtrack->SetXRMS(fXZrms[0]);
00141   houghtrack->SetZRMS(fXZrms[1]);
00142   houghtrack->SetPeakMin(fPeakMin);
00143   houghtrack->SetPeakMinFrac(fPeakMinFrac);
00144   houghtrack->SetPeakMinFracZoom(fPeakMinFracZoom);
00145   houghtrack->SetMinInterBinSize(fPeakMinFracZoom);
00146   houghtrack->SetMaxBin(40);
00147   //  if(fClusterList->GetLast()<10) houghtrack->SetMaxBin(20);
00148   houghtrack->Iterate();
00149   fHoughTrackList.Add(houghtrack);
00150   
00151 }

Int_t HoughViewSR::Iterate ( Int_t  imode = 0  ) 

Definition at line 164 of file HoughViewSR.cxx.

References IterateSingle(), Msg::kDebug, and MSG.

Referenced by AlgTrackSRList::RunAlg().

00165 {
00166 
00167   //imode<=0: max # iterations = 20
00168   //imode>0: max # iterations = imode
00169   if (imode<=0) {
00170     Int_t niterate=0;
00171     Int_t icount=0;
00172     do {
00173       MSG("TrackSR",Msg::kDebug) << "ITERATING " << icount << "\n";
00174       niterate = IterateSingle();
00175       ++icount;
00176     } while (niterate && icount<20);
00177     return icount;
00178   }
00179   else {
00180     Int_t niterate=0;
00181     for (Int_t i=0; i<imode; ++i) {
00182       niterate = IterateSingle();
00183     }
00184     return niterate;
00185   }
00186 }

Int_t HoughViewSR::IterateSingle (  )  [private]

Definition at line 189 of file HoughViewSR.cxx.

References fHoughTrackList, fMinInterBinSize, HoughTrackSR::GetInterceptMax(), HoughTrackSR::GetInterceptMin(), HoughTrackSR::GetNBin(), HoughTrackSR::GetNPeak(), HoughTrackSR::Iterate(), Msg::kDebug, and MSG.

Referenced by Iterate().

00190 {
00191   MSG("TrackSR",Msg::kDebug) << "begin IterateSingle\n";
00192   TObjArray tracklist;
00193   Int_t niterate=0;
00194  
00195   for (Int_t i=0; i<=fHoughTrackList.GetLast(); ++i) {
00196     MSG("TrackSR",Msg::kDebug) << "TRACK " << i << "/" << fHoughTrackList.GetLast() << "\n";
00197     HoughTrackSR *houghtrack = dynamic_cast<HoughTrackSR*>(fHoughTrackList.At(i));
00198     MSG("TrackSR",Msg::kDebug) << "OLD\n"; 
00199     //            houghtrack->Print();
00200     HoughTrackSR *oldHT = 0;
00201     if (houghtrack->GetNPeak()>0 && houghtrack->GetInterceptMax()-houghtrack->GetInterceptMin()>fMinInterBinSize*(Double_t)houghtrack->GetNBin()) {
00202       oldHT = new HoughTrackSR(*houghtrack);
00203       TObjArray newlist(houghtrack->Iterate());
00204       for (Int_t i=0; i<=newlist.GetLast(); ++i) {
00205         HoughTrackSR *htrack = dynamic_cast<HoughTrackSR*>(newlist.At(i));
00206         MSG("TrackSR",Msg::kDebug) << "newly created " << i << "\n";
00207         //      htrack->Print();
00208         if (htrack->GetNPeak()>0) {
00209           fHoughTrackList.Add(htrack);
00210           MSG("TrackSR",Msg::kDebug) << "adding to list\n";
00211         }
00212         else {
00213           delete htrack;
00214         }
00215       }
00216       MSG("TrackSR",Msg::kDebug) << "NEW\n";
00217       //   houghtrack->Print();
00218       if (houghtrack->GetNPeak()>0) {
00219         ++niterate;
00220         delete oldHT;
00221       }
00222       else if (newlist.GetLast()<0) {
00223         delete houghtrack;
00224         houghtrack = oldHT;
00225         MSG("TrackSR",Msg::kDebug) << "NO PEAKS, REVERTING BACK\n";
00226       }
00227       else {
00228         delete oldHT;
00229       }
00230     }
00231     if (houghtrack->GetNPeak()>0) {
00232       tracklist.Add(houghtrack);
00233     }
00234     else {
00235       delete houghtrack;
00236     }
00237     MSG("TrackSR",Msg::kDebug) << "tracklist size " << tracklist.GetLast() << "\n";
00238   }
00239   MSG("TrackSR",Msg::kDebug) << "clearing houghtracklist\n";
00240   fHoughTrackList.Clear();
00241   fHoughTrackList.Compress();
00242   for (Int_t i=0; i<=tracklist.GetLast(); ++i) {
00243   MSG("TrackSR",Msg::kDebug) << "adding to houghtracklist " << i << "/" << tracklist.GetLast() << "\n";
00244     HoughTrackSR *htrack = dynamic_cast<HoughTrackSR*>(tracklist.At(i));
00245     fHoughTrackList.Add(htrack);
00246   }
00247   MSG("TrackSR",Msg::kDebug) << "end iteratesingle\n";
00248   return niterate;
00249 }

void HoughViewSR::Print ( Option_t *  option = ""  )  const

Definition at line 154 of file HoughViewSR.cxx.

References fHoughTrackList, and HoughTrackSR::Print().

00155 {
00156   for (Int_t i=0; i<=fHoughTrackList.GetLast(); i++) {
00157     HoughTrackSR *houghtrack = dynamic_cast<HoughTrackSR*>(fHoughTrackList.At(i));
00158     cout << "**************************** TRACK " << i << "/" << fHoughTrackList.GetLast() << " ****************************\n\n";
00159     houghtrack->Print();
00160   }
00161 }

void HoughViewSR::SetClusterList ( TObjArray *  candclusterlist,
Double_t  minPulseHeight 
)

Definition at line 68 of file HoughViewSR.cxx.

References fClusterList, TrackClusterSR::GetCharge(), TrackClusterSR::GetMaxStrip(), TrackClusterSR::GetMinStrip(), TrackClusterSR::GetPlane(), Init(), Msg::kDebug, and MSG.

00069 {
00070   fClusterList = new TObjArray(1,0);
00071 
00072  for (Int_t i=0; i<=clusterlist->GetLast(); i++) {
00073     TrackClusterSR *cluster = dynamic_cast<TrackClusterSR*>(clusterlist->At(i)); 
00074     if(cluster->GetCharge()>minPulseHeight){
00075       
00076       //loop over the cluster list and look to see if there is a cluster from
00077       //this clusters plane already in the list.  if so, check to see if the 
00078       //current cluster has a larger signal and if it does replace the one in the
00079       //list with the current cluster
00080       fClusterList->AddLast(cluster);
00081       
00082       MSG("TrackSR", Msg::kDebug) << "plane " << cluster->GetPlane() << " cluster " 
00083                                   <<  cluster->GetMaxStrip() << " - " << cluster->GetMinStrip() << endl;
00084     }
00085   }
00086   
00087   MSG("TrackSR", Msg::kDebug) << fClusterList->GetLast()+1 
00088                               << " clusters in the HoughView" << endl;
00089   Init();
00090 
00091 
00092 }

void HoughViewSR::SetClusterList ( TObjArray  candclusterlist  ) 

Definition at line 60 of file HoughViewSR.cxx.

References fClusterList, and Init().

Referenced by AlgTrackSRList::RunAlg().

00061 {
00062   fClusterList = new TObjArray(clusterlist);
00063   Init();
00064 
00065 }

void HoughViewSR::SetMinInterBinSize ( Double_t  frac  ) 

Definition at line 270 of file HoughViewSR.cxx.

References fMinInterBinSize.

Referenced by AlgTrackSRList::RunAlg().

00271 {
00272   fMinInterBinSize = frac;
00273 }

void HoughViewSR::SetPeakMin ( Int_t  nbin  ) 

Definition at line 252 of file HoughViewSR.cxx.

References fPeakMin.

Referenced by AlgTrackSRList::RunAlg().

00253 {
00254   fPeakMin = nbin;
00255 }

void HoughViewSR::SetPeakMinFrac ( Double_t  frac  ) 

Definition at line 258 of file HoughViewSR.cxx.

References fPeakMinFrac.

Referenced by AlgTrackSRList::RunAlg().

00259 {
00260   fPeakMinFrac = frac;
00261 }

void HoughViewSR::SetPeakMinFracZoom ( Double_t  frac  ) 

Definition at line 264 of file HoughViewSR.cxx.

References fPeakMinFracZoom.

Referenced by AlgTrackSRList::RunAlg().

00265 {
00266   fPeakMinFracZoom = frac;
00267 }


Member Data Documentation

TObjArray* HoughViewSR::fClusterList [private]

Definition at line 59 of file HoughViewSR.h.

Referenced by Init(), SetClusterList(), and ~HoughViewSR().

TObjArray HoughViewSR::fHoughTrackList [private]
Double_t HoughViewSR::fMinInterBinSize [private]

Definition at line 64 of file HoughViewSR.h.

Referenced by HoughViewSR(), IterateSingle(), and SetMinInterBinSize().

Int_t HoughViewSR::fPeakMin [private]

Definition at line 61 of file HoughViewSR.h.

Referenced by HoughViewSR(), Init(), and SetPeakMin().

Double_t HoughViewSR::fPeakMinFrac [private]

Definition at line 62 of file HoughViewSR.h.

Referenced by HoughViewSR(), Init(), and SetPeakMinFrac().

Double_t HoughViewSR::fPeakMinFracZoom [private]

Definition at line 63 of file HoughViewSR.h.

Referenced by HoughViewSR(), Init(), and SetPeakMinFracZoom().

Double_t HoughViewSR::fXZmean[2] [private]

Definition at line 57 of file HoughViewSR.h.

Referenced by GetX0(), GetZ0(), and Init().

Double_t HoughViewSR::fXZrms[2] [private]

Definition at line 58 of file HoughViewSR.h.

Referenced by Init().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1