forked from MethodicalAcceleratorDesign/MAD-X-User-Manual
-
Notifications
You must be signed in to change notification settings - Fork 0
/
foot.tex
438 lines (391 loc) · 10.4 KB
/
foot.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
%%%\title{Range Selection}
% Changed by: Chris ISELIN, 27-Jan-1997
% Changed by: Hans Grote, 10-Jun-2002
\paragraph{Real life example for IF statements, and MACRO usage}
\begin{verbatim}
! Creates a footprint for head-on + parasitic collisions at IP1+5
! of lhc.6.5; both lhcb1 (for tracking) and lhcb2 (to define the
! beam-beam elements, i.e. weak-strong) are used; there are flags to
! select head-on, left, and right parasitic separately at all IPs.
! The bunch spacing can be given in nanosec and automatically creates
! the beam-beam interaction points at the correct positions.
! It is important to set the correct BEAM parameters, i.e. number
! of particles, emittances, bunch length, energy.
!--- For completeness, all files needed by this job are copied
! to the local directory ldb. The links to the the originals
! in offdb (official database) are commented out.
Option, warn,info,echo;
!System,
"ln -fns /afs/cern.ch/eng/sl/MAD-X/dev/test_suite/foot/V3.01.01 ldb";
!system,"ln -fns /afs/cern.ch/eng/lhc/optics/V6.4 offdb";
Option, -echo,-info,warn;
SU=1.0;
call, file = "ldb/V6.5.seq";
call,file="ldb/slice_new.madx";
Option, echo,info,warn;
!+++++++++++++++++++++++++ Step 1 +++++++++++++++++++++++
! define beam constants
!++++++++++++++++++++++++++++++++++++++++++++++++++++++++
b_t_dist = 25.e-9; !--- bunch distance in [sec]
b_h_dist = clight * b_t_dist / 2 ; !--- bunch half-distance in [m]
ip1_range = 58.; ! range for parasitic collisions
ip5_range = ip1_range;
ip2_range = 60.;
ip8_range = ip2_range;
npara_1 = ip1_range / b_h_dist; ! # parasitic either side
npara_2 = ip2_range / b_h_dist;
npara_5 = ip5_range / b_h_dist;
npara_8 = ip8_range / b_h_dist;
value,npara_1,npara_2,npara_5,npara_8;
eg = 7000;
bg = eg/pmass;
en = 3.75e-06;
epsx = en/bg;
epsy = en/bg;
Beam, particle = proton, sequence=lhcb1, energy = eg,
sigt= 0.077 ,
bv = +1, NPART=1.1E11, sige= 1.1e-4,
ex=epsx, ey=epsy;
Beam, particle = proton, sequence=lhcb2, energy = eg,
sigt= 0.077 ,
bv = -1, NPART=1.1E11, sige= 1.1e-4,
ex=epsx, ey=epsy;
beamx = beam%lhcb1->ex; beamy%lhcb1 = beam->ey;
sigz = beam%lhcb1->sigt; sige = beam%lhcb1->sige;
!--- split5, 4d
long_a= 0.53 * sigz/2;
long_b= 1.40 * sigz/2;
value,long_a,long_b;
ho_charge = 0.2;
!+++++++++++++++++++++++++ Step 2 +++++++++++++++++++++++
! slice, flatten sequence, and cycle start to ip3
!++++++++++++++++++++++++++++++++++++++++++++++++++++++++
use,sequence=lhcb1;
makethin,sequence=lhcb1;
!save,sequence=lhcb1,file=lhcb1_thin_new_seq;
use,sequence=lhcb2;
makethin,sequence=lhcb2;
!save,sequence=lhcb2,file=lhcb2_thin_new_seq;
!stop;
option,-warn,-echo,-info;
call,file="ldb/V6.5.thin.coll.str";
option,warn,echo,info;
! keep sextupoles
ksf0=ksf; ksd0=ksd;
use,period=lhcb1;
select,flag=twiss.1,column=name,x,y,betx,bety;
twiss,file;
plot,haxis=s,vaxis=x,y,colour=100,noline;
use,period=lhcb2;
select,flag=twiss.2,column=name,x,y,betx,bety;
twiss,file;
plot,haxis=s,vaxis=x,y,colour=100,noline;
seqedit,sequence=lhcb1;
flatten;
endedit;
seqedit,sequence=lhcb1;
cycle,start=ip3.b1;
endedit;
seqedit,sequence=lhcb2;
flatten;
endedit;
seqedit,sequence=lhcb2;
cycle,start=ip3.b2;
endedit;
bbmarker: marker; /* for subsequent remove */
!+++++++++++++++++++++++++ Step 3 +++++++++++++++++++++++
! define the beam-beam elements
!++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!
!===========================================================
! read macro definitions
option,-echo;
call,file="ldb/bb.macros";
option,echo;
!
!===========================================================
! this sets CHARGE in the head-on beam-beam elements.
! set +1 * ho_charge for parasitic on, 0 for off
on_ho1 = +1 * ho_charge; ! ho_charge depends on split
on_ho2 = +0 * ho_charge; ! because of the "by hand" splitting
on_ho5 = +1 * ho_charge;
on_ho8 = +0 * ho_charge;
!
!===========================================================
! set CHARGE in the parasitic beam-beam elements.
! set +1 for parasitic on, 0 for off
on_lr1l = +1;
on_lr1r = +1;
on_lr2l = +0;
on_lr2r = +0;
on_lr5l = +1;
on_lr5r = +1;
on_lr8l = +0;
on_lr8r = +0;
!
!===========================================================
! define markers and savebetas
assign,echo=temp.bb.install;
!--- ip1
if (on_ho1 0)
{
exec, mkho(1);
exec, sbhomk(1);
}
if (on_lr1l 0 || on_lr1r 0)
{
n=1; ! counter
while (n 0 || on_lr1l 0)
{
n=1; ! counter
while (n 0)
{
exec, mkho(5);
exec, sbhomk(5);
}
if (on_lr5l 0 || on_lr5r 0)
{
n=1; ! counter
while (n 0 || on_lr5l 0)
{
n=1; ! counter
while (n 0)
{
exec, mkho(2);
exec, sbhomk(2);
}
if (on_lr2l 0 || on_lr2r 0)
{
n=1; ! counter
while (n 0 || on_lr2l 0)
{
n=1; ! counter
while (n 0)
{
exec, mkho(8);
exec, sbhomk(8);
}
if (on_lr8l 0 || on_lr8r 0)
{
n=1; ! counter
while (n 0 || on_lr8l 0)
{
n=1; ! counter
while (n 0)
{
exec, inho(mk,1);
}
if (on_lr1l 0 || on_lr1r 0)
{
n=1; ! counter
while (n 0 || on_lr1l 0)
{
n=1; ! counter
while (n 0)
{
exec, inho(mk,5);
}
if (on_lr5l 0 || on_lr5r 0)
{
n=1; ! counter
while (n 0 || on_lr5l 0)
{
n=1; ! counter
while (n 0)
{
exec, inho(mk,2);
}
if (on_lr2l 0 || on_lr2r 0)
{
n=1; ! counter
while (n 0 || on_lr2l 0)
{
n=1; ! counter
while (n 0)
{
exec, inho(mk,8);
}
if (on_lr8l 0 || on_lr8r 0)
{
n=1; ! counter
while (n 0 || on_lr8l 0)
{
n=1; ! counter
while (n betx) / 0.0007999979093;
value,on_sep2;
!===========================================================
! define bb elements
assign,echo=temp.bb.install;
!--- ip1
if (on_ho1 0)
{
exec, bbho(1);
}
if (on_lr1l 0)
{
n=1; ! counter
while (n 0)
{
n=1; ! counter
while (n 0)
{
exec, bbho(5);
}
if (on_lr5l 0)
{
n=1; ! counter
while (n 0)
{
n=1; ! counter
while (n 0)
{
exec, bbho(2);
}
if (on_lr2l 0)
{
n=1; ! counter
while (n 0)
{
n=1; ! counter
while (n 0)
{
exec, bbho(8);
}
if (on_lr8l 0)
{
n=1; ! counter
while (n 0)
{
n=1; ! counter
while (n 0)
{
exec, inho(bb,1);
}
if (on_lr1l 0)
{
n=1; ! counter
while (n 0)
{
n=1; ! counter
while (n 0)
{
exec, inho(bb,5);
}
if (on_lr5l 0)
{
n=1; ! counter
while (n 0)
{
n=1; ! counter
while (n 0)
{
exec, inho(bb,2);
}
if (on_lr2l 0)
{
n=1; ! counter
while (n 0)
{
n=1; ! counter
while (n 0)
{
exec, inho(bb,8);
}
if (on_lr8l 0)
{
n=1; ! counter
while (n 0)
{
n=1; ! counter
while (n footprint";
stop;
\end{verbatim}
\paragraph{\href{macro}{Real life example of MACRO definitions}}
\begin{verbatim}
bbho(nn): macro = {
!--- macro defining head-on beam-beam elements; nn = IP number
print, text="bbipnnl2: beambeam, sigx=sqrt(rnnipnnl2->betx*epsx),";
print, text=" sigy=sqrt(rnnipnnl2->bety*epsy),";
print, text=" xma=rnnipnnl2->x,yma=rnnipnnl2->y,";
print, text=" charge:=on_honn;";
print, text="bbipnnl1: beambeam, sigx=sqrt(rnnipnnl1->betx*epsx),";
print, text=" sigy=sqrt(rnnipnnl1->bety*epsy),";
print, text=" xma=rnnipnnl1->x,yma=rnnipnnl1->y,";
print, text=" charge:=on_honn;";
print, text="bbipnn: beambeam, sigx=sqrt(rnnipnn->betx*epsx),";
print, text=" sigy=sqrt(rnnipnn->bety*epsy),";
print, text=" xma=rnnipnn->x,yma=rnnipnn->y,";
print, text=" charge:=on_honn;";
print, text="bbipnnr1: beambeam, sigx=sqrt(rnnipnnr1->betx*epsx),";
print, text=" sigy=sqrt(rnnipnnr1->bety*epsy),";
print, text=" xma=rnnipnnr1->x,yma=rnnipnnr1->y,";
print, text=" charge:=on_honn;";
print, text="bbipnnr2: beambeam, sigx=sqrt(rnnipnnr2->betx*epsx),";
print, text=" sigy=sqrt(rnnipnnr2->bety*epsy),";
print, text=" xma=rnnipnnr2->x,yma=rnnipnnr2->y,";
print, text=" charge:=on_honn;";
};
mkho(nn): macro = {
!--- macro defining head-on markers; nn = IP number
print, text="mkipnnl2: bbmarker;";
print, text="mkipnnl1: bbmarker;";
print, text="mkipnn: bbmarker;";
print, text="mkipnnr1: bbmarker;";
print, text="mkipnnr2: bbmarker;";
};
inho(xx,nn): macro = {
!--- macro installing bb or markers for head-on beam-beam (split into 5)
print, text="install, element= xxipnnl2, at=-long_b, from=ipnn;";
print, text="install, element= xxipnnl1, at=-long_a, from=ipnn;";
print, text="install, element= xxipnn, at=1.e-9, from=ipnn;";
print, text="install, element= xxipnnr1, at=+long_a, from=ipnn;";
print, text="install, element= xxipnnr2, at=+long_b, from=ipnn;";
};
sbhomk(nn): macro = {
!--- macro to create savebetas for ho markers
print, text="savebeta, label=rnnipnnl2, place=mkipnnl2;";
print, text="savebeta, label=rnnipnnl1, place=mkipnnl1;";
print, text="savebeta, label=rnnipnn, place=mkipnn;";
print, text="savebeta, label=rnnipnnr1, place=mkipnnr1;";
print, text="savebeta, label=rnnipnnr2, place=mkipnnr2;";
};
mkl(nn,cc): macro = {
!--- macro to create parasitic bb marker on left side of ip nn; cc = count
print, text="mkipnnplcc: bbmarker;";
};
mkr(nn,cc): macro = {
!--- macro to create parasitic bb marker on right side of ip nn; cc = count
print, text="mkipnnprcc: bbmarker;";
};
sbl(nn,cc): macro = {
!--- macro to create savebetas for left parasitic
print, text="savebeta, label=rnnipnnplcc, place=mkipnnplcc;";
};
sbr(nn,cc): macro = {
!--- macro to create savebetas for right parasitic
print, text="savebeta, label=rnnipnnprcc, place=mkipnnprcc;";
};
inl(xx,nn,cc): macro = {
!--- macro installing bb and markers for left side parasitic beam-beam
print, text="install, element= xxipnnplcc, at=-cc*b_h_dist, from=ipnn;";
};
inr(xx,nn,cc): macro = {
!--- macro installing bb and markers for right side parasitic beam-beam
print, text="install, element= xxipnnprcc, at=cc*b_h_dist, from=ipnn;";
};
bbl(nn,cc): macro = {
!--- macro defining parasitic beam-beam elements; nn = IP number
print, text="bbipnnplcc: beambeam, sigx=sqrt(rnnipnnplcc->betx*epsx),";
print, text=" sigy=sqrt(rnnipnnplcc->bety*epsy),";
print, text=" xma=rnnipnnplcc->x,yma=rnnipnnplcc->y,";
print, text=" charge:=on_lrnnl;";
};
bbr(nn,cc): macro = {
!--- macro defining parasitic beam-beam elements; nn = IP number
print, text="bbipnnprcc: beambeam, sigx=sqrt(rnnipnnprcc->betx*epsx),";
print, text=" sigy=sqrt(rnnipnnprcc->bety*epsy),";
print, text=" xma=rnnipnnprcc->x,yma=rnnipnnprcc->y,";
print, text=" charge:=on_lrnnr;";
};
\end{verbatim}
%\href{http://www.cern.ch/Hans.Grote/hansg_sign.html}{hansg}, June 17, 2002