79{
80 if(part>2||part<0) {
81 cout<<"BAD part id from MucRecLineFit"<<endl;
82 return -1;
83 }
84
85 int status = -1;
86 float c,d,sigc,sigd;
87
88 if(part != 1 ){
89 for(
int i = 0; i <
n; i++){
91
93
94 }
95 status =
LineFit(x,y,
w,
n,a,b,chisq,siga,sigb);
96
97 }
98 else{
99 if(orient == 0){
100
101 for(
int i = 0; i <
n; i++){
103 y[i] -= gap0r;
104 }
105 status =
LineFit(y,x,
w,
n,&c,&d,chisq,&sigc,&sigd);
106
107
108
109
110
111
112 *a = 1/c;
113 *b = -1 * d / c;
114 *siga = 1/c/c * sigc;
115
116 *sigb = sigd;
117 }
118 else{
119 if(seg == 0||seg == 4){
121 for(
int i = 0; i <
n; i++){
123 }
124 status =
LineFit(x,y,
w,
n,a,b,chisq,siga,sigb);
125 }
126 else if(seg == 2||seg == 6){
128 for(
int i = 0; i <
n; i++){
129 y[i] -= gap0y;
130 }
131 status =
LineFit(y,x,
w,
n,&c,&d,chisq,&sigc,&sigd);
132
133 *a = 1/c;
134 *b = -1 * d / c;
135 *siga = 1/c/c * sigc;
136
137 *sigb = sigd;
138 }
139 else{
140 for(
int i = 0; i <
n; i++){
141 float temp = (y[i] +
x[i])/sqrt(2.0);
142 y[i] = (y[i] -
x[i])/sqrt(2.0);
144 }
145
146 if(seg == 1 || seg == 5){
147 for(
int i = 0; i <
n; i++){
150 }
151 status =
LineFit(x,y,
w,
n,a,b,chisq,siga,sigb);
152 }
153 else if(seg == 3 || seg == 7){
154 for(
int i = 0; i <
n; i++){
156 y[i] -= gap0y;
157 }
158 status =
LineFit(y,x,
w,
n,a,b,chisq,siga,sigb);
159
160 }
161
162 }
163
164
165 }
166
167 }
168
169 return status;
170
171}
HepPoint3D GetCenter() const
Get gap center position in global coordinate.
MucGeoGap * GetGap(const int part, const int seg, const int gap) const
Get a pointer to the gap identified by (part,seg,gap).
static MucGeoGeneral * Instance()
Get a pointer to the single instance of MucGeoGeneral.
int LineFit(float x[], float y[], float w[], int n, float *a, float *b, float *chisq, float *siga, float *sigb)