BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
HoughStereo Class Reference

#include <HoughStereo.h>

Public Member Functions

 HoughStereo (double bunchTime, Hough2D *circle, HoughRecHit *rechit)
 
void setAmb (int i)
 
int cald ()
 
void calcu (double x1, double y1, double xc, double yc, double rc, double x_east, double y_east, double z_east, double x_west, double y_west, double z_west, double &theta, double &l, double &z)
 
void setRecHit ()
 
void print ()
 
Hough2DgetCircle () const
 
HoughRecHitgetRecHit () const
 
double getlLeft () const
 
double getlRight () const
 
double getzLeft () const
 
double getzRight () const
 

Static Public Attributes

static int m_debug =0
 

Detailed Description

Definition at line 9 of file HoughStereo.h.

Constructor & Destructor Documentation

◆ HoughStereo()

HoughStereo::HoughStereo ( double bunchTime,
Hough2D * circle,
HoughRecHit * rechit )

Definition at line 9 of file HoughStereo.cxx.

9 :_bunchTime(bunchTime),_circle(circle),_rechit(rechit){
10 _lleft=-99;
11 _zleft=-99;
12 _lright=-99;
13 _zright=-99;
14 _ambig=0;
15 _charge=circle->getCharge();
16}
int getCharge() const
Definition Hough2D.h:39

Member Function Documentation

◆ calcu()

void HoughStereo::calcu ( double x1,
double y1,
double xc,
double yc,
double rc,
double x_east,
double y_east,
double z_east,
double x_west,
double y_west,
double z_west,
double & theta,
double & l,
double & z )

Definition at line 119 of file HoughStereo.cxx.

119 {
120 //rphi -> sz
121 if(xc==0||x1-xc==0){
122 theta=0;
123 }
124 else{
125 theta=M_PI-atan2(y1-yc,x1-xc)+atan2(yc,xc);
126 if(theta>2*M_PI){
127 theta=theta-2*M_PI;
128 }
129 if(theta<0){
130 theta=theta+2*M_PI;
131 }
132 }
133 if(_charge == 1 ) theta = 2*M_PI-theta;
134
135 double d1=sqrt((x1-x_west)*(x1-x_west)+(y1-y_west)*(y1-y_west));
136 double d2=sqrt((x_east-x_west)*(x_east-x_west)+(y_east-y_west)*(y_east-y_west));
137// cout<<"d1/d2 "<<d1/d2<<" "<<d1<<" "<<d2<<endl;
138// cout<<"zw ze "<<z_west<<" "<<z_east<<endl;
139 z = z_west-(z_west-z_east)*d1/d2;
140 l = rc*theta;
141}
#define M_PI
Definition TConstant.h:4

Referenced by cald().

◆ cald()

int HoughStereo::cald ( )

Definition at line 23 of file HoughStereo.cxx.

23 {
24 bool ok_ambig[2];
25 bool ok[2][2];
26 ok_ambig[0]=true;
27 ok_ambig[1]=true;
28 ok[0][0]=false;
29 ok[0][1]=false;
30 ok[1][0]=false;
31 ok[1][1]=false;
32 double xeast = _rechit->getEastPoint().x();
33 double xwest = _rechit->getWestPoint().x();
34 double yeast = _rechit->getEastPoint().y();
35 double ywest = _rechit->getWestPoint().y();
36 double zeast = _rechit->getEastPoint().z();
37 double zwest = _rechit->getWestPoint().z();
38// cout<<"xeast xwest "<<xeast<<" "<<xwest<<endl;
39 double k = (ywest-yeast)/(xwest-xeast);
40 double b = -k*xeast+yeast;
41 // cout<<" k b "<<k<<" "<<b<<endl;
42 double xc = _circle->getCirX();
43 double yc = _circle->getCirY();
44 double rc = _circle->getCirR();
45// cout<<"xc yc rc "<<xc<<" "<<yc<<" "<<rc<<endl;
46 double drift = _rechit->getDriftDist();
47 //double drift = _rechit->getDriftDistTruth();
48// cout<<"drift "<<_rechit->getDriftDist()<<endl;
49// cout<<"driftTruth "<<_rechit->getDriftDistTruth()<<endl;
50 double x1(999),y1(999);
51 double x2(999),y2(999);
52 double a = k*k+1;
53 double b1 = -2*(xc+k*yc-k*b);
54 double c1 = xc*xc+(yc-b)*(yc-b)-(rc+drift)*(rc+drift);
55 double c2 = xc*xc+(yc-b)*(yc-b)-(rc-drift)*(rc-drift);
56 double delta1 = (b1*b1-4*a*c1);
57 double delta2 = (b1*b1-4*a*c2);
58 if( delta1 <0 ) ok_ambig[0] = false;
59 if( delta2 <0 ) ok_ambig[1] = false;
60 // cout<<"(b1*b1-4*a*c1) "<<(b1*b1-4*a*c1)<<endl;
61 // cout<<"(b1*b1-4*a*c2) "<<(b1*b1-4*a*c2)<<endl;
62 if( delta1>=0 ) {
63 double x1_0 = ( -b1+sqrt(delta1) ) /(2*a);
64 double x1_1 = ( -b1-sqrt(delta1) ) /(2*a);
65// cout<<"x1 0 1 "<<x1_0<<" "<<x1_1<<endl;
66 if( (xeast>=x1_0 && xwest<=x1_0) or (xeast<=x1_0 && xwest>=x1_0) ) ok[0][0] = true;
67 if ( (xeast>=x1_1 && xwest<=x1_1) or (xeast<=x1_1 && xwest>=x1_1) ) ok[0][1]=true;
68 if( ok[0][0] == true && ok[0][1]==false ) x1 = x1_0;
69 if( ok[0][0] == false && ok[0][1]==true ) x1 = x1_1;
70 if( ok[0][0] == true && ok[0][1]==true ) {
71 x1 = x1_0; //??good
72// cout<<" error both ok "<<endl;
73 }
74 if( ok[0][0] == false && ok[0][1]==false ) ok_ambig[0] = false;
75 y1 = k*x1+b;
76 double theta1 = 0;
77 double l1= 0;
78 double z1= 0;
79 if(ok_ambig[0]==true) {
80 calcu(x1,y1,xc,yc,rc,xeast,yeast,zeast,xwest,ywest,zwest,theta1,l1,z1);
81 if(m_debug>0) cout<<" theta1 l1 z1 "<<theta1<<" "<<l1<<" "<<z1<<endl;
82 _zleft = z1;
83 _lleft = l1;
84 }
85 }
86
87 if( delta2>=0){
88 double x2_0 = ( -b1+sqrt(delta2) ) /(2*a);
89 double x2_1 = ( -b1-sqrt(delta2) ) /(2*a);
90// cout<<"x2 0 1 "<<x2_0<<" "<<x2_1<<endl;
91 if( (xeast>=x2_0 && xwest<=x2_0) or (xeast<=x2_0 && xwest>=x2_0) ) ok[1][0] = true;
92 if ( (xeast>=x2_1 && xwest<=x2_1) or (xeast<=x2_1 && xwest>=x2_1) ) ok[1][1]=true;
93 if( ok[1][0] == true && ok[1][1]==false ) x2 = x2_0;
94 if( ok[1][0] == false && ok[1][1]==true ) x2 = x2_1;
95 if( ok[1][0] == true && ok[1][1]==true ) {
96 x2 = x2_0;
97// cout<<" error both ok "<<endl;
98 }
99 if( ok[1][0] == false && ok[1][1]==false ) ok_ambig[1] = false;
100 y2 = k*x2+b;
101 double theta2 = 0;
102 double l2= 0;
103 double z2= 0;
104 if(ok_ambig[1]==true) {
105 calcu(x2,y2,xc,yc,rc,xeast,yeast,zeast,xwest,ywest,zwest,theta2,l2,z2);
106 if(m_debug>0) cout<<" theta2 l2 z2 "<<theta2<<" "<<l2<<" "<<z2<<endl;
107 _zright = z2;
108 _lright = l2;
109 }
110 }
111 if( ok_ambig[0] == true && ok_ambig[1] == false ) return -1;
112 if( ok_ambig[0] == false && ok_ambig[1] == true ) return 1;
113 if( ok_ambig[0] == true && ok_ambig[1] == true ) return 2;
114 if( ok_ambig[0] == false && ok_ambig[1] == false ) return 0;
115 //cout<<" ztruth : "<<_rechit->getZTruth()<<endl;
116}
@ theta2
Definition TrkKalDeriv.h:24
@ theta1
Definition TrkKalDeriv.h:24
double getCirR() const
Definition Hough2D.h:35
double getCirX() const
Definition Hough2D.h:33
double getCirY() const
Definition Hough2D.h:34
double getDriftDist() const
Definition HoughHit.h:69
HepPoint3D getWestPoint() const
Definition HoughHit.h:59
HepPoint3D getEastPoint() const
Definition HoughHit.h:58
static int m_debug
Definition HoughStereo.h:26
void calcu(double x1, double y1, double xc, double yc, double rc, double x_east, double y_east, double z_east, double x_west, double y_west, double z_west, double &theta, double &l, double &z)
const double b
Definition slope.cxx:9

