57 {
58 auto* MTCDet =
59 dynamic_cast<MTCDetector*
>(gROOT->GetListOfGlobals()->FindObject(
"MTC"));
60 if (!MTCDet) {
61 LOG(fatal) << "MTCDetHit: MTCDetector not found";
62 return;
63 }
64
66
68
69 Float_t total_light_yield = 0.0f;
70 Float_t earliest_to_A = std::numeric_limits<Float_t>::max();
71 Float_t earliest_to_B = std::numeric_limits<Float_t>::max();
72 const size_t n = points.size();
73 Float_t signal_sum = 0.0f;
74 bool hit_flag = false;
75
76
77 if (plane_type == 2) {
78 Float_t x_temp = 0.0, y_temp = 0.0, z_temp = 0.0;
79 for (auto* pt : points) {
80 signal_sum +=
pt->GetEnergyLoss();
81
82 Float_t arrival =
pt->GetTime();
83 earliest_to_B = std::min(earliest_to_B, arrival);
87 }
88 time = gRandom->Gaus(earliest_to_B, time_res);
89
90
95 return;
96 }
97
98
99 total_light_yield = 0.0f;
100
101 TVector3 sipmA, sipmB;
102 MTCDet->GetSiPMPosition(SiPMChan, sipmA, sipmB);
103
106
107 for (
size_t i = 0;
i <
n; ++
i) {
108 auto*
pt = points[
i];
109 Float_t
energy =
pt->GetEnergyLoss();
112
113
114 TVector3 impact(
pt->GetX(),
pt->GetY(),
pt->GetZ());
115 const Float_t distance = (sipmB - impact).Mag();
116
117
118 Float_t light_yield =
signal * 1e6f * 0.16f;
119 light_yield *= light_attenuation(distance);
120 total_light_yield += light_yield;
121
122
123 Float_t arrival =
pt->GetTime() + distance * inv_signal_speed;
124 earliest_to_A = std::min(earliest_to_A, arrival);
125 }
126
127
128 const Int_t smeared_light_yield = gRandom->Poisson(total_light_yield);
129 const Float_t n_pixels = sipm_saturation(smeared_light_yield);
130 signals = n_pixels_to_qdc(n_pixels);
131
132
133 hit_flag = (smeared_light_yield > n_photons_min);
135 time = gRandom->Gaus(earliest_to_A, time_res);
136}
Int_t GetStationType() const
Int_t fDetectorID
Detector unique identifier.