Skip to content
Snippets Groups Projects
Commit 2812c55c authored by zhang's avatar zhang
Browse files

20/10/2010

1)  Now user can  specific one family of
      quadrupoles/sextupole in the input
       script, to fit tunes/charomaticities
2) User can set seed and rms value of
     rotation error coupling.
3)  No more ExperimentalFMA
4)  Add FMAPdp
5) Add RFVoltage flag, now use can
      set RF voltage in the input script.
6)  User can read multipole errors from
      a file.
7)  Fix the bug to read blank lines.
parent d6efe65c
No related branches found
No related tags found
No related merge requests found
......@@ -27,14 +27,22 @@
****************************************************************************/
/* global flag, used in script_read() and main() for read the input from script*/
bool RFvoltageFlag =false; double RFvolt =0.0;
bool TuneTracFlag = false;
bool ChromTracFlag = false;
bool FmapFlag = false, ExperimentFMAFlag = false, DetailedFMAFlag = false;
bool FmapFlag = false;
long _FmapFlag_nxpoint=31L, _FmapFlag_nypoint=21L, _FmapFlag_nturn=516L;
double _FmapFlag_xmax=0.025, _FmapFlag_ymax=0.005, _FmapFlag_delta=0.0;
bool _FmapFlag_diffusion = true;
bool FmapdpFlag = false;
long _FmapdpFlag_nxpoint=31L, _FmapdpFlag_nepoint=21L, _FmapdpFlag_nturn=516L;
double _FmapdpFlag_xmax=0.025, _FmapdpFlag_emax=0.005, _FmapdpFlag_z=0.0;
bool _FmapdpFlag_diffusion = true;
bool AmplitudeTuneShiftFlag = false;
long _AmplitudeTuneShift_nxpoint=31L; long _AmplitudeTuneShift_nypoint=21L;
long _AmplitudeTuneShift_nturn=516L; double _AmplitudeTuneShift_xmax=0.025;
......@@ -44,7 +52,8 @@ bool EnergyTuneShiftFlag = false;
long _EnergyTuneShift_npoint=31L; long _EnergyTuneShift_nturn=516L;
double _EnergyTuneShift_deltamax=0.06;
bool ErrorCouplingFlag = false; bool CouplingFlag = false;
bool ErrorCouplingFlag = false; long err_seed=0L; double err_rms=0.0;
bool CouplingFlag = false;
bool MomentumAccFlag = false;
long _MomentumAccFlag_istart=1L, _MomentumAccFlag_istop=108L,
......@@ -52,12 +61,13 @@ long _MomentumAccFlag_istart=1L, _MomentumAccFlag_istop=108L,
double _MomentumAccFlag_deltaminn=0.01, _MomentumAccFlag_deltamaxn=0.05;
double _MomentumAccFlag_deltaminp=0.01, _MomentumAccFlag_deltamaxp=0.05;
bool ReadMultipoleFlag = false;
bool MultipoleFlag = false, ThinsextFlag = false;
char fic_hcorr[max_str],fic_vcorr[max_str], fic_skew[max_str];
bool FitTuneFlag = false; double targetnux = 0, targetnuz = 0;
bool FitChromFlag = false; double targetksix = 0, targetksiz = 0;
bool FitTuneFlag = false; char qm1[max_str],qm2[max_str]; double targetnux = 0.0, targetnuz = 0.0;
bool FitChromFlag = false; char sxm1[max_str],sxm2[max_str]; double targetksix = 0.0, targetksiz = 0.0;
bool ChamberFlag = false, ChamberNoU20Flag = false, ReadChamberFlag = false;
bool GirderErrorFlag = false;
bool SigmaFlag = false;
......@@ -69,7 +79,7 @@ bool PhaseSpaceFlag = false;
bool TouschekFlag = false, IBSFlag = false, TousTrackFlag = false;
char chamber_file[max_str];
char multipole_file[max_str];
#define OLD_LATTICE
/* Read script */
......@@ -105,7 +115,8 @@ void read_script(const char *param_file_name, bool rd_lat)
printf("cfg: %s",line);
LineNum++;
if (strstr(line, "#") == NULL) {
if (strstr(line, "#") == NULL && strcmp(line,"\n") != 0) {
// get initial command token
sscanf(line, "%s", name);
......@@ -139,6 +150,10 @@ void read_script(const char *param_file_name, bool rd_lat)
sscanf(line, "%*s %s", str);
sprintf(chamber_file,"%s%s", in_dir, str); /* add file directory of the chamber file*/
}
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 chamber file*/
}
/* read in bool flags */
else if (strcmp("ChamberFlag", name) == 0){
......@@ -185,6 +200,20 @@ void read_script(const char *param_file_name, bool rd_lat)
exit_(1);
}
}
else if (strcmp("RFvoltageFlag", name) == 0){
sscanf(line, "%*s %s %lf", str,&RFvolt);
if(strcmp(str, "true") == 0)
RFvoltageFlag = true;
else if(strcmp(str, "false") == 0)
RFvoltageFlag = false;
else {
printf("set boolean flag true or false for RFvoltageFlag \n");
exit_(1);
}
}
else if (strcmp("TuneTracFlag", name) == 0){
sscanf(line, "%*s %s", str);
if(strcmp(str, "true") == 0)
......@@ -209,28 +238,17 @@ void read_script(const char *param_file_name, bool rd_lat)
}
// FMA
else if (strcmp("FmapFlag", name) == 0){
sscanf(line, "%*s %s", str);
if(strcmp(str, "true") == 0)
FmapFlag = true;
else if(strcmp(str, "false") == 0)
FmapFlag = false;
else {
printf("set boolean flag true or false for FmapFlag \n");
exit_(1);
}
}
else if (strcmp("ExperimentFMAFlag", name) == 0){
strcpy(dummy, "");
sscanf(line, "%*s %s %ld %ld %ld %lf %lf %lf %s", str,
&_FmapFlag_nxpoint, &_FmapFlag_nypoint,
&_FmapFlag_nturn, &_FmapFlag_xmax, &_FmapFlag_ymax,
&_FmapFlag_delta, dummy);
if(strcmp(str, "true") == 0)
ExperimentFMAFlag = true;
FmapFlag = true;
else if(strcmp(str, "false") == 0)
ExperimentFMAFlag= false;
FmapFlag= false;
else {
printf("set boolean flag true or false for ExperimentFMAFlag \n");
printf("set boolean flag true or false for FMAFlag \n");
exit_(1);
}
if(strcmp(dummy, "true") == 0)
......@@ -238,18 +256,31 @@ void read_script(const char *param_file_name, bool rd_lat)
else if(strcmp(dummy, "false") == 0)
_FmapFlag_diffusion = false;
else {
printf("set boolean flag true or false for Diffusion (value is %s) \n", dummy);
printf("set boolean flag true or false for FMA Diffusion (value is %s) \n", dummy);
exit_(1);
}
}
else if (strcmp("DetailedFMAFlag", name) == 0){
sscanf(line, "%*s %s", str);
// FMA dp
else if (strcmp("FmapdpFlag", name) == 0){
strcpy(dummy, "");
sscanf(line, "%*s %s %ld %ld %ld %lf %lf %lf %s", str,
&_FmapdpFlag_nxpoint, &_FmapdpFlag_nepoint,
&_FmapdpFlag_nturn, &_FmapdpFlag_xmax, &_FmapdpFlag_emax,
&_FmapdpFlag_z, dummy);
if(strcmp(str, "true") == 0)
DetailedFMAFlag = true;
FmapdpFlag = true;
else if(strcmp(str, "false") == 0)
DetailedFMAFlag = false;
FmapdpFlag= false;
else {
printf("set boolean flag true or false for DetailedFMAFlag \n");
printf("set boolean flag true or false for FMAdpFlag \n");
exit_(1);
}
if(strcmp(dummy, "true") == 0)
_FmapdpFlag_diffusion = true;
else if(strcmp(dummy, "false") == 0)
_FmapdpFlag_diffusion = false;
else {
printf("set boolean flag true or false for FMAdp Diffusion (value is %s) \n", dummy);
exit_(1);
}
}
......@@ -280,7 +311,7 @@ void read_script(const char *param_file_name, bool rd_lat)
}
}
else if (strcmp("ErrorCouplingFlag", name) == 0){
sscanf(line, "%*s %s", str);
sscanf(line, "%*s %s %ld %lf", str,&err_seed,&err_rms);
if(strcmp(str, "true") == 0)
ErrorCouplingFlag = true;
else if(strcmp(str, "false") == 0)
......@@ -315,6 +346,17 @@ void read_script(const char *param_file_name, bool rd_lat)
printf("set boolean flag true or false for MomentumAccFlag \n");
exit_(1);
}
}
else if (strcmp("ReadMultipoleFlag", name) == 0){
sscanf(line, "%*s %s", str);
if(strcmp(str, "true") == 0)
ReadMultipoleFlag = true;
else if(strcmp(str, "false") == 0)
ReadMultipoleFlag = false;
else {
printf("set boolean flag true or false for ReadMultipoleFlag \n");
exit_(1);
}
}
else if (strcmp("MultipoleFlag", name) == 0){
sscanf(line, "%*s %s", str);
......@@ -351,7 +393,7 @@ void read_script(const char *param_file_name, bool rd_lat)
sprintf(fic_skew,"%s%s", in_dir, str);
}
else if (strcmp("FitTuneFlag", name) == 0){
sscanf(line, "%*s %s %lf %lf", str,&targetnux,&targetnuz);
sscanf(line, "%*s %s %s %s %lf %lf", str,qm1,qm2,&targetnux,&targetnuz);
if(strcmp(str, "true") == 0)
FitTuneFlag = true;
else if(strcmp(str, "false") == 0)
......@@ -362,7 +404,7 @@ void read_script(const char *param_file_name, bool rd_lat)
}
}
else if (strcmp("FitChromFlag", name) == 0){
sscanf(line, "%*s %s %lf %lf", str,&targetksix,&targetksiz);
sscanf(line, "%*s %s %s %s %lf %lf", str,sxm1,sxm2,&targetksix,&targetksiz);
if(strcmp(str, "true") == 0)
FitChromFlag = true;
else if(strcmp(str, "false") == 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment