Go to the documentation of this file.00001 #include "ConformalMappingFit.h"
00002
00003 using namespace std;
00004
00005 template <class T> T sqr( T t) {return t*t;}
00006
00007 ConformalMappingFit::ConformalMappingFit(
00008 const std::vector<PointXY> & hits, const std::vector<float> & errRPhi2, const Rotation * rot)
00009 : theRotation(rot), myRotation(rot==0)
00010 {
00011 typedef ConformalMappingFit::MappedPoint<double> PointUV;
00012 int hits_size = hits.size();
00013 for ( int i= 0; i < hits_size; i++) {
00014 if (!theRotation) findRot( hits[i] );
00015 PointUV point( hits[i], 1./errRPhi2[i], theRotation);
00016 theFit.addPoint( point.u(), point.v(), point.weight());
00017 }
00018 }
00019
00020 void ConformalMappingFit::findRot(const PointXY & p)
00021 {
00022 myRotation = true;
00023 GlobalVector aX = GlobalVector( p.x(), p.y(), 0.).unit();
00024 GlobalVector aY( -aX.y(), aX.x(), 0.);
00025 GlobalVector aZ( 0., 0., 1.);
00026 theRotation = new Rotation(aX,aY,aZ);
00027 }
00028
00029 ConformalMappingFit::~ConformalMappingFit()
00030 { if( myRotation) delete theRotation; }
00031
00032 double ConformalMappingFit::phiRot() const
00033 { return atan2( theRotation->xy(), theRotation->xx() ); }
00034
00035 Measurement1D ConformalMappingFit::curvature() const
00036 {
00037 double val = fabs( 2. * theFit.parA() );
00038 double err = 2.*sqrt(theFit.varAA());
00039 return Measurement1D(val,err);
00040 }
00041
00042 Measurement1D ConformalMappingFit::directionPhi() const
00043 {
00044 double val = phiRot() + atan(theFit.parB());
00045 double err = sqrt(theFit.varBB());
00046 return Measurement1D(val,err);
00047 }
00048
00049 Measurement1D ConformalMappingFit::impactParameter() const
00050 {
00051 double val = -theFit.parC();
00052 double err = sqrt(theFit.varCC());
00053 return Measurement1D(val,err);
00054 }
00055
00056 int ConformalMappingFit::charge() const
00057 { return (theFit.parA() > 0.) ? -1 : 1; }
00058