File indexing completed on 2024-11-16 09:01:51
0001 from math import *
0002 import matplotlib.pyplot as plt
0003 import numpy as np
0004 import getopt
0005 import sys
0006 from matplotlib.ticker import *
0007
0008 narg = len(sys.argv)
0009 if narg == 1:
0010 print("usage :", sys.argv[0], "1 1 0.3");
0011 print("First number 0 --> pi/K 1--> e/pi");
0012 print("Second number 0 --> gas 1--> aerogel");
0013 print("Third number is the working resolution");
0014 exit();
0015 agrv1 = sys.argv[1];
0016 agrv2 = sys.argv[2];
0017 sigma = float(sys.argv[3]);
0018
0019 file = "";
0020 mass1 = 0;
0021 mass2 = 0;
0022 refIndex = 0;
0023 maxmom = 0;
0024
0025 fig, ax = plt.subplots();
0026 ml = AutoMinorLocator(2);
0027
0028 ax.xaxis.set_minor_locator(ml);
0029
0030 if agrv1 == '0':
0031 mass1 = 0.139;
0032 mass2 = 0.493;
0033 file = "piK.pdf";
0034 plt.title('pi/K separation');
0035 if agrv2 == '0':
0036 refIndex = 1.0008;
0037 maxmom = 60;
0038 plt.ylim([1, 100]);
0039 elif agrv2 == '1':
0040 refIndex = 1.02;
0041 maxmom = 20;
0042 plt.ylim([1, 100]);
0043
0044 elif agrv1 == '1':
0045 mass1 = 0.000511;
0046 mass2 = 0.139;
0047 file = "epi.pdf";
0048 plt.title("e-Pi Separation");
0049 if agrv2 == '0':
0050 refIndex = 1.0008;
0051 maxmom = 20;
0052 plt.ylim([1, 100]);
0053 elif agrv2 == '1':
0054 refIndex = 1.02;
0055 maxmom = 10;
0056 plt.ylim([1, 100]);
0057
0058 p = [0.0];
0059 y = [0.0];
0060 z = [0.0];
0061 m = [0.0];
0062
0063
0064
0065
0066 print(mass1, mass2, refIndex, maxmom);
0067
0068
0069 def computebeta(zz, mm):
0070 return zz / sqrt(zz * zz + mm * mm);
0071
0072
0073 def computetheta(beta):
0074 csth = (1 / (refIndex * beta));
0075 if (csth > 1):
0076 return 0;
0077 else:
0078 return acos(csth);
0079
0080
0081 for x in range(0, maxmom, 1):
0082 p.append(x);
0083 y.append(1000 * computetheta(computebeta((x + 0.1), mass1)));
0084 z.append(1000 * computetheta(computebeta((x + 0.1), mass2)));
0085
0086 Y = np.array(y);
0087 Z = np.array(z);
0088 m_a = np.subtract(Y, Z);
0089 m_0 = np.divide(m_a, sigma);
0090 m = list(m_0);
0091
0092
0093
0094
0095 plt.plot(p, m, color='magenta', linestyle='solid', linewidth=1.5,
0096 marker='o', markerfacecolor='blue', markersize=1.0);
0097 plt.yscale('log');
0098 plt.xlabel('momentum (GeV/c)');
0099 plt.ylabel('expected N-sigma separation');
0100 plt.grid(True);
0101 plt.grid(which='minor', alpha=0.3)
0102
0103
0104
0105
0106
0107 plt.savefig(file);