HerdSoftware  0.4.0
PhotonTool.h
Go to the documentation of this file.
1 /*
2  * PhotonTool.h
3  *
4  * Interface for the tool that transforms deposited energies to photons exiting
5  * the fibre ends
6  *
7  * Created on 03 Mar 2020
8  * Author: Valerio Formato (based on code by Junjing Wang)
9  */
10 
11 #ifndef HERD_PHOTONTOOL_H_
12 #define HERD_PHOTONTOOL_H_
13 
14 #include <random>
15 
17 
18 // this in c++17 will become
19 // namespace Herd::FitDigitizationTools {
21 
22 class PhotonTool {
23 
24 public:
26  ~PhotonTool() = default;
27 
28  double numExpectedPhotons(double effective_energy);
29  int numObservedPhotons(double num_expected_photons);
30  double averagePropagationTime(double distToSiPM) {
31  // because the default unit is cm, convert mm to m 1e-3
32  return (distToSiPM * 1e-2) * m_fibrePropagationSpeed;
33  };
34 
36 
37  void generatePhoton(double &time, double &wavelength, double &posX, double &posZ, double &dXdY, double &dZdY);
38  // double &dXdY, double &dZdY, double &newTheta, double &newPhi);
39 
40 private:
42  void generatePosAndDir(double &posX, double &posZ, double &dXdY, double &dZdY);
43 
44  bool m_generateWavelength = true; // "Flag for turning on random wavelength generation"
45  const double m_photonsPerMeV = 455.; //"Average number of photons per MeV"
46  const double m_wavelengthShift = 405. * nm; // "Shift parameter of Wavelength distributions"};
47  const double m_wavelengthScale = 77.89 * nm; // "Scale parameter of Wavelength distributions"};
48  const double m_wavelengthShape = 0.44; // "Shape parameter of Wavelength distributions"};
49 
50  // Fibre properties
51  const double m_effFibreR = 0.0115; // "Effective Radius of the fibre"};
52  const double m_fibrePropagationSpeed = 6.0; //(ns/m) //"Light propagation speed in fibre"};
53  const double m_scintillationDecayTime = 2.8 * ns; //"Decay time of scintillation light release"};
54 
55  // Random number generators
56  std::mt19937 m_generator;
57  std::uniform_real_distribution<double> m_flat_dist;
58  std::poisson_distribution<unsigned int> m_pois_dist;
59  std::normal_distribution<double> m_gauss_dist;
60 };
61 
62 } // namespace Herd::FitDigitizationTools
63 #endif
Herd::FitDigitizationTools::PhotonTool::m_pois_dist
std::poisson_distribution< unsigned int > m_pois_dist
Definition: PhotonTool.h:58
Herd::FitDigitizationTools::PhotonTool::m_gauss_dist
std::normal_distribution< double > m_gauss_dist
Definition: PhotonTool.h:59
Herd::FitDigitizationTools::PhotonTool::m_generator
std::mt19937 m_generator
Definition: PhotonTool.h:56
Herd::FitDigitizationTools::PhotonTool::m_scintillationDecayTime
const double m_scintillationDecayTime
Definition: PhotonTool.h:53
Herd::FitDigitizationTools::PhotonTool::generatePhoton
void generatePhoton(double &time, double &wavelength, double &posX, double &posZ, double &dXdY, double &dZdY)
Definition: PhotonTool.cpp:36
Herd::FitDigitizationTools::PhotonTool
Definition: PhotonTool.h:22
Herd::FitDigitizationTools
Definition: AttenuationTool.h:26
Herd::FitDigitizationTools::PhotonTool::m_wavelengthShape
const double m_wavelengthShape
Definition: PhotonTool.h:48
Herd::FitDigitizationTools::PhotonTool::m_fibrePropagationSpeed
const double m_fibrePropagationSpeed
Definition: PhotonTool.h:52
Herd::FitDigitizationTools::PhotonTool::m_flat_dist
std::uniform_real_distribution< double > m_flat_dist
Definition: PhotonTool.h:57
Herd::FitDigitizationTools::PhotonTool::m_photonsPerMeV
const double m_photonsPerMeV
Definition: PhotonTool.h:45
Herd::FitDigitizationTools::PhotonTool::numObservedPhotons
int numObservedPhotons(double num_expected_photons)
Definition: PhotonTool.cpp:27
Herd::FitDigitizationTools::ns
constexpr double ns
Definition: Units.h:8
Herd::FitDigitizationTools::PhotonTool::m_effFibreR
const double m_effFibreR
Definition: PhotonTool.h:51
Herd::FitDigitizationTools::PhotonTool::m_wavelengthShift
const double m_wavelengthShift
Definition: PhotonTool.h:46
Herd::FitDigitizationTools::PhotonTool::generateScintillationTime
double generateScintillationTime()
Definition: PhotonTool.h:35
Herd::FitDigitizationTools::PhotonTool::m_generateWavelength
bool m_generateWavelength
Definition: PhotonTool.h:44
Herd::FitDigitizationTools::nm
constexpr double nm
Definition: Units.h:7
Herd::FitDigitizationTools::PhotonTool::PhotonTool
PhotonTool()
Definition: PhotonTool.h:25
Units.h
Herd::FitDigitizationTools::PhotonTool::averagePropagationTime
double averagePropagationTime(double distToSiPM)
Definition: PhotonTool.h:30
Herd::FitDigitizationTools::PhotonTool::generatePosAndDir
void generatePosAndDir(double &posX, double &posZ, double &dXdY, double &dZdY)
Generate photon exit position and direction in fibre.
Definition: PhotonTool.cpp:49
Herd::FitDigitizationTools::PhotonTool::m_wavelengthScale
const double m_wavelengthScale
Definition: PhotonTool.h:47
Herd::FitDigitizationTools::PhotonTool::~PhotonTool
~PhotonTool()=default
Herd::FitDigitizationTools::PhotonTool::numExpectedPhotons
double numExpectedPhotons(double effective_energy)
Definition: PhotonTool.cpp:22