Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JPHYSICS::JK40Rates Struct Reference

Auxiliary class for K40 rates. More...

#include <JK40Rates.hh>

Inheritance diagram for JPHYSICS::JK40Rates:
JDETECTOR::JK40DefaultSimulator JTRIGGER::JK40RunByRunSimulator

Public Member Functions

 JK40Rates ()
 Default constructor.
 
 JK40Rates (const JRateL0_t rateL0_Hz, const JRateL1_t &rateL1_Hz=JRateL1_t())
 Constructor.
 
double getSinglesRate () const
 Get singles rate.
 
const JRateL1_tgetMultiplesRates () const
 Get multiples rate.
 
double getMultiplesRate (const multiplicity_type M) const
 Get multiples rate at given multiplicity.
 
multiplicity_type getLowerL1Multiplicity () const
 Get lower multiplicty.
 
multiplicity_type getUpperL1Multiplicity () const
 Get upper multiplicty.
 
void correct (const double QE)
 Correct rates for global efficiency,.
 

Static Public Attributes

static const multiplicity_type LOWER_L1_MULTIPLICITY = 2
 Lower L1 multiplicity.
 

Protected Attributes

JRateL0_t rateL0
 singles rate [Hz]
 
JRateL1_t rateL1
 multiples rates [Hz]
 

Friends

std::istream & operator>> (std::istream &in, JK40Rates &object)
 Read K40 rates from input.
 
std::ostream & operator<< (std::ostream &out, const JK40Rates &object)
 Write K40 rates to output.
 

Detailed Description

Auxiliary class for K40 rates.

The singles rate refers to the counting rate of a PMT and the multiples rate to the rate of genuine coincidences due to K40 decays.

Definition at line 41 of file JK40Rates.hh.

Constructor & Destructor Documentation

◆ JK40Rates() [1/2]

JPHYSICS::JK40Rates::JK40Rates ( )
inline

Default constructor.

Definition at line 45 of file JK40Rates.hh.

45 :
46 rateL0(0.0),
47 rateL1()
48 {}
JRateL1_t rateL1
multiples rates [Hz]
Definition JK40Rates.hh:222
JRateL0_t rateL0
singles rate [Hz]
Definition JK40Rates.hh:221

◆ JK40Rates() [2/2]

JPHYSICS::JK40Rates::JK40Rates ( const JRateL0_t rateL0_Hz,
const JRateL1_t & rateL1_Hz = JRateL1_t() )
inline

Constructor.

The multiples rates start counting at two-fold coincidences.

Parameters
rateL0_Hzsingles rate [Hz]
rateL1_Hzmultiples rates [Hz]

Definition at line 59 of file JK40Rates.hh.

60 :
61 rateL0(rateL0_Hz),
62 rateL1(rateL1_Hz)
63 {}

Member Function Documentation

◆ getSinglesRate()

double JPHYSICS::JK40Rates::getSinglesRate ( ) const
inline

Get singles rate.

Returns
rate [Hz]

Definition at line 71 of file JK40Rates.hh.

72 {
73 return rateL0;
74 }

◆ getMultiplesRates()

const JRateL1_t & JPHYSICS::JK40Rates::getMultiplesRates ( ) const
inline

Get multiples rate.

Returns
rate [Hz]

Definition at line 82 of file JK40Rates.hh.

83 {
84 return rateL1;
85 }

◆ getMultiplesRate()

double JPHYSICS::JK40Rates::getMultiplesRate ( const multiplicity_type M) const
inline

Get multiples rate at given multiplicity.

Parameters
Mmultiplicity (M >= JK40Rates::LOWER_L1_MULTIPLICITY)
Returns
rate [Hz]

Definition at line 94 of file JK40Rates.hh.

95 {
97 return rateL1[M - LOWER_L1_MULTIPLICITY];
98 else
99 return 0.0;
100 }
size_t multiplicity_type
Type definition of multiplicity.
Definition JK40Rates.hh:33
static const multiplicity_type LOWER_L1_MULTIPLICITY
Lower L1 multiplicity.
Definition JK40Rates.hh:217

◆ getLowerL1Multiplicity()

multiplicity_type JPHYSICS::JK40Rates::getLowerL1Multiplicity ( ) const
inline

Get lower multiplicty.

Returns
lower multiplicity

Definition at line 108 of file JK40Rates.hh.

109 {
111 }

◆ getUpperL1Multiplicity()

multiplicity_type JPHYSICS::JK40Rates::getUpperL1Multiplicity ( ) const
inline

Get upper multiplicty.

Returns
upper multiplicity

Definition at line 119 of file JK40Rates.hh.

120 {
121 return rateL1.size() + 1;
122 }

◆ correct()

void JPHYSICS::JK40Rates::correct ( const double QE)
inline

Correct rates for global efficiency,.

Parameters
QEglobal efficiency

Definition at line 130 of file JK40Rates.hh.

131 {
132 if (QE > 0.0) {
133
134 rateL0 /= QE;
135
136 JRateL1_t buffer = rateL1;
137
139
140 // determine contribution from higher multiplicities
141
142 double R = 0.0;
143
144 for (multiplicity_type i = M + 1; i <= getUpperL1Multiplicity(); ++i) {
145 R += buffer[i - LOWER_L1_MULTIPLICITY] * JMATH::binomial(i, M) * pow(QE, M) * pow(1.0 - QE, i - M);
146 }
147
148 if (getMultiplesRate(M) > R)
149 buffer[M - LOWER_L1_MULTIPLICITY] = (getMultiplesRate(M) - R) / pow(QE, M);
150 else
151 buffer[M - LOWER_L1_MULTIPLICITY] = 0.0;
152 }
153
154 rateL1 = buffer;
155
156 } else {
157
158 rateL0 = 0.0;
159
160 for (JRateL1_t::iterator i = rateL1.begin(); i != rateL1.end(); ++i) {
161 *i = 0.0;
162 }
163 }
164 }
T pow(const T &x, const double y)
Power .
Definition JMath.hh:97
double binomial(const size_t n, const size_t k)
Binomial function.
std::vector< double > JRateL1_t
Type definition of count rate as a function of multiplicty [Hz] The multiples rate start counting at ...
Definition JK40Rates.hh:27
double getMultiplesRate(const multiplicity_type M) const
Get multiples rate at given multiplicity.
Definition JK40Rates.hh:94
multiplicity_type getLowerL1Multiplicity() const
Get lower multiplicty.
Definition JK40Rates.hh:108
multiplicity_type getUpperL1Multiplicity() const
Get upper multiplicty.
Definition JK40Rates.hh:119

Friends And Related Symbol Documentation

◆ operator>>

std::istream & operator>> ( std::istream & in,
JK40Rates & object )
friend

Read K40 rates from input.

Parameters
ininput stream
objectK40 rates
Returns
input stream

Definition at line 174 of file JK40Rates.hh.

175 {
176 const double rateL0 = object.rateL0;
177
178 if (in >> object.rateL0) {
179
180 object.rateL1.clear();
181
182 for (double x; in >> x; ) {
183 object.rateL1.push_back(x);
184 }
185
186 } else {
187
188 object.rateL0 = rateL0;
189 }
190
191 return in;
192 }

◆ operator<<

std::ostream & operator<< ( std::ostream & out,
const JK40Rates & object )
friend

Write K40 rates to output.

Parameters
outoutput stream
objectK40 rates
Returns
output stream

Definition at line 202 of file JK40Rates.hh.

203 {
204 out << object.rateL0;
205
206 for (JRateL1_t::const_iterator i = object.rateL1.begin(); i != object.rateL1.end(); ++i) {
207 out << ' ' << *i;
208 }
209
210 return out;
211 }

Member Data Documentation

◆ LOWER_L1_MULTIPLICITY

const multiplicity_type JPHYSICS::JK40Rates::LOWER_L1_MULTIPLICITY = 2
static

Lower L1 multiplicity.

Definition at line 217 of file JK40Rates.hh.

◆ rateL0

JRateL0_t JPHYSICS::JK40Rates::rateL0
protected

singles rate [Hz]

Definition at line 221 of file JK40Rates.hh.

◆ rateL1

JRateL1_t JPHYSICS::JK40Rates::rateL1
protected

multiples rates [Hz]

Definition at line 222 of file JK40Rates.hh.


The documentation for this struct was generated from the following file: