HerdSoftware  0.1.1
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 {
26 namespace Herd {
27 namespace FitDigitizationTools {
28 
29 namespace AttenuationTool {
30 
31 double m_matLength = std::numeric_limits<double>::min();
32 
33 namespace {
34 constexpr double m_shortAttenuationLength = 20; //"Attenuation length of the light along the fibre: short component"
35 constexpr double m_longAttenuationLength = 470; //"Attenuation length of the light along the fibre: long component"
36 constexpr double m_fractionShort = 0.18; //"Fraction of short attenuation at SiPM"
37 constexpr double m_reflectionCoefficient = 0.7; // "Reflection coefficient of the fibre mirrored side, from 0 to 1"
38 
39 inline double calcAtt(const double l) {
40  return (m_fractionShort * exp(-l / m_shortAttenuationLength) +
41  (1 - m_fractionShort) * exp(-l / m_longAttenuationLength));
42 }
43 
44 // here we assume SiPM array is located in +m_matLength/2.
45 // and the coordinates system is local coordinates
46 inline double calcAttDir(const double y) {
47  double Len = m_matLength / 2. - y;
48  return calcAtt(Len);
49 }
50 
51 inline double calcAttRef(const double y) {
52  double Len_dir = y - (-m_matLength / 2.);
53  return calcAtt(Len_dir) * m_reflectionCoefficient * calcAtt(m_matLength);
54 }
55 } // namespace
56 
58 std::pair<double, double> attenuation(const double hitYPosition) {
59  return std::make_pair(calcAttDir(hitYPosition), calcAttRef(hitYPosition));
60 }
61 
62 } // namespace AttenuationTool
63 } // namespace FitDigitizationTools
64 } // namespace Herd
65 #endif
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:24
double m_matLength
Definition: AttenuationTool.h:31
std::pair< double, double > attenuation(const double hitYPosition)
Calculate the direct attenuation and the attenuation with reflection.
Definition: AttenuationTool.h:58