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

Added conform transform functions

	modified:   include/GenFindHits.h
	modified:   src/GenFindHits.cxx
parent 12cc856b
......@@ -22,6 +22,8 @@ namespace genfind {
public:
Hit();
Hit(const ROOT::Math::XYZTVector& );
Hit(double x, double y, double z, double t=0);
Hit(const Hit&) = default;
Hit(Hit&&) = default;
Hit& operator=(const Hit&) = default;
......@@ -41,7 +43,6 @@ namespace genfind {
/** Conform space hits.
*/
class ConformalHit {
public:
ROOT::Math::XYZTVector fPosition = {0,0,0,0};
std::shared_ptr<genfind::Hit> fImageHit;
......@@ -63,7 +64,34 @@ namespace genfind {
ClassDef(ConformalHit,1)
};
/** @brief Compute the conformal transform of a hit.
*
* @param hit The hit that provides the position space coordinates.
* @param ref Hit providing the reference coordinates (x0,y0).
*
* \f$ u = \frac{x}{x^2+y^2} \f$
* \f$ v = \frac{y}{x^2+y^2} \f$
*
*/
ConformalHit compute_conformal_hit(std::shared_ptr<Hit> hit, std::shared_ptr<Hit> ref);
ConformalHit compute_conformal_hit(std::shared_ptr<Hit> hit);
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}) ;
double x = hit.X() - ref.X();
double y = hit.Y() - ref.Y();
double R = x*x + y*y;
if( !(hit == ref) ) {
chit.fPosition = { 2.0*x/R, 2.0*y/R, hit.Z(), hit.T() } ;
}
return chit;
}
}
......
......@@ -6,6 +6,14 @@ namespace genfind {
{ }
//__________________________________________________________________________
Hit::Hit(const ROOT::Math::XYZTVector& p) : fPosition(p)
{ }
//__________________________________________________________________________
Hit::Hit(double x, double y, double z, double t) : fPosition({x,y,z,t})
{ }
//__________________________________________________________________________
Hit::~Hit()
{ }
//__________________________________________________________________________
......@@ -27,9 +35,16 @@ namespace genfind {
double y = hit->Y() - ref->Y();
double R = x*x + y*y;
if( !(hit == ref) ) {
chit.fPosition = { 2.0*x/R, -2.0*y/R, hit->Z(), hit->T() } ;
chit.fPosition = { 2.0*x/R, 2.0*y/R, hit->Z(), hit->T() } ;
}
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