HoughTransNCPi0 Class Reference

#include <HoughTransNCPi0.h>

List of all members.

Public Member Functions

 ~HoughTransNCPi0 ()
 HoughTransNCPi0 ()
 HoughTransNCPi0 (Int_t numSamps, Float_t lowGrad, Float_t highGrad)
 HoughTransNCPi0 (Int_t numSamps, Float_t lowGrad, Float_t highGrad, Float_t lowIcept, Float_t highIcept)
void SetVtxz (Float_t vertz)
Float_t GetVtxz ()
void FillHough (NtpSRStrip *stp)
void FillHough (Float_t zPos, Float_t tPos)
void FillHoughweight (Float_t zPos, Float_t tPos, Float_t energy)
void DrawHough ()
Int_t EntriesHough ()
void ResetHough ()
void DeleteHough ()
Int_t GetPeakHeight ()
Int_t GetPeakGradBin ()
Int_t GetPeakIceptBin ()
Float_t GetPeakGradVal ()
Float_t GetPeakIceptVal ()
Float_t GetCos ()
Float_t GetGradientweight ()
Float_t GetTransverseVtxCoord ()
Float_t GetIntercept ()
Float_t GetRms (Float_t frac)

Public Attributes

TH2F * houghSpace
Float_t vtxz

Detailed Description

Definition at line 30 of file HoughTransNCPi0.h.


Constructor & Destructor Documentation

HoughTransNCPi0::~HoughTransNCPi0 (  ) 

Definition at line 35 of file HoughTransNCPi0.cxx.

References houghSpace.

00035                                  {
00036   // Mark, you need to delete histograms created with new!!!
00037   delete houghSpace; houghSpace=0;
00038 
00039 }

HoughTransNCPi0::HoughTransNCPi0 (  ) 

Definition at line 28 of file HoughTransNCPi0.cxx.

References houghSpace, and vtxz.

00028                                   :houghSpace("houghSpace","houghSpace",80,-2.0,2.0,80,-4.0,4.0),vtxz(0)
00029 {
00030   houghSpace = new TH2F("houghSpace","houghSpace",80,-2.0,2.0,80,-4.0,4.0);
00031   houghSpace->SetDirectory(0);
00032   vtxz = 0.0;
00033 }

HoughTransNCPi0::HoughTransNCPi0 ( Int_t  numSamps,
Float_t  lowGrad,
Float_t  highGrad 
)

Definition at line 41 of file HoughTransNCPi0.cxx.

References houghSpace, and vtxz.

00041                                                                                  :
00042 {
00043   
00044   houghSpace = new TH2F("houghSpace","houghSpace",numSamps,lowGrad,highGrad,numSamps,-4.0,4.0);
00045   houghSpace->SetDirectory(0);
00046   vtxz = 0.0;
00047 }

HoughTransNCPi0::HoughTransNCPi0 ( Int_t  numSamps,
Float_t  lowGrad,
Float_t  highGrad,
Float_t  lowIcept,
Float_t  highIcept 
)

Definition at line 49 of file HoughTransNCPi0.cxx.

References houghSpace, and vtxz.

00049                                                                                                                     :
00050 {
00051   houghSpace = new TH2F("houghSpace","houghSpace",numSamps,lowGrad,highGrad,numSamps,lowIcept,highIcept);
00052   houghSpace->SetDirectory(0);
00053   vtxz = 0.0;
00054 }


Member Function Documentation

void HoughTransNCPi0::DeleteHough (  ) 

Definition at line 112 of file HoughTransNCPi0.cxx.

References houghSpace.

00113 {
00114   delete houghSpace;
00115 }

void HoughTransNCPi0::DrawHough (  ) 

Definition at line 94 of file HoughTransNCPi0.cxx.

References houghSpace.

00095 {
00096   //TFile f("hough.root",new");
00097   houghSpace->Draw("LEGO2");
00098   //  houghSpace->Write();
00099 }

Int_t HoughTransNCPi0::EntriesHough (  ) 

Definition at line 101 of file HoughTransNCPi0.cxx.

References houghSpace.

00102 {
00103   Int_t counts = static_cast<Int_t>(houghSpace->Integral());
00104   return counts;
00105 }

void HoughTransNCPi0::FillHough ( Float_t  zPos,
Float_t  tPos 
)

Definition at line 71 of file HoughTransNCPi0.cxx.

References houghSpace, and vtxz.

00072 {       
00073   if(zPos<(vtxz)) return;
00074   for(Int_t i=1;i<=houghSpace->GetNbinsX();++i){
00075     Float_t cos=(houghSpace->GetXaxis())->GetBinCenter(i);
00076     Float_t icept=tPos-sqrt(pow((1/cos),2)-1)*(zPos-vtxz);
00077     if(icept>4.0 || icept<-4.0) continue; //max MINOS transverse dimensions
00078     houghSpace->Fill(cos,icept);
00079     // cout << "Filling Hough Space with grad " << gradient << " and icept " << icept << endl;
00080   }
00081 }

void HoughTransNCPi0::FillHough ( NtpSRStrip stp  ) 

Definition at line 66 of file HoughTransNCPi0.cxx.

References NtpSRStrip::tpos, and NtpSRStrip::z.

00067 {
00068   FillHough(stp->z,stp->tpos);
00069 }

void HoughTransNCPi0::FillHoughweight ( Float_t  zPos,
Float_t  tPos,
Float_t  energy 
)

Definition at line 82 of file HoughTransNCPi0.cxx.

References houghSpace, and vtxz.

00083 {
00084   if(zPos<vtxz) return;
00085   for(Int_t i=1;i<houghSpace->GetNbinsX();++i){
00086     Float_t gradient=(houghSpace->GetXaxis())->GetBinCenter(i);
00087     Float_t icept=tPos-gradient*(zPos-vtxz);
00088     Float_t weight= energy;
00089     if(icept>4.0 || icept<-4.0) continue; //max MINOS transverse dimensions
00090     houghSpace->Fill(gradient,icept,weight);
00091     // cout << "Filling Hough Space with grad " << gradient << " and icept " << icept << endl;
00092   }
00093 }

Float_t HoughTransNCPi0::GetCos (  ) 

Definition at line 159 of file HoughTransNCPi0.cxx.

References houghSpace.

Referenced by GetIntercept(), and GetRms().

00160 {
00161   Int_t binx, biny;
00162   Float_t x = 0.;
00163   Float_t y = 0;
00164   Float_t peak = 0.;
00165   
00166   peak = houghSpace->GetBinContent(houghSpace->GetMaximumBin());
00167   
00168   for (biny=houghSpace->GetYaxis()->GetFirst();biny<=houghSpace->GetYaxis()->GetLast();++biny) {
00169     for (binx=houghSpace->GetXaxis()->GetFirst();binx<=houghSpace->GetXaxis()->GetLast();++binx) {
00170       if (houghSpace->GetBinContent(binx,biny) == peak) {
00171         x = houghSpace->GetXaxis()->GetBinCenter(binx);
00172         y = houghSpace->GetYaxis()->GetBinCenter(biny);
00173         //      continue; 
00174       }
00175     }
00176   }
00177    
00178 
00179   return x;
00180 }

Float_t HoughTransNCPi0::GetGradientweight (  ) 

Definition at line 181 of file HoughTransNCPi0.cxx.

References houghSpace.

00182 {
00183   Int_t binx, biny;
00184   Float_t x =0.;
00185   Float_t y=0.;
00186   Float_t peak = 0.;
00187   
00188   peak = houghSpace->GetBinContent(houghSpace->GetMaximumBin());
00189   
00190   for (biny=houghSpace->GetYaxis()->GetFirst();biny<=houghSpace->GetYaxis()->GetLast();++biny) {
00191     for (binx=houghSpace->GetXaxis()->GetFirst();binx<=houghSpace->GetXaxis()->GetLast();++binx) {
00192       if (houghSpace->GetBinContent(binx,biny) == peak) {
00193         x = houghSpace->GetXaxis()->GetBinCenter(binx);
00194         y = houghSpace->GetYaxis()->GetBinCenter(biny);
00195         //      continue; 
00196       }
00197     }
00198   }
00199   
00200   
00201   return x;
00202 }

Float_t HoughTransNCPi0::GetIntercept (  ) 

Definition at line 227 of file HoughTransNCPi0.cxx.

References GetCos(), GetTransverseVtxCoord(), and GetVtxz().

Referenced by GetRms().

00228 {
00229   
00230   Float_t intercept = GetTransverseVtxCoord() - sqrt(pow((1/GetCos()),2)-1)*GetVtxz();
00231   
00232   return intercept;
00233 }

Int_t HoughTransNCPi0::GetPeakGradBin (  ) 

Definition at line 123 of file HoughTransNCPi0.cxx.

References houghSpace.

00124 {
00125   Int_t x=0;
00126   Int_t y=0;
00127   Int_t z=0;
00128   houghSpace->GetMaximumBin(x,y,z);
00129   return x;
00130 }

Float_t HoughTransNCPi0::GetPeakGradVal (  ) 

Definition at line 141 of file HoughTransNCPi0.cxx.

References houghSpace.

00142 {
00143   Int_t x=0;
00144   Int_t y=0;
00145   Int_t z=0;
00146   houghSpace->GetMaximumBin(x,y,z);
00147   return (houghSpace->GetXaxis())->GetBinCenter(x);
00148 }

Int_t HoughTransNCPi0::GetPeakHeight (  ) 

Definition at line 117 of file HoughTransNCPi0.cxx.

References houghSpace.

Referenced by GetRms().

00118 {
00119   Int_t binmax = static_cast<Int_t>(houghSpace->GetBinContent(houghSpace->GetMaximumBin()));
00120   return binmax;
00121 }

