#print('Base weights:') #for xp in x: # print(str(xp)) #resp2=det(modelForGuess.getERange(), model.getFluence(x))#TODO guess-> x #print('Expected detector responses with calculated spectrum:') #for i in range(len(resp2[0])): # print((['No sphere']+milanoReference.names)[i]+' & %.1f'%resp[0][i]+' & %.1f'%resp2[0][i]+' \\\\') pl.subplot(111, xscale="log", yscale="log") pn=1e3 E=np.exp(np.linspace(np.log(1e-14), np.log(1e3), pn)) pl.plot(E,[spectrum[1](e) for e in E]) #pl.plot(E,[max(CMSNeutrons.fluence(e),1e-10) for e in E]) E=np.exp(np.linspace(np.log(model.getERange()[0]), np.log(model.getERange()[1]), pn)) #pl.plot(E,[modelForGuess(guess,e) for e in E]) #modelForGuess.plot(guess,errors=guessErrors) model.plot(x,errors=errors) #E=np.exp(np.linspace(np.log(1e-13), np.log(2e-10), pn)) #pl.plot(E,[maxwellDistribution(e)/2e10*1.4e4 for e in E]) pl.xlim([1e-13,1e1]) pl.ylim([1e0,1e20]) pl.grid() pl.xlabel('$E$ [GeV]') pl.ylabel('$\phi(E)$ [$(\mathrm{fb}^{-1}\ \mathrm{cm}^{2}\mathrm{GeV})^{-1}$]') pl.show()
for xp in x: print(str(xp)) resp2=det(model.getERange(), model.getFluence(x)) print('Expected detector responses with calculated spectrum:') for r in resp2[0]: print(str(r)) import pylab as pl pl.subplot(111, xscale="log", yscale="log") pn=1e3 #E=np.exp(np.linspace(np.log(1e-14), np.log(1e3), pn)) #pl.plot(E,[spectrum[1](e) for e in E]) #pl.plot(E,[CMSNeutrons.fluence(e) for e in E]) #E=np.exp(np.linspace(np.log(model.getERange()[0]), np.log(model.getERange()[1]), pn)) #pl.plot(E,[model(x,e) for e in E]) modelForGuess.plot(guess,errors=guessErrors) #model.plot(x,errors=errors) #E=np.exp(np.linspace(np.log(1e-13), np.log(2e-10), pn)) #pl.plot(E,[maxwellDistribution(e)/2e10*1.4e4 for e in E]) pl.ylabel('$\phi(E)$ [$\mathrm{mb}\ \mathrm{cm}^{-2}\mathrm{GeV}^{-1}$]') pl.xlabel('$E$ [GeV]') pl.xlim([1e-13,1e1]) pl.ylim([1e-10,1e6]) pl.grid() pl.show()
print('\\hline') for i in range(len(x)): print(str(i+1)+' & $%.3g'%(simx[i])+'\\pm%.3g$'%(simerrors[i])+' &$ %.3g'%(x[i])+'\\pm %.3g$'%(errors[i])+' \\\\') #plot stuff!!! import pylab as pl pl.subplot(111, xscale="log", yscale="log") pn=1e3 E=np.exp(np.linspace(np.log(1e-14), np.log(1e3), pn)) pl.plot(E,[spectrum[1](e) for e in E],label='Simulated spectrum') #pl.plot(E,[max(CMSNeutrons.fluence(e),1e-10) for e in E]) #E=np.exp(np.linspace(np.log(model.getERange()[0]), np.log(model.getERange()[1]), pn)) #pl.plot(E,[model(x,e) for e in E]) #modelForGuess.plot(guess,errors=guessErrors) model.plot(x,errors=errors,label='Using measured responses') model.plot(simx,errors=simerrors,label='Using simulated responses') #E=np.exp(np.linspace(np.log(1e-13), np.log(2e-10), pn)) #pl.plot(E,[maxwellDistribution(e)/2e10*1.4e4 for e in E]) pl.legend() pl.xlim([1e-13,1e1]) pl.ylim([1e5,1e20]) pl.grid() pl.xlabel('$E$ [GeV]') pl.ylabel('$\phi(E)$ [$(\mathrm{fb}^{-1}\ \mathrm{cm}^{2}\mathrm{GeV})^{-1}$]') pl.savefig('unfoldCMS1.pdf',bbox_inches=0) pl.show()