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

04/11/2010

1) Delete unused test parts.
parent a0bf116d
No related branches found
No related tags found
No related merge requests found
#define ORDER 1 #define ORDER 1
#include "tracy_lib.h"
int no_tps = ORDER; // arbitrary TPSA order is defined locally int no_tps = ORDER; // arbitrary TPSA order is defined locally
extern bool freq_map; extern bool freq_map;
#include "tracy_lib.h"
//*************************************************************************************** //***************************************************************************************
// //
...@@ -15,7 +13,6 @@ extern bool freq_map; ...@@ -15,7 +13,6 @@ extern bool freq_map;
//**************************************************************************************** //****************************************************************************************
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
const long seed = 1121; const long seed = 1121;
const bool All = TRUE; const bool All = TRUE;
iniranf(seed); setrancut(2.0); iniranf(seed); setrancut(2.0);
...@@ -24,11 +21,12 @@ extern bool freq_map; ...@@ -24,11 +21,12 @@ extern bool freq_map;
// IDs accounted too if: wiggler model and symplectic integrator (method = 1) // IDs accounted too if: wiggler model and symplectic integrator (method = 1)
globval.H_exact = false; globval.H_exact = false;
globval.quad_fringe = false; // quadrupole fringe field globval.quad_fringe = false; // quadrupole fringe field
globval.Cavity_on = false; // include RF cavity
globval.radiation = false; // synchrotron radiation globval.radiation = false; // synchrotron radiation
globval.emittance = false; // emittance globval.emittance = false; // emittance
globval.pathlength = false; globval.pathlength = false;
globval.bpm = 0;
// overview, on energy: 25-15 // overview, on energy: 25-15
//const double x_max_FMA = 20e-3, y_max_FMA = 10e-3; //const x_max_FMA = 25e-3, y_max_FMA = 15e-3; //const double x_max_FMA = 20e-3, y_max_FMA = 10e-3; //const x_max_FMA = 25e-3, y_max_FMA = 15e-3;
...@@ -45,76 +43,71 @@ extern bool freq_map; ...@@ -45,76 +43,71 @@ extern bool freq_map;
//const int n_x = 28, n_dp = 56, n_tr = 2048; //const int n_x = 28, n_dp = 56, n_tr = 2048;
double nux=0.0, nuz=0.0, ksix=0.0, ksiz=0.0; double nux=0.0, nuz=0.0, ksix=0.0, ksiz=0.0;
bool chroma; bool chroma;
double dP = 0.0; double dP = 0.0;
long lastpos = -1L; long lastpos = -1L;
char str1[S_SIZE]; char str1[S_SIZE];
if (true)
Read_Lattice("/home/nadolski/codes/tracy/maille/soleil/solamor2_tracy3");
// Read_Lattice(argv[1]); //sets some globval params
else
rdmfile("flat_file.dat"); //instead of reading lattice file, get data from flat file
/************************************************************************
start read in files and flags
*************************************************************************/
read_script(argv[1], true);
/************************************************************************
end read in files and flags
*************************************************************************/
globval.quad_fringe = true; // include quadrupole fringe field
/*globval.bpm = ElemIndex("bpm"); //definition for max4 lattice, bpm
globval.hcorr = ElemIndex("ch");
globval.vcorr = ElemIndex("cv");*/
// if (true)
// // Read_Lattice("/home/nadolski/codes/tracy/maille/soleil/solamor2_tracy3");
// Read_Lattice(argv[1]); //sets some globval params
// else
// rdmfile("flat_file.dat"); //instead of reading lattice file, get data from flat file
//no_sxt(); //turns off sextupoles //no_sxt(); //turns off sextupoles
// Ring_GetTwiss(true, 0e-2); //gettwiss computes one-turn matrix arg=(w or w/o chromat, dp/p)
//get_matching_params_scl();
//get_alphac2();
//GetEmittance(ElemIndex("cav"), true);
//prt_lat("linlat.out", globval.bpm, true); /* print lattice file for nsrl-ii*/
prtmfile("flat_file.dat"); // writes flat file /* very important file for debug*/
//prt_chrom_lat(); //writes chromatic functions into chromlat.out
// printlatt(); /* print out lattice functions */
Ring_GetTwiss(true, 0.0);
printglob(); //gettwiss computes one-turn matrix arg=(w or w/o chromat, dp/p)
get_matching_params_scl();
get_alphac2(); // compute up to 3rd order mcf
GetEmittance(ElemIndex("cav"), true);
/* print lattice file */ /* print lattice file */
prt_lat("linlatBNL.out", globval.bpm, All); // BNL print for all elements // prt_lat("linlatBNL.out", globval.bpm, All); // BNL print for all elements
printlatt(); /* SOLEIL print out lattice functions */ printlatt(); /* SOLEIL print out lattice functions */
printglob();
prtmfile("flat_file.dat"); // writes flat file
prt_chrom_lat(); //writes chromatic functions into chromlat.out
// Using tracking to get tunes and chromaticities
if (false) {
GetTuneTrac(1026L, 0.0, &nux, &nuz);
fprintf(stdout,"From tracking: nux = % f nuz = % f \n",nux,nuz);
GetChromTrac(2L, 1026L, 1e-5, &ksix, &ksiz);
fprintf(stdout,"From tracking: ksix= % f ksiz= % f \n",ksix,ksiz);
}
// Flag factory // Flag factory
bool TuneTracFlag = true, ChromTracFlag = true; // bool TuneTracFlag = true;
bool FmapFlag = false, ExperimentFMAFlag = false, DetailedFMAFlag = false; // bool ChromTracFlag = true;
bool TuneShiftFlag = false;
bool ErrorCouplingFlag = false; bool CouplingFlag = false;
bool MomentumAccFlag = false;
bool MultipoleFlag = false;
bool FitTuneFlag = false; double targetnux = 18.202, targetnuz = 10.317;
bool FitChromFlag = false; double targetksix = 2.0, targetksiz = 2.6;
bool ChamberFlag = false, U20ChamberFlag = false;
bool GirderErrorFlag = false;
bool SigmaFlag = false;
bool PX2Flag = false;
bool InducedAmplitudeFlag = false;
bool CodeComparaisonFlag = false;
bool EtaFlag = false;
//************************************************************* //*************************************************************
//============================================================= //=============================================================
// // Chamber factory // Chamber factory
// if (ChamberFlag == false) if (ChamberFlag == false)
// ChamberOff(); // no chamber limitations ChamberOff(); // turn off vacuum chamber setting, use the default one
// else if (U20ChamberFlag == true) else if (ChamberNoU20Flag == true)
// DefineChNoU20; DefineChNoU20(); // using vacuum chamber setting but without undulator U20
else if (ReadChamberFlag == true)
ReadCh("Apertures.dat"); /* read vacuum chamber from a file "Apertures.dat" , soleil version*/
//LoadApers("Apertures.dat", 1.0, 1.0); /* read vacuum chamber definition for bnl */
PrintCh(); PrintCh();
LoadApers("Apertures.dat", 1.0, 1.0);
// compute tunes by tracking (should be the same as by DA) // compute tunes by tracking (should be the same as by DA)
if (TuneTracFlag == true) { if (TuneTracFlag == true) {
...@@ -124,7 +117,7 @@ extern bool freq_map; ...@@ -124,7 +117,7 @@ extern bool freq_map;
// compute chromaticities by tracking (should be the same as by DA) // compute chromaticities by tracking (should be the same as by DA)
if (ChromTracFlag == true){ if (ChromTracFlag == true){
GetChromTrac(2, 1026L, 1e-5, &ksix, &ksiz); GetChromTrac(2L, 1026L, 1e-5, &ksix, &ksiz);
fprintf(stdout,"From tracking: ksix= % f ksiz= % f \n",ksix,ksiz); fprintf(stdout,"From tracking: ksix= % f ksiz= % f \n",ksix,ksiz);
} }
...@@ -145,32 +138,43 @@ extern bool freq_map; ...@@ -145,32 +138,43 @@ extern bool freq_map;
//SetKLpar(ElemIndex("QT"), 1, 2L, 0.001026770838382); //SetKLpar(ElemIndex("QT"), 1, 2L, 0.001026770838382);
// // coupling calculation // coupling calculation
// if (CouplingFlag == true){ if (CouplingFlag == true){
// Ring_GetTwiss(chroma=true, 0.0); /* Compute and get Twiss parameters */ Ring_GetTwiss(chroma=true, 0.0); /* Compute and get Twiss parameters */
// printlatt(); /* dump linear lattice functions into "linlat.dat" */ printlatt(); /* dump linear lattice functions into "linlat.dat" */
// Coupling_Edwards_Teng(); // Coupling_Edwards_Teng();
// printglob(); /* print parameter list */ printglob(); /* print parameter list */
// } }
// add coupling by random rotating of the quadrupoles // add coupling by random rotating of the quadrupoles
// if (ErrorCouplingFlag == true){ if (ErrorCouplingFlag == true){
// SetErr(); SetErr();
// Ring_GetTwiss(chroma=true, 0.0); /* Compute and get Twiss parameters */ Ring_GetTwiss(chroma=true, 0.0); /* Compute and get Twiss parameters */
// printlatt(); /* dump linear lattice functions into "linlat.dat" */ printlatt(); /* dump linear lattice functions into "linlat.dat" */
// Coupling_Edwards_Teng(); // Coupling_Edwards_Teng();
// printglob(); /* print parameter list */ printglob(); /* print parameter list */
// } }
// WARNING Fit tunes and chromaticities before applying errors !!!! // WARNING Fit tunes and chromaticities before applying errors !!!!
//set multipoles in all magnets //set multipoles in all magnets
if (MultipoleFlag == true ){ if (MultipoleFlag == true ){
fprintf(stdout, "\n Setting Multipoles \n"); if (ThinsextFlag ==true){
//Multipole_new(); /* for thick sextupoles */ fprintf(stdout, "\n Setting Multipoles for lattice with thin sextupoles \n");
Multipole(); /* for thin sextupoles */ Multipole_thinsext(); /* for thin sextupoles */
Ring_GetTwiss(chroma=true, 0.0); /* Compute and get Twiss parameters */ Ring_GetTwiss(chroma=true, 0.0); /* Compute and get Twiss parameters */
printglob(); /* print parameter list */ printglob();
} }
else{
fprintf(stdout, "\n Setting Multipoles for lattice with thick sextupoles \n");
Multipole_thicksext(); /* for thick sextupoles */
Ring_GetTwiss(chroma=true, 0.0); /* Compute and get Twiss parameters */
printglob();
}
}
/* print parameter list */
// PX2 chicane // PX2 chicane
// if (PX2Flag ==true){ // if (PX2Flag ==true){
...@@ -205,7 +209,9 @@ extern bool freq_map; ...@@ -205,7 +209,9 @@ extern bool freq_map;
} }
if (MomentumAccFlag == true){ if (MomentumAccFlag == true){
MomentumAcceptance(1L, 108L, 0.01, 0.05, 100L, -0.01, -0.05, 100L); //MomentumAcceptance(10L, 28L, 0.01, 0.05, 4L, -0.01, -0.05, 4L);
MomentumAcceptance(1L, 28L, 0.01, 0.05, 40L, -0.01, -0.05, 40L);
// MomentumAcceptance(1L, 108L, 0.01, 0.05, 100L, -0.01, -0.05, 100L);
} }
// computes Tuneshift with amplitudes // computes Tuneshift with amplitudes
...@@ -233,7 +239,7 @@ extern bool freq_map; ...@@ -233,7 +239,7 @@ extern bool freq_map;
if (EtaFlag == true){ if (EtaFlag == true){
// compute cod and twiss parameters for different energy offsets // compute cod and twiss parameters for different energy offsets
for (double ii=0; ii<=40; ii++) { for (int ii=0; ii<=40; ii++) {
dP = -0.02+ 0.001*ii; dP = -0.02+ 0.001*ii;
Ring_GetTwiss(chroma=false, dP); /* Compute and get Twiss parameters */ Ring_GetTwiss(chroma=false, dP); /* Compute and get Twiss parameters */
printlatt(); /* dump linear lattice functions into "linlat.dat" */ printlatt(); /* dump linear lattice functions into "linlat.dat" */
...@@ -248,26 +254,6 @@ extern bool freq_map; ...@@ -248,26 +254,6 @@ extern bool freq_map;
} }
} }
return 0;
//---------------------------------------------------------
// test region
// trace = true;
// Get_Disp_dp();
//InducedAmplitude(20);
// Hcofonction(2, 0.001);
// fmapdp(20L, 21L, 1026L, 25e-3, 0.06, 0.3e-3, true);
// return 1;
//--------------------------------------------------------
//********************************************************************************* //*********************************************************************************
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment