Skip to content
Snippets Groups Projects
Commit 91a695f1 authored by Daniel Jeans's avatar Daniel Jeans Committed by Marko Petric
Browse files

FieldTypes: add factorial function to definition of multipole coefficients/skews

parent 5dc1d296
No related branches found
No related tags found
No related merge requests found
...@@ -95,8 +95,8 @@ namespace dd4hep { ...@@ -95,8 +95,8 @@ namespace dd4hep {
* The different momenta are given by: * The different momenta are given by:
* *
* \f{eqnarray*}{ * \f{eqnarray*}{
* B_y + i*B_x &=& C_n * (x + iy)^{n-1} \\ * B_y + i*B_x &=& ( 1/(n-1)! )* C_n * (x + iy)^{n-1} \\
* B_sum = B_y + i B_x &=& Sum_{n=1..4} (b_n + ia_n) (x + iy)^{n-1} \\ * B_sum = B_y + i B_x &=& Sum_{n=1..4} ( 1/(n-1)! )*(b_n + ia_n) (x + iy)^{n-1} \\
* \f} * \f}
* With C_n being the complex multipole coefficients and * With C_n being the complex multipole coefficients and
* b_n the "normal multipole coefficients" and a_n the "skew multipole coefficients". * b_n the "normal multipole coefficients" and a_n the "skew multipole coefficients".
...@@ -122,17 +122,17 @@ namespace dd4hep { ...@@ -122,17 +122,17 @@ namespace dd4hep {
* \li Sextupole (n=3): * \li Sextupole (n=3):
* *
* \f{eqnarray*}{ * \f{eqnarray*}{
* B_y + i B_x &=& (b_3 +ia_3) (x^2 + 2ixy - y^2) \\ * B_y + i B_x &=& (1/2) * (b_3 +ia_3) (x^2 + 2ixy - y^2) \\
* B_y &=& b_3 x^2 - b_3 y^2 - 2 a_3 xy \\ * B_y &=& (1/2) * ( b_3 x^2 - b_3 y^2 - 2 a_3 xy) \\
* B_x &=& a_3 x^2 - a_3 y^2 + 2 b_3 xy \\ * B_x &=& (1/2) * (a_3 x^2 - a_3 y^2 + 2 b_3 xy) \\
* \f} * \f}
* *
* \li Octopole (n=4): * \li Octopole (n=4):
* *
* \f{eqnarray*}{ * \f{eqnarray*}{
* B_y + i B_x &=& (b_4 +ia_4) (x^3 + 3ix^2y - 3xy^2 -iy^3) \\ * B_y + i B_x &=& (1/6) * (b_4 +ia_4) (x^3 + 3ix^2y - 3xy^2 -iy^3) \\
* B_y &=& b_4 x^3 - 3 b_4 x y^2 - 3 a_4 x^2 y + a_4 y^3 \\ * B_y &=& (1/6) * (b_4 x^3 - 3 b_4 x y^2 - 3 a_4 x^2 y + a_4 y^3) \\
* B_x &=& 3 b_4 x^2 y - b_4 y^3 + a_4 x^3 - 3 a_4 x y^2 \\ * B_x &=& (1/6) * (3 b_4 x^2 y - b_4 y^3 + a_4 x^3 - 3 a_4 x y^2) \ \
* \f} * \f}
* *
* The defined field components only apply within the shape 'volume'. * The defined field components only apply within the shape 'volume'.
......
...@@ -99,12 +99,12 @@ void MultipoleField::fieldComponents(const double* pos, double* field) { ...@@ -99,12 +99,12 @@ void MultipoleField::fieldComponents(const double* pos, double* field) {
double y2 = y*y; double y2 = y*y;
switch(coefficents.size()) { switch(coefficents.size()) {
case 4: // Ocupole momentum case 4: // Ocupole momentum
by += coefficents[3] * (x2*x - 3.0*x*y2) + skews[3]*(y2*y - 3.0*x2*y); by += (1./6.) * ( coefficents[3] * (x2*x - 3.0*x*y2) + skews[3]*(y2*y - 3.0*x2*y) );
bx += coefficents[3] * (3.0*x2*y - y2*y) + skews[3]*(x2*x - 3.0*x*y2); bx += (1./6.) * ( coefficents[3] * (3.0*x2*y - y2*y) + skews[3]*(x2*x - 3.0*x*y2) );
[[fallthrough]]; [[fallthrough]];
case 3: // Sextupole momentum: case 3: // Sextupole momentum:
by += coefficents[2] * (x2 - y2) - skews[2] * 2.0 * xy; by += (1./2.) * ( coefficents[2] * (x2 - y2) - skews[2] * 2.0 * xy );
bx += coefficents[2] * 2.0 * xy + skews[2] * (x2 - y2); bx += (1./2.) * ( coefficents[2] * 2.0 * xy + skews[2] * (x2 - y2) );
[[fallthrough]]; [[fallthrough]];
case 2: // Quadrupole momentum: case 2: // Quadrupole momentum:
bx += coefficents[1] * y + skews[1]*x; bx += coefficents[1] * y + skews[1]*x;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment