Skip to content

Forking Lines

David Sagan edited this page Sep 4, 2017 · 4 revisions

Fork Elements

A fork or photon_fork element marks the point where multiple lines can merge or branch off from. Forking elements can be used to describe X-ray lines branching from storage rings, injection or extraction lines, etc.


Example

beginning[beta_a] = 10.0        ! m  a-mode beta function
beginning[beta_b] = 10.0        ! m  b-mode beta function
beginning[e_tot] = 10e6         ! eV 
parameter[geometry] = open      ! or closed

b: bend, l = 2, rho = pi/4
f: fork, to_line = extract_line, superimpose, offset = 0.4
d: drift, l = 2

extract_line: line = (d)	     ! The line forked to.
extract_line[geometry] = open

lat: line = (b)
use, lat                ! Line used to construct the lattice

Copy this to a file fork.bmad and run Tao:

> tao -lat fork.bmad
Tao> place r11 floor

Gives:

The lattice is looks like:

Tao> show lat
      Values at End of Element:
 Index  name      key                       s       l    beta     phi    eta  orbit     beta     phi    eta  orbit    Track_State
                                                            a       a      a  x [mm]       b       b      b  y [mm]
     0  BEGINNING Beginning_Ele         0.000     ---   10.00   0.000   0.00   0.000   10.00   0.000   0.00   0.000   Alive
     1  B#1       Sbend                 0.400   0.400    9.77   0.040   0.03   0.000   10.02   0.040   0.00   0.000   Alive
     2  F         Fork                  0.400   0.000    9.77   0.040   0.03   0.000   10.02   0.040   0.00   0.000   Alive
     3  B#2       Sbend                 2.000   1.600    5.32   0.249   0.75   0.000   10.40   0.197   0.00   0.000   Alive
     4  END       Marker                2.000   0.000    5.32   0.249   0.75   0.000   10.40   0.197   0.00   0.000   Alive
Lord Elements:
     5  B         Sbend                 2.000   2.000    5.32   0.249   0.75   0.000   10.40   0.197   0.00   0.000   Alive
 Index  name      key                       s       l    beta     phi    eta  orbit     beta     phi    eta  orbit    Track_State
                                                            a       a      a  x [mm]       b       b      b  y [mm]
      Values at End of Element:

Where is the line that was forked to? Bmad creates branches to hold the different lines. Branches are assigned an index starting from 0:

Tao> show branch
                          N_ele  N_ele                  Default                       Live
  Branch                  Track    Max   Ref_Particle   Tracking_Species    Geometry  Branch  From_Fork
  0: LAT                      4      5   Positron       Ref_Particle        Open       T
  1: EXTRACT_LINE             2      2   Positron       Ref_Particle        Open       T      0>>2
 
                                                                                                      Defines
  Fork_Element                              Forking_To                                   Direction    To_Branch?
  0>>2: LAT>>F                              1>>0: EXTRACT_LINE>>BEGINNING                 1             T

The show lat branch, by default, shows branch 0. To see other branches use the -branch option:

Tao> show lat -branch 1
      Values at End of Element:
 Index  name      key                       s       l    beta     phi    eta  orbit     beta     phi    eta  orbit    Track_State
                                                            a       a      a  x [mm]       b       b      b  y [mm]
     0  BEGINNING Beginning_Ele         0.000     ---    9.77   0.040   0.03   0.000   10.02   0.040   0.00   0.000   Alive
     1  D         Drift                 2.000   2.000    8.04   0.268   0.34   0.000   10.58   0.236   0.00   0.000   Alive
     2  END       Marker                2.000   0.000    8.04   0.268   0.34   0.000   10.58   0.236   0.00   0.000   Alive
 Index  name      key                       s       l    beta     phi    eta  orbit     beta     phi    eta  orbit    Track_State
                                                            a       a      a  x [mm]       b       b      b  y [mm]
      Values at End of Element:

Notes:

  • The difference between fork and photon_fork is that the default species for fork is the same as the line forked from while for a photon_fork the default species are photons.
  • A fork element is not restricted to forking to the beginning of a line. The place where a fork element connects can be set by the to_element attribute.