diff --git a/tracy/tracy/src/soleillib.cc b/tracy/tracy/src/soleillib.cc index 0c1c7f148ac4421ee4dbdc015af1cb9c39021202..c1681e6a22cb8f61196f7b606ca7f4bea7200d7e 100644 --- a/tracy/tracy/src/soleillib.cc +++ b/tracy/tracy/src/soleillib.cc @@ -5016,9 +5016,11 @@ void set_RFVoltage(const int Fnum, const double V_RF){ 10/2010 Written by Jianfeng Zhang 01/2011 Fix the bug for reading the end of line symbol "\n" , "\r",'\r\n' at different operation system + 04/2011 Change the set of 'seed' for rms error in file, now it's mandatory. *****************************************************************************************************/ void ReadFieldErr(const char *FieldErrorFile) { + bool rms, set_rnd = false; char in[max_str], name[max_str],keywrd[max_str], *prm; char *line; int n = 0; /* field error order*/ @@ -5029,7 +5031,7 @@ void ReadFieldErr(const char *FieldErrorFile) double _convHcorr = 8.14e-4,_convVcorr = 4.642e-4, _convQt = 93.83e-4; FILE *inf; - const bool prt = false; + const bool prt = false; inf = file_read(FieldErrorFile); @@ -5057,12 +5059,20 @@ void ReadFieldErr(const char *FieldErrorFile) if (strcmp("seed", name) == 0) { // the line to set random seed sscanf(line, "%*s %d", &seed_val); printf("ReadFieldErr: setting random seed to %d\n", seed_val); - iniranf(seed_val); + set_rnd = true; + iniranf(seed_val); } else{//line to set (n Bn An sequence) /*read and assign the key words and measure radius*/ sscanf(line, " %*s %s %lf",keywrd, &r0); - if (prt) printf("\nsetting multipole error to: %-5s r0 = %7.1le\n",name,r0); + if (prt) printf("\nsetting <%s> multipole error to: %-5s r0 = %7.1le\n",keywrd,name,r0); + + rms = (strcmp("rms", keywrd) == 0)? true : false; + if (rms && !set_rnd) { + printf("ReadFieldErr: seed not defined\n"); + exit(1); + } + // skip first three parameters strtok(line, " \t"); strtok(NULL, " \t"); @@ -5079,8 +5089,6 @@ void ReadFieldErr(const char *FieldErrorFile) prm = get_prm(); sscanf(prm, "%lf", &An); - - if (prt) printf(" n = %2d, Bn = %9.1e, An = %9.1e\n", n, Bn, An); @@ -5274,7 +5282,7 @@ void AddFieldValues_fam(const int Fnum, const char *keywrd, const double r0, n order of the error Bn relative B component for the n-th error An relative A component for the n-th error - new_rnd bool flag to set new random number + Output: @@ -5602,3 +5610,5 @@ void FitTune4(long qf1,long qf2, long qd1, long qd2, double nux, double nuy) Ring_Fittune(nu, nueps, nq, qfbuf, qdbuf, nudkL, nuimax); } + +