File indexing completed on 2025-04-01 09:06:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef SIPM_SIPMDEBUGINFO_H
0013 #define SIPM_SIPMDEBUGINFO_H
0014
0015 #include <cstdint>
0016 #include <iomanip>
0017 #include <iostream>
0018 #include <sstream>
0019
0020 namespace sipm {
0021 struct SiPMDebugInfo {
0022
0023 constexpr SiPMDebugInfo(const uint32_t aPh, const uint32_t aPe, const uint32_t aDcr, const uint32_t aXt,
0024 const uint32_t aDXt, const uint32_t aAp) noexcept
0025 : nPhotons(aPh), nPhotoelectrons(aPe), nDcr(aDcr), nXt(aXt), nDXt(aDXt), nAp(aAp) {}
0026
0027 const uint32_t nPhotons;
0028 const uint32_t nPhotoelectrons;
0029 const uint32_t nDcr;
0030 const uint32_t nXt;
0031 const uint32_t nDXt;
0032 const uint32_t nAp;
0033 friend std::ostream& operator<<(std::ostream&, const SiPMDebugInfo&);
0034 std::string toString() const {
0035 std::stringstream ss;
0036 ss << *this;
0037 return ss.str();
0038 }
0039 };
0040
0041 inline std::ostream& operator<<(std::ostream& out, const SiPMDebugInfo& obj) {
0042 out << std::setprecision(2) << std::fixed;
0043 out << "Address :" << std::hex << std::addressof(obj) << "\n";
0044 out << "===> SiPM Debug Info <===\n";
0045 out << "Number of photons impinging to the sensor: " << std::dec << obj.nPhotons << "\n";
0046 out << "Number of photoelectrons detected: " << obj.nPhotoelectrons << "\n";
0047 out << "Number of dark count events (DCR): " << obj.nDcr << "\n";
0048 out << "Number of optical crosstalk events (XT + DTX): " << obj.nXt << "\n";
0049 out << "Number of delayed optical crosstalk events (DXT): " << obj.nDXt << "\n";
0050 out << "Number of afterpulsing events (AP): " << obj.nAp << "\n";
0051 return out;
0052 }
0053 }
0054 #endif