Belle II Software  release-08-01-10
DeltaRayPDF.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 
11 #include <top/reconstruction_cpp/BackgroundPDF.h>
12 #include <top/reconstruction_cpp/PixelPositions.h>
13 #include <top/reconstruction_cpp/TOPTrack.h>
14 #include <vector>
15 #include <cmath>
16 
17 namespace Belle2 {
22  namespace TOP {
23 
27  class DeltaRayPDF {
28 
29  public:
30 
35  explicit DeltaRayPDF(int moduleID);
36 
42  void prepare(const TOPTrack& track, const Const::ChargedStable& hypothesis);
43 
48  int getModuleID() const {return m_moduleID;}
49 
54  double getNumPhotons() const {return m_numPhotons;}
55 
60  double getFraction() const {return m_fraction;}
61 
68  double getPDFValue(int pixelID, double time) const;
69 
77  double getPDFValue(double time, double dt0 = 0, double acc = 1) const;
78 
85  double getIntegral(double minTime, double maxTime) const;
86 
87  private:
88 
92  struct GausXY {
93  double x = 0;
94  double y = 0;
100  explicit GausXY(double X): x(X), y(exp(-0.5 * x * x))
101  {}
102  };
103 
110  double angularDistr(double kz) const;
111 
118  double timeDistr(double t, double t0) const;
119 
126  double smearedTimeDistr(double t, double t0) const;
127 
135  double peakFraction(double tmin, double tmax, double t0) const;
136 
143  double totalFraction(double tmin, double tmax) const;
144 
150  double directFraction(double z) const;
151 
158  double photonYield(double beta, int PDGCode) const;
159 
160  // variables set in constructor (slot dependent)
164  double m_zD = 0;
165  double m_zM = 0;
166  double m_phaseIndex = 0;
167  double m_groupIndex = 0;
168  double m_dispersion = 0;
169  double m_angularNorm = 0;
170  std::vector<double> m_norms;
171  std::vector<GausXY> m_tableGaus;
173  // variables set in prepare method (track/hypothesis dependent)
174  double m_xE = 0;
175  double m_yE = 0;
176  double m_zE = 0;
177  double m_dirFrac = 0;
178  double m_dirT0 = 0;
179  double m_reflT0 = 0;
180  double m_TOF = 0;
181  double m_fraction = 0;
182  double m_numPhotons = 0;
183  std::vector<double> m_pixelAcceptances;
185  };
186 
187 
188  //--- inline functions ------------------------------------------------------------
189 
190  inline double DeltaRayPDF::angularDistr(double kz) const
191  {
192  if (std::abs(kz) < 1 / m_phaseIndex) {
193  double x = sqrt((1 - 1 / pow(m_phaseIndex, 2)) / (1 - pow(kz, 2)));
194  return 1 - acos(x) * 4 / M_PI;
195  }
196  return 1;
197  }
198 
199  inline double DeltaRayPDF::timeDistr(double t, double t0) const
200  {
201  if (t < t0) return 0;
202  return angularDistr(t0 / t) / m_angularNorm * t0 / pow(t, 2);
203  }
204 
205  inline double DeltaRayPDF::getPDFValue(double time, double dt0, double acc) const
206  {
207  double t = time - m_TOF;
208  double pdfDirect = smearedTimeDistr(t, m_dirT0 + dt0) * acc;
209  double pdfReflec = smearedTimeDistr(t, m_reflT0);
210  return m_dirFrac * pdfDirect + (1 - m_dirFrac) * pdfReflec;
211  }
212 
213  inline double DeltaRayPDF::getIntegral(double minTime, double maxTime) const
214  {
215  return totalFraction(minTime, maxTime) / m_fraction;
216  }
217 
218  } // namespace TOP
220 } // namespace Belle2
221 
Provides a type-safe way to pass members of the chargedStableSet set.
Definition: Const.h:580
Parametrization of background PDF in pixels of single module.
Definition: BackgroundPDF.h:23
Parametrization of delta-ray PDF in pixels of single module.
Definition: DeltaRayPDF.h:27
double m_dispersion
dispersion coefficient
Definition: DeltaRayPDF.h:168
double m_dirT0
minimal propagation time of direct photons
Definition: DeltaRayPDF.h:178
double m_reflT0
minimal propagation time of reflected photons
Definition: DeltaRayPDF.h:179
double totalFraction(double tmin, double tmax) const
Total fraction of delta-ray photons within given propagation time interval.
Definition: DeltaRayPDF.cc:148
double directFraction(double z) const
Fraction of direct photons from delta-rays, e.g direct/(direct+reflected)
Definition: DeltaRayPDF.cc:155
double m_zD
detector (photo-cathode) position in z
Definition: DeltaRayPDF.h:164
double m_dirFrac
fraction of direct photons
Definition: DeltaRayPDF.h:177
void prepare(const TOPTrack &track, const Const::ChargedStable &hypothesis)
Prepare the object.
Definition: DeltaRayPDF.cc:70
double m_yE
average photon emission position in y
Definition: DeltaRayPDF.h:175
double m_TOF
time-of-flight of particle
Definition: DeltaRayPDF.h:180
double m_groupIndex
group refractive index
Definition: DeltaRayPDF.h:167
const BackgroundPDF * m_background
background PDF
Definition: DeltaRayPDF.h:162
double photonYield(double beta, int PDGCode) const
Photon yield from delta-rays per track length in quartz for nominal photon detection efficiency.
Definition: DeltaRayPDF.cc:169
int getModuleID() const
Returns slot ID.
Definition: DeltaRayPDF.h:48
std::vector< double > m_norms
relative angular distribution normalization constants (cumulative)
Definition: DeltaRayPDF.h:170
std::vector< GausXY > m_tableGaus
table of normal (Gaussian) distribution
Definition: DeltaRayPDF.h:171
double m_zM
spherical mirror position in z
Definition: DeltaRayPDF.h:165
double m_angularNorm
angular distribution normalization constant
Definition: DeltaRayPDF.h:169
double getFraction() const
Returns fraction of delta-ray photons in the time window.
Definition: DeltaRayPDF.h:60
double peakFraction(double tmin, double tmax, double t0) const
Fraction of delta-ray photons within given propagation time interval for single peak at t0.
Definition: DeltaRayPDF.cc:138
DeltaRayPDF(int moduleID)
Class constructor.
Definition: DeltaRayPDF.cc:24
double m_fraction
fraction of delta-ray photons within time window
Definition: DeltaRayPDF.h:181
std::vector< double > m_pixelAcceptances
pixel angular acceptances for direct peak (index = pixelID - 1)
Definition: DeltaRayPDF.h:183
double m_phaseIndex
phase refractive index
Definition: DeltaRayPDF.h:166
double getNumPhotons() const
Returns number of photons.
Definition: DeltaRayPDF.h:54
double getIntegral(double minTime, double maxTime) const
Returns integral of PDF from minTime to maxTime.
Definition: DeltaRayPDF.h:213
double smearedTimeDistr(double t, double t0) const
Smeared time distribution of photons from delta rays (normalized).
Definition: DeltaRayPDF.cc:126
const PixelPositions * m_pixelPositions
pixel positions
Definition: DeltaRayPDF.h:163
double angularDistr(double kz) const
Angular distribution of photons from delta rays w/ total reflection requirement.
Definition: DeltaRayPDF.h:190
double m_zE
average photon emission position in z
Definition: DeltaRayPDF.h:176
double m_numPhotons
number of photons
Definition: DeltaRayPDF.h:182
double getPDFValue(int pixelID, double time) const
Returns PDF value at given time and pixel.
Definition: DeltaRayPDF.cc:113
double timeDistr(double t, double t0) const
Time distribution of photons from delta rays (normalized).
Definition: DeltaRayPDF.h:199
double m_xE
average photon emission position in x
Definition: DeltaRayPDF.h:174
Pixel positions and dimensions in module local frame.
Reconstructed track at TOP.
Definition: TOPTrack.h:39
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
Abstract base class for different kinds of events.
Normal (Gaussian) distribution: an entry for the table.
Definition: DeltaRayPDF.h:92
GausXY(double X)
Constructor.
Definition: DeltaRayPDF.h:100
double y
function value
Definition: DeltaRayPDF.h:94