Int_t HoughTransNCPi0::GetPeakIceptBin (  ) 

Definition at line 132 of file HoughTransNCPi0.cxx.

References houghSpace.

00133 {
00134   Int_t x=0;
00135   Int_t y=0;
00136   Int_t z=0;
00137   houghSpace->GetMaximumBin(x,y,z);
00138   return y;
00139 }

Float_t HoughTransNCPi0::GetPeakIceptVal (  ) 

Definition at line 150 of file HoughTransNCPi0.cxx.

References houghSpace.

00151 {
00152   Int_t x=0;
00153   Int_t y=0;
00154   Int_t z=0;
00155   houghSpace->GetMaximumBin(x,y,z);
00156   return (houghSpace->GetYaxis())->GetBinCenter(y);
00157 }

Float_t HoughTransNCPi0::GetRms ( Float_t  frac  ) 

Definition at line 235 of file HoughTransNCPi0.cxx.

References count, GetCos(), GetIntercept(), GetPeakHeight(), and houghSpace.

00236 {
00237   Int_t bincount = 0;
00238   Int_t mRmsInput[6400];
00239   Int_t cRmsInput[6400];
00240   Float_t peakheight = GetPeakHeight();
00241   Float_t cos = GetCos();
00242   Float_t interc = GetIntercept();
00243   Float_t mpeak = 0;
00244   Float_t cpeak = 0;
00245   Float_t contents = 0;
00246   
00247   for(Int_t mBin=1;mBin<houghSpace->GetNbinsX();++mBin){
00248     for(Int_t cBin=1;cBin<houghSpace->GetNbinsY();++cBin){
00249       if(houghSpace->GetBinContent(mBin,cBin)>=frac*peakheight){
00250         mpeak = (houghSpace->GetXaxis())->GetBinCenter(mBin);
00251         contents = houghSpace->GetBinContent(mBin,cBin);
00252         cpeak = (houghSpace->GetYaxis())->GetBinCenter(cBin);
00253         //cout<< "mpeak " << mpeak << endl;
00254         //cout<< "contents = " << contents << endl;
00255         //cout<< "cpeak " << cpeak << endl;
00256         //cout << "m_av " << grad << endl;
00257         //cout << "c_av " << interc << endl;
00258         
00259         mRmsInput[bincount]=static_cast<Int_t>(mpeak);
00260         cRmsInput[bincount]=static_cast<Int_t>(cpeak); 
00261         bincount++;
00262       }
00263     }
00264   }
00265   if(bincount==0) return 0;
00266   Float_t squaresum = 0;
00267   for (Int_t count=1;count<bincount;++count) {
00268     squaresum+=(pow((mRmsInput[count]-cos),2)+pow((cRmsInput[count]-interc),2));
00269     
00270   }
00271   Float_t Rms = sqrt(squaresum/bincount);
00272   return Rms;
00273 }

Float_t HoughTransNCPi0::GetTransverseVtxCoord (  ) 

Definition at line 204 of file HoughTransNCPi0.cxx.

References houghSpace.

Referenced by GetIntercept().

00205 {
00206   Int_t binx, biny;
00207   Float_t x =0.;
00208   Float_t y =0.;
00209   Float_t peak = 0.;
00210   
00211   peak = houghSpace->GetBinContent(houghSpace->GetMaximumBin());
00212   
00213   for (biny=houghSpace->GetYaxis()->GetFirst();biny<=houghSpace->GetYaxis()->GetLast();++biny) {
00214      for (binx=houghSpace->GetXaxis()->GetFirst();binx<=houghSpace->GetXaxis()->GetLast();++binx) {
00215        if (houghSpace->GetBinContent(binx,biny) == peak) {
00216          x = houghSpace->GetXaxis()->GetBinCenter(binx);
00217          y = houghSpace->GetYaxis()->GetBinCenter(biny);
00218          //     continue; 
00219        }
00220      }
00221   }
00222   
00223   
00224   return y;
00225 }

Float_t HoughTransNCPi0::GetVtxz (  ) 

Definition at line 61 of file HoughTransNCPi0.cxx.

References vtxz.

Referenced by GetIntercept().

00062 {
00063   return vtxz;
00064 }

void HoughTransNCPi0::ResetHough (  ) 

Definition at line 107 of file HoughTransNCPi0.cxx.

References houghSpace.

00108 {
00109   houghSpace->Reset();
00110 }

void HoughTransNCPi0::SetVtxz ( Float_t  vertz  ) 

Definition at line 56 of file HoughTransNCPi0.cxx.

References vtxz.

00057 {
00058   vtxz=vertz;
00059 }


Member Data Documentation

Definition at line 70 of file HoughTransNCPi0.h.

Referenced by FillHough(), FillHoughweight(), GetVtxz(), HoughTransNCPi0(), and SetVtxz().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1