Skip to content
Snippets Groups Projects
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
Branches
No related tags found
No related merge requests found
...@@ -22,6 +22,8 @@ namespace genfind { ...@@ -22,6 +22,8 @@ namespace genfind {
public: public:
Hit(); Hit();
Hit(const ROOT::Math::XYZTVector& );
Hit(double x, double y, double z, double t=0);
Hit(const Hit&) = default; Hit(const Hit&) = default;
Hit(Hit&&) = default; Hit(Hit&&) = default;
Hit& operator=(const Hit&) = default; Hit& operator=(const Hit&) = default;
...@@ -41,7 +43,6 @@ namespace genfind { ...@@ -41,7 +43,6 @@ namespace genfind {
/** Conform space hits. /** Conform space hits.
*/ */
class ConformalHit { class ConformalHit {
public: public:
ROOT::Math::XYZTVector fPosition = {0,0,0,0}; ROOT::Math::XYZTVector fPosition = {0,0,0,0};
std::shared_ptr<genfind::Hit> fImageHit; std::shared_ptr<genfind::Hit> fImageHit;
...@@ -63,7 +64,34 @@ namespace genfind { ...@@ -63,7 +64,34 @@ namespace genfind {
ClassDef(ConformalHit,1) 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, 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 { ...@@ -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() Hit::~Hit()
{ } { }
//__________________________________________________________________________ //__________________________________________________________________________
...@@ -27,9 +35,16 @@ namespace genfind { ...@@ -27,9 +35,16 @@ namespace genfind {
double y = hit->Y() - ref->Y(); double y = hit->Y() - ref->Y();
double R = x*x + y*y; double R = x*x + y*y;
if( !(hit == ref) ) { 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; return chit;
} }
ConformalHit compute_conformal_hit(std::shared_ptr<Hit> hit)
{
// Use ref = {0,0};
return compute_conformal_hit(hit, std::make_shared<Hit>());
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment