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

Added template function to compute conformal hits from vector

parent fe1cf96e
......@@ -2,6 +2,7 @@
#define genfind_GenFindHits_HH
#include <memory>
#include <algorithm>
#include "TObject.h"
#include "Math/Vector3D.h"
#include "Math/Vector4D.h"
......@@ -80,8 +81,8 @@ namespace genfind {
template<class T>
ConformalHit compute_conformal_hit(const T& hit, const T& ref) {
ConformalHit chit;
//chit.fImageHit = std::make_shared<ROOT::Math::XYZTVector>({hit.X(), hit.Y(), 0.0,0.0}) ;
//chit.fImageRef = std::make_shared<ROOT::Math::XYZTVector>({ref.X(), ref.Y(), 0.0,0.0}) ;
chit.fImageHit = std::make_shared<genfind::Hit>(hit.X(), hit.Y(), 0.0) ;
chit.fImageRef = std::make_shared<genfind::Hit>(ref.X(), ref.Y(), 0.0) ;
double x = hit.X() - ref.X();
double y = hit.Y() - ref.Y();
double R = x*x + y*y;
......@@ -92,6 +93,23 @@ namespace genfind {
}
template<class T>
std::vector<ConformalHit> compute_conformal_hits(const std::vector<T>& hits, const T& ref)
{
struct Sum {
std::vector<ConformalHit> fChits;
T fRef;
Sum(const T& R) : fChits{}, fRef(R) { }
void operator()(const T& h){ fChits.push_back(compute_conformal_hit(h, fRef)); }
std::vector<ConformalHit> Get(){ return fChits; }
};
return std::for_each(hits.begin(),
hits.end(),
Sum(ref)
).Get();
}
}
......
......@@ -14,7 +14,10 @@
namespace genfind {
class HoughTransform : public TObject {
protected:
public:
TH1F* fPhi = nullptr;
......
......@@ -39,12 +39,14 @@ namespace genfind {
}
return chit;
}
//__________________________________________________________________________
ConformalHit compute_conformal_hit(std::shared_ptr<Hit> hit)
{
// Use ref = {0,0};
return compute_conformal_hit(hit, std::make_shared<Hit>());
}
//__________________________________________________________________________
}
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