Back to home page

sPhenix code displayed by LXR

 
 

    


Warning, /analysis/EMCal-analysis/ThicknessScan/ThicknessScan.m is written in an unsupported language. File is not indexed.

0001 close all
0002 clear all
0003 
0004 % From Geant4 Material Scans on EMCal along without support and electronics, e.g. 
0005 % 
0006 % g4->ApplyCommand("/control/matScan/phi 1111 0 22.5 deg")
0007 % g4->ApplyCommand("/control/matScan/theta 1111 1 70 deg")
0008 % g4->ApplyCommand("/control/matScan/scan") ; > mat3.list
0009 
0010 
0011 % file = 'mat2.list';
0012 
0013 % file = 'mat.list';
0014 % n_scan = 111;
0015 
0016 file = 'E:\tmp\Transfer Buffer\mat3.list';
0017 n_scan = 1111;
0018 
0019 
0020 
0021 %%
0022 
0023 Data = zeros(n_scan*n_scan,5);
0024 
0025 i = 1;
0026 
0027 fid = fopen(file);
0028 tline = fgetl(fid);
0029 while ischar(tline)
0030 %     disp(tline)
0031     
0032     [A,n] = sscanf(tline,'%f');
0033     if n == 5 
0034 %         disp(A);
0035         
0036         Data(i,:) =  A';
0037         i = i + 1;
0038         
0039     elseif (strncmpi(tline,' ave.',5))
0040         disp(tline)
0041     end
0042     
0043     
0044     tline = fgetl(fid);
0045     
0046 end
0047 fclose(fid);
0048 
0049 
0050 assert(i-1 == n_scan*n_scan);
0051 %%
0052 Data = Data(Data(:,1)<54,:);
0053 n_eta = size(Data,1)/n_scan;
0054 
0055 
0056 %%
0057 
0058 Theta = Data(:,1);
0059 Phi_Deg = Data(:,2);
0060 Length = Data(:,3);
0061 x0 = Data(:,4);
0062 lambda0 = Data(:,5);
0063 
0064 %%
0065 
0066 Theta = reshape(Theta,[],n_eta);
0067 Phi_Deg = reshape(Phi_Deg,[],n_eta);
0068 Length = reshape(Length,[],n_eta);
0069 x0 = reshape(x0,[],n_eta);
0070 lambda0 = reshape(lambda0,[],n_eta);
0071 
0072 %%
0073 
0074 Eta = -log(tan((90-Theta)/180*pi/2));
0075 Phi_Rad = Phi_Deg/180*pi;
0076 
0077 %%
0078 
0079 figure('name','2D','PaperPositionMode','auto', ...
0080     'position',[100,0,1900,1000]) ;
0081 
0082 subplot(1,2,1);
0083 
0084 surf(Eta,Phi_Rad,x0);
0085 
0086 xlabel('\eta','FontSize',18);
0087 ylabel('\phi [rad]','FontSize',18);
0088 zlabel('Radiatiaon Length','FontSize',18);
0089 
0090 
0091 subplot(1,2,2);
0092 
0093 surf(Eta,Phi_Rad,lambda0);
0094 
0095 xlabel('\eta','FontSize',18);
0096 ylabel('\phi [rad]','FontSize',18);
0097 zlabel('Nuclear Interaction Length','FontSize',18);
0098 
0099 %%
0100 
0101 figure('name','1D-Projections','PaperPositionMode','auto', ...
0102     'position',[100,0,1900,1100]) ;
0103 
0104 subplot(2,2,1);
0105 
0106 plot(mean(Eta,1),mean(x0,1), 'LineWidth',2);
0107 
0108 xlabel('\eta','FontSize',18);
0109 ylabel('Radiatiaon Length','FontSize',18);
0110 set(gca,'FontSize',16, 'XMinorTick','off', 'YMinorTick','off');
0111 line(get(gca,'XLim'),[18,18],'Color',[.5 .5 .5]);
0112 text(mean(get(gca,'XLim')),18,'18 X_0','VerticalAlignment','top','FontSize',18,'Color',[.5 .5 .5]);
0113 
0114 set(gca,'YLim',[0,30]);
0115 set(gca,'XLim',[0,1.2]);
0116 
0117 text(mean(get(gca,'XLim')),mean(get(gca,'YLim'))*.2,...
0118     sprintf('sPHENIX EMCal, average %.1f X_0', mean(mean(x0))),...
0119     'HorizontalAlignment','center','FontSize',18);
0120 
0121 
0122 subplot(2,2,2);
0123 
0124 plot(mean(Phi_Rad,2),mean(x0,2), 'LineWidth',2);
0125 
0126 xlim = get(gca,'XLim');
0127 
0128 xlabel('\phi [rad]','FontSize',18);
0129 ylabel('Radiatiaon Length','FontSize',18);
0130 set(gca,'FontSize',16, 'XMinorTick','off', 'YMinorTick','off');
0131 line((xlim),[18,18],'Color',[.5 .5 .5]);
0132 text(mean(xlim)*1.2,18,'18 X_0','VerticalAlignment','top','FontSize',18,'Color',[.5 .5 .5]);
0133 
0134 
0135 set(gca,'YLim',[0,30]);
0136 set(gca,'XLim',xlim);
0137 
0138 subplot(2,2,3);
0139 
0140 plot(mean(Eta,1),mean(lambda0,1), 'LineWidth',2);
0141 
0142 xlabel('\eta','FontSize',18);
0143 ylabel('Nuclear Interaction Length','FontSize',18);
0144 set(gca,'FontSize',16, 'XMinorTick','off', 'YMinorTick','off');
0145 
0146 line(get(gca,'XLim'),[0.75,0.75],'Color',[.5 .5 .5]);
0147 text(mean(get(gca,'XLim')),0.75 ,'0.75 \Lambda_0','VerticalAlignment','top','FontSize',18,'Color',[.5 .5 .5]);
0148 
0149 set(gca,'YLim',[0,1.5]);
0150 set(gca,'XLim',[0,1.2]);
0151 
0152 text(mean(get(gca,'XLim')),mean(get(gca,'YLim'))*.2,...
0153     sprintf('sPHENIX EMCal, average %.1f \\Lambda_0', mean(mean(lambda0))),...
0154     'HorizontalAlignment','center','FontSize',18);
0155 
0156 subplot(2,2,4);
0157 
0158 plot(mean(Phi_Rad,2),mean(lambda0,2), 'LineWidth',2);
0159 
0160 xlabel('\phi [rad]','FontSize',18);
0161 ylabel('Nuclear Interaction Length','FontSize',18);
0162 set(gca,'YLim',[0,1.5]);
0163 set(gca,'XLim',xlim);
0164 set(gca,'FontSize',16, 'XMinorTick','off', 'YMinorTick','off');
0165 
0166 line((xlim),[.75,.75],'Color',[.5 .5 .5]);
0167 text(mean(xlim)*1.2,0.75 ,'0.75 \Lambda_0','VerticalAlignment','top','FontSize',18,'Color',[.5 .5 .5]);
0168 
0169 
0170 SaveCavas(file,gcf);
0171 
0172 
0173 %%
0174 
0175 
0176 figure('name','1D-Projections-RadiationLength','PaperPositionMode','auto', ...
0177     'position',[100,0,800,600]) ;
0178 
0179 
0180 plot(mean(Eta,1),mean(x0,1), 'LineWidth',3);
0181 
0182 xlabel('\eta','FontSize',18);
0183 ylabel('Radiatiaon Length','FontSize',18);
0184 set(gca,'FontSize',16, 'XMinorTick','off', 'YMinorTick','off');
0185 line(get(gca,'XLim'),[18,18],'Color',[.5 .5 .5]);
0186 text(mean(get(gca,'XLim')),18,'18 X_0','VerticalAlignment','top','FontSize',18,'Color',[.5 .5 .5]);
0187 
0188 set(gca,'YLim',[0,30]);
0189 set(gca,'XLim',[0,1.2]);
0190 
0191 text(mean(get(gca,'XLim'))*.1,mean(get(gca,'YLim'))*.6,...
0192     sprintf('sPHENIX simulation\n2-D projective SPACAL EMCal\nThickness scan from vertex of (0,0,0) & averaged in \\phi\n\nAverage thickness = %.1f X_0, %.2f \\Lambda_0\nMin thickness = %.1f X_0, %.2f \\Lambda_0',...
0193     mean(mean(x0)),mean(mean(lambda0)),min(mean(x0,1)),min(mean(lambda0,1))),...
0194     'HorizontalAlignment','left','FontSize',18);
0195 
0196 
0197 SaveCavas(file,gcf);