Commit ab8c0045 authored by Whitney Armstrong's avatar Whitney Armstrong
Browse files

modified: include/GenFindHits.h

	modified:   include/HoughTransform.h
	modified:   src/HoughTransform.cxx
parent b25e27b1
......@@ -92,7 +92,6 @@ namespace genfind {
return chit;
}
template<class T>
std::vector<ConformalHit> compute_conformal_hits(const std::vector<T>& hits, const T& ref)
{
......
......@@ -11,13 +11,12 @@
#include "TSpectrum.h"
#include "TSpectrum2.h"
#include "TMultiGraph.h"
#include "GenFindHits.h"
namespace genfind {
class HoughTransform : public TObject {
protected:
public:
TH1F* fPhi = nullptr;
......@@ -36,13 +35,37 @@ namespace genfind {
public:
HoughTransform();
virtual ~HoughTransform();
std::vector<ROOT::Math::XYZTVector> GetConformalCoordinates(
const ROOT::Math::XYZTVector ref_point,
const std::vector<ROOT::Math::XYZTVector>& hits) const;
/** @brief Method to get the result.
*
* @param hits Vector of hit type T which.
*
* Returns vector of vector of hits group into possilbe track candidates.
* Note: the reference hit for the conformal transform is at the origin.
*
*/
template<class T>
std::vector<std::vector<T>> operator()(const std::vector<T>& hits){
std::vector<std::vector<T>> res;
T ref = {0.0,0.0,0.0,0.0};
auto chits = genfind::compute_conformal_hits(hits, ref);
res.push_back(hits);
return res;
}
/** @brief Fill the Hough transform histograms for searching.
*
* @param chits Vector of ConformalHits used to find lines.
*
*/
void FillHistograms(const std::vector<genfind::ConformalHit>& chits);
TMultiGraph* FillHoughTransforms(const std::vector<ROOT::Math::XYZTVector>& hits);
int FindPeaks(const std::vector<ROOT::Math::XYZTVector>& hits);
......
......@@ -52,6 +52,46 @@ namespace genfind {
}
//__________________________________________________________________________
void HoughTransform::FillHistograms(const std::vector<genfind::ConformalHit>& chits)
{
double degree = TMath::Pi()/180.0;
double phi_min = 0.0;
double phi_max = 180.0;
TH1F* temp0 = (TH1F*)fRhoTheta0->Clone();
TH1F* temp1 = (TH1F*)fRhoTheta1->Clone();
TH1F* temp2 = (TH1F*)fRhoTheta2->Clone();
fRhoTheta0->Reset();
fRhoTheta1->Reset();
fRhoTheta2->Reset();
for(const auto& ahit : chits) {
temp0->Reset();
temp1->Reset();
temp2->Reset();
for(int i_theta = 0; i_theta<1000; i_theta++) {
double theta = 180.0*degree*double(i_theta)/double(500);//rand.Uniform(0.0,180.0)*degree;
int bin = temp0->FindBin(theta/degree, ahit.X()*TMath::Cos(theta) + ahit.Y()*TMath::Sin(theta) );
temp0->SetBinContent(bin, 1);
bin = temp1->FindBin(theta/degree, ahit.X()*TMath::Cos(theta) + ahit.Y()*TMath::Sin(theta) );
temp1->SetBinContent(bin, 1);
bin = temp2->FindBin(theta/degree, ahit.X()*TMath::Cos(theta) + ahit.Y()*TMath::Sin(theta) );
temp2->SetBinContent(bin, 1);
}
fRhoTheta0->Add(temp0);
fRhoTheta1->Add(temp1);
fRhoTheta2->Add(temp2);
}
delete temp0;
delete temp1;
delete temp2;
}
//__________________________________________________________________________
TMultiGraph* HoughTransform::FillHoughTransforms(const std::vector<ROOT::Math::XYZTVector>& hits)
{
double degree = TMath::Pi()/180.0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment