diff --git a/tracy/tracy/src/soleilcommon.cc b/tracy/tracy/src/soleilcommon.cc index 8f8e53e11c4cdd2a76f425de99784f016a5ee5c9..ea68ed40ce41f4cf8cc4f36878526db224d8f90b 100644 --- a/tracy/tracy/src/soleilcommon.cc +++ b/tracy/tracy/src/soleilcommon.cc @@ -81,6 +81,7 @@ void Read_Lattice(char *fic) bool chroma = true; double dP = 0.0; const double RFacceptance = 1.0; // maximum exusrtion during tracking + Vector2 beta, alpha, eta, etap; Vector codvect; // double beta[2], alpha[2], eta[2], etap[2], codvect[6]; @@ -136,9 +137,9 @@ void Read_Lattice(char *fic) /* Creator of all the matrices for each element */ Cell_Init(); - + // for a ring if (globval.RingType == 1) - { // for a ring + { /* Defines global variables for Tracy code */ @@ -155,11 +156,11 @@ void Read_Lattice(char *fic) globval.CODimax = 40L; /* maximum number of iterations for COD algo */ globval.dPcommon = 1e-10; /* Common energy step for energy differentiation */ globval.delta_RF = RFacceptance;/* energy acceptance for SOLEIL */ - globval.bpm = get_bpm_number(); /* number of bpm into the latice */ - globval.hcorr = get_hcorr_number(); /* number of horizontal corrector into the lattice */ - globval.vcorr = get_vcorr_number(); /* number of vertical corrector into the lattice */ - globval.qt = get_qt_number(); /* number of skew quad into the lattice */ - + globval.qt = ElemIndex("qt"); /* get family index of skew quadrupole */ + globval.hcorr = ElemIndex("ch"); /* get family index of horizontal corrector */ + globval.vcorr = ElemIndex("cv"); /* get family index of vertical corrector */ + globval.bpm = ElemIndex("bpm"); /* get family index of bpm*/ + // globval.g = ElemIndex("g"); /* get family index of girder*/ /* define x/y physical aperture */ //ChamberOff(); @@ -171,9 +172,9 @@ void Read_Lattice(char *fic) Cell_SetdP(dP); /* added for correcting BUG if non convergence: compute on momentum linear matrices */ } - else - { - // for transfer lines + + else + { // for transfer lines /* Initial settings : */ beta[0] = 8.1; alpha[0] = 0.0; @@ -201,13 +202,13 @@ void Read_Lattice(char *fic) globval.CODimax = 10L; /* maximum number of iterations for COD algo */ globval.dPcommon = 1e-10; /* Common energy step for energy differentiation */ globval.delta_RF = 0.10; /* 6% + epsilon energy acceptance for SOLEIL */ - globval.dPparticle = dP; - globval.bpm = get_bpm_number(); /* number of bpm into the latice */ - globval.hcorr = get_hcorr_number(); /* number of horizontal corrector into the lattice */ - globval.vcorr = get_vcorr_number(); /* number of vertical corrector into the lattice */ - globval.qt = get_qt_number(); /* number of skew quad into the lattice */ - + globval.qt = ElemIndex("qt"); /* get family index of skew quadrupole */ + globval.hcorr = ElemIndex("ch"); /* get family index of horizontal corrector */ + globval.vcorr = ElemIndex("vh"); /* get family index of vertical corrector */ + globval.bpm = ElemIndex("bpm"); /* get family index of bpm*/ + // globval.g = ElemIndex("g"); /* get family index of girder*/ + ChamberOff(); TransTwiss(alpha, beta, eta, etap, codvect); } @@ -216,294 +217,6 @@ void Read_Lattice(char *fic) } - - -/****************************************************************************/ -/* void ChamberOn(void) - - Purpose: - Switch on the vacuum chamber - - Input: - none - - Output: - none - - Return: - none - - Global variables: - none - - specific functions: - DefineCh - - Comments: - none - -****************************************************************************/ -// void ChamberOn(void) -// { -// DefineCh(); -// status.chambre = true; -// } - -/****************************************************************************/ -/* void ChamberOff(void) - - Purpose: - Switch off the vacuum chamber - Still a check at 1 meter for avoiding numerical divergences - - Input: - none - - Output: - none - - Return: - none - - Global variables: - globval - - specific functions: - none - - Comments: - 16/06/03 Introduction of an asymmetrical vaccuum vessel - -// ****************************************************************************/ -// void ChamberOff(void) -// { -// int i; - -// for (i = 0; i <= globval.Cell_nLoc; i++) -// { -// globval.maxamplH[i][0] = -1.0; -// globval.maxamplH[i][1] = 1.0; -// globval.maxamplV[i][0] = -1.0; -// globval.maxamplV[i][1] = 1.0; -// } -// status.chambre = false; -// } - -/****************************************************************************/ -/* void PrintCh(void) - - Purpose: - Print the vacuum chamber in the file chambre.out - - Input: - none - - Output: - none - - Return: - none - - Global variables: - globval - - specific functions: - getglobv_, getelem - - Comments: - 16/06/03 Introduction of an asymmetrical vaccuum vessel - -****************************************************************************/ -// void PrintCh(void) -// { -// FILE *f; -// long i = 0, j = 0; -// const char *fic = "chambre.out"; -// const long Taille = 5; -// CellType Cell; -// struct tm *newtime; - -// /* Get time and date */ -// newtime = GetTime(); - - -// /* open the lattice Input file */ -// if ((f = fopen(fic, "w")) == NULL) -// { -// fprintf(stderr, "PrintCh: Error while opening file %s \n", -// fic); -// exit(1); -// } -// fprintf(f, "# TRACY II v. SYNCHROTRON SOLEIL -- %s -- %s \n", fic, -// asctime2(&newtime)); -// fprintf(f, "# i name s -xch(mm) +xch(mm) zch (mm)\n#\n"); - -// for (i = 1; i <= globval.Cell_nLoc; i++) -// { -// getelem(i, &Cell); -// fprintf(f, "%4ld ", i); -// for (j = 0; j < Taille; j++) -// { -// if (Cell.Elem.PName[j] != ' ') -// putc(Cell.Elem.PName[j], f); -// else -// putc(' ', f); -// } -// fprintf(f, " %6.2f %7.3f %7.3f %7.3f\n", Cell.S, -// globval.maxamplH[i][0] * 1E3, -// globval.maxamplH[i][1] * 1E3, -// globval.maxamplV[i][1] * 1E3); -// } - -// fclose(f); -// } - -/****************************************************************************/ -/* void GetChromTrac(long Nb, long Nbtour, double emax, double *xix, double *xiz) - - Purpose: - Computes chromaticities by tracking - - Input: - Nb point number - Nbtour turn number - emax energy step - - Output: - xix horizontal chromaticity - xiz vertical chromaticity - - Return: - none - - Global variables: - trace - - Specific functions: - Trac_Simple, Get_NAFF - - Comments: - 27/04/03 chromaticities are now output arguments - -****************************************************************************/ -// #define nterm 2 -// void GetChromTrac(long Nb, long Nbtour, double emax, double *xix, double *xiz) -// { - -// double Tab[6][NTURN], fx[nterm], fz[nterm]; -// int nb_freq[2] = { 0, 0 }; /* frequency number to look for */ -// int i = 0; -// boolean status = true; - -// double x = 1e-6, xp = 0.0, z = 1e-6, zp = 0.0; -// double x0 = 1e-6, xp0 = 0.0, z0 = 1e-6, zp0 = 0.0; -// double nux1, nux2, nuz1, nuz2; - -// /* initializations */ -// for (i = 0; i < nterm; i++) -// { -// fx[i] = 0.0; -// fz[i] = 0.0; -// } -// /* end init */ - -// /* Tracking for delta = emax and computing tunes */ -// x = x0; -// xp = xp0; -// z = z0; -// zp = zp0; - -// Trac_Simple(x, xp, z, zp, emax, 0.0, Nbtour, Tab, &status); -// Get_NAFF(nterm, Nbtour, Tab, fx, fz, nb_freq); - -// nux1 = (fabs (fx[0]) > 1e-8 ? fx[0] : fx[1]); -// nuz1 = fz[0]; - -// if (trace) -// fprintf(stdout, -// "\n Entering routine for chroma using tracking\n"); -// if (trace) -// fprintf(stdout, "emax= % 10.6e nux1=% 10.6e nuz1= % 10.6e\n", -// emax, nux1, nuz1); - -// /* Tracking for delta = -emax and computing tunes */ -// x = x0; -// xp = xp0; -// z = z0; -// zp = zp0; - -// Trac_Simple(x, xp, z, zp, -emax, 0.0, Nbtour, Tab, &status); -// Get_NAFF(nterm, Nbtour, Tab, fx, fz, nb_freq); - -// if (trace) -// fprintf(stdout, -// "nturn=%6ld x=% 10.5g xp=% 10.5g z=% 10.5g zp=% 10.5g delta=% 10.5g ctau=% 10.5g \n", -// Nbtour, Tab[0][Nbtour - 1], Tab[1][Nbtour - 1], -// Tab[2][Nbtour - 1], Tab[3][Nbtour - 1], -// Tab[4][Nbtour - 1], Tab[5][Nbtour - 1]); - -// nux2 = (fabs(fx[0]) > 1e-8 ? fx[0] : fx[1]); -// nuz2 = fz[0]; - -// if (trace) -// fprintf(stdout, -// "emax= % 10.6e nux2= % 10.6e nuz2= % 10.6e\n", -emax, -// nux2, nuz2); - -// /* Computing chromaticities */ -// *xix = (nux2 - nux1) * 0.5 / emax; -// *xiz = (nuz2 - nuz1) * 0.5 / emax; - -// if (trace) -// fprintf (stdout, -// " Exiting routine for chroma using tracking\n\n"); -// } -// #undef nterm - -// /****************************************************************************/ -// /* void GetTuneTrac(long Nbtour, double emax, double *nux, double *nuz) - -// Purpose: -// Computes chromaticities by tracking - -// Input: -// Nb point number -// Nbtour turn number -// emax energy step - -// Output: -// none - -// Return: -// none - -// Global variables: -// trace - -// Specific functions: -// Trac_Simple, Get_NAFF - -// Comments: -// none - -// ****************************************************************************/ -// #define nterm 2 -// void GetTuneTrac(long Nbtour, double emax, double *nux, double *nuz) -// { -// double Tab[6][NTURN], fx[nterm], fz[nterm]; -// int nb_freq[2]; -// boolean status; - -// double x = 1e-6, xp = 0.0, z = 1e-6, zp = 0.0; - -// Trac_Simple(x, xp, z, zp, emax, 0.0, Nbtour, Tab, &status); -// Get_NAFF(nterm, Nbtour, Tab, fx, fz, nb_freq); - -// *nux = (fabs (fx[0]) > 1e-8 ? fx[0] : fx[1]); -// *nuz = fz[0]; -// } -// #undef nterm - /****************************************************************************/ /* long get_bpm_number(void) @@ -549,7 +262,7 @@ long get_bpm_number(void) } /****************************************************************************/ -/* long get_bpm_number(void) +/* long get_hcorr_number(void) Purpose: called by Read_Lattice Compute number of corrector into the lattice @@ -683,28 +396,3 @@ long get_qt_number(void) -/**************************************************************************** - * - - Purpose: - - Input: - none - - Output: - - - Return: - none - - Global variables: - none - - specific functions: - none - - Comments: - none - -****************************************************************************/ -