Referenced by HoughTrack::calzs().

◆ getCircle()

Hough2D * HoughStereo::getCircle ( ) const
inline

Definition at line 20 of file HoughStereo.h.

20{return _circle;}

◆ getlLeft()

double HoughStereo::getlLeft ( ) const
inline

Definition at line 22 of file HoughStereo.h.

22{return _lleft;}

◆ getlRight()

double HoughStereo::getlRight ( ) const
inline

Definition at line 23 of file HoughStereo.h.

23{return _lright;}

◆ getRecHit()

HoughRecHit * HoughStereo::getRecHit ( ) const
inline

Definition at line 21 of file HoughStereo.h.

21{return _rechit;}

◆ getzLeft()

double HoughStereo::getzLeft ( ) const
inline

Definition at line 24 of file HoughStereo.h.

24{return _zleft;}

◆ getzRight()

double HoughStereo::getzRight ( ) const
inline

Definition at line 25 of file HoughStereo.h.

25{return _zright;}

◆ print()

void HoughStereo::print ( )

Definition at line 275 of file HoughStereo.cxx.

275 {
276 cout<<"Hit"<<"("<<_rechit->getLayerId()<<","<<_rechit->getWireId()<<") "<<_rechit->getStyle()<<endl;
277 cout<<" left: "<<_lleft<<","<<_zleft<<endl;
278 cout<<" right: "<<_lright<<","<<_zright<<endl;
279}
int getStyle() const
Definition HoughHit.h:106
int getLayerId() const
Definition HoughHit.h:62
int getWireId() const
Definition HoughHit.h:63

Referenced by HoughTrack::calzs().

◆ setAmb()

void HoughStereo::setAmb ( int i)

Definition at line 17 of file HoughStereo.cxx.

17 {
18 //initial
19 _ambig=i;
20}

◆ setRecHit()

void HoughStereo::setRecHit ( )

Definition at line 269 of file HoughStereo.cxx.

269 {
270 _rechit->setzAmb( 0 , _zleft);
271 _rechit->setsAmb( 0 , _lleft);
272 _rechit->setzAmb( 1 , _zright);
273 _rechit->setsAmb( 1 , _lright);
274}
void setzAmb(int i, double zPos)
Definition HoughRecHit.h:32
void setsAmb(int i, double sPos)
Definition HoughRecHit.h:33

Referenced by HoughTrack::calzs().

Member Data Documentation

◆ m_debug

int HoughStereo::m_debug =0
static

Definition at line 26 of file HoughStereo.h.

Referenced by cald(), and MdcHoughFinder::initialize().


The documentation for this class was generated from the following files: