Home

User`s Manual of CAIN

image

Contents

1. Unit vector in CAIN coordinate along the orbit direction of the beam line at the entrance This defines the s axis of the beamline Default is 0 0 1 Unit vector in CAIN coordinate along the radial direction of the beam line at the entrance This defines the x axis of the beamline Default is 1 0 0 Change the vertical scale in the plot with respect to horizontal When Ton gt 1 vertical scale is magnified Default 1 Magnet full width in meters Dipole magnets appear as a box of width w and quadrupoles as 0 75w Default 1 0 Paper size in inches Default 13 10 Character string of the filter of the magnet names to be printed It may contain the wild card e g FILTER B will print names starting with B only If not specified names of all the dipoles and quadrupoles are printed 68 3 24 8 Plot a function Syntax PLOT FUNCTION NONEWPAGE H f V f PARAMETER name RANGE x w2 n XLOG XLINEAR HSCALE Lmin mar VSCALE Ymin Ymar HLOG HLINEAR VLOG HLINEAR LINEMODE 1 l2 COLOR color TITLE top title HTITLE bottom title VTITLE left title FILE f file name APPEND Fade Define the function to be plotted in the parameterized form They should name 11 2 XLOG lis normally contain the variable defined by the PARAMETER command Name of the parameter to vary Must satisfy the constraint
2. fenh Event rate enhancement factor It is unity when the number of created macro pairs is the same as the expected number of real pairs 2 e the weight of the pair particle is 1 fenn Default fenn 0 1 In using ABEL one had to define the minimum scattering angle and minimum transverse momentum This was due to the ultra relativistic approximation employed there CAIN does not need these parameters 3 13 PUSH ENDPUSH Define the time step loop of tracking Tracking is done by a pair of commands instead of one single command in order to allow users to take action such as print plot insert test particles etc at arbitrary time steps Syntax PUSH Time to tr sted 4 any commands ENDPUSH to t Start and end time multiplied by velocity of light of tracking meter Note the spelling of Time which contains lower case alphabet in contrast AT to other operand keywords consisting of upper case letters only In fact Time is a pre defined variable name Therefore you can for example print its current value during PUSH loop by PRINT Time FORMAT net Number of time steps gt 0 Actual control of the loop is done in the following way e Before the first time step all the particles are made to drift to t to by straight lines e At the PUSH command of j th loop j 0 1 n the time variable Time is set to tj to At where At ts to ne e Execute commands between PUSH and ENDPUSH e Cont
3. PERIODIC Periodic condition i e Twiss parameters at the entrance equal to those at exit is applied BETA etc are not needed Ba By Ux 04y Na My 1 1 Twiss parameters and eta functions at the entrance The y y Ma My Ma My default values are all zero so that at least and 3 must be defined if not PERIODIC 3 19 MATCHING Optics matching of a beamline Syntax MATCHING BEAMLINE name PERIODIC BETA G 3 ALPHA a Qy ETA 92 9y ETAPRIME 7 n VARIABLE 01 02 ZERO f1 f2 POSITIVE g1 92 MINFUN h name Name of a defined beamline 52 PERIODIC Periodic condition i e Twiss parameters at the entrance equal to those at exit is applied BETA etc are not needed Bax By Ax Ay Nx Ny Twiss parameters and eta functions at the entrance The default values are all zero so that at least 6 and 6 must be defined if not PERIODIC These expressions can be floating or character If floating the value is computed when MATCHING command is invoked and is treated as a constant during matching If character the string is treated as a meta expression see Sec 2 7 and is repeadtedly evaluated during matching Therefore if the expression contains a variable which is to be treated as a matching variable you have to enclose the whole expression to make it a meta expression vi Name of a variable scalar floating variable or an element of a floating array or an array name without sub
4. TPROFILE Tprof1 gt Tprof2 NPROFILE Mprof time profile params spatial _profile params file params RIGHT LEFT Right going or left going If RIGHT LEFT is specified the laser acts only onto the left right going particles to save computing time If omitted acts on both AL Laser wavelength m Poo Peak power density Watt m If FILE operand is used Poo is multiplied on the power density values obtained from the file PES Laser focal point and the time when the laser pulse comes there m e e e 3 Unit vector e along the direction of laser propagation e eH e Unit vector e perpendicular to e e e e with e e xe forms a right handed orthonormal frame e and e need not be normalized exactly and need not be perpendicular to each other ex actly The component parallel to e is subtracted from el by Schmidt orthogonalization 1 2 3 Stokes parameter defined in the e e e frame Default 0 0 0 PLOTPROFILE Flag to plot the intensity profile on TDFile This is basically to check the profile defined by a file You cannot specify axes scale range etc The only parameter is Tprof You can also plot the intensity profile as a scatter plot of laser photons by using PLOT SCAT LASERPHOTON command See Sec 3 24 2 Toney The time multiplied by velocity of light to take snapshop for plotting laser profile In units of meter in the laser coordinate 7 7 T
5. or or y It is also possible to write a do type sequence of the form almost like FORTRAN Yis Yn s1 t1 12 13 where y s are expressions i is a floating type user parameter name need not be defined by SET command or an element of floating type array 71 12 and 73 are expressions for initial final and increment values of i If 13 is omitted 13 1 is adopted Note that 21 i2 and 73 are considered to be integers Nint is applied Do type sequence may be nested as in FORTRAN The do control vari able must not duplicate of course Duplication within the sequence and the loop of DO command is checked but possible interference with variables outside PRINT or WRITE is not checked Fortran format Character expression or a character string enclosed by The latter is for backward compatibility CAIN recognizes the following format descriptors XTPAIFEDG When l format is called for Nint is applied for the corresponding ar gument If format is not specified printed as expression value by 1PD15 8 for floating or by A for character type one line for each An exception is that the value is just printed by A without expression when the expression is a character type literal constant Thus PRINT abc will cause abc be printed If format is given but there is no expression to be printed the format is executed as in FORTRAN For example WRITE FORMAT nothing will caus
6. 2 f Tv 5 179 with V x 2 Ko x Ko x K o 5 180 When Ymin lt 1 the total number is a 2 ic log Ymin 2 log 2 m 24 1 log Ymin 5 181 where y 0 577 is Euler s constant At very high energies the number of virtual photons per electron is O 1 in spite of the small factor a r due to the factor log Yin 5 11 3 Numerical methods When Bethe Heitler and or Landau Lifshitz processes are specified by PPINT command CAIN generates virtual photons in each longitudinal slice at each time step and counts them in the same mesh as that generated by the LUMINOSITY command The number of macro virtual photons is somewhat arbitrary In the present version it is determined such that the weight of the macro virtual photons is equal to the maximum weight of the electrons in the on coming beam not equal to the weight of each parent electron in order to prevent low weight electrons from generating many photons Since the y energy spectrum is approximately proportional to log y y for small y the spectrum becomes almost flat if one chooses log y as the primary variable To account for relatively large y too CAIN adopts the variable 7 instead of y 1 y exp log y ylog y 4clog y 5 182 Here c gt 0 is introduced so that the function G n defined later is finite It is chosen to be 0 2 but is almost arbitrary provided c Z 0 1 The maximum is 1 mas 5 log Ymin y log Ymin
7. If you specify one of then RIGHT for example the left going P lt 0 in Cain 59 KIND coordinate particles are left intact The right going ones are transformed to the beamline coordinate and if P lt 0 in beamline coordinate they are asigned lost Apply to electrons or positrons only Of course you must not choose photons LOSSMONITOR Activate loss monitor Normally particles going out side the aperture are eliminated from memory When the loss monitor is activated they are kept and their coordinates beamline coordinate are fronzen where they are lost You can write their data by WRITE BEAM LOST and plot them by PLOT HIST LOST etc However the present version simply compares the aperture with the beam x y coordinate only at entrance and exit of magnets Therfore the stored position is not exactly on the aperture surface Also note that in some cases the lost position may be inside the aperture when a particle curls within a magnet and cannot reach the exit of the magnet When the beamline consists of n elements the j th step 0 lt j lt n is executed as follows e At the TRANSPORT command in the first step j 0 the coordinates of the relevant particles are transformed into the beamline coordinate e Execute the commands between TRANSPORT and ENDTRANSPORT Thus these commands are repeated n 1 times e At the ENDTRANSPORT the beam goes throughth the j 1 th element if j lt n If 7
8. are replaced by blanck spaces e A practical problem is the computing time since the file data has to be interpreted character by character typically 0 5 to 1 msec per particle on 750MHz platform If you are going to use the same particle data many times you had better convert it into standard format A CAIN job consisting of two commands BEAM FILE filet dat USERDEFINED WRITE BEAM FILE file2 dat will do 3 5 3 Single particle You can define add to the existing list one particle by explicitly specifying the data It is not reccommended however to define many particles by this way because of the computing interpreting time Syntax BEAM SINGLEPARTICLE KIND k WEIGHT w TXYS t xw y s P pos Pys Ps SPIN Gp Sy 595 4 32 k Particle specie w Weight how many real particles are represented t Y 8 Space time location of the test particle m Default is 0 0 0 0 Px Py Ps 3 momentum eV c ps must not be zero i e either right going or left going The energy is computed from E m p Sud 3 components of the spin Default is 0 0 0 3 5 4 Test particles Definition of test particles can also be done by BEAM command One BEAM command is needed for each test particle The number of test particles times the number of PUSH time steps must be less than 5000 parameter MTSTP in the file cain src include tstpcm h Test particles do not create a field but feel a field They
9. lt P decide to create a pair The number of laser photons to absorb is determined from GINT n NY 7 1 as in the Compton case To determine the electron energy generate another random number ra in the range 1 1 Then y 0 lt y lt 1 is determined from r as in the Compton case Adopt y instead of y if ra lt 0 The helicity of electron is given by _ hiGan hyGan Gin hih G3n he 5 143 The positron momentum is calculated by the momentum conservation and the helicity from the above formula with y replaced by y 5 9 Beamstrahlung 5 9 1 Basic formulas When the orbit of a high energy electron positron with energy Ey mey is bent by a magnetic field B or by an electric field with the curvature radius p the critical energy of synchrotron radiation is given by B E 13 Ac E TEN T TT T27 5 144 i 2 Do Bsn Esen ma where Ac is the Compton wavelength Bsen Mm e 4 4 x 10 Tesla is Schwinger s critical field and Esen CBsen 1 32 x 10 8V m The energy spectrum of emitted photons is given by the Sokolov Ternov formula Radiation angle is not included in CAIN All the photons are emitted forward The 112 number of photons per unit time in the interval x dx of the energy fraction x E Eo is am q dW Fooda Foo Kis 3 z Ko 3 2 5 145 T 00 00 5 3 2 2 3 2 Here a is the fine structure constant and Es 1 EEEo 1E 1 z z 5 146 Elk
10. A problem happens when a meta expression contains another meta expression which may happen for example if you use SigX in H operand of PLOT command This is solved by FORTRAN recursive call of the loader since CAIN2 3 FORTRAN9O required However this is still very much time consuming because the compiler is invoked many times for the inner meta expression in the present algorithm Therefore you should avoid recursive call of meta expressions There can also be bugs related to the recursive call 2 8 External Files Files are identified by unit number and or file name Standard I O files The files used for standard outputs are refered to only by unit numbers defined by the variables MsgFile OutFile OutFile2 and TDFile These unit numbers should be as 22 cociated to particular file names before CAIN run if needed These files are not closed unless you do so by FILE CLOSE command On the other hand the input file unit number is not asigned to a CAIN variable but is fixed to 5 If you want to change it you have to change the FORTRAN varible RDFL in cain242 src initlz f and compile this file Other output files Some commands such as WRITE and BEAM accept I O files specifed as FILE f file name The right hand side is evaluated as a general expression If it is of floating type it is identified as a file unit number f gt 0 If it is of character type it is identified as a file name Either full path o
11. CLEAR BEAM SELECT RIGHT LEFT Clear right or left going particles only Default both k k k2 Clear photon k 1 or electron 2 or positron 3 only Ta Logical function for selecting particles See Sec for detail Turn off lasers Syntax CLEAR LASER Turn off LASERQED Syntax CLEAR LASERQED COMPTON BREITWHEELER Clear parameters for the laser QED If either one of COMPTON or BREITWHEELER is specified the other one is not turned off Clear luminosity Syntax CLEAR LUMINOSITY Clear luminosity integrals as well as the definitions of luminosities Note that the contents of luminosity integrals are cleared whenever the PUSH command starts Thus if you do another PUSH without CLEAR LUMINOSITY the luminosity command will be still active and the integration starts from scratch Turn off beam beam field Syntax CLEAR BBFIELD Turn off the external field 70 Syntax CLEAR EXTERNALFIELD Turn off CFQED Syntax CLEAR CFQED BEAMSTRAHLUNG COHERENTPAIR E If none of BEAMSTRAHLUNG and COHERENTPAIR is specified both is turned off Turn off PPINT Syntax CLEAR PPINT Turn of particle particle interaction defined by PPINT command Note that this does not mean to eliminate particles already created 3 26 FILE Open close rewind a file The first operand is positional Syntax FILE OPEN CLOSE REWIND ENDFILE
12. For example ARRAY a 20 0 10 SET a 3 4 5 0 x a 3 4 ARRAY FREE a When the lower bound of a subscript is not specified in ARRAY command 1 is assumed as in FORTRAN Total number of arrays and the maximum rank is limited but reasonably large number by FORTRAN parameter statement but the size of each array is arbitrary as long as your computer memory allows See Sec 3 4 for more detail 2 5 6 Character expression A literal character string is defined as a string enclosed by a pair either of apostrophes or of double apostrophes The string must close within a file line When you need a long string you can use concatenation like abc xyz to be explained below Within a string enclosed by you can use as a normal character The FORTRAN rule that two successive or are recognized as a single or is still valid but not reccommended there can be bugs Even if you have both and in a string you can write like gt gt Character expressions have been introduced since CAIN2 3 All expressions can be classified into two types floating and character according to the results 3When a file line is read from a file blanck spaces to the end of the line cause a problem There is no way in standard FORTRAN to distinguish between blanck spaces existing in the file and those added when read in 16 A variable with the first character up to 16 characters including the no in the body
13. Lyp i Loo L20 Loz 22 L 3 Loo Lo Loz L22 5 59 Ly I Loo L20 Loz L22 L__ 3 Loo L Loz L22 The helicity luminosity is calculated by LUMINOSITY command by specifying the operand HELICITY If you want all 16 combinations or the linear polarization effects you need to specify ALLPOL operand For electrons the expression 5 58 is not exact because the helicity is defined as p p rather than 94 5 7 Beam Field One of the basic assumptions of CAIN is that the most particles in the beams have high energy and are almost either right or left going This assumption leads to the following facts e A field due to a particle is almost concentrated in a transverse plane with the same s coordinate of the particle because of the Lorentz contraction e If the electric field is E the magnetic field is given by B ce x E where e is the unit vector along the s axis c the velocity of light and the upper lower sign is for the field created by the right left goin beam In contrast to ABEL CAIN does not assume that all the particles have the above property Some particles may have low energies and large angles with respect to the s axis CAIN will work unless the sum of their weight becomes a significant fraction of the beam The equation of motion under the Lorentz force is integrated with possible low energies and large angles taken into account The calculation of the beam elect
14. and e e xe This is ill defined when the momentum is exactly parallel to the z axis but this possibility is simply ignored Except for large angle photons e e e is almost equal to ez y ez for right going photons and x e e for left going photons See the next subsection for more detail on the polarization GEN Generation When a particle is generated by BEAM command by Twiss parameters etc GEN 1 Created particles such as beamstrahlung photons have GEN larger by one than that of the parent particle This is also true for the spent parents GEN of the secondary particles due to particle particle interaction such as incoherent pairs is the sum of GENs of the parents In this case GENs of the parents do not change WGT Weight Number of real particles represented by the macro particle NAME 4 byte character string Normally blanks The test particles have Tnnn where nnn is a three digit number NAME of the particles created by inco herent particle particle interactions starts with I For example IBW IBH ILL for the pairs created by incoherent Breit Wheeler Bethe Heitler Landau Lifshitz processes respectively 5 2 2 Description of Polarization Convention for electron positron polarization In most applications one is interested in the helicity states Therefore one possible way of expressing the electron positron spin is to store the information whether ea
15. Fo E UA 4 m pi 88 If this is not small enough divide the interval At by an integer ng Note that dr x At because F Fo is proportional to At The total error after multiplied by the number of intervals ng is proportional to 1 n3 However the above prescription is not really enough when there are extremely low energy particles e g those from incoherent pair creation It often happens that ng so determined bocomes over several hundreds In such a case the above error estimation may not be accurate at all When na is too large CAIN tries the fourth order Runge Kutta integration Starting from the whole interval At it is divided by 2 at each step until the difference becomes small enough This method is a little better than the simple formulas above but is still time consuming So the users should be aware that incoherent pair creation is expensive 5 5 Beamline A beamline consists of magnets RF cavities drift spaces etc Here we shall call them beamline elements or simply elements and sometimes magnet RF cavities are not ready yet In CAIN only single particle dynamics in given fields is taken into account 5 5 1 Beamline Coordinate A beamline has a reference orbit which is defined by the element length LENGTH in MAGNET command orbit bending angle ANGLE and axial rotation angle ROTATION So far the reference orbit is defined only geometrically because time varying fields are not inc
16. LT LT Linear laser Compton e laser e y LT LT LT LT Nonlinear laser Compton e n laser e y L L E L or N iti N T initial y laser final e Coherent pair y gt eF 4er LT LT Linear laser Breit Wheeler y laser gt eT e7 LT LT LT Nonlinear laser Breit Wheeler y n laser gt et e7 L L L initial final pair Incoherent Breit Wheeler y y et e7 L N Incoherent Bethe Heitler y eetet e7 N N Incoherent Landau Lifshitz ete etetet e N N initial final Bremsstrahlung e e e e y N N L Longitudinal spin of electron positron or circular polarization of photon Transverse spin of electron positron or linear polarization of photon 100 polarization only N Not computed No change for existing particles zero for created particles Irrelevant 5 3 Beam Parameters The BEAM command makes it possible to define a beam in terms of the conventional Twiss parameters A beam is defined by many parameters described in Sec 3 5 Here we will give formulas how to generate a beam using these parameters An important point is that the beam is defined on a plane s constant rather than t constant Thus the longitudinal structure of the beam appears as the time structure Note that t is larger at the bunch tail The parameters are to To Yo So Reference point of the Twiss parameters m Eo Reference energy eV Bay Qz Nay Ney Twiss parameters T Geometric emittance rad m on R m s bunch length m a R m s re
17. REPEAT and WHILE must be the first operand Syntax form 1 DO REPEAT nm n Number of repetition Can be an expression evaluated when entering the loop n gt 0 n 0 causes a jump to ENDDO n lt 0 causes an abnormal term Syntax form 2 DO WHILE expr expr A logical expression like in DO WHILE x gt 0 Any expression is considered to be logical by asigning false for 0 and true otherwise For example the do loop DO WHILE n ends when n 0 For compatibility with old versions The substition operator is treated as in DO WHILE and IF command The loop is repeated so long as the condition is satified The check is made at the time of DO command The values of expressions are REAL 8 If you want integers for definiteness use Nint or Int Syntax form 3 DO i1 dl 43 1 DO control variable Either a floating scalar variable or an element of a floating array variable In the former case the variable need not be defined before In the latter case the array must be declared before The subscript is evaluated when entering the DO loop Obviously the variable must not be used as a DO control variable of a lower nest level CAIN checks this but does not check if the user changes the value 11 12 13 The starting value the upper lower bound and the increment of the control variable as in FORTRAN If 73 is omitted 13 1 is assumed The value of 7 s are evaluated when entering the DO loop 73 m
18. and TDFile will be created as dat and tdr in the directory where the input file is located where is the input file name without extension If you want outputs to other files you have to explicitly open files by using CAIN commands FILE OPEN commad or FILE operand of various commands Windows9x stops when an undefined file unit number such as WRITE x is encountered whereas UNIX usually automatically creates a file named fort x KEK DEC station or ftn00x KEK HP station Due to this fact changing the variables above will cause a file open error e One problem of the compiler on Windows Visual Fortran is that the number of stored lines in the console window is very limited When the output to MsgFile exceeds some hundred lines the early are will be lost If you want the destination of MsgFile to be a file please insert the following line in the file Cain ini in the same directory where Cain exe is located MSGDEST FILE The default is MSGDEST CONSOLE Then the messages will go to txt in the same directory as dat The same message will also go to the console with some delay The messages to the file are copied at every encounter of CAIN command e The current directory is the directory where the input file is located rather than cain exec Be carefull with the file name You do not need directories such as cain in and cain out unless you want e Since only the binary module is distributed you cannot change the si
19. electron positron Gen Particle generation 73 Wgt Macro particle weight One macro particle corresponds to Wgt real particles Incp Logical variable True 1 if the particle is created by an incoherent process False 0 otherwise PName Macro particle name 4byte character Normally blanck Incoher ent particles start with T e g IBW IBH ILL IBR for Breit Wheeler Bethe Heitler Landau Lifshitz and bremsstrahlung respec tively For examples SELECT Kind 2 amp amp En gt 100e9 amp amp Sqrt Px 2 Py 2 gt 1e9 for selecting electrons with energy over 100GeV and transverse momentum over 1GeV c The outermost parenthesis are used for clarity They are not needed grammatically Thus the keywords RIGHT LEFT and KIND are not needed RIGHT can be replaced by SELECT Ps gt 0 However they are still retained and recommended These keywords define the subset of particles to apply SELECT operand Another selecting keyword LOST cannot be replaced by SELECT There was a keyword GENERATION or GEN in old versions of CAIN for selecting parti cles with specified generation This keyword is not used since CAIN2 3 because its syntax like GEN gt 2 is not compatible with the new grammer You can now say SELECT Gen gt 2 There is a complication on the selecting operand INCP which exclusively select inco herent particles The versions since CAIN2 32 apply the following rule for lower com patibility o
20. for left going note that right left appears only here and m is the relevant particle mass in units of eV c 5 4 Solving Equation of Motion Under the PUSH command the equation of particle motion is solved step by step with the Time as the independent variable The time step size is determined automatically for each 86 particle Smaller step size is used for low energy particles On the other hand an exact solution is used in the case of DRIFT EXTERNAL command which uses either the time or s as the independent variable 5 4 1 Equation of motion under DRIFT EXTERNAL command The present version of CAIN accepts a constant external field only The covariant form of the equation of motion dx 1 dp e p F p 5 31 drm dr m pat where 7 is the proper time and F the electromagnetic field tensor can be solved exactly when the field is constant The eigenvalues of the matrix f eF m is given by w and w3 where w Vi vVa 4B a We iy Uva 40 a 5 32 with e2 2 E B b E B 5 33 a Then the solution is Y 1 w w1 w2 V a 4b where the upper lower sign applies to w w2 and f 1 Hv08 F with e being the antisymmetric tensor of rank 4 The classical spin motion of electrons is given by the Thomas BMT equation dS 1 E Ee pea ae va 1 B7 a 1 Bz qla Be x xS 5 35 dt my y 1 c sinhwt E G FHF
21. gt a 2 x Fo FES Es PeP EO Fatt E Fats E HF C GCI PLA TE AEG 6 91 See Sec for the meaning of the bars on and The omitted terms are products of three and four among C ra E and E w Actually we need the terms x x C and 2 Actually adopts left handed basis after collision so that the first and the second components of are l and in 3 Our a is not amp 3 but 1 2 3 3The term G is given in eq 4 6 in 4 102 CHE E but they are not found in literature The functions introduced in the above expression are ma m sin Fy sin 90 5 92 Fi 2cos Fo 2 z cos 0 F33 1 cos 0 5 93 1 1 f e cos 0 k cos O k f Al cos 0 k k cos 0 5 94 g f sind wtu k k l A 5 95 oy G I 1 cos 6 a sin 0 oe 1 cos n n n n m a pil _ a n n 8 n n nxn e nxn Www F SE cos0 k k n n sin 0 2 cos 0 Fo na ean BB kK 596 These formulas are used in their exact forms in CAIN Summation over the final polarization and the azimuthal angle gives the differential crosssection with respect to the final photon energy w Introducing the variables Z inplace of w by 2 ElLa O lt 2 1 z log w w Ly log 1 A 5 97 cos 1 2 e 1 A 5 98 we write the differential crossection as do 2 Da dz Arre
22. 3 4 i j 0 1 2 3 Luminosity values used in PLOT LUMINOSITY command Center of mass energy used in PLOT LUMINOSITY command s coordinate in a beamline Makes sense only inside TRANSPORT ENDTRANSPORT loop Character Name of the previous magnet Valid only during a TRANSPORT ENDTRANSPORT loop Character Name of the next magnet Valid only during a TRANSPORT ENDTRANSPORT loop InFilePath Full path of the input file directory includes the last character P UNIX or Windows InFileName Name of the input file without path with extension e The third type is those whose names are predefined with default values and which the user can change by SET command such as MsgFile OutFile DutFile2 TDFile MsgLevel Rand Debug Smesh File reference number for echo error messages and default desti nation of PRINT command default 6 File reference number for voluminous outputs The default desti nation of WRITE command default 12 Other print output Not used default 12 TopDrawer file number default 8 Message level default 0 i e error messages only Random number seed Positive odd integer other than 1 default 3 You can reset random number at any time Debug parameter for the programmer If you set Debug gt 2 call and return from major subroutines are announced default 0 Longitudinal mesh size m for the calculation of beam beam field luminosity etc No default value 2 5 3 Us
23. 4c log in A 5 183 Now the spectrum with respect to n is dn G n an 5 184 with _ 26 Gln soe ayaa 5 185 8 The upper limit y 1 is not regorous The recoil effect must be taken into account when y is large 123 1 00 4 0907 y Figure 5 12 Function G n defined in eq 5 185 m 085 s It is close to unity because S 1 f only large 7 region is im 0 807 F portant G 0 is finite and depends on the parame ter e G 0 lt Life gt ae E 0 1035 Here c 0 2 f is adopted 0 65 7 i rete 1x10 1x10 1x10 1x108 For 0 lt y lt oo G n lt 1 and close to 1 except for the small 7 region which is umimportant in practice Thus Nmazx n PO G n dn lt maz 5 186 T JO T For given 7 or y the distribution of x is proportional to dV x V y and therefore can be random generated by using inverse function V 1 V The algorithm is as follows a From the given parameters compute Ymin max and Q Nmax T W P where w is the weight of virtual photon to be created Po is the expected number of macro virtual photons If Po is not small enough say gt 0 1 divide it by an integer N and repeat the following steps N times b Generate a uniform random number r 0 1 Reject if r gt Po Otherwise redefine r by r Po c Generate a random number ra 0 1 define n raMmax and calculate G n from a table Reject if r gt G The probabili
24. EN YE Vise E Ey E Fo 1 2 is the final electron energy K the modified Bessel function and Ki is its integral Ki z f Klik 5 147 The function Fo0 is available as a CAIN function FuncBS and so are some of the K s and Ki s See Secl2 6 5 9 2 Algorithm of event generation The random number generation using the acception rejection method is applicable when the distribution function is everywhere finite and is most efficient when the function is flat Since the function Foo is infinite at E 0 the following variable y is introduced in CAIN instead of the photon energy fraction x in order to make the distribution function finite and relatively flat Ty r 3 1 y3 1Y 1 y6 0 lt y lt 1 5 148 The number of photons during a time interval At in the photon energy range y y dy is then given by dn poG T y dy 5 149 where Co 1 ayAt yAt At E 5 150 a var 1 3134 p p Ac Esch l _ 37 de _ 9 G Y y cot dy co pial 2 8 5 151 The function G Y y is less than or equal to unity for any Y and y It is plotted in Fig 5 8l The photon generation in CAIN proceeds in the following way The definition of y has changed since ABEL and CAIN2 40 in order to keep high efficiency even when Y is extremely large 113 Figure 5 8 Function G Y y for various values of Y Unpolarized case only eS E Oo Calculate py for
25. F z 5 99 where 1 F z gt 1 e e sin 0 heos 1 e A 5 100 21 k h se 5 101 Note that does not appear here because it is based on the scattering plane and there fore disappears after integration over the azimuthal angle The function F Z satisfies 0 lt F lt 1 for any Z and A and is O 1 except when h is close to 1 and A is extremely large The Function F Z is plotted in Fig 5 6 The total crosssection for given initial momenta and polarizations is given by Ly Otot rro Fl 5 102 103 100 gt 1000 1 0 oe E 0 8 5 q L Figure 5 7 Function F FimilA for h 0 1 as a ls function of A Fins is less amp than unity and is O 1 un 1 te S ss less h is close to 1 and A E bs 4 Fal As is extremely large wee 7 0 0 a TO lai 42 1 3 T 4 5 6 1x10 1x10 1x10 1x10 1x10 1x10 1x10 1x10 1x10 A Let us driefly describe the algorithm of event generation 1 Compute the total event rate Po in the given time interval using Cto without the factor Fint Since Fin lt 1 this is an over estimation of the rate If Po is too large divide the time interval by an integer N and repeat the following procedure N times 104 2 Generate a random number r uniform in 0 1 Reject if r gt Po 3 Compute Fint and multiply it to Pp Reject if still r gt Pp Otherwise accept Note that the Lorentz transformation of is not neede
26. Nonlinear Breit Wheeler Process k kL p p momenta of the initial photon laser photon final electron and positron w wy lt Energies of the initial photon laser photon final electron and positron E Laser intensity parameter n Laser energy parameter 7 k k 2m wrw m n Number of absorbed laser photons ie p k k k w 0 lt a2 lt 1 u u 1 4x 1 x x 1 4 1 1 u 1 lt u lt oo Un Maximum u for given n un nn 1 Tn Zn 3 1 4 1 1 un 109 O Lorentz invariant variable defined by O y4mz 1 2 1 amp Jor E 1 5 127 The polar angle of final electron is 6 m0 e in the head on frame For given x and n the final momenta are given by p xk ha x E kr mO e cos egsin 5 128 pal k Es k l 5 129 p 1 x k gt a L m0O e cos ez sin q 5 129 Here is the azimuthal scattering angle in a head on frame ef is a spatial vector perpendicular to kz and k and e is defined by VEO B p Emvapeok ki _ 0 a eo wR eRe 5 190 These vectors satisfy es Kee 0 ej lj 1 j 1 2 12 O 5 131 5 8 4 2 Case of Circularly Polarized Lasers Transition Rate Total number of pair electrons per unit time summed over the positron polarization is am 1 2 ear Y dr Grp hh Gon he htGan hyGan 5 132 n 1 n gt 14 2 9 a Initial photon helicity hy Laser helicity i Final electron helici
27. Plot charge distribution and beam beam field 67 AAA a ee ee 68 3 24 7 Plot beamline geometry o 68 Sos Shs ee om eR EE eee eo Mee ee 69 Ga UE y a a e ARE A OWE we AR ESR RSH 69 ACETONA A A 71 o HEADER ag 2 2 24 8 das a Roe a ee e ee 71 Ss boo unas ents A he eee ee Dee oes a E LI DESEES Str ctu rej s saa e ed wee a a wR bw ee GS a et BB ee ee ee ee 4 1 3 Storage Requirements o e eee A ad Eee E ee ee A E ee ar de ada ei ee ios a el ds e S AL IAEA lt a ida A a AAA A rr e e Gee ee 4 PAS E o ee a ee Be ee bee eae ate pa E bo acd BMC ECS HH MR A Ge A ra a 5 Physics and Numerical Methods AI oie ee Be Goa CR ee A AR OR OS OE Ree x 02 Particle Variables 4 5 2 4448 4464 224 4 2o8e SEHR ORES RA 52L Armoys lor Parla suo ce ae be bE ae eRe Des Description of Polarizados s sa s sarob a sa a a nei 53 Beam Parametarska ORES e Ra Oe wR Biase Wi A A ee es SD E 5 4 1 Equation of motion under DRIFT EXTERNAL command 5 4 2 Equation of motion under PUSH command Say bees Bok Se Be Ook pe ee eee ee ee Oe ee 5 5 1 Beamline Coordinate lt 6 4 ee css RR ee Diode _ Beamline coordinate lt lt s ss soara sra ee ad dnu ee Sas Dipole Magne e ea s rank a le A A A 5 54 Quadrupole Magnets s a sa socs 6 racco eo daa ao dad aaa SO ME ee oa a a aca a A 5 6 1 Luminosity Integration Algorithm Dage ei nodo aa a a a e E a
28. SigX the expression En gt 1e9 would be evaluated in place and give one single number 0 0 or 1 0 On the other hand the argument En gt 1e9 in SigX 1 2 En gt 1e9 does not mean one single value but is to be evaluated for each particle repeatedly This kind of expression may be called meta expression Note that SigX 1 2 En gt 1e9 can also be written as SigX 1 2 a if a is already defined by SET a En gt 1e9 There are other occurences of meta expressions although not enclosed by apostrophes such as the SELECT operand of many commands H and V operands of PLOT command etc These need not be enclosed by apostrophes because there is no fear of confusion The concept of meta expression is important in particular in optics matching When you define a magnet you have to distinguish between a parameter that is constant during matching and one that changes when the variables change The latter must be written as a meta expression i e a character variable or as a character string enclosed by apos trophes For example MAGNET QF L s K1 x 2 defines a magnet of length s and strength x using the current value of s and x but MAGNET QF L s K1l x 2 will change when s or x changes later CAIN evaluates expressions by a sort of an interpretator Since this is very slow a sort of compiler and loader is employed when a meta expression is to be evaluated many times e g repeated over particles
29. Syntax PLOT BBFIELD S s S s 52 FILE f file name APPEND 5 Define the s coordinate Plot for the slice which contains one of s s Upto 5 s s can be specified 67 3 24 6 Plot beamline optics Syntax PLOT BLOPTICS BEAMLINE name INTERPOLATE As FILE f filemame APPEND name Name of a defined beamline The apostrophes can be omitted The optics must be calculated by using BLOPTICS command in advance As Interpolate optics functions so that the step size lt As meter Other wise the values at magnet borders are linked by straight lines Caution You get an error message when you have not called the BLOPTICS command However if you changed magnet parameters and have not called the BLOPTICS command since then PLOT BLOPTICS command will will write down a wrong data without error message 3 24 7 Plot beamline geometry Syntax PLOT BLGEOMETRY BEAMLINE name TXYS to o Yo So E3 y s E1 Pg 1y 15 VHRATIO r MAGWIDTH w PAPER 0 0 FILTER f FILE f filemame APPEND name Name of a defined beamline The apostrophes can be omitted The optics must be calculated by using BLOPTICS command in advance to To Yo So Location of the beamline entrance in CAIN coordinate Actually to is CT y es Fi Piha not used but it is retained for uniformity and for possible future use Default is 0 0 0 0
30. The given numbers are those in the present version You can change them and re compile all the files MWLUM in include lumcom h Store differential luminosity 8xMWLUM 1 6MB MWLUM 200000 MTSTP in include tstpcm h Store the history of test particles MTSTP is the maximum number of the number of time steps times the number of test particles 100xMTSTP 0 5MB MTSTP 5000 The sum is about 30MB with defaults The size of the load module is about 0 8MB 4 1 4 Run All the input data have to be written in the directory cain242 in with file names having the extension i The file set sent to you may contain some example data The directory cain242 exec contains a csh script file go for execution It works only when the current directory is cain242 exec like make Note that make is always called from go so that you do not need make When you want to run CAIN with the input data example i for example you would say go example without i If you use the same input file as in the previous run go suffices TopDrawer output will be written on cain242 out example tdr OutFile on cain242 out example and OutFile2 on cain242 out example out2 If you want a submit job please write an approproate shell script by yourself TT 4 2 Windows Version You can get the binary module of CAIN for Windows from the ftp site ftp 1cdev kek jp pub Yokoya CainW zip It is confirmed to work on Windows 2000 and XP 4 2 1 Installa
31. This means some fraction outside the region is moved inside Therefore if the simple weight N N is assigned to macroparticles ig 1 the effective particle density would become slightly larger than the physical value although the sum of the weight is equal to N If one is interested in the quantities related to the density such as luminosities this would cause an overestimation When i 0 default a correction factor is multiplied to the weight such that the real particle density becomes correct In this case the sum of the macro particle weights is less than N When the default n s are adopted for example the correction of the weight amounts to 3 4 In most cases ig 0 will be better Figure 3 1 Physical a f E charge density dashed curve and the simulated N density solid for 0 _ EN od o and 1 i 0 i Uniform transverse distribution Default is Gaussian x y distribu tion is a uniform ellips with radii 20 20 where 0 Vebi j x y In this case the beam is parallel in spite the finite emittances are spec ified The emittance and beta are only used to define oz ALPHA and GCUT are not used Uniform t distribution Default is Gaussian The full length is 2 304 GCUTT is not used Uniform E distribution Default is Gaussian The full relative energy spread is 2 30 GCUTE is not used Angle offset radian The right and left going beams have the same sign of slope
32. UNIT n STATUS status NAME fname nf Logical file number No default status For OPEN one of NEW OLD SCRATCH UNKNOWN Default UNKNOWN For CLOSE one of KEEP DELETE Default KEEP Not used for REWIND and ENDFILE Need not be enclosed by apostrophes fname File name Used for OPEN only 3 27 HEADER Define the header for TopDrawer plots Effective until next HEADER command appears Syntax HEADER header string header string Character string Upto 120 characters Strings delimited by commas like string string2 are concatenated The case string for Top Drawer can be defined by using semicolon as delimiter like HEADER JLC EOCM1 500GeV X X aa If header string is not written the header is cleared 71 3 28 STORE and RESTORE Store restore the current variables or the luminosity data in from a file The latter is needed when you compute the luminosity in a run and print plot it in the next run Syntax STORE LUMINOSITY FILE f fname Syntax RESTORE LUMINOSITY FILE f fname LUMINOSITY Store restore luminosity data If not specified store restore variables fn Mame File unit number or file name When a file name is specified the file is opened with the unit number 98 and is closed after reading writing When the unit number is given no process of open and close is done If either is omitted the standard name stdstfl dat for vari
33. a minor effort would be enough please write to mailto kaoru yokoya kek jp When you execute make a line sysname with be shown on the monitor Please tell me the letters on the right hand side to identify your system There used to be system dependent subroutines for the date and the computing time They have been replaced by the standard FORTRAN subroutines DATE_AND_TIME and SYSTEM_CLOCK since CAIN2 35 76 4 1 3 Storage Requirements Dynamic allocation of FORTRAN90 has been used since CAIN2 2 for some of the very large arrays so that you can change the size in runtime See Sec 3 1 The array lengths changeable in runtime are MP Maximum number of macro particles including photons electrons positrons test particles right going and left going Actual maximum number is 90 of MP because 10 is reserved for newly created particles in one time step 192xMP 19 2MB default MP 100000 MVPH Maximum number of virtual photons in a time step in an s slice 80xMVPH 0 8MB default MVPH 10000 MMAG Maximum number of magnets of different types MBEAMLINE Maximum number of beamlines MBBXY Maximum number of bins in each of x and y for beam beam force calcula tion 88 xMBBXY 1 37MB default MBBXY 128 MLUMMESH Maximum number of bins in each of x and y for for luminosity calculation 152 x MLUMMESH 2 4MB default MLUMMESH 128 Other large arrays are given by parameter statements Major ones are the following
34. a piecewise linear function The sum of FINT k n NY 7 1 over n is stored in FALL k 7 l For a given initial condition calculate the parameters and A and find FALL by 2 dimensional interpolation The asterisk indicates the appropriate sum over the initial polarization i e FALL FALL 1 hzheFALLk 2 Then calculate the total probability P eq 5 111 times the time interval DT am At Eeff If this is larger than the value defined by PMAX operand of LASERQED command the time interval is subdivided such that P becomes less than PMAX Generate a uniform random number r in the interval 0 1 If r lt P decide to emit a photon and otherwise reject If rejected the helicity of the electron should be changed according to eq 5 12 to Renew iste 2 PP P Co x FALL k 1 2 5 119 If accepted decide how many laser photons to absorb To do so sum up FINT x n NY 7 from n 1 to n n until the sum becomes larger than r Then n will be the number of photons Once n is determined the photon energy is determined by f dy FF x r2 x FINT x 0 where ra is another uniform random number The left hand side is known for the mesh point of y 1 e FINT k n NY 7 l Since we approximate Fkn by a piecewise linear function of y the left hand side is a quadratic function between successive y s Thus inverse interpolation with respect to i by solving a quadratic equation gives the photon energy to be
35. after interaction The polarization change described in Sec is not taken into account e More than one event may be generated in one time step because the change of parent partciles after the first event need not be taken into account In contrast to ABEL CAIN does not assume the particles are ultra relativistic Therefore unless the beam beam field created by the pair particles becomes significant their trajectories are correctly calculated Note however that only the beam field due to the on coming beam is taken into account in the present version The beam field in the same beam may have significant effects on low energy particles Among the four QED processes above the Breit Wheeler process is treated as a funda mental process Others are reduced to the former or to the Compton process in the case of Bremsstrahlung by using the virtual photon approximation As for the polarization only the circular polarization of initial photons in the direct non virtual Breit Wheeler process is taken into account 5 11 1 Breit Wheeler Process The differential crosssection with respect to the scattering angle of the final electron in the center of mass frame is given by do T om p a o fh 5 168 with wW p 1 2m y A A eC 5 169 fo w2 prc 2 w pe we pc 2m fa E p 1 2 pe Pe 5 170 where w p Energy and momentum of final electron in the center of mass frame Cc Cosine of the scattering angle 0 of the f
36. beams go opposite direction right going and left going For the case they make a large angle you can apply CAIN command for Lorentz transformation so that the collision looks head on The lasers can go any direction As external fields the present version accepts only constant fields but since CAIN2 23 you can track a beam though a beamline consisting of magnets The physical processes that can be handled by the present version CAIN2 42 are e Classical interaction orbit deformation due to the Coulomb field e Luminosity between beams e7 et y e Synchrotron radiation by electrons positrons beamstrahlung and pair creation by high energy photons coherent pair creation due to the beam field Interaction of high energy photon or electron positron beams with laser field in cluding the nonlinear effects of the field strength e Classical and quantum interactions with a constant external field e Incoherent e e pair creation by photons electrons and positrons e Transport of charged particles through a magnetic beamline e In almost all interactions the polarization effects can be included Output data properties of particles luminosities etc can be written in specified files at any moment of job The graphic output is written only in the TopDrawer format If you want other formats you have to write a post processor by yourself 1 1 General Structure of Input Data In this section we briefly describe the structure of i
37. cannot be handled during the TRANSPORT ENDTRANSPORT loop You cannot nest the TRANSPORT ENDTRANSPORT and the PUSH ENDPUSH loops in each other The purpose of using a pair of commands TRANSPORT and ENDTRANSPORT rather than a single command is similar to the case of PUSH and ENDPUSH i e to allow user s action such as printing during the beamline transport The BEAMLINE command does not define the location and direction of the beamline as a whole You have to define them in TRANSPORT command Also you must define the momentum and charge of the reference particle which are needed in converting the bending angles focal lengths etc into the actual magnetic fields Syntax TRANSPORT BEAMLINE name TXYS to 2 0 Yo S0 gt El Eiz r Ely A 15 R E3 ezz 3y C35 MOMENTUM p0 CHARGE RIGHT LEFT KIND k k k2 LOSSMONITOR Syntax ENDTRANSPORT name The beamline name You may omit apostrophes to To Yo So Entrance of the beamline in CAIN coordinate m E1 E3 Unit vectors along the direction of the horizontal axis and the longitudi nal axis of the beamline at its entrance in CAIN coordinate Po Reference momentum in eV c 1 Sign of the charge of the reference particle RIGHT LEFT Apply to right or left going in Cain coordinate particles only If you do not specify this operand all the particles having opposite momentum with respect to the beamline direction E3 will be asigned lost
38. command expr is a mathematical expression described in Sec 2 5 An operand of the form a is a flag type operand The form b is exceptional It is used only when printing the value of a variable The right hand side of type c can be a character string for some operands The right hand side of type d can also be an array name If for example a is an array of length 2 kwd a is equivalent to kwd a 1 a 2 In some commands the first operand must be a positional operand of the flag type For example LASERQED command must be either LASERQED COMPTON or LASERQED BREITWHEELER In such a case the after the keyword may be omitted There is no ambiguity because keywords do not contain blanck characters in contrast to expressions FLAG command is special in that all the commas may be omitted because all the operands are type a The command names and the keywords can be shortened so long as unambiguos For example LASERQ is equivalent to LASERQED since the former can distinguish from LASER Now let us describe the each command in detail When describing the command formats in this manual the type faced characters are those to be typed in the input data as they are The variable names in the FORTRAN source also appear in type face The items embraced by square brackets may be omitted in some cases and the vertical stroke indicates an exclusive choice of one of the items Thus A B means to choose either o
39. do not interact with lasers and do not create particles such as beamstrahlung incoherent pair etc Therefore test photon does not make sense Coordinates and energy momentum of test particles can be refered to at any time by functions TestT etc See Sec 2 6 Syntax BEAM TESTPARTICLE NAME n name KIND k TXYS t xw y s P pz Py Ps SPIN S2 Sy 85 n name A test particle must have a name consisting of upto 3 characters The name left adjusted must be enclosed by a pair of apostrophes It can also be specified by an integer 99 lt n lt 999 which is converted to a decimal character string right adjusted Thus NAME 1 and NAME 1 is identical In the computer one character T is added at the top Thus NAME 999 becomes T999 k Particle specie trs Location of the test particle m Default is 0 0 0 Px Py Ps 3 momentum eV c ps must not be zero i e either right going or left going den dls 3 components of the spin Default is 0 0 0 3 5 5 Caution What is actually defined by the particle variables t x y s and E Pr Py ps is not a particle at a definite space time coordinate but rather is a straight trajectory a world line which passes the space time point t x y s At the time when the PUSH command is executed they are first pulled to the intercept on t to plane where ty is the starting time of the PUSH loop 33 When a BEAM command is inserte
40. emitted The helicities of the final photon and electron are calculated from hr Fon heF in sa atan 5 120 Fin F hpheFon he Fin Fon hi Fon pe 5 121 Fin T hrheFon for n n This is done by directly calling a Bessel function routine without using a table 5 8 3 3 Case of Linearly Polarized Lasers Transition Rate When the laser is linearly polarized by 100 the transition probability for unpolarized electron summed over final electron eo is Y i vd wv fo fon fin s fanta 5 122 m 2 w 2F2 108 Es The Stokes parameter of the final photon based on the polarization plane of the initial laser The azimuthal scattering angle 0 is the polarization plane of the initial laser The functions fin x o i 0 1 3 are given by AP 1 fon 2 1 g AMP AO A 5 123 T AD fin 3 1 08 sin 24 e sin AO AW 5 124 0 fon 1 20 sin An 42 AM ADAD 5 125 where A is defined by s do s 4_i n az sin a2g 2 sin 2 AN F cos pe A 2 s 0 1 2 5 126 T with arguments a a p ay e er gz ovate cos Q ea f 1 O r a ae kp kpj Al a amp a is the vector potential A with the phase factor e7 omitted The algorithm is more complicated than the circular polarization case because of one more variable but the method is similar 5 8 4 Breit Wheeler Process in a Strong Laser Field 5 8 4 1 Kinematics of
41. es Joos 0 0 1 sin d 0 cos 0 0 1 es Ja rolso 1 ro so ples so sin 0 1 cos 0 es so cos p y So sing 5 48 where sy is the entrance of the magnet To locate the beamline in the CAIN coordinate system we need ro and es y s at the entrance of the beamline These are specified in the TRANSPORT command not in BEAMLINE command by the operands TXYS E3 and E1 This information is not needed for the optics of the beamline 5 5 3 Dipole Magnets A dipole magnet is divided into three parts the leading edge the body sector bend and the trailing edge The edges are approximated by quadrupole magnets thin lens of inverse fo cal length k tane po e edge angle Since CAIN has to handle particles with a vast range of momentum even from a o few MeV to TeV simultaneously an exact solution is used for 7 the body Y Let us assume the body is defined by the horizontal bending angle 0 for the reference particle with mass mp and momentum po and the orbit length ly so that the curvature radius is p lp 07 Vertical bend is treated by coordinate rotation before and after 90 the magnet Suppose that a particle enters the body at t x y s with E pz py Ps ps gt 0 Let us define a tan p ps p V p O pE f sin a bo 7 po POPE bo sin o 2sin 5 cos 5 00 where is the sign of charge relative to the reference particle Then the partic
42. given field electron energy and time interval At Generate one random number p which is uniform in 0 1 1 2 3 If p gt po reject emitting a photon Otherwise 4 Generate one more random number y uniform in 0 1 5 Calculate G T y A polynomial approximation is used for K3y3 and Kis 3 The relative error is less than 1074 6 If p gt poG Y y reject emitting a photon Otherwise 7 Emit a photon whose energy is given by eq 5 148 The cases when accepted in 3 but rejected in 6 cause a waste of time because the calculation of G Y y is the most time consuming The probability to be accepted in 6 is plotted in Fig 5 9 is given by i G T y dy and is plotted as a function of Y One finds the probability is very high for any Y owing to the choice of the variable y 5 9 3 Polarization Polarization effects have been added since CAIN2 1 In order to describe polarizations let us introduce an orthonormal basis vector e1 s Here e is the unit vector along the initial electron velocity e the unit vector along the direction of the transverse component of acceleration and ez e xe If the acceleration is due to a transverse 7 This must be much smaller than 1 Otherwise the probability of emitting more than one photon during At cannot be ignored The maximum po is defined by the keyword PMAX When Y is very large po is suppressed by the factor 1 Y However in defining At by the num
43. hy Final photon helicity Regt Detector helicity of the final particles See section 65 of 3 The total transition rate is sum over he and h am 2 00 Ln W 5 f dx Fin hiheFon 5 111 The functions Fy are defined by 1 1 y Fin 3342 2 1 2 ee ei 112 In 2 Ja 2 21 En 5 La Jaya Ja 5 1 v v l v 2 _ 3 Pon y 11 1 v y Fan 14 eee 114 m Y le ea 5 114 v 1 lv 1 v 2 Fy 2 a E dl An 1 ie v E dJi 2 1 ai y Ja Jayi Ja 5 5 v 1 Fen Je 5 116 J s are Bessel functions with the argument z defined by B E v Y MA o i 5 117 Fin Fon F3n Fan are identical to Din Dan Nin Nin divided by 8 in Tsai s paperl 5 although the expressions in his paper look much more complicated Algorithm of Event Generation When the command LASERQED is invoked CAIN creates a table of the functions Fin and Fan They are three argument functions In the program A and y v v 0 lt y lt 1 are used as the independent variables instead of A x The functions Fy k 1 2 are stored in a 5 dimensional array FF k n i j l n 1 NPH 0 NY j 0 NXTI J 0 NLAMBDA The numbers NPH etc are specified by the LASERQED command The integral over y from 0 to y is stored in FINT k n 7 7 1 The integral over the full range 107 0 lt y lt 1 is then FINT k n NY 7 For integration the trapezondal rule is used which means the function Fx is approximated by
44. is O eee ere i e you need to add at the top of the file and at the end replace the last comma by to get complete MATHEMATICA list format RIGHT LEFT Write only either right going or left going particles Default both INCP Write particles created by incoherent processes defined by PPINT com mand Otherwise normal particles only If you want both execute the command twice LOST Write particles lost in beamlines See Sec 3 20 Only lost particles are written Otherwise lost particles are not written k Write only photon k 1 or electron k 2 or positron k 3 selectively Default all 59 tid Logical function for selecting particles e g SELECT X gt 0 will select particles with positive x coordinate See Sec for more detail 3 23 2 Write the beam statistics data Syntax PRINT STATISTICS INCP SHORT LONG LOST FILE f filemame APPEND STATISTICS Write beam global data such as number of particles r m s size etc SHORT Print only the number of macro and real particles If none of SHORT and LONG is specified print average and r m s of t y s and E pz Py Ps as well as the average spin components LONG Print max and min in addition to the standard items INCP Include incoherent particles only Otherwise normal particles only If you want both execute the command twice LOST Include particles lost in beamlines See Sec 3 20 Only lost particles are include
45. k and the magnet length l at t x y s with E Pr py Ps ps gt 0 the values at the exit are computed by o 7 T Pr Ps Y Py Ps sin 0 E sinh xp cos0x l 0 0 wy 7 sin x cos 8 a y 7 sinh Oy cosh 0 yl 7 l a7 y a Psf IFF y Prf T tPsf Pyf YfPsf where is the sign of charge relative to the reference particle tk gt 0 assumed The opposite case is obvious 5 6 Luminosity 5 6 1 Luminosity Integration Algorithm Let us denote the position velocity distribution function of j th beam j 1 2 at time t by 7 r v t It is normalized such that f jdrdv is the total number of particles in the j th beam The luminosity per crossing is in general given by L fv V1 V2 v1 XV2 N1 T V1 t r Vo t drdv dvodt 5 49 If all the particles in the j th beam are ultrarelativistic and have almost the same velocity vj v 1 then the expression is simplified as L 1 cos J ma r tm r t drat 5 50 where q is the polar angle between v and v2 and n r t f jdv is the number density of the j th beam CAIN uses this formula with 7 ignoring the velocity distribution and the crossing angle The integration is done by introducing the time step size At longitudinal slice width As transverse mesh size A and A Summing the number of particles in each bin the luminosity is given by L C YN ee Ne is ic Ao Ay A aos 5 51 ta sly sts tt where C i
46. kf kd MAGNET L L ldrift 53 MAGNET QFH L 1q Ki kf 2 MAGNET QDH L 1q Ki kd 2 BEAMLINE HALFCELL LINE QFH L QDH BEAMLINE CELL LINE HALFCELL HALFCELL MATCHING BEAMLINE CELL PERIODIC VARIABLE kf kd ZERO Nu 1 99 nu Nu 2 99 nu PRINT kf kd IF Convergence gt 1e 4 STOP ENDIF PRINT BLOPTICS BEAMLINE CELL The second argument of Nu should be larger than the number of magnets so that it is understood as the beamline end Caution and Tips e Don t forget to enclose the magnet parameters by apostrophes if they contain match ing variables See meta expression in Sec 3 16 As of CAIN2 3 only the length L and focal length K1 of magnets can contain matching variables When you allow a length of a magnet to vary you should impose the positive definite constraint by POSITIVE operand e The minimization procedure uses derivatives by difference of the constraint func tions assuming they are smooth So for example if you want to limit the maximum strength of a quad you should not write SET k 0 1 kmax 0 2 MAGNET QF K1 k MATCHING POSITIVE kmax Abs k but should write MATCHING POSITIVE kmax 2 k 2 or MATCHING POSITIVE kmax k kmax k e There is a problem in the constraint on phase advance common to all matching codes which can rigorously be defined only up to modulo 27 If you want
47. of a from n th charac ter start from 1 to n2 th character If na is omitted the end of a is used A null string is returned if na lt n Strstr a b searches for the first occurence of the string b within the string a and return the position of the first character start from 1 if found Return 0 0 if not found or if illegal zero length of b etc Get a string with all lower case characters converted to upper case SET b ToUpper a Get a string with all upper case characters converted to lower case 2 6 CAIN functions In addition to the predefined functions of general use such as Sin and Cos there are other special functions intrinsic to CAIN They are Beam statistics functions Average rms quantities of the beam such as SigX Test particle functions Retrieves parameters of individual test particles Beamline functions Twiss parameters etc Luminosity related functions Retrieves luminosity Laser related functions Local laser intensity etc Special functions Such as Bessel functions 2 6 1 Beam statistics functions The number of particles that of macro particles the average coordinates energy momentum polarizatio and their r m s values of the beam at the given moment are retrieved by NParticle NMacro AvrT AvrX AvrY AvrS SigT SigX SigY Sigs AvrEn AvrPx AvrPy AvrPs SigEn SigPx SigPy SigPs 18 AvrSx AvrSy AvrSs AvrXil AvrXi2 AvrXi3 Sigsx SigSy SigSs SigxXil Sigxi2 5igxi3 Bea
48. of initial photon and final positron electron by E Ey E E_ E and The transition rate is obtained by the following replacement in the formula 5 152 Ey En Ey gt E E E_ ENE gt E dE 1 2 Es En amp 2 E3 2 E 2 E SA Ta 5 159 ae aa a Ignoring the terms related to the polarization correlation between the final electron and positron we obtain omPdE E E E_ ao dW x 4 Fop K p Ken C 4 3n E l CP 2 363 2E E 2 3 C C_ amp 2 E E En P K 3 2 Se at Ky3 e1 amp 1 2 amp 3 Fe at s 100 where Fop is defined as E E Fop Ki Kays 5 161 CP 1 3 E ES 2 3 K is the modified Bessel function and Ki is defined in eq 5 147 Their arguments are n defined in eq 5 159 The transition rate summed over the final polarization is 5 a OP Esla 5 162 M Yy The function Fop K 3 s is plotted in Fig 5 10 as a function of E E The function Fop is available as a CAIN function FuncCP and its integral over 0 lt E E lt 1 as IntFCP See Sec 2 6 5 10 2 Algorithm of event generation The total rate for given is approximately Y NAAA pm X _ amp 3X did gt Ut e ch y 3a 5c2 3x 1 3 fs 103 16 2 oman l 2 5 323 6 60 117 Figure 5 10 Function Fop Ko 3 amp 3 for three val ues of y The solid dot dash and dashed curves are for amp 0 1 1
49. process and the Bremsstrahlung to the Compton process Bethe Heitler yY gt oe et Landau Lifshitz Y fy gt 7 et Bremsstrahlung e y oe y where y is a virtual photon Let the electron energy be E my y gt 1 The number of virtual photons with energy w and transverse momentum q is given by adw 1 qidq dn S 5 176 na ee la 1 Sm 5 176 where a is the fine structure constant For given w the typical transverse momentum is very small q w y so that it is not important in collision kinematics but instead the finite transverse extent 1 q can bring about significant effects In the transverse configuration space the above expression becomes ex a dw eer dr z1 5 177 ER 02 1 m 5 177 where r is the transverse coordinate with respect to the parent electron p r and K the modified Bessel function The transverse momentum cut off q S m or p Z 1 m is somewhat umbiguous It should depend on the momentum transfer of the whole process This dependence is ignored in CAIN because the virtual photons are generated independently from the following processes and because it does not much affect the low energy pairs The lower limit wmin of the integration over w is in our case determined by the pair creation threshold Let us introduce dimensionless variables y w E Ymin Wmin E 122 and z wp y The total number of the virtual photons is given by a fi dy f a es Ki x 2xdx 5 178
50. rmar and Cmar lt C lt Cmax A table will be created only in this region So time consuming if unnecessarily large 3 6 4 File format Syntax FILE f file name SHIFTT Ar SHIFTZ AC ZMAX C a fn file name Unit number or name of an existing file which describe the laser field profile For the differece between the two forms See Sec 2 8 See below Sec 3 6 4 for the file format AT Al Add to the coordinate data 7 of the file Crag Range of field Cmar lt lt max to extend the file data Needed only for ORDER XY see below The file must be written in the following format e When a character appears in a line the rest of the line is considered as a comment e The first non comment line must be ORDER a where a is a combination of characters L X Y Z R These characters mean that the following table specifies the dependence of the power density on T L X n Y Z VE n R The possible combinations are L Er XYZ Pee 37 RZ Fs r LXYZ F T B 4 E n LRZ F t r or their permutation of characters The number of characters is the dimension of the table The order of the characters specify the nesting order in the table For example RZ implies the FORTRAN order F IR 1IZ IR 1 M 1Z 1 N For the case L the spatial profile F is expected to be given in other place operands of LASER command or another ORDER in the
51. spread in the laser frequency In other words the number of oscillations of the laser field felt by an electron is finite This effect is not included e When the Rayleigh length is not very long compared with the wavelength the laser wave front has a curvature This is included only approximately by n as in eq 5 84 Laser field is treated locally as a plane wave 5 8 1 3 Donuts shaped Laser Beam One can create a donuts shaped beam i e low intensity near the axis by using the so called axicon mirror lens depicted in Fig 5 5 If the field at the entrance of the axicon is given by Gore 0 the field after axicon is given by 7 P r Gs T m lA F r where A eee Pep CA krp PO ep Linea pip dave Drew el AE 100 lt gt Figure 5 5 Geometry of axicon Integration over the transverse plane const gives J F r 2rrdr 2105 1 eo 208 Note that in the absense of the axicon b 0 a 00 2 IF r 0 OS am ct lis E a r C kao ee 2 Rayleigh length E At 4 5 8 1 4 Laser field propagation in vaccuum CAIN accepts the laser field profile wiriiten in a file See Sec 3 6 4 In the special case ORDER XY instead of specifying 3 dimensional data at 7 one can specify only the 2 dimensional data at 7 on the plane 0 Assuming the propagation of a perfectly coherent beam in free vaccuum CAIN can extend the data to 3 dimensional space W
52. the same algorithm of generating the photon energy can be used G T y is slightly larger when 2 1 but still G T y lt 1 For the given radiation energy E xEo the polarizations of the final electron and photon are calculated by the prescription described in Sec 5 2 2 Thus ae Ki K Cr Fo ne aa 1 3 2 ev Si er 4 8 e C e 2 3 fs 159 115 _ T K 3 x 2 2 K3y3 _ Kaj3 TaK usler gi so l z Fo 2 1 x Fo Fo In the case when the event generation is rejected the polarization of the electron must be changed according to eq 5 12 am Cs Gi e2 ertt f In storage rings the electron polarization builds up slowly along the direction of the magnetic field This effect comes from the difference between the coefficient of and see eq 5 14 61 ergy s e i E3 xK ja z dz 5 156 q Kijg 1K13 ig e re a Toys 5 157 When Y is small 10 in storage rings each term on the left hand side is proportional to Y whereas the right hand side is Y because of cancellation CAIN cannot reproduce such slow buildup even if the computing time allows because the approximate polyno mials adopted do not have that accuracy They are enough however for beam beam problems 5 9 4 Enhancement factor of the event rate CAIN normally produces macro photons such that the expected number of macro photons per macro electron i
53. to set the phase advance 27 at QF to be 0 2 for example you can write ZERO Nu 1 QF 0 2 If this does not work try either ZERO Cos 2 Pi Nu 1 QF Cos 2 Pix 0 2 or ZERO Sin 2 Pi Nu 1 QF Sin 2 Pix 0 2 depending on the region of the phase e CAIN tries to minimize X f 0 g g 0 step function The expressions in ZERO and POSITIVE should properly be weighted e MATCHING stops when the beamline is unstable during matching in the case of PERIODIC This problem may be solved by the following way though much more tedius SET bx 1 by 1 ax 0 ay 0 54 MATCHING BEAMLINE VARIABLE bx by ax ay BETA bx by ALPHA ax ay ZERO Beta 1 99 bx Beta 2 99 by Alpha 1 99 ax Alpha 2 99 ay n and 7 are omitted in this example Don t forget to enclose expression in BETA and ALPHA 3 20 TRANSPORT ENDTRANSPORT PUSH ENDPUSH loop can track the particles under various interactions but it is not conve nient for tracking the individual particle motion in magnetic beamlines DRIFT EXTERNAL command can do this but is very limited TRANSPORT ENDTRANSPORT loop is to be used in such a case It tracks particles with the orbit length variable s as the independent variable as in most accelerator tracking codes in contrast to PUSH ENDPUSH loop where the time t is used as the independent variable However the interactions between particles the interactions with lasers etc
54. to specify spatial profile F n C of the pulse This includes RAYLEIGH GCUT and TDL DONUT and those specifying the donut shape d Parameters for file reading data You can specify b and or c by a file defined by the FILE operand The parameters FILE SHIFTT and SHIFTZ belong to this category The laser profile is determined in the following order 1 FILE operand has the highest priority If time or space profile is missing in the file it is expected to be given by the command parameters of the category b or c 2 The time profile if not given in the file can be Gaussian or trapezoidal according to whether SIGT or TTOT operand is specified 3 The spatial profile if not given in the file is donut shape if DONUT operand is given otherwise Gaussian The laser power density P is a function of 7 7 It is written as P 7 amp 7 6 Poo X Flr C x F E n C 3 1 34 Poo is given in the category a F in b and F in c It is also possible to specify F x F by a file as a 4 argument function The flush energy observed at const is A P r 0 dr edgdn Poo x F t Gdl 6 ex Fe E n 6 d dn 32 Care must be taken for the unit system P must be given in Watt m 3 6 1 General laser parameters Syntax LASER RI GHT LEFT 4 WAVELENGTH A 1 POWERDENSITY Pb0 TXYS t y s E3 e a El e e e STOKES 2 3 PLOTPROFILE TPROFILE Tpror
55. v v zx 1 zx x v 1 v 0 lt v lt du 1 v dz ta Maximum v for given n Un n 1 En Maximum z for given n n Un 1 Un nA 1 E nA Ear 9 E Aur is the effective energy of initial electron in the laser field 3 Lorentz invariant variable defined by o yi are are 1 5 106 x The photon scattering angle 0 0 for backward in the head on frame can be written as 6 mO E Once x and n are given the final momentuma are given in the head on frame by 2 2 k xp a ts J k mx0 ef cos ef sin 5 107 p p E gt k 5 108 kl z Here el is a spatial vector perpendicular to p and to k and e is defined by Vn B p EuvaBe1P kr 0 5 109 kr ii a where P is the completely anti symmetric tensor 6028 1 is the azimuthal scattering angle in the head on frame its distribution is uniform in 0 27 for circularly polarized laser The direction of ef is arbitrary so long as perpendicular to p For convenience we choose the polarization plane of the laser for the case of linear polarization 106 5 8 3 2 Case of Circularly Polarized Lasers Transition rate The transition rate per unit time is given by 2 2 00 W y f de 1 he e Fin hr he e Fin hehe Fsn hy hr Fon heFm 5 110 qo n 1 9 hr Laser helicity 1 or 1 hahe Initial and final electron helicities 1 lt he lt 1
56. when there is a crossing angle Default 0 0 Crab angle Ox y Ot radian Positive when the bunch tail has larger x y When the full crossing angle in the horizontal plane is cross and this is to be compensated by the crab angle the SLOPE and CRAB parameters should be SLOPE 0 ross 2 CRAB Qcross 2 for both right going and left going beams If you are not confident after beam definition try for example DRIFT T t0 dt PLOT SCAT H S V X 28 Ma Ny Met de dt Dag HSCALE smin smax VSCALE xmin xmax HTITLE 5 m VTITLE X m 3 DRIFT T t0 PLOT SCAT NONEWPAGE H S V X HSCALE smin smax VSCALE xmin xmax DRIFT T t0 dt PLOT SCAT NONEWPAGE H S V X HSCALE smin smax VSCALE xmin xmax with appropriate definitions of t0 smin etc The DRIFT command trans ports the beam to the plane t constant snap shot NONEWPAGE operand suppresses page break so that the s x profiles at different times appear on the same page Eta function m Derivative of eta function Coherent energy slope from bunch head to tail 1 m Roll angle of the beam in the z y plane radian da de da de Energy dependence of a dimension less This defines the energy dependence of the focal point The focal point in the z y plane for par ticles with relative energy deviation e is given by B y X dazy de pos itive if focused beyond the normal focal point This operand together with the coherent energy slope de
57. whose values are determined by the program Users cannot change their values but can refer to These variables have definte meanings only under certain situations For example Time makes sense in the PUSH ENDPUSH loop PrevMag in the TRANSPORT ENDTRANSPORT loop etc Those from T to Incp refer to each particle and therefore have definte meanings only in loop statements over particles for example in defining the axes for plots Time TA Running variables for global time coordinate m Makes sense only inside PUSH ENDPUSH loop Running variables for particle coordinate m En Px Py Ps Running variables for energy momentum eV eV c The energy Sx Sy Ss is En but not E Electron positron spin Helicity may be written approximately as Ss Sgn Ps Xi1 Xi2 Xi3 Photon Stokes parameters 1 2 3 Kind Gen Wgt Incp PName Particle species 1 2 3 for photon electron positron Particle generation Particle weight One macro particle represents Wgt real particles 1 if the particle is created by an incoherent process Otherwise 0 Particle name 4 bytes Normally blanck The first character is T for test particles I for incoherent particles IBW IBH ILL IBR for incoherent particles created by Breit Wheeler Bethe Heitler Landau Lifshitz Bremsstrahlung processes respec tively LOST for lost particles 14 Ln Lij W Sbl PrevMag NextMag n 0 1 2
58. with the operand names e g L is understood as the abbreviation of LENGTH 50 At present the following cannot be included e Combined function bends e Skew quads can be used in tracking by TRANSPORT command but the BLOPTICS cannot handle them e Errors of magnets e Higher multipoles e RF components An element with all zero parameters is possible It may be used as a marker The maximum number of magnets is defined by the parameter MMAG in the ALLOCATE command The default is 200 Meta expression The length l and gradient k can be a meta expression see Sec 2 7 It is re evaluated when the parameter changes For example SET k 0 1 MAGNET QFH K1 k 2 will set the parameter K1 to be 0 05 but in the case SET k 0 1 MAGNET QFH K1 k 2 the expression k 2 itself is stored with its initial value 0 05 and is re evaluated when k changes for example during matching You can also write if you want as SET qfh k 2 k 0 1 MAGNET QFH Ki qfh 3 17 BEAMLINE Defines a beamline consisting of magnets To use a beamline see TRANSPORT command Sec 3 20 To calculate the optics see BLOPTICS command Sec 3 18 Syntax BEAMLINE name LINE name name name APERTURE a siy name Beamline name Same rule as the magnet naming rule Must be enclosed by apostrophes General form of character expression not accepted Re defined if already exists You cannot elim
59. 111 NE 211 Mp 211 Nc 211 or for ORDER RZ or ORDER LRZ N Nr 111 N 111 Nr 211 Nc 211 If N does not appear n 0 0 1 is used which means parallel propagation along E3 vector Then ORDER can appear again to define other dependences For example the first ORDER defines F 7 and the second defines F r C Of course there can be only one ORDER if it defines F T n C or defines F r C r C 38 Special case of 2D file input Theoretically it is possible to extend a 2D data given on 7 plane at constant to 3D region 7 using the Maxwell equation See Sec for the method CAIN does this provided e Complex phase data in addition to the intensity is given e Propagation in vaccuum e Perfectly coherent beam e The focal points in the and 7 planes are close to each other within the Rayleigh length and close to the point where the 2D data is given This condition is only to avoid programming complication The file format in this case is the following ORDER XY X 1 E2 Ne Y M1 N2 Ny PFAC Cp FFAC co P Pi Pa P31 F 011 Q21 31 e The temporal profile is expected to be given in other place operands of LASER command or ORDER L in the same file e The file data is assumed to be given on the plane 0 If not you can use the operand SHIFTZ in LASER command e To create a 3D table in 7 plane the range of must be specified This has t
60. 14 and 15 in the figure on the left corresponds to the bin 3 on the right Otherwise add N Oy 2 into the luminosity sum This doubling of the bin size is repeated so long as NO lt Nmin In order to make this algorithm efficient the bin numbering system is a little complicated Instead of using two indices i iy the bins are numbered as in Fig 5 2 With this numbering the sum of neighbouring bins can be simply written as n n n n n 2 Nik Napa Nik 2 Nik 3 No 5 52 where N is the number of particles in the k th bin k 0 1 2 n2 1 inn x n bin system 5 6 2 Polarization In the present version of CAIN the particles are either photon or electron or positron They all have two polarization eigenstates and can be specified by three real numbers the Stokes parameter 1 2 3 for photons or the polarization vector y Gs for elec trons positrons Let us denote the three numbers in general by s s1 52 3 Then the crossection of a particular interaction integrated over a given final state energy momentum and polarization is in general written in the form 3 o Y oys PsP 5 53 i j 0 where R and L represent the right and left going particles and s 1 for notational convenience 93 The number of events N during a beam collision is obtained by integrating eq 5 53 with an appropriate factor over the momentum the interaction volume and time N J dr dt dp dpa f 5 54 where f i
61. 2 N Each of these is a unit vector 1 and the average over the ensemble is Cia Let us arbitrarily take the quatization axis e The probability in the state e is 1 e 2 and the non transition probability is 1 w f e At Therefore the sum of the final polarization along e over the ensemble is 1 eCia LO 9 Lt wt feJAl 2 leCia l wAt feAt Ner Ci 1 wAt 2 Q The axis e is arbitrary Therefore the sum of the final polarization vector is given by the above expression with e taken away The total number of particles without transition is N l w f C At Thus the final polarization vector is _ 1 wAt fAt Cno trans w F Ci At 5 12 The average final polarization over the whole ensemble with and without transition is then given by E 1 w FCAT AN F J arwr P FU CJAt a Ce lg f w GA 5 13 If one can ignore the change of energy momentum during the transition the evolution of the polarization is described by the differential equation dg 9 fe HE 5 14 Polarization effects included in CAIN The present version of CAIN does not include all the polarization effects The following table shows what effects are included In any case the correlation of polarization between final particles is not taken into account 84 fAt initiale laser finale final y Beamstrahlung e e y LT
62. 2 Sine y 40 0 il Fly Es 2 0 0 T T T T T T T T T T T T T T T T T T 0 0 0 2 0 4 0 6 0 8 1 0 7 Compute the final polarization of e from 1 1 Fop Ko 3 amp C q A1 3 2 Kult 3 F2 3 48r1 66 E 2x 1 2 The formula for _ is obtained by replacing x by 1 zx 8 In the case of rejection the polarization of the photon should be changed according to eq E1 fin 1 a31 bo fin 7 a amp 3 amp o E3 fin E a 1 El 5 167 am At x 2 1 d a dz V3rE Jo 2 3 3y x 1 zr The error of the formula 5 163 does not cause any inaccuracy of event generation but causes inefficiency 5 11 Incoherent Processes In addition to the interactions between a particle and a macro scopic field such as beam strahlung and laser Compton there are particle particle interactions between e e and y that have to be simulated The present version of CAIN include the following processes Breit Wheeler y tyre tet Bethe Heitler yte et e et Landau Lifshitz e e gt e e e e Bremsstrahlung e e gt e e y 119 These QED processes have relatively large event rates even at high energies The treatment of these incoherent processes in CAIN is slightly different from other coherent processes since the event rates of the former are usually much smaller than the latter e The parent macro particles are not eliminated nor changed
63. 34 48 time coordinate t TMatTMat transfer matrix TRANSPORT transverse mesh 44 92 Twiss parameter 20 uniform distribution user defined parameter 15 26 velocity of light virtual photon 122 Weizacker Williams approximation 122 WRITE zero padding 172
64. 5 79 _ F F exp 202 5 80 1 E n F exp a 5 81 Lo oa with AL CG Here 6 i 1 2 is the Rayleigh length and o is the r m s pulse length The dilatation factor d is introduced for later use The wave front is given by the contour of k If one defines n by kn V k 8 n is nearly a unit vector and approximated by eS ce ce n 5 83 Jl ci c a G aeae O TRA Tn earlier versions of the manual the function F As used to include the factor 1 Vd1d2 This was a mistake of the manual The factor is included in the definition of Poo specified by the input data POWERDENSITY 99 In CAIN when the relevant particle is at t x y s or at 7 7 in laser coor dinate the laser field is considered to be locally a plane wave with the power density A t amp 7 Poo wave number k and the propagation direction n n There is some problem on the polarization because eq 5 78 does not exactly satisfy the Maxwell equation For simplicity the basis e e e e n for polariza tion is defined in the following manner e is the unit vector along e eV n n and e n xe This is irrelevant if only the longitudinal polarization is needed The r m s beam size at the position is given by eq 5 82 where the dilatation factor d is included To satisfy the Maxwell equation d must be unity but actual high power lasers may not sat
65. Error if n lt 0 or n is larger than the number of bins LumWH k k h Differential helicity luminosity cm sec bin LumWP k ki n 51 52 Differential polarization luminosity 0 lt s lt 3 0 lt s2 lt 3 See Sec 5 6 2 for definition cm sec bin LumEE k kini no 2 D differential luminosity d dE dE for the bin n n2 cm sec bin LumEEbin k k 1 n Bin center eV of the n th bin of E l 1 or Ez 1 2 If n 0 the number of bins is returned Error if n lt 0 or n is larger than the number of bins LumEEbinEdge k k l n Bin edge of the n th bin of E l 1 or Ez l 2 See LumWbinEdge for the definition of n LumEEH k k n1 n2 h 2 D differential helicity luminosity 45 LumEEP k k n1 n2 51 582 2 D differential polarization luminosity These functions can be included in expressions Thus you can write the computed lumi nosity on a file In particular the only way to retrieve the 2 D luminosity d dE dE is to use the above functions because PLOT LUMINOSITY command cannot plot it KEK TopDrawer cannot draw 3 D plot So for example to write e e luminosity say SET mi LumEEbin 2 3 1 0 m2 LumEEbin 2 3 2 0 WRITE LumEE 2 3 n1 n2 n1 1 m1 n2 1 m2 FORMAT If you are satisfied with a pre defined format you can use PRINT WRITE LUMINOSITY command 3 12 PPINT Incoherent particle particle interaction such as incoherent pair creation and brem
66. G3 are even functions of y only the part y gt 0 is tabulated The mesh for q cannot be equally spaced Select q s such that all the threshold points 1 n Nn Amin Nmin L NPH Nmin integer part of 1 ETAMAX are included that q are equally spaced between successive thresholds and that the spaces are not very diffrent Thus the total number of q s may not exactly equal to NQ 111 The functions stored in the array GG k n i 7 1 are Gi k 1 and G3 k 2 The integral GINT k n 2 7 1 is calculated as in the Compton case The sum of GINT k n NY j over n does not make sense because the result would be a quite discontinuos function of and q which makes the interpolation inaccurate However for given q the sum from n n q to NPH is continuous where n q is the minimum integer which does not exceed 1 q Thus the sum over n n to NPH is stored in GALL k n j I For given initial condition calculate and q Then interpolate GALL k n q 7 l for j and l and calculate the total probability P by summing for appropriate polarization 2 2At PLO Lens CEH ei pO eat W If this is larger than the value defined by PMAX operand of LASERQED command the time interval is subdivided such that P becomes less than PMAX Generate a uniform random number r and reject an event if r gt P In this case the helicity of the photon should change to ha 1 Pr bP hy new p P Co x GALL k 1 2 5 142 If r
67. LOPE de dt XYROLL 0 DALPHADE da de da de DALPHADT da dt da dt SPINS Co byte Aj RIGHT LEFT Specify whether the beam is right going or left going k Particle species 1 for photon 2 for electron 3 for positron If you cannot remember these codes you can do SET photon 1 electron 2 positron 3 BEAM RIGHT KIND electron N Number of real particles Ny Number of macro particles Eo Beam energy eV t x y 8 Location of the reference point and the time when the beam center comes there In units of meter This is the point where the Twiss parameters are to be defined Default 0 0 0 0 Bus By Beta functions m Oy hy Alpha functions Default 0 0 The sign of a is positive when the beam is going to be focused regardless the beam is right going or left going Ex Ey R m s geometric emittance rad m Deafault 0 0 0 R m s bunch length m Default 0 Te Relative r m s energy spread Default 0 Ng Ny Nt Ne Gaussian tail cutoff in units of corresponding sigmas The default values are 3 for ny and ny n and ne For transverse variables the cut off is done in the action variable which means J lt n 2 i x y 21 ELLIPTIC TUNIFORM EUNIFORM Oas Oy Ya Vy O or 1 There is a subtle problem on how to take into account the Gaussian cut off nz ny nz in the macro particle weight CAIN throws away the random numbers outside this range and generates exactly Np macro particles
68. LOPTICS BMT equation 82 87 130 Breit Wheeler process 40 120 CAIN function CFQED 12 character expression 16 classical electron radius CLEAR coherent pair creation coherent pair creation clear 71 command 11 24 comment compilation of CAIN Compton scattering Compton wavelength 14 Cos 15 169 Cosh FuncCP crab angle crossing angle dagger t Gamma 15 generation DBesJ harmonic expansion 97 DBesK HEADER 71 Debug 15 helicity DEBUGFLAG 73 IF 58 differential luminosity mooki pair creation 46 directory of CAIN file incoherent pair creation clear DO incoherent processes 119 donut 34 37 installation of CAIN donuts 100 Int 15 DRIFT IntFCP 22 117 ECHO 25 Landau Lifshitz 122 elliptic coordinate LASER 34 49 elliptic distribution LASER clear 70 laser geometry laser propagation 101 ELSE ELSETF emittance 27 85 LaserIntensity END LASERQED 39 ENDDO LASERQED clear 70 endfile LaserRange ENDIF 58 Log ENDPUSH 47 log scale 64 67 ENDTRANSPORT 55 Log10 15 enhancement of event rate 41 47 longitudinal coordinate s equivalent photon approximation 122 longitudinal mesh Eta LORENTZ 31 49 Etaprime 20 Lorentz transformation 49 Exp 15 Lum 21 expression LumEE 21 EXTERNALFIELD LumEEbin EXTERNALFIELD clear LumEEbinEdge fast Fourier tr
69. Maximum value of A for the table Applies to Compton case only Maximum value of 7 for the table Applies to Breit Wheeler case only Maximum probability of events in one step When the probalility of events in the time step specified by PUSH command for a particle CAIN temporarily subdivides the time interval for the particle such that the probality is less than 40 Pmas Default is Pmaz 0 52 Pstop Maximum probability of events per one time step specified by PUSH command If the computed probability exceeds Pstop CAIN stops with a message Default iS Pstop 100 It is not recommended to define too large a value because the possible events by the new particles within the same time step are ignored This operand was introduced since cain2 42 fenn Defines a function in order to artificially enhance the event rate You can enhance a part of spectrum It is defined as an expression containing Y as the final energy parameter 0 lt Y lt 1 Its value must be gt 1 for all Y Generally speaking Y close to 1 generates low energy charged particles For example ENH 1 Step Y 0 8 Y 0 8 10 will enhance the events with Y gt 0 8 by a factor upto 3 at Y 1 In the program the real spectrum function is multiplied by fenn and when an event is generated the created particles are asigned a weight 1 fenn B This function is used only during the initialization by LASERQED command Therefore if the expression contains user defined paramet
70. RCREATION Specifies which parameters to define here Only one of these may be specified by one CFQED command POLARIZATION Flag to take into account all the polarization effect default No Pmazx Wenh Note that the flag SPIN FLAG command must also be on for polarization calculation Maximum probability of events per one time step Default 0 1 When the probability exceeds Pmax CAIN stops with a message This has been improved for PAIRCREATION after CAIN2 1e by dividing the time step into substeps so that the probability in a substep does not exceed Pmaz Enhancement factor of radiation rate 0 lt Wenn When Wenn 1 default macro photons are created such that nmacroy Nmacroe Nrealy Nreale When Wenn gt 1 lt 1 macro photons are created more less by the factor Wenn each having less more weight When Wenn 0 no photon is created but the recoil of electron is taken into account This operand is introduced in order to avoid poor statistics due to too less macro photons or memory overflow due to too many macro photons See Sec 5 9 and Sec 5 10l for the formulas and algorithm and for more detail on the enhancement factor 42 3 9 BBFIELD Define the parameters for the calculation of beam beam field Syntax BBFIELD R r Wri Wr2 Waim1Wxm2 May Nemom WX Wz1 WX We Wa WXMAX Wami WXMAX A Wena INX n NY n PSIZE A NMOM rmoms Horizontal width of t
71. RITE and PRINT is the default destination which is OutFile for WRITE and MsgFile for PRINT Therefore they are identical if FILE 58 operand is specified Another difference is that errors in reading the command cause abnormal termination for WRITE whereas the command is ignored for PRINT Following is the list of possible forms of WRITE commands WRITE can be replaced by PRINT WRITE BEAM Write individual data of the particles Sec 3 23 1 WRITE STATISTICS Write statistical data of the beam e g beam size Sec 3 23 2 WRITE LUMINOSITY Write luminosity already computed Sec 3 23 3 WRITE MAGNETS Write list of defined magnets Sec WRITE BLOPTICS Write linear optics of a beamline Sec 3 23 5 WRITE BLGEOMETRY Write the geometry of a beamline Sec 3 23 6 WRITE PARAMETER Write values of expressions Sec 3 23 7 WRITE ARRAY Write list of allocated arrays Sec 3 23 8 WRITE CPUTIME Write the cpu time Sec 3 23 9 3 23 1 Write the macro particle data Syntax WRITE BEAM FILE f filemame APPEND SHORT MATHEMATICA RIGHT LEFT KIND k INCP LOST SELECT f 1 BEAM Write beam data fn file name APPEND Unit number or name of an old or new file For the differece between the two forms See Sec 2 8 SHORT Short format which may fits to a monitor screen METHEMATICA MATHEMATICA list style format Use standard format see Sec 3 5 if none of the above two are specified Caution The list style in the output file
72. TAMAX Nmax PMAX Pmaw gt PSTOP Pstop ENHANCEFUNCTION fenns LENHANCE lenn COMPTON BREITWHEELER Specifies which parameters to define here CIRCULARPOL LINEARPOL Polarization of laser Needed for np gt 1 only Elliptic a RA Eman Aras maz Pmax polarization is not ready when nonlinear effects are needed As of CAIN2 42 Breit Wheeler process with linear polarization is not ready Also note that the electron spin is ignored for linear polarization case Default is circular polarization Maximum number of laser photons to be absorbed in one process If lt 0 turn off Compton or Breit Wheeler If 0 use linear Compton Breit Wheeler formula If gt 1 use nonlinear formula Note that ny 0 and npa 1 are different The former is the limit of 0 which contains np 1 term only whereas the latter is a truncation of the exact series with respect to npn When np 0 none of the variables ny ne NA Ng Emas many Now are needed When npa gt 1 only longitudinal polarization is considered and the lasers must be circularly polarized by 100 i e amp 0 1 Number of abscissa for final energy Default 20 Number of abscissa for parameter Default 20 Number of abscissa for A parameter Applies to Compton case only De fault 20 Number of abscissa for g parameter Applies tp Breit Wheeler case only De fault 50 Maximum value of for the table
73. User s Manual of CAIN Version 2 42 Jun 27 2011 TeXed on June 27 2011 Contents 1 Introduction II General Structure al Input Data xicos os oa whee A 2 Basic Grammer of the Input Data 21 System ol Wes wa oe we eee oe De ee aE ewe Eee Se 22 AI so x eS Se KS ee A AA ww ESR a 2 3 File Lines and Command Blocks gt roes s roda dedci heri e dri ZA Command ea sabad e bode ewe 4 e eae e e a he Bho hae BR a 2 9 EXpressionS e e ieg a AA RA we Gey ARM 6 poa a A ee A Se a EOE REEDS RED 2 0 2 Predefined parameters lt o 6b gt lt eb eee oa e 2 5 3 User defined parameters 0 o 00024 e 2 5 4 Predefined functions e s s ecoa 2 e e ee es ce oe eh ok oe SE See AA A Deen Pepe feuds pte as a gots a oe 26 CAIN functions s os s sa iarr aies Kip a ee a 2 6 1 Beam statistics functions e 260 2 Test panicle UNEO aa AAA 2 6 3 Beamline functions 2 6 4 Luminosity related function 0 2 ee ee ee 2 6 5 Laser related function coc 2 ds ass E AR NE AN E III AO AI 3 Commands 21 ALLOCATE sd A We e a Boe ee ae Ge a AO 32 a alee af eB we A wh ak eR a Re OE BO dW Hl Stl Se ee Ee ea Se ere ws fede Sot eink e a Es ss Eee A Oe i Oe ed Be oS Er ee Sk we SGD EE ER we REA BO a oe a a ee ee eee ee ee SG 3 5 1 Definition by Twiss parameters o A AN e 35 3 ingle Particle se esac emad ARA 3 5 4 Test particles cs p a nice ee ee ee a ee eee
74. a A oo on ae ke ee BA PR AG Sot ab Be eh ees 33 0 LASER lt 4 coe doi Ao ed BOOS Bah Ra SRR ene GE ee A 34 by eee he eS oO AAA 35 kh oes PAL aces Rm hae hee ae i 36 A RIOR a RAKE OR HOR AA 36 364A File Dra as he kk we Ee ee ee ee he ORR Cees 37 3 6 5 Laser related CAIN functions o 39 3 LA EROED ccecce oa HOR aS a OR we ace A Ga eS a a 39 B GEDED e Goce e a Ha a BH Oh a A ae a A eR a Ae a i 42 J BEPIELD 406 2 fd ale da aie a ER A ee ee ee 43 9 10 EXTERNALEIELD oo ee we we aa 43 SE TUMINJSITTI aia ii ed he oo A wee da a a 44 APA ee os eh ee BS He SH Bees ee 46 Oto PUSH ENDPUGHL codos 2 Sack eek ee ea be eae be be eee 47 a aa aaa a o 48 AS LORENTZ o aaa aaa a a e a in a bn ae d 49 AO MAGNET desa a A 50 AAA E e a i Gea we a See wa a 51 A sor eea i e Da NR 52 A aea ee A A AR A A ee ee ee a 52 NA AE E 55 3 21 DO CYCLE EXIT ENDDO 2 rara ee ee 57 BOD IF ELSEIF ELSE ENDIF oe iin oboe Sk awe LR a 58 ceo WRITE PRONG ce va Soe BLP a ee A ASE aR Rw A ew A ee a 58 ao ee a ete ee Dik kaha ie eo 59 oe bee we kang wk oe ek E 4 60 3 23 3 Write the calculated luminosity 65 46 64 ee eee es 60 i ie Ors He Gr A 60 Ore ee Se ee ee ee ee ee 61 3 23 6 Write the beamline geometry o o 61 eee ee 61 EA A ae ee 63 A e a we ee a da 63 A AAA 63 RA E AR AAA 63 shan micas 65 EL ea o pa a a 66 S244 Plot the diferential lwmimosity s so co sre aw be ee es 66 3 24 5
75. ables and stdstolum dat for luminosity both in exec directory is used The file is written in ascii format but do not try to edit it No protection against wrong formats When STORE is called all the variables are written in a file At the time of RESTORE there can be three kinds of variables except for unchangeable ones those already defined and appear in the file already defined but do not appear in the file and undefined vari ables The first kind variables are overwritten The second ones are kept not eliminated and the last ones are added When STORE LUMINOSITY is called all the luminosity data at that time will be written in the specified file When RESTORE LUMINOSITY is invoked all the luminosity data in the present run is erased and replaced by the data in the file These two commands are introduced for convenience in splitting a job into two jobs for calculation and for output For example if you expect a long job but do not know what is to be printed plotted You write WRITE BEAM FILE beam_file STORE STORE LUMINOSITY near the end of the long job Then you can print plot the beam in the next job by BEAM FILE beam_file RESTORE RESTORE LUMINOSITY PLOT ieee ck 12 Exceptions are the two variables MsgFile and MsgLevel They are not stored and hence not restored 72 Here in the PLOT command you can use the variables you defined in the previous job If you want different plots
76. amelist like format The generic form of the file data that CAIN can undestand is begin_flag keyword value keyword value end_flag for each particle You have to list up these keywords in the command and to give formulas to convert them into CAIN variables The syntax of the command is Syntax BEAM FILE f filemame N N USERDEFINED BEGIN b str END e str TERMINATE t str COMMENT c KEYWORD kw kw2 CONVERSION x1 f1 x2 f2 b str e str Character string to appear in the file indicating the start and end of data of each particle At least one of these must be specified t str Character string to appear in the file to terminate reading the file Read to the end of file if not specified G Character indicating the start of comment data to the end of the file line kw Name of variables which appear in the file Case sensitive Each data is expected in the form a 3 0 or b 0 5 2 0 etc If a data has more than one components you need to add the size The above form requires the KEYWORD operand of the form KEYWORD a b 2 Xi fi Define the rule to convert the input data KEYWORDs into the CAIN vari ables The l h s x is either one of T X Y S Px Py Ps Sx Sy Ss Xi1 Xi2 Xi3 Kind Gen Wgt The r h s f is an expression including the KEYWORDs kw s 31 and possibly other variables You have to define all the 16 varables above Default is all zero ex
77. an integral number in floating format does not have fractional part unless the number of digits exceeds the double precision limit about 15 digits Therefore SET x 3 y 5 z x 2 gt y still works as you intend Logical operators In a logical expression a amp amp or b any number is treated as false if zero and as true if nonzero The result of operation is either 0 0 false or 1 0 true Priority of operators The priority of the operators is as follows SS RAN gt lt gt lt gt lt gt Il The operators within a pair of braces have the same priority In contrast to the C language the substitution is not treated as an operator It would cause a confusion with our command syntax keyword operator which is not an expression as a whole 13 2 5 2 Pre defined parameters There are three types of predefined parameters e The first type is the universal constants that never change Pi E Euler Deg Cvel Hbar Hbarc Emass Echarge Reclass LambdaC FinStrC T e 2 TB Euler s constant yg 0 577 7 180 0 0174 You can write e g 10 Deg where the randian unit is required Velocity of light m sec Planck s constant Joule sec Planck s constant times the velocity of light eV m Electron mass eV c Elementary charge Coulomb Classical electron radius m Compton wavelength m Fine structure constant e The second type is the parameters
78. ansformation LumEEH FILE LumEEP 21 file close LumH 21 file open 71 LUMINOSITY file rewind 7 LUMINOSITY clear 70 fine structure constant luminosity function FLAG luminosity integration Frac LumP 2 1 FuncBs 21 13 LumW 170 LumWbin Schwinger s critical field LumWbinEdge SELECT SET MAGNET 50 Sgn 15 MATCHING shift of origin 49 Max SigEn meta expression SigPs Min 15 SigPx Mod SigPy 18 modified Bessel function Sigs 18 MsgFile SigSs MsgFLevel 15 SigSx Nint aa NMacro a SigX 18 SigXil SigXi2 nonlinear Breit Wheeler process 109 nonlinear Compton process 105 NParticle Nu SigXi3 SigY operator 113 Sin 15 OutFile Sinh 15 OutFile2 Smesh Sokolov Ternov formula particle selection SPIN Planck s constant Sqrt 15 PLOT standard format 30 59 Poisson equation statistics of beam polarization luminosity 93 Step polarization vector 29 30 S0 82 Stokes parameter positional operand STOP 73 PPINT 46 STORE 72 predefined function Strlen predefined parameter 14 Strstr PRINT 58 print array Tan 15 print parameters Tanh PUSH 33 47 TDFile test particle Rand TestEn 19 random number TestPs 19 Rayleigh length TestPx RESTORE 72 TestPy rotation 49 Tests running CAIN TestT 19 running variable TestX 19 171 Testy Thomas precession Thomas BMT equation Time 14
79. article WGT is the number of real particles expressed by one macro particle and GEN is an integer expressing the generation 1 for the initial particles 2 for secondaries etc SPIN is the polarization vector for electron positron and the Stokes parameter for photons The file can also be MATHEMATICA style automatically detected The format string is 1 11 7 15 44 12 1PD19 12 y gt In the case of the NAMELIST format the namelist BEAMIN must be inserted for each particle 30 amp BEAMIN KIND 2 GEN 1 PNAME gt WGT 0 0 TXYS 0 0 0 0 0 0 0 0 EP 0 0 0 0 0 0 1 0 SPIN 0 0 0 0 0 0 END FALSE SKIP FALSE amp END Here the r h s show the number of data the data type and the default The last component of EP i e P must not be zero All the particles must be either right or left going Actually the particle energy is calculated from yp m The input data is not used If the first character of PNAME is T the particle is treated as a test particle The test particle name must be unique PNAME should be blanck for normal particles If SKIP TRUE the present data is omitted If END TRUE the present data and all the following data are ignored Comments in NAMELIST statements follow the local rule on the platform To modify the file data shift of origin rotation etc can be done to some extent by using the command LORENTZ User defined format You can also read a file of user defined n
80. ate representing an ensemble of particles having almost the same energy momentum and space time coordinate If one observes the particle spin with the quantization axis e le 1 the probability to be found in the spin e state is given by 1 e 2 The polarization vector obeys the Thomas BMT equation 5 35 in the absense of quantum phenomena Convention for photon polarization A similar way is used for photon polarization too The polarization vector 3 vector normalized as e 1 is orthogonal to the photon momentum k It can be represented by the components along two unit vectors e and e perpendicular to k The three vectors e e k k form a right handed orthonormal basis The density matrix is defined as pl e e e 5 6 This is Hermitian with unit trace as in the case of electron density matrix so that it can be written as pM 101 E0 E Trace pWo 5 7 The 3 vector is called the Stokes parameter In the standard representation of the Pauli matrices the three components of have the meaning Linear polarization along the direction e e V 2 gt 0 or e e 2 amp lt 0 z Circular polarization s Linear polarization along the direction e gt 0 or e lt 0 82 The linear polarization can also be written as 3 cos2 and z sin2 z gt 0 where z is the magnitude of linear polarization and z modulo 7 i
81. be specified by using as the delimitor like TITLE E0G1 XGX for writing E It is recommended to put also at the end as in this example to avoid writing unnecessary blanck charac ters Hl fn file name APPEND Output file unit number or name of an old or new file If not specified FILE TDfile For the differece between the two forms See Sec 2 8 3 24 2 Scatter plot of particles or laser photons Syntax PLOT SCATTER NONEWPAGE RIGHT LEFT KIND k k k2 INCP LOST SELECT f H f V f HSCALE Emin Umar VSCALE Yymin gt Ymar HLOG HLINEAR VLOG VLINEAR COLOR color MAXNP Mmaw TITLE top title HTITLE bottom title VTITLE left_title FILE f file name APPEND Es An expression defining the vertical variable YminsVmax Minimum and maximum of the vertical scale a Maximum number of points to be plotted in order to save the plotting time Randomly selected Default plot all points Other operands are the same as for the histogram You can also plot laser intensity profile as a scatter plot of laser photons Unfortu nately there is no way to select a laser if more than one lasers are defined 11 There is a subtle problem related to the quote and the double quote For example CAIN recognizes as a character but since TopDrawer does not understand so that it is transformed to 222 Tf you want one you have to writ
82. ber of steps in PUSH command so as to make po small enough you have to omit this factor because the energy of some electrons can be much smaller after first radiation 114 0 8 Po Figure 5 9 The acception Se probability in the step 6 oy as a function of Y The solid line is the unpolar ized case The dot dash and dotted lines are polarized cases with e2 1 and 1 respectively 0 4 SGT y dy 0 27 0 0 ix10 1x107 1x10 1x10 1x10 1x10 magnetic field e2 is the unit vector along the magnetic field times the sign of charge The transition rate from the initial electron polarization to the final polarization Cf with the photon Stokes parameter based on the basis vector e1 2 e is dW ae x F t CC y ti 3 2 ss Kailer 2 7 eorSiN enS Kinja Gils ev Gren Es Kays 5 152 Kale Gb A E ke plerg E Kays 7 Kiysles6i F where Foo is defined in eq 5 145 and the argument of the Bessel functions is 2 We omit ted the terms involving s and simultaneously which means to ignore the correlation of polarization between the final electron and photon See Secl5 2 2 for the meaning of bars on Cf and The radiation energy spectrum summed over the final polarization is given by eq with Foo replaced by Fo Foo xK jslez i 5 153 Since the function G T y with Foo replaced by Fo has still the above mentioned property
83. c has changed its meaning See Sec 2 6 e The use of within a character string to express one is better be avoided You can now use Other minor changes e Travelling focus parameter DALPHADE has been introduced See Sec 3 5 e Bug fix in cohpar f and cprnd2 f data initialization Thanks to D Asner A 8 CAIN2 23 e The commands MAGNET BEAMLINE BLOPTICS TRANSPORT and ENDTRANSPORT are added PRINT PLOT BLOPTICS and PRINT MAGNETS BLGEOMETRY added accordingly e Bug fix in lumprt f Factor 1074 in luminosity output Thanks to G Franzoni A 9 CAIN2 21 e Bug fix in donut f n vector e Random number routine changed the name rand randcain to avoid name con fliction in some unix systems e makefile rewritten for jlecc Thanks to I Sakai e go rewritten for jlecc Thanks to T Omori A 10 CAIN2 2a e Donut laser beam by axicon introduced 129 A 11 CAIN2 2 There has been a version CAIN2 1d but the changes since then are only bug fixes Here we list up the changes beside bug fixes e Unequal mesh of energy for differential luminosity has been introduced e LASER command improved for arbitrary intensity profile e Dynamic allocation command ALLOCATE of some arrays introduced This change invokes Fortran90 A 12 History until the version CAIN2 1b New entries on physics e 2D differential luminosity d dE dEz added e Lorentz transformation of lasers has been added e Field stren
84. cept Kind 1 Gen 1 Note that En does not appear here because the energy is computed from ym p An example Suppose each data in the file representing an electron at s 0 is given as START xy 0 1 0 5 T 0 3 pxy 0 01 0 03 dp 0 001 END where xy is in mm T in mm pxy in milli radian dp Ap po with pp 1GeV c Then the BEAM command should be SET p0 1e9 BEAM FILE USERDEFINED BEGIN START END END KEYWORD xy 2 T pxy 2 dp CONVERSION X xy 1 1e3 Y xy 2 1e3 T T 1e3 S 0 Ps 1 dp p0 Px pxy 1 Ps Py pxy 2 Ps Kind 2 Wgt 1e6 The spin will be zero Note that the CONVERSION functions are evaluated in the given order so that in this example Ps is already defined when Px and Py are computed A complication arises when some of the above 16 variables appear as keywords If they are used as exactly same meaning as in CAIN including the unit system you need must not list them as KEYWORD and must not give CONVERSION formula If they are different they have to appear in KEYWORD and in the h s of the CONVERSION formula In this case the l h s of a CONVERSION formula is a CAIN varable but the same name appears on the r h s as a user keyword In the above example T in the file is in mm different from CAIN definition so that it is listed in KEYWORD and the conversion formula T T 1e3 is given Tips bi e Blanck spaces in the file data are treated as delimiters Comma and line feed
85. ch macro particle is in the helicity h 1 state or 1 state The unpolarized state is represented by an equal number of macro particles with h 1 and 1 The spin may flip at the interactions such as laser Compton scattering and beamstrahlung However this simple way cannot be applied to our case because for example a pure transverse polarization may become longitudinal during the precession in a magnetic field beam beam field or external field In order to include such classical precession effects the phase relation between the up and down components of the spinor is important This problem can be solved by using the density matrix Let us express an elec tron positron state by a two component spinor p The 2x2 density matrix p is defined as a ewl G 5 1 where f denotes the Hermitian conjugate and is the average over a particle ensemble Since p is Hermitian and its trace is unity by normalization p can be written as pPO M1 0 Trace pa pap 5 2 81 where is the Pauli matrices The 3 vector is called polarization vector In the case of pure states y can be represented by a superposition of spin up down states p P C4p4 CY lea eles 2 5 3 With the standard representation of the Pauli matrices ES 2 os can be written as G Weic 23 Mcj0 G lal Icl 5 5 and its length is unity 1 CAIN allows lt 1 so that each macro particle is in a mixed st
86. coshwr wero p 0 45 34 Ww where a is the coefficient of anomalous magnetic moment and B e B e Br B B e x Bxe 5 36 When the field is very strong a is different from the well known value a 2r O a but is a function of the field strength characterized the parameter Y e e T y FWp VWEr px B E2 5 37 According to V N Baier a Y 2 r zdz r fz e t dt 5 38 an Cp aa a ed The function a Y a 0 is shown in Fig 5 1 Simple polynomial approximations are used in CAIN 87 Figure 5 1 Field dependence of the anomalous magnetic mo ment of electron 5 4 2 Equation of motion under PUSH command Ss T 0 F 1 is 1 T ix10 1x10 1x107 1x10 do Solving the equation of motion in PUSH command is much more complicated because of the possible presense of the beam field The equation of motion is in general written in the form dr de dp dt P UP Tara pe F r p 5 39 5 40 The force F includes the beam field and the external field The p dependence of F comes from vx B although very weak in the case of the beam field Given the initial variables ro pp a simple approximation after the time interval At is Fo Pi r F P r F ro po Po FoAt ro v pp v p At F ri p Po Fo FijAt ro ilv po v p At The error of r by these formulas is estimated by or _1 Fi
87. d Otherwise lost particles are not included fn file mame APPEND Unit number or name of an old or new file For the differece between the two forms See Sec 2 8 3 23 3 Write the calculated luminosity Syntax PRINT LUMINOSITY KIND k k2 FILE fn file name il APPEND LUMINOSITY Write calculated luminosity specified by k k2 k1 ka Define right and left going beams All the luminosities differential and polarization defined by the LUMINOSITY command will be printed The print format is complicated Just try fn file name APPEND Unit number or name of an old or new file For the differece between the two forms See Sec 2 8 3 23 4 Write a list of defined magnets Syntax WRITE MAGNETS BEAMLINE name COMBINE MOMENTUM pp FILE f filemame APPEND 60 name Name of a defined beamline The apostrophes can be omitted If the beamline name is not given write a list of all defined magnets If given only those which actually appear in the beam line with the number of appearance are listed COMBINE Same name magnets with zero length drift spaces in between are to be listed as one magnet Effective when the beamline name is specified Po Reference momentum in eV c If given print also the field strength in Tesla or Tesla m 3 23 5 Write the beamline optics Syntax WRITE BLOPTICS BEAMLINE name FILE f file name APPEND name Name of a defined beamline The apostrop
88. d a bug on Windows platform when simultaneous output to a file and to the console is intended Apr 10 2003 e Linear laser polarization added in nonlinear Compton scattering Apr 21 2003 However the electron spin is not yet included 126 e Files jobdat f and clock1 f changed They now only use standard FORTRAN routines DATE_AND_TIME and SYSTEM_CLOCK These files were moved to the directory src and the directort src local was removed The file windows second c was removed There is no more C files Apr 23 2003 e The redundunt argument for RANDCAIN eliminated Apr 23 2003 e Platform dependent common blocks word boundary problem due to the length of FORTRAN pointers EVLOADCM and LASRCM4 were replaced by MODULEs Apr 25 2003 A 4 CAIN2 33 e When the destination of MsgFile in Windows version is a file its copy can also be shown on the console See Sec 1 2 4 changed See Sec 3 32 e A predefined particle variable PName added e The treatment of SELECT operand in PLOT and CLEAR BEAM commands e PLOT BLGEOMETRY added e Bug fix of error message in rdall f CMD ICMD IC 1 NCCMD ICMD IC CMD IC 1 NCCMD IC e Bug fix for test particles P 3 EP 0 3 in addtstp f and also line mode errors in pltstp f scat f e Bug fix for virtual photon generation in vphgen f PO FINSTRC PI HMAX WGT PO FINSTRC PI HMAX WGT This bug is serious It seems howerver WGT is unity in most applications upto now It causes an er
89. d for the computation of h because is Lorentz invariant Also note that input is defined already in the rest frame of electron Only the Lorentz transformation of k is needed 4 Generate two random numbers Z and ra in 0 1 Repeat this step until ra lt F Z is satisfied Once or twice repetition is normally enough unless h is close to 1 and A is very large 5 Compute w from z Generate the azimuthal angle compute the final polariza tion if needed and go back to the laboratory frame In this step many Lorentz transformations are needed 5 8 3 Compton Process in a Strong Laser Field When the laser field is strong the simple formulas of Compton can nolonger be used The laser field strength is characterized by the parameter JmcP 5 104 Here A is the 4 vector potential of the laser field and indicates the average over the phase Az is the laser wavelength 27 in meter m the electron rest mass in eV c c the velocity of light in m s uo 47 x 1077 and P the power density in Watt m When lt 1 the well knwon formulas are enough but as becomes large the probability of absorbing more than one photon in the laser field cannot be ignored When gt 1 the constant field approximation becomes good If lt O 1 the expansion in terms of the number of absorbed photons n shows good convergence The expansion takes a relatively simple form when the laser is circularly polarized by 100 Old versio
90. d within a PUSH loop the particles are taken to the corresponding time t Time However it is safer not to insert BEAM command within PUSH loop unless you know well what is going on One exception is the test particles which in some cases you want to create during a PUSH loop for example to see the behavior of a low energy particle created during interaction If you do not want them to be time shifted in such cases you can define the TXYS operand as TXYS Time where Time is the PUSH running time present time 3 6 LASER Defines a laser There can be upto 5 lasers but this can easily be increased parameter MLSR in src module lasrdata f One LASER command defines one laser Note that lasers if there are more than one act incoherently Their interference effects cannot be included in the present version The interaction with photons electrons pisitrons is defined by the command LASERQED Secl3 7 The parameters for a laser can be classified into 4 categories a General parameters such as wavelength peak power density and those defining laser coordinate sytem 7 amp 7 See Sec 5 8 1 for laser coordinate This category includes the parameters RIGHT LEFT POWERDENSITY WAVELENGTH TXYS E3 El and STOKES Also included in this category are parameters for plotting the intensity profile b Parameters to specify time profile F 7 of the pulse This includes SIGT TTOT GCUTT and TEDGE c Parameters
91. de particles created by incoherent incoherent processes only Otherwise normal particles only Include particles lost in beamlines See Secl3 20 Only lost particles are included Otherwise lost particles are not included Logical function for selecting particles e g SELECT X gt 0 will select particles with positive x coordinate See Sec 3 32 for more detail Note that once SELECT is specified both normal and inco herent particles are included by default If you reject incoherent particles you must say PLOT SELECT Incp 0 HLOG VLOG Log scale of horizontal and vertical axes When HLOG is specified Lmin and Imaz Must be specified explicitly The binning interval will be equal in log scale 64 color Color name allowed in TopDrawer One of the following WHITE RED YELLOW GREEN CYAN BLUE MAGENTA BLACK Note that WHITE appears black and BLACK is invisible ERRBAR Flag to add error bars to the plot The error bar is defined as the n type statistical spread for population or when fy is defined r m s data spread within the bin correction due to possible variation of the function within the bin is not applied In the case of secondary particles the statistics of their parent particles are not taken into account The error bars so determined are often misleading so that they are drawn only when this flag is given top_title etc Title string Must be enclosed by a pair of apostrophes Topdrawer case string can
92. dt can be used for the travelling focus scheme using energy slope do dt da dt Bunch position dependence of a 1 m This defines the bunch Gas Cy Cs position dependence of the focal point The focal point in the z y plane for particles with the position in the bunch t note t gt 0 at bunch tail is given by tB y X day dt positive if focused beyond the normal focal point This operand can be used for the travelling focus scheme See the note below Polarization vector Default 0 0 0 Note the sign of for left going particles In the case of photon beams these are the Stokes parameter 1 2 3 The basis vector of the Stokes parameter is e e e where e is the unit vector along the particle momentum el is the unit vector along e e e e and e e xe See Sec 5 3 for rigorous definitions Traveling Focus A little complicated parameter definition is needed for travelling focus For the scheme using the energy slope in the bunch is straight forward by using DALPHADE Here is the parameter definition for the scheme without using the energy slope e g crab cavity plus sextupole SET s0 Sqrt 3 2 sigz dalphdty 0 5 betay BEAM RIGHT TXYS 50 0 0 80 DALPHADT 0 dalphadty BEAM LEFT TXYS s0 0 0 s0 DALPHADT 0 dalphadty where sigz is the bunch length and betay is the vertical beta function at the collision point This sequence will make every
93. e which bocomes in the TopDrawer input data and is understand as one single by TopDrawer 65 Syntax PLOT SCATTER LASERPHOTON NONEWPAGE 5 T t S s 3 MAXNP n H fo gt V fy HSCALE E MER par gt VSCALE CUm n gt Unaas gt HLOG HLINEAR VLOG VLINEAR COLOR color TITLE top title HTITLE bottom title VTITLE left title 2 FILE f filemame APPEND ts Either one of these must be specified meter Snapshot if t is specified race goal shot if s is specified n Number of laser photons to be plotted default 1000 Other operands are the same as for the scatter plot of particles The following example to be inserted during a PUSH ENDPUSH loop will cause a s 1 snapshot of laser and electron beams in the same frame PLOT SCAT LASER T Time COLOR RED H S 1e 3 V X 1e 6 HTITLE S mm VTITLE X Mm G 3 TITLE t FtoA Time 1e 3 F7 2 mm PLOT SCAT NONEWPAGE KIND 2 COLOR WHITE MAXNP 0 Note that Time is the running variable during a PUSH ENDPUSH loop 3 24 3 Plot the test particle data Syntax PLOT TESTPARTICLE RIGHT LEFT 1 KIND k ki ka l H fz V fy HSCALE Lmin gt TUmax VSCALE Ymin gt Ymax COLOR color TITLE top_title HTITLE bottom title 5 VTITLE left title FILE f filemame APPEND Other operands are the same as for the scatter plo
94. e nothing be printed Unfortunately the grammer of CAIN does not allow an un paired apos trophe so that for example 1H will cause an error fn file name APPEND Unit number or name of an old or new file For the differece 7 There is no such a rule that a user parameter name must not be identical to some keyword Here however there is an inconsistency of grammer If you define a parameter with the name ST for example PRINT ST may be understood as printing the parameter or printing the statistics unless the keyword PARAMETER is explicitly written This can be avoided by writing PRINT ST because ST is not a keyword but is an expression actually identical to ST Here is a problem of grammer Only the character expression should be accepted for consistency of grammer but a string with should be retained for backward compatibility A problem arises e g for FORMAT I which can be interpreted in both ways print three characters I if interpreted in the old way or print something with I format in new way CAIN assumes the old form at first L format was not allowed before CAIN2 3 10 A known bug WRITE i 1 2 FORMAT nothing won t work Instead you can write WRITE nothing i 1 2 62 between the two forms See Sec 2 8 3 23 8 Write a list of all allocated arrays Syntax PRINT ARRAY LONG FILE f file name LONG Write the values of array contents Otherwise only a
95. e matrix element mag bl name Same as Twiss parameters caution The 5th column row of the transfer matrix corresponds to the time variable multiplied by the velocity of linght It is negative at the bunch head because the head comes to a given machine point earlier The tansfer matrix is simplectic only when 5 7 and 1 5 i 4 5 elements are multiplied by 1 20 2 6 4 Luminosity related function There are functions related to the luminosity Lum LumH LumP LumW LumWbin LumWbinEdge LumWH LumWP LumEE LumEEbin LumEEbinEdge LumEEH LumEEP See Sec 3 11 for definitions for these functions 2 6 5 Laser related function LaserIntensity t 1 y 2 n Get laser intensity in Watt m at the space time point t x y z world coordinate not laser coordinate for laser n n can be omitted if n 1 LaserRange 1 n Get the range where the laser field is non zero in laser coordinate for laser n n can be omitted if n 1 1 minimum 7 2 maximum j 0 FF HG j 1 E j 2 n j 3 See Secl5 8 1 for the laser coordinate 7 y 2 6 6 Special functions Bessel function Jp n must be an integer BesJ n 1 Bessel function J 1 n must be an integer DBesJ n z Derivative of Bessel function J x n must be an integer Modified Bessel function K and its integral In all the following functions the last argument k must be 1 or 2 When k 2 the output is the function multiplied by e The last argument may be
96. egion for FFT and its left bottom quadrant is the charge region w X wy The region hatched by solid lines is the real charge region and that by dot ted lines the ghost charge due to the periodicity of Fourier transformation The kernel matrix G has to be calculated by taking average over the source cell 1 1 e ee Zj NEE 2 o 2 64 Cis Ar y x y in cell i j 2 ogl z x Y y Jdxdy 5 6 This averaging is important when A A is far from unity The convolution in eq 5 63 can be done efficiently by using FFT However if we apply FFT for the finite region wy wy instead of the infinite region in eq 5 61 we would be assuming a periodic charge distribution i e the charge distribution in Wz wy is infinitely repeated To avoid this problem we use the following trick First double the region to 2w 2w by padding zero in the extended region and carry out FFT This still means a periodic charge distribution as depicted in Fig 5 3 However if we use the kernel matrix with zero padded in the extended region Gij 0 if ny lt i lt 2n or Ny lt i lt 2n the field due to the ghost charges will never reach the real charge region because their horizontal vertical distance is larger than ws w Thus the potential in the region wy wy is calculated correctly although incorrect in the extended region The obtained values of the potential are those at cell centers They are interpolated by 2 di
97. ele dhos aahei 5I Baam Field 6 e sos coss Be oo oe kon d A KEES e aa i Ce Loe e e t a Eeee d E aos a Ree Oe oe ae o E 58 1 L ser Geometry cinc ia aan oY da eee Meee Be 58 2 Linear Compton Scattering cre raa siko eo eiii 5 8 3 Compton Process in a Strong Laser Field 5 8 4 Breit Wheeler Process in a Strong Laser Field 99 BESTIA NIUE circo b444 02 2 beeen ede A A AA E ph kk fe oH ae ee ne HY BS Bw eS ee 5 9 2 Algorithm of event generation a a Hey cd eck Ge Ba Go wash Bw Ak eee ooo ae Boh Be eb ag aaa AAA AAA 5101 Base formulas orcos da a a a 5 10 2 Algorithm of event generation o o 511 Incoher nt Processes gt oc oidos cd a Sees 5 11 1 Breit Wheeler Process 5 11 2 Virtual almost real photon approximation 5 11 3 Numerical methods o sa a ca sataa ee oe g 000000088 A History of Revision Rol es a ee ratas AR ek we EE A NA Pe ee er ee ere ee ee OGe se san Ge hoe en eee eee ey eee eee ee oS eens See A Se 64 ere ates Bee e a ees peo ote Goer Pa topico lap ane ee tee hs LAI a ood a A a as Be Rw a A LR plo ay e eee pis oad E pops pod e pia ptas EEEIEE TETEE EENT eae aad ATAN ais Ye AA HP DDD gap OM De A A 12 History until the version CAUN2 1b 2 24 22244 es bee ee bees Chapter 1 Introduction CAIN is a stand alone FORTRAN Monte Carlo code for the interaction involving high energy electron positro
98. er defined parameters These are those defined by SET command see Sec 3 3 Upto 16 characters consisting of upper lower case alphabets numericals and underscore _ The first character must not be a numerical The first character of character type variables must be and no in the body 2 5 4 Predefined functions There are following basic math functions Int Nint Sgn Step Abs Frac Sqrt Exp Log Log10 2The input file number is set to 5 If you want to change it see the variable RDFL in the file cain242 src initlz f 15 Cos Sin Tan ArcSin ArcCos ArcTan Cosh Sinh Tanh ArcCosh ArcSinh ArcTanh Gamma Mod Atan2 Min Max Defintions are the same as in standard FORTRAN except Sgn and Step 1 forr gt 0 1 f gt 0 Sgn z 4 0 toerzx 0 Step x aes 0 for z 0 1 forx lt 0 Enclose the argument by or or 4 Separate arguments by if there are more than one argument Mod Atan2 Min Max Number of arguments for Min and Max is arbitrary In addition to the above functions of standard type there are functions of other type which are defined for CAIN See the next subsection Sec 2 6 2 5 5 Arrays You can allocate or deallocate arrays by using the command ARRAY and set their values by SET command The rule about the array name is the same as that of user defined parameters The subscripts are delimited by commas and enclosed by a pair of parenthesis or or 4 must match
99. ers their values at the time of LASERQED command are used Changing them afterwards will not affect the computation lenn Integer 1 or 2 or 3 Defines how to treat macro particles under enhancement Needed only when you specify fenn Normally you should use the default 1 but you have to read below if you suffer from generating too many unneces sary particles When an event is generated under lenn 1 CAIN generates new macro particles with the weight wo fenn where wo is the weight of the initial particle and leave the initial macro particle with the reduced weight wo 1 1 fenn When fenn is very large however in the case of Compton scattering for ex ample this rule will create many photons and electrons with small weight The electrons thus created cause another events generating electrons of even lower weights If you are interested only in the photon this is just a waste of computing time and memory This problem can be avoided by l 2 or 3 In the case of Compton e If lenn 2 the initial particle e is treated probabilistically i e it is replaced by the new e with the probability 1 fenn but remain as it was with the probability 1 1 fen Therefore the number of macro e will never increase e If lenn 8 the new particle y is treated probabilistically i e a y of weight wo not wo fenn is generated with the probability 1 fenn Thus the number of macro y is the same as in the absense of enhanceme
100. ever these two sets are not actually distinguished For example AvrSs 1 2 means average electron helicity but it is equivalent to AvrXi3 1 2 BeamMatrix requires two more arguments BeamMatrix a b j k f 1 lt a b lt 8 The returned value is the average of 1 1 where x T X Y S En Px Py Ps for a 1 to 8 In units of m and eV or eV c 2 6 2 Test particle functions The coordinates and the energy momentum of the test particles can be retrieved by the functions TestT TestX TestY TestS TestEn TestPx TestPy TestPs The calling sequence is for example TestX name or TestX n where name is the character string for the particle name and n is an expression representing an integer 99 lt n lt 999 See Sec 3 5 for the test particle name The meaning of this argument has changed since CAIN2 3 It used to be selecting the range of S coordinate but has been replaced by a more powerful one 19 2 6 3 Beamline functions The functions related to the beamline optics such as P and 7 functions and the transfer matrix are retrieved by Beta Alpha Eta Etaprime Nu TMat Nu is the phase advance 27 from the beamline entrance TMat is the 6x6 linear transfer matrix from the beamline entrance Prior to use you must compute the optics by BLOPTICS command The calling sequence of these functions are the same except for TMat Beta j mag bl_name where a 1 or 2 for x or y respectively mag Either inte
101. f input data In the commands like PLOT e When INCP is specified include only incoherent particles e When SELECT is specified include both normal and incoherent particles e When none of INCP and SELECT is specified include only normal particles e In any case SELECT if specified applies on the particle subset defined above For example if you want to plot right going normal particles you say PLOT HIST RIGHT or you can also say PLOT HIST SELECT Ps gt 0 amp amp Incp 0 Don t miss Incp 0 in the latter case if your beam contains incoherent particles but you do not want them included If you want on the other hand to plot right going incoherent particles you say PLOT HIST RIGHT INCP or PLOT HIST SELECT Ps gt 0 amp amp Incp 1 A similar rule applies to the beam statistics functions For example AvrEn 1 1 average energy of normal right going photons AvrEn 1 1 Incp 1 average energy of incoherent right going photons AvrEn 1 1 average energy of all right going photons 13 The evaluation of the expression fse is done by a sort of compiled load module rather than interpretator but still the computing time is a problem 74 Chapter 4 Installation The development platform of CAIN used to be a UNIX machine but since CAIN2 2 it moved to Windows There has been inconvenience for UNIX users CAIN2 35 now tries to support UNIX version too although
102. ger or character expression If it is an integer n gt 0 the exit of the n th magnet in the beamline is implied Beamline entrance if n lt 0 and beamline exit if n is equal to or larger than the number of magnets in the beamline If mag is a character expression it is identified as a magnet name If there are more one magnets with the same name you can add the occurence number after a dot For example the exit of the third QF is QF 3 You can of course write as QF ItoA 3 If omitted the first occurence is assumed If you forget apostrophes and write Beta 1 QF blname you will get an error message like Variable QF not found bl_name Beamline name Must be enclosed by apostrophes character expression in general You can omit the third argument if in a TRANSPORT ENDTRANSPORT loop The default is the current beam line Even in this case you have to call BLOPTICS command prior to TRANSPORT Note that Twiss parameters are not needed for particle tracking You can also omit the second argument which means the current position You can omit the third argument during optics matching i e in the matching condi tion but cannot omit the second argument in this case These functions return zero when an error occurs such as BLOPTICS not called the beamline not existing illegal number after the dot etc The calling sequence of TMat is TMat i 7 mag bl_name where 1 1 lt 1 7 lt 6 Identify th
103. ghout the PUSH loop 3 10 EXTERNALFIELD Define external field The present version allows only a constant field over an interval bordered by two parallel planes Syntax EXTERNALFIELD e Wisse EEE EN B B By Bs a Define the range of the field as s1 lt CY cyy C58 lt 89 Must be s lt 52 Default s oo s2 00 and z Cy cs 0 0 1 43 E Electric field components in units of V m Default 0 0 0 B Magnetic field components in units of Tesla Default 0 0 0 3 11 LUMINOSITY Define the transverse mesh size number of bins etc for luminosity calculation One luminosity command is needed for each combination of particles y e7 et right going and left going Thus there can be at most 9 LUMINOSITY commands Syntax LUMINOSITY KIND k ki FREP frep gt W nio V mgs Tiina W Wo Ad hta Wri W Warray g Ed Pimins Eimar titwal Els Ero Eiir ea imu s E eiras E2 Emina Eoman ndin a E2 E0 E31 se r Beng o E2 Etarrays WX Wel Wam WY 0 0ym HELICITY ALLPOL Reki Particle species of right and left going beams Fees Repetition frequency Hz Used for the luminosity scale only De fault 1Hz Winin WmaxMbin Parameters for differential luminosity with respect to the center of mass energy W Winin Wmar is the range in eV and nin is the number of bins If Winin Wmax is not given the center of mass spectrum is not calculated Default for np is 50 W
104. gth dependence of the anomalous magnetic moment of electron is taken into account in solving the Thomas BMT equation e Polarization dependence of the beamstrahlung and the coherent pair creation has been included e The kinematics in nonlinear QED subroutines was improved so as to accept non relativistic electrons positrons e The final polarization of electron in the nonlinear Compton scattering was added e Polarization change in linear and nonlinear QED beamstrahlung and coherent pair creation processes when event generation is rejected is now taken into account e Incoherent ete pair creation by Breit Wheeler Bethe Heitler and Landau Lifshitz processes has been added e Luminosity with full polarization information including linear polarization can be computed e Differential luminosities with unequal space energy bins are introduced New entries on user interface e Following pre defined variables have been added Kind Gen e Following pre defined functions have been added Min Max AvrT AvrX AvrY AvrS SigT SigX SigY Sigs AvrEn AvrPx AvrPy AvrPs SigEn SigPx SigPy SigPs TestT TestX TestY TestS TestEn TestPx TestPy TestPs 130 LumP LumWP LumWbin LumWbinEdge LumEE LumEEbin LumEEbinEdge LumEEH LumEEP BesJ DBesJ BesK13 BesK23 BesKi13 BesKi53 FuncBS FuncCP IntFCP Do type sequence in PRINT WRITE command became possible Maximum number of characters of user parameters is i
105. he mesh in meters for right and left going beams If wz2 is not specified wz2 wz is adopted No default for wz If WXMAX is given the with of the mesh region can vary in the range Wr Wrm when the beam fraction outside the range defined by WX and R is significant Note Wem gt We Aspect ratio w n 1 N of the horizontal to vertical mesh size This is common to right and left going beams No default Number of horizontal and vertical bins Present version uses Fast Fourier Transformation so that a power of 2 is the best choice Other numbers are also allowed but those of the form 2 or 3 x 2 or 5 x 2 are recommended Default 32 Macro particle size in units of the bin size Macro particles are treated as a rectangular of uniform distribution Must be 0 lt A lt 1 Default 1 For x y points outside the mesh region a harmonic expansion using the elliptic coordinate is used The parameter Nmom specifies the truncation of harmonics Nmom 0 takes only the total charge term and NnNmom lt 0 ignores the field outside Default 10 Note that the particles outside mesh region receive the beam beam kick unless Nmom lt 0 but the field created by them is not taken into account See Sec 5 7 for more detail Note that the longitudinal mesh size which is common to beam beam field and luminosity calculations has to be defined by the parameter Smesh by the SET command Its value at the time when PUSH started is used thou
106. hen the f number is not too small 2 1 5 the longitudinal field E can be ignored and the transverse field E E varies only slowly 07E 0 lt kOE 0 Then the Maxwell equation of propagation in vaccuum is 2 E SE 5 55 When E n C is given on the plane Co the solution at 4 Cy is given by u v o dedye CE ECE n 66 5 86 EEC duav er i us on otal oo E u v Co 5 87 101 or by BEMO ERC 588 CO Both of these two expressions are exact solutions of eq 5 85 but the former latter is preferred for short long distance propagation in numerical computation 5 8 2 Linear Compton Scattering When the parameter NPH 0 is specified in LASERQED command the formulas of linear Compton scattering are used Let us define the following variables in the rest frame of the initial electron ww Initial laser and final energies of the photon kk Initial laser and final momenta of the photon 0 4 Polar and azimuthal scattering angle of the photon dQ Solid angle sin 6d d m w dw d E EU Photon Stokes parameters before and after collision as defined in 3 page 361 2 The definition of the axis is such that the first axis is parallel to kxk and the third axis is k k for The range of w is given by lt w lt u A 5 89 The Compton relation is 1 1 1 cos0 A 5 90 Ww m w The crosssection is given by eq 87 22 in 3 IN 2 A
107. hes can be omitted The optics must be calculated by using BLOPTICS command in advance Caution You get an error message when you have not called the BLOPTICS nor the MATCHING command However if you changed magnet parameters and have not called the BLOPTICS command since then WRITE BLOPTICS command will write down a wrong data without error message 3 23 6 Write the beamline geometry Syntax WRITE BLGEOMETRY BEAMLINE name TXYS to 20 Yo 50 gt E3 z y s El rg fy tfs FILE f filemame APPEND name Name of a defined beamline The apostrophes can be omitted to To Yo So Location of the beamline entrance in CAIN coordinate Actually to is not used but it is retained for uniformity and for possible future use ex y 0s Unit vector in CAIN coordinate along the orbit direction of the beam line at the entrance This defines the s axis of the beamline Tx Ty 7s Unit vector in CAIN coordinate along the radial direction of the beam y line at the entrance This defines the x axis of the beamline 3 23 7 Write the values of parameters and expressions Syntax PRINT PARAMETER FILE f filename cal 23 FORMAT fmt FORMAT fmt 61 PARAMETER Write values of predefined or user defined parameters or expressions tn oe fmt fmt Can be omitted File reference number See above for default Expressions It is safer to enclose each expression by
108. inal electron in the center of mass frame h Product of circular polarizations of the two initial photons The total crosssection is rr LG 5 171 09 where 1 2_ dal fde 2 1 4 gt sinh b 4 a 3h 5 172 0 2a a where a w m b p m a b 1 Events are generated by the following algorithm using inverse function a Compute w p a b G and o for given initial parameters reject if a lt 1 i e below threshold and calculate the event probability for the given time step WW Ge ow V where w and wy are the weights of initial photons number of real photons divided by that of macro photons w the weight of the pair to be created At the time interval and V the volume in which the macro phtons are located b If P is too large say gt 0 1 divide the interval At and P by an integer naiw and repeat the following procedure Naiv times c Generate a random number r 0 1 Reject if r gt P d Generate another random number ra 1 1 and solve the equation 2a 1 2a4 2 2a h 1 z 1 h tanh z a sinh z cosh z r2 G 5 173 a 2 1 n with respect to z Here z is defined by c cos 0 a b tanh z 0 lt z lt sinh b The left hand side is the integral of f from 0 to c The sign of c cos is determined by the sign of ra e Generate another random number r3 0 27 and compute the transverse compo nent of electron momentu
109. inate Define a coordinate system attached to a laser Let e be the unit vector along the direction of propagation and introduce a unit vector e perpendicular to e and another unit vector e e xe The three vectors e e e form an orthonormal frame Define the components of these vectors in the original frame er y s as Vi Via Vis V31 V32 V33 98 Then V Vj is a 3 x 3 orthogonal matrix Let 7 be the spatial coordinate in this frame Define the origin of u1 u2 u3 as the laser focus and let zo yo So be its coordinate in the original frame and ty the time when the laser pulse center passes the origin Introduce a time coordinate r whose origin is t Now the relation between t T Y s and T E n is T t to 5 75 E Vu Va V31 T Xo n Viz Va Vz Y yo 5 76 Vis V3 V33 S 8 5 8 1 2 Gaussian laser beam A plane wave is written in the form in the 7 7 coordinate E REg 0r 5 77 where k 1 A 27 Xz is the wave number n is the unit vector along the propagation direction of the wave component and Eo is a complex vector perpendicular to n A laser beam is considered to be a superposition of plane waves with slightly different n and k If the distribution of n around e and that of k are Gaussian and if one ignores the n dependence of Eo the laser field can be approximated by E RE CPV Fe 5 78 where PEE Flr Paleo n C
110. inate the beamline name once defined Present version does not work correctly if re defined Sorry namej Name of already defined magnet or beamline You can put sign for a reversed beamline You cannot use nested If needed you must asign a name for the part of the beamline 51 AA Half aperture for the whole beamline m Not checked if 0 Default 0 0 This value is overwritten if its components beamline or magnet have their own aperture BEAMLINE command only defines the sequence of magnets It does not define the location in the CAIN coordinate and does not have information of the beam They must be defined when used in TRANSPORT command You can print plot the optics by PRINT PLOT BLOPTICS command But prior to these you need to call BLOPTICS command Also you can print the geometry of a beam line by PRINT BLGEOMETRY command The maximum number of beamlines is defined by the parameter MBEAMLINE in the ALLOCATE command The default is 50 3 18 BLOPTICS Calculate Twiss parameters of a beamline This command is needed only when you print plot optics by using PRINT BLOPTICS or PLOT BLOPTICS It is not used in particle tracking You need to specify either PERIODIC or the Twiss parameters at the entrance of the beamline Syntax BLOPTICS BEAMLINE name PERIODIC al BETA a Oud al ALPHA 0 0y ETA nx sy 5 ETAPRIME 9 17 name Name of a defined beamline The apostrophes can be omitted
111. ion of the beam beam force Choose a power of 2 Default is 128 me Number of bins for each of xz and y for the luminosity calculation Choose a power of 2 Default is 128 3 2 FLAG Set flag example FLAG ON ECHO OFF SPIN The keywords ON and OFF act until the opposite one appears ON is the default after FLAG Existing flags ECHO input data echo default ON 25 SPIN include spin calculation default 0N Sorry spin calculation cannot be avoided consistently in the present version 3 3 SET Defines parameters Syntax SET p a p a ned p New or existing parameter name or an element of an existing array The name can consists of upto 16 characters upper lower case alphabets nu mericals or underscore _ The first character must not be a numerical It must be for character type variables arrays Unchangeable predefined pa rameters Pi Time etc and the predefined function names Sin etc have to be avoided All the predefined parameter names and function names start with an uppercase letter Therefore a user parameter starting with a lower case alphabet will never hit the predefined ones a An expression See Sec 2 5 The type floating or character must match with the left hand side 3 4 ARRAY Allocate or deallocate arrays Syntax ARRAY a l n1 l2 no gt lm nmd Fu 5 a Array name to be allocated Obeys the same rule as user defined parameter upto 16 characters If the a
112. is treated as a character string variable For example SET a abc b a xyz will define b as a string containing abcxyz Basically when an operand of a command is of the form keyword something such as file names you can use a general form of character expression including character variables for the right hand side For example SET fn abc n 3 FILE OPEN UNIT 20 NAME fn ItoA n txt opens a file with the name abc3 txt See below for ItoA There are various limits for the size of character stack e g total number of variable names total stored number of characters total number of characters in one expression etc They cannot be changed by the ALLOCATE command basically because FORTRAN90 does not allow dynamic allocation of a character string of dynamically determined length However the prepared sizes are large enough for normal uses The only possible operations involving character strings are e Concatenation by The result is a character string e Multiplication by a positive integer like e g 2 a or a 2 which is equivalent to a a The result is a character string e Relational operation like a b The result is a floating number either 0 0 or 1 0 The result of a gt b may depend on the platform lexical order or ascii code order Note that due to the standard FORTRAN rule the result of a b is true 1 0 when a abc and b abc You can in
113. isfy the above formula with d 1 As a remedy to this problem CAIN allows d 4 1 The value of d is specified by the keyword TDL times diffraction limit in LASER command However this remedy is only a stopgap It is presumably sufficient for linear Compton scattering but does not give a unique formula for nonlinear scattering So TDL must not be used with LASERQED NPHX0 The formulas 5 78 to 5 84 apply to Gaussian beam When the time space struc ture of the pulse is given by a file F F is replaced by the values read from the file The Lorentz transformation is a little complicated because eq 5 78 is far from a co variant form The particle coordinates and the external fields are transformed immediately when LORENTZ command is invoked and the transformation parameters are forgotten In the case of lasers the transformation is not done immediately but instead the transforma tion parameters are stored When the laser is called at every time step for each particle the particle coordinates are Lorentz transformed back to the frame where the laser was defined and the calculated parameters A w e e e are transformed to the current Lorentz frame Therefore the Lorentz transformation is a little time consuming Limitations e When there are more than one lasers there can be interference effects but these effects are not included in CAIN e When the pulse length is not very long compared with the wavelength there is a
114. lative energy spread Ng Ny Nt Ne Gaussian tail cut off Oa Oy Orbit slope rad Wa Py Crab angle rad Ory Beam roll in the z y plane rad 85 de dt Coherent energy slope 1 m dOtgy de Energy dependence of the focal point Parameter for the travelling focus using energy slope dAzy dt Bunch position dependence of the focal point Parameter for the trav elling focus using crab cavity and sextupole magnet First generate particle variables in usual accelerator coordinate ti or E1 dera de dt t 5 15 5 16 Ly 4 2 7U1P 1 COS P1 NgE1 5 17 2 y 2erU1 br1 az COS p1 sin P1 E1 5 18 Y y 2eyU28y1 COS P2 NyE1 5 19 y y 2 yu2 By ay Cos pa sin pa NY Er 5 20 5 21 5 22 Agyl Any 1 dazy de t1 dazy dt Beyi Bry 1 Crdarzy de tiday dt where r r2 is a Gaussian random number of zero mean and unit standard deviation cut at ni ne uj j 1 2 is a random number of exponential distribution x e cut at u n 2 n 2 and y a uniform random number in 0 27 These variables are then transformed to t to ti 5 23 o Ue COS Day Sin dy Ly 0 t Cee gia 5 24 y Yo Wy i S n Pry COS Pry Yi FN O COS day S N day a ae ee ae Finally the energy momentum is given by E Eo Ever 5 27 E2 m A __ 5 28 p 1 q y Py Ipsly 5 30 where is for right going beam and
115. le can reach the magnet exit sf s lo iff f lt 1 and the particle property tr f yf sf with Ey E Prf pyr Psp in the beamline coordinate at the exit is exactly given by 1 tp t At At a bo sin f Wy xj LCOS lo poll cos Ap p y 1 f cos a 0o a 0o O a Q f gcos ho 2 p k 2 00 p 0 p Po sin po sin sin 0 y y at Y YH E ef el Es E Pes fm Pyf Py Psf 0 BMT equation The spin equation of motion in an inertial frame is given by dS e B eB P wnt nnn oh to be compared with the equation for momentum dp eB emMoYo Vo oe Xp wey Xp _ dt my emy Po The BMT equation becomes simple if seen in a frame rotating with angular velocity w around the y axis e e10 cos wt ezo sin wt ez eio Sin wt 39 coswt ez ey d S QxS Q w yae aly Dleyp 2 gt dt p where the components of Q are constant in this frame Thus if the 3x3 rotation matrix corresponding to QAt At already defined is denoted by Moas then the final spin component in the beamline coordinate is Sef cosy 0 sing Sx Syf 0 1 0 Mon Sy 5 Yi wAt Ao Ss f sinp 0 cosy Ss 91 5 5 4 Quadrupole Magnets Since an exact solution is hard the linear approximation employed in many accelerator codes is used The edge effects are ignored When a particle enters the magnet character ized by the inverse focal length
116. list of array names with their sizes are printed 3 23 9 Write the cpu time Print the cpu time since the job start Syntax PRINT CPUTIME LONG i LONG Print cpu time in major subroutines Otherwise the total only 3 24 PLOT Plot using TopDrawer Following is the list of possible forms of PLOT commands PLOT HISTOGRAM Histogram of particles Sec 3 24 1 PLOT SCATTER Scatter plot of particles or laser photons Sec 3 24 2 PLOT TSTPARTICLE Plot test particle data Sec 3 24 3 PLOT LUMINOSITY Differential luminosity Sec 3 24 4 PLOT BBFIELD Charge distribution and beam field Sec 3 24 5 PLOT BLOPTICS Beamline optics Twiss paramewters Sec 3 24 6 PLOT BLGEOMETRY Beamline geometry Sec 3 24 7 PLOT FUNCTION Function expressed by expression Sec 3 24 8 3 24 1 Histogram of particle data Syntax PLOT HISTOGRAM NONEWPAGE RIGHT LEFT KIND k k k2 INCP LOST SELECT f 1 H fe V fy HSCALE 2min Zmaz gt Mbin s VSCALE fmin gt fmax gt HLOG HLINEAR VLOG VLINEAR COLOR color ERRBAR TITLE head title HTITLE bottom title VTITLE left_title FILE filename APPEND 63 NONEWPAGE Do not insert NEWFRAME of TopDrawer so that the figure is written fo on the previous plot on the same file This makes sense when the new plot has the same scale as the previous plot The FILE operand is ignored The default values of the following parame
117. luded yet 5 5 2 Beamline coordinate A beamline has is own coordinate system t x y s which is in general a curvilinear coor dinate different from the Cartesian coordinate of CAIN At present the time coordinate is the same Let us denote the reference orbit by ro s where s is the length measured along the reference orbit from the beamline entrance The unit vector along the orbit is dro s 9 41 Te e4 s 5 41 One must define two vectors e s and e s perpen dicular to e s Since e s 1 its change orbit bending is perpendicular to e s Therefore one can write as de ds M s xes Als e 0 5 42 89 The orientation of e s and e s in the plane perpendicular to e is defined such that the similar equation hold for all three axes de Fe Ms xej j 2y s 5 43 s with the same Q s One can expand M s as 5 44 which defines the curvature radius pz py By using these definitions one can write any point vector near the reference orbit by three numbers x y s as r 7o s Fuesls ye s 5 45 In a bending magnet specified by LENGTH ANGLE 0 ROTATION Q s is written as Ola es sin f e cos p 5 46 By solving eqs 5 41 and 5 43 with eq 5 46 one finds the transportation of the basis vectors and ro s through the bending magnet as Cx cos sing 0 cos 0 sin coso sing 0 Cy ey sino cosd 0 0 1 0 sing coso 0 e 4 47
118. m by p psin0 e cos eg sind 5 174 where e and eg are arbitrary unit vectors perpendicular to ez the unit vector along the initial photon momentum in the center of mass frame The latter is given by w Ww ky w w1 ko w 2w wy we where w k are the energy momentum of the photons in the original frame The value of sin should be computed from b sinh z 2 sinf e sin gt 0 b2 cosh z 20 rather than from cos 0 because the latter is usually very close to unity when w is much larger than the electron rest mass 121 f Then the momentum of the electron in the original frame is calculated by 1 pe pe kp k 1 k 1 Dko 4 5 175 p gt 3 14 1 ka Bi Da 5 175 where k k ky Note that 1 p c w must be computed from e cosh z in order to avoid round off errors g The momentum of positron is computed from the momentum conservation 5 11 2 Virtual almost real photon approximation To treat the Bethe Heitler Landau Lifshitz and the Bremsstrahlung processes the so called almost real photon approximation or equivalent photon approximation or Weizacker Williams approximation is employed An electron is accompanied by virtual photons which look like real photons at ultra relativistic limit They interact with on coming real or virtual photons incoherently Thus the Bethe Heitler and Landau Lifshitz processes above are reduced to the Breit Wheeler
119. mMatrix The calling sequence is common to these functions except BeamMatrix Let us take SigX as an example SigX j k j 1 or2 or 3 k 1 or 2 or 3 returns the horizontal r m s size of right going j 1 or left going j7 2 or both j 3 of the photon k 1 or electron k 2 or positron k 3 beam The particles created by incoherent processes are excluded See below for how to include them There can be one more argument which must be enclosed by a pair of apostrophes a character expression in general like SigX j k f where f is a logical expression for selecting particles It may contain variables of indi vidual particles such as En X etc Then the particles that make f true i e 0 are selected For example SigX 1 2 En gt 1le9 amp amp En lt 2e9 will select right going electrons with energy between 1 and 2 GeV See Sec 3 32 for more detail The reason that f must be enclosed by apostrophes is that f must not be evalu ated immediately but is to be evaluated later individually for each particle When the particle selection argument is given the incoherent particles are included by default If you want to exclude them you should say e g SigX 1 2 En gt 1le9 amp amp En lt 2e9 amp amp Incp 0 When you include incoherent particles only you should of course say Incp 1 The variables Sx Sy Ss are used for the spin of electrons positrons and those Xi1 Xi2 Xi3 for polarization of photons How
120. mensional cubic spline and differentiated to get O Ox and 09 0y Outside the mesh region When a charged particle gets out of the mesh region the field created by it is ignored in CAIN2 42 However the force by the other beam is taken into account even if the particle is outside the mesh region of the other beam To this end CAIN2 42 adopts three methods namely A direct Coulomb force by the charge distribution in the mesh B harmonic expansion in polar coordinate and C harmonic expansion in elliptic coordinate Let wz wy be the total width of the mesh region If it is close to a square or more precisely if 0 8 lt w w lt 1 25 the whole region is divided into three regions O A B as depicted in Fig 5 4 If the mesh region is far from square the whole region is divided 96 Figure 5 4 Regions for cal culating the beam field 0 A into four O A B C as in Fig 5 4b In the region O the mesh is used for calculating the field In other regions the methods mentioned above are used A Direct sum of Coulomb force Since the sum is time consuming this is used only in region A where two other methods fail to converge The method is trivial and given by e Ti ily y a E ne Y y ys 5 Wis 5 65 However this formula is not accurate when the bin size ratio A A is far from unity It is needed to take average over a bin when the bin is close to
121. n The parenthesis may be replaced by or if they match In the case when all the expressions are expected to be floatng type i e not character type the right hand side can be replaced by an array name without subscripts It must be a one dimensional array and its full size is used For example ARRAY a 2 SET a 1 2 a 2 3 command keyword a is equivalent to command keyword 2 3 699 2 2 4 Commands As stated above each command block must start with a command name The present version has the following commands ALLOCATE Memory allocation for big arrays Sec 3 1 FLAG On off flags echo etc Sec 3 2 SET Define user variables Sec 3 3 ARRAY Allocate array variables Sec 3 41 BEAM Define particle beams Sec 3 5 LASER Define lasers Sec 3 6l EXTERNALFIELD Define external static electromagnetic field Sec 3 10 LASERQED Parameters for the laser particle interaction Sec 3 7 Here is some problem since blanck characters in a line after the last non blanck character are ignored For example SET x 0 is line feed is understood as SETx 0 even if there is a blanck character following SET 11 CFQED BBFIELD PPINT LUMINOSITY LORENTZ MAGNET BEAMLINE MATCHING BLOPTICS Parameters for the interaction between particles and constant electro magnetic field beamstrahlung and coherent pair creation Sec 3 8 Method of calculation of the beam field Sec 3 9 Incoherent particle particle interac
122. n and photons Originally it started with the name ABEL in 1984 for the beam beam interaction in eve linear colliders At that time the main concern was the beam deformation due to the Coulomb field and the synchrotron radi ation beamstrahlung Later the pair creation by particle particle collision was added and it was renamed to CAIN when the interaction with laser beams radiation by elec trons positrons and pair creation by photons in a strong laser field was added for the y y colliders CAIN home page is located at http www acc theory kek jp members cain The first version CAIN1 1 2 which was a combined program of modified ABEL and a laser QED code was limited because it could not handle the laser interaction and the ete interaction simultaneously and does not accept mixed ete beams To overcome these problems CAIN2 0 was written from scratch It now allows any mixture of e eT y and lasers and multiple stage interactions The input data format has been refreshed completely The physical objects which appear in the present version CAIN2 42 are particle beams lasers external fields and magnetic beamlines The beams may consist of high energy electrons positrons and photons The direction of the beams is arbitrary but when the Coulomb field is to be calculated for two colliding beams a basic assumption is that each beam must be a beam t e most particles in each beam go almost parallel CAIN assumes the two
123. n the coordinates are transformed back to the CAIN coordinate During the loop the predefined parameter Sb1 contains the current s coordinate analo gous to Time in PUSH ENDPUSH loop It is zero at j 0 and is the location of the exit of j th 1 lt j lt number of magnets magnet The pre defined character variable PrevMag is the name of the previous magnet entr 0 if j 0 and NextMag is the name of the next magnet exit 0 if j n The name of the magnet is followed by a dot and the order of occurence For example the second occurene of QF is QF 2 If you want to separate the name and the occurence id you can say e g SET n Strstr PrevMag Caution name Substr PrevMag 1 n 1 id AtoF Substr PrevMag n 1 e This command is still premature The accuracy is limited for particles very different from the reference particle very low energy particle and oppositely charged particles etc Wait for future improvements e During the loop the beamline coordinate is used instead of the CAIN coordinate Thus the coordinate used in PRINT and PLOT commands is the beamline coordinate However the particles which are excluded by the RIGHT LEFT and KIND operands are left in the CAIN coordinate 56 e You must not use LORENTZ command during the loop Also you must be careful enough in using BEAM command in the loop 3 21 DO CYCLE EXIT ENDDO Do loop Can be nested Three forms are possible
124. ncreased to 16 Also the underscore _ is allowed in parameter names The flags for beamstrahlung and coherent pair creation which had been defined in the BBFIELD command were moved to a new command CFQED constant field QED This is more logical becuase CAIN computes these phenomenon due to the external fields too Acoording to this change CFQED operand was added to CLEAR command Except for this change input data files prepared for CAIN2 40 can be used for CAIN2 42 New commands STORE and RESTORE were added You can store the variables and the luminosity data for later jobs Command PLOT FUNCTION was added Bugs already fixed in the present version There was a bug in CLEAR BEAM command when applied during a PUSH ENDPUSH loop Fixed A bug was found in the file source physics bb bbmain bbkick f in solving the equation of motion under the beam beam force It is a kind of double counting of the beam beam effect Fixed Several bugs were found in DRIFT EXTERNAL command Fixed There was a miss spelled variable in subroutine EVUFN in the directory source control deciph This has been overlooked because of missing IMPLICIT NONE Not very harmful Fixed Total helicity luminosity was not calculated although differential helicity luminosity was A bug in physics lum dlumcal f Fixed PRINT WRITE command did not correctly understand the KIND operand Fixed The polarization sign of the final positron in the subrou
125. ne of A or B or to omit both Note that and are different The dagger f indicates that the operands to the left of it are positional operands 24 The quantities printed in math font in command syntax can be expressions 3 1 ALLOCATE Allocate memory for some of the arrays Dynamic memory allocation has been used since CAIN2 2 Some of the big arrays are allocated near the beginning of run so that you need not re compile the program when large memory is needed Dynamic allocation requires FORTRAN9O but is absolutely needed for Windows version because only the binary is distributed e This command must not be preceeded by other commands except for HEADER and SET commands e If this command is not invoked CAIN allocates the arrays using the default values when the first command other than the above two commands is encountered e This command can appear only once Therefore for example ALLOCATE MP 100000 ALLOCATE MVPH 10000 is illegal Syntax ALLOCATE MP m MVPH Mpn MMAG Mag MBEAMLINE me MBBXY my MLUMMESH me his Maximum number of macro particles Default is 10 uah Maximum number of virtual photons in a time step in a longutudinal slice Default is m 10 Mmag Maximum number of magnets to be defined in MAGNET command Default is 200 Myl Maximum number of beamlines to be defined in BEAMLINE command De fault is 50 Mbp Maximum number of bins for each of x and y for the calculat
126. nnot be log scale PERBIN Luminosity per bin 1 cm sec bin is plotted PERHVAR Luminosity per unit increment of horizontal axis energy is plotted 1 cm sec eV Default is PERBIN More flexible plot is possible with the complicated syntax Syntax PLOT LUMINOSITY KIND k k2 V f NONEWPAGE VSCALE Ymin Ymax VLOG VLINEAR PERBIN PERHVAR COLOR color TITLE top _title HTITLE bottom_title VTITLE left_title FILE f filename APPEND F Defines what is plotted You can use the following variables LO unpolarized luminosity Ln n 1 2 3 4 helicity luminosity Lij i j 0 1 2 3 general polarization luminosity These are in units of 1 cm s bin Or 1 cm s eV if PERHVAR is speci fied Ln Lij is allowed when HELICITY ALLPOL has been specified in LUMINOSITY command The operands KIND PERBIN PERHVAR are the same as in the first syntax The rest is the same as in PLOT SCATTER except for V f The titles are automatically created in the first syntax but not in the second 3 24 5 Plot charge distribution and beam beam field The charge distribution and the beam field data for beam beam interaction are computed at each time step for each longitudinal slice but they are not kept in the memory They can be plotted only at the time moment and for the slice which is being proccessed Thus this command is to be inserted during PUSH loop The slice is specified by the S operand
127. nput data CAIN is not intended for interactive jobs because the computing time is normally more than several minutes Every instruction to the program is given in the input data Two cases a simple e e collision and a y y collider are given here as examples For more detail look at the sections for each command and the example input data files in the directory cain242 in Consider a simple ete collision You have first to define the two beams BEAM RIGHT KIND 2 NP 10000 AN 1E10 EO 500E9 SIGT 1E 4 BETA 1E 2 1E 4 EMIT 3E 12 3E 14 This defines a right going electron KIND 2 beam with the bunch population 1 x 107 energy 500GeV bunch length 100m etc Note that every command must end with a semicolon You can use variables and mathematical expressions see Sec 2 5 For example if you prefer normalized emittance you may write SET ee 500E9 gamma ee Emass emitx 3D 6 gamma emity 3D 8 gamma betax 1E 2 betay 1E 4 sigx Sqrt emitx betax sigy Sqrt emity betay BEAM RIGHT KIND 2 NP 10000 AN 1E10 EO ee SIGT 1E 4 BETA betax betay EMIT emitx emity Emass is a reserved variable and Sqrt is a predefined function sigx and sigy are defined for later use If you like millimeter instead of meter you may say SET mm 1E 3 sigz 0 1 mm BEAM SIGT sigz E Now you know how to define the positron KIND 3 beam Obviously BEAM LEFT KIND 3 will do For calculating the beam beam force you need
128. ns treat only circular polarization 100 linear polarization has also been accepted since CAIN2 35 However for linear laser polarization only the Compton scattering is ready i e the Breit Wheeler process is not ready Moreover the electron spin is ignored in the case of linear laser polarization ALA 5 8 3 1 Kinematics of Nonlinear Compton Process We work in the head on frame where the laser beam and the electron collide head on In the following is an approximation that the electron is ultra relativistic in this frame We use the following notation p kL p k 4 momenta of initial electron laser photon final electron and emitted pho ton respectively Ew E w Energies of initial electron laser photon final electron and emitted photon respectively This should be treated by the CFQED command If users want EXTERNALFIELD command will be rewritten so as to accept varying fields 105 Laser energy parameter 2k p m 4w m Number of absorbed laser photon When an electron with 4 momentum p goes adiabatically into a strong laser field characterized by it behaves as if its momentum called quasi momentum is 2 2 2p ky q p kz P 14 m 5 105 The momentum conservation of the process of n photon absorption is there fore takes the form q nkf q k where q is defined like q with p replaced by p x k ki pkr w E 0 lt a2 lt 1
129. nt 2 The meaning of Piar has been changed since cain2 42 Till cain2 40 the execution used to be stopped when pmax is exceeded 3 Note that fenn slightly larger than 1 is useless even harmful because a small fraction 1 1 fenn of the parent particle will remain as a macro particle causing a waste of computing time In the example above fenn 1 exactly for Y lt 0 8 41 e To treat both initial and new particles probabilistically is meaningless doesn t enhance the events If you are interested only in the photons e lenn 2 3 is recommended In the case of Breit Wheeler e If lenn 2 the initial particle y is treated probabilistically i e it is elim inated with the probability 1 fenn but remain as it was with the proba bility 1 1 fenh e If lenn 3 the new particles e are treated probabilistically i e a pair of the weight wo is generated with the probability 1 fenn 3 8 CFQED Constant Field QED i e the beamstrahlung and coherent pair creation Both the effects of the beam field and the external field are included The angular distribution of the final particles is not included When the polarization flag see below is on all the polarization effects longitudinal and transverse spin of electron positron and linear and circular polarization of photon are included Syntax CFQED BEAMSTRAHLUNG PAIRCREATION POLARIZATION PMAX Pmax gt WENHANCE Wenp gt BEAMSTRAHLUNG PAI
130. o Wns Define the center of mass energy bins in the case of non equal spaced bins Mpin is the number of bins W is the lower edge of the first bin and W is the upper edge of the last bin np must be gt 3 in order to distinguish from the equal space case np must be lt 200 Wer The above two cases can also be specified by a name of an array Warray It must be one dimensional array with no subscript Its full size is used If the size is lt 3 it is understood as Winin Wmax NMbin Otherwise as Wi Woes Eimin Eimar tibia E min A A 2 D differential luminosity dL dE dE Emin Ejmax is the range in eV and nj is the number of bins j 1 for right going beam and j 2 for left going beam Both or none of E1 and E2 have to be specified If none is specified 2 D luminosity is not calculated Default for ni bin is 50 EijNibin i 1 2 Define non equal spaced bins Similar to the case of the center of mass energy Clarray C2array One dimensional array names without subscripts Similar to Warray iy Ay Full horizontal vertical width of the mesh region m The origin is adjusted automatically from time to time 44 Wam Wym Maximum width of the mesh region m If not given w wy is used throughout If given an increased size upto Wym Wym is used when a significant particle fraction gets out of the mesh region defined by Wz Wwy The number of mesh points is determined automatically HELICITY Calculate luminosit
131. o be given by ZMAX Cmax operand of the LASER command Unnecessarily large Cmar may cause memory error or be a waste of computing time e F gives the phase data in units of radian You can use degree here by specifying FFAC 0 01745329 7 180 The sign of the phase is defined such that the electric field is proportional to V Pe 3 6 5 Laser related CAIN functions One can use the CAIN function LaserIntensity to retrieve the laser power density at a specified space time point See Sec 2 6 This may be useful e g when Emar is needed in LASERQED command Another CAIN function is LaserRange to retrieve the range of coodinate where the laser field is non zero See Sec 2 6 for detail 3 7 LASERQED Defines the method and parameters for the calculation of the interaction between lasers and particles See Sec 5 8 2 Sec 5 8 3 and Sec 5 8 4 for more detail on physics 39 As of CAIN2 42 there can be only one LASERQED command for each of Compton and Breit Wheeler processes This means all the lasers must share the same LASERQED command if there are more than one laser Therefore you cannot use circularly and linearly polarized lasers together if you want nonlinear interaction NPH gt 1 This point will be improved in later versions when such a case becomes needed Syntax LASERQED COMPTON BREITWHEELER CIRCULARPOL LINEARPOL NPH n NY n NXI nmg NLAMBDA n NQ n XIMAX maw LAMBDAMAX Amas E
132. of the file the line PD 0 was added Bugfix in drfext f Thanks to A Stahl CHARGO CHARG added just after the line ELSEIF CHARG NE CHARGO THEN Bugfix in cprnd2 f EXPETA EXP DETA EXPETA EXP ETA FCP FCOHP DXDP FMAX CCO WCOHPO FCP FCOHP DXDP FMAX CCO WCOHP1 A 6 CAIN2 31 ELSEIF added DO loop improved DO i 1 2 23 type added Due to this change a comma after DO REPEAT and DO WHILE is now mandatory CYCLE and EXIT added Initial check of nesting DO IF PUSH TRANSPORT added The variables InFileName and InFilePath added A 7 CAIN2 3 e The expression greately improved e Arrays introduced command ARRAY See Sec 2 5 5 PRINT ARRAY added e Logical expression introduced See Sec 2 5 e Character expression introduced see Sec 2 5 6 128 e The command MATCHING added e A new flexible format defined for reading particle files These changes have been done mostly in a backward compatible way but there are a few non compatible changes e The operands GEN and GENERATION in some commands were eliminated syntax like GEN gt 2 does not fit to the new grammer having been replaced by the much more powerful operand SELECT for particle selection See Sec e Character strings such as FILE must be enclosed by apostrophes Old ver sions allowed omitting them if the string did not contain blanck spaces etc e The last optional argument of the beam statistics functions SigX et
133. omitted equivalent to k 1 BesK v x k Modified Bessel function K x x gt 0 DBesK v 1x k Derivative of the modified Bessel function K x x gt 0 BesK13 x k Modified Bessel function Xy 3 x x gt 0 BesK23 x k Modified Bessel function K gt 3 x x gt 0 BesKi13 1 k Integral of Modified Bessel function Ki y3 x gt 0 See eq 5 147 for the definition of Ki Beski53 x k Integral of Modified Bessel function Kisy3 x gt 0 Functions for beamstrahlung and coherent pair creation FuncBS x Y Beamstrahlung function Foo defined in eq 5 145 x 0 lt x lt 1 is the photon energy in units of the initial electron energy Y gt 0 FuncCP z x Spectrum function Fep of coherent pair creation defined in eq 5 161 x 0 lt x lt 1 is the positron energy in units of the initial photon energy x gt 0 21 IntFCP x k Integral of FuncCP x x over 0 lt x lt 1 The total rate of coherent pair creation is given by multiplying by am V3TE See Sec 5 10 k must be 1 or 2 can be omitted if 1 If k 2 the function is multiplied by exp 8 3 x 2 7 Meta expression Some of the CAIN functions e g the beam statistics functions accept an expression en closed by apostrophes as an argument For example as stated above SigX 1 2 En gt 1e9 retrieves 0 of right going electrons with energy above 1GeV If this expression is written as SigX 1 2 En gt 1e9 although gramatically incorrect for
134. ound in the state te is given by 1 f dr w g e The final energy momentum distribution is determined by w J For given I the final polarization vector is see 3 page 254 C g 1 w 1 5 9 Now consider a process involving initial and final electrons summing over other pos sible particles The transition rate is written as dW s farw fi g C HC 5 10 where the subscripts 7 and f denote initial and final variables represents transpose and H is a 3x3 matrix For given the final energy momentum distribution is determined by w f In a Monte Carlo algorithm I is decided by using random numbers according tow f Once T is decided the final polarization is definitely without using random numbers given by Crane ED FED Pres wD FEY 5 11 This expression does not satisfy 1 If one does not allow a macro particle in a mixed state one has to choose a pure state by using random numbers 83 The macro particles which did not make transition must carefully be treated One might say their final polarization is equal to but this is not correct because of the selection effect due to the term f C The probability that a transion does not occur in a time interval At is 1 w f At where the underlines indicates quantities integrated over the whole kinetic range of I Consider an ensemble one macro particle of N real particles having the polarization vector Cia a 1
135. part of the bunch to be focused when it encounters with the head of the on coming bunch The definition of the head is somewhat arbitrary Here it is defined as V3 2c as suggested by uniform distribution but the coefficient should be tweaked so as to give the maximum luminosity In fact it should be zero for zero intensity beams 3 5 2 Read particle data from a file Standard format When you read a file of CAIN defined format standard format MATHEMATICA format FORTRAN NAMELIST the syntax is Syntax BEAM FILE f filename N N NAMELIST fn file name Unit number or name of an existing file For the differece between the two forms See Sec 2 8 N p Maximum number of macro particles to be read in from file If 0 non active Default 0 NAMELIST FORTRAN NAMELIST format Othewise the standard format Reading file stops when one of the following conditions are satisfied e N is reached when N gt 0 e A file line found whose first three characters are END in the case of the standard format Or END TRUE found in the case of the NAMELIST format e End_of_file detected In the case of the standard format the file is assumed to be created by the following FORTRAN statement WRITE 12 16 1X A4 1P12D20 12 KIND GEN NAME WGT 1 TXYS 1 150 9 EPI 150 3 SPINCL I 1 3 Here NAME is blanck unless the particle is a test particle or a lost particle or an incoherent pair p
136. photons but included here because it is common to all the processes The purpose of this parameter is to save computing time The creation of pairs does not take too much computing time but to track 4 There is a known bug PPINT is not effective when LUMINOSITY command is not invoked 46 extremely low energy pairs in a strong beam field is very expensive The worst ones are the pair particles having the sign of charge opposite to that of the on coming beam because they are trapped in the strong field region If you are not interested in them you can eliminate them during the PUSH loop as CLEAR BEAM INCP RIGHT KIND 2 CLEAR BEAM INCP LEFT KIND 3 if the right left going beam is electron positron Syntax Specify individual processes PPINT BW BH LL BREMSSTRAHLUNG RIGHT LEFT ENHANCE fenn BW BH LL BREMSSTRAHLUNG Specify one of Breit Wheeer Bethe Heitler Landau Lifshitz and Bremsstrahlung interactions If more than one of these are needed apply PPINT command repeatedly No default RIGHT LEFT Applies to Bethe Heitler and Bremsstrahlung The Bethe Heitler process has two possible combinations namely y e and e y RIGHT LEFT option specifies the photon is right going or left going or both Default is both The Bremsstrahlung is treated as the interaction between real e and a virtual photon Therefore it also has two possible combinations This operand specifies which beam is the real particle
137. pression so that 2 is identical to 2 0 e Literal character string enclosed by a pair of apostrophes or of double apostrophes 12 e Arithmetic operators e Relational operators lt gt lt gt lt gt lt gt gt lt e Logical operators amp amp e Parenthesis 4 Must match e Parameters variables They are classified as scalar and array or as pre defined and user defined or floating and character string There is no pre defined array as of Cain2 3 e Functions pre defined only The result of an expression is either a double precision floating value or a character string There is no integer type expression Expressions involving character strings will be de scribed later Sec 2 5 6 2 5 1 Operators Arithmetic operators On As arithmetic operators you can use Note that power is indicated by instead of of FORTRAN Relational operators Too many operators are defined lt gt lt gt lt gt lt gt gt lt Among these the members of each of the group lt lt gt gt and lt gt gt lt have the same meaning Results of operation are either 0 0 false or 1 0 true Thus for example 2 x gt y 1 is 1 if z gt y and is l if x lt y Note CAIN does not have integer type variables so that for example the result of SET x 1 5 y 5 x gt 1 is unpredictable Nevertheless
138. prof1sTprof2 prof Number and time range for plotting profile See Sec for more detail about the laser definition n the case when you use predefined profile Gaussian etc F and F are dimensionless see below so that Poo must be given in Watt m When you use a file data the only requirement is that the product Poo x F x F must be in units of Watt m The factor 1 c in the above expression of A may look bizzare but it is to convert 7 given in meter CAIN s general rule into second so that A comes out in Joule 39 3 6 2 Time profile parameters Two cases Gaussian and trapezoidal are available Use files for general shape The two cases are distinguished by SIGT TTOT operands Either one of these has to be specified For Gaussian temporal profile Syntax SIGT 0 GCUTT necue Cy R m s pulse length times velocity of light in power not in field ampli tude meter Ntcut Cut off of longitudinal tail in units of sigmas Default 3 5 In this case the time profile factor is F e020 2 not e 0 00 270 For trapezoindal profile Syntax TTOT 7T 0 TEDGE 7 edge y gt Tici Total pulse length for trapezoidal time structure meter Telge Edge length meter for trapezoidal time structure The flat top length is then Tiot 2Tedge Default 0 i e rectangular shape In this case F is a function whose flat top value is unity 3 6 3 Spatial profile parameters Two cases Gaussian and donut
139. q Tru64 compiler Compaq Fortran 90 The file is written assuming the following rule e This make is to be executed at cain src e All object files 0 are to be stored in cain src obj e All module files mod are to be stored in cain src module e The executable cain exe is to be stored in cain exec For using this Makefile on your system you may have to change the followings e The compile command FC f90 must be adapted to your system e The compiler option FOPT 1 module module module for SAD must states that the module files mod are to be stored in src module module module and when compiling USE statement the same directory must be searched for I module e Also You may have to change all the file names f to 90 The directory cain242 exec contains a csh script file make although the script might be system dependent If it does not work with minor modification you have to write a makefile by yourself make works only when the current directory is cain242 exec You can modify it so that it works anywhere The only problem is that CAIN does not know in which directory you placed him When you compile all the source files you say make all and when compiling only the files you changed you should just say make When make all stopped due to a compilation error make will be enough next time because make all touches all the files at the beginning If make does not work and if you think
140. r expression not accepted Up to 8 characters containing only upper and lower alphabet numbers 0 to 9 and underscore _ Redefined if already exists You cannot eliminate the magnet name once defined l Magnet length in meter Default 0 Can be a meta expression See below 0 Horizontal orbit bending angle in radian positive for bend to x direc tion Default 0 l cannot be zero if 0 0 thin lens bend not allowed 1 2 Entrance and exit edge angle in radian Zero for sector type magnets and e 0 2 for rectangular bend Hard edge assumed equivalent to a thin lens quad with k tane l The edge angle is effective only for thick lens bend i e gt 0 and 8 4 0 Default 0 0 RECTANGULAR Rectangular bend i e e 0 2 Effective when 0 4 0 EDGE need not be specified ky Focusing strength defined by l x e p 0B 0x where e and p are charge and mementum of reference particle This is equal to the inverse focal length Positive for horizontally focusing magnets Default 0 Thin lens is expressed by 0 Can be a meta expression See below Rotation of the magnet around the orbit axis in radian Vertical bends skew quads are expressed by ANGLE K1 and ROTATE A bend with 7 2 bends the orbit downward y direction Default 0 ax ay Magnet half aperture m Not checked if 0 Default 0 0 5You may omit apostrophes in most cases but an error is caused if the name conflicts
141. r relative path can be used but note that CAIN is run in the directory cain exec UNIX version or in the directory where the input file is located Windows version When you specify the unit number FILE f fn must be ascociated to an actual file name in advance before CAIN run or by the command FILE OPEN In this case the file is not closed till the end of CAIN run unless you explicitly close it by FILE CLOSE command Therefore when you use the same unit number in the same run again the new data will be appended APPEND operand is not needed When you specify a file name FILE filename in a command the file is opened with a temporary unit number The file is closed at the end of execution of the command If you want to keep writing onto the same file you have to use APPEND operand except in the first call Otherwise the file will be overwritten Actually in such a case better to use the form FILE f 23 Chapter 3 Commands A command in general has the following structure command name OP 0P2 OPn A command _name is a string consisting of upper case roman letters only There must be one or more than one blanck characters after a command_name before the first operand op is an operand having either one of the following forms a kwd b expr c kwd expr d kwd expr expr Here kwd is a keywaod i e a string consisting of upper case roman letters only which is predefined for each
142. rast to ABEL CAIN does not use the longitudinal coordinate 21 22 attached to the beams 5 2 Particle Variables 5 2 1 Arrays for Particles All the particles photons electrons positrons carry the following variables TXYS i i 0 1 2 3 Particle coordinates in meter Note that in contrast to ABEL the time and the s coordinates are also defined for each particle During tracking by PUSH ENDPUSH command all the particles have basically the same time coordinate an exception is the particles just created whereas in some cases e g after defined by BEAM command after DRIFT S 5 command etc they have different t but same S Also note that in contrast to ABEL s coordinate does not simply change as sy ct but changes according to the instantaneous longitudinal velocity so that longitudinal mixing may occur for low energy or large angle particles EP i i 0 1 2 3 Energy momentum in units of eV eV c SPIN i 1 2 3 The polarization component Sy Sy Ss for electrons positrons and the Stokes parameter 1 E2 E3 for photons S Sy Ss is defined as usual in particle s rest frame Therefore it aquires 80 the Thomas precession under Lorentz transformation by LORENTZ command For defining the Stokes parameter one needs a set of orthonormal basis vectors e e 2 e with the third vector e parallel to the momentum In CAIN the first vector el is taken to be the unit vector along e e e e
143. re spectively The curves for 0 are normalized such that J FopdE E 1 and those for 3 0 are drawn with the same scale as the corresponding 3 0 curves FopKo 3 3 In order to make the spectrum function flatter CAIN introduces the variable y 1 lt y lt 1 instead of E JE 0 lt z lt 1 Ep e y ll a y BG eny ED Y ow 1 anes 5 164 The spectrum function with respect to y then becomes dW am x Fop Ko 3 3 V 30 dx d y 2 gt E c3U x amp 3 Fy x E3 F ez U d y 2 where y 2 is used because the range of y is 2 The constant 5 165 T T a a TEACA 1 35286 is chosen so that F lt 1 for any y x 3 F y x 3 is plotted in Fig 5 11 Now the event generation goes as 1 Compute x and reject if x lt 0 05 the rate is too small 2 Generate a uniform random number 0 lt p lt 1 and compute po c3WappAt 3 Reject if p gt po 4 Generate another uniform random numbers 0 lt q lt 1 and 1 lt y lt 1 and compute F Instead of q one can also use p po 5 Reject if q gt F 6 Accept and compute x from eq 5 164 and E xE E 1 2 E 118 Figure 5 11 Function F y x 3 as a function of y for three values of x 0 3 2 40 and for ty 0 1 The parameter x is indicated by the line mode l X 3 xX 1 mt and amp 3 is by crosses no es y 20 batt am cross for 3 0 o
144. region s lt s lt sa is shined by a laser An electron beam comes from the left and goes through the laser region to created back scattered photons and subsequently goes through a magnetic field region s lt s lt s4 If the interval sa 53 is shorter than the bunch length the bunch head is already in the field region when the tail gets out of the laser region If you use PUSH command you have to track the beam till the end of the magnetic field region Instead you can do more elegantly BEAM Define electron beam LASER Define laser LASERQED Define laser QED parameters PUSH Start push without magnetic field ENDPUSH End push EXTERNALFIELD Define external field DRIFT S s3 Pull back the beam to the plane sz DRIFT S s EXTERNALFIELD Calculate the field effects 3 15 LORENTZ Coordinate transformation shift of origin rotation Lorentz transformation of particle coordinate energy momentum polarization etc Using this command you can trans form a collision at an angle into a head on collision Syntax LORENTZ TxYS At Ax Ay As ANGLE BETAGAMMA 6 AXIS ay y 05 EV vr vys vs NOBEAM RIGHT LEFT KIND k k k2 EXTERNALFIELD LASER At Az Ay As Shift of origin m O Spacial rotation angle radian rotation of the coordinate axis By Lorentz boost parameter 3 x y Boost of the coordinate axis az 0 4 Unit vector along the rota
145. ric field is done in the following way First cut the right left going particles into longitudinal slices the width As is defined by the parameter Smesh Within each slice the following Poisson equation is solved 2mr As where m is the electron mass in units of eV c re the classical electron radius in meters Po x y is the charge divided by the elementary charge per unit transverse area then E is given in units of V m For each slice and for each of right and left going beams a region 2 Ww 2 yetw 2 is selected where e Ye is the center of mass and Ws wy is the width determined by the input parameters The field created by the particles outside this region is ignored Let us name this region O Vo 5 60 A t y 2mp 0 y E O Fast Fourier Transformation In the region O the Poisson equation is solved using the FFT Eq 5 60 can formally be solved as amp r T G r r p r dr G r log r 5 61 00 Divide this region by na x ny grid Within each cell i j i 1 nz j 1 Ny the the density p x y is approximated by Q j AzAy where A Wr Ng Ay Wy Ny and Qj is the total charge in the cell Qi a x y dxdy 5 62 aa in mesh ij where x y is the cell center coordinate Then eq 5 61 becomes a sum over the cells D z yj 5 Gizi j j Qu jr 5 63 q q 95 Figure 5 3 Doubled re gion for FFT The solid frame indicates the dou bled r
146. rol comes to ENDPUSH If 7 lt n make tracking beam beam beamstrahlung laser interaction etc for the time step t lt Time lt t 41 e If 7 lt m returns to PUSH Note that the commands between PUSH and ENDPUSH are executed n 1 times If n 0 the actions taken are to drift all particles to t and to do commands between PUSH and ENDPUSH once If n lt 0 CAIN stops at PUSH with an error message rather than at ENDPUSH 3 14 DRIFT Drift the particles to a certain time or to a certain s coordinate Syntax DRIFT T t DT At S s RIGHT LEFT KIND k k k2 EXTERNALFIELD ty Drift until Time t meter At Drift over time interval At meter 1 Drift to s coordinate s meter In any of the three cases T DT and S the particles may go backwards in time depending on the parameters RIGHT LEFT Drift right or left going particles only k Drift only particles of kind k EXTERNALFILED Take into account the external field When there is only external field without beam interaction DRIFT EXTERNAL is much better more accurate and faster than the PUSH command The difference is that DRIFT EXTERNAL uses an exact solution in a constant field whereas PUSH carries out step by step integration and that PUSH accepts only t as the independent variable while DRIFT also allows s as in most accelerator program codes 48 How to use DRIFT EXTERNAL may be understood by the following example Suppose that the
147. ror in incoherent pair creation when an even enhancement function is used in two step processes like y y e Bug fixes related to character variables In evemplo f ELSEIF LCH GE C_EXP AND LCH LE C_VAR THEN gt ELSEIF LCH GE C_EXP AND LCH LE C_VAR OR LCH EQ C_DOLLAR THEN In evload f After CALL EVARRGET PL 3 IP 0 0 X PL 2 IP ERR1 IF ERR1 NE GOTO 950 2 lines inserted note the first line is two long Must be split into 2 lines CALL FLCHSET2 GSTR X PL 2 IP C 1 X PL 2 IP C 2 X PL 2 IP ERR1 IF ERR1 NE GOTO 940 Also the same 2 lines inserted after CALL EVARRGET ID PL 3 IP IND X PL 2 IP ERR1 IF ERR1 NE GOTO 950 e Bug fix in evarrget f Inserted ERR just after the first RETURN 127 A 5 CAIN2 32 A predefined particle variable Incp added BEAM SINGLEPARTICLE added for adding a particle in the particle list Runge Kutta integration introduced in drift1 f for more accurate computation of PUSH in extenal field but with no beam beam Change of the third argument of the beam statistics functions AvrX etc When the particle selection argument is given the incoherent particles are included by default If not given excluded Destination of MsgFile in Windows version can be a file See Sec 1 2 4 Bug fix in evdefarr f After the line CALL EVARFREE ID inserted IF NARRAY LT ID NARRAY NARRAY 1 Bugfix in Isrgeo f Thanks to K Dobashi After the line PDO 0 near the beginning
148. rray already exists it is once freed and then re allocated The first character must be for character type arrays Lng Define the lower and upper bounds of the subscripts If l is omitted the subscripts start at 1 as in FORTRAN v All the elements of a floating array are initialized by the value v De fault 0 0 This is ignored for character arrays They are initialized by null strings The syntax to deallocate arrays is Syntax ARRAY FREE a ao This is not needed unless you want many arrays or unless your computer memory is very limited Those left unfreed are deallocated automatically at the end of the CAIN run 26 3 5 BEAM Defines a beam Append particles to the existing list There are two ways to create a beam one by specifying the Twiss parameters etc and the other by reading data from a file See Sec 5 1 for the coordinate system 3 5 1 Definition by Twiss parameters Note that the beam is defined on a plane s constant race goal picture rather than on the t constant plane snap shot picture Thus e g the bunch length is a spread in t although in units of meter rather than in s Syntax BEAM RIGHT LEFT KIND k AN N NP N EO Eo TXYS t x0 y s BETA G G ALPHA a Q EMIT e SIGT 0 SIGE 0 GCUT n n GCUTT n GCUTE n GAUSSWEIGHT i ELLIPTIC TUNIFORM EUNIFORM SLOPE 9 0 CRAB 1p7 y ETA 9z ny ETAPRIME 77 7 ES
149. s are available Use files for general shape For Gaussian transverse profile Syntax RAYLEIGH 61 2 GCUT new TDL di d2 B1 82 Rayleigh length in e e direction for Gaussian beam meter Tout Cut off of Gaussian transverse tail in units of sigmas Default 3 5 d d2 Dilatation factor for a laser which is not at the diffraction limit TDL means times diffraction limit This factor is multiplied to the emittance of the laser beam which is z 4r at the diffraction limit See Sec 5 8 1 for more detail Default is di d 1 Note that POWERDENSITY has to define the power density with the TDL parameters included The spatial profile factor F is given explicitly in eq 5 81 For donuts shape beam by an axicon 36 Syntax DONUT AAXICON a BAXICON b FOCALLENGTH f SIGMAO o9 RMAX Pmax gt ZMAX Cmaz DONUT Flag for donut shape created by an axicon See Fig 5 5 for the definition of the geometric parameters The operand POWERDENSITY in this case specifies the power density at the entrance of the axicon The spatial profile at the entrance is assumed to be Gaussian defined by a9 The power Watt integrated over the transverse plane is P 2702 Py 1 ew habs 208 Cabas Outer and inner radius of the axicon 7 Focal length of the lens just after the axicon To Rms radius of the laser beam at the entrance of the axicon Tmaz Cmax Specify the range of laser field VE n lt
150. s a comment unless the is in a literal character string Apart from the above two points i e that a character string must close within a file line and that is effective till the end of the file line the concept of file line is irrelevant Therefore for example continuing the two file lines will give the same results 1 10 ae and the end of a command must explicitly stated by semicolon without relying on the end of line The whole text after the comment part is eliminated is divided into command blocks The end of a command block is indicated by a semicolon if the is not in a literal character string Each command block has the following structure command_name operand operand operand After the command_name before the first operand there must be at least one blanck character unless there is no operand Operands are separated by a comma and the er number of blancks before and after is arbitrary In some commands can be replaced by one or more blancks Unless stated in each command description in the next section the order of operands is arbitrary An operand is either a single keyword a flag or of the form keyword right_hand side A keyword is an alphanumerical string predefined for each command The right_hand_side is just a number or an expression to be explained later or of the form expression expression expressio
151. s an appropriate normalization factor and N de D isi 18 the number of particles of the beam j in the bin i 1y 1s 1 A problem is how to determine the transverse size of the bin A and A is mainly determined by the dynamics they are actually 92 42 43 46 47 58 59 62 63 Fi 52 Bi 40 41 44 45 56 57 60 61 A A 34 35 38 39 50 51 54 55 inosi 8 9 12 13 ies a eee 32 33 36 37 48 49 52 53 Sect ee eee 10 11 14 15 26 27 30 31 ple with n 8 and the 2 3 6 7 re 8 9 12 13 24 25 28 29 EA 21 3 6 7 18 19 22 23 0 1 4 5 16 17 20 21 specified by the user If the bin is too large detail of the distribution is lost whereas if too small statistical error becomes large because each bin will contain only a small number of macro particles CAIN adopts the following way At first determine the size of the whole transverse region W wy such that most particles are contained there Then divide this region into as many bins n x n as allowed by the storage requirement n must be a power of 2 CAIN uses n 128 and count the number of particles in each bin for both beams NY k 0 1 2 n 1 If the number of macro particles in any of the neighbouring 4 bins are less than some number Nmin CAIN adopts 5 for both beams then sum these numbers and put the sum into a larger bin 2A 2A For the example in Fig 5 2 the sum of the bins 12 13
152. s as a user defined variable and must not be the pre defined names If you want to plot a circle for example you would say PLOT FUNCTION PARAMETER t RANGE 0 2x Pi H Cos t V Sin t HSCALE 1 5 1 5 VSCALE 1 2 1 2 Define the range of the parameter 11 4 22 Number of points 1 in the range 11 12 Default n 100 Divide the range uniformly in log scale Otherwise linear Define the line mode meaning a line segment of length l in units of inches followed by a space of length l2 followed by a line l3 etc The whole pattern is repeated For example LINEMODE 0 1 0 1 will cause a dashed line If LINEMODE is not defined or only l is specified a solid line is plotted Other operands are the same as for the histogram You can plot many functions in a frame by using NONEWPAGE option 3 25 CLEAR Clear disable the beam laser etc The first operand is a positional keyword one of BEAM LASER LASERQED LUMINOSITY BBFIELD EXTERNALFIELD CFQED PPINT Clear particles Syntax CLEAR BEAM TESTPARTICLE INCP RIGHT LEFT KIND k k k2 SELECT fse1 TESTPARTICLE Clear test particles 69 INCP Clear particles created by incoherent processes defined by PPINT If none of TESTPARTICLE and INCP is specified normal particles are elimi nated Therefore if you want to eliminate all you need CLEAR command twice CLEAR BEAM TESTPARTICLE INCP CLEAR BEAM or use SELECT operand
153. s equal to the expected number of real photons per real electron In some cases however too many macro photons are created causing the memory overflow or the statistics is too poor due to a small number of macro photons To solve this problem a variable WENHANCEMENT W np is introduced in the CFQED command When Wenn gt 1 more macro photons are created They have the weight smaller than that of the parent electron positron by the factor 1 Wenn However the recoil of electron positron is taken into account only with the probability 1 wen so that their statistical property does not depend on Wen When Wenn lt 1 the event generation goes the same as in the case Wenpn 1 but the final photons are stored in the memory only with the probability Wenn The recoil of electron positron is taken into acount regardless the photon is stored or not Thus if there is no bug Wenn does not cause any physical change 5 10 Coherent Pair Creation 5 10 1 Basic formulas When a high energy photon goes through a strong transverse field it can create a real electron positron pair This process is known as coherent pair creation and is character ized by the parameter E B E E 5 158 A me Bscn mc Esch 116 where E is the energy of the initial photon Bsen and Esen are defined in eq 5 144 The probability of the process is exponentially small x e73 40 when y is small Let us denote the energy and polarization vector
154. s the angle of the polarization plane measured from the e axis counterclockwise Completely polarized states have 1 A single photon is always in a completely polarized state Mixed states may have lt 1 In contrast to the case of electron positron the polarization of a photon with a given momentum cannot be defined by the three numbers one has to define the e axis The most general way is that every macro photon carries its own e axis but this is too much redundant CAIN adopts the convention that e is parallel to e e k k k where k is the photon momentum This is ill defined when k is parallel to e but it will not cause a serious problem For lasers el axis must be specified explicitly Polarization related processes In any process involving polarizations the transition rate or crosssection is given by multiplying the density matrices and by taking the trace Therefore the expressions for the rates are bilinear forms for each polarization vector initial final electron positron or photon The final polarization needs some comments The transition rate is written in general as W gt farw 90 5 8 where I represents the final energy momentum variables and w and g are functions of I The vector itself is not the final polarization Its direction is defined by the setup of the detectors What the term g means is that if one observes the spin direction e le 1 the probability to be f
155. s the particle density functions with kinematic factors and is found in eq 5 49 Since s and s depend on the particles in general we get different coefficients from term to term of eq 5 53 Thus the number of events is written in the form 3 TSS eG Be J dr dt dp dp P sP f 5 55 1 3 0 When the right and left going beams are primary beams the polarization is often uniform i e independent of energy momentum and space time to a good approximation In such a case is simply given by Ls where Loo is the total luminosity and g t is the polarization vectors of the beams Then the number of events is Lo where a is given by eq 5 55 with beam polarization value gf plugged in Let us consider the helicity component in electron electron collision The helicity is approximately and for right and left going particles respectively The crosssections for four possible helicity combinations are O44 000 930 003 033 0 4 000 930 003 033 5 56 O4 000 030 O03 033 l O_ 000 930 903 033 The number of events is written as N 04 4 L444 0 4L t Oj Ly 0 L 5 57 with L 4 z Loo T L30 Los _ L33 L z Loo L30 Loz 33 5 58 L4 Loo L30 Los L33 5 58 I 3 Loo L30 Los L33 The total luminosity is Loo Note that the helicity is for photons Thus if both beams are photons the above expression becomes
156. s without repeating the time consuming calculation You can do the following After ENDPUSH store all the variables and the particle data STORE FILE aaa WRITE BEAM FILE bbb and restore them in the input file for the next job RESTORE FILE aaa BEAM FILE bbb PLOT ges haads y y collider is more complex Three steps e y conversion of right going electron that of left going electron and y y collision are needed You can do these steps in one job or in separate jobs using STORE WRITE and RESTORE BEAM FILE commands The attached example cain242 in NLCggCP i executes the two conversions and NLCggIP i the collision at the interaction point For the conversion you define the lasers in addition to the initial electron beam LASER LEFT WAVEL laserwl POWERD powerd TXYS dcp 0 off 2 dcp E3 0 Sin angle Cos angle E1 1 0 0 RAYLEIGH rlx rly SIGT sigt STOKES 0 1 0 See Sec 3 6 for the meaning of the key words The type of laser electron and laser y interactions has to be specified by LASERQED command LASERQED COMPTON NPH 5 XIMAX 1 1 xi LAMBDAMAX 1 1 lambda LASERQED BREITW NPH 5 XIMAX 1 1 xi ETAMAX 1 1x eta The PUSH ENDPUSH loop is the same as in the ete example After ENDPUSH write all the particle data by WRITE BEAM FILE or if you do not want to include e e collision write the photon data selectively by WRITE BEAM KIND 1 FILE Then read this file in the nex
157. same file For the case XYZ or RZ the temporal profile F is expected to be given in other place operands of LASER command or another ORDER in the same file The following lines define the range of the variables specified in ORDER in the form a A 03 Na where a is one of the characters which appear in ORDER a a2 the first last value and na the number of values Thus the interval is az a1 na 1 The present version accepts equally spaced data only az can be lt a For example if ORDER RZ the lines R ri 12 Np Z Ci 2 ne are expected Input order of R and Z is irrelevant Optional lines to specify the units in the form aFAC c where a is one of the characters which appear in ORDER or P for power density see below or F for phase see below and c is a number These numbers are to be multiplied to get the coordinates in meter or power density in Watt m7 Finally power density data in the form P Pi Pou Ps The data are separated by one or more blanck characters There can be any number of carriage return unless a data is split into two lines These must be aligned as defined by the character order in ORDER The data are in units of Watt m after multiplied by PFAC in the file and or POWERDENSITY in the command Linear interpolation is applied For the case ORDERAL you may optionally define the local propagation direction n in the form for ORDER XYZ or ORDER LXYZ N 111 M111 Nc
158. scripts to be treated as a matching variable Ifit is an array name all the elements of the array are treated as independent variables The variables must be defined prior to MATCHING command The values are used as the initial value for fitting fi Expressions to be made zero Floating or character Always treated as a meta expression The number of ZERO conditions must not exceed the number of variables You can use the beamline functions Twiss parameters etc described in Sec 2 6 3 gi Expressions that must be gt 0 Floating or character Always treated as a meta expression h Function to be minimized Actually CAIN tries to minimize h c where c is defined below The convergence is defined by g ie fit Eog 0 step function CAIN stops if an error occurs during reading the input command When the fitting somehow finishes the above value is set to the predefined parameter Convergence You have to decide to continue or to STOP by checking this variable Also note that the beamline optics is calculated in the case when Convergence is set You need not call BLOPTICS command Example Following example is a FODO cell of phase advance 90 degrees with the quadrupole strengths as the matching variables Starting from the thin lens approximation try matching and print the variables before and after matching and then print the optics SET nu 0 25 1q 0 5 ldrift 4 5 lcell 2 lq ldrift kf 4 lcell Sin Pi nu kd kf PRINT
159. sstrahlung The following processes are included Breit Wheeler v y gt e tet Bethe Heitler yte gt et e e Landau Lifshitz e e gt e e e e Bremsstrahlung e e gt e e y All the processes except for Breit Wheeler are calculated using the virtual photon approximation The circular polarization effect of the initial photons is included in the Breit Wheeler process but all other polarization effects are ignored Particles created by incoherent processes do not contribute in creating the beam field Also note that the parent macro particles do not change by particle particle interaction All these come from the actual situation in linear colliders where the incoherent particles are much less in number compared with the initial particles Syntax Specify virtual photon options PPINT VIRTUALPHOTON LOCAL FIELDSUPPRESSION EMIN Emin LOCAL Flag to adopt local virtual photon i e to ignore the effects due to the finite transverse extent of virtual photons Default is non local FIELDSUPPRESSION Flag to include the virtual photon suppression effect due to strong external fields normally the beam field by the on coming beam This can be effective when LOCAL is not specified See section 3 4 of 6 De fault does not include this effect Enim Minimum energy of final electron positron energies in eV Default is twice the rest mass of electron 1 022 E6 This parameter is not directly related to virtual
160. t Note that the information of the test particle history is stored in contrast to normal particles Thus you can say for example H T to see the trajectory as a function of time The plot may show apparently unphysical features when you apply DRIFT command DRIFT command may be used to pull particles to a certain position or time This does not corresponds to a physical motion Even in such cases test particle coordinates are stored at the end of DRIFT command Moreover in contrast to the PUSH command step by step information of test particles during DRIFT command is not stored because DRIFT command calculates particle trajectories by a single step using exact analytic formulas 3 24 4 Plot the differential luminosity The differential luminosity w r t the center of mass energy can be plotted if defined by LUMINOSITY command and calculated by PUSH command Only the 1 D differential lumi nosity d dW is plotted 2 D differential luminosity d dE dE is not plotted because the TopDrawer available at KEK HP station is not capable of 3 D plot 66 Syntax PLOT LUMINOSITY KIND k k2 FILE filemame APPEND VLOG VLINEAR PERBIN PERHVAR COLOR color ky ke Define right and left going beams When HELICITY operand has been specified in the LUMINOSITY command all the 5 spectrums unpolarized and 4 combinations of helicities come out in 5 separate plots VLOG Log scale of vertical axis The horizontal axis ca
161. t job and simulate the y y collision See Sec 2 for the basic grammer of the input data See Sec 2 4 for a list of all the available commands Chapter 2 Basic Grammer of the Input Data 2 1 System of Units MKSA is used throughout The particle energy and momentum are eV and eV c respec tively An exception is the luminosity which is expressed in cm sec The time e g the laser pulse length time coordinate of particles etc is always expressed in units of meter by multiplying the velocity of light 2 2 Characters Upper and lower case alphabets are distinguished The following characters have special use I a ee Also the following characters are used in mathematical expressions x x lt gt amp Sl C 4 DF The command names and almost all keywords consist of upper case alphabets only Variables may consist of upper lower case alphabets numerical characters and underscore 9 2 3 File Lines and Command Blocks The input data is a collection of file lines Upto 256 characters in a line are read in This limitation can be easily changed by modifying the parameter statement in the main program A literal character string is defined as a string enclosed by a pair either of apostrophes or of double apostrophes See Sec 2 5 6 for more detail The string must close within a file line If a character is encountered the whole text after it to the end of the file line is considered a
162. ters are those in the previous plot so that they need not be specified if the same values are to be used this list includes parameters for PLOT SCATTER etc RIGHT LEFT KIND SELECT FILE MAXNP COLOR H V HSCALE VSCALE HLOG HLINEAR VLOG VLINEAR The following parameters are not inherited from the previous plot HISTOGRAM SCATTER etc INCP LOST TITLE HTITLE VTITLE A problem is the vertical scale for histogram which is determined from the data contents It may not work as you want An expression defining the horizontal variable Following running variables can be used See Sec 2 5 T X Y S En Px Py Ps Sx Sy Ss X11 Xi2 Xi3 Kind Gen Wgt For example H Sqrt Px 2 Py 2 Ps 2 1E6 defines the orbit angle in micro radians Lmin Xmarsyin Minimum and maximum of the horizontal scale and the number of fo bins If omitted the minimum and maximum in the particle data are used fOr Arma aNd Mon 50 HISTOGRAM is intended to plot particle population for each bin but it is also possible to plot other function averaged over each bin by specifying the function fz fmin fmax Range of the vertical axis Normally this is not needed for plotting a histogram but it is better to specify them explicitly if you want to plot other function by the V operand RIGHT LEFT Select right left going particles only k k k2 INCP LOST Tael Select photons k 1 electrons k 2 positrons k 3 only Inclu
163. the field point x y CAIN makes a table for the Coulomb force by a bin A Ay for faster computation B Harmonic expansion in polar coordinate In the region B the following formula is used 0D 00 mai iF E rt 5 B 5 66 eae 1 c a Qh fas dzdy 5 67 Here ro is arbitrary introduced for avoiding overflow underflow The formula is valid for y gt Trae Where Tmas w w2 2 is the maximum radius of the mesh region 97 C Harmonic expansion in elliptic coordinate When w gt wy otherwise exchange x and y the elliptic coordinate u v defined by x f cosh u cos v cosh u iv a iy f y f sinh usin v u gt 0 0 lt v lt 2r 5 68 is used Here f is chosen as f y w w7 2 5 69 The maximum of the radial like coordinate u in the mesh region is 1 Wa FW log 4 5 70 O ae Wy Wy 5 70 which is taken at the four corners Then the expansion of is Ob 00 eee eae eee m 1 u uotiv Qc 5 71 2 sinh m 1 u v g tadu dedy 5 72 Actually there is a finite relation between QZ and QS al m 2 o 20 m 2r 1 c p m 1 uo 1y 2D B The formula converges if u gt uo which corresponds to the region C and B in Fig 5 4b The truncation of the series is defined by the operand NMOM of the command BBFIELD common to the two types of expansions for simplicity 5 8 Laser 5 8 1 Laser Geometry 5 8 1 1 Definition of laser coord
164. there may still be several problems depending on the species of UNIX 4 1 UNIX Version To obtain CAIN by anonymous ftp 1 Go to the web page http 1lcdev kek jp yokoya CAIN 2 Get the source code cain242 tar gz and the manual CainMan235 pdf 4 1 1 Directory Structure The directory structure is shown below cain src many files most of the fortran source files unix source files for unix actually dummy routines of Windows module source files containing MODULEs include all the files to be INCLUDEd obj directory to store objects exec load module shell scripts Hin input data out outputs doc documents 4 1 2 Compilation Since CAIN2 2 FORTRAN9O has been adopted This may be inconvenient to UNIX users no free compiler but it is necessary for using dynamic allocation by standard FORTRAN statements Since only the binary is distributed for Windows version users cannot re compile CAIN with changed array dimension Following steps are needed for compiling CAIN 75 1 If you do not have FORTRAN90 compiler you have to buy one N You may have to change all the file names f in src src unix and src module to 90 depending on your compiler Compile src module flchtype f first 3 4 Then compile other f files in src module 5 Compile all files in src unix and src 6 Link all The directory cain src contains Makefile for make It works on the SAD computer at KEK Compa
165. tine for linear Breit Wheeler process source physics laser nllsr lnbwgn f was wrong Corrected Linear polarization of final photons in the linear Compton scattering was wrong 1 3 used to come out as amp 3 Fixed Following this logic more faithfully CAIN should have adopted the word SYNCHROTRONRADIATION instead of BEAMSTRAHLUNG 131 Bibliography 1 K Yokoya A Computer Simulation Code for the Beam Beam Interaction in Linear Colliders KEK report 85 9 Oct 1985 6 2 16 3 V B Berestetskii E M Lifshitz and L P Pitaevskii Quantum Electrodynamics volume 4 of Course of theoretical Physics second edition translated Pergamon Press 83 102 107 132 Index FtoA ItoA 18 NextMag 15 56 PrevMag Substr ToLower ToUpper Abs ALLOCATE almost real photon 122 Alpha 20 anomalous magnetic moment ArcCos ArcCosh ArcSin ArcSinh 15 ArcTan ArcTanh ARRAY array Atan2 15 AtoF AvrEn AvrPs AvrPx AvrPy 18 AvrS 18 AvrSs AvrSx AvrSy AvrT 18 AvrX 18 AvrXil AvrXi2 AvrXi3 AvrY 18 axicon 37 BBFIELD BBFIELD clear 70 BEAM 27 beam field beam function BEAMLINE beamline beamline coordinate 89 beamline functions BeamMatrix beamstrahlung BEAMSTRAHLUNG clear BesJ BI BesK 21 BesK13 BesK23 BesKi13 BesKi53 21 Bessel function 21 Beta Bethe Heitler process 122 B
166. tion Expanding CainW zip somewhere in your hard drive to get a directory CainW Must be in hard drive since a file cain ini will be created in the same directory No other installation process is needed The directory will contain CainW exe The load module readme txt A short memo for installation example A directory containing an example input data 4 2 2 Directory Structure CainW src many files most of the fortran source files module source files containing MODULE Hwindows files for Windows unix files for unix dummies of windows subroutines These files must not be compiled _include all the files to be INCLUDEd Release contains the load module CainW exe of release version Debug contains the load module CainW exe of debug version Hresource contains the files to create icons tin contains example data Hdoc documents readme txt other files files of project settings The main project file is CainW dsw 4 2 3 Run To run CAIN for Windows e From the DOS prompt say CainW exe input_file_name including the extension CainW exe must be in valid path e Or more conveniently drag and drop the input file icon on to the icon of CainW exe Clicking the icon of CainW exe won t work 4 2 4 Difference of usage from UNIX version e You must not change the variables MsgFile OutFile OutFile2 TDFile from the default values 6 12 12 8 MsgFile will appear on the console OutFile 0utFile2 78
167. tion Sec 3 12 Define what sort of luminosities to be calculated Sec 3 11 Lorentz transformation Sec 3 15 Define a magnet for beamline transportation Sec 3 16 Define configuration of a beamline Sec 3 17 Optics matching of a beamline Sec 3 19 Calculate Twiss parameters of a beamline Sec 3 18 TRANSPORT ENDTRANSPORT Loop for beam transportation along a beamline Sec DRIFT PUSH ENDPUSH Move particles in vaccuum or in external field Sec 3 14 Loop of time steps Sec DO CYCLE EXIT ENDDO Do loop Sec3 21 IF ELSEIFELSE ENDIF If block Sec 3 22 WRITE PRINT PLOT CLEAR FILE HEADER STORE RESTORE STOP END Print on screen or on a file Sec 3 23 Plot using TopDrawer Sec 3 24 Clear data or disable commands Sec 3 25 Open close files Sec 3 26 Define the header for graphic outputs Sec 3 27 Save recall variables and luminosity values Sec 3 28 Stop run Sec 3 30 End of the input file Sec 3 31 The command names may be shortened if not ambiguous Therefore LASERQ is equiv alent to LASERQED This rule applies also to the operand keywords of all commands But does not apply to parameter and function names 2 5 Expressions In the example in Sec 1 1 the right_hand sides of some operands are written in the form of mathematical expressions In general it may contain e Literal numbers such as 2 2 0 3E 5 etc To indicate the exponent any of E e D d Q q may be used Note that there is no integer ex
168. tion axis Need not be normalized exactly Cur vy vs Unit vector along the boost direction Need not be normalized exactly NOBEAM No transformation of particles If specified RIGHT LEFT KIND operands are ignored RIGHT LEFT Select right or left going particles only If omitted both are trans formed k Select only particles of kind k If omitted all species are transformed EXTERNALFIELD Lorentz transformation of external field transformation of the field strength and the boundary LASER Lorentz transformation of lasers 49 The three types of transformations are carried out in the order of the input keywords TXYS ANGLE BETAGAMMA With one LORENTZ command each transformation can be specified at most once Note that for any type the transformation is that of the coordinate axis rather than the particles themselves Thus for example if you say TXYS 0 0 0 1 then the s coordinate of the particles decreases by 1 meter 3 16 MAGNET Defines a magnet to be used in BEAMLINE command Here MAGNET means any element in beamlines such as magnets drfit spaces rf cavities markers etc although at present limited to those expressed by the following parameters One MAGNET command is needed for each element Syntax MAGNET name LENGTH ANGLE 0 EDGE 2 Kt ki ROTATE APERTURE a a RECTANGULAR name Magnet name Must be enclosed by apostrophes General form of characte
169. to tell CAIN about the mesh SET Smesh sigz 2 BBFIELD NX 32 NY 32 WX 8 sigx R sigx sigy 2 7 The definition of the longitudinal mesh Smesh may look bizzarre This is because the same mesh is used for luminosity calculation For computing the ete luminosity you have to say for example LUMINOSITY KIND 2 3 W 0 2 ee 50 WX 8 sigx WY 8 sigy FREP 90 150 if the rep rate is 90 bunches times 150Hz WX and WY define the mesh region See Sec 3 11 Now you are ready to start the collision FLAG OFF ECHO PUSH Time 2 5 sigz 2 5 sigz 200 ENDPUSH will track the beam over the specified time range in 200 steps It is better to turn off the echo before running You can get the transient information e g plot the beam profile during collision by inserting commands PLOT WRITE etc between PUSH and ENDPUSH If you want the beamstrahlung you have to insert CFQED BEAMSTRAHLUNG before PUSH After ENDPUSH you can plot generate TopDrawer input file the ete dif ferential luminosity by PLOT LUMINOSITY KIND 2 3 You can also plot particle distribution For example for plotting the photon KIND 1 energy spectrum PLOT HIST KIND 1 H En 1E9 HSCALE 0 ee 1E9 50 TITLE Beamstrahlung Energy Spectrum HTITLE E0G1 GeV XGX hae H defines the horizontal axis energy in units of GeV in this example Unfortunately the present version creates input data for TopDrawer only You may want different output
170. troduce arrays of character strings in the same way as floating numbers e g by ARRAY a 3 0 5 This only defines a pointer Strings are actually allocated when defined by SET command The elements of an array may have different lengths There are a few functions related to character strings Obviously when the first character of the function name is it returns a character string otherwise a floating number Strlen Length of a character string e g SET n Strlen a AtoF Convert a character string into a floating number e g SET a 1e10 x AtoF a 4 However when this manual says apostrophes can be omitted such as the case of magnet names you cannot use the general form You have to use the name alone or the name enclosed by apostrophes 17 FtoA ItoA Substr Stestr ToUpper ToLower Convert a floating number into a character string A format must be specified like SET a FtoA 5 3 F4 2 which will define a string a 5 30 will be added when the format string is not enclosed by Convert a floating number into a character string after operating Nint For example SET a ItoA 3 2 will create a string a 3 You can optionally specify the format like SET a ItoA 4 2 13 3 which results in a 004 Consult your FORTRAN manual will be added when the format string is not enclosed by Substring Substr a n n gt is the substring
171. ty he Detector helicity of the final electron Zn The argument of the Bessel functions in the following expressions A 1 2 110 Sum over final electron polarization gives 2 2 oo 1 Zn me tE dCi hrhyGsn 5 133 O nal n gt 1 4 2 n 7 The functions Gkn s are defined by 1 1 Gin ain Qu 1 J2_ di 24 5 134 1 u 2 2 EE E 10 5 7 2 PAP 5 135 1 u 2 2 Gan 2u 1 5 Jn 1 Inst 5 136 1 Gan J u 1 22 J2_ J2 232 5 137 qe These formulas can be obtained from those of Fi for the Compton process by the re placement ho 7 e i d B 5 138 This implies v gt 1 l 2 Un gt 4TUun v Un UfUn Zn gt Zr 5 139 For convenience we have changed the sign as Fin gt gt Gin Fon Gon Fon gt Gn Fan gt Gan 5 140 Algorithm of Event Generation Because of the threshold behavior of n photon process the algorithm is slightly differ ent from that for the Compton process Gz are 3 argument functions In order to avoid discontinuities due to the n photon threshold following variables in addition to are used in CAIN as the independent variables instead of 7 x q Defined by q 7 1 The n photon threshold is given by q gt 1 n y Defined by x 1 44 1 1 u ny i e y 1 2x 1 1 un The range 0 lt y lt 1 represents electrons with energy lt w 2 and 1 lt y lt 0 those gt w 2 Since Gin and
172. ty to be rejected here is small because G is close to unity Otherwise accept d Calculate y using eq 5 182 and w Ey If LOCAL option is specified stop here and return r 0 0 Otherwise calculate the value of V y from G using eq 5 185 e Generate a random number r3 0 1 and solve the equation r3 V x V y with respect to x This is done by using a table of inverse function of V 124 f Compute p A 2 y A being the Compton wave length g Generate a random number r4 0 1 and compute the photon coordinate r pcos27r4 psin 2774 125 Appendix A History of Revision There can be lots of items in particular bug fixes missing here A 1 CAIN2 42 e Added DEBUGFLAG for debugging purpose Jun 23 2011 e The meaning of PMAX in LASERQED command was changed and a new keyword PSTOP was introduced Jun 25 2011 A 2 CAIN2 40 e Added DALPHADT for travelling focus Sep 10 2009 A 3 CAIN2 35 e PLOT BLGEOMETRY added Apr 22 2002 e Added MBBXY and MLUMMESH in ALLOC command Also a bug in the file rdalloc f that MMAG and MBEALINE in ALLOC command had not been recognized was fixed Nov 20 2002 e Bug fix in vphbf1l f Feb 05 2003 Thanks to K Moenig WRITE TDFL 460 NELEC WGTESUM NPH WGTSUM replaced by WRITE TDFL 460 NELEC NPH WGTESUM WGTSUM e STORE command changed so that the variable MsgFile is not stored and therefore not restored by the RESTORE command This is to avoi
173. ust not be zero If 2 22 the loop is executed once If i lt ig and 23 lt 0 or 24 gt i2 and 13 gt 0 the loop is not executed Don t forget to enclose the numbers by 6 CAIN2 31 introduced the third type DO i Due to this change REPEAT and WHILE are no more positional operands though they should come first As a result you have to put a comma after REPEAT WHILE 57 End of do loop is Syntax ENDDO Do not forget As in FORTRAN CYCLE causes a jump to ENDDO at the deepest nest level lower than or equal to the current level and a return to DO EXIT causes a jump to ENDDO and the end of the loop For example DO i 1 5 DO j 1 10 IF x gt 0 IF y gt 0 EXIT ENDIF ENDIF ENDDO ENDDO will cause the end of the j do loop but the 2 loop still continues A jump getting out of PUSH or TRANSPORT loop is prohibited 3 22 IF ELSEIF ELSE ENDIF Define if block Can be nested Note that THEN is not needed The ELSEIF and ELSE clause may be absent Syntax IF expr expr A logical expression like in IF x gt 0 Any expression is considered to be logical by asigning false for 0 and true otherwise For example the IF statement IF n cause a jump to ELSEIF or ELSE when n 0 For compatibility with old versions the substition operator is treated as in IF and ELSEIF and DO WHILE command Do not forget 3 23 WRITE PRINT Write some data The only difference between W
174. y for every combination of helicity ALLPOL Calculate luminosity for all possible 16 combinations of the spins see Sec 5 6 2 for detail All the LUMINOSITY commands must have the same value of wz Wy Wrm Wym and frep Specify them at the first LUMINOSITY command Note that the longitudinal mesh size which is common to beam beam field and lumi nosity calculations has to be defined by the parameter Smesh by the SET command The luminosity is actually computed by the PUSH ENDPUSH loop The calculated lumi nosity can be referred to by the following functions If during the loop the accumulated luminosity upto that moment is returned Lum k k Luminosity of KIND k k in units of cm sec LumH k k h Helicity luminosity helicity combination h 1 h 2 h 3 h 4 h 0 will give the total luminosity Lum k kp cm sec LumP k k 51 82 Polarization luminosity 0 lt s lt 3 0 lt sz lt 3 See Sec 5 6 2 for definition cm sec LumW k k n Differential luminosity in the n th bin cm sec bin LumWbin k k n Bin center eV of the n th bin If n 0 the number of bins is returned Error if n lt 0 or n is larger than the number of bins LumWbinEdge k k n Bin edge eV of the n th bin 0 lt n lt number of bins n 0 is the lower edge of the first bin and n number of bis is the upper edge of the highest bin
175. you can repeat the second job However keep in mind that these commands are not intended to split a job at arbitrary point Only the user variables luminosity data and particle data can be transfered to later jobs by STORE RESTORE and WRITE BEAM commands 3 29 DEBUGFLAG Set runtime flags for debugging purpose Users should not use this command Added since cain2 42 Syntax DEBUGFLAG ID 2 1 Flag ID 1 lt 1 lt 8 Cleared at start 3 30 STOP Stop CAIN run 3 31 END Indicates the end of input data If absent added at the end of file At the beginning of CAIN run the input file is read through until END or end of file and the command struc ture command names the terminator nest of DO IF PUSH TRANSPORT is checked Thus the grammer beyond END is not checked in contrast to STOP 3 32 Particle selection operand Several commands such as PLOT allow to select particles by using the keywords like RIGHT LEFT KIND A more powerful way is to use SELECT with the operand syntax SELECT fe The function fs is any logical expression involving particle properties coordinate energy momentum etc If it is zero false the particle is not selected The particle variables that you can use in this context is TAs particle time space coordinate m En Px Py Ps energy momentum eV eV c Sx Sy Ss Electron positron spin Xi1 Xi2 Xi3 Photon Stokes parameters 1 2 amp 3 Kind Particle species 1 2 3 for photon
176. ze of arrays However since CAIN2 2 you can dynamically allocate the arrays related to the maximum number of macro particles so that there should be no serious problem If you still want differefent sizes for other arrays please email to mailto kaoru yokoya kek jp 4 2 5 TopDrawer Once you run CAIN on PC you may want to view the TopDrawer output on the same platform An incomplete TopDrawer for Windows is available If you want it in spite of full of bugs and danger go to the ftp site ftp lcdev kek jp pub Yokoya TopDrawW zip It is of course possible to open files explicitly in FORTRAN instead of defining them by shell environment variables as is done now in the go command However this would cause a change of usage in the UNIX side which I do not want I want the source files to be identical except for the two files above 2This is not true with CAIN2 32 79 Chapter 5 Physics and Numerical Methods 5 1 Coordinate One of the basic assumptions of CAIN is that the main part i e the part which con tributes to the beam field dominantly of the high energy beams consists of either almost right going or left going particles The longitudinal coordinate s is the right going direc tion The reason s is used instead of z is only historical since ABEL The x and y axes are perpendicular to s and x y s forms a right handed orthonormal frame The time coordinate t is always multiplied by the velocity of light In cont

Download Pdf Manuals

image

Related Search

Related Contents

Aerocool Dead Silence 12cm  Cooper Lighting Fail-Safe X10 User's Manual  施工説明書 取扱説明書  User's Guide    

Copyright © All rights reserved.
Failed to retrieve file