8 : theInnerPoint(inner), theOuterPoint(outer), theVertexPoint(inner) {
14 double x1 = inner.
x();
15 double y1 = inner.
y();
16 double x2 = outer.
x();
17 double y2 = outer.
y();
18 double alpha1 = (direction.
y() != 0) ? atan(-direction.
x() / direction.
y()) :
PI / 2;
20 theRho = (denominator != 0) ? ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) / denominator : 1E12;
40 : theInnerPoint(innerPoint), theOuterPoint(outerPoint), theVertexPoint(vertexPoint) {
41 FastCircle circle(outerPoint, innerPoint, vertexPoint);
70 double s = (SecInnerPoint - InitialVertex).
mag();
71 double deltaTheta = s / primCircle.
rho();
73 double minTangentCondition = 1E12;
77 double theta = deltaTheta / (NITER - 1);
79 for (
int i = 0;
i < NITER;
i++) {
81 TangentCircle secCircle(SecOuterPoint, SecInnerPoint, vertex);
84 double minCond =
isTangent(primCircle, secCircle);
89 if (minCond < minTangentCondition) {
90 minTangentCondition = minCond;
91 theCorrectSecCircle = secCircle;
93 if (
i == 0 && ((vertex - SecInnerPoint).
mag() > (InitialVertex - SecInnerPoint).
mag())) {
95 vertex =
getPosition(primCircle, InitialVertex, theta, dir);
96 LogDebug(
"NuclearSeedGenerator") <<
"Change direction to look for vertex"
105 theX0 = theCorrectSecCircle.
x0();
106 theY0 = theCorrectSecCircle.
y0();
117 double distanceBetweenCircle = (primCircle.
x0() - secCircle.
x0()) * (primCircle.
x0() - secCircle.
x0()) +
118 (primCircle.
y0() - secCircle.
y0()) * (primCircle.
y0() - secCircle.
y0());
119 double RadiusSum = (primCircle.
rho() + secCircle.
rho()) * (primCircle.
rho() + secCircle.
rho());
120 double RadiusDifference = (primCircle.
rho() - secCircle.
rho()) * (primCircle.
rho() - secCircle.
rho());
122 return std::min(fabs(RadiusSum - distanceBetweenCircle), fabs(RadiusDifference - distanceBetweenCircle));
127 LogDebug(
"NuclearSeedGenerator") <<
"Center of TangentCircle not calculated but used !!!"
139 double sum = (
dir + fastDir).
mag();
158 double x2 = initalPosition.
x();
159 double y2 = initalPosition.
y();
161 if ((x2 > circle.
x0()) && dir > 0) {
166 if ((x2 > circle.
x0()) && dir < 0) {
171 if ((x2 < circle.
x0()) && dir > 0) {
176 if ((x2 < circle.
x0()) && dir < 0) {
182 double l = 2 * circle.
rho() *
sin(theta / 2);
183 double alpha = atan((y2 - circle.
y0()) / (x2 - circle.
x0()));
184 double beta =
PI / 2 - theta / 2;
185 double gamma =
PI + sign[2] * alpha -
beta;
187 double xnew = x2 + sign[0] * l *
cos(gamma);
188 double ynew = y2 + sign[1] * l *
sin(gamma);
197 return fabs(1 / circle1.
rho() - 1 / circle2.
rho());
201 return fabs(1 / circle1.
rho() - 1 / circle2.
rho());
218 if (u.
x() *
F.x() + u.
y() *
F.y() > 0)
224 LogDebug(
"NuclearSeedGenerator") <<
"Inconsistency in calculation of the charge"
233 double tz = v.
x() * u.
y() - v.
y() * u.
x();
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