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

ThetaPhiGirder

PURPOSE ^

rtp=ThetaPhiGirder(r,mag_gr)

SYNOPSIS ^

function rtp=ThetaPhiGirder(r,mag_gr)

DESCRIPTION ^

rtp=ThetaPhiGirder(r,mag_gr)

 sets misalignment to model theta, phi errors for magnets on girder

 mag_gr is the output of getMagGroupsFromGirderIndex(ring)
 
see also: GetExistingErrors setANYshift setTiltAbout seterrorrand

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function rtp=ThetaPhiGirder(r,mag_gr)
0002 %rtp=ThetaPhiGirder(r,mag_gr)
0003 %
0004 % sets misalignment to model theta, phi errors for magnets on girder
0005 %
0006 % mag_gr is the output of getMagGroupsFromGirderIndex(ring)
0007 %
0008 %see also: GetExistingErrors setANYshift setTiltAbout seterrorrand
0009 
0010 %    get girder centers
0011 gm=cellfun(@(mg)gmisal(r,mg),mag_gr,'un',0);
0012 
0013 magindex=[mag_gr{:}];
0014 allmisg=[gm{:}];
0015 
0016 % get existing alignment errors
0017 %[X0,Y0]=GetExistingErrors(r,magindex);
0018 
0019 rtp=r;
0020 nsig=2;
0021 
0022 errfun=@(r,po,er)setANYshift(r,po,1,er); % sets x errors
0023 %rtp=seterrorrand(rtp,magindex,errfun,0,0,nsig,X0+allmisg(1,:));
0024 rtp=seterrorrand(rtp,magindex,errfun,0,0,nsig,allmisg(1,:));
0025 
0026 errfun=@(r,po,er)setANYshift(r,po,3,er); % sets Y errors
0027 %rtp=seterrorrand(rtp,magindex,errfun,0,0,nsig,Y0+allmisg(2,:));
0028 rtp=seterrorrand(rtp,magindex,errfun,0,0,nsig,allmisg(2,:));
0029 
0030 
0031 return
0032 
0033 function gm=gmisal(r,mg)
0034 
0035 sg=findspos(r,mg);
0036 gc=(max(sg)+min(sg))/2;
0037 
0038 dg=sg-gc; % distance from girder center
0039 
0040 tg=atgetfieldvalues(r,mg,'RotAboutX',{1,1}); % sets a vertical misalignment
0041 pg=atgetfieldvalues(r,mg,'RotAboutY',{1,1}); % sets a horizontal misalignment
0042 
0043 gm=zeros(length(mg),2);
0044 
0045 if ~isempty(tg)
0046     gm(:,2)=dg'.*sin(tg);
0047 end
0048 if ~isempty(pg)
0049     gm(:,1)=dg'.*sin(pg);
0050 end
0051 
0052 gm=gm';
0053 return
0054 
0055

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