Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
TRACY3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PA
Optics
TRACY3
Commits
1251af83
Commit
1251af83
authored
14 years ago
by
zhang
Browse files
Options
Downloads
Patches
Plain Diff
ZJ
parent
334bc0b9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tracy/tools/max4.cc
+143
-12
143 additions, 12 deletions
tracy/tools/max4.cc
with
143 additions
and
12 deletions
tracy/tools/max4.cc
+
143
−
12
View file @
1251af83
...
...
@@ -4,11 +4,20 @@
int
no_tps
=
ORDER
;
// arbitrary TPSA order is defined locally
extern
bool
freq_map
;
// dynamic aperture
const
double
delta
=
5.0e-2
;
// delta for off-momentum aperture
/////////////////////////////////////////////////////////////////////////////////////////////////
//***************************************************************************************
//
// MAIN CODE
//
//****************************************************************************************
int
main
(
int
argc
,
char
*
argv
[])
{
...
...
@@ -41,30 +50,140 @@ const double delta = 5.0e-2; // delta for off-momentum aperture
//const double x_max_FMA = 3e-3, delta_FMA = 7e-2;
//const int n_x = 28, n_dp = 56, n_tr = 2048;
double
nux
=
0.0
,
nuz
=
0.0
,
ksix
=
0.0
,
ksiz
=
0.0
;
if
(
true
)
Read_Lattice
(
argv
[
1
]);
//sets some globval params
else
rdmfile
(
"flat_file.dat"
);
//instead of reading lattice file, get data from flat file
globval
.
quad_fringe
=
true
;
// include quadrupole fringe field
//no_sxt(); //turns off sextupoles
Ring_GetTwiss
(
true
,
0e-2
);
printglob
();
//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*/
// prt_lat("linlat.out", globval.bpm, true);
//prtmfile("flat_file.dat"); // writes flat file
//prt_chrom_lat(); //writes chromatic functions into chromlat.out
// Using tracking to get tunes and chromaticities
if
(
true
)
{
//prt_cod("cod.out", globval.bpm, true); //prints a specific closed orbit with corrector strengths
globval
.
bpm
=
ElemIndex
(
"bpm_m"
);
// globval.bpm = ElemIndex("bpm");
globval
.
hcorr
=
ElemIndex
(
"corr_h"
);
globval
.
vcorr
=
ElemIndex
(
"corr_v"
);
globval
.
gs
=
ElemIndex
(
"GS"
);
globval
.
ge
=
ElemIndex
(
"GE"
);
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
);
}
//*************************************************************
//=============================================================
double
dP
=
0.0
;
// Chamber
bool
ChamberFlag
=
false
;
// tune shift with amp and energy
bool
TuneShiftFlag
=
true
;
// frequency map
bool
FmapFlag
=
false
,
ExperimentFMAFlag
=
false
,
DetailedFMAFlag
=
true
;
set_bn_design_fam
(
globval
.
hcorr
,
Dip
,
0.0
,
0.0
);
// momentum acceptance
bool
MomentumAccFlag
=
false
;
// Call soleillib.cc
// computes Tuneshift with amplitudes and energy
if
(
TuneShiftFlag
==
true
){
if
(
ChamberFlag
==
true
){
NuDx
(
31L
,
21L
,
516L
,
0.025
,
0.005
,
dP
);
//NuDp(31L,516L,0.06);
NuDp
(
31L
,
1026L
,
0.06
);
}
else
{
// NuDx(50L,30L,516L,0.035,0.02,dP);
// NuDp(31L,1026L,0.06);
NuDx
(
50L
,
30L
,
516L
,
-
0.02
,
-
0.02
,
dP
);
NuDp
(
31L
,
1026L
,
0.06
);
}
}
// Computes FMA
if
(
FmapFlag
==
true
){
if
(
ChamberFlag
==
true
){
if
(
ExperimentFMAFlag
==
true
)
// fmap(40,12,258,-20e-3,5e-3,0.0,true,false); // for experimental
fmap
(
40
,
12
,
258
,
-
20e-3
,
5e-3
,
0.0
,
true
);
// for experimental
if
(
DetailedFMAFlag
==
true
)
// fmap(100,50,1026,20e-3,5e-3,0.0,true,false);
fmap
(
100
,
50
,
1026
,
20e-3
,
5e-3
,
0.0
,
true
);
}
else
{
if
(
ExperimentFMAFlag
==
true
)
// fmap(40,12,258,-32e-3,5e-3,0.0,true,false);
fmap
(
40
,
12
,
258
,
-
32e-3
,
5e-3
,
0.0
,
true
);
if
(
DetailedFMAFlag
==
true
)
// fmap(200,100,1026,32e-3,7e-3,0.0,true);
fmap
(
20
,
10
,
1026
,
32e-3
,
7e-3
,
0.0
,
true
);
}
}
// Compute momentum acceptance
if
(
MomentumAccFlag
==
true
){
MomentumAcceptance
(
1L
,
18L
,
0.01
,
0.05
,
4L
,
-
0.01
,
-
0.05
,
4L
);
// MomentumAcceptance(1L, 108L, 0.01, 0.05, 100L, -0.01, -0.05, 100L);
}
//---------------------------------------------------------
// 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;
//--------------------------------------------------------
//*********************************************************************************
//---------------------------------------------------------------------------------------------------------------------------------
// Delicated for max4 lattice. To load alignment error files and do correction
if
(
false
)
{
//prt_cod("cod.out", globval.bpm, true); //prints a specific closed orbit with corrector strengths
globval
.
bpm
=
ElemIndex
(
"bpm_m"
);
//definition for max4 lattice, bpm
// globval.bpm = ElemIndex("bpm");
globval
.
hcorr
=
ElemIndex
(
"corr_h"
);
globval
.
vcorr
=
ElemIndex
(
"corr_v"
);
//definition for max4 lattice, correctors
// globval.hcorr = ElemIndex("ch"); globval.vcorr = ElemIndex("cv");
globval
.
gs
=
ElemIndex
(
"GS"
);
globval
.
ge
=
ElemIndex
(
"GE"
);
//definition for max4 lattice, girder maker
//compute response matrix (needed for OCO)
gcmat
(
globval
.
bpm
,
globval
.
hcorr
,
1
);
gcmat
(
globval
.
bpm
,
globval
.
vcorr
,
2
);
...
...
@@ -89,7 +208,8 @@ const double delta = 5.0e-2; // delta for off-momentum aperture
//LoadAlignTol("/home/simon/projects/out/20091126/AlignErr.dat", true, 1.0, true, 1);
//prt_cod("cod_err.out", globval.bpm, true); //prints a specific closed orbit with corrector strengths
// delicated for max4 lattice
//load alignment errors and field errors, correct orbit, repeat N times, and get statistics
get_cod_rms_scl_new
(
1
);
//trim coils aren't reset when finished
...
...
@@ -99,7 +219,14 @@ const double delta = 5.0e-2; // delta for off-momentum aperture
//LoadApers("/home/simon/projects/src/lattice/Apertures.dat", 1, 1);
}
//*******************************************************************************
//-------------------------------------------------------------------------------------------------------------------------------------
// Call nsls-ii_lib.cc
// tune shift with amplitude
if
(
false
)
{
cout
<<
endl
;
cout
<<
"computing tune shifts"
<<
endl
;
...
...
@@ -110,7 +237,8 @@ const double delta = 5.0e-2; // delta for off-momentum aperture
if
(
false
)
{
//fmap(n_x, n_y, n_tr, x_max_FMA, y_max_FMA, 0.0, true, false);
fmapdp
(
n_x
,
n_dp
,
n_tr
,
x_max_FMA
,
-
delta_FMA
,
1e-3
,
true
,
false
);
// always use -delta_FMA (+delta_FMA appears broken)
// fmapdp(n_x, n_dp, n_tr, x_max_FMA, -delta_FMA, 1e-3, true, false); // always use -delta_FMA (+delta_FMA appears broken)
fmapdp
(
n_x
,
n_dp
,
n_tr
,
x_max_FMA
,
-
delta_FMA
,
1e-3
,
true
);
// always use -delta_FMA (+delta_FMA appears broken)
}
else
{
globval
.
Cavity_on
=
true
;
// this gives longitudinal motion
globval
.
radiation
=
false
;
// this adds ripple around long. ellipse (needs many turns to resolve damp.)
...
...
@@ -120,7 +248,10 @@ const double delta = 5.0e-2; // delta for off-momentum aperture
}
// return 1;
//
// IBS & TOUSCHEK
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment