From ff16e9549796b3d2c3a5d54369897ab405f3a0ff Mon Sep 17 00:00:00 2001
From: zhang <zhang@9a6e40ed-f3a0-4838-9b4a-bf418f78e88d>
Date: Thu, 30 Jun 2011 16:39:24 +0000
Subject: [PATCH] 30/06/2011

Fix the bug to get momentum compact factor.
---
 tracy/tracy/src/soleillib.cc | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tracy/tracy/src/soleillib.cc b/tracy/tracy/src/soleillib.cc
index 917d554..5579dc5 100644
--- a/tracy/tracy/src/soleillib.cc
+++ b/tracy/tracy/src/soleillib.cc
@@ -3001,7 +3001,8 @@ void SetSkewQuad(void)
 	         since the Cell_Pass( ) is tracking from element i0 to i1(tracy 3), and
 		       the Cell_Pass( ) is tracking from element i0+1L to i1(tracy 2).
 	   17/04/11 add number of turn
-                                                             		
+        27/06/11  fix the bug of the index in the tabz and tabpz when calling Trac( ); 
+                 fix the bug in the vertical closed orbit when calling Trac( ).                                                     		
 ****************************************************************************/
 void MomentumAcceptance(long deb, long fin, double ep_min, double ep_max,
 			long nstepp, double em_min, double em_max, long nstepm, long nturn)
@@ -3170,7 +3171,7 @@ void MomentumAcceptance(long deb, long fin, double ep_min, double ep_max,
       if (trace)  printf("i=%4ld pos=%4ld dp=%6.4g\n",i,pos,dp2);
       if (0) fprintf(stdout,"pos=%4ld z0 =% 10.5f  pz0 =% 10.5f  \n", pos, tabz0[i-1L][pos-1L], tabpz0[i-1L][pos-1L]);
       
-      Trac(x, px, tabz0[i-1L][pos], tabpz0[i-1L][pos-1L], dp2+delta , ctau0, nturn, pos, lastn, lastpos, outf1);
+      Trac(x, px, z+tabz0[i-1L][pos-1L], pz+tabpz0[i-1L][pos-1L], dp2+delta , ctau0, nturn, pos, lastn, lastpos, outf1);
     
     }while (((lastn) == nturn) && (i != nstepp));
             
@@ -3320,7 +3321,7 @@ void MomentumAcceptance(long deb, long fin, double ep_min, double ep_max,
         dp2 = em_max;
       }
       if (trace) printf("i=%4ld pos=%4ld dp=%6.4g\n",i,pos,dp2);
-      Trac(x, px, tabz0[i-1L][pos], tabpz0[i-1L][pos-1L], dp2+delta , ctau0, nturn, pos, lastn, lastpos, outf1);
+      Trac(x, px, z+tabz0[i-1L][pos-1L], pz+tabpz0[i-1L][pos-1L], dp2+delta , ctau0, nturn, pos, lastn, lastpos, outf1);
     }
     while (((lastn) == nturn) && (i != nstepm));
 
@@ -4211,7 +4212,7 @@ void Coupling_Edwards_Teng(void)
   S[0][1] = 1.0; S[1][0] = -1.0;
 
   /* Compute invariants */
-  GetEmittance(ElemIndex("cav"), true);
+  GetEmittance(globval.cav, true);
  
   
   /* Set everything to 4D integrator */
-- 
GitLab