From f6d15c6693384022acc428fbe095910bf26c49ef Mon Sep 17 00:00:00 2001
From: zhang <zhang@9a6e40ed-f3a0-4838-9b4a-bf418f78e88d>
Date: Fri, 8 Apr 2011 17:02:08 +0000
Subject: [PATCH] 08/04/2011

Add the functions to do orbit corrections, from nsls-ii_lib_templ.h and physlib_templ.h
---
 tracy/tracy/inc/lsoc.h | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/tracy/tracy/inc/lsoc.h b/tracy/tracy/inc/lsoc.h
index 592f7a0..82ca5cb 100644
--- a/tracy/tracy/inc/lsoc.h
+++ b/tracy/tracy/inc/lsoc.h
@@ -8,8 +8,46 @@
 
 */
 
+
+extern const int   nCOR;
+extern const char  hOrbitFileName[];     
+extern const char  vOrbitFileName[];    
+extern const char  OrbScanFileName[];    
+ 
+ extern FILE     *OrbScanFile;
+
+/****** for orbit correction *********/
 void prt_gcmat(int bpm, int corr, int plane);
 
 void gcmat(int bpm, int corr, int plane);
 
 void lsoc(int niter, int bpm, int corr, int plane);
+
+/***The following functions are copied from nsls-ii_lib_templ.h, need to be tested***/
+bool CorrectCOD_Ns(FILE *hOrbitFile, FILE *vOrbitFile, const char *ae_file, const int n_orbit,
+     const int n, const int k, const int nwh, const int nwv, int *hcorrIdx, int *vcorrIdx);
+     
+void readCorrectorList(const char *hCorrListName, const char *vCorrListName, int *hcorrIdx, int *vcorrIdx);
+
+void gcmats(int bpm, int corr, int plane, int *corrIdx);
+
+void LoadFieldErrs(const char *FieldErrorFile, const bool Scale_it,
+     const double Scale, const bool new_rnd, const int ik);
+     
+bool CorrectCOD_Ns(FILE *hOrbitFile, FILE *vOrbitFile, const char *ae_file, const int n_orbit,
+     const int n, const int k, const int nwh, const int nwv, int *hcorrIdx, int *vcorrIdx);
+     
+bool CorrectCODs(FILE *hOrbitFile, FILE *vOrbitFile, int n_orbit, int nwh, int nwv, int *hcorrIdx, int *vcorrIdx);
+
+void lsoc2(int niter, int bpm, int corr, int plane, int nval);
+
+void lsoc2s(int niter, int bpm, int corr, int plane, int nval, int *corIdx);
+
+void Align_BPM2quad(const int n);
+
+
+/*** The following functions are copied from physlib_templ.h, need to be tested ***/
+void codstats(FILE *hOrbitFile, FILE *vOrbitFile, double *mean, double *sigma, double *xmax, long lastpos, bool all);
+
+void corstat(double *mean, double *sigma, double *xmax, long lastpos);
+
-- 
GitLab