BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
CFCir.cxx
Go to the documentation of this file.
1#include "CFCir.h"
2#include <iostream>
3#include <math.h>
4
6
7CFCir::CFCir( double x, double y, double phi, int n, double centerX, double centerY,
8 double centerR )
9 : _x( x )
10 , _y( y )
11 , _phi( phi )
12 , _n( n )
13 , _centerX( centerX )
14 , _centerY( centerY )
15 , _centerR( centerR ) {
16 double normal = ( y - _centerY ) / ( x - centerX );
17 double k = -1. / normal;
18 double b = y - k * x;
19 double x_cross = -b / ( k + 1 / k );
20 double y_cross = b / ( 1 + k * k );
21 // std::cout<<"x y centerX centerY "<<x<<" "<<y<<" "<<centerX<<" "<<centerY<<std::endl;
22 // std::cout<<"k b "<<k<<" "<<b<<std::endl;
23 // std::cout<<"xcross ycross "<<x_cross<<" "<<y_cross<<std::endl;
24
25 double rho_temp = sqrt( x_cross * x_cross + y_cross * y_cross );
26 double theta_temp = atan2( y_cross, x_cross );
27 if ( theta_temp < 0 )
28 {
29 theta_temp = theta_temp + M_PI;
30 rho_temp = -rho_temp;
31 }
32 if ( normal == 0 && x > 0 )
33 {
34 rho_temp = fabs( x );
35 theta_temp = 0;
36 }
37 if ( normal == 0 && x < 0 )
38 {
39 rho_temp = -fabs( x );
40 theta_temp = M_PI;
41 }
42 _theta = theta_temp;
43 _rho = rho_temp;
44 double slant = _y * cos( _theta ) - _x * sin( _theta );
45 _slant = slant;
46 // std::cout<<"THETA RHO "<<theta_temp<<" "<<rho_temp<<std::endl;
47 // std::cout<<std::endl;
48}
49// void CFtrans(){
50//
51// double Rcf = _x*_x + _y*_y - _d*_d;
52//
53// _cfx = _x/Rcf;
54// _cfy = _y/Rcf;
55// _cfd = _d/Rcf;
56//
57// }
59 _x = cir._x;
60 _y = cir._y;
61 _phi = cir._phi;
62 _n = cir._n;
63
64 _theta = cir._theta;
65 _rho = cir._rho;
66 _centerX = cir._centerX;
67 _centerY = cir._centerY;
68 _centerR = cir._centerR;
69 _slant = cir._slant;
70
71 return *this;
72}
73
74CFCir::CFCir( const CFCir& cir )
75 : _x( cir._x )
76 , _y( cir._y )
77 , _phi( cir._phi )
78 , _n( cir._n )
79 ,
80
81 _theta( cir._theta )
82 , _rho( cir._rho )
83 , _centerX( cir._centerX )
84 , _centerY( cir._centerY )
85 , _centerR( cir._centerR )
86 , _slant( cir._slant ) {}
const Int_t n
#define M_PI
Definition TConstant.h:4
CFCir()
Definition CFCir.cxx:5
CFCir & operator=(const CFCir &)
Definition CFCir.cxx:58