0001 function tauT = calc_Touschek(THERING,Ib,varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 alpha=1.7e-4;
0016
0017 hori_acceptance = Inf;
0018 if nargin>=3
0019 hori_acceptance = varargin{1};
0020 end
0021
0022 if nargin<7
0023
0024 atsum = tlssummary
0025 end
0026
0027
0028 if nargin>=4
0029 U0 = varargin{2}*1e6;
0030 else
0031 U0 = atsum.radiation*1e9;
0032
0033 end
0034 coupling = 0.05*1e-2;
0035 if nargin>=5
0036 coupling = varargin{3};
0037 end
0038
0039 if nargin>=7
0040 sigE = varargin{4};
0041 emit_x = varargin{5}*1e-9;
0042 else
0043 sigE = atsum.naturalEnergySpread
0044 emit_x = atsum.naturalEmittance
0045
0046 end
0047
0048 e0 = 1.6e-19;
0049 cspeed = 299792458;
0050 r0 = 2.82e-15;
0051
0052
0053
0054 cava = findcells(THERING,'PassMethod','ThinCavityPass');
0055 cavb = findcells(THERING,'PassMethod','CavityPass');
0056 CAVINDEX = sort([cava,cavb]);
0057 if isempty(CAVINDEX)
0058 error('cavity not defined')
0059 end
0060 freq = THERING{CAVINDEX(1)}.Frequency;
0061 harm = THERING{CAVINDEX(1)}.HarmNumber;
0062 E0 = THERING{CAVINDEX(1)}.Energy;
0063 gamma = THERING{CAVINDEX(1)}.Energy/0.511e6;
0064
0065 Vrf = 0;
0066 for ii=1:length(CAVINDEX)
0067 Vrf = Vrf + THERING{CAVINDEX(ii)}.Voltage;
0068 end
0069
0070 Vrf = 1.6e6;
0071
0072
0073
0074 phi_s = asin(U0/Vrf);
0075 nus = sqrt(harm*Vrf*alpha*cos(phi_s)/2/pi/E0);
0076
0077 sigZ = sigE/nus*harm*alpha/2/pi/freq*cspeed;
0078
0079
0080 delta_max_rf = sqrt(2*U0/pi/alpha/harm/E0)*sqrt( sqrt((Vrf/U0).^2-1) - acos(U0./Vrf));
0081
0082
0083
0084 [td, tune,chrom] = twissring(THERING,0,1:length(THERING)+1, 'chrom', 1e-5);
0085 Dx = cat(2, td.Dispersion)';
0086 betxy = cat(1, td.beta);
0087 alfxy = cat(1, td.alpha);
0088
0089 spos = cat(1,td.SPos);
0090 circ = spos(end);
0091
0092 sigX = sqrt(betxy(:,1)*emit_x+Dx(:,1).^2*sigE^2);
0093
0094 sigY = sqrt(betxy(:,2)*emit_x*coupling);
0095 sigXp = sqrt(emit_x*(1+alfxy(:,1).^2)./betxy(:,1)+Dx(:,2).^2*sigE^2);
0096
0097 curH = (Dx(:,1).^2 + (betxy(:,1).*Dx(:,2)+alfxy(:,1).*Dx(:,1)).^2)./betxy(:,1);
0098
0099 display('delta_max_perp data: ');
0100 delta_max_perp = hori_acceptance./sqrt(curH);
0101 display('delta_max data: ');
0102 delta_max = min([delta_max_perp, ones(size(curH))*delta_max_rf]')';
0103 display('xi data: ');
0104 xi = (delta_max/gamma.*betxy(:,1)./sigX).^2;
0105 Dval = funcD(xi);
0106
0107 N0 = 0.001/(freq/harm)/e0;
0108
0109 ds = diff(spos);
0110 n=1:length(THERING);
0111
0112 avgfac = sum(Dval(n)./sigX(n)./sigY(n)/sigZ./delta_max(n).^3.*ds)/circ;
0113 lossrate = Ib*N0*r0^2*cspeed/8/gamma^2/pi*avgfac;
0114
0115 tauT = 1/lossrate;
0116
0117 if 0
0118 figure
0119 plot(spos, delta_max, spos, delta_max_rf*ones(size(spos)));
0120
0121 set(gca,'fontsize', 16,'xlim',[0,120])
0122 xlabel('s (m)')
0123 ylabel('\delta_{max}')
0124 grid
0125
0126 set(gca,'ylim',[0,0.15]);
0127
0128 end
0129
0130 function D=funcD(xi)
0131
0132 DfunTable = [
0133
0134 0.000500 0.123802
0135 0.001000 0.153464
0136 0.001500 0.172578
0137 0.002000 0.186757
0138 0.002500 0.198008
0139 0.003000 0.207298
0140 0.003500 0.215179
0141 0.004000 0.221992
0142 0.004500 0.227968
0143 0.005000 0.233269
0144 0.005500 0.238015
0145 0.006000 0.242294
0146 0.006500 0.246176
0147 0.007000 0.249717
0148 0.007500 0.252961
0149 0.008000 0.255944
0150 0.008500 0.258697
0151 0.009000 0.261244
0152 0.009500 0.263607
0153 0.010000 0.265805
0154 0.010500 0.267852
0155 0.011000 0.269763
0156 0.011500 0.271549
0157 0.012000 0.273221
0158 0.012500 0.274788
0159 0.013000 0.276259
0160 0.013500 0.277640
0161 0.014000 0.278938
0162 0.014500 0.280159
0163 0.015000 0.281308
0164 0.015500 0.282391
0165 0.016000 0.283411
0166 0.016500 0.284372
0167 0.017000 0.285278
0168 0.017500 0.286132
0169 0.018000 0.286938
0170 0.018500 0.287698
0171 0.019000 0.288415
0172 0.019500 0.289090
0173 0.020000 0.289727
0174 0.020500 0.290327
0175 0.021000 0.290893
0176 0.021500 0.291425
0177 0.022000 0.291926
0178 0.022500 0.292397
0179 0.023000 0.292840
0180 0.023500 0.293256
0181 0.024000 0.293646
0182 0.024500 0.294011
0183 0.025000 0.294352 ];
0184 ximin = DfunTable(1,1);
0185 ximax = DfunTable(end,1);
0186 xi(find(xi<ximin)) = ximin;
0187 xi(find(xi>ximax)) = ximax;
0188 D = interp1(DfunTable(:,1), DfunTable(:,2), xi,'linear');
0189