HerdSoftware  0.4.0
DistributionChannelTool.h
Go to the documentation of this file.
1 /*
2  * DistributionChannelTool.h
3  *
4  * This tool calculates the fraction of the total path length
5  * of a track in the core of each fibre that was hit along with
6  * the position of the fibre.
7  *
8  * Created on 03 Mar 2020
9  * Author: Valerio Formato (based on code by Junjing Wang)
10  */
11 
12 // clang-format off
13  // sipm setup parameters
14 
15  // Mat and SiPMs
16  // -----------------------------------------------------------
17  // |---------------| |---------------| |---------------|
18  // | | | | | |
19  // | SiPM0 |0.09| SiPM1 |0.09| SiPM2 |
20  // | 32.54mm | mm | 32.54mm | mm | 32.54mm |
21  // | | | | | |
22  // |---------------| |---------------| |---------------|
23  // -----------------------------------------------------------
24  // \_________________________97.8mm__________________________/
25  //
26  //
27  // SiPM structure
28  //
29  // ==================================================
30  // | | | | | |
31  // | | | | | |
32  // | | active die0 | | active die0 | |
33  // |0.16| |0.22| |0.16|
34  // | mm | 0.25mm*64 | mm | 0.25mm*64 | mm |
35  // | | | | | |
36  // | | | | | |
37  // | | | | | |
38  // ==================================================
39  // \__________________32.54mm_______________________/
40  //
41  //
42  // gap between SiPMs is actually determined by FitGeoParams dynamically
43 // clang-format on
44 
45 #ifndef HERD_DISTRIBUTIONCHANNELTOOL_H_
46 #define HERD_DISTRIBUTIONCHANNELTOOL_H_
47 
49 
50 #include <optional>
51 
52 // this in c++17 will become
53 // namespace Herd::FitDigitizationTools {
55 
57 public:
58  /*
59  G4int targetChannel(double posX, double posZ,
60  double dXdY, double dZdY);
61  */
62  static std::optional<int> targetChannel(double posX, double posZ, double dXdY, double dZdY,
63  const FitGeoParams &geoParams);
64 
65 private:
66  // members for detailed simulation
67  static constexpr double m_channelSizeZ = 0.1625; //"Channel width in z direction (local coordinates)"
68  static constexpr double m_epoxyWidth = 0.01; // "Thickness of the epoxy layer between fibre ends and SiPMs"
69  static constexpr double m_airWidth = 0.002; // "Thickness of the air layer between fibre ends and SiPMs"
70  static constexpr double m_refractionIndex = 1.52; // refraction index of sipm's epoxy
71 
72  // gcc marks this function as unused, even if it is not (maybe because it's used in a try block)
73  static std::optional<std::pair<int, double>> calculateChannelAndFrac(double localX, const FitGeoParams &geoParams);
74 
76  static double findFinalPosSlope(double pos, double slope) { return pos + m_epoxyWidth * slope; }
77 };
78 } // namespace Herd::FitDigitizationTools
79 #endif // DISTRIBUTIONCHANNELTOOL_H
FitGeoParams.h
Herd::FitDigitizationTools::DistributionChannelTool
Definition: DistributionChannelTool.h:56
Herd::FitDigitizationTools
Definition: AttenuationTool.h:26
Herd::FitDigitizationTools::DistributionChannelTool::targetChannel
static std::optional< int > targetChannel(double posX, double posZ, double dXdY, double dZdY, const FitGeoParams &geoParams)
Definition: DistributionChannelTool.cpp:57
Herd::FitDigitizationTools::DistributionChannelTool::m_epoxyWidth
static constexpr double m_epoxyWidth
Definition: DistributionChannelTool.h:68
Herd::FitDigitizationTools::DistributionChannelTool::m_channelSizeZ
static constexpr double m_channelSizeZ
Definition: DistributionChannelTool.h:67
Herd::FitGeoParams
Data structure for single silicon layer geometry parameters.
Definition: FitGeoParams.h:66
Herd::FitDigitizationTools::DistributionChannelTool::m_refractionIndex
static constexpr double m_refractionIndex
Definition: DistributionChannelTool.h:70
Herd::FitDigitizationTools::DistributionChannelTool::m_airWidth
static constexpr double m_airWidth
Definition: DistributionChannelTool.h:69
Herd::FitDigitizationTools::DistributionChannelTool::calculateChannelAndFrac
static std::optional< std::pair< int, double > > calculateChannelAndFrac(double localX, const FitGeoParams &geoParams)
Definition: DistributionChannelTool.cpp:24
Herd::FitDigitizationTools::DistributionChannelTool::findFinalPosSlope
static double findFinalPosSlope(double pos, double slope)
Calculate the final x position of a photon based on its slope at the fibre.
Definition: DistributionChannelTool.h:76