EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
tofBarrel.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file tofBarrel.C
1 #include "tofBarrel.h"
2 
3 using namespace std;
4 
5 
6 tofBarrel::tofBarrel(double r, double eL, double eH, double sT)
7 {
8  radius = r;
9  etaLow = eL;
10  etaHigh = eH;
11  sigmaT = sT;
12 
13  char nameit[500];
14  sprintf(nameit,"TOF barrel R=%d dT=%d",int(radius),int(sigmaT));
15  myName = nameit;
16 
17  // Initialize a few constants: Wikipedia...should be redone in a better manner...
18  c = 0.0299792458; // cm/picosecond
19  mPion = 0.13957018; //GeV/c^2
20  mKaon = 0.493677; //GeV/c^2
21  mProton = 0.93827208816; //GeV/c^2
22 }
23 
24 double tofBarrel::numSigma(double eta, double p, PID::type PID)
25 {
26  if (valid(eta,p))
27  {
28  double theta = 2.0*atan( exp(-eta) );
29  double L = radius/sin(theta);
30  if (PID == pi_k)
31  {
32  return (tof(L,p,mKaon)-tof(L,p,mPion))/sigmaT;
33  }
34  if (PID == k_p)
35  {
36  return (tof(L,p,mProton)-tof(L,p,mKaon))/sigmaT;
37  }
38  cout << "tofBarrel.C: Unrecognized PID type requested." <<endl;
39  return 0.0;
40  }
41  else
42  {
43  cout << "tofBarrel.C: Invalid (eta,p) for this detector." <<endl;
44  return 0.0;
45  }
46 }
47 
48 double tofBarrel::maxP(double eta, double numSigma, PID::type PID)
49 {
50  //
51  // Justification of formula:
52  // Tof1 = L/c *1/sqrt( p^2 / (m1^2 + p^2) ) = L/c * 1/p * sqrt(m1^2 + p^2)
53  // Tof2 = L/c *1/sqrt( p^2 / (m2^2 + p^2) ) = L/c * 1/p * sqrt(m2^2 + p^2)
54  // Require: numSigma*sigmaT = Tof1 - Tof2
55  // Therefore: (c/L) * numSigma *sigmaT = 1/p * [ sqrt(m1^2 + p^2) - sqrt(m1^2 + p^2) ]
56  // Let:
57  // a = c/L * numSigma * sigmaT
58  // b = m1
59  // c = m2
60  // Wolfram Alpha:
61  // https://www.wolframalpha.com/input/?i=solve+1%2Fx*%28sqrt%28x%5E2%2Bb%5E2%29+-+sqrt%28x%5E2%2Bc%5E2%29%29%3Da+for+x
62 
63  if (valid(eta,1.0))
64  {
65  double theta = 2.0*atan( exp(-eta) );
66  double L = radius/sin(theta);
67 
68  double a = c/L * numSigma * sigmaT;
69  double b=mKaon;
70  double c=mPion;
71  if (PID == k_p)
72  {
73  b=mProton;
74  c=mKaon;
75  }
76 
77  double num1 = a*a*b*b;
78  double num2 = 2*sqrt(a*a*(a*a*b*b*c*c + b*b*b*b -2*b*b*c*c + c*c*c*c));
79  double num3 = a*a*c*c;
80  double denom = a*a*a*a - 4*a*a;
81 
82  return ( sqrt( (num1-num2+num3)/denom ) );
83 
84  }
85  else
86  {
87  cout << "tofBarrel.C: Invalid (eta) for this detector." <<endl;
88  return 0.0;
89  }
90 
91 }
92 
93 double tofBarrel::tof(double L, double p, double m)
94 {
95  double p2_m2 = p*p/(m*m);
96  double beta = sqrt(p2_m2/(1+p2_m2));
97  return (L/(c*beta));
98 }
99 
101 {
102  // Here one should describe what this detector is and what assumptions are
103  // made in calculating the performance specifications.
104 
105  cout << "My name is \"" << myName << "\" and I am described as follows:" <<endl;
106  cout << " I am a Time-of-Flight barrel." <<endl;
107  cout << " I extend from eta = " << etaLow << " until eta = " << etaHigh << " ." <<endl;
108  cout << " I am located at radius R= " << radius << " cm." <<endl;
109  cout << " I have a time resolution of " << sigmaT << " picoseconds." <<endl;
110  cout << " My calculations have assumed perfect momentum resolution and pointing." <<endl;
111  cout << " My calculations have assumed purely Gaussian time response." <<endl;
112  cout << endl;
113 
114 }