HerdSoftware  0.4.0
AttenuationTool.h
Go to the documentation of this file.
1 /*
2  * AttenuationTool.h
3  *
4  * Tool to calculate the attenuation length for direct and reflectec light in a scintillating fibre.
5  *
6  * Created on 03 Mar 2020
7  * Author: Valerio Formato (based on code by Junjing Wang)
8  */
9 
10 /*
11  * Some definitions:
12  * - ShortAttenuationLength: Distance along the fibre to divide the light amplitude by a factor e : short component
13  * - LongAttenuationLength: Distance along the fibre to divide the light amplitude by a factor e : long component
14  * - FractionShort: Fraction of short attenuation at SiPM
15  */
16 
17 #ifndef HERD_ATTENUATIONTOOL_H_
18 #define HERD_ATTENUATIONTOOL_H_
19 
20 #include <limits>
21 #include <math.h>
22 #include <utility>
23 
24 // this in c++17 will become
25 // namespace Herd::FitDigitizationTools {
27 
28 double m_matLength = std::numeric_limits<double>::min();
29 
30 namespace {
31 constexpr double m_shortAttenuationLength = 20; //"Attenuation length of the light along the fibre: short component"
32 constexpr double m_longAttenuationLength = 470; //"Attenuation length of the light along the fibre: long component"
33 constexpr double m_fractionShort = 0.18; //"Fraction of short attenuation at SiPM"
34 constexpr double m_reflectionCoefficient = 0.7; // "Reflection coefficient of the fibre mirrored side, from 0 to 1"
35 
36 inline double calcAtt(const double l) {
37  return (m_fractionShort * exp(-l / m_shortAttenuationLength) +
38  (1 - m_fractionShort) * exp(-l / m_longAttenuationLength));
39 }
40 
41 // here we assume SiPM array is located in +m_matLength/2.
42 // and the coordinates system is local coordinates
43 inline double calcAttDir(const double y) {
44  double Len = m_matLength / 2. - y;
45  return calcAtt(Len);
46 }
47 
48 inline double calcAttRef(const double y) {
49  double Len_dir = y - (-m_matLength / 2.);
50  return calcAtt(Len_dir) * m_reflectionCoefficient * calcAtt(m_matLength);
51 }
52 } // namespace
53 
55 std::pair<double, double> attenuation(const double hitYPosition) {
56  return std::make_pair(calcAttDir(hitYPosition), calcAttRef(hitYPosition));
57 }
58 
59 } // namespace Herd::FitDigitizationTools::AttenuationTool
60 #endif
Herd::FitDigitizationTools::AttenuationTool::m_matLength
double m_matLength
Definition: AttenuationTool.h:28
Herd::FitDigitizationTools::AttenuationTool
Definition: AttenuationTool.h:26
Herd::FitDigitizationTools::AttenuationTool::attenuation
std::pair< double, double > attenuation(const double hitYPosition)
Calculate the direct attenuation and the attenuation with reflection.
Definition: AttenuationTool.h:55