From 77f952fc9199b2a0b4a21a535ebcd13020b1a649 Mon Sep 17 00:00:00 2001
From: zhang <zhang@9a6e40ed-f3a0-4838-9b4a-bf418f78e88d>
Date: Thu, 22 Dec 2011 13:03:30 +0000
Subject: [PATCH] 1) Add feature to read virtual source of coupling for soleil
 lattice 2) Add feature to turn off quadrupole fringe field. 3) Separate
 misalignment errors and COD correction.

---
 tracy/tracy/src/read_script.cc | 52 +++++++++++++++++++---------------
 1 file changed, 29 insertions(+), 23 deletions(-)

diff --git a/tracy/tracy/src/read_script.cc b/tracy/tracy/src/read_script.cc
index 9c3d3c2..b7efda9 100644
--- a/tracy/tracy/src/read_script.cc
+++ b/tracy/tracy/src/read_script.cc
@@ -34,10 +34,12 @@ char girder_file[max_str];
 
 
 
- // multipole files
+ // multipole files; for soleil lattice
 char multipole_file[max_str];
   // multipole file for soleil lattice 
 char fic_hcorr[max_str],fic_vcorr[max_str], fic_skew[max_str];
+ // files to set sources of coupling; for SOLEIL lattice
+char virtualskewquad_file[max_str];
 
 //errors
 //char fe_file[max_str]; //the same as multipole_file[max_str]????
@@ -161,11 +163,18 @@ void read_script(const char *param_file_name, bool rd_lat, long& CommNo, UserCom
       else if (strcmp("multipole_file", name) == 0){ 
         sscanf(line, "%*s %s", str);
         sprintf(multipole_file,"%s%s", in_dir, str); /* add file directory of the multipole file*/
+      } //virtual skew quadrupole file; for soleil lattice
+        else if (strcmp("virtualskewquad_file", name) == 0){ 
+        sscanf(line, "%*s %s", str);
+        sprintf(virtualskewquad_file,"%s%s", in_dir, str); /* add file directory of the multipole file*/
       } 
       
       /* read in bool flags */
         else if (strcmp("QuadFringeOnFlag", name) == 0){
 	  strcpy(UserCommandFlag[CommNo].CommandStr,name);
+      } 
+        else if (strcmp("QuadFringeOffFlag", name) == 0){
+	  strcpy(UserCommandFlag[CommNo].CommandStr,name);
       } 
         else if (strcmp("RFvoltageFlag", name) == 0){
 	  sscanf(line, "%*s %lf", &(UserCommandFlag[CommNo].RFvolt));
@@ -190,12 +199,9 @@ void read_script(const char *param_file_name, bool rd_lat, long& CommNo, UserCom
 	  sprintf(UserCommandFlag[CommNo].ae_file,"%s%s", in_dir, str);
 	  strcpy(UserCommandFlag[CommNo].CommandStr,name);
        } 
-      
-      
       //read multipole errors; specific for SOLEIL lattice
       else if (strcmp("ReadMultipoleFlag", name) == 0){
             strcpy(UserCommandFlag[CommNo].CommandStr,name);
-        
       }else if (strcmp("fic_hcorr", name) == 0){// read of h-correctors for multipoles
         sscanf(line, "%*s %s", str);
         sprintf(fic_hcorr,"%s%s", in_dir, str);
@@ -205,7 +211,11 @@ void read_script(const char *param_file_name, bool rd_lat, long& CommNo, UserCom
       }else if (strcmp("fic_skew", name) == 0){// read of skew quads for multipoles
         sscanf(line, "%*s %s", str);
         sprintf(fic_skew,"%s%s", in_dir, str);
-      } 
+      }
+      // for soleil lattice
+      else if (strcmp("ReadVirtualSkewquadFlag", name) == 0){
+            strcpy(UserCommandFlag[CommNo].CommandStr,name);  
+      }
        //print twiss parameters flag
       else if (strcmp("PrintTwissFlag", name) == 0){
          sscanf(line, "%*s %s",nextpara);
@@ -445,17 +455,8 @@ void read_script(const char *param_file_name, bool rd_lat, long& CommNo, UserCom
        else if (strcmp("TousTrackFlag", name) == 0){
         strcpy(UserCommandFlag[CommNo].CommandStr,name); 
       }
-  
-      //correctors for COD correction
-       else if (strcmp("hcorr_file", name) == 0){ 
-        sscanf(line, "%*s %s", str);
-        sprintf(hcorr_file,"%s%s", in_dir, str); /* add file directory of the multipole file*/
-      }
-       else if (strcmp("vcorr_file", name) == 0){ 
-        sscanf(line, "%*s %s", str);
-        sprintf(vcorr_file,"%s%s", in_dir, str); /* add file directory of the multipole file*/
-      }
-        else if (strcmp("bpm_name", name) == 0){ 
+      //bpms and h/v correctors used for orbit correction
+      else if (strcmp("bpm_name", name) == 0){ 
         sscanf(line, "%*s %s", bpm_name); /* the name of bpm */
       }
       else if (strcmp("h_corr", name) == 0){ 
@@ -473,27 +474,32 @@ void read_script(const char *param_file_name, bool rd_lat, long& CommNo, UserCom
       else if (strcmp("ge", name) == 0){ 
         sscanf(line, "%*s %s", ge_name); /* name of end of the girder */
       }
-
       else if (strcmp("normalcut", name) == 0){
         sscanf(line, "%*s %d", &idummy);
         fprintf(stdout,"User value for cutting at n sigma-s the normal distributions\n");
         setrancut(idummy); /* set normal cut for computation: random data are n sigma-s*/
       }
+      //flag to do orbit correction
+      else if (strcmp("CODCorrectFlag", name) == 0){
+        strcpy(UserCommandFlag[CommNo].CommandStr,name);
+      } 
       //set parameters for COD correction
       else if (strcmp("n_orbit", name) == 0){
         sscanf(line, "%*s %d", &n_orbit);
       }
-      else if (strcmp("n_scale", name) == 0){
-        sscanf(line, "%*s %d", &n_scale);
-      }
-      else if (strcmp("n_stat", name) == 0){
-        sscanf(line, "%*s %d", &n_stat);
-      }
       else if (strcmp("nwh", name) == 0){
         sscanf(line, "%*s %d", &nwh);
       }
       else if (strcmp("nwv", name) == 0){
         sscanf(line, "%*s %d", &nwv);
+      }
+       else if (strcmp("hcorr_file", name) == 0){ 
+        sscanf(line, "%*s %s", str);
+        sprintf(hcorr_file,"%s%s", in_dir, str); /* add file directory*/
+      }
+       else if (strcmp("vcorr_file", name) == 0){ 
+        sscanf(line, "%*s %s", str);
+        sprintf(vcorr_file,"%s%s", in_dir, str); /* add file directory*/
       }
       //ID correction
       else if (strcmp("IDCorrFlag", name) == 0)
-- 
GitLab