From a94174a9ef02b5af3c9f5ad259c308b6732ba106 Mon Sep 17 00:00:00 2001
From: zhang <zhang@9a6e40ed-f3a0-4838-9b4a-bf418f78e88d>
Date: Wed, 23 Mar 2011 08:09:27 +0000
Subject: [PATCH] 23/03/2011

1) Add "PrintCODFlag"
---
 tracy/tools/soltracy.cc        | 17 ++++++++++++-----
 tracy/tracy/inc/read_script.h  |  2 +-
 tracy/tracy/src/read_script.cc |  9 ++++++++-
 3 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/tracy/tools/soltracy.cc b/tracy/tools/soltracy.cc
index 2c8a458..069509d 100644
--- a/tracy/tools/soltracy.cc
+++ b/tracy/tools/soltracy.cc
@@ -34,8 +34,7 @@ int main(int argc, char *argv[]) {
   // globval.pathlength  = false;
   //  globval.bpm         = 0;
 
-  //  const double  x_max_FMA = 10e-3,  delta_FMA = 10e-2;
-  //  const int     n_x = 801, n_dp = 80, n_tr = 2048;
+ 
   long i=0L; //initilize the for loop to read command string
   char CommandStr[max_str];
   double nux = 0, nuy = 0, ksix = 0, ksiy = 0;
@@ -68,11 +67,11 @@ int main(int argc, char *argv[]) {
   }
 
   /************************************************************************
-   writes flat file with all the design values of the lattice, very important file for debug
+    print files, very important file for debug
    *************************************************************************/
+  //print flat file with all the design values of the lattice,
   prtmfile("flat_file.dat");
-
-  // print cod
+  // print close orbit to a file
   getcod(dP, lastpos);
   prt_cod("cod.out", globval.bpm, true);
 
@@ -97,6 +96,14 @@ int main(int argc, char *argv[]) {
       cout << "print the twiss parameters to file: "<< twiss_file << "\n";
       printlatt(twiss_file);  
    }
+   //print the close orbit
+   else if(strcmp(CommandStr,"PrintCODFlag") == 0) {
+      cout << "\n";
+      cout << "print the close orbit to file: "<< cod_file << "\n";
+      getcod(dP, lastpos);
+      prt_cod(cod_file, globval.bpm, true);
+   }
+    
     
     //turn on flag for quadrupole fringe field
    else if(strcmp(CommandStr,"QuadFringeOnFlag") == 0) {
diff --git a/tracy/tracy/inc/read_script.h b/tracy/tracy/inc/read_script.h
index 5853397..081b8ac 100644
--- a/tracy/tracy/inc/read_script.h
+++ b/tracy/tracy/inc/read_script.h
@@ -113,6 +113,6 @@
 
  extern char chamber_file[max_str];
  extern char twiss_file[max_str];
-
+ extern char cod_file[max_str];
 // function
  void read_script(const char *param_file_name, bool rd_lat,long& CommNo, UserCommand UserCommandFlag[]);
diff --git a/tracy/tracy/src/read_script.cc b/tracy/tracy/src/read_script.cc
index 1ee1369..0adffff 100644
--- a/tracy/tracy/src/read_script.cc
+++ b/tracy/tracy/src/read_script.cc
@@ -30,6 +30,8 @@
 /* files */ 
  //twiss file
 char twiss_file[max_str];
+ // cod file
+char cod_file[max_str];
  //chamber file
 char chamber_file[max_str];
  // multipole files
@@ -150,10 +152,15 @@ void read_script(const char *param_file_name, bool rd_lat, long& CommNo, UserCom
       } 
       
       /* read in bool flags */
-       //print twiss parameters flag flag
+       //print twiss parameters flag
       else if (strcmp("PrintTwissFlag", name) == 0){
           sscanf(line, "%*s %s", twiss_file);
 	  strcpy(UserCommandFlag[CommNo].CommandStr,name);
+      } 
+       //print close orbit(COD) flag
+      else if (strcmp("PrintCODFlag", name) == 0){
+          sscanf(line, "%*s %s", cod_file);
+	  strcpy(UserCommandFlag[CommNo].CommandStr,name);
       } 
       //read chamber file flat
       else if (strcmp("ReadChamberFlag", name) == 0){
-- 
GitLab