File indexing completed on 2025-01-17 09:55:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef SIPM_SIPMPROPERTIES_H
0015 #define SIPM_SIPMPROPERTIES_H
0016
0017 #include <algorithm>
0018 #include <fstream>
0019 #include <iomanip>
0020 #include <iostream>
0021 #include <map>
0022 #include <cmath>
0023 #include <stdint.h>
0024 #include <string>
0025 #include <vector>
0026
0027 namespace sipm {
0028
0029 class SiPMProperties {
0030 public:
0031
0032
0033
0034 enum class PdeType {
0035 kNoPde,
0036 kSimplePde,
0037 kSpectrumPde
0038 };
0039
0040
0041
0042 enum class HitDistribution {
0043 kUniform,
0044 kCircle,
0045 kGaussian
0046 };
0047
0048
0049 void readSettings(std::string&);
0050
0051
0052 uint32_t size() const { return m_Size; }
0053
0054
0055 uint32_t pitch() const { return m_Pitch; }
0056
0057
0058 uint32_t nCells() const;
0059
0060
0061 uint32_t nSideCells() const;
0062
0063
0064 uint32_t nSignalPoints() const;
0065
0066
0067 HitDistribution hitDistribution() const { return m_HitDistribution; }
0068
0069
0070 double signalLength() const { return m_SignalLength; }
0071
0072
0073 double sampling() const { return m_Sampling; }
0074
0075
0076 double risingTime() const { return m_RiseTime; }
0077
0078
0079 double fallingTimeFast() const { return m_FallTimeFast; }
0080
0081
0082
0083 double fallingTimeSlow() const { return m_FallTimeSlow; }
0084
0085
0086
0087 double slowComponentFraction() const { return m_SlowComponentFraction; }
0088
0089
0090 double recoveryTime() const { return m_RecoveryTime; }
0091
0092
0093 double dcr() const { return m_Dcr; }
0094
0095
0096 double xt() const { return m_Xt; }
0097
0098
0099 double dxt() const { return m_DXt; }
0100
0101
0102 double dxtTau() const { return m_DXtTau; }
0103
0104
0105 double ap() const { return m_Ap; }
0106
0107
0108 double tauApFast() const { return m_TauApFastComponent; }
0109
0110
0111 double tauApSlow() const { return m_TauApSlowComponent; }
0112
0113
0114 double apSlowFraction() const { return m_ApSlowFraction; }
0115
0116
0117 double ccgv() const { return m_Ccgv; }
0118
0119
0120 double gain() const { return m_Gain; }
0121
0122
0123 double snrdB() const { return m_SnrdB; }
0124
0125
0126 double snrLinear() const;
0127
0128
0129 double pde() const { return m_Pde; }
0130
0131
0132 const std::map<double, double>& pdeSpectrum() const { return m_PdeSpectrum; }
0133
0134
0135 PdeType pdeType() { return m_HasPde; }
0136
0137
0138 bool hasDcr() const { return m_HasDcr; }
0139
0140
0141 bool hasXt() const { return m_HasXt; }
0142
0143
0144 bool hasDXt() const { return m_HasDXt; }
0145
0146
0147 bool hasAp() const { return m_HasAp; }
0148
0149
0150
0151 bool hasSlowComponent() const { return m_HasSlowComponent; }
0152
0153
0154 void setProperty(const std::string&, const double);
0155
0156
0157 void setSize(const double x) { m_Size = x; }
0158
0159
0160 void setPitch(const double x) { m_Pitch = x; }
0161
0162
0163 void setSampling(const double x);
0164
0165
0166 void setSignalLength(const double x) { m_SignalLength = x; }
0167
0168
0169 void setRiseTime(const double x) { m_RiseTime = x; }
0170
0171
0172 void setFallTimeFast(const double x) { m_FallTimeFast = x; }
0173
0174
0175
0176 void setFallTimeSlow(const double x) { m_FallTimeSlow = x; }
0177
0178
0179 void setSlowComponentFraction(const double x) { m_SlowComponentFraction = x; }
0180
0181
0182 void setRecoveryTime(const double x) { m_RecoveryTime = x; }
0183
0184
0185 void setSnr(const double x) {
0186 m_SnrdB = x;
0187 m_SnrLinear = pow(10, -x / 20);
0188 }
0189
0190
0191 void setTauApFastComponent(const double x) { m_TauApFastComponent = x; }
0192
0193
0194 void setTauApSlowComponent(const double x) { m_TauApSlowComponent = x; }
0195
0196
0197 void setTauApSlowFraction(const double x) { m_ApSlowFraction = x; }
0198
0199
0200 void setCcgv(const double x) { m_Ccgv = x; }
0201
0202
0203 void setPde(const double x) { m_Pde = x; }
0204
0205
0206
0207 void setDcr(const double aDcr) { m_Dcr = aDcr; }
0208
0209
0210
0211 void setXt(const double aXt) { m_Xt = aXt; }
0212
0213
0214
0215 void setDXt(const double aDXt) { m_DXt = aDXt; }
0216
0217
0218
0219 void setDXtTau(const double aDXtTau) { m_DXtTau = aDXtTau; }
0220
0221
0222
0223 void setAp(const double aAp) { m_Ap = aAp; }
0224
0225
0226 void setDcrOff() { m_HasDcr = false; }
0227
0228 void setXtOff() { m_HasXt = false; }
0229
0230 void setDXtOff() { m_HasXt = false; }
0231
0232 void setApOff() { m_HasAp = false; }
0233
0234 void setSlowComponentOff() { m_HasSlowComponent = false; }
0235
0236 void setDcrOn() { m_HasDcr = true; }
0237
0238 void setXtOn() { m_HasXt = true; }
0239
0240 void setDXtOn() { m_HasDXt = true; }
0241
0242 void setApOn() { m_HasAp = true; }
0243
0244 void setSlowComponentOn() { m_HasSlowComponent = true; }
0245
0246 void setPdeType(PdeType aPdeType) { m_HasPde = aPdeType; }
0247
0248
0249 void setPdeSpectrum(const std::map<double, double>&);
0250
0251
0252 void setPdeSpectrum(const std::vector<double>&, const std::vector<double>&);
0253
0254 void setHitDistribution(const HitDistribution aHitDistribution) { m_HitDistribution = aHitDistribution; }
0255
0256 friend std::ostream& operator<< (std::ostream&, const SiPMProperties&);
0257
0258 private:
0259 double m_Size = 1;
0260 double m_Pitch = 25;
0261 mutable uint32_t m_Ncells = 0;
0262 mutable uint32_t m_SideCells = 0;
0263 HitDistribution m_HitDistribution = HitDistribution::kUniform;
0264
0265 double m_Sampling = 1;
0266 double m_SignalLength = 500;
0267 mutable uint32_t m_SignalPoints = 0;
0268 double m_RiseTime = 1;
0269 double m_FallTimeFast = 50;
0270 double m_FallTimeSlow;
0271 double m_SlowComponentFraction;
0272 double m_RecoveryTime = 50;
0273
0274 double m_Dcr = 200e3;
0275 double m_Xt = 0.05;
0276 double m_DXt = 0.05;
0277 double m_DXtTau = 15;
0278 double m_Ap = 0.03;
0279 double m_TauApFastComponent = 10;
0280 double m_TauApSlowComponent = 80;
0281 double m_ApSlowFraction = 0.5;
0282 double m_Ccgv = 0.05;
0283 double m_SnrdB = 30;
0284 double m_Gain = 1.0;
0285 mutable double m_SnrLinear = 0;
0286
0287 double m_Pde;
0288 std::map<double, double> m_PdeSpectrum;
0289 PdeType m_HasPde = PdeType::kNoPde;
0290
0291 bool m_HasDcr = true;
0292 bool m_HasXt = true;
0293 bool m_HasDXt = false;
0294 bool m_HasAp = true;
0295 bool m_HasSlowComponent = false;
0296 };
0297
0298 }
0299 #endif