7 #include <FairLogger.h>
9 #include <Math/Point2D.h>
10 #include <Math/Point2Dfwd.h>
11 #include <Math/Vector3D.h>
12 #include <Math/Vector3Dfwd.h>
23 constexpr
auto cRED =
"\033[1;31m";
26 constexpr
auto cGREEN =
"\033[1;32m";
31 LOG(debug) <<
"Constructor of AtPulseLineTask";
36 auto r = gRandom->Gaus(0, diffusionSigma);
37 auto phi = gRandom->Uniform(0, TMath::TwoPi());
38 double propX = loc.x() + r * TMath::Cos(phi);
39 double propY = loc.y() + r * TMath::Sin(phi);
41 return fMap->GetPadNum(pos);
47 fXYintegrationMap.clear();
52 for (
int i = 0; i < fNumIntegrationPoints; ++i) {
58 fXYintegrationMap[padNumber]++;
62 for (
auto &elem : fXYintegrationMap)
63 elem.second /= (double)validPoints;
69 if (line ==
nullptr) {
70 LOG(fatal) <<
"Data in branch AtSimulatedPoint is not of type AtSimulatedLine!";
75 std::vector<double> zIntegration;
79 for (
const auto &[padNum, percentEle] : fXYintegrationMap) {
83 for (
int i = 0; i < zIntegration.size(); ++i) {
84 auto zLoc =
fPadCharge[0]->GetXaxis()->GetBinCenter(i + binMin);
85 auto charge = line->GetCharge() * zIntegration[i] * percentEle;
86 double gain =
GetGain(padNum, charge);
103 auto dT = (tMax - tMin);
105 LOG(debug) <<
"This line charge spans multiple TB widths from " << tMin <<
" us to " << tMax <<
" us.";
106 LOG(debug) <<
" The time distribution is likely widder than will be calculated. dT: " << dT
107 <<
"ns TB width: " <<
fTBTime <<
"ns";
110 auto tMean = (tMax + tMin) / 2.;
114 const TAxis *axis =
fPadCharge[0]->GetXaxis();
115 auto binMin = axis->FindBin(tIntegrationMinimum);
116 auto binMax = axis->FindBin(tIntegrationMaximum);
125 double lowerBound = TMath::Erf((axis->GetBinLowEdge(binMin) - tMean) / denominator);
126 for (
int i = binMin; i <= binMax; ++i) {
127 auto upperBound = TMath::Erf((axis->GetBinUpEdge(i) - tMean) / denominator);
128 auto integral = 0.5 * (upperBound - lowerBound);
129 zIntegral.emplace_back(integral);
130 lowerBound = upperBound;
135 auto sum = std::accumulate(zIntegral.begin(), zIntegral.end(), 0.);
136 for (
auto &elem : zIntegral)