CbmRoot
Loading...
Searching...
No Matches
CbmStsParAsic.h
Go to the documentation of this file.
1/* Copyright (C) 2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Volker Friese [committer] */
4
5#ifndef CBMSTSPARASIC_H
6#define CBMSTSPARASIC_H 1
7
8#include <Rtypes.h> // for THashConsistencyHolder, ClassDefNV
9
10#include <algorithm>
11#include <array>
12#include <set>
13#include <string> // for string
14
15class TF1;
16
25
26 public:
29
30
41 CbmStsParAsic(uint16_t nChannels, uint16_t nAdc, double dynRange, double threshold, double timeResol, double deadTime,
42 double noise, double znr);
43
44
47
48
51
52
55
56
61 double AdcToCharge(uint16_t adc) const { return fThreshold + fDynRange / double(fNofAdc) * (double(adc) - 0.5); }
62
63
68 uint16_t DeactivateRandomChannels(double fraction);
69
70
77 uint16_t ChargeToAdc(double charge) const
78 {
79 return (uint16_t) std::clamp(1 + (charge - fThreshold) * fNofAdc / fDynRange, 0.0, 31.0);
80 };
81
82
86 double GetDeadTime() const { return fDeadTime; }
87
88
92 double GetDynRange() const { return fDynRange; }
93
94
98 uint16_t GetNofAdc() const { return fNofAdc; }
99
100
104 uint16_t GetNofChannels() const { return fNofChannels; }
105
106
110 double GetNoise() const { return fNoise; }
111
112
116 double GetNoiseRate() const;
117
118
126 double GetRandomNoiseCharge() const;
127
128
132 double GetThreshold() const { return fThreshold; }
133
134
138 double GetTimeResol() const { return fTimeResolution; }
139
140
144 double GetZeroNoiseRate() const { return fZeroNoiseRate; }
145
146
151 void Init();
152
153
158 Bool_t IsChannelActive(uint16_t channel) const { return fDeadChannels.find(channel) == fDeadChannels.end(); }
159
160
172 void Set(uint16_t nChannels, uint16_t nAdc, double dynRange, double threshold, double timeResol, double deadTime,
173 double noise, double zeroNoiseRate, std::set<uint16_t> deadChannels = {});
174
175
181 void SetTimeOffset(double offset) { fTimeOffset = offset; }
182
183
187 void SetWalkCoef(std::array<double, 31> par) { fWalkCoef = par; }
188
193 double GetWalkCoef(uint32_t uIdx) const
194 {
195 if (uIdx < 31) return fWalkCoef[uIdx];
196 return 0.;
197 }
198
200 std::string ToString() const;
201
202
203 private:
204 uint16_t fNofChannels = 0;
205 uint16_t fNofAdc = 0;
206 double fDynRange = 0.;
207 double fThreshold = 0.;
208 double fTimeResolution = 0.;
209 double fDeadTime = 0.;
210 double fNoise = 0.;
211 double fZeroNoiseRate = 0.;
212 double fTimeOffset = 0.;
213 std::array<double, 31> fWalkCoef = {};
214 std::set<uint16_t> fDeadChannels{};
215
216 bool fIsInit = kFALSE;
217
220 TF1* fNoiseCharge = nullptr;
221
223};
224
225#endif /* CBMSTSPARASIC_H */
Parameters of the STS readout ASIC.
double GetDynRange() const
Dynamic range of ADC.
double GetRandomNoiseCharge() const
Random noise charge.
double fTimeResolution
Time resolution [ns].
TF1 * fNoiseCharge
Flag for being initialised.
uint16_t GetNofAdc() const
Number of ADC channels.
CbmStsParAsic(uint16_t nChannels, uint16_t nAdc, double dynRange, double threshold, double timeResol, double deadTime, double noise, double znr)
Constructor with parameters.
void Set(uint16_t nChannels, uint16_t nAdc, double dynRange, double threshold, double timeResol, double deadTime, double noise, double zeroNoiseRate, std::set< uint16_t > deadChannels={})
Set parameters.
double AdcToCharge(uint16_t adc) const
Charge from ADC channel (mean)
uint16_t GetNofChannels() const
Number of readout channels.
double GetZeroNoiseRate() const
Zero-crossing noise rate.
std::string ToString() const
Info to string.
double fDeadTime
Channel dead time [ns].
std::set< uint16_t > fDeadChannels
Map of dead channels.
double GetNoise() const
Electronic noise RMS.
uint16_t DeactivateRandomChannels(double fraction)
Randomly deactivate a fraction of the channels.
double GetNoiseRate() const
Single-channel noise rate.
double GetThreshold() const
ADC Threshold.
double GetWalkCoef(uint32_t uIdx) const
Get one of the coefficients for walk correction.
uint16_t ChargeToAdc(double charge) const
ADC channel for a given charge.
double GetTimeResol() const
Time resolution.
~CbmStsParAsic()
Destructor.
double fZeroNoiseRate
Zero-crossing noise rate [1/ns].
ClassDefNV(CbmStsParAsic, 4)
CbmStsParAsic()
Default constructor.
double fNoise
RMS of noise [e].
CbmStsParAsic & operator=(const CbmStsParAsic &other)
Copy assignment operator.
double fTimeOffset
Time offset [ns].
double fDynRange
Dynamic range [e].
std::array< double, 31 > fWalkCoef
Parameters for correction of walk effect.
void SetWalkCoef(std::array< double, 31 > par)
Set coefficients for walk correction.
uint16_t fNofAdc
Number of ADC channels.
Bool_t IsChannelActive(uint16_t channel) const
Check for a channel being active.
void SetTimeOffset(double offset)
Set time offset.
uint16_t fNofChannels
Number of readout channels.
double fThreshold
Threshold [e].
void Init()
Initialisation.
double GetDeadTime() const
Single-channel dead time.