0001 function [ring,mag_groups]=UniformGirderErrors(ring,mag_groups)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 if nargin<2
0013 mag_groups=getMagGroupsFromGirderIndex(ring);
0014 end
0015
0016 for i=1:length(mag_groups)
0017
0018
0019 ind=mag_groups{i};
0020 if length(ind)>1
0021
0022
0023 bpmingroup=findcells(ring(ind),'Class','Monitor');
0024 if ~isempty(bpmingroup)
0025
0026 offerrx=atgetfieldvalues(ring,ind(bpmingroup(1)),'Offset',{1,1});
0027 offerry=atgetfieldvalues(ring,ind(bpmingroup(1)),'Offset',{1,2});
0028 roterr=atgetfieldvalues(ring,ind(bpmingroup(1)),'Rotation',{1,1});
0029 indALL=ind(bpmingroup);
0030 ring=atsetfieldvalues(ring,indALL,'Offset' ,offerrx,1,1);
0031 ring=atsetfieldvalues(ring,indALL,'Offset' ,offerry,1,2);
0032 ring=atsetfieldvalues(ring,indALL,'Rotation' ,roterr,1,1);
0033 end
0034
0035
0036
0037
0038 if isfield(ring{ind(1)},'T1')
0039 T1=ring{ind(1)}.T1;
0040 else
0041 T1=zeros(6,1);
0042 end
0043
0044 if isfield(ring{ind(1)},'T2')
0045 T2=ring{ind(1)}.T2;
0046 else
0047 T2=zeros(6,1);
0048 end
0049
0050 if isfield(ring{ind(1)},'R1')
0051 R1=ring{ind(1)}.R1;
0052 else
0053 R1=eye(6,6);
0054 end
0055
0056 if isfield(ring{ind(1)},'R2')
0057 R2=ring{ind(1)}.R2;
0058 else
0059 R2=eye(6,6);
0060 end
0061
0062 if isfield(ring{ind(1)},'DeltaS')
0063 DeltaS=ring{ind(1)}.DeltaS;
0064 else
0065 DeltaS=0;
0066 end
0067
0068 if isfield(ring{ind(1)},'RotAboutS')
0069 RotAboutS=ring{ind(1)}.RotAboutS;
0070 else
0071 RotAboutS=0;
0072 end
0073
0074 if isfield(ring{ind(1)},'RotAboutX')
0075 RotAboutX=ring{ind(1)}.RotAboutX;
0076 else
0077 RotAboutX=0;
0078 end
0079
0080 if isfield(ring{ind(1)},'RotAboutY')
0081 RotAboutY=ring{ind(1)}.RotAboutY;
0082 else
0083 RotAboutY=0;
0084 end
0085
0086 for isl=1:length(ind)
0087
0088
0089 ring{ind(isl)}.T1=T1;
0090 ring{ind(isl)}.T2=T2;
0091 ring{ind(isl)}.R1=R1;
0092 ring{ind(isl)}.R2=R2;
0093 ring{ind(isl)}.DeltaS=DeltaS;
0094 ring{ind(isl)}.RotAboutS=RotAboutS;
0095 ring{ind(isl)}.RotAboutX=RotAboutX;
0096 ring{ind(isl)}.RotAboutY=RotAboutY;
0097
0098
0099 end
0100 end
0101
0102 end
0103
0104
0105
0106
0107 return