Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-01 09:06:28

0001 /** @struct sipm::SiPMDebugInfo SimSiPM/SimSiPM/SiPMDebugInfo.h SiPMDebugInfo.h
0002  *
0003  *  @brief Stores MC-Truth informations.
0004  *
0005  *  This class is used to store some MC-Truth informations about the generated
0006  *  event for debug purposes.
0007  *
0008  *  @author Edoardo Proserpio
0009  *  @date 2020
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   /** @brief Constructor of SiPMDebugInfo */
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;        ///< Number of photons impinging on the sensor surface
0028   const uint32_t nPhotoelectrons; ///< Number of photoelectrons: total number of hitted cells
0029   const uint32_t nDcr;            ///< Number of DCR events generated
0030   const uint32_t nXt;             ///< Number of XT events generated: XT and DXT
0031   const uint32_t nDXt;            ///< Number of DXT events generated
0032   const uint32_t nAp;             ///< Number of AP events generated
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 } /* namespace sipm */
0054 #endif /* SIPM_SIPMDEBUGINFO_H */