8 theInnerPoint(inner), theOuterPoint(outer), theVertexPoint(inner) {
13 double x1 = inner.
x();
14 double y1 = inner.
y();
15 double x2 = outer.
x();
16 double y2 = outer.
y();
17 double alpha1 = (direction.
y() != 0) ? atan(-direction.
x()/direction.
y()) :
PI/2 ;
19 theRho = (denominator != 0) ? ((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2))/denominator : 1E12;
37 theInnerPoint(innerPoint), theOuterPoint(outerPoint), theVertexPoint(vertexPoint) {
38 FastCircle circle(outerPoint, innerPoint, vertexPoint);
58 GlobalPoint SecInnerPoint( innerPoint.
x(), innerPoint.
y(), 0);
59 GlobalPoint SecOuterPoint( outerPoint.
x(), outerPoint.
y(), 0);
62 double s = (SecInnerPoint - InitialVertex).
mag();
63 double deltaTheta = s/primCircle.
rho();
65 double minTangentCondition = 1E12;
69 double theta = deltaTheta/(NITER-1);
71 for(
int i=0;
i<NITER;
i++) {
74 TangentCircle secCircle( SecOuterPoint, SecInnerPoint, vertex );
77 double minCond =
isTangent(primCircle, secCircle);
82 if(minCond < minTangentCondition) {
83 minTangentCondition = minCond;
84 theCorrectSecCircle = secCircle;
86 if(
i==0 && ((vertex-SecInnerPoint).
mag() > (InitialVertex-SecInnerPoint).
mag()) ) {
88 vertex =
getPosition( primCircle, InitialVertex, theta, dir );
89 LogDebug(
"NuclearSeedGenerator") <<
"Change direction to look for vertex" <<
"\n";
98 theX0 = theCorrectSecCircle.
x0();
99 theY0 = theCorrectSecCircle.
y0();
110 double distanceBetweenCircle = (primCircle.
x0() - secCircle.
x0())*(primCircle.
x0() - secCircle.
x0())
111 + (primCircle.
y0() - secCircle.
y0())*(primCircle.
y0() - secCircle.
y0());
112 double RadiusSum = (primCircle.
rho() + secCircle.
rho())*(primCircle.
rho() + secCircle.
rho());
113 double RadiusDifference = (primCircle.
rho() - secCircle.
rho())*(primCircle.
rho() - secCircle.
rho());
115 return std::min( fabs(RadiusSum-distanceBetweenCircle), fabs(RadiusDifference-distanceBetweenCircle) );
121 LogDebug(
"NuclearSeedGenerator") <<
"Center of TangentCircle not calculated but used !!!" <<
"\n";
132 double sum = (
dir + fastDir).
mag();
134 if( sum < diff )
dir = (-1)*
dir;
148 double x2 = initalPosition.
x();
149 double y2 = initalPosition.
y();
151 if( (x2>circle.
x0()) && dir >0) { sign[0] = 1; sign[1] = -1; sign[2] = -1; }
152 if( (x2>circle.
x0()) && dir <0) { sign[0] = 1; sign[1] = 1; sign[2] = 1; }
153 if( (x2<circle.
x0()) && dir >0) { sign[0] = -1; sign[1] = 1; sign[2] = -1; }
154 if( (x2<circle.
x0()) && dir <0) { sign[0] = -1; sign[1] = -1; sign[2] = 1; }
156 double l = 2*circle.
rho()*
sin(theta/2);
157 double alpha = atan((y2-circle.
y0())/(x2-circle.
x0()));
158 double beta =
PI/2-theta/2;
159 double gamma =
PI + sign[2]* alpha -
beta;
161 double xnew = x2 + sign[0]*l*
cos(gamma);
162 double ynew = y2 + sign[1]*l*
sin(gamma);
171 return fabs(1/circle1.
rho() - 1/circle2.
rho());
176 return fabs(1/circle1.
rho() - 1/circle2.
rho());
196 LogDebug(
"NuclearSeedGenerator") <<
"Inconsistency in calculation of the charge" <<
"\n";
205 double tz = v.
x() * u.
y() - v.
y() * u.
x() ;
207 if(tz * magz > 0)
return 1;
else return -1;
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Sin< T >::type sin(const T &t)
Global3DPoint GlobalPoint
Geom::Theta< T > theta() const
GlobalPoint innerPoint() const
GlobalPoint getPosition(const TangentCircle &circle, const GlobalPoint &initalPosition, double theta, int direction) const
GlobalPoint theVertexPoint
GlobalPoint outerPoint() const
GlobalPoint theOuterPoint
Cos< T >::type cos(const T &t)
GlobalVector directionAtVertex()
Return the direction at the vertex.
int chargeLocally(float magz, GlobalVector v) const
GlobalVector direction(const GlobalPoint &point) const
GlobalPoint theInnerPoint
GlobalVector theDirectionAtVertex
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
double isTangent(const TangentCircle &primCircle, const TangentCircle &secCircle) const
GlobalPoint vertexPoint() const
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Global3DVector GlobalVector