9 #define Conv4HitsReco2_cxx
18 Refresh(vPhotVertex, h1, h2, h3, h4);
27 fPV = vPhotVertex;
fPV.SetZ(0.);
59 double x11,x12,x21,x22,y11,y12,y21,y22;
61 x11 = v11.X(); y11 = v11.Y();
62 x12 = v12.X(); y12 = v12.Y();
63 x21 = v21.X(); y21 = v21.Y();
64 x22 = v22.X(); y22 = v22.Y();
68 double SignCOSP = 1.;
if(COSP < 0.) SignCOSP = -1.;
69 double AbsCOSP = std::fabs(COSP);
71 double X11 = -std::fabs(x11*SINP*SignCOSP - y11*AbsCOSP);
72 double Y11 = std::fabs(y11*SINP*SignCOSP + x11*AbsCOSP);
74 double X21 = -std::fabs(x21*SINP*SignCOSP - y21*AbsCOSP);
75 double Y21 = std::fabs(y21*SINP*SignCOSP + x21*AbsCOSP);
77 double X12 = std::fabs(x12*SINP*SignCOSP - y12*AbsCOSP);
78 double Y12 = std::fabs(y12*SINP*SignCOSP + x12*AbsCOSP);
80 double X22 = std::fabs(x22*SINP*SignCOSP - y22*AbsCOSP);
81 double Y22 = std::fabs(y22*SINP*SignCOSP + x22*AbsCOSP);
83 V11.SetXYZ(X11,Y11,0.);
84 V12.SetXYZ(X12,Y12,0.);
85 V21.SetXYZ(X21,Y21,0.);
86 V22.SetXYZ(X22,Y22,0.);
104 double x11,x12,x21,x22,y11,y12,y21,y22;
116 double tempr1 =
std::sqrt(y11*y11 + x11*x11);
117 double tempr2 =
std::sqrt(y12*y12 + x12*x12);
119 double Phi1 = 2.0 * std::atan(y11 / (x11+tempr1));
120 double Phi2 = 2.0 * std::atan(y12 / (x12+tempr2));
122 if (Phi1<Phi2) Phi1 += 2.0 * 3.141592653;
126 double NextPhi = ( Phi1 + Phi2 ) / 2.0;
128 double prevR1 = 0;
double prevR2 = 0;
129 double R1 = 0;
double R2 = 0;
137 double SignCOSP = 1.;
if(COSP < 0.) SignCOSP = -1.;
138 double AbsCOSP = std::fabs(COSP);
140 double X11 = -std::fabs(x11*SINP*SignCOSP - y11*AbsCOSP);
141 double Y11 = std::fabs(y11*SINP*SignCOSP + x11*AbsCOSP);
143 double X21 = -std::fabs(x21*SINP*SignCOSP - y21*AbsCOSP);
144 double Y21 = std::fabs(y21*SINP*SignCOSP + x21*AbsCOSP);
146 double X12 = std::fabs(x12*SINP*SignCOSP - y12*AbsCOSP);
147 double Y12 = std::fabs(y12*SINP*SignCOSP + x12*AbsCOSP);
149 double X22 = std::fabs(x22*SINP*SignCOSP - y22*AbsCOSP);
150 double Y22 = std::fabs(y22*SINP*SignCOSP + x22*AbsCOSP);
157 double d1 = Y21 - Y11;
158 double d2 = Y22 - Y12;
160 if ( ( (X11*X11*d1*d1/(X21-X11)/(X21-X11) + X11*X21 + X11*d1*d1/(X21-X11)) < 0 ) ||
161 ( (X12*X12*d2*d2/(X22-X12)/(X22-X12) + X12*X22 + X12*d2*d2/(X22-X12)) < 0 ) )
162 {
fSolved = -1; fLoop =
i;
return; }
166 D1 = X11*d1/(X21-X11);
167 D1 = D1 +
std::sqrt(X11*X11*d1*d1/(X21-X11)/(X21-X11) + X11*X21 + X11*d1*d1/(X21-X11));
168 D2 = X12*d2/(X22-X12);
169 D2 = D2 +
std::sqrt(X12*X12*d2*d2/(X22-X12)/(X22-X12) + X12*X22 + X12*d2*d2/(X22-X12));
171 R1 = std::fabs((X11+X21)/2.0+(D1+d1/2.0)*d1/(X21-X11));
172 R2 = std::fabs((X12+X22)/2.0+(D2+d2/2.0)*d2/(X22-X12));
174 if ((Y11-D1)>=(Y12-D2)) {
177 NextPhi = (Phi1+Phi2)/2.0;
179 else if ((Y11-D1)<(Y12-
D2)) {
182 NextPhi = (Phi1+Phi2)/2.0;
186 double tmpPhiE = std::fabs(Phi1-Phi2);
187 double tmpRE = std::fabs( (Y11 - D1) - (Y12 - D2) );
188 double tmpRadiusE = ( std::fabs(R1-prevR1) + std::fabs(R2-prevR2) ) / 2.;
201 fRecR = ( (Y11 -
D1) + (Y12 - D2) ) / 2.0;
211 if ( (R1>0)&&(R2>0)&&(D1>0)&&(D2>0)&&((Y11-D1)>0)&&((Y12-D2)>0) )
fSignSatisfied = 1;
214 else if (
i==fLoop-1) {
223 fRecR = ( (Y11 -
D1) + (Y12 - D2) ) / 2.0;
233 if ( (R1>0)&&(R2>0)&&(D1>0)&&(D2>0)&&((Y11-D1)>0)&&((Y12-D2)>0) )
fSignSatisfied = 1;
237 prevR1 = R1; prevR2 = R2;
246 std::cout << std::endl<<
"================================================" << std::endl;
int fFixedNumberOfIterations
Sin< T >::type sin(const T &t)
void LocalTransformation(const math::XYZVector &v11, const math::XYZVector &v12, const math::XYZVector &v21, const math::XYZVector &v22, math::XYZVector &V11, math::XYZVector &V12, math::XYZVector &V21, math::XYZVector &V22, double Phi)
math::XYZVector GetMinusCenter(double &)
int ConversionCandidate(math::XYZVector &, double &, double &)
Cos< T >::type cos(const T &t)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
int fMaxNumberOfIterations
void Refresh(math::XYZVector &vPhotVertex, math::XYZVector &h1, math::XYZVector &h2, math::XYZVector &h3, math::XYZVector &h4)
math::XYZVector GetPlusCenter(double &)
Power< A, B >::type pow(const A &a, const B &b)