ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ECCEdRICHFastPIDMap.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ECCEdRICHFastPIDMap.cc
1 // $Id: $
2 
11 #include "ECCEdRICHFastPIDMap.h"
12 
13 #include <TF1.h>
14 #include <TFile.h>
15 #include <TGraph.h>
16 #include <TH2F.h>
17 #include <TMath.h>
18 #include <TRandom.h>
19 #include <TVector3.h>
20 
21 #include <cassert>
22 #include <cmath>
23 #include <iostream>
24 
26 
28 
31  const double momentum,
32  const double theta_rad) const {
33  assert(initialized);
34 
36 
37  const int abs_truth_pid = abs(truth_pid);
38  const double eta = -log(tan(0.5 * theta_rad));
39 
40  if (eta < etaMin() or eta > etaMax()) {
41  // not processing out of acceptance tracks
42  if (Verbosity())
43  std::cout << __PRETTY_FUNCTION__ << " " << mName
44  << ": not processing out of acceptance tracks eta = " << eta
45  << " etaMin() = " << etaMin() << " etaMax() = " << etaMax()
46  << std::endl;
47 
48  return ll_map;
49  }
50 
51  const double Nsigma_piK = numSigma(eta, momentum, pi_k);
52  const double Nsigma_Kp = numSigma(eta, momentum, k_p);
53 
54  if (Verbosity())
55  std::cout << __PRETTY_FUNCTION__ << " " << mName
56  << ": processing tracks momentum = " << momentum
57  << " eta = " << eta << " Nsigma_piK = " << Nsigma_piK
58  << " Nsigma_Kp = " << Nsigma_Kp << std::endl;
59 
60  const double pion_sigma_space_ring_radius = +Nsigma_piK;
61  const double kaon_sigma_space_ring_radius = 0;
62  const double proton_sigma_space_ring_radius = -Nsigma_Kp;
63 
64  double sigma_space_ring_radius = gRandom->Gaus(0, 1);
65  if (abs_truth_pid == EICPIDDefs::PionCandiate)
66  sigma_space_ring_radius += pion_sigma_space_ring_radius;
67  else if (abs_truth_pid == EICPIDDefs::KaonCandiate)
68  sigma_space_ring_radius += kaon_sigma_space_ring_radius;
69  else if (abs_truth_pid == EICPIDDefs::ProtonCandiate)
70  sigma_space_ring_radius += proton_sigma_space_ring_radius;
71 
72  ll_map[EICPIDDefs::PionCandiate] =
73  -0.5 * pow(sigma_space_ring_radius - pion_sigma_space_ring_radius, 2);
74  ll_map[EICPIDDefs::KaonCandiate] =
75  -0.5 * pow(sigma_space_ring_radius - kaon_sigma_space_ring_radius, 2);
77  -0.5 * pow(sigma_space_ring_radius - proton_sigma_space_ring_radius, 2);
78 
79  return ll_map;
80 }
81 
83  switch (mType) {
84  case kBarrel:
85  return -log(tan(atan2(mRadius, -mLength) * 0.5));
86  case kForward:
87  return -log(tan(atan2(mRadiusOut, mPositionZ) * 0.5));
88  }
89  return 0.;
90 }
91 
93  switch (mType) {
94  case kBarrel:
95  return -log(tan(atan2(mRadius, mLength) * 0.5));
96  case kForward:
97  return -log(tan(atan2(mRadiusIn, mPositionZ) * 0.5));
98  }
99  return 0.;
100 }
101 
103  initialized = true;
104  setName("aerogel");
106  setType(kForward);
107  setRadiusIn(10.); // [cm]
108  setRadiusOut(120.); // [cm]
109  setPositionZ(250.); // [cm]
111  setLength(4.); // [cm]
112  setIndex(1.02);
114  setEfficiency(0.08);
116  double angle[5] = {5., 10., 15., 20., 25.}; // [deg]
117  double chromatic[5] = {0.00260572, 0.00223447, 0.00229996, 0.00237615,
118  0.00245689}; // [rad] from actual file
119  double emission[5] = {0.000658453, 0.000297004, 0.00014763, 0.000196477,
120  0.000596087}; // [rad] from actual file
121  double pixel[5] = {0.000502646, 0.000575427, 0.000551095, 0.000555055,
122  0.000564831}; // [rad] from actual file
123  double field[5] = {8.13634e-05, 6.41901e-05, 3.92289e-05, 9.76800e-05,
124  2.58328e-05}; // [rad] from actual file
125  double tracking[5] = {0.000350351, 0.000306691, 0.000376006, 0.000401814,
126  0.000389742}; // [rad] from actual file
127  setChromaticSigma(5, angle, chromatic);
128  setPositionSigma(5, angle, pixel);
129  setEmissionSigma(5, angle, emission);
130  setFieldSigma(5, angle, field);
131  setTrackingSigma(5, angle, tracking);
132 }
133 
135  initialized = true;
136  setName("C2F6");
138  setType(kForward);
139  setRadiusIn(10.); // [cm]
140  setRadiusOut(120.); // [cm]
141  setPositionZ(250.); // [cm]
143  setLength(160.); // [cm]
144  setIndex(1.0008);
146  setEfficiency(0.15);
148  double angle[5] = {5., 10., 15., 20., 25.}; // [deg]
149  double chromatic[5] = {0.000516327, 0.000527914, 0.000525467, 0.000515349,
150  0.000489377}; // [rad] from actual file
151  double emission[5] = {0.001439090, 0.000718037, 0.000656786, 0.000946782,
152  0.001404630}; // [rad] from actual file
153  double pixel[5] = {0.000480520, 0.000533282, 0.000564187, 0.000577872,
154  0.000605236}; // [rad] from actual file
155  double field[5] = {8.60521e-05, 7.64798e-05, 0.000167358, 0.000475598,
156  0.000629863}; // [rad] from actual file
157  double tracking[5] = {0.000389136, 0.000328530, 0.000402517, 0.000417901,
158  0.000393391}; // [rad] from actual file
159  setChromaticSigma(5, angle, chromatic);
160  setPositionSigma(5, angle, pixel);
161  setEmissionSigma(5, angle, emission);
162  setFieldSigma(5, angle, field);
163  setTrackingSigma(5, angle, tracking);
164 }
165 
167  double m) const {
168  auto theta = 2. * atan(exp(-eta)) * 57.295780;
169  auto chromatic = mChromaticSigma ? mChromaticSigma->Eval(theta) : 0.;
170  auto position = mPositionSigma ? mPositionSigma->Eval(theta) : 0.;
171  auto emission = mEmissionSigma ? mEmissionSigma->Eval(theta) : 0.;
172  auto field = mFieldSigma ? mFieldSigma->Eval(theta) : 0.;
173  auto tracking = mTrackingSigma ? mTrackingSigma->Eval(theta) : 0.;
174 
175  // contributions that scale with number of detected photons
176  auto ndet = numberOfDetectedPhotons(cherenkovAngle(p, m));
177  auto sigma1 = sqrt(chromatic * chromatic + position * position +
178  emission * emission + field * field + tracking * tracking);
179  // contributions that do not
180  auto sigma2 = 0.;
181  //
182  return sqrt(sigma1 * sigma1 / ndet + sigma2 * sigma2);
183 };
184 
185 double ECCEdRICHFastPIDMap::numSigma(double eta, double p,
187  double mass1(0), mass2(0);
188  switch (PID) {
189  case pi_k:
190  mass1 = mMassPion;
191  mass2 = mMassKaon;
192  break;
193  case k_p:
194  mass1 = mMassKaon;
195  mass2 = mMassProton;
196  break;
197  default:
198  assert(0); // exit the code for logical error
199  exit(1);
200  }
201 
202  double thr1 = cherenkovThreshold(mass1);
203  double thr2 = cherenkovThreshold(mass2);
204 
205  if (Verbosity())
206  std::cout << __PRETTY_FUNCTION__ << " " << mName
207  << ": processing tracks momentum = " << p << " eta = " << eta
208  << " thr1 = " << thr1 << " thr2 = " << thr2 << std::endl;
209 
211  if (p > thr1 && p > thr2) {
212 
213  if (Verbosity())
214  std::cout << __PRETTY_FUNCTION__ << " " << mName
215  << ": processing tracks momentum = " << p << " eta = " << eta
216  << " cherenkovAngle(p, mass1) = " << cherenkovAngle(p, mass1)
217  << " cherenkovAngle(p, mass2)) = " << cherenkovAngle(p, mass2)
218  << " cherenkovAngleSigma(eta, p, mass1) = "
219  << cherenkovAngleSigma(eta, p, mass1) << std::endl;
220 
221  return (cherenkovAngle(p, mass1) - cherenkovAngle(p, mass2)) /
222  cherenkovAngleSigma(eta, p, mass1);
223  }
225  if (mThresholdMode && p > thr1)
226  return (cherenkovAngle(thr2 + 0.001, mass1) -
227  cherenkovAngle(thr2 + 0.001, mass2)) /
228  cherenkovAngleSigma(eta, thr2 + 0.001, mass1);
229 
231  return 0.;
232 }