187 gradient[0]=fGradient1*(
tesla/
m)/coef;
188 gradient[1]=fGradient2*(
tesla/
m)/coef;
189 gradient[2]=fGradient3*(
tesla/
m)/coef;
190 gradient[3]=fGradient4*(
tesla/
m)/coef;
191 gradient[4]=-fGradient3*(
tesla/
m)/coef;
193 for (quad=0; quad<=4; quad++)
195 if ((quad+1)==1) {z = point[2] + 3720 *
mm;}
196 if ((quad+1)==2) {z = point[2] + 3580 *
mm;}
197 if ((quad+1)==3) {z = point[2] + 330 *
mm;}
198 if ((quad+1)==4) {z = point[2] + 190 *
mm;}
199 if ((quad+1)==5) {z = point[2] + 50 *
mm;}
205 x>=fMinix && x<=fMaxix &&
206 y>=fMiniy && y<=fMaxiy &&
207 z>=fMiniz && z<=fMaxiz
212 double xfraction = (x - fMinix) / fDx;
213 double yfraction = (y - fMiniy) / fDy;
214 double zfraction = (z - fMiniz) / fDz;
218 double xdindex, ydindex, zdindex;
222 double xlocal = ( std::modf(xfraction*(fNx-1), &xdindex));
223 double ylocal = ( std::modf(yfraction*(fNy-1), &ydindex));
224 double zlocal = ( std::modf(zfraction*(fNz-1), &zdindex));
228 int xindex =
static_cast<int>(xdindex);
229 int yindex =
static_cast<int>(ydindex);
230 int zindex =
static_cast<int>(zdindex);
234 (fXField[xindex ][yindex ][zindex ] * (1-xlocal) * (1-ylocal) * (1-zlocal) +
235 fXField[xindex ][yindex ][zindex+1] * (1-xlocal) * (1-ylocal) * zlocal +
236 fXField[xindex ][yindex+1][zindex ] * (1-xlocal) * ylocal * (1-zlocal) +
237 fXField[xindex ][yindex+1][zindex+1] * (1-xlocal) * ylocal * zlocal +
238 fXField[xindex+1][yindex ][zindex ] * xlocal * (1-ylocal) * (1-zlocal) +
239 fXField[xindex+1][yindex ][zindex+1] * xlocal * (1-ylocal) * zlocal +
240 fXField[xindex+1][yindex+1][zindex ] * xlocal * ylocal * (1-zlocal) +
241 fXField[xindex+1][yindex+1][zindex+1] * xlocal * ylocal * zlocal)*gradient[quad]
245 (fYField[xindex ][yindex ][zindex ] * (1-xlocal) * (1-ylocal) * (1-zlocal) +
246 fYField[xindex ][yindex ][zindex+1] * (1-xlocal) * (1-ylocal) * zlocal +
247 fYField[xindex ][yindex+1][zindex ] * (1-xlocal) * ylocal * (1-zlocal) +
248 fYField[xindex ][yindex+1][zindex+1] * (1-xlocal) * ylocal * zlocal +
249 fYField[xindex+1][yindex ][zindex ] * xlocal * (1-ylocal) * (1-zlocal) +
250 fYField[xindex+1][yindex ][zindex+1] * xlocal * (1-ylocal) * zlocal +
251 fYField[xindex+1][yindex+1][zindex ] * xlocal * ylocal * (1-zlocal) +
252 fYField[xindex+1][yindex+1][zindex+1] * xlocal * ylocal * zlocal)*gradient[quad]
256 (fZField[xindex ][yindex ][zindex ] * (1-xlocal) * (1-ylocal) * (1-zlocal) +
257 fZField[xindex ][yindex ][zindex+1] * (1-xlocal) * (1-ylocal) * zlocal +
258 fZField[xindex ][yindex+1][zindex ] * (1-xlocal) * ylocal * (1-zlocal) +
259 fZField[xindex ][yindex+1][zindex+1] * (1-xlocal) * ylocal * zlocal +
260 fZField[xindex+1][yindex ][zindex ] * xlocal * (1-ylocal) * (1-zlocal) +
261 fZField[xindex+1][yindex ][zindex+1] * xlocal * (1-ylocal) * zlocal +
262 fZField[xindex+1][yindex+1][zindex ] * xlocal * ylocal * (1-zlocal) +
263 fZField[xindex+1][yindex+1][zindex+1] * xlocal * ylocal * zlocal)*gradient[quad]
294 if (z>=-3770*
mm && z<=-3670*
mm) G0 = (fGradient1/coef)*
tesla/
m;
295 if (z>=-3630*
mm && z<=-3530*
mm) G0 = (fGradient2/coef)*
tesla/
m;
297 if (z>=-380*
mm && z<=-280*
mm) G0 = (fGradient3/coef)*
tesla/
m;
298 if (z>=-240*
mm && z<=-140*
mm) G0 = (fGradient4/coef)*
tesla/
m;
299 if (z>=-100*
mm && z<=0*
mm) G0 = (-fGradient3/coef)*
tesla/
m;
331 G4double Grad1, Grad2, Grad3, Grad4, Grad5;
349 if ( (z>=-3900*
mm && z<-3470*
mm) || (z>=-490*
mm && z<100*
mm) )
367 gradient[0] =Grad1*(
tesla/
m)/coef;
376 gradient[1] =Grad2*(
tesla/
m)/coef;
387 gradient[2] = Grad3*(
tesla/
m)/coef;
396 gradient[3] = Grad4*(
tesla/
m)/coef;
405 gradient[4] = Grad5*(
tesla/
m)/coef;
408 G4double Bx_local,By_local,Bz_local;
409 Bx_local = 0; By_local = 0; Bz_local = 0;
413 x_local= 0; y_local=0; z_local=0;
435 for (
G4int i=0;i<5; i++)
440 zoprime = lineZ + i*140*
mm;
443 z_local = (z - zoprime);
447 zoprime = lineZ + i*140*mm +(3150-40)*mm;
451 z_local = (z - zoprime);
455 if ( z_local < -z2[i] || z_local > z2[i])
463 if ( (z_local>=-z1[i]) && (z_local<=z1[i]) )
471 if ( ((z_local>=-z2[i]) && (z_local<-z1[i])) || ((z_local>z1[i]) && (z_local<=z2[i])) )
474 myVars = ( z_local - z1[i]) / a0[i];
475 if (z_local<-z1[i]) myVars = ( - z_local - z1[i]) / a0[i];
478 P0 = c0[i]+c1[i]*myVars+c2[i]*myVars*myVars;
480 P1 = c1[i]/a0[i]+2*c2[i]*(z_local-z1[i])/a0[i]/a0[i];
481 if (z_local<-z1[i]) P1 = -c1[i]/a0[i]+2*c2[i]*(z_local+z1[i])/a0[i]/a0[i];
483 P2 = 2*c2[i]/a0[i]/a0[i];
485 cte = 1 +
G4Exp(c0[i]);
489 K2 = -cte*
G4Exp(P0)*(
491 +2*P1*K1/(1+
G4Exp(P0))/cte
495 K3 = -cte*
G4Exp(P0)*(
497 +4*K1*(P1*P1+P2)/(1+
G4Exp(P0))/cte
498 +2*P1*(K1*K1/cte/cte+K2/(1+
G4Exp(P0))/cte)
501 G0 = gradient[i]*cte/(1+
G4Exp(P0));
508 Bx_local = y_local*(G0-(1./12)*(3*x_local*x_local+y_local*y_local)*G2);
509 By_local = x_local*(G0-(1./12)*(3*y_local*y_local+x_local*x_local)*G2);
510 Bz_local = x_local*y_local*(G1-(1./12)*(x_local*x_local+y_local*y_local)*G3);
static constexpr double tesla
static c2_factory< G4double > c2
static constexpr double mm
static const G4double * P1[nN]
static const G4double * P0[nN]
static constexpr double m
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
static const G4double * P2[nN]