Home
User`s Manual of CAIN
Contents
1. 1 hap AW AO 5 118 r AP Fin 2 0 sin 2 227 sin AM AW 5 119 a 2 in yA op 02 4040 fan 1 20 sin 6 2 140 AMA 5 120 where A is defined by s do s 1 i np ar sin a2g 2 sin 2 AS F cos peint 2 gt E 5 121 T with arguments fap ap ya E ay kp kp 2 Al z C89 _ ear f 1 L r ra kp kp Al x a is the vector potential A with the phase factor e 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 Nonlinear Breit Wheeler Process 107 k kL p p 4 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 a Laser intensity parameter n Laser energy parameter n k k 2m wrw m n Number of absorbed laser photons x p k k ky w 0 lt x lt 1 u u 1 4x 1 x x 4 1 4 1 1 u 1 lt u lt oo Un Maximum u for given n un nn 1 La Zn Lll 4 1 1 u 9 Lorentz invariant variable defined by O y 4anx 1 z 1 2 4 1 1 5 122 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 akt ha x kr mO e cos ez sin 5 12
2. 0 1 Reject if r gt P d Generate another random number r3 1 1 and solve the equation Za 1 2a2h 1 2i z 1 h tanh z sinh z cosh z r2 G 5 168 21m 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 0 is determined by the sign of ra e Generate another random number rz 0 27 and compute the transverse compo nent of electron momentum by p psin0 e cos eg sin d 5 169 119 where e and ez 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 w k w w k Ca g w 2w w2 where wj kj are the energy momentum of the photons in the original frame The value of sin 9 should be computed from b sinh z 2 A sinf 0 _ _ sin gt 0 b2 cosh z 20 rather than from cos 8 because the latter is usually very close to unity when w is much larger than the electron rest mass f Then the momentum of the electron in the original frame is calculated by 1 pC pc k p k 1 k 1 k m 5 170 p 2 tg eo PE at ae where k k k Note that 1 ple 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
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 2 profiles at different times appear on the same page Nx Ny Eta function m dd Derivative of eta function de dt Coherent energy slope from bunch head to tail 1 m Ox Roll angle of the beam in the x y plane radian da de da de Energy dependence of a This defines the energy dependence of the focal point The focal point in the x y plane for particles with relative energy deviation e is given by B y X daz y de positive if focused beyond the normal focal point This operand together with the coherent energy slope de dt can be used for the travelling focus scheme Cas Gy Cs Polarization vector Default 0 0 0 Note the sign of s 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 3 5 2 Read particle data from a file Standard format When you read a file of CAIN defined format standard format MA
4. COLOR color TITLE top title HTITLE bottom_title VTITLE left_title FILE f filemame APPEND Other operands are the same as for the scatter plot 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 Syntax PLOT LUMINOSITY KIND k ko FILE f filemame APPEND VLOG VLINEAR PERBIN PERHVAR COLOR color k1 ka Define right and left going beams When HELICITY operand has been
5. p 5 45 By solving eqs 5 40 and 5 42 with eq 5 45 one finds the transportation of the basis vectors and ry s through the bending magnet as Cx cos sing 0 cos 0 sin cos sing 0 Cx ey sind cosd 0 0 1 0 sing coso 0 ey 4 46 es Leo 0 0 1 sin 0 cos 0 0 1 es Jo rolso 1 ro so ples so sin 0 1 cos 0 es so cos ey so sinp 5 47 where s is the entrance of the magnet To locate the beamline in the CAIN coordinate system we need ro and ex 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 tan 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 os the body Y Let us assume the body is defined by the horizontal bending angle o for the reference particle with mass mp and momentum pp and the orbit length l so that the curvature radius is p lo 6o Vertical bend is treated by coordinate rotation before and after 89 the magnet Suppose that a particle enters the body at t
6. K 3 3 is plotted in Fig 5 10 as a function of E E The function Fcp is available as a CAIN function FuncCP and its integral over 0 lt E E lt 1 as IntFCP See Sec 2 6 dW Fop K 3 amp 3 5 157 115 Figure 5 10 Function Fop Ko 3 amp 3 for three val ues of x The solid dot dash and dashed curves are for 0 1 1 re spectively The curves for 3 0 are normalized such that J FopdE E 1 and those for 4 0 are drawn with the same scale as the corresponding 3 0 curves FopK2 3 3 5 10 2 Algorithm of event generation The total rate for given is approximately am E y W Wap U U x amp e a e Rtx Ba Gex where 8 _ 16 2 mae i ME O 2 TE In order to make the spectrum function flatter CAIN introduces the variable y 1 lt y lt 1 instead of x E E 0 lt x lt 1 2 lo te v bs I eae C No y 1 v 5 1 sey The spectrum function with respect to y then becomes dW o am ae Fcp Koa 3 3 V3r dx d y 2 E SV S PY X 3 F oU dyz where y 2 is used because the range of y is 2 The constant 5 160 a 1 35286 3 6F 5 6 F 2 3 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 116 Figure 5 11 Function F y x 3 as a function of y for three values of x 0 3
7. e Multiplication by a positive integer like e g 2 a or a 2 which is equivalent to at 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 introduce 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 w
8. 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 K1 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 y 3 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 eliminate the beamline name once defined Present version does not work correctly if re defined Sorry name 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 ang lay Half apert
9. 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 x gt y and is 1 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 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 noo 4 7 lt gt lt gt lt gt se 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 Fi
10. 3 3 SET Defines parameters Syntax SET p a p a 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 li ni lo ne 5 lm tm Fu a Array name to be allocated Obeys the same rule as user defined parameter upto 16 characters If the array already exists it is once freed and then re allocated The first character must be for character type arrays Ly 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 ag This is not needed unless you want many
11. 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 c 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 and possibly other variables You have to define all the 16 varables above Default is all zero except 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 po 1GeV c Then the BEAM command should be SET pO 1e9 BEAM FILE USERDEFINED BEGIN START END END KEYWORD xy 2 T pxy 2 dp CONVER
12. n n nxn e nxn bed 1 cos0 k k n n m w w 2m sin 6 2 cos 0 E A 5 91 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 Z zL 0 lt Zz lt 1 z log w w Ly log 1 A 5 92 cos 1 2 e 1 A 5 93 2The term G is given in eq 4 6 in 4 101 we write the differential crossection as do 2D dz 4rr F Z 5 94 where 1 F z 1 e7 e 7 sin 8 hos 1 e 5 95 A k h gt EP 5 96 Note that 3 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 ie gt ses i sete 1G lt 100 1000 Figure 5 6 Function F Z for h 0 1 for various values of A The total crosssection for given initial momenta and polarizations is given by A Fma A 5 97 1 4 8 ig l 2 1 Fal 37 En is 13 os Let us driefly describe the algorithm of event generation 102 0 85 a L Figure 5 7 Function 5 L FinilA for h 0 1 as a ls function of A
13. x _ et tKy 3 I Kis 5 152 7T When Y is small lt 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 is 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 wWenp 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 wen However the recoil of electron positron is taken into account only with the probability 1 Wenn so that their statistical property does not depend on Wen When Wenn lt 1 the event generation goes the same as in the case Wenn 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 Wen does not cause any p
14. direction meter Mein Cut off of transverse tail in units of sigmas Default 3 5 d da 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 A 4r at the diffraction limit See Sec 5 8 1 for more detail Default is d da 1 Note that POWERDENSITY has to define the power density with the TDL parameters included 35 DONUT Qag Tog bl 00 Tans Gen 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 2708 Ppeak 1 e ste 2 08 Outer and inner radius of the axicon Focal length of the lens just after the axicon Rms radius of the laser beam at the entrance of the axicon Specify the range of laser field VE 7 lt Tmar and Umar lt lt Cmax A table will be created only in this region So time consuming if unnecessarily large 3 6 4 File format The file must be written in the following format e When a character comment 6649 appears in a line the rest of the line is considered as a e The first non comment line must be ORDER a where a is a combination of characters L
15. k n1 Nn2 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 Ey 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 1 n Bin edge of the n th bin of E J 1 or Ez l 2 See LumWbinEdge for the definition of n LumEEH k k n1 n2 h 2 D differential helicity luminosity LumEEP k ky 1 2 51 82 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 ete luminosity say SET mi LumFEbin 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 43 3 12 PPINT Incoherent particle particle interaction such as incoherent pair creation and bremsstrahlung The following processes are included Breit Wheeler v y gt e t et Bethe Heitler ytet 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 approximatio
16. 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 Particle specie t x y s 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 bw ds 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 pz 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 y s At the time when the PUSH command is executed they are first pulled to the intercept on t ty plane where ty is the starting time of the PUSH loop When a BEAM command is inserted 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
17. 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 one 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 F
18. Gen Particle generation 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 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 of 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 I
19. respectively A 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 mE qg pt t ky 1 E m 5 100 2p kr 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 a lt 1 v v zx 1 zx xz v 1 v 0 lt v lt dv 1 v dz Vi Maximum v for given n un NA 1 Ea Maximum z for given n n Up 1 vn ndA 1 E nd di 9 E Aur is the effective energy of initial electron in the laser field Lorentz invariant variable defined by mi 14 1 1 5 101 The photon scattering angle 6 0 0 for backward in the head on frame can be written as 6 mO E 3This should be treated by the CFQED command If users want EXTERNALFIELD command will be rewritten so as to accept varying fields 104 Once x and n are given the final momentuma are given in the head on frame by 2 2 k xp ha a Es z ki mx0 el cos ef sin 5 102 mp4 JER ET 5 103 n gt k P P eee T Here el is a spatial vector perpendicular to p and to kz and e is defined by V a B u Emwvapip kr _ 0 5 1
20. 19 2MB default MP 100000 MVPH Maximum number of virtual photons in a time step in an s slice 80 MVPH 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 z and y for beam beam force calcula tion 88xMBBXY 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 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 75 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 cain235 in with file names having the extension i The file set sent to you may contain some example data The directory cain235 exec contains a csh script file go for execution It works only when the current directory is cain235 exec like make Note that Cmake is always called from go so that you do not need make When you want to run
21. CAIN include the following processes Breit Wheeler y y gt e et Bethe Heitler ytet et e7 e Landau Lifshitz e e gt e e e tet Bremsstrahlung e e gt e e 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 after interaction The polarization change described in Sec 5 2 2 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 p
22. Definition by Twiss parameters o 3 5 2 Read particle data from a file 3 5 3 Single particle 0 a A A A ee 3 5 4 Test pafticles 2 wrk eae kek Bua meek Ghai Sew OP Bee pe ed 10 10 10 10 11 12 13 14 15 15 16 16 18 18 19 19 20 20 21 21 22 3 6 3 7 3 8 3 9 3 10 3 11 3 12 3 13 3 14 3 15 3 16 3 17 3 18 3 19 3 20 3 21 3 22 3 23 3 24 3 25 3 26 3 27 3 5 5 Caution s e sossen aee a e r e eo a ae r a a a 33 LASER s ear pee ia dia AR A a a 33 3 6 1 General laser parameters 253023244444 255508 34 3 6 2 Time profile parameters sure a eo 24245 24 44 0 35 3 6 3 Spatial profile parameters o oo a dsd 35 304 EMETONMAL eras rasa ae AAA 36 3 6 5 Laser related CAIN functions 37 LASERQED gt canepa t 8469 aa a a ale amp a 37 GFQED 2 2444 3 2426s eae a ER ROE ERE SRR Ra ERR Ra ea eo i 39 BBE LELD po aa e Ga a Bs AS GH a MS S Eee Ge G ae 8 40 EXTERNALEFIEED gt oox ea aew ra ea a a a a a he 41 LUMINOSITY ta re io Sk ta Sok RO a es he th er Gen ae 41 IPP UNG carea T au iras e a a A EA ee 44 PUSH ENDPUSH a o oee a o a A e ce pe Ee 45 DRITE Da ech a Meee a ca a A a a 46 LORENTZ es senres ert as gs poa E e a E od 47 MAGNET a 060 00 se a We ey ee ee ee Bl ae ee a es ae 48 BEAMLINE gt ac 04 eadera w a yw Gow Bee do a aa ee we Bo 49 BEOPTIGS Ca dees ec We es ee A we ea ee a ee E a 50 MATCHING 0 6 eee 1 8 gs we ee
23. MATCHING Optics matching of a beamline Syntax MATCHING BEAMLINE name PERIODIC BETA ALPHA az Qy ETA 92 7y ETAPRIME 7 7 VARIABLE v v2 ZERO f1 f2 POSITIVE g9 92 MINFUN h name Name of a defined beamline PERIODIC Periodic condition i e Twiss parameters at the entrance equal to those at exit is applied BETA etc are not needed Bx By 0 x yNa My M Ny Twiss parameters and eta functions at the entrance The default values are all zero so that at least 6 and 2 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 50 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 v Name of a variable scalar floating variable or an element of a floating array or an array name without subscripts to be treated as a matching variable If it 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
24. 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 name Substr PrevMag 1 n 1 id AtoF Substr PrevMag n 1 Caution 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 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 REPEAT and WHILE must be the first operand 4 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 54 Syntax form 1 DO REPEAT m n Number of repetition Can be an expression evaluated when entering the loop n gt 0 n 0 causes a j
25. 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 kj 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 kr k cm sec LumP k ki S1 52 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 Error if n lt 0 or n is larger than the number of bins LumWH k k n h Differential helicity luminosity cm sec bin LumWP k k 51 82 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
26. 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 contrast 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 s 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 1 i 0 1 2 3 Energy momentum in
27. 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 interaction 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 3 20 DRIFT PUSH ENDPUSH Move particles in vaccuum or in external field Sec 3 14 Loop of time steps Sec 3 13 DO CYCLE EXIT ENDDO Do loop Sec 3 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 29 End of the input file Sec 3 30 The command names may be shortened if not ambiguous Therefore LASERQ is equiv al
28. Se ee See eee 50 TRANSPORT ENDTRANSPORT 0 2 2 00200000208 52 DO CYCLE EXIT ENDDO coe aa eee De Re Re e 54 IF ELSEIF ELSE ENDIF a a we e E E 56 WRITE PRINT 6 4 6 3 48 amp OS 4 we e ee ee dde eb hw Dee 56 3 23 1 Write the macro particle data lt 4 es 24 2 45 84244 8 i664 57 3 23 2 Write the beam statistics data pote a4 57 3 23 3 Write the calculated luminosity 58 3 23 4 Write a list of defined magnets o 58 3 23 5 Write the beamline optics acosa eds ao 2 a be ee a 59 3 23 6 Write the beamline geometry 0 o 59 3 23 7 Write the values of parameters and expressions 59 3 23 8 Write a list of all allocated arrays o 60 3 23 9 Write the cpu time e ok rs es aa e ee ee ee a 61 PILOT ed Mee a ee ee e a e le ee io A a 61 3 24 1 Histogram of particle data 2 20 oro eso bp ends 61 3 24 2 Scatter plot of particles or laser photons 63 3 24 3 Plot the test particle data 2 0 000 eee eee 64 3 24 4 Plot the differential luminosity 2 0 44 4 ee amp eee oe as 64 3 24 5 Plot charge distribution and beam beam field 65 3 24 0 Plot beamline optics lt lt ies rio Oe oo Pa ee eee ds 65 3 24 7 Plot beamline geometry o o 66 3 248 Plot GIBCO sses a AA E REA CE ae Se 66 CLEAR corr eared e SL ee ee Boe we ew ee ee BS 67 PILE goo ao rs a eee AR A woe aa
29. Several bugs were found in DRIFT EXTERNAL command Fixed e 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 e Total helicity luminosity was not calculated although differential helicity luminosity was A bug in physics lum dlumcal f Fixed e PRINT WRITE command did not correctly understand the KIND operand Fixed e The polarization sign of the final positron in the subroutine for linear Breit Wheeler process source physics laser nllsr 1nbwgn f was wrong Corrected e Linear polarization of final photons in the linear Compton scattering was wrong 1 3 used to come out as amp 3 1 Fixed 129 Bibliography 1 K Yokoya A Computer Simulation Code for the Beam Beam Interaction in Linear Colliders KEK report 85 9 Oct 1985 6 2 6 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 82 100 100 100 101 105 4 H A Tolhoek Rev Mod Phys 28 1956 277 101 5 Y S Tsai SLAC PUB 5924 Nov 1992 106 6 T Tauchi K Yokoya and P Chen Part Acc 41 1993 29 7 Yabo Liu and Ping He 44 99 130 Index BEAMLINE 49 BLOPTICS 50 MAGNET 48 MATCHING 50 FtoA 18 ItoA 18 NextMag 15 54 PrevMag 15 54 Substr 18 ToLowe
30. The 3 vector is called the Stokes parameter In the standard representation of the Pauli matrices the three components of have the meaning Es Linear polarization along the direction e e y2 gt 0 or e e v2 1 lt 0 Circular polarization Ez Linear polarization along the direction e gt 0 or e lt 0 81 The linear polarization can also be written as cos 26 and sin 2 z gt 0 where z is the magnitude of linear polarization and z modulo 7 is 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 amp 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 e 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
31. 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 Default is 0 0 0 0 ez y s 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 Ta Ty Ts 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 Default is 1 0 0 on Change the vertical scale in the plot with respect to horizontal When Tun gt 1 vertical scale is magnified Default 1 w Magnet full width in meters Dipole magnets appear as a box of width w and quadrupoles as 0 75w Default 1 0 Wh Wy Paper size in inches Default 13 10 f 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 3 24 8 Plot a function Syntax PLOT FUNCTION NONEWPAGE H f V f PARAMETER name RANGE 21 22 7 XLOG XLINEAR HSCALE 2min Zmar VSCALE Ymin Ymac HLOG HLINEAR VLOG HLINEAR LINEMODE 1 l2 COLOR color TITLE top title HTITLE bottom title VTITLE left_title FILE f file name APPEND Tasu Define the function to be
32. and azimuthal scattering angle of the photon dQ Solid angle sin 0d6d m w dw dd E Photon Stokes parameters before and after collision as defined in 3 page 361 The definition of the axis is such that the first axis is parallel to kxk and the third axis is k k for 1 Actually 3 adopts left handed basis after collision so that the first and the second components of are and in 3 Our ED is not 1 5 5 but 1 4 3 100 The range of w is given by lt w Su 5 84 The Compton relation is A A 5 85 The crosssection is given by eq 87 22 in 3 do 1 rae L De L DE L Lyg L EE x P BEP AEP EE PPE PE 7 E gt HF C GTI F a TIE AE GEA 6 86 See Sec 5 2 2 for the meaning of the bars on and 4 The omitted terms are products of three and four among 7 and E Actually we need the terms x x and xox E but they are not found in literature The functions introduced in the above expression are vv ww h 3 sinW0 F sin 0 5 87 W w w w Fii 2cos0 Foo TF 2 COS 0 F33 1 cos 0 5 88 w 1 1 f 1 cos0 kcos k f cos 0 k k cos 0 5 89 m 2 1 g f sin w w k k 5 90 4 See ee 5 90 w w w w sin 0 El G I l cos 0 1 cos n n n n w w 3 lin 2
33. 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 E0 p TXYS t 7 y 5 BETA B 0 ALPHA a a EMIT e SIGT 0 SIGE 0 GCUT m ny GCUTT n GCUTE n GAUSSWEIGHT ELLIPTIC TUNIFORM EUNIFORM SLOPE 6 0 CRAB y y ETA ne My ETAPRIME 7 7 ESLOPE de dt XYROLL 0 DALPHADE da de day de SPIN Cz Cy Cs 5 5 RIGHT LEFT Specify whether the beam is right going or left going R 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 Np 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 I
34. ayAt Al At E E _ oe ee 5 145 a vV3r 1 4Y p p Ac Esch l 1 e dx 9 Ella a ar dy 00 Co 91 3 T 2 3 5 146 111 Figure 5 8 Function G Y y for various values of Y Unpolarized case only The function G Y y is less than or equal to unity for any Y and y It is plotted in Fig 5 8 The photon generation in CAIN proceeds in the following way 1 Calculate pof for given field electron energy and time interval At 2 Generate one random number p which is uniform in 0 1 3 If p gt po reject emitting a photon Otherwise 4 Generate one more random number y uniform in 0 1 5 Calculate G Y y A polynomial approximation is used for K 3 and Kis 3 The relative error is less than 107 6 If p gt poG Y y reject emitting a photon Otherwise 7 Emit a photon whose energy is given by eq 5 143 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 fj 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 The definition of y has changed since ABEL and CAIN2 3 in order to keep high efficiency even when Y is extremely large 6 This must be much smaller than 1 Otherwise the probability of emitting more than one photon during At cannot be ignored The
35. 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 as 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 pr 10 uy 1 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 number of blancks before and after er is arbitrary In some commands c
36. data contents It may not work as you want 61 RIGHT LEFT Select right left going particles only k k1 k2 Select photons k 1 electrons k 2 positrons k 3 only INCP Include particles created by incoherent incoherent processes only Otherwise normal particles only LOST Include particles lost in beamlines See Sec 3 20 Only lost particles are included Otherwise lost particles are not included sei Logical function for selecting particles e g SELECT X gt 0 will select particles with positive x coordinate See Sec 3 31 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 fy 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 Xi1 Xi2 Xi3 Kind Gen Wgt For example H Sqrt Px 2 Py 2 Ps 2 1E6 defines the orbit angle in micro radians Lmin Tmaz Nbin Minimum and maximum of the horizontal scale and the number of bins If omitted the minimum and maximum in the particle data are used fOr Ma a and npm gt 30 HLOG VLOG Log scale of horizontal and vertical axes When HLOG is specified Lmin and Zmar Must be specified explicitly The binning interval will be equal in log scale color Color name allowed in TopDrawer One of the following WHITE RED YELLOW GREEN CYAN BLUE MAG
37. g Z wAt Ao Ssf siny 0 cosy Ss 90 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 k and the magnet length l at t x y s with E pz py Ps ps gt 0 the values at the exit are computed by a Pal Ps Y Py Ps in 0 inh 0 ZAY y ys cosh 9 z 11 xp coss l 0 0 x sinf z cos 0 x y sinh 0 y cosh 0 y SE Ea 1 q ga 1 27 ya Das UsDsf Puf YpPsf Psf 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 r v t It is normalized such that f drdv is the total number of particles in the j th beam The luminosity per crossing is in general given by L y V1 V2 0 X V2 T V1 t Ne T Vo t drdv dvuzdt 5 48 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 1 cosd J n r t no r t drdt 5 49 where 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
38. if you want nonlinear interaction NPH gt 1 This point will be improved in later versions when such a case becomes needed 37 Syntax LASERQED COMPTON BREITWHEELER CIRCULARPOL LINEARPOL NPH nph NY n NXI ng NLAMBDA n NQ n XIMAX ma LAMBDAMAX A maz ETAMAX maw gt PMAX Pmas ENHANCEFUNCTION fenh LENHANCE lenn COMPTON BREITWHEELER Specifies which parameters to define here CIRCULARPOL LINEARPOL Polarization of laser Needed for np gt 1 only Elliptic Nph mE RA Ng Eras Amar max Pmax Ton polarization is not ready when nonlinear effects are needed As of CAIN2 35 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 1 Ng Emax Amaz max are needed When npa gt 1 only longitudinal polarization is considered and the lasers must be circularly polarized by 100 i e amp 3 0 amp 1 Number of abscissa for fin
39. 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 O Y Nica Ne AAA 5 50 la sty isit ix iy ts it ba by Usd where C is an appropriate normalization factor and N cee is the number of particles of the beam j in the bin iz 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 91 42 43 46 47 58 59 62 63 10 11 14 15 Fi 59 Bi 40 41 44 45 56 57 60 61 o E m me 34 35 38 39 50 51 54 55 y f m P es e ad 32 33 36 37 48 49 52 53 a or aa 7 rere 10 11 14 15 26 27 30 31 oat te a 8 9 12 13 24 25 28 29 AAA MEA 2 31 6 7 18 19 22 23 0 1 4 5 ol 11 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 Ws 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 cou
40. m 2r 1 ae Y a f 2 QB a 5 72 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 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 e y s as Vii Via Vis V31 V32 V33 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 7 whose origin is tg Now the relation between e gos and T n is E Va Va Va T Lo n V2 Va Vzz y y 5 75 Vis Vaz V33 S So A plane wave is written in the form in the 7 n C coordinate E RE er 5 76 where k 1 X 27 Xz is the wave number n is the unit vector along the propagation direction of the wave component and Ep is a complex vector perpendicular to n A laser beam is considered to be a superposition of plane waves with
41. maximum po is defined by the keyword PMAX When Y is very large Po is suppressed by the factor 1 4T 3 However in defining At by the number 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 112 1 0 l Figure 5 9 The acception probability in the step 6 van as a function of Y The gt 1 t solid line is the unpolar ized case The dot dashand 044 dotted lines are polarized cases with e2 1 and 7 1 respectively as l 0 0 2 T A T To i Fog i 2 3 1x10 1x10 1x10 1x10 1x10 1x10 5 9 3 Polarization Polarization effects have been added since CAIN2 1 In order to describe polarizations let us introduce an orthonormal basis vector e es e 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 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 es e is dW ae x Fit Cif K1 3 2 Ci 1 Kujalez Ey 2 lec es Sp Kinys Gi Sy e Cieo y Ko 3 5 147 Kale cda Fay kapeng Keys
42. not work with minor modification you have to write a makefile by yourself make works only when the current directory is cain235 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 a minor effort would be enough please write to mailto kaoru yokoyaQ 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 4 1 3 Storage Requirements Dynamic allocation of FORTRAN9O 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
43. objects which appear in the present version CAIN2 35 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 i e most particles in each beam go almost parallel CAIN assumes the two 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 35 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 e 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 throu
44. s 00 s2 00 and cz cy cs 0 0 1 E Electric field components in units of V m Default 0 0 0 Bi 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 e et right going and left going Thus there can be at most 9 LUMINOSITY commands 41 Syntax LUMINOSITY KIND k kj FREP f p W W min gt Wmas Moin gt W Wo Wi Wasin gt N Warray ED Eimin Eimas linit s EL Erp Eris Pi o ELFO Larrosa E2 Eomin Bomas la Navin E2 H20 Fe1 sLenorin s E2 20rrag WX Wel Wam WY w Wym HELICITY ALLPOL keki Particle species of right and left going beams Fr Repetition frequency Hz Used for the luminosity scale only De fault 1Hz W min Wmaz Nbin Parameters for differential luminosity with respect to the center of mass energy W WminiWmaz is the range in eV and Nyin is the number of bins If Wmin Wmaz is not given the center of mass spectrum is not calculated Default for Nyin is 50 Wo W Define the center of mass energy bins in the case of non equal spaced bins Nbin is the number of bins Wo is the lower edge of the first bin and W is the upper edge of the last bin nsin must be gt 3 in order to distinguish from the equal space case Npiy must be lt 200 Warray Th
45. 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 Nmom 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 thoughout 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 S 5 52 V cy y s E Ez Ey Es Br By Bs s 4 2p E Define the range of the field as s1 lt Ct cyy C38 lt S2 Must be s lt s2 Default
46. 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 Picas Wenh Enhancement factor of radiation rate 0 lt Wenn When Wen 1 default macro photons are created such that Mmacroy Mmacroe 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 10 for the formulas and algorithm and for more detail on the enhancement factor 3 9 BBFIELD Define the parameters for the calculation of beam beam field Syntax BBFIELD WX wei WX we1 Weo WXMAX wom1 WXMAX Wem1sWem2 Rer NX nz NY n PSIZE A NMOM ninom Wel Woo Horizontal width of the mesh in meters for right and left going beams If wz is not specified wz2 Wz is adopted No default for wz WamlWam2 If WXMAX is given the with of the mesh region can vary in the range Wr Wgm When the beam fraction outside the range defined by WX and R is significant Note Wem gt We 40 Mty Nemom Aspect ratio Ws Na Wy Ny of the horizontal to vertical mesh
47. to the coordinate data 7 of the file 34 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 Taraf The time multiplied by velocity of light to take snapshop for plotting laser profile In units of meter in the laser coordinate 7 n Tprof1 Tprof2 Nprof Number and time range for plotting profile See Sec 5 8 1 for more detail about the laser definition 3 6 2 Time profile parameters Syntax SIGT 0 TTOT T ot GCUTT Nicut TEDGE Tedge gt 0 R m s pulse length times velocity of light in power not in field ampli tude assuming Gaussian structure meter Nica Cut off of longitudinal tail in units of sigmas for Gaussian time structure Default 3 5 Ting Total pulse length for trapezoidal longitudinal structure meter Either one of SIGT or TTOT must be specified Teige Longitudinal edge length meter for trapezoidal time structure The flat top length is then Tiot 2Tedge Default 0 i e rectangular shape 3 6 3 Spatial profile parameters Syntax RAYLEIGH 81 82 GCUT neut TDL di d2 DONUT AAXICON a BAXICON b FOCALLENGTH f SIGMAO o9 RMAX T maw gt ZMAX Cinacl B1 82 Rayleigh length in e e
48. 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 each 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 vy The 2x2 density matrix p is defined as oe pipt i j 1 2 5 1 where f denotes the Hermitian conjugate and is the average over a particle ensemble Since p is Hermitian and its tra
49. 0 where Ac is the Compton wavelength Bsen Mm e 4 4x 10 Tesla is Schwinger s critical field and Esen CBsen 1 32 x 1019V 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 number of photons per unit time in the interval x dx of the energy fraction x E Eo is am a dW Var oe Foo Kis 3 z Tog 520 5 140 Here a is the fine structure constant and E 1 EEEo 1E 1 z z 5 141 E l 5 JH ES Ye Tl a E Ey E Eo 1 2 is the final electron energy K the modified Bessel function and Ki is its integral Ki z K z dz 5 142 The function 0 is available as a CAIN function FuncBS and so are some of the K s and Ki s See Sec 2 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 _ _ _ 0 lt y lt l1 5 143 ees 5 143 The number of photons during a time interval At in the photon energy range y y dy is then given by dn poG Y y dy 5 144 where Co 1
50. 000 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 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 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 ee 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
51. 04 2 pay a N da where e is the completely anti symmetric tensor e 128 1 is the azimuthal scattering angle in the head on frame its distribution is uniform in 0 27 for circularly polarized laser 5 8 3 2 Case of Circularly Polarized Lasers Transition rate The transition rate per unit time is given by 2 2 00 Ln _ _ _ _ W ae 5 f de 1 he e Fin hr he h e Fon hehe Fon R ht Fon heFm 5 105 0 n 1 hz Laser helicity 1 or 1 hehe Initial and final electron helicities 1 lt he lt 1 hy Final photon helicity Rais Detector helicity of the final particles See section 65 of 3 The total transition rate is sum over he and h 2 2 00 Ln mat a de Fin hrheF on 5 106 4do n 1 0 The functions Fx are defined by ca l EET O 5 107 la E2 n 2 2 1 v n 1 n 1 n A l_uy0al e 2 2 fy _ all 2n 5 7 1 v Jai Jaa 5 08 1 vw y Aa e 1 v 1 lv 1 w 2 Fan te E A in mel 4 Ley 2 da 2 16 Jai si d da 5 0 v 1 Fon J 5 111 5 Lag 2 n 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 105 J s are Bessel functions with the argument z defined by wee E n 2n z14 1 5 112 1E Y Un Un Fin Fon F3n Fan are identical to Din Dan Nin Nin divided by 8 in Tsai s paper 5 although the expre
52. 1 NCCMD ICMD IC CMD IC 1 NCCMD IC Bug fix for test particles P 3 EP 0 3 in addtstp f and also line mode errors in pltstp f scat f 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 error in incoherent pair creation when an even enhancement function is used in two step processes like y y 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 Bug fix in evarrget f Inserted ERR just after the first RETURN A 3 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 selec
53. 2 40 and for 4 0 1 The parameter x is indicated by the line mode and 3 is by crosses no cross for 3 0 1 2 3 4 1 2 3 Reject if p gt po 4 Fly E 0 0 _AAAA lt A A lt A lt AA lt lt lt yey Compute y and reject if x lt 0 05 the rate is too small Generate a uniform random number 0 lt p lt 1 and compute po c3WappAt 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 159 and E xE E 1 x E 7 Compute the final polarization of e from 1 1 Fop K2 3 amp 3 C q hse SO E3 2 x 1l 2x 1 2 F2 3 48 161 The formula for _ is obtained by replacing x by 1 x 8 In the case of rejection the polarization of the photon should be changed according to eq 5 12 En fin E 08381 En fin E2 08362 Es fin s a 1 3 5 162 a am At pl 2 1 E E CN E Tick h a Coa The error of the formula 5 158 does not cause any inaccuracy of event generation but causes inefficiency 117 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
54. 3 r k k l 5 124 p 1 2x k a L mO e cos eg sin d 5 124 Here is the azimuthal scattering angle in a head on frame ef is a spatial vector perpendicular to kz and k and es is defined by VLO b u Swapegk ky _ 0 C2 k kz E E 5 125 These vectors satisfy k es ke 0 ejej 1 j 1 2 Ej Es 0 5 126 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 2 oo lx Es 2 de Gin aC Re h1Gon hyGan 5 127 W n l n gt 1 2 n hy Initial photon helicity 108 hy Laser helicity Ma Final electron helicity e Detector helicity of the final electron Sn The argument of the Bessel functions in the following expressions Za 2n TEV i ae Sum over final electron polarization gives 2 2 1 an va do Gyn hp hyCsn 5 128 Wo nal n gt 1 2 n7 The functions G s are defined by 1 1 Gin zn al u 1 J2_ J24 234 5 129 1 Gan 120 20 7 2 Ua Ja 5 130 Un 1 u 2 2 G3n 2u 1 5 a Cm tee Jayi 5 131 Un 1 Gan za u 1 2x J2 Sisi 23 5 132 T These formulas can be obtained from those of Fkn for the Compton process by the re placement w gt y E gt h gt h Ihe he a183 This implies v gt 1 1 2 Un gt 4run v Un UfUn Zn gt Zn 5 134 For convenience we h
55. 8 5 52 i j 0 where R and L represent the right and left going particles and s 1 for notational convenience 92 The number of events N during a beam collision is obtained by integrating eq 5 52 with an appropriate factor over the momentum the interaction volume and time J dr dt dp dp f 5 53 where f is the particle density functions with kinematic factors and is found in eq 5 48 Since s and s depend on the particles in general we get different coefficients from term to term of eq 5 52 Thus the number of events is written in the form 3 N y Oig aiis Lij far dt dp dp DPS f 5 54 1 3 0 When the right and left going beams are primary beams the polarization is often uniform e independent of energy momentum and space time to a good approximation In such a case is simply given by Laa where Loo is the total luminosity and gf is the polarization vectors of the beams Then the number of events is Lo where a is given by eq 5 54 with beam polarization value sl rE 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 900 T 930 903 033 O_4 000 930 003 T 033 5 55 O 000 O30 Tos O33 O0_ O00 030 903 033 The number of
56. ALINE in ALLOC command had not been recognized was fixed Nov 20 2002 e Bug fix in vphbf1 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 avoid 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 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 2 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 4 2 4 changed See Sec 3 31 124 A predefined particle variable PName added The treatment of SELECT operand in PLOT and CLEAR BEAM commands PLOT BLGEOMETRY added Bug fix of error message in rdall f CMD CICMD IC
57. 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 cain235 out example tdr OutFile on cain235 out example and OutFile2 on cain235 out example out2 If you want a submit job please write an approproate shell script by yourself 4 2 Windows Version You can get the binary module of CAIN for Windows from the ftp site ftp lcdev kek jp pub Yokoya CainW zip It is confirmed to work on Windows 2000 and XP 4 2 1 Installation 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 76 CainW src many files most of the fortran source files module source files containing MODULE windows 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 resource contains the files to create icons in contains example data oc documents readme txt ther files files of pro
58. CS BEAMLINE CELL 51 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 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 Pi 0 2 or ZERO Sin 2 Pi Nu 1 QF Sin 2 Pi 0 2 depending on the region of the phase e CAIN tries to minimize X f 0 9 9 0 step function The expressions in ZERO and POSITIVE should
59. DENSITY in the command Linear interpolation is applied e For the case ORDERAL you may optionally define the local propagation direction n in the form for ORDER XYZ or ORDER LXYZ N Me 111 My 111 Ne 111 ME 211 M211 NE 211 or for ORDER RZ or ORDER LRZ N Nr 111 Nc111 Nry211 N 211 If N does not appear n 0 0 1 is used which means parallel propagation along E3 vector e Then ORDER can appear again to define other dependences For example the first ORDER defines F 7 C and the second defines F r C Of course there can be only one ORDER if it defines F 7 n C or defines F T C r C 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 Ema 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 sec LinComptonSec 5 8 3 and Sec 5 8 4 for more detail on physics As of CAIN2 35 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
60. Drawer 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 User 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 Logi10 2The input file number is set to 5 If you want to change it see the variable RDFL in the file cain235 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 for x gt 0 gt Sgn la 0 forx 0 sept E 1 forx gt 0 1 forx lt 0 cis 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 a
61. ENTA BLACK Note that WHITE appears black and BLACK is invisible top_title etc Title string Must be enclosed by a pair of apostrophes Topdrawer case string can 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 characters 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 There is a subtle problem related to the quote and the double quote For example CAIN recognizes gt as a character but since TopDrawer does not understand so that it is transformed to gt gt gt Tf you want one you have to write which bocomes in the TopDrawer input data and is understand as one single by TopDrawer 62 3 24 2 Scatter plot of particles or laser photons Syntax PLOT SCATTER NONEWPAGE RIGHT LEFT KIND 4 k k2 INCP LOST SELECT fw H fe V f HSCALE Lmin Umar VSCALE Ymin Ymaw s HLOG HLINEAR VLOG VLINEAR COLOR color MAXNP Mmax TITLE top title HTITLE bottom_title VTITLE left_title FILE f file name APPEND Ey An expression defining the vertical variable Ymin Ymax Minimum and maximum of the vertical scale Maximum number of points to be plotted in ord
62. ER 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 59 FORTRAN yi ani Un 151 la 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 11 io and 13 are expressions for initial final and increment values of i If 13 is omitted i 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 fmt fmt 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 execute
63. Fins is less Es y 5 t e a s i than unity and is O 1 un less h is close to 1 and A l is extremely large ea s Fint S Y 0 0 ix10 1x10 ixto ixio 1xi0 1xi0 1x10 1xio 1x10 A 1 Compute the total event rate Py in the given time interval using Cio 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 2 Generate a random number r uniform in 0 1 Reject if r gt Po 3 Compute Fint and multiply it to Py Reject if still r gt Py Otherwise accept Note that the Lorentz transformation of is not needed for the computation of h because amp 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 le Gea im 5 99 Her
64. Fipleri E where Foo is defined in eq 5 140 and the argument of the Bessel functions is z We omit ted the terms involving s and simultaneously which means to ignore the correlation of polarization between the final electron and photon See Sec 5 2 2 for the meaning of bars on and The radiation energy spectrum summed over the final polarization is given by eq 5 140 with Foo replaced by Fo Foo Ky 3 2 Gi 5 148 Since the function G T y with Foo replaced by Fo has still the above mentioned property the same algorithm of generating the photon energy can be used G T y is slightly larger when ez 1 but still G T y lt 1 113 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 1 x 2 E 4 FoC K Cr El 00 1 3 2 T a ev enKinys ex e K2 3 Ja s x K z esta Gs _ a2 Kays e amp Kajs Fa Kuler gi so Irz 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 1 am o V3ry 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 Ce Gi lez e2 Q q
65. H F coshwr u f 4078 0 5 33 where the upper lower sign applies to w wz and fH 101 fag with e being the antisymmetric tensor of rank 4 The classical spin motion of electrons is given by the Thomas BMT equation dS e 1 E ae my va 1 Br a 1 Bz yla T Bex xS 5 34 where a is the coefficient of anomalous magnetic moment and B e B e Br B B e x Bxe 5 35 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 Po 3 y F py 3 VWEr pxB El 5 36 According to V N Baier a 2 ade eo E ie aur aaa sin E 5 dt 5 37 The function a Y a 0 is shown in Fig 5 1 Simple polynomial approximations are used in CAIN 86 0 85 0 64 Figure 5 1 Field dependence l of the anomalous magnetic mo ad ment of electron SS a 0 24 0 0 i ixto 1x10 1x107 1x10 1x10 1x10 5 4 2 Equation of motion under PUSH command 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 i v p P 5 38 n F r p 5 39 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 initia
66. H 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 l 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 P ChKGALL N CLJ at EA 5 136 W 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 hy 1 Pi hi Pa Py Co x GALL k 1 2 5 137 hinen P gt If r lt P decide to create a pair The number of laser photons to absorb is determined from GINT n NY 7 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 ra as in the Compton case Adopt y instead of y if r lt 0 The helicity of electron is given by 2 hLGon T hy Gan he Gin F hrhyG3n 5 138 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 me 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 rr B E TYE T E o p lg TF T Y 5 139 NI w 11
67. 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 Tosi Logical function for selecting particles e g SELECT X gt 0 will select particles with positive x coordinate See Sec 3 31 for more detail 3 23 2 Write the beam statistics data Syntax PRINT STATISTICS INCP SHORT LONG LOST FILE f filemame APPEND 57 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 x y s and E pz Py Ds 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 included Otherwise lost particles are not included f 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 3 Write the calculated luminosity Syntax PRINT LUMINOSITY KIND k k2 FILE f filemame APPEND LUMINOSITY Write calculated luminosity specified by k kz k1 ka Define right and left going
68. NCP 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 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 Feet Logical function for selecting particles See Sec 3 31 for detail Turn off lasers 67 Syntax CLEAR LASER Turn off LASERQED Syntax CLEAR LASERQED i 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 Syntax CLEAR EXTERNALFIELD Turn off CFQED Syntax CLEAR CFQED BEAMSTRAHLUNG COHERENTPAIR 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 m
69. ORTRAN90 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 mm MVPH mMpn MMAG Mag MBEAMLINE mu MBBXY mp MLUMMESH mz is Maximum number of macro particles Default is 10 ic Maximum number of virtual photons in a time step in a longutudinal slice Default is m 10 Mag Maximum number of magnets to be defined in MAGNET command Default is 200 Mo Maximum number of beamlines to be defined in BEAMLINE command De fault is 50 Mob Maximum number of bins for each of x and y for the calculation of the beam beam force Choose a power of 2 Default is 128 me Number of bins for each of x 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 0N 25 SPIN include spin calculation default 0N Sorry spin calculation cannot be avoided consistently in the present version
70. 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 4 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 outputs 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 seseca awe 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 cain235 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 interacti
71. Px AvrPy AvrPs SigEn SigPx SigPy SigPs TestT TestX TestY TestS TestEn TestPx TestPy TestPs LumP LumWP LumWbin LumWbinkdge LumEE LumEEbin LumEEbinEdge LumEEH LumEEP BesJ DBesJ BesK13 BesK23 BesKi13 BesKi53 FuncBS FuncCP IntFCP e Do type sequence in PRINT WRITE command became possible e Maximum number of characters of user parameters is increased to 16 Also the underscore _ is allowed in parameter names e 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 3 can be used for CAIN2 35 Following this logic more faithfully CAIN should have adopted the word SYNCHROTRONRADIATION instead of BEAMSTRAHLUNG 128 e New commands STORE and RESTORE were added You can store the variables and the luminosity data for later jobs e Command PLOT FUNCTION was added Bugs already fixed in the present version e There was a bug in CLEAR BEAM command when applied during a PUSH ENDPUSH loop Fixed e 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 e
72. SION 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 1 h s of the CONVERSION formula In this case the 1 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 31 different from CAIN definition so that it is listed in KEYWORD and the conversion formula T T 1e3 is given Tips y e Blanck spaces in the file data are treated as delimiters Comma and line feed 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 de
73. SOS a dute a Sack Ae dy a a Oe oe ke A Ses 126 AO CAINI 23 oe ae E oe a wa a SS OR Se ES a 127 AT IEEE 127 A8 MAING ey esas cee ns Gedy ee he BAe ky es Bes Be eS He HS He HE SES 127 A9 CAIN 2 c 6 oe oe bine ee eS Di e e 127 A 10 History until the version CAIN2 1b 0 127 Chapter 1 Introduction CAIN is a stand alone FORTRAN Monte Carlo code for the interaction involving high energy electron positron and photons Originally it started with the name ABEL 1 in 1984 for the beam beam interaction in e e 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 e7 e y and lasers and multiple stage interactions The input data format has been refreshed completely The physical
74. THEMATICA format FORTRAN NAMELIST the syntax is Syntax BEAM FILE f filename N N NAMELIST fn filename Unit number or name of an existing file For the differece between the two forms See Sec 2 8 No 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 29 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 x 12 16 1X A4 1P12D20 12 KIND GEN NAME WGT 1 TXYS I I 0 3 EP I I 0 3 SPIN I I 1 3 Here NAME is blanck unless the particle is a test particle or a lost particle or an incoherent pair particle 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 11 4 15 44 12 1PD19 12 In the case of the NAMELIST format the namelist BEAMIN must be ins
75. 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 Sec 3 7 The parameters for a laser can be classified into 3 categories a General parameters such as wavelength peak power density and those defining laser coordinate sytem 7 n C See Sec 5 8 1 for laser coordinate This category includes the parameters RIGHT LEFT POWERDENSITY WAVELENGTH TXYS E3 El and STOKES b Parameters to specify time profile F T of the pulse This includes SIGT TTOT GCUTT and TEDGE 33 c Parameters to specify spatial profile F 7 of the pulse This includes RAYLEIGH GCUT and TDL DONUT and those specifying the donut shape You can specify b and or c by a file defined by the FILE operand The laser profile is determined in the following order I FILE operand has the highest priority If time or space profile is missing it is expected to be given by the command parameters The time profile if not given in the file can be Gaussian or trapezoidal according to whether SIGT or TTOT operand is specified The spatial profile if n
76. User s Manual of CAIN Version 2 35 Apr 30 2003 TeXed on April 30 2003 Contents 1 Introduction 1 1 General Structure of Input Data co bee eae OE ei 2 Basic Grammer of the Input Data 2 System OF Nits oe 20 aaa a A Re e A a A IEEE 2 3 File Lines and Command Blocks 5 0 6560 63 10d 268 re 24 Commands 245 i doeka A Ae ee hee web e ESLER ES eB 2 5 ESPTEBSIONS cria SS eke Oe ES eae Cad a 2 5 1 Operators Coda cue oe AAA A ee A ee ee ed 2 5 2 Predefined parameters o o e e 2 5 3 User defined parameters o o e 2 5 4 Predefined functions 22 lt con 2 sms 25 5 ATAN aa a a AA a 2 5 6 Character expression e ar eses era 2 6 CAIN functions lt lt lt a eee oe ee bbe ee Del a 2 6 1 Beam statistics functions 2 6 br aa br 24 44 2 6 2 Test particle functions 4 s AR SE 2 6 3 Beamline functions 44 6 4 4 6 xs rs ees 2 6 4 Luminosity related function ose 46 Pees we Mae a des 2 6 5 Laser related function 0 2 000000004 e 2 6 0 Special functions sce ss eat amo eh oe ee ee eS E Bee Of Meta eX pressi s 6 2254 ei a A is 548 28 External Piles coed 56324455 44658 A ee ow ee 3 Commands Ol ALLOCATE e c s 6 2 ba Se my ee ar GD a ooh oe es 9 2 FLAG 322i 225 oh Fee awe BRA EEA OE A Pile eo Bio PELS veas es Se Se A Ge eS a O Ses oe aoe Gi OA ARRAY aci n 24 45 ig Sk a oe eee Shh hse Ba ees Ovo BEAM uo aa kde a ro ara ok Goats Bk Ee ee ee A 3 5 1
77. 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 Weiz cker 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 process and the Bremsstrahlung to the Compton process Bethe Heitler y eT Het Landau Lifshitz A y 5 eT Het 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 q dq dn gt Sm 5 171 TU T q w2 y2 lal where qa is the fine structure constant For given w the typical transverse momentum is very small q1 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 d dr a dw p2 22 w dry dn p 2 1 m 5 172 T Ww yY YT 120 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 som
78. X Y Z R These characters mean that the following table specifies the T L X n Y Z V 77 R dependence of the power density The possible combinations are G XYZ RZ LXYZ LRZ rel AS E Pl Flr 1 6 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 IZ IR 1 M IZ 1 N e The following lines define the range of the variables specified in ORDER in the form a A Q2 Na where a is one of the characters which appear in ORDER a a2 the first last value and na the number of values az can be lt a1 For example if ORDER RZ the lines R 11 12 Ny Z Qi 2 ne are expected Input order of R and Z is irrelevant 36 e 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 and cis a number These numbers are to be multiplied to get the coordinates in meter or power density in Watt m2 e Finally power density data in the form P Pin 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 POWER
79. a poi casg reddar date dgtl 89 5 5 4 Quadrupole Magnets si a A AE ES 91 5 0 L minosity se s s egie ek ee A ee ee Ee ee eee ee ee 91 5 6 1 Luminosity Integration Algorithm 6 6440 4 Pasa we a dem 91 040 2 Polarizati n o ero cacata cedeo goes Saxe we e 92 Sof Bean Field s ao Sie dh BS ee ESS A E A ee 94 A AER ENERO 97 Deol Laser Geometry o e es s s po ma ee oa A She 97 5 8 2 Linear Compton Scattering oaoa a 54 8255588 100 5 8 3 Compton Process in a Strong Laser Field 103 5 8 4 Breit Wheeler Process in a Strong Laser Field 107 5 9 Beamstrahl ng es oia a a a 8 110 9 1 Basie formulas ee exis pag d aA apata ea p 110 5 9 2 Algorithm of event generation o oo a a 111 dd Polarization os ai aa A AR d 113 5 9 4 Enhancement factor of the event rate 114 5 10 Coherent Pair Creation 115 5 10 1 Basic formulas 115 5 10 2 Algorithm of event generation es a des 116 5 11 Incoherent Processes 0 118 5 11 1 Breit Wheeler Process 0 0 0 0 0 0 0 0 000000084 118 5 11 2 Virtual almost real photon approximation 120 5 11 3 Numerical methods 0 0 0 0 0 00 0 0 000000084 121 History of Revision 124 AJ CAIN 35 dra bs Be oh bo ae ee e he eee da er 124 A2 CAIN es od td as ada oe ea be A ew 124 A3 CAIN2 32 oo ok osas pda ee we a Oa eo ae ee 125 AA CATNS SL aria see a he gets Carnie a Fes arnt See Bs Wie es EE SS 126 AO GAN
80. air 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 gt 2 There is a known bug PPINT is not effective when LUMINOSITY command is not invoked 44 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 Fon Event rate enhancement factor It is unity when the number of created macro pairs is the same as the expected number of real pairs i e the weight of the pair particle is 1 fenn Default fen 0 1 In using ABEL one had to define the minimum scattering angle and minimum transver
81. al 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 Maximum value of 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 per one time step If the computed probability exceeds Pmazx CAIN of present version stops with a message 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 38 lerik event is generated the created particles are asigned a weight 1 fenn This function is used only during the initialization by LASERQED command Therefore if the expression contains user defined parameters their values at the time of LASERQED command are used Changing them afterwards will not affect the computation Integer 1 or 2 or 3 Defines how to treat macro particles under enhancemen
82. all 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 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 cain235 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 filename 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 or 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 append
83. 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 46 BEAM Define electron beam LASER Define laser LASERQED Define laser QED parameters PUSH sis Start push without magnetic field ENDPUSH End push EXTERNALFIELD Define external field DRIFT S s3 Pull back the beam to the plane s3 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 Aw Ay As ANGLE BETAGAMMA 3 AXIS az y s EV orz vy vs NOBEAM RIGHT LEFT KIND k ki k2 EXTERNALFIELD LASER At Az Ay As Shift of origin m Spacial rotation angle radian rotation of the coordinate axis By Lorentz boost parameter 3 x y Boost of the coordinate axis ax 4y 4 Unit vector along the rotation axis Need not be normalized exactly evz Cuy Cvs 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 bo
84. an 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 expression 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 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 4 BEAM Define particle beams Sec 3 5 LASER Define lasers Sec 3 6 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
85. at 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 electric 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 Y y 2 is selected where e Ye is the center of mass and wz 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 A z y 2T Po z y E Vo 5 59 O Fast Fourier Transformation In the region O the Poisson equation is solved using the FFT Eq 5 59 can formally be solved as amp r f G r r og r dr G r log r 5 60 00 Divide this region by na x ny grid Within each cell i j i 1 Nns j 1 ny the the dens
86. ave changed the sign as Fin Cs Fon Gon Es F G3n Fan i 5 135 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 109 y Defined by z 4 4 1 1 uny ie 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 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 n Amin Nmin 1 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 The functions stored in the array GG k n i 3 l are Gin k 1 and G3 k 2 The integral GINT k n 7 7 1 is calculated as in the Compton case The sum of GINT k n NY j 1 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 NP
87. 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 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 Do Reference momentum in eV c If given print also the field strength in Tesla or Tesla m 58 3 23 5 Write the beamline optics Syntax WRITE BLOPTICS BEAMLINE name FILE f file name al APPEND name Name of a defined beamline The apostrophes 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 beaml
88. bove 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 pa rameters The subscripts are delimited by commas and enclosed by a pair of parenthesis or J or must match 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 sin
89. ce 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 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
90. ce is unity by normalization p can be written as pO 1 60 Trace pa pop 5 2 80 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 e le eP 1 5 3 With the standard representation of the Pauli matrices O can be written as 1 2R c c G Wele asa eT 5 5 and its length is unity 1 CAIN allows lt 1 so that each macro particle is in a mixed state 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 e 1 the probability to be found in the spin te state is given by 1 e 2 The polarization vector obeys the Thomas BMT equation 5 34 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 ph 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 p 1 14 0 Trace po 5 7
91. d as in FORTRAN For example WRITE FORMAT nothing will cause 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 between the two forms See Sec 2 8 3 23 8 Write a list of all allocated arrays Syntax PRINT ARRAY LONG FILE f filename LONG Write the values of array contents Otherwise only a list of array names with their sizes are printed SHere 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 1 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 8 A known bug WRITE i 1 2 FORMAT nothing wont work Instead you can write WRITE nothing i 1 2 60 3 23 9 Write the cpu time Print the cpu time since the job start Syntax PRINT CPUTIME LONG A 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
92. d 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 variables and gt stdstolum dat for luminosity both in exec directory is used The 69 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 scr Here in the PLOT command you can use the variables you defi
93. 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 59 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 WRITE and PRINT is the default destination which is OutFile for WRITE and MsgFile for PRINT Therefore they are identical if FILE 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 indivi
94. dual 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 3 23 4 56 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 is A ccnp dee a A ps 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
95. during the transition the evolution of the polarization is described by the differential equation dg 9 f we 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 83 fAt initial e laser final e final y Beamstrahlung e gt e y LT LT LT Linear laser Compton e laser e y LT LT LT LT Nonlinear laser Compton e n laser e y L L L L or N T N T initial y laser final e Coherent pair y et e7 LT LT Linear laser Breit Wheeler y laser e e LT LT LT Nonlinear laser Breit Wheeler y n laser e e7 L L L initial final pair Incoherent Breit Wheeler y y ette7 L N Incoherent Bethe Heitler ytee et e7 N N Incoherent Landau Lifshitz e e e e et er N N initial final Bremsstrahlung e e e e 7 N N L Longitudinal spin of electron positron or circular polarization of photon T 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
96. e 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 y 47 x 107 and P the power density in Watt m 103 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 versions 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 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 ky p k 4 momenta of initial electron laser photon final electron and emitted pho ton respectively E wy w Energies of initial electron laser photon final electron and emitted photon
97. e included by default If you want to exclude them you should say e g SigX 1 2 En gt 1e9 amp amp En lt 2e9 amp amp Incp 0 When you include incoherent particles only you should of course say Incp 1 BeamMatrix requires two more arguments BeamMatrix a b j k f 1 lt a b lt 8 The returned value is the average of x 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 2 6 3 Beamline functions The functions related to the beamline optics such as and y functions are retrieved by Beta Alpha Eta Etaprime Nu Nu is the phase advance 27 from the beamline entrance Prior to use you must compute the optics by BLOPTICS command The calling sequence of these functions are the same 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 Beta j mag bl_name where J mag bl_name 1 or 2 for x or y respectively Either integer or character expres
98. e 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 Nbin otherwise as Wense Je Petre imas in amia mas abi 2 D differential luminosity dL dE dE Ejmin Ejmaz is the range in eV and Njbin 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 Es j Mibin i 1 2 Define non equal spaced bins Similar to the case of the center of mass energy Clarray 2array One dimensional array names without subscripts Similar to Warray a Me Full horizontal vertical width of the mesh region m The origin is adjusted automatically from time to time 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 wy The number of mesh points is determined automatically HELICITY Calculate luminosity for every combination of helicity ALLPOL Calculate luminosity for all possible 16 combinations of the spins see Sec 5 6 2 for detail 42 All the LUMINOSITY commands must have the same value of Ww Wy Wem Wym and frep Specify them at the first LUMINOSITY command
99. e is located MSGDEST FILE 3It 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 TT 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 size 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 yokoyaCkek 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 4This is not true with CAIN2 32 78 Chapter 5 Physics and
100. eamline 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 included 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 e 5 40 m es s 5 40 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 es s Therefore one can write as de ds Q s xes Als e 0 5 41 88 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 des 4 M s xej J 2 9 8 5 42 s with the same Q s One can expand M s as 5 43 which defines the curvature radius p py By using these definitions one can write any point vector near the reference orbit by three numbers x y s as r rols ze s yey s 5 44 In a bending magnet specified by LENGTH ANGLE 0 ROTATION Q s is written as N s es sind e cos
101. ean to eliminate particles already created 68 3 26 FILE Open close rewind a file The first operand is positional Syntax FILE OPEN CLOSE REWIND ENDFILE UNIT n STATUS status NAME fname ne 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 stringo are concatenated The case string for Top Drawer can be defined by using semicolon as delimiter like HEADER JLC EOCM1 500GeV X X a If header_string is not written the header is cleared 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 fname File unit number or file name When a file name is specified the file is opened with the unit number 98 an
102. ed 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 22 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 Opi OP2 gt 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 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
103. el functions 2 6 1 Beam statistics functions The number of particles that of macro particles the average coordinates energy momentum 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 BeamMatrix The calling sequence is common to these functions except BeamMatrix Let us take SigX as an example SigX j k j 1 or 2 or 3 k Lor 2 or 3 returns the horizontal r m s size of right going j 1 or left going j 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 1e9 amp amp En lt 2e9 will select right going electrons with energy between 1 and 2 GeV See Sec 3 31 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 ar
104. ent 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 expression 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 x e Relational operators lt gt lt gt lt gt lt gt gt lt e Logical operators amp amp e Parenthesis 1 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 ond 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
105. equation d must be unity but actual high power lasers may not satisfy the above formula with d 1 As a remedy to this problem CAIN allows d 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 77 to 5 83 apply to Gaussian beam When the time space struc ture of the pulse is given by a file A A is replaced by the values read from the file The Lorentz transformation is a little complicated because eq 5 77 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
106. er to save the plotting time Randomly selected Default plot all points Nmax 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 Syntax PLOT SCATTER LASERPHOTON NONEWPAGE T t S s MAXNP n H fo gt V f gt HSCALE ni gt masa gt VSCALE iini gt Unies gt HLOG HLINEAR VLOG VLINEAR COLOR color TITLE top_title HTITLE bottom title VTITLE left_title FILE f filemame APPEND t s 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 E Ps TITLE t FtoA Time 1le 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 63 3 24 3 Plot the test particle data Syntax PLOT TESTPARTICLE RIGHT LEFT KIND k k ko H fe V fy HSCALE m n max gt VSCALE Ymin gt Ymaz
107. erted for each particle 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 namelist 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 30 The syntax of the command is Syntax BEAM FILE f filename N N 5 USERDEFINED BEGIN b str END e str TERMINATE t str COMMENT c KEYWORD kw kw2
108. es 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 t0 Yo0 S0 El eiz A Ely 3 Eis E3 ezz i 3y 5 35 A MOMENTUM p0 CHARGE e RIGHT LEFT KIND k k k2 LOSSMONITOR Syntax ENDTRANSPORT name The beamline name You may omit apostrophes to Zo 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 If you specify one of then RIGHT for example the left going P lt 0 in Cain 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 KIND Apply to electrons or positrons only Of course you must not choose photons LOSSMONITOR Activate loss monitor Normally par
109. events is written as N 044l 0 LL p OL La 0 L 5 56 with L Loo Slip L30 Lo3 gt L33 Loy Loo 30 Loz 33 5 57 Lao Loo L30 Log L33 oo L Loo L30 Lo3 L33 The total luminosity is Loy Note that the helicity is for photons Thus if both beams are photons the above expression becomes Lie 3 Loo L20 Loz 22 L_4 q Loo L2 Loz 22 5 58 L4 3 Loo Lo Loz 22 5 58 La 7 Loo Lao 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 57 is not exact because the helicity is defined as p p rather than 93 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 es 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 th
110. ewhat 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 Winin 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 and x wp y The total number of the virtual photons is given by api dy fe Oe MM K x 2adx 5 173 Z a Yvi 5 174 with V x x Ko Ka K o 5 175 When Ymin lt 1 the total number is Q 2 n log Ymin 2 log 2 27 1 log Ta 5 176 T 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 ymin 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 electron
111. f accepted decide how many laser photons to absorb To do so sum up FINT x n NY 7 l 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 ro 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 1 Since we approximate F 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 emitted The helicities of the final photon and electron are calculated from hr Fsn heFan h a 5 115 I Fin hrheFon l el Fin Fon hr Fon ha ia 5 116 Fin hiheFon 106 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 polarization is m 2 was 2b 2 4 w fo fon fingi T fal 5 117 Ez 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 i 0 1 3 are given by 0 2 1 fon
112. fine 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 2 y s P p PysPed SPINKGsys5 55 5 k Particle specie w Weight how many real particles are represented t 2 Y S 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 So Sima 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 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 DysPyeDeds EPI N 55 85589 3 5 32 n name A test particle must have a name consisting of upto 3 characters The name
113. ftp site ftp 1lcdev kek jp pub Yokoya cain235 cain235 tar gz 3 gunzip it you get cain235 tar It is a tar ed file Move it to an appropriate directory 4 untar it by tar xvf cain235 tar Then a new directory cain235 overwritten if already exists will be created under the current directory You may rename the root directory cain235 but not the subdirectories In the following we assume the root directory is cain This new directory contains five subdirectories exec in out src doc The directory doc contains a file readme txt You can also download the manual you are reading from the same home page gzip ed postscript file manual cain235 ps zip 4 1 1 Directory Structure The directory structure is shown below 1 There may be one more directory out0 containing the outputs from example data 2 Or from the ftp site ftp lcdev kek jp pub Yokoya manual cain235 ps zip 13 cain src many files most of the fortran source files unix source files for unix actually dummy routines of Windows odule source files containing MODULES include all the files to be INCLUDEd obj directory to store objects exec load module shell scripts in input data out outputs oc documents 4 1 2 Compilation Since CAIN2 2 FORTRAN90 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 dis
114. gh 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 input 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 ete 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 cain235 in Consider a simple e e 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 101 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 10
115. he 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 fen but remain as it was with the proba bility 1 1 fenn 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 1 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 fenh 1 exactly for Y lt 0 8 39 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 Ji POLARIZATION PMAX Pmax gt WENHANCE Wenn gt BEAMSTRAHLUNG PAIRCREATION 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 Note that the flag SPIN FLAG command must also be on for polarization calculation Pmax Maximum probability of events per one
116. hen 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 n2 is the substring of a from n th charac ter start from 1 to n th character If na is omitted the end of a is used A null string is returned if ng lt ny 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 Bess
117. hoton approximation 120 Eta 19 Etaprime 19 Exp 15 expression 12 59 EXTERNALFIELD 41 46 47 EXTERNALFIELD clear 68 fast Fourier transformation 94 FILE 69 file close 69 file open 69 file rewind 69 fine structure constant 14 FLAG 25 Frac 15 FuncBS 21 111 FuncCP 21 115 Gamma 15 generation 30 80 harmonic expansion 96 397 HEADER 69 helicity 42 43 IF 56 incoherent pair creation 44 118 incoherent pair creation clear 68 incoherent processes 118 installation of CAIN 73 Int 15 IntFCP 21 115 Landau Lifshitz 120 LASER 33 47 LASER clear 68 laser geometry 97 LaserIntensity 20 LASERQED 37 LASERQED clear 68 LaserRange 20 Log 15 log scale 62 64 Log10 15 longitudinal coordinate s 79 longitudinal mesh 41 94 LORENTZ 30 47 Lorentz transformation 47 Lum 20 LumEE 20 LumEEbin 20 LumEEbinEdge 20 LumEEH 20 LumEEP 20 LumH 20 LUMINOSITY 41 LUMINOSITY clear 68 luminosity function 20 43 luminosity integration 91 LumP 20 LumW 20 LumWbin 20 LumWbinEdge 20 Max 15 meta expression 21 49 Min 15 Mod 15 modified Bessel function 21 MsgFile 15 22 MsgFLevel 15 Nint 15 NMacro 18 nonlinear Breit Wheeler process 107 nonlinear Compton process 103 NParticle 18 Nu 19 operator 13 OutFile 15 22 OutFile2 15 22 particle selection 71 Planck s constant 14 PLOT 61 Poisson equation 94 polarization lu
118. hotons 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 Sow Lo fh 5 163 with w p 1 m 1 1 5 164 fo w pe t3 w pe w prc 2m f2 w pee 1 w2 prc 5 189 where 118 w p Energy and momentum of final electron in the center of mass frame E Cosine of the scattering angle 0 of the final electron in the center of mass frame h Product of circular polarizations of the two initial photons The total crosssection is m Caw Tr 6 5 166 where 1 2a 1 1 G fde 2 E ene sinko 2 5 3h 5 167 0 Za a 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 Ogy At w 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 naiv and repeat the following procedure ngj times c Generate a random number r
119. hysical change 114 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 Ey y 5 153 mc Bsen me Esch where E is the energy of the initial photon Bg and Esen are defined in eq 5 139 The probability of the process is exponentially small x e when y is small Let us denote the energy and polarization vector 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 147 E gt E En see E gt E E dE gt EVdE Eata tar amp Es 2 E 2 E i ites A 5 154 3B ELE a Ignoring the terms related to the polarization correlation between the final electron and positron we obtain am dE x l E E E_ dW Fop Ko 3 3 2E E Kajen Cy CJ Ay 3mE Bi Ene E E K 3 9 Fe at Ky1 3 e1 1 2 3 Fe at s155 where Fop is defined as e i Fop Ki Koz 5 156 CP 1 3 2 3 K is the modified Bessel function and Ki is defined in eq 5 142 Their arguments are n defined in eq 5 154 The transition rate summed over the final polarization is amdE V3nE The function Fop
120. ine geometry Syntax WRITE BLGEOMETRY BEAMLINE name TXYS to 2 0 Yo 50 gt E3 y s El PgsTys Ts FILE f filemame APPEND name Name of a defined beamline The apostrophes can be omitted to Zo 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 s Unit vector in CAIN coordinate along the orbit direction of the beam line at the entrance This defines the s axis of the beamline r Ty Ts Unit vector in CAIN coordinate along the radial direction of the beam 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 filemame z l tal 23 FORMAT fmt FORMAT fmt PARAMETER Write values of predefined or user defined parameters or expressions Can be omitted Je File reference number See above for default d Expressions It is safer to enclose each expression by or or 1 It is also possible to write a do type sequence of the form almost like 5 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 PARAMET
121. ity p x y is approximated by Q A A where Az wz nz Ay Wy Ny and Qij is the total charge in the cell Qiy po x y daxdy 5 61 les in mesh ij where x y is the cell center coordinate Then eq 5 60 becomes a sum over the cells Bum gt Gi v 5 7 Qo 5 62 q J 94 Figure 5 3 Doubled re gion for FFT The solid frame indicates the dou bled region for FFT and its left bottom quadrant is the charge region Wr 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 j has to be calculated by taking average over the source cell 1 Gis A Ay S x y in cell ij 2 ogllw 2 y y ldrdy 5 63 This averaging is important when A A is far from unity The convolution in eq 5 62 can be done efficiently by using FFT However if we apply FFT for the finite region wz wy instead of the infinite region in eq 5 60 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 2na
122. ject settings The main project file is CainW dsw 4 23 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 OutFile2 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 ex
123. l 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 DT At S s RIGHT LEFT KIND k ky ho EXTERNALFIELD ty Drift until Time t meter De Drift over time interval At meter S1 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 How to use DRIFT EXTERNAL may be understood by the following example Suppose that the 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 s3 lt s lt s4 If the interval sa s3 is shorter than the bunch length the bunch head is
124. l variables ro pp a simple approximation after the time interval At is Fo F ro po P Po FoAt T ro v py v p At F F ri p p py 4 Fo FijAt r ro u po v p At The error of r by these formulas is estimated by EE inte 87 or Gage 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 na 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 b
125. 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 10 History until the version CAIN2 1b New entries on physics e 2D differential luminosity dL dE dE added 127 e Lorentz transformation of lasers has been added e Field strength 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 Avr
126. m 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 a Figure 3 1 Physical a f charge density dashed 1 0 curve and the simulated density solid for i 0 Son and 1 2 1971 Uniform transverse distribution Default is Gaussian x y distribu tion is a uniform ellips with radii 20 20 where a Veb jay 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 30 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 when there is a crossing angle Default 0 0 Crab angle 0x y 0t 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 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 HSCALE smin smax VSCALE xmin xmax HTITLE S m VTITLE X m
127. mb 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 oP o ily y a l ay 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 the field point zx y CAIN makes a table for the Coulomb force by a bin A A for faster computation B Harmonic expansion in polar coordinate In the region B the following formula is used 00 oe 1 cri J role y e dady 5 66 Here ro is a introduced for avoiding overflow underflow The formula is valid for y gt Tina Where Tmax w w2 2 is the maximum radius of the mesh region 96 C Harmonic expansion in elliptic coordinate When wz gt wy otherwise exchange x and y the elliptic coordinate u v defined by x f cosh u cos v cosh u iv x iy f y f sinh usin v u gt 0 0 lt v lt 2r 5 67 is used Here f is chosen as f w2 w 2 5 68 The maximum of the radial like coordinate u in the mesh region is 1 Wa W ly 2 5 69 uo 3 08 Ws Wy 5 69 which is taken at the four corners Then the expansion of is A E Y e7 m 1 u uo iv a 5 70 m 0 e sinh m 1 u v c m 1 uo dy 5 71 QS F Mlz y sinh u iv dady Actually there is a finite relation between Q8 and QS mi m 2 meor 2ro
128. minosity 92 polarization vector 29 30 79 81 positional operand 24 PPINT 44 predefined function 15 predefined parameter 14 PRINT 56 print array 60 print parameters 59 PUSH 33 45 Rand 15 random number 15 Rayleigh length 35 98 RESTORE 69 rotation 47 running CAIN 76 running variable 14 62 Schwinger s critical field 111 SELECT 71 SET 26 Sgn 15 shift of origin 47 SigEn 18 SigPs 18 SigPx 18 SigPy 18 398 Sigs 18 SigT 18 SigXx 18 SigY 18 Sin 15 Sinh 15 Smesh 15 41 43 94 Sokolov Ternov formula 111 SPIN 26 Sqrt 15 standard format 30 57 statistics of beam 57 Step 15 Stokes parameter 29 30 34 79 STOP 70 STORE 69 Strlen 17 Strstr 18 Tan 15 Tanh 15 tar 73 TDFile 15 22 test particle 19 32 TestEn 19 TestPs 19 TestPx 19 TestPy 19 Tests 19 TestT 19 TestX 19 Testy 19 Thomas precession 80 Thomas BMT equation 81 86 128 Time 14 33 45 time coordinate t 79 TRANSPORT 52 transverse mesh 41 91 Twiss parameter 19 uniform distribution 28 user defined parameter 15 26 velocity of light 14 virtual photon 120 Weizacker Williams approximation 120 WRITE 56 zero padding 95 359
129. n 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 Erin 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 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 extremely low energy pairs in a strong beam field is very expensive The worst ones are the p
130. n any case SELECT if specified applies on the particle subset defined above 11 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 71 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 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 Ayral i i gt average energy of all right going photons 72 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 there may still be several problems depending on the species of UNIX 4 1 UNIX Version To obtain CAIN by anonymous ftp 1 Goto the CAIN home page http www acc theory kek jp members cain and click at cain235 tar gz Then you get cain235 tar gz about 375kB 2 Or directly to the
131. n 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 Syntax PLOT BBFIELD S s S s 52 FILE fn filename APPEND Sy Define the s coordinate Plot for the slice which contains one of s s Upto 5 s s can be specified 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 65 3 24 7 Plot beamline geometry Syntax PLOT BLGEOMETRY BEAMLINE name TXYS to o Yo So gt E3 y s E1 rz fy rs VHRATIO r p MAGWIDTH w PAPER wp 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 Zo
132. n units of meter This is the point where the Twiss parameters are to be defined Default 0 0 0 0 Ds Oy Beta functions m On 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 on R m s bunch length m Default 0 Oz Relative r m s energy spread Default 0 Nz 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 ELLIPTIG TUNIFORM EUNIFORM Pe By Va 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 N macro particles 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 su
133. nStrC T en lo ee 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 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 TS 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 9S 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 c
134. nclosed 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 21 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 K1 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 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 c
135. ned in the previous job If you want different plots 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 STOP Stop CAIN run 3 30 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 10 Exceptions are the two variables MsgFile and MsgLevel They are not stored and hence not restored 70 3 31 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 f The function fse 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 TX Y S 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 amp 1 2 3 Kind Particle species 1 2 3 for photon electron positron
136. nt 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 14 and 15 in the figure on the left corresponds to the bin 3 on the right Otherwise add N UNP 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 Niky Nik 2 Nik 3 N 5 51 where N is the number of particles in the k th bin k 0 1 2 n 1 in n 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 for photons or the polarization vector y s for elec trons positrons Let us denote the three numbers in general by s s1 52 83 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 g D 04386
137. o Ws COS Oz sin dy vy 4 al r 5 23 7 Ce i SIN ry COS Pay y a EN 0 COS dry sin gt a IS a la oo S So 5 25 Finally the energy momentum is given by E Eo Eve 5 26 m s E gt 5 27 P 1 q y Py lps y 5 29 where is for right going beam and 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 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 85 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 p Fp 5 30 dr m dr m ey 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 w s where wi y Va 40 a w iy Va 4b a 5 31 with e 3 3 e a E B b EB 5 32 Then the solution is 1 sinh wt ren Y wow Y a 46 G F
138. oe e 69 HEADER ox 44 26 Se pa OME RS Bee ee Ge oe ae BO 69 3 28 STORE and RESTORE sasos 45 580 e e a a A ES ES EH 69 3 29 STOP rasa AAA PAN OR PA 70 3 30 END 2 6 oe is AAA 70 3 31 Particle selection operand espai PR A 71 Installation 73 4l UNIX Version ce e a eae Via e a AA DSS Ee A a 73 4 1 1 Directory Structure vs ea a A a 73 41 2 Compilation suprime bs acata SE ee ee ae 74 4 1 3 Storage Requirements 2 sees ee hehe eee sr So T AA RUN dera rata a a a ee 76 4 2 Windows Version os 2 4 wa Ge bee ARA 76 4 2 1 Installation ooa aaa ee A ee ees 76 4 2 2 Directory Structure a s s a ae ie a a E Be ee is 76 42 3 RUN x 64d egaa despa a aa A y a 77 4 2 4 Difference of usage from UNIX version 77 4 25 TopDraWer s o ct oise edipa cga een eee O we ee a eS eed 78 Physics and Numerical Methods 79 Sl CUOTAS 40 e A a owe See a ca 79 5 2 Particle Variables oa a so rta sag hada ge drige oe aa 79 Deak Arrays dor Particles s s s 44 amp 444 H04 rd EGS oO 79 ll Description of Polarization e s Sims ecb hw echos BO ew a 80 5 3 Beam Parameters e io das a a a 84 54 Solving Equation of Motion s ssas aso secar esec r era tua 85 5 4 1 Equation of motion under DRIFT EXTERNAL command 86 5 4 2 Equation of motion under PUSH command 87 E o A 88 5 5 1 Beamline Coordinate 24 4 2242 esos ao 88 5 5 2 Beamline coordinate e e eee 88 5 0 3 Dipole Magnets s ss
139. 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 fse H f2 HSCALE mmi Uma gt Mbin s HLOG HLINEAR VLOG VLINEAR COLOR color TITLE head_title HTITLE bottom title VTITLE left_title FILE f filemame APPEND NONEWPAGE Do not insert NEWFRAME of TopDrawer so that the figure is written 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 parameters 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
140. ons 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 1 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 next 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 fs LL LA 9d Also the following characters are used in mathematical expressions e f 2 amp S Lit 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
141. 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 w 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 dimensional cubic spline and differentiated to get 00 0x and 00 0y Outside the mesh region When a charged particle gets out of the mesh region the field created by it is ignored in CAIN2 35 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 35 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 4a If the mesh region is far from square the whole region is divided 95 Figure 5 4 Regions for cal culating the beam field 0 A 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 Coulo
142. orizontal orbit bending angle in radian positive for bend to x direc tion Default 0 l cannot be zero if 9 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 640 Default 0 0 RECTANGULAR Rectangular bend i e e 0 2 Effective when 0 0 EDGE need not be specified ky Focusing strength defined by 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 1 2 bends the orbit downward y direction Default 0 A Magnet half aperture m Not checked if 0 Default 0 0 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 3You may omit apostrophes in most cases but an error is caused if the name conflicts with the operand names e g L is understood as the abbreviation of LENGTH 48 e Higher multipoles
143. ot given in the file is donut shape if DONUT operand is given otherwise Gaussian 3 6 1 General laser parameters Syntax LASER RIGHT LEFT al WAVELENGTH A 7 POWERDENS II Foeni 5 TXYS t 2 y 8 E3 e pa e El e e em STOKES 1 2 3 FILE f filemame SHIFTI A7 SHIFTZ AC PLOTPROFILE TPROFILE Tp of TPROFILE Tprof1 Tprof2 NPROFILE Mprof time profile_params spatial_profile_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 Peak Peak power density Watt m If FILE operand is used P eak is multi plied on the power density values obtained from the file ELY Laser focal point and the time when the laser pulse comes there m e ee Unit vector e along the direction of laser propagation e ee Unit vector el 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 e by Schmidt orthogonalization E1 2 3 Stokes parameter defined in the e e e frame Default 0 0 0 fn file name Unit number or name of an existing file For the differece between the two forms See Sec 2 8 See below for the file format Ar ANC Add
144. plotted in the parameterized form They should normally contain the variable defined by the PARAMETER command 66 name Name of the parameter to vary Must satisfy the constraints 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 L1 02 Define the range of the parameter 11 4 22 n Number of points 1 in the range 11 12 Default n 100 XLOG Divide the range uniformly in log scale Otherwise linear l1 l2 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 t TESTPARTICLE INCP RIGHT LEFT KIND k k1 k2 SELECT feer TESTPARTICLE Clear test particles INCP Clear particles created by incoherent processes defined by PPINT If none of TESTPARTICLE and I
145. 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 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 92 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 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 do
146. pure state by using random numbers 82 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 Cig a 1 2 N Each of these is a unit vector 1 and the average over the ensemble is ia 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 7 e HSS wt 0 D lecial wAt fest Ne Ci 1 wt 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 1 w f At Thus the final polarization vector is E i 1 wAt fAt C fno trans T w ft At 5 12 The average final polarization over the whole ensemble with and without transition is then given by i JAt Ge notrans F Jart I T FU CE jAt f trang we HCAt 5 13 If one can ignore the change of energy momentum
147. r 18 ToUpper 18 Abs 15 ALLOCATE 25 almost real photon 120 Alpha 19 anomalous magnetic moment 86 ArcCos 15 ArcCosh 15 ArcSin 15 ArcSinh 15 ArcTan 15 ArcTanh 15 ARRAY 26 array 16 Atan2 15 AtoF 17 AvrEn 18 AvrPs 18 AvrPx 18 AvrPy 18 Avrs 18 AvrT 18 AvrX 18 AvrY 18 axicon 36 BBFIELD 40 65 396 BBFIELD clear 68 BEAM 27 beam field 40 94 beam function 18 beamline 88 beamline coordinate 88 beamline functions 19 BeamMatrix 18 beamstrahlung 40 110 BEAMSTRAHLUNG clear 68 BesJ 21 BesK 21 BesK13 21 BesK23 21 BesKi13 21 BesKi53 21 Bessel function 21 Beta 19 Bethe Heitler process 120 BMT equation 81 86 128 Breit Wheeler process 38 118 CAIN function 18 CFQED 39 character expression 16 classical electron radius 14 CLEAR 67 coherent pair creation 40 115 coherent pair creation clear 68 command 11 24 comment 10 compilation of CAIN 74 Compton scattering 38 100 Compton wavelength 14 Cos 15 Cosh 15 crab angle 28 84 crossing angle 28 dagger f 24 DBesJ 21 DBesk 21 Debug 15 differential luminosity 42 43 directory of CAIN file 73 76 DO 54 donut 34 36 donuts 99 DRIFT 46 ECHO 25 elliptic coordinate 97 elliptic distribution 28 ELSE 56 ELSEIF 56 emittance 27 84 END 70 ENDDO 54 endfile 69 ENDIF 56 ENDPUSH 45 ENDTRANSPORT 52 enhancement of event rate 38 45 equivalent p
148. reated 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 Spl PrevMag NextMag n 0 1 2 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 OutFile2 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 Top
149. rent pair creation FuncBS x Y Beamstrahlung function Foo defined in eq 5 140 0 lt x lt 1 is the photon energy in units of the initial electron energy Y gt 0 FuncCP zx x Spectrum function Fop of coherent pair creation defined in eq 5 156 x 0 lt a lt 1 is the positron energy in units of the initial photon energy x gt 0 IntFCP y 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 V 37E 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 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 e
150. s 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 instead of y 1 y exp t log y Vlog y 4clog y 5 177 Here c gt 0 is introduced so that the function G 7 defined later is finite It is chosen to be 0 2 but is almost arbitrary provided c amp 0 1 The maximum 77 is 1 at na maz 2 log Umin F log Umin F 4c log Yn 5 178 121 1 007 0 95 4 0 90 Figure 5 12 Function G n defined in eq 5 180 0 85 4 It is close to unity because S only large 7 region is im 0 80 4 portant G 0 is finite and depends on the parame aa F ter c G 0 lt life gt 0 707 i 0 1035 Here c 0 2 is adopted 0 65 4 i 0604 3 5 15 i 1x10 1x10 1x10 1x10 1x10 n Now the spectrum with respect to 7 is a dn G n dn 5 179 T with 2c n G n V y 5 180 M RV 5 180 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 Q Nmazx Q n G n dn lt Nmax T JO T 5 181 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 V The algorithm is as follows a From the given parame
151. se 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 tf n 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 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 tf to ne e Execute commands between PUSH and ENDPUSH 45 e Control comes to ENDPUSH If j lt ny make tracking beam beam beamstrahlung laser interaction etc for the time step t lt Time lt t41 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 al
152. sion 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 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 2 6 4 Luminosity related function There are functions related to the luminosity Lum LumH LumP LumW LumWbin LumWbinEdge LumWH L
153. 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 DV Aet 5 77 where ALE S C A T e CAE n C 5 78 ho i exp gt 5 79 205 1 E e 7 n Sad ANI C Bo P AAA en El Here 6 i 1 2 is the Rayleigh length and o is the r m s pulse length d which is unity to satisfy the Maxwell equation is introduced for later use The wave front is given by the contour of kC 0 If one defines n by kn V kC 0 n is nearly a unit vector and approximated by el ce ce PELA ee 5 81 Vvl d4 e oe ai IG Gee Ere et 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 7 6 Preak Wave number k and the propagation direction n n There is some problem on the polarization because eq 5 77 does not exactly satisfy the Maxwell equation For simplicity the basis e eV e e n for polariza tion is defined in the following manner e is the unit vector along e e n n and e n xe This is irrelevant if only the longitudinal polarization is needed 98 The r m s beam size at the position is given according to eq 5 77 by AL eN al yar 5 i 1 2 5 83 To satisfy the Maxwell
154. 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 cannot 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 gt VLOG VLINEAR PERBIN PERHVAR COLOR color TITLE top title HTITLE bottom title VTITLE left_title FILE f filemame APPEND 64 i Defines what is plotted You can use the following variables LO unpolarized luminosity Ln n 1 2 3 4 helicity luminosity Lij i jj 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 i
155. ssions 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 Fkn k 1 2 are stored in a 5 dimensional array FF k n i j 1 n 1 NPH 0 NY j 0 NXT 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 i j 1 The integral over the full range 0 lt y lt 1l is then FINT k n NY 7 For integration the trapezondal rule is used which means the function Fj is approximated by a piecewise linear function The sum of FINT k n NY 7 over n is stored in FALL k j 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 106 times the time interval DT am E At P Co x FALL Co z eff 5 113 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 he 1 Pi hP he new Ca P Co x FALL k 1 2 5 114 I
156. t 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 lenn 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 fenn Therefore the number of macro e will never increase e If lenn 3 the new particle y is treated probabilistically i e a y of weight wo not wo fenn is generated with the probability 1 f Thus the number of macro y is the same as in the absense of enhancement 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 t
157. t 2 does not fit to the new grammer having been replaced by the much more powerful operand SELECT for particle selection See Sec 3 31 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 etc has changed its meaning See Sec 2 6 126 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 6 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 7 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 8 CAIN2 2a e Donut laser beam by axicon introduced A 9 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
158. ters compute Ymin maz and Q Nmax T W R where w is the weight of virtual photon to be created Py is the expected number of macro virtual photons If P is not small enough say gt 0 1 divide it by an integer N and repeat the following steps N times 7 The upper limit y 1 is not regorous The recoil effect must be taken into account when y is large y 8 y 8 122 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 7 remax and calculate G n from a table Reject if r gt G The probability to be rejected here is small because G is close to unity Otherwise accept d Calculate y using eq 5 177 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 180 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 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 y pcos 2rr4 psin Zrra 123 Appendix A History of Revision There can be lots of items in particular bug fixes missing here A 1 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 MBE
159. th 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 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 47 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 1 ANGLE 0 EDGE e2 K1 ky ROTATE APERTURE a a RECTANGULAR name Magnet name Must be enclosed by apostrophes General form of character 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 H
160. 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 5 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 lel 1 the probability to be found in the state te is given by 4 f dr w g e The final energy momentum distribution is determined by w I For given I the final polarization vector is see 3 page 254 gU w T 5 9 Now consider a process involving initial and final electrons summing over other pos sible particles The transition rate is written as aw 5 f ar w 10 97 GHG 5 10 where the subscripts and f denote initial and final variables represents transpose and H is a 3x3 matrix For given C 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 I is decided the final polarization is definitely without using random numbers given by Chae IDHE Femmes wD FLY 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
161. the pulse length is not very long compared with the wavelength there is a 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 82 Laser field is treated locally as a plane wave 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 Po 7 C aio 409 the field after axicon is given by 7 P r G T Bo 7 JAEN F r ok E a r RI a krp reo o linge f dV Hoe Lo ig do 0 99 e gt Figure 5 5 Geometry of axicon Integration over the transverse plane const gives J F r O 2rrdr 2105 1 0 20 Note that in the absense of the axicon b 0 a 00 2 IF r O AS nore Lal 1 4 E o r 2koo C f EN cad Rayleigh length 2 ana 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 wu Initial laser and final energies of the photon k k Initial laser and final momenta of the photon 0 o Polar
162. ticles 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 53 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 7 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 j 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 7 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 C entr 0 if j 0 and
163. tion 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 4 2 4 Bug fix in evdefarr f After the line CALL EVARFREE ID inserted IF NARRAY LT ID NARRAY NARRAY 1 125 e Bugfix in Isrgeo f Thanks to K Dobashi After the line PDO 0 near the beginning of the file the line PD 0 was added e Bugfix in drfext f Thanks to A Stahl CHARGO CHARG added just after the line ELSEIF CHARG NE CHARGO THEN e Bugfix in cprnd2 f EXPETA EXP DETA EXPETA EXP ETA FCP FCOHP DXDP FMAX CCO WCOHPO FCP FCOHP DXDP FMAX CCO WCOHP1 A 4 CAIN2 31 e ELSEIF added e DO loop improved DO i 1 12 13 type added Due to this change a comma after DO REPEAT and DO WHILE is now mandatory CYCLE and EXIT added e Initial check of nesting DO IF PUSH TRANSPORT added e The variables InFileName and InFilePath added A 5 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 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 g
164. treated as a meta expression The number of ZERO conditions must not exceed the number of variables 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 e where c is defined below The convergence is defined by c x i gt 16 9 9 1 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 1 2 0 step function SET nu 0 25 1q 0 5 ldrift 4 5 lcell 2 lq ldrift kf 4 1cell Sin Pix nu kd kf PRINT kf kd MAGNET L L ldrift MAGNET QFH L 1q K1 kf 2 MAGNET QDH L 1q K1 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 BLOPTI
165. tributed for Windows version users cannot re compile CAIN with changed array dimension Following steps are needed for compiling CAIN 1 If you do not have FORTRAN90 compiler you have to buy one 2 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 Compaq 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 74 The directory cain235 exec contains a csh script file make although the script might be system dependent If it does
166. umWP LumEE LumEEbin LumEEbinEdge LumEEH LumEEP See Sec 3 11 for definitions for these functions 2 6 5 Laser related function LaserIntensity t 1 y z n Get laser intensity in Watt m 2 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 T gal E J 2 n J 3 See Sec 5 8 1 for the laser coordinate 7 n 20 2 6 6 Special functions Bessel function J n must be an integer BesJ n x 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 omitted equivalent to k 1 BesK v x k Modified Bessel function K x x gt 0 DBesK v 2 k Derivative of the modified Bessel function K x gt 0 Besk13 2 k Modified Bessel function Ky 3 a gt 0 Besk23 x k Modified Bessel function K 3 x x gt 0 BesKi13 x k Integral of Modified Bessel function Kiy 3 x gt 0 See eq 5 142 for the definition of Ki BesKi53 1 k Integral of Modified Bessel function Kis 3 x gt 0 Functions for beamstrahlung and cohe
167. ump 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 i i1 121 13 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 i1 12 i3 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 must not be zero If i1 22 the loop is executed once If 7 lt ig and 3 lt 0 or 21 gt and 13 gt 0 the loop is not executed Don t forget to enclose the numbers by End of
168. units of eV eV c SPIN 2 i 1 2 3 The polarization component Sy Sy Ss for electrons positrons and the Stokes parameter 1 2 3 for photons Sz Sy Ss is defined as usual in particle s rest frame Therefore it aquires 79 the Thomas precession under Lorentz transformation by LORENTZ command For defining the Stokes parameter one needs a set of orthonormal basis vectors e e 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 and e e xe This is ill defined when the momentum is exactly parallel to the x axis but this possibility is simply ignored Except for large angle photons e e e is almost equal to e y ez for right going photons and es ey 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
169. ure 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 49 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 BETA 8 3 ALPHA 0 0y ETA ne y ETAPRIME 77 7 name Name of a defined beamline The apostrophes can be omitted PERIODIC Periodic condition i e Twiss parameters at the entrance equal to those at exit is applied BETA etc are not needed Bar By Ax Ay Nx Ny Np My Twiss parameters and eta functions at the entrance The default values are all zero so that at least 6 and 2 must be defined if not PERIODIC 3 19
170. 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 Zo Yo So Reference point of the Twiss parameters m Eo Reference energy eV Bry Qx Nay Ney Twiss parameters Ed Geometric emittance rad m on R m s bunch length m Oz R m s relative energy spread Nz Ny Nt Ne Gaussian tail cut off Bos Oy Orbit slope rad Wa Py Crab angle rad Peay Beam roll in the z y plane rad 84 de dt Coherent energy slope 1 m daz de Energy dependence of the focal point Parameter for the travelling fo cus First generate particle variables in usual accelerator coordinate ty Ory E O Ta de dt t 5 15 5 16 T1 y 2 rU18 1 COS P1 NEI 5 17 zx y 26741 Bx1 071 COS Y1 Sin 91 nhe 5 18 Y 1 2 yU2By1 COS P2 NyE1 5 19 y y 2eyu2 8y1 041 cos p2 sin p2 ny E1 5 20 Asy Any 1 dorey de Beyi Bay 1 E1d0 y de 5 21 where r r2 is a Gaussian random number of zero mean and unit standard deviation cut at ne nz uj J 1 2 is a random number of exponential distribution x e cut at u n 2 n 2 and p a uniform random number in 0 27 These variables are then transformed to t t t 5 22 x X
171. x y s with E pz Py Ps ps gt 0 Let us define a tan pr ps p yp p p to w gt 0 f sin a 4 e sin 09 2sin Z cos 5 00 po fo 7 sin 9 where is the sign of charge relative to the reference particle Then the particle can reach the magnet exit sp s lo iff f lt 1 and the particle property ts f yy Sf with Ey E pep Pys Psy in the beamline coordinate at the exit is exactly given by 1 tp t At At a bo sin f Wy LF x cos lo poll cos 0o p 4 1 f cos a Op 0 00 a Q f x cos 0 2 p i 2 sin 00 p s 0 p Po sin po sin sinl 0 Pisy T y At Yy y E a 24l Es E Pas fp Pyf Py Psf y1 Pa St BMT equation The spin equation of motion in an inertial frame is given by dS eB eB P de low ee ae my Jr a to be compared with the equation for momentum dp emo7o Vo xp WeyXp w dt my eomy 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 e1o Sin wt 39 COs wt ez ey d S 0065 0 w yae a y Dep Y dt pl where the components of 2 are constant in this frame Thus if the 3x3 rotation matrix corresponding to QAt At already defined is denoted by Maat then the final spin component in the beamline coordinate is Dag cosy 0 siny Sa Syf 0 1 0 Maat Sy 5
Download Pdf Manuals
Related Search
Related Contents
FVA bedienungsanleitung user manual mode d`emploi manual del usuario 取扱説明書 - psn UsersGuide_XJA-S - Support PI-163 PI-163 - Breast-feeding: Breast Fullness and Engorgement qig german Power Drive 1500 User's Manual Copyright © All rights reserved.
Failed to retrieve file