8 #include <FairLogger.h>
10 #include <Math/Point3D.h>
11 #include <Math/Point3Dfwd.h>
28 LOG(debug) <<
"Running PSA on pad " << pad->
GetPadNum();
33 if (pos.X() < -9000 || pos.Y() < -9000) {
34 LOG(debug) <<
"Skipping pad, position is invalid";
39 LOG(ERROR) <<
"Pedestal should be subtracted to use this class!";
42 std::array<Double_t, 512> floatADC{};
50 if (*std::max_element(floatADC.begin(), floatADC.end()) > fMaxThreshold)
53 Double_t traceIntegral = std::accumulate(floatADC.begin(), floatADC.end(), 0);
56 for (
int i = 0; i < 512 / fTBtoAvg; ++i) {
57 Int_t idx = i * fTBtoAvg;
58 Double_t charge = std::accumulate(floatADC.begin() + idx, floatADC.begin() + idx + fTBtoAvg, 0);
64 Double_t zTB = idx +
static_cast<double>(fTBtoAvg) / 2;
67 auto hit = std::make_unique<AtHit>(PadNum, pos, charge);
69 hit->SetTimeStamp(zTB);
70 hit->SetTimeStampCorr(zTB);
71 hit->SetTimeStampCorrInter(zTB);
72 hit->SetTraceIntegral(traceIntegral);
73 hits.push_back(std::move(hit));