Line | |
---|
1 | subroutine elipsdp(nt90,n,x,y,a,b,xc,yc,e) |
---|
2 | c |
---|
3 | c subroutine for parmila to fit an elipse to a set of phase space |
---|
4 | c points. |
---|
5 | c n = no of points |
---|
6 | c x,y = coordinates |
---|
7 | c a,b = alpha & beta of ellipse |
---|
8 | c xc,yc = mean for x and y |
---|
9 | c e = emittance |
---|
10 | c e = gamma*x**2 + 2*alpha*x*y + beta*y**2 |
---|
11 | c note that we do not let the centroid shift from the minimum e value |
---|
12 | c |
---|
13 | c-------------------------------------------------------------------------- |
---|
14 | implicit double precision (a,b,e,f,r,s,x,y) |
---|
15 | c |
---|
16 | include 'ucom.h' |
---|
17 | c |
---|
18 | dimension x(n),y(n) |
---|
19 | c-------------------------------------------------------------------------- |
---|
20 | c* |
---|
21 | fx=0. |
---|
22 | fy=0. |
---|
23 | sx=0. |
---|
24 | sy=0. |
---|
25 | sxy=0. |
---|
26 | c minimize e |
---|
27 | do 10 i = 1,n |
---|
28 | fx = fx + x(i) |
---|
29 | fy = fy + y(i) |
---|
30 | sx = sx + x(i)*x(i) |
---|
31 | sxy = sxy + x(i)*y(i) |
---|
32 | sy = sy + y(i)*y(i) |
---|
33 | 10 continue |
---|
34 | xc = fx/n |
---|
35 | yc = fy/n |
---|
36 | scx = sx/n - xc*xc |
---|
37 | scy = sy/n - yc*yc |
---|
38 | scxy = sxy/n - xc*yc |
---|
39 | rbm=(scx*scy - scxy*scxy) |
---|
40 | if(rbm.le.0.) then |
---|
41 | if(nt90.eq.1) then |
---|
42 | write(nemit,*) |
---|
43 | *' no calculation of emittances for (x,xp): negative square root' |
---|
44 | else |
---|
45 | write(nemit,*) |
---|
46 | *' no calculation of emittances for (y,yp): negative square root' |
---|
47 | endif |
---|
48 | else |
---|
49 | e = dsqrt(rbm) |
---|
50 | a = -scxy/e |
---|
51 | b = scx/e |
---|
52 | endif |
---|
53 | return |
---|
54 | end |
---|
55 | c++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++* |
---|
Note: See
TracBrowser
for help on using the repository browser.