CbmRoot
CbmStsParAsic.cxx
Go to the documentation of this file.
1
5
#include "
CbmStsParAsic.h
"
6
7
#include <TF1.h>
// for TF1
8
#include <TMath.h>
// for Exp
9
10
#include <assert.h>
// for assert
11
#include <sstream>
// for operator<<, basic_ostream, stringstream
12
13
ClassImp
(
CbmStsParAsic
)
14
15
// ----- Constructor ---------------------------------------------------
16
CbmStsParAsic::CbmStsParAsic
(UShort_t nAdc,
17
Double_t dynRange,
18
Double_t threshold,
19
Double_t timeResol,
20
Double_t deadTime,
21
Double_t noise,
22
Double_t znr) {
23
Set
(nAdc, dynRange, threshold, timeResol, deadTime, noise, znr);
24
}
25
// -------------------------------------------------------------------------
26
27
28
// ----- Copy constructor ----------------------------------------------
29
CbmStsParAsic::CbmStsParAsic
(
const
CbmStsParAsic
& other) {
30
Set
(other.
fNofAdc
,
31
other.
fDynRange
,
32
other.
fThreshold
,
33
other.
fTimeResolution
,
34
other.
fDeadTime
,
35
other.
fNoise
,
36
other.
fZeroNoiseRate
);
37
}
38
// -------------------------------------------------------------------------
39
40
41
// ----- Copy assignment operator --------------------------------------
42
CbmStsParAsic
&
CbmStsParAsic::operator=
(
const
CbmStsParAsic
& other) {
43
Set
(other.
fNofAdc
,
44
other.
fDynRange
,
45
other.
fThreshold
,
46
other.
fTimeResolution
,
47
other.
fDeadTime
,
48
other.
fNoise
,
49
other.
fZeroNoiseRate
);
50
return
*
this
;
51
}
52
// -------------------------------------------------------------------------
53
54
55
// ----- Destructor ----------------------------------------------------
56
CbmStsParAsic::~CbmStsParAsic
() {
57
if
(
fNoiseCharge
)
delete
fNoiseCharge
;
58
}
59
// -------------------------------------------------------------------------
60
61
62
// ----- ADC channel from charge ----------------------------------------
63
Short_t
CbmStsParAsic::ChargeToAdc
(Double_t charge)
const
{
64
if
(charge <
fThreshold
)
return
-1;
// Underflow
65
if
(charge >=
fThreshold
+
fDynRange
)
return
fNofAdc
- 1;
// Overflow
66
return
Short_t((charge -
fThreshold
) /
fDynRange
* Double_t(
fNofAdc
));
67
}
68
// -------------------------------------------------------------------------
69
70
71
// ----- Single-channel noise rate -------------------------------------
72
Double_t
CbmStsParAsic::GetNoiseRate
()
const
{
73
if
(
fNoise
== 0.)
return
0.;
74
Double_t ratio =
fThreshold
/
fNoise
;
75
return
0.5 *
fZeroNoiseRate
* TMath::Exp(-0.5 * ratio * ratio);
76
}
77
// -------------------------------------------------------------------------
78
79
80
// ----- Random charge of a noise signal -------------------------------
81
Double_t
CbmStsParAsic::GetRandomNoiseCharge
()
const
{
82
assert(
fIsInit
);
83
return
fNoiseCharge
->GetRandom();
84
}
85
// -------------------------------------------------------------------------
86
87
88
// ----- Intialise the noise charge distribution -----------------------
89
void
CbmStsParAsic::Init
() {
90
if
(
fNoiseCharge
)
delete
fNoiseCharge
;
91
fNoiseCharge
=
new
TF1(
92
"Noise Charge"
,
"TMath::Gaus(x, [0], [1])"
,
fThreshold
, 10. *
fNoise
);
93
fNoiseCharge
->SetParameters(0.,
fNoise
);
94
fIsInit
= kTRUE;
95
}
96
// -------------------------------------------------------------------------
97
98
99
// ----- Set the parameters ---------------------------------------------
100
void
CbmStsParAsic::Set
(UShort_t nAdc,
101
Double_t dynRange,
102
Double_t threshold,
103
Double_t timeResol,
104
Double_t deadTime,
105
Double_t noise,
106
Double_t zeroNoiseRate,
107
std::set<UShort_t> deadChannels) {
108
109
// Assert validity of parameters
110
assert(dynRange > 0.);
111
assert(threshold > 0.);
112
assert(timeResol > 0.);
113
assert(deadTime >= 0.);
114
assert(noise >= 0.);
115
assert(zeroNoiseRate >= 0.);
116
117
fNofAdc
= nAdc;
118
fDynRange
= dynRange;
119
fThreshold
= threshold;
120
fTimeResolution
= timeResol;
121
fDeadTime
= deadTime;
122
fNoise
= noise;
123
fZeroNoiseRate
= zeroNoiseRate;
124
fDeadChannels
= deadChannels;
125
126
Init
();
127
}
128
// --------------------------------------------------------------------------
129
130
131
// ----- String output ----------------------------------------------------
132
std::string
CbmStsParAsic::ToString
()
const
{
133
std::stringstream ss;
134
ss <<
"nAdc "
<<
fNofAdc
<<
" | dynRange "
<<
fDynRange
<<
" e | thresh. "
135
<<
fThreshold
<<
" e | tResol "
<<
fTimeResolution
<<
" ns | deadTime "
136
<<
fDeadTime
<<
" ns | noise "
<<
fNoise
<<
" e | ZNR "
<<
fZeroNoiseRate
137
<<
"/ns | SCNR "
<<
GetNoiseRate
() <<
"/ns"
;
138
return
ss.str();
139
}
140
// --------------------------------------------------------------------------
CbmStsParAsic::GetNoiseRate
Double_t GetNoiseRate() const
Single-channel noise rate.
Definition:
CbmStsParAsic.cxx:72
CbmStsParAsic::~CbmStsParAsic
~CbmStsParAsic()
Destructor.
Definition:
CbmStsParAsic.cxx:56
CbmStsParAsic::ChargeToAdc
Short_t ChargeToAdc(Double_t charge) const
ADC channel for a given charge.
Definition:
CbmStsParAsic.cxx:63
CbmStsParAsic::fIsInit
Bool_t fIsInit
Definition:
CbmStsParAsic.h:196
CbmStsParAsic::fTimeResolution
Double_t fTimeResolution
Time resolution [ns].
Definition:
CbmStsParAsic.h:190
CbmStsParAsic::fZeroNoiseRate
Double_t fZeroNoiseRate
Zero-crossing noise rate [1/ns].
Definition:
CbmStsParAsic.h:193
ClassImp
ClassImp(CbmStsParAsic) CbmStsParAsic
Definition:
CbmStsParAsic.cxx:13
CbmStsParAsic::fNoise
Double_t fNoise
RMS of noise [e].
Definition:
CbmStsParAsic.h:192
CbmStsParAsic::fNofAdc
UShort_t fNofAdc
Number of ADC channels.
Definition:
CbmStsParAsic.h:187
CbmStsParAsic
Parameters of the STS readout ASIC.
Definition:
CbmStsParAsic.h:25
CbmStsParAsic::CbmStsParAsic
CbmStsParAsic()
Default constructor.
Definition:
CbmStsParAsic.h:29
CbmStsParAsic::fThreshold
Double_t fThreshold
Threshold [e].
Definition:
CbmStsParAsic.h:189
CbmStsParAsic::fDeadChannels
std::set< UShort_t > fDeadChannels
Map of dead channels.
Definition:
CbmStsParAsic.h:194
CbmStsParAsic::operator=
CbmStsParAsic & operator=(const CbmStsParAsic &other)
Copy assignment operator.
Definition:
CbmStsParAsic.cxx:42
CbmStsParAsic::Init
void Init()
Initialisation.
Definition:
CbmStsParAsic.cxx:89
CbmStsParAsic::fDynRange
Double_t fDynRange
Dynamic range [e].
Definition:
CbmStsParAsic.h:188
CbmStsParAsic::fNoiseCharge
TF1 * fNoiseCharge
Flag for being initialised.
Definition:
CbmStsParAsic.h:200
CbmStsParAsic::ToString
std::string ToString() const
Info to string.
Definition:
CbmStsParAsic.cxx:132
CbmStsParAsic::Set
void Set(UShort_t nAdc, Double_t dynRange, Double_t threshold, Double_t timeResol, Double_t deadTime, Double_t noise, Double_t zeroNoiseRate, std::set< UShort_t > deadChannels={})
Set parameters.
Definition:
CbmStsParAsic.cxx:100
CbmStsParAsic::fDeadTime
Double_t fDeadTime
Channel dead time [ns].
Definition:
CbmStsParAsic.h:191
CbmStsParAsic::GetRandomNoiseCharge
Double_t GetRandomNoiseCharge() const
Random noise charge.
Definition:
CbmStsParAsic.cxx:81
CbmStsParAsic.h
core
detectors
sts
CbmStsParAsic.cxx
Generated on Wed Oct 28 2020 15:11:45 for CbmRoot by
1.8.18