Home > pubtools > LatticeTuningFunctions > errors > errorsmanipulation > UniformMagGroupsErrors.m

UniformMagGroupsErrors

PURPOSE ^

function ring=UniformMagGroupsErrors(ring)

SYNOPSIS ^

function ring=UniformMagGroupsErrors(ring)

DESCRIPTION ^

 function ring=UniformMagGroupsErrors(ring)

 makes T1, R1, DeltaS and Tilt error in a mag group 
 identical to the ones on the first element of the group. 
 
 Groups are defined in the lattice by the MagNum Field

see also: getMagGroupsFromMagNum

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function ring=UniformMagGroupsErrors(ring)
0002 % function ring=UniformMagGroupsErrors(ring)
0003 %
0004 % makes T1, R1, DeltaS and Tilt error in a mag group
0005 % identical to the ones on the first element of the group.
0006 %
0007 % Groups are defined in the lattice by the MagNum Field
0008 %
0009 %see also: getMagGroupsFromMagNum
0010 
0011 mag_groups=getMagGroupsFromMagNum(ring);
0012 
0013 for i=1:length(mag_groups)
0014     
0015     % group indexes
0016     ind=mag_groups{i};
0017     if length(ind)>1
0018         
0019         % get first element errors
0020         if isfield(ring{ind(1)},'T1')
0021             T1=ring{ind(1)}.T1;
0022         else
0023             T1=zeros(6,1);
0024         end
0025         
0026         if isfield(ring{ind(1)},'T2')
0027             T2=ring{ind(1)}.T2;
0028         else
0029             T2=zeros(6,1);
0030         end
0031         
0032         if isfield(ring{ind(1)},'R1')
0033             R1=ring{ind(1)}.R1;
0034         else
0035             R1=eye(6,6);
0036         end
0037         
0038         if isfield(ring{ind(1)},'R2')
0039             R2=ring{ind(1)}.R2;
0040         else
0041             R2=eye(6,6);
0042         end
0043         
0044         if isfield(ring{ind(1)},'Tilt')
0045             Tilt=ring{ind(1)}.Tilt;
0046         else
0047             Tilt=0;
0048         end
0049         
0050         if isfield(ring{ind(1)},'DeltaS')
0051             DeltaS=ring{ind(1)}.DeltaS;
0052         else
0053             DeltaS=0;
0054         end
0055         
0056         
0057         for isl=1:length(ind)
0058             
0059             % set all other slices to this value
0060             ring{ind(isl)}.T1=T1;
0061             ring{ind(isl)}.T2=T2;
0062             ring{ind(isl)}.R1=R1;
0063             ring{ind(isl)}.R2=R2;
0064             ring{ind(isl)}.Tilt=Tilt;
0065             ring{ind(isl)}.DeltaS=DeltaS;
0066             
0067         end
0068     end
0069     
0070 end
0071 
0072

Generated on Thu 24-Aug-2017 18:47:33 by m2html © 2005