0001 function ffcompare
0002
0003
0004 BLeffHCM = 410;
0005 BLeffVCM = 171;
0006 Leff = 55;
0007 labelmat = [];
0008
0009 DirStart = pwd;
0010 gotodata
0011 cd gaptrack
0012 cd archive
0013
0014 figure
0015 ha=subplot(2,2,1);
0016 hb=subplot(2,2,2);
0017 hc=subplot(2,2,3);
0018 hd=subplot(2,2,4);
0019
0020 SectorIn = menu('Which Sector?','4','5','7','8','9','10','12','Cancel');
0021 if SectorIn == 1
0022 Sector = 4;
0023 elseif SectorIn == 2
0024 Sector = 5;
0025 elseif SectorIn == 3
0026 Sector = 7;
0027 elseif SectorIn == 4
0028 Sector = 8;
0029 elseif SectorIn == 5
0030 Sector = 9;
0031 elseif SectorIn == 6
0032 Sector = 10;
0033 elseif SectorIn == 7
0034 Sector = 12;
0035 elseif SectorIn == 8
0036 return
0037 end
0038 if Sector == 0
0039 return;
0040 end
0041
0042 for i = 1:100000
0043
0044 [Datafn, DirStr] = uigetfile(sprintf('id%02d*.mat', Sector), 'Choose the desired feed forward file (Cancel to stop).');
0045 if Datafn == 0
0046
0047 eval(['cd ', DirStart]);
0048
0049
0050 axes(ha);
0051 title('');
0052 hold off
0053 axis tight
0054
0055 axes(hb);
0056 title('');
0057 hold off
0058 axis tight
0059
0060 axes(hc);
0061 title('');
0062 hold off
0063 axis tight
0064
0065 axes(hd);
0066 title('');
0067 hold off
0068 axis tight
0069 orient landscape
0070
0071 h=addlabel(.5,1,sprintf('Sector %d Feed Forward Tables', Sector1),12);
0072 set(h,'HorizontalAlignment','center');
0073
0074 for j = 1:size(labelmat,1)
0075 h=addlabel(1,1-.02*(j-1),labelmat(j,:),7);
0076 set(h,'color',labelcmat(j,:));
0077
0078
0079
0080 end
0081
0082 return
0083 end
0084
0085
0086 eval(['load ', DirStr, Datafn]);
0087 h1 = tableX;
0088 v1 = tableY;
0089 Sector1 = str2num(Datafn(3:4));
0090 GeVnum1 = str2num(Datafn(6:7))/10;
0091
0092
0093 cmat = get(gca,'ColorOrder');
0094 icolor=rem(i-1,size(cmat,1))+1;
0095
0096
0097 axes(ha);
0098 plot(h1(:,1),h1(:,2),'color',cmat(icolor,:));
0099 xlabel('Gap Position [mm]');
0100 ylabel(sprintf('HCM(%d,%d) [amps]',Sector1-1,4));
0101 title(sprintf('Sector %d Table at %.1f GeV', Sector1, GeVnum1));
0102 hold on
0103
0104
0105 axes(hb);
0106 plot(h1(:,1),h1(:,3),'color',cmat(icolor,:));
0107 xlabel('Gap Position [mm]');
0108 ylabel(sprintf('HCM(%d,%d) [amps]',Sector1,1));
0109 title(sprintf('Sector %d Table at %.1f GeV', Sector1, GeVnum1));
0110 hold on
0111
0112
0113 axes(hc);
0114 plot(v1(:,1),v1(:,2),'color',cmat(icolor,:));
0115 xlabel('Gap Position [mm]');
0116 ylabel(sprintf('VCM(%d,%d) [amps]',Sector1-1,4));
0117 title(sprintf('Sector %d Table at %.1f GeV', Sector1, GeVnum1));
0118 hold on
0119
0120
0121 axes(hd);
0122 plot(v1(:,1),v1(:,3),'color',cmat(icolor,:));
0123 xlabel('Gap Position [mm]');
0124 ylabel(sprintf('VCM(%d,%d) [amps]',Sector1,1));
0125 title(sprintf('Sector %d Table at %.1f GeV', Sector1, GeVnum1));
0126 hold on
0127
0128 fprintf(' %d. %s Sector %d %.1f GeV\n', i, FFDate, Sector1, GeVnum1);
0129
0130 labelmat = strvcat(labelmat, sprintf('%s, Sector %d, %.1f GeV', FFDate, Sector1, GeVnum1));
0131 labelcmat(i,:) = cmat(icolor,:);
0132
0133
0134
0135 for j = 1:i
0136 h=addlabel(1,1-.02*(j-1),labelmat(j,:),7);
0137 set(h,'color',labelcmat(j,:));
0138
0139
0140
0141 end
0142
0143 drawnow
0144 end
0145
0146
0147
0148 return
0149
0150
0151
0152
0153
0154
0155 [Datafn, DirStr] = uigetfile('*.mat', 'Choose the desired feed forward file.');
0156 eval(['load ', DirStr, Datafn]);
0157 h1 = tableX;
0158 v1 = tableY;
0159 Sector2 = str2num(Datafn(3:4));
0160 GeVnum2 = str2num(Datafn(6:7))/10;
0161
0162
0163 subplot(2,1,1);
0164 plot(h1(:,1),h1(:,2),'-.r', h1(:,1),h1(:,3),':g');
0165 hold off;
0166 xlabel('Gap Position [mm]');
0167 ylabel('Horizontal Corrector Strength [amps]');
0168 title(['Insertion Device Feedfoward Tables']);
0169 legend(['HCM4, Sector ',num2str(Sector1-1),' ', num2str(GeVnum1), ' GeV'], ...
0170 ['HCM1, Sector ',num2str(Sector1),' ', num2str(GeVnum1), ' GeV'], ...
0171 ['HCM4, Sector ',num2str(Sector2-1),' ', num2str(GeVnum2), ' GeV'], ...
0172 ['HCM1, Sector ',num2str(Sector2),' ', num2str(GeVnum2), ' GeV']);
0173
0174
0175 subplot(2,1,2);
0176 plot(v1(:,1),v1(:,2),'-.r', v1(:,1),v1(:,3),':g');
0177 hold off;
0178 xlabel('Gap Position [mm]');
0179 ylabel('Vertical Corrector Strength [amps]');
0180 title(['Insertion Device Feedfoward Tables']);
0181 legend(['VCM4, Sector ',num2str(Sector1-1),' ', num2str(GeVnum1), ' GeV'], ...
0182 ['VCM1, Sector ',num2str(Sector1),' ', num2str(GeVnum1), ' GeV'], ...
0183 ['VCM4, Sector ',num2str(Sector2-1),' ', num2str(GeVnum2), ' GeV'], ...
0184 ['VCM1, Sector ',num2str(Sector2),' ', num2str(GeVnum2), ' GeV']);