#include <HoughTrackSR.h>
Public Member Functions | |
| HoughTrackSR () | |
| HoughTrackSR (TObjArray candclusterhandlelist) | |
| HoughTrackSR (const HoughTrackSR &) | |
| ~HoughTrackSR () | |
| void | SetX0 (Double_t) |
| void | SetZ0 (Double_t) |
| void | SetXRMS (Double_t) |
| void | SetZRMS (Double_t) |
| void | SetSlopeMin (Double_t) |
| void | SetSlopeMax (Double_t) |
| void | SetInterceptMin (Double_t) |
| void | SetInterceptMax (Double_t) |
| Double_t | GetSlopeMin () const |
| Double_t | GetSlopeMax () const |
| Double_t | GetInterceptMin () const |
| Double_t | GetInterceptMax () const |
| Int_t | GetNBin () const |
| Int_t | GetNPeak () const |
| Int_t | GetMaxBin () |
| void | SetMaxBin (Int_t i) |
| Double_t | GetPeakSlope (Int_t=0) const |
| Double_t | GetPeakIntercept (Int_t=0) const |
| Int_t | GetPeakBin (Int_t=0) const |
| Int_t | GetLargestPeakIndex () const |
| void | SetPeakMin (Int_t) |
| void | SetPeakMinFrac (Double_t) |
| void | SetPeakMinFracZoom (Double_t) |
| void | SetMinInterBinSize (Double_t) |
| void | SetClusterList (TObjArray candclusterhandlelist) |
| TObjArray | Iterate () |
| void | Print (Option_t *option="") const |
Private Member Functions | |
| void | FillHough () |
| Double_t | GetSlope (Int_t) const |
| Double_t | GetInter (Int_t) const |
Private Attributes | |
| Int_t | fMaxBin |
| Double_t | fXZmean [2] |
| Double_t | fXZrms [2] |
| Double_t | fSlopeLim [2] |
| Double_t | fInterLim [2] |
| Double_t | fDSlope |
| Double_t | fDInter |
| TObjArray * | fClusterList |
| Int_t | fPeakMin |
| Double_t | fPeakMinFrac |
| Double_t | fPeakMinFracZoom |
| Double_t | fMinInterBinSize |
| Int_t | fNBinMax |
| Int_t | fNBinCut |
| Int_t | fHough [fNBin][fNBin] |
| Int_t | fMaxHoughBin [fNBin][fNBin][2] |
| Int_t | fNPeak |
| Int_t | fNMaxima |
| Bool_t | fFillHough |
| vector< Int_t > | fMPeak |
| vector< Int_t > | fCPeak |
| vector< Int_t > | fIPeak |
| vector< Double_t > | fSlopePeak |
Static Private Attributes | |
| const Int_t | fNBin = 40 |
|
|
Definition at line 83 of file HoughTrackSR.cxx. References fFillHough, fInterLim, fMaxBin, fMinInterBinSize, fPeakMin, fPeakMinFrac, fPeakMinFracZoom, and fSlopeLim. Referenced by Iterate(). 00084 {
00085 fSlopeLim[0] = -20.;
00086 fSlopeLim[1] = 21.;
00087 fInterLim[0] = -10.;
00088 fInterLim[1] = 11.;
00089 fMaxBin=40;
00090 fPeakMin = 4;
00091 fPeakMinFrac = .5;
00092 fPeakMinFracZoom = .75;
00093 fMinInterBinSize = .02;
00094 fFillHough = kFALSE;
00095 }
|
|
|
Definition at line 25 of file HoughTrackSR.cxx. 00026 {
00027 fSlopeLim[0] = -20.;
00028 fSlopeLim[1] = 21.;
00029 fInterLim[0] = -10.;
00030 fInterLim[1] = 11.;
00031 fMaxBin=40;
00032 fPeakMin = 4;
00033 fPeakMinFrac = .25;
00034 fPeakMinFracZoom = .75;
00035 fMinInterBinSize = .02;
00036 fClusterList = new TObjArray(clusterlist);
00037 fFillHough = kFALSE;
00038 }
|
|
|
Definition at line 40 of file HoughTrackSR.cxx. References fClusterList, fCPeak, fDInter, fDSlope, fFillHough, fHough, fInterLim, fIPeak, fMaxBin, fMaxHoughBin, fMinInterBinSize, fMPeak, fNBinCut, fNBinMax, fNMaxima, fNPeak, fPeakMin, fPeakMinFrac, fPeakMinFracZoom, fSlopeLim, fSlopePeak, fXZmean, and fXZrms. 00040 : TObject(oldHT)
00041 {
00042 fSlopeLim[0] = oldHT.fSlopeLim[0];
00043 fSlopeLim[1] = oldHT.fSlopeLim[1];
00044 fInterLim[0] = oldHT.fInterLim[0];
00045 fInterLim[1] = oldHT.fInterLim[1];
00046 fPeakMin = oldHT.fPeakMin;
00047 fPeakMinFrac = oldHT.fPeakMinFrac;
00048 fPeakMinFracZoom = oldHT.fPeakMinFracZoom;
00049 fMinInterBinSize = oldHT.fMinInterBinSize;
00050 fClusterList = new TObjArray(*(oldHT.fClusterList));
00051 fFillHough = oldHT.fFillHough;
00052
00053 fXZmean[0] = oldHT.fXZmean[0];
00054 fXZmean[1] = oldHT.fXZmean[1];
00055 fXZrms[0] = oldHT.fXZrms[0];
00056 fXZrms[1] = oldHT.fXZrms[1];
00057 fDSlope = oldHT.fDSlope;
00058 fDInter = oldHT.fDInter;
00059 fMaxBin = oldHT.fMaxBin;
00060 fNBinMax = oldHT.fNBinMax;
00061 fNBinCut = oldHT.fNBinCut;
00062
00063 for (Int_t im=0; im<fNBin; im++) {
00064 for (Int_t ic=0; ic<fNBin; ic++) {
00065 fHough[im][ic] = oldHT.fHough[im][ic];
00066 fMaxHoughBin[im][ic][0] = oldHT.fMaxHoughBin[im][ic][0];
00067 fMaxHoughBin[im][ic][1] = oldHT.fMaxHoughBin[im][ic][1];
00068 }
00069 }
00070
00071 fNPeak = oldHT.fNPeak;
00072 fNMaxima = oldHT.fNMaxima;
00073
00074 for (Int_t i=0; i<fNMaxima; i++) {
00075 fMPeak.push_back(oldHT.fMPeak[i]);
00076 fCPeak.push_back(oldHT.fCPeak[i]);
00077 fIPeak.push_back(oldHT.fIPeak[i]);
00078 fSlopePeak.push_back(oldHT.fSlopePeak[i]);
00079 }
00080
00081 }
|
|
|
Definition at line 97 of file HoughTrackSR.cxx. 00098 {
00099 if (fClusterList) {
00100 delete fClusterList;
00101 }
00102 }
|
|
|
Definition at line 109 of file HoughTrackSR.cxx. References abs(), fClusterList, fCPeak, fDInter, fDSlope, fFillHough, fHough, fInterLim, fIPeak, fMaxHoughBin, fMPeak, fNBin, fNBinMax, fNMaxima, fNPeak, fPeakMin, fSlopeLim, fSlopePeak, fXZmean, TrackClusterSR::GetTPos(), TrackClusterSR::GetZPos(), min, and LinearFit::Weighted(). Referenced by Iterate(). 00110 {
00111 fFillHough = kTRUE;
00112
00113 fDSlope = fSlopeLim[1]-fSlopeLim[0];
00114 fDInter = fInterLim[1]-fInterLim[0];
00115 for (int im=0; im<fMaxBin; im++) {
00116 for (int ic=0; ic<fMaxBin; ic++) {
00117 fHough[im][ic] = 0;
00118 }
00119 }
00120 fMPeak.erase(fMPeak.begin(),fMPeak.end());
00121 fCPeak.erase(fCPeak.begin(),fCPeak.end());
00122 fIPeak.erase(fIPeak.begin(),fIPeak.end());
00123 fSlopePeak.erase(fSlopePeak.begin(),fSlopePeak.end());
00124 for (int i=0; i<=fClusterList->GetLast(); i++) {
00125 TrackClusterSR *cluster = dynamic_cast<TrackClusterSR*>(fClusterList->At(i));
00126 if (cluster) {
00127 for (int im=0; im<fMaxBin; im++) {
00128 Double_t slope = (Double_t)(im+.5)/(Double_t)fMaxBin*fDSlope+fSlopeLim[0];
00129 Double_t inter = cluster->GetTPos()-fXZmean[0]-slope*(cluster->GetZPos()-fXZmean[1]);
00130 int ic=-1;
00131 if(fDInter!=0){
00132 ic = (int)((inter-fInterLim[0])/fDInter*fMaxBin+.5);
00133 }
00134 if (ic>=0 && ic<fMaxBin) {
00135 fHough[im][ic]++;
00136 }
00137 }
00138 }
00139 }
00140 // find maximum bin
00141 fNBinMax = 0;
00142 fNPeak = 0;
00143 fNMaxima = 0;
00144 for (int im=0; im<fMaxBin; im++) {
00145 for (int ic=0; ic<fMaxBin; ic++) {
00146 if (fHough[im][ic]>fNBinMax) {
00147 fNBinMax = fHough[im][ic];
00148 }
00149 Int_t nmax = fHough[im][ic];
00150 Int_t nmin=10000;
00151 Int_t immax = 0;
00152 Int_t icmax = 0;
00153 for (int im1=-3; im1<=3; im1++) {
00154 for (int ic1=-3; ic1<=3; ic1++) {
00155 if (im+im1>=0 && im+im1<fNBin && ic+ic1>=0 && ic+ic1<fMaxBin && fHough[im+im1][ic+ic1]>nmax) {
00156 nmax = fHough[im+im1][ic+ic1];
00157 immax = im1;
00158 icmax = ic1;
00159 }
00160 if (im+im1>=0 && im+im1<fMaxBin && ic+ic1>=0 && ic+ic1<fMaxBin && fHough[im+im1][ic+ic1]<nmin) nmin=fHough[im+im1][ic+ic1];
00161 }
00162 }
00163 if((nmax-nmin)<fPeakMin){
00164 immax=-40;
00165 icmax=-40;
00166 }
00167 fMaxHoughBin[im][ic][0] = immax;
00168 fMaxHoughBin[im][ic][1] = icmax;
00169 }
00170 }
00171 /*
00172 MSG("HoughTrackSR", Msg::kInfo) << " MAX -----";
00173 for (int ic=0; ic<fMaxBin; ic++) {
00174 MSG("HoughTrackSR", Msg::kInfo) << "---";
00175 }
00176 MSG("HoughTrackSR", Msg::kInfo) << "\n";
00177 for (int im=0; im<fMaxBin; im++) {
00178 printf("%2d | ",im);
00179 for (int ic=0; ic<fMaxBin; ic++) {
00180 printf("%2d/%2d ",fMaxHoughBin[im][ic][0],fMaxHoughBin[im][ic][1] );
00181 }
00182 MSG("HoughTrackSR", Msg::kInfo) << "\n";
00183 }
00184 */
00185
00186 // find peak(s)
00187 Int_t nmuon = 0;
00188 Int_t imaxpeak = 0;
00189 for (int im=0; im<fMaxBin; im++) {
00190 for (int ic=0; ic<fMaxBin; ic++) {
00191 if (fHough[im][ic]>=fPeakMin && fMaxHoughBin[im][ic][0]==0 && fMaxHoughBin[im][ic][1]==0) {
00192 int ifound = 0;
00193 for (int imaxima=0; imaxima<fNMaxima; imaxima++) {
00194 if (abs(fMPeak[imaxima]-im)<=3 && abs(fCPeak[imaxima]-ic)<=3) {
00195 if (!ifound) {
00196 ifound = fIPeak[imaxima];
00197 }
00198 else if (ifound!=fIPeak[imaxima]) {
00199 for (int jmaxima=0; jmaxima<fNMaxima; jmaxima++) {
00200 if (fIPeak[jmaxima]==fIPeak[imaxima]) {
00201 fIPeak[jmaxima] = ifound;
00202 }
00203 }
00204 }
00205 }
00206 }
00207
00208 fMPeak.push_back(im);
00209 fCPeak.push_back(ic);
00210 if (ifound) {
00211 fIPeak.push_back(ifound);
00212 }
00213 else {
00214 nmuon++;
00215 fIPeak.push_back(nmuon);
00216 }
00217 if (!fNMaxima || fHough[im][ic]==fNBinMax) {
00218 imaxpeak = fNMaxima;
00219 }
00220 fNMaxima++;
00221 }
00222 }
00223 }
00224 // calculate slope in hough space
00225 for (int i=0; i<fNMaxima; i++) {
00226 int ic = fCPeak[i];
00227 Double_t xhough[7] = {-3.,-2.,-1.,0.,1.,2.,3.};
00228 Double_t yhough[7] = {0.,0.,0.,0.,0.,0.,0.};
00229 Double_t whough[7] = {0.,0.,0.,0.,0.,0.,0.};
00230 Int_t ncexist=0;
00231 for (int ic1=-3; ic1<=3; ic1++) {
00232 if (ic+ic1>=0 && ic+ic1<fMaxBin) {
00233 for (int im1=0; im1<fMaxBin; im1++) {
00234 yhough[ic1+3] += (Double_t)(im1*fHough[im1][ic+ic1]);
00235 whough[ic1+3] += (Double_t)(fHough[im1][ic+ic1]);
00236 }
00237 }
00238 if (whough[ic1+3]>0.) {
00239 yhough[ic1+3] /= whough[ic1+3];
00240 ncexist++;
00241 }
00242 }
00243 if (ncexist>1) {
00244 Double_t parm[2];
00245 LinearFit::Weighted(7,xhough,yhough,whough,parm);
00246 fSlopePeak.push_back(parm[1]);
00247 } else {
00248 fSlopePeak.push_back(99999.); // no nearby peaks, set to non physical number so that it does not match any other peaks
00249 }
00250 }
00251
00252
00253
00254 // match local maxima, and remove those below threshold
00255 for (int i=0; i<fNMaxima; i++) {
00256 for (int j=0; j<fNMaxima; j++) {
00257 if (i!=j) {
00258 int avec = (fCPeak[j] + fCPeak[i])/2;
00259 int avem = (fMPeak[j] + fMPeak[i])/2;
00260 Double_t peakisum = 0;
00261 Double_t peakjsum = 0;
00262 Double_t valleysum = 0;
00263 for (int ij=-1;ij<=1;ij++){
00264 for (int ik=-1;ik<=1;ik++){
00265 if(fMPeak[i]+ij>=0 && fMPeak[i]+ij<fMaxBin && fCPeak[i]+ik>=0 && fCPeak[i]+ik<fMaxBin) peakisum += fHough[fMPeak[i]+ij][fCPeak[i]+ik];
00266 if(fMPeak[j]+ij>=0 && fMPeak[j]+ij<fMaxBin && fCPeak[j]+ik>=0 && fCPeak[j]+ik<fMaxBin) peakjsum +=fHough[fMPeak[j]+ij][fCPeak[j]+ik];
00267 if(avem+ij>=0 && avem+ij<fMaxBin && avec+ik>=0 && avec+ik<fMaxBin) valleysum += fHough[avem+ij][avec+ik];
00268 }
00269 }
00270 Double_t minpeak = min(peakisum,peakjsum);
00271 Double_t threshold = 2 * valleysum + fPeakMin;
00272 if(valleysum>10) threshold = valleysum + 2.* TMath::Sqrt(valleysum);
00273 // cout << i << " " << j << " " << avem << " " << avec << " " << peakisum << " " << peakjsum << " " << valleysum << endl;
00274 if(minpeak<threshold){
00275 // cout << "remove " << endl;
00276 if(peakisum<peakjsum)fIPeak[i]=-1;
00277 else fIPeak[j]=-1;
00278 }
00279
00280
00281 }
00282 }
00283 }
00284
00285 // remove all peaks that are shorter than 20% of longest
00286 for (int i=0; i<fNMaxima; i++) {
00287 if(fHough[fMPeak[i]][fCPeak[i]]<0.2*fNBinMax)fIPeak[i]=-1;
00288
00289 }
00290 // require slopes to be within +-3 bins of maximum peak (this only seems to make sense for cosmics)
00291 /*
00292 for (int i=0; i<fNMaxima; i++) {
00293 if (i!=imaxpeak && abs(fMPeak[i]-fMPeak[imaxpeak])>3) {
00294 fIPeak[i] = -1;
00295 }
00296 }
00297 */
00298
00299 int muonmult[fNBin*fNBin+1];
00300 for (int i=0; i<=fNBin*fNBin; i++) {
00301 muonmult[i] = 0;
00302 }
00303 for (int i=0; i<fNMaxima; i++) {
00304 if (fIPeak[i]>=0) {
00305 muonmult[fIPeak[i]] = 1;
00306 }
00307 }
00308 for (int i=0; i<=fMaxBin*fMaxBin; i++) {
00309 fNPeak += muonmult[i];
00310 }
00311 }
|
|
|
Definition at line 720 of file HoughTrackSR.cxx. References fCPeak, fHough, fMaxBin, fMPeak, and fSlopePeak. Referenced by Iterate(), and Print(). 00721 {
00722 Int_t impeak = fMPeak[i];
00723 Int_t icpeak = fCPeak[i];
00724 Int_t nentry = fHough[impeak][icpeak];
00725 Int_t found=1;
00726 Int_t nskip=0;
00727 Int_t nfound = 0;
00728 Double_t mpeak = 0.;
00729 Double_t cpeak = 0.;
00730 for (Int_t ic1=icpeak-1; ic1>=0 && nskip<2; ic1--) {
00731 found = 0;
00732 Int_t im1 = (Int_t)((ic1-icpeak)*fSlopePeak[i]+.5)+impeak;
00733 for (Int_t im2=-3; im2<=3; im2++) {
00734 if (im1+im2>=0 && im1+im2<fMaxBin && fHough[im1+im2][ic1]==nentry) {
00735 found = 1;
00736 nfound++;
00737 mpeak += (Double_t)(im1+im2);
00738 cpeak += (Double_t)(ic1);
00739 }
00740 }
00741 if (!found) {
00742 nskip++;
00743 }
00744 else {
00745 nskip = 0;
00746 }
00747 }
00748 found=1;
00749 nskip=0;
00750 for (Int_t ic1=icpeak; ic1<fMaxBin && nskip<2; ic1++) {
00751 found = 0;
00752 Int_t im1 = (Int_t)((ic1-icpeak)*fSlopePeak[i]+.5)+impeak;
00753 for (Int_t im2=-3; im2<=3; im2++) {
00754 if (im1+im2>=0 && im1+im2<fMaxBin && fHough[im1+im2][ic1]==nentry) {
00755 found = 1;
00756 nfound++;
00757 mpeak += (Double_t)(im1+im2);
00758 cpeak += (Double_t)(ic1);
00759 }
00760 }
00761 if (!found) {
00762 nskip++;
00763 }
00764 else {
00765 nskip = 0;
00766 }
00767 }
00768 if (!nfound) return -1.;
00769 mpeak /= (Double_t)nfound;
00770 cpeak /= (Double_t)nfound;
00771 return cpeak;
00772 }
|
|
|
Definition at line 559 of file HoughTrackSR.cxx. References fInterLim. Referenced by HoughViewSR::IterateSingle(). 00560 {
00561 return fInterLim[1];
00562 }
|
|
|
Definition at line 554 of file HoughTrackSR.cxx. References fInterLim. Referenced by HoughViewSR::IterateSingle(). 00555 {
00556 return fInterLim[0];
00557 }
|
|
|
Definition at line 649 of file HoughTrackSR.cxx. References fCPeak, fHough, fIPeak, and fMPeak. Referenced by HoughViewSR::GetLargestTrackIndex(), and AlgTrackSRList::RunAlg(). 00650 {
00651 Int_t nmaxbin = 0;
00652 Int_t imax = -9999;
00653 Int_t ipeak = 0;
00654 for (Int_t i=0; i<fNMaxima; i++) {
00655 if (fIPeak[i]>=0) {
00656 if (fHough[fMPeak[i]][fCPeak[i]]>nmaxbin) {
00657 nmaxbin = fHough[fMPeak[i]][fCPeak[i]];
00658 imax = ipeak;
00659 }
00660 ipeak++;
00661 }
00662 }
00663 return imax;
00664 }
|
|
|
Definition at line 48 of file HoughTrackSR.h. 00048 {return fMaxBin;}
|
|
|
Definition at line 519 of file HoughTrackSR.cxx. Referenced by HoughViewSR::IterateSingle(). 00520 {
00521 return fMaxBin;
00522 }
|
|
|
Definition at line 313 of file HoughTrackSR.cxx. Referenced by HoughViewSR::GetNPeak(), and HoughViewSR::IterateSingle(). 00314 {
00315 return fNPeak;
00316 }
|
|
|
Definition at line 636 of file HoughTrackSR.cxx. References fCPeak, fHough, fIPeak, fMPeak, fNMaxima, and fNPeak. Referenced by HoughViewSR::GetLargestTrackIndex(). 00637 {
00638 if (fNPeak==0) return -9999;
00639 if (i<0 || i>=fNPeak) i = 0;
00640 Int_t j;
00641 Int_t n=0;
00642 for (j=0; j<fNMaxima && n<=i; j++) {
00643 if (fIPeak[j]>=0) n++;
00644 }
00645 j--;
00646 return fHough[fMPeak[j]][fCPeak[j]];
00647 }
|
|
|
Definition at line 619 of file HoughTrackSR.cxx. References fCPeak, fDInter, fDSlope, fInterLim, fIPeak, fMaxBin, fMPeak, fNMaxima, fNPeak, fSlopeLim, and fXZmean. Referenced by AlgTrackSRList::RunAlg(). 00620 {
00621 if (fNPeak==0) return -9999.;
00622 if (i<0 || i>=fNPeak) i = 0;
00623 Int_t j;
00624 Int_t n=0;
00625 for (j=0; j<fNMaxima && n<=i; j++) {
00626 if (fIPeak[j]>=0) n++;
00627 }
00628 j--;
00629
00630 Double_t slope = fMPeak[j]*fDSlope/fMaxBin+fSlopeLim[0];
00631 Double_t inter = fCPeak[j]*fDInter/fMaxBin+fInterLim[0];
00632
00633 return inter-slope*fXZmean[1]+fXZmean[0];
00634 }
|
|
|
Definition at line 605 of file HoughTrackSR.cxx. References fDSlope, fIPeak, fMaxBin, fMPeak, fNMaxima, fNPeak, and fSlopeLim. Referenced by AlgTrackSRList::RunAlg(). 00606 {
00607 if (fNPeak==0) return -9999.;
00608 if (i<0 || i>=fNPeak) i = 0;
00609 Int_t j;
00610 Int_t n=0;
00611 for (j=0; j<fNMaxima && n<=i; j++) {
00612 if (fIPeak[j]>=0) n++;
00613 }
00614 j--;
00615 Double_t slope = fMPeak[j]*fDSlope/fMaxBin+fSlopeLim[0];
00616 return slope;
00617 }
|
|
|
Definition at line 666 of file HoughTrackSR.cxx. References fCPeak, fHough, fMaxBin, fMPeak, and fSlopePeak. Referenced by Iterate(), and Print(). 00667 {
00668 Int_t impeak = fMPeak[i];
00669 Int_t icpeak = fCPeak[i];
00670 Int_t nentry = fHough[impeak][icpeak];
00671 Int_t found=1;
00672 Int_t nskip=0;
00673 Int_t nfound = 0;
00674 Double_t mpeak = 0.;
00675 Double_t cpeak = 0.;
00676 for (Int_t ic1=icpeak-1; ic1>=0 && nskip<2; ic1--) {
00677 found = 0;
00678 Int_t im1 = (Int_t)((ic1-icpeak)*fSlopePeak[i]+.5)+impeak;
00679 for (Int_t im2=-3; im2<=3; im2++) {
00680 if (im1+im2>=0 && im1+im2<fMaxBin && fHough[im1+im2][ic1]==nentry) {
00681 found = 1;
00682 nfound++;
00683 mpeak += (Double_t)(im1+im2);
00684 cpeak += (Double_t)(ic1);
00685 }
00686 }
00687 if (!found) {
00688 nskip++;
00689 }
00690 else {
00691 nskip = 0;
00692 }
00693 }
00694 found=1;
00695 nskip=0;
00696 for (Int_t ic1=icpeak; ic1<fMaxBin && nskip<2; ic1++) {
00697 found = 0;
00698 Int_t im1 = (Int_t)((ic1-icpeak)*fSlopePeak[i]+.5)+impeak;
00699 for (Int_t im2=-3; im2<=3; im2++) {
00700 if (im1+im2>=0 && im1+im2<fMaxBin && fHough[im1+im2][ic1]==nentry) {
00701 found = 1;
00702 nfound++;
00703 mpeak += (Double_t)(im1+im2);
00704 cpeak += (Double_t)(ic1);
00705 }
00706 }
00707 if (!found) {
00708 nskip++;
00709 }
00710 else {
00711 nskip = 0;
00712 }
00713 }
00714 if (!nfound) return -1.;
00715 mpeak /= (Double_t)nfound;
00716 cpeak /= (Double_t)nfound;
00717 return mpeak;
00718 }
|
|
|
Definition at line 549 of file HoughTrackSR.cxx. References fSlopeLim. 00550 {
00551 return fSlopeLim[1];
00552 }
|
|
|
Definition at line 544 of file HoughTrackSR.cxx. References fSlopeLim. 00545 {
00546 return fSlopeLim[0];
00547 }
|
|
|
Definition at line 359 of file HoughTrackSR.cxx. References fClusterList, fCPeak, fDInter, fDSlope, fHough, FillHough(), fInterLim, fIPeak, fMaxBin, fMinInterBinSize, fMPeak, fNBinCut, fNMaxima, fNPeak, fPeakMin, fPeakMinFrac, fPeakMinFracZoom, fSlopeLim, fXZmean, fXZrms, GetInter(), GetSlope(), HoughTrackSR(), max, min, SetInterceptMax(), SetInterceptMin(), SetPeakMin(), SetPeakMinFrac(), SetSlopeMax(), SetSlopeMin(), SetX0(), SetXRMS(), SetZ0(), and SetZRMS(). Referenced by HoughViewSR::Init(), and HoughViewSR::IterateSingle(). 00360 {
00361 TObjArray tracklist;
00362 if (fFillHough) {
00363 Double_t SlopeLim[2] = {fSlopeLim[0],fSlopeLim[1]};
00364 Double_t InterLim[2] = {fInterLim[0],fInterLim[1]};
00365 if (fNPeak>1) {
00366 Int_t imuon=0;
00367 Double_t newslopelim[2] = { 0, 0 }, newinterlim[2] = { 0, 0 };
00368 for (Int_t i=0; i<fNMaxima; i++) {
00369 if (fIPeak[i]>=0) {
00370 Int_t nentry = fHough[fMPeak[i]][fCPeak[i]];
00371 fNBinCut = max(fPeakMin,(Int_t)(fPeakMinFracZoom*nentry));
00372 Int_t impeak = (Int_t)(GetSlope(i)+.5);
00373 Int_t icpeak = (Int_t)(GetInter(i)+.5);
00374 Int_t minbin[2] = {impeak-5,icpeak-5};
00375 Int_t maxbin[2] = {impeak+5,icpeak+5};
00376 /*
00377 Int_t found=1;
00378 for (Int_t ic1=icpeak-1; ic1>=0 && found; ic1--) {
00379 found = 0;
00380 Int_t im1 = (Int_t)((ic1-icpeak)*fSlopePeak[i]+.5)+impeak;
00381 for (Int_t im2=-3; im2<=3; im2++) {
00382 if (im1+im2>=0 && im1+im2<fMaxBin && fHough[im1+im2][ic1]>=fNBinCut) {
00383 found = 1;
00384 minbin[1] = ic1;
00385 minbin[0] = min(minbin[0],im1+im2);
00386 maxbin[0] = max(maxbin[0],im1+im2);
00387 }
00388 }
00389 }
00390 found = 1;
00391 for (Int_t ic1=icpeak+1; ic1<fMaxBin && found; ic1++) {
00392 found = 0;
00393 Int_t im1 = (Int_t)((ic1-icpeak)*fSlopePeak[i]+.5)+impeak;
00394 for (Int_t im2=-3; im2<=3; im2++) {
00395 if (im1+im2>=0 && im1+im2<fMaxBin && fHough[im1+im2][ic1]>=fNBinCut) {
00396 found = 1;
00397 maxbin[1] = ic1;
00398 minbin[0] = min(minbin[0],im1+im2);
00399 maxbin[0] = max(maxbin[0],im1+im2);
00400 }
00401 }
00402 }
00403 */
00404 // expand intercept bin range to minimum allowed if we have specified
00405 // a range that is smaller than allowed by fMinInterBinSize
00406 Int_t dMinInterBin = (Int_t)(fMinInterBinSize*(Double_t)(fMaxBin*fMaxBin)/fDInter);
00407 while (dMinInterBin<fMaxBin && maxbin[1]-minbin[1]+1<dMinInterBin) {
00408 minbin[1]--;
00409 if (minbin[1]<0) minbin[1]=0;
00410 if (maxbin[1]-minbin[1]<dMinInterBin) {
00411 maxbin[1]++;
00412 if (maxbin[1]>=fMaxBin) maxbin[1]=fMaxBin-1;
00413 }
00414 }
00415
00416 if (!imuon) {
00417 // set new limits on original track space
00418 if (fMPeak[i]-minbin[0]<fMaxBin/4) minbin[0] = max(0,fMPeak[i]-fMaxBin/4);
00419 if (fCPeak[i]-minbin[1]<fMaxBin/4) minbin[1] = max(0,fCPeak[i]-fMaxBin/4);
00420 if (maxbin[0]-fMPeak[i]<fMaxBin/4) maxbin[0] = min(fMaxBin-1,fMPeak[i]+fMaxBin/4);
00421 if (maxbin[1]-fCPeak[i]<fMaxBin/4) maxbin[1] = min(fMaxBin-1,fCPeak[i]+fMaxBin/4);
00422 minbin[0] = min(minbin[0],fMPeak[i]);
00423 minbin[1] = min(minbin[1],fCPeak[i]);
00424 maxbin[0] = max(maxbin[0],fMPeak[i]);
00425 maxbin[1] = max(maxbin[1],fCPeak[i]);
00426
00427 newslopelim[0] = SlopeLim[0]+(Double_t)minbin[0]/(Double_t)fMaxBin*fDSlope;
00428 newslopelim[1] = SlopeLim[0]+(Double_t)maxbin[0]/(Double_t)fMaxBin*fDSlope;
00429 newinterlim[0] = InterLim[0]+(Double_t)minbin[1]/(Double_t)fMaxBin*fDInter;
00430 newinterlim[1] = InterLim[0]+(Double_t)maxbin[1]/(Double_t)fMaxBin*fDInter;
00431 }
00432 else {
00433 // create new hough track space centered on peak
00434 HoughTrackSR *newhough = new HoughTrackSR(*fClusterList);
00435 newhough->SetX0(fXZmean[0]);
00436 newhough->SetZ0(fXZmean[1]);
00437 newhough->SetXRMS(fXZrms[0]);
00438 newhough->SetZRMS(fXZrms[1]);
00439 newhough->SetPeakMin(fPeakMin);
00440 newhough->SetPeakMinFrac(fPeakMinFrac);
00441
00442 newhough->SetSlopeMin(SlopeLim[0]+(Double_t)minbin[0]/(Double_t)fMaxBin*fDSlope);
00443 newhough->SetSlopeMax(SlopeLim[0]+(Double_t)maxbin[0]/(Double_t)fMaxBin*fDSlope);
00444 newhough->SetInterceptMin(InterLim[0]+(Double_t)minbin[1]/(Double_t)fMaxBin*fDInter);
00445 newhough->SetInterceptMax(InterLim[0]+(Double_t)maxbin[1]/(Double_t)fMaxBin*fDInter);
00446 newhough->FillHough();
00447 tracklist.Add(newhough);
00448 }
00449 imuon++;
00450 }
00451 }
00452
00453 // set new space limits and refill this track
00454 fSlopeLim[0] = newslopelim[0];
00455 fSlopeLim[1] = newslopelim[1];
00456 fInterLim[0] = newinterlim[0];
00457 fInterLim[1] = newinterlim[1];
00458 FillHough();
00459 }
00460 else if (fNPeak==1) {
00461 Int_t i;
00462 for (i=0; i<fNMaxima && fIPeak[i]<0; i++);
00463
00464 // we now determine what bin count we use to define new boundaries of
00465 // slope/int space
00466 fNBinCut = max(fPeakMin,(Int_t)(fPeakMinFrac*fHough[fMPeak[i]][fCPeak[i]]));
00467 Int_t minbin[2] = {fMaxBin,fMaxBin};
00468 Int_t maxbin[2] = {0,0};
00469 for (Int_t im=0; im<fMaxBin; im++) {
00470 for (Int_t ic=0; ic<fMaxBin; ic++) {
00471 if (fHough[im][ic]>=fNBinCut) {
00472 minbin[0] = min(minbin[0],im);
00473 minbin[1] = min(minbin[1],ic);
00474 maxbin[0] = max(maxbin[0],im);
00475 maxbin[1] = max(maxbin[1],ic);
00476 }
00477 }
00478 }
00479 Int_t dinter = (Int_t)(fMinInterBinSize*(Double_t)(fMaxBin*fMaxBin)/fDInter);
00480 while (dinter<fMaxBin && maxbin[1]-minbin[1]+1<dinter) {
00481 minbin[1]--;
00482 if (minbin[1]<0) minbin[1]=0;
00483 if (maxbin[1]-minbin[1]<dinter) {
00484 maxbin[1]++;
00485 if (maxbin[1]>=fMaxBin) maxbin[1]=fMaxBin-1;
00486 }
00487 }
00488
00489 // don't allow excessive scale change in one iteration
00490 if (fMPeak[i]-minbin[0]<fMaxBin/4) minbin[0] = max(0,fMPeak[i]-fMaxBin/4);
00491 if (fCPeak[i]-minbin[1]<fMaxBin/4) minbin[1] = max(0,fCPeak[i]-fMaxBin/4);
00492 if (maxbin[0]-fMPeak[i]<fMaxBin/4) maxbin[0] = min(fMaxBin-1,fMPeak[i]+fMaxBin/4);
00493 if (maxbin[1]-fCPeak[i]<fMaxBin/4) maxbin[1] = min(fMaxBin-1,fCPeak[i]+fMaxBin/4);
00494 minbin[0] = min(minbin[0],fMPeak[i]);
00495 minbin[1] = min(minbin[1],fCPeak[i]);
00496 maxbin[0] = max(maxbin[0],fMPeak[i]);
00497 maxbin[1] = max(maxbin[1],fCPeak[i]);
00498 fSlopeLim[1] = fSlopeLim[0]+(Double_t)maxbin[0]/(Double_t)(fMaxBin-1)*fDSlope;
00499 fSlopeLim[0] += (Double_t)minbin[0]/(Double_t)(fMaxBin-1)*fDSlope;
00500 fInterLim[1] = fInterLim[0]+(Double_t)maxbin[1]/(Double_t)(fMaxBin-1)*fDInter;
00501 fInterLim[0] += (Double_t)minbin[1]/(Double_t)(fMaxBin-1)*fDInter;
00502 FillHough();
00503 }
00504 }
00505 else {
00506 int nrms = 1;
00507 fInterLim[0] = min(-nrms*fXZrms[0]-fSlopeLim[1]*nrms*fXZrms[1],
00508 -nrms*fXZrms[0]+fSlopeLim[0]*nrms*fXZrms[1]);
00509 fInterLim[1] = max(nrms*fXZrms[0]+fSlopeLim[1]*nrms*fXZrms[1],
00510 nrms*fXZrms[0]-fSlopeLim[0]*nrms*fXZrms[1]);
00511 FillHough();
00512 }
00513
00514
00515 return tracklist;
00516
00517 }
|
|
|
Definition at line 318 of file HoughTrackSR.cxx. References fCPeak, fHough, fInterLim, fIPeak, fMPeak, fNMaxima, fNPeak, fSlopeLim, fSlopePeak, fXZmean, fXZrms, GetInter(), GetSlope(), and MSG. Referenced by HoughViewSR::Print(). 00319 {
00320 MSG("HoughTrackSR", Msg::kInfo) << "MEAN " << fXZmean[0] << " " << fXZmean[1] << "\n";
00321 MSG("HoughTrackSR", Msg::kInfo) << "RMS " << fXZrms[0] << " " << fXZrms[1] << "\n";
00322
00323 MSG("HoughTrackSR", Msg::kInfo) << "slope limits: " << fSlopeLim[0] << " / " << fSlopeLim[1] << "\n";
00324 MSG("HoughTrackSR", Msg::kInfo) << "intercept limits: " << fInterLim[0] << " / " << fInterLim[1] << "\n";
00325 MSG("HoughTrackSR", Msg::kInfo) << "\n";
00326
00327 MSG("HoughTrackSR", Msg::kInfo) << " | ";
00328 for (int ic=0; ic<fMaxBin; ic++) {
00329 printf("%2d ",ic);
00330 }
00331 MSG("HoughTrackSR", Msg::kInfo) << "\n";
00332 MSG("HoughTrackSR", Msg::kInfo) << "-----";
00333 for (int ic=0; ic<fMaxBin; ic++) {
00334 MSG("HoughTrackSR", Msg::kInfo) << "---";
00335 }
00336 MSG("HoughTrackSR", Msg::kInfo) << "\n";
00337 for (int im=0; im<fMaxBin; im++) {
00338 printf("%2d | ",im);
00339 for (int ic=0; ic<fMaxBin; ic++) {
00340 printf("%2d ",fHough[im][ic]);
00341 }
00342 MSG("HoughTrackSR", Msg::kInfo) << "\n";
00343 }
00344 MSG("HoughTrackSR", Msg::kInfo) << "\n\n";
00345
00346 MSG("HoughTrackSR", Msg::kInfo) << "# of found muons = " << fNPeak << "\n";
00347 MSG("HoughTrackSR", Msg::kInfo) << "# of found local maxima = " << fNMaxima << "\n";
00348
00349 for (int i=0; i<fNMaxima; i++) {
00350 MSG("HoughTrackSR", Msg::kInfo) << " " << i << " " << fMPeak[i] << " " << fCPeak[i] << " " << fIPeak[i] << " " << fSlopePeak[i] << " " << fHough[fMPeak[i]][fCPeak[i]] << "\n";
00351 if (fIPeak[i]>=0) {
00352 MSG("HoughTrackSR", Msg::kInfo) << " PEAK: " << GetSlope(i) << " " << GetInter(i) << "\n";
00353 }
00354 }
00355 MSG("HoughTrackSR", Msg::kInfo) << "\n\n";
00356
00357 }
|
|
|
Definition at line 104 of file HoughTrackSR.cxx. References fClusterList. 00105 {
00106 fClusterList = new TObjArray(clusterlist);
00107 }
|
|
|
Definition at line 600 of file HoughTrackSR.cxx. References fInterLim. Referenced by Iterate(). 00601 {
00602 fInterLim[1] = dvar;
00603 }
|
|
|
Definition at line 595 of file HoughTrackSR.cxx. References fInterLim. Referenced by Iterate(). 00596 {
00597 fInterLim[0] = dvar;
00598 }
|
|
|
Definition at line 49 of file HoughTrackSR.h. References fMaxBin. Referenced by HoughViewSR::Init(). 00049 {fMaxBin = i;}
|
|
|
Definition at line 539 of file HoughTrackSR.cxx. References fMinInterBinSize. Referenced by HoughViewSR::Init(). 00540 {
00541 fMinInterBinSize = dvar;
00542 }
|
|
|
Definition at line 524 of file HoughTrackSR.cxx. References fPeakMin. Referenced by HoughViewSR::Init(), and Iterate(). 00525 {
00526 fPeakMin = nbin;
00527 }
|
|
|
Definition at line 529 of file HoughTrackSR.cxx. References fPeakMinFrac. Referenced by HoughViewSR::Init(), and Iterate(). 00530 {
00531 fPeakMinFrac = dvar;
00532 }
|
|
|
Definition at line 534 of file HoughTrackSR.cxx. References fPeakMinFracZoom. Referenced by HoughViewSR::Init(). 00535 {
00536 fPeakMinFracZoom = dvar;
00537 }
|
|
|
Definition at line 590 of file HoughTrackSR.cxx. References fSlopeLim. Referenced by Iterate(). 00591 {
00592 fSlopeLim[1] = dvar;
00593 }
|
|
|
Definition at line 585 of file HoughTrackSR.cxx. References fSlopeLim. Referenced by Iterate(). 00586 {
00587 fSlopeLim[0] = dvar;
00588 }
|
|
|
Definition at line 564 of file HoughTrackSR.cxx. References fXZmean. Referenced by HoughViewSR::Init(), and Iterate(). 00565 {
00566 fXZmean[0] = dvar;
00567 }
|
|
|
Definition at line 574 of file HoughTrackSR.cxx. References fXZrms. Referenced by HoughViewSR::Init(), and Iterate(). 00575 {
00576 fXZrms[0] = dvar;
00577 }
|
|
|
Definition at line 569 of file HoughTrackSR.cxx. References fXZmean. Referenced by HoughViewSR::Init(), and Iterate(). 00570 {
00571 fXZmean[1] = dvar;
00572 }
|
|
|
Definition at line 579 of file HoughTrackSR.cxx. References fXZrms. Referenced by HoughViewSR::Init(), and Iterate(). 00580 {
00581 fXZrms[1] = dvar;
00582 }
|
|
|
Definition at line 84 of file HoughTrackSR.h. Referenced by FillHough(), HoughTrackSR(), Iterate(), and SetClusterList(). |
|
|
Definition at line 103 of file HoughTrackSR.h. Referenced by FillHough(), GetInter(), GetLargestPeakIndex(), GetPeakBin(), GetPeakIntercept(), GetSlope(), HoughTrackSR(), Iterate(), and Print(). |
|
|
Definition at line 83 of file HoughTrackSR.h. Referenced by FillHough(), GetPeakIntercept(), HoughTrackSR(), and Iterate(). |
|
|
Definition at line 82 of file HoughTrackSR.h. Referenced by FillHough(), GetPeakIntercept(), GetPeakSlope(), HoughTrackSR(), and Iterate(). |
|
|
Definition at line 100 of file HoughTrackSR.h. Referenced by FillHough(), and HoughTrackSR(). |
|
|
Definition at line 94 of file HoughTrackSR.h. Referenced by FillHough(), GetInter(), GetLargestPeakIndex(), GetPeakBin(), GetSlope(), HoughTrackSR(), Iterate(), and Print(). |
|
|
Definition at line 81 of file HoughTrackSR.h. Referenced by FillHough(), GetInterceptMax(), GetInterceptMin(), GetPeakIntercept(), HoughTrackSR(), Iterate(), Print(), SetInterceptMax(), and SetInterceptMin(). |
|
|
Definition at line 104 of file HoughTrackSR.h. Referenced by FillHough(), GetLargestPeakIndex(), GetPeakBin(), GetPeakIntercept(), GetPeakSlope(), HoughTrackSR(), Iterate(), and Print(). |
|
|
Definition at line 76 of file HoughTrackSR.h. Referenced by GetInter(), GetPeakIntercept(), GetPeakSlope(), GetSlope(), HoughTrackSR(), Iterate(), and SetMaxBin(). |
|
|
Definition at line 95 of file HoughTrackSR.h. Referenced by FillHough(), and HoughTrackSR(). |
|
|
Definition at line 89 of file HoughTrackSR.h. Referenced by HoughTrackSR(), Iterate(), and SetMinInterBinSize(). |
|
|
Definition at line 102 of file HoughTrackSR.h. Referenced by FillHough(), GetInter(), GetLargestPeakIndex(), GetPeakBin(), GetPeakIntercept(), GetPeakSlope(), GetSlope(), HoughTrackSR(), Iterate(), and Print(). |
|
|
Definition at line 75 of file HoughTrackSR.h. Referenced by FillHough(). |
|
|
Definition at line 92 of file HoughTrackSR.h. Referenced by HoughTrackSR(), and Iterate(). |
|
|
Definition at line 91 of file HoughTrackSR.h. Referenced by FillHough(), and HoughTrackSR(). |
|
|
Definition at line 98 of file HoughTrackSR.h. Referenced by FillHough(), GetPeakBin(), GetPeakIntercept(), GetPeakSlope(), HoughTrackSR(), Iterate(), and Print(). |
|
|
Definition at line 97 of file HoughTrackSR.h. Referenced by FillHough(), GetPeakBin(), GetPeakIntercept(), GetPeakSlope(), HoughTrackSR(), Iterate(), and Print(). |
|
|
Definition at line 86 of file HoughTrackSR.h. Referenced by FillHough(), HoughTrackSR(), Iterate(), and SetPeakMin(). |
|
|
Definition at line 87 of file HoughTrackSR.h. Referenced by HoughTrackSR(), Iterate(), and SetPeakMinFrac(). |
|
|
Definition at line 88 of file HoughTrackSR.h. Referenced by HoughTrackSR(), Iterate(), and SetPeakMinFracZoom(). |
|
|
Definition at line 80 of file HoughTrackSR.h. Referenced by FillHough(), GetPeakIntercept(), GetPeakSlope(), GetSlopeMax(), GetSlopeMin(), HoughTrackSR(), Iterate(), Print(), SetSlopeMax(), and SetSlopeMin(). |
|
|
Definition at line 105 of file HoughTrackSR.h. Referenced by FillHough(), GetInter(), GetSlope(), HoughTrackSR(), and Print(). |
|
|
Definition at line 78 of file HoughTrackSR.h. Referenced by FillHough(), GetPeakIntercept(), HoughTrackSR(), Iterate(), Print(), SetX0(), and SetZ0(). |
|
|
Definition at line 79 of file HoughTrackSR.h. Referenced by HoughTrackSR(), Iterate(), Print(), SetXRMS(), and SetZRMS(). |
1.3.9.1