diff --git a/tracy/tracy/src/soleilcommon.cc b/tracy/tracy/src/soleilcommon.cc
index 1a619de05eef0187a7b5873d2f8fc42205edb8bf..bfc0c24c743b994f8116213741b99370565e3d94 100644
--- a/tracy/tracy/src/soleilcommon.cc
+++ b/tracy/tracy/src/soleilcommon.cc
@@ -73,7 +73,10 @@
        02/06/08 energy RF acceptance set to 1 just to avoid overflow during tracking
        22/06/10 add new globval.  flag and modify new name of variables
                  from Tracy III Read_Lattice(), which is defined in physlib.cc 
-
+       30/06/11  Get the family index of RF cavity for the lattice of ring; and check whether the RF harmonic number is defined. This is critical to get the 
+       correct COD for the lattice with negative momentum compact factor.
+       
+		 
 ****************************************************************************/
 void Read_Lattice(char *fic)
 {
@@ -142,6 +145,16 @@ void Read_Lattice(char *fic)
   // for a ring 
   if (globval.RingType == 1)
   {      
+     /* find the family index of RF cavity*/
+    for(i=0; i<=globval.Cell_nLoc; i++){
+      if(Cell[i].Elem.Pkind == Cavity)
+        globval.cav =  ElemIndex(Cell[i].Elem.PName);    
+    }
+    /*check whether the RF cavity hormonic number is defined or not*/
+    if(Cell[Elem_GetPos(globval.cav, 1)].Elem.C->Ph == 0){
+      printf("soleilcommon:    Error!!! Define RF cavity harmonic number in the lattice!\n");
+      exit_(1);
+    }
     
     /* Defines global variables for Tracy code */