ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
LandauDistribution.hpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file LandauDistribution.hpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2018-2020 CERN for the benefit of the Acts project
4
//
5
// This Source Code Form is subject to the terms of the Mozilla Public
6
// License, v. 2.0. If a copy of the MPL was not distributed with this
7
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
9
#pragma once
10
11
#include <random>
12
13
namespace
ActsFatras {
14
18
class
LandauDistribution
{
19
public
:
21
struct
param_type
{
23
using
distribution_type
=
LandauDistribution
;
24
28
double
location
= 0.0;
30
double
scale
= 1.0;
31
33
param_type
(
double
location_,
double
scale_)
34
:
location
(location_),
scale
(scale_) {}
35
// Explicitlely defaulted construction and assignment
36
param_type
() =
default
;
37
param_type
(
const
param_type
&) =
default
;
38
param_type
(
param_type
&&) =
default
;
39
param_type
&
operator=
(
const
param_type
&) =
default
;
40
param_type
&
operator=
(
param_type
&&) =
default
;
41
43
friend
bool
operator==
(
const
param_type
&lhs,
const
param_type
&rhs) {
44
return
(lhs.
location
== rhs.
location
) and (lhs.
scale
== rhs.
scale
);
45
}
46
friend
bool
operator!=
(
const
param_type
&lhs,
const
param_type
&rhs) {
47
return
not(lhs == rhs);
48
}
49
};
51
using
result_type
= double;
52
54
LandauDistribution
(
double
location,
double
scale
) :
m_cfg
(location, scale) {}
56
LandauDistribution
(
const
param_type
&cfg) :
m_cfg
(cfg) {}
57
// Explicitlely defaulted construction and assignment
58
LandauDistribution
() =
default
;
59
LandauDistribution
(
const
LandauDistribution
&) =
default
;
60
LandauDistribution
(
LandauDistribution
&&) =
default
;
61
LandauDistribution
&
operator=
(
const
LandauDistribution
&) =
default
;
62
LandauDistribution
&
operator=
(
LandauDistribution
&&) =
default
;
63
65
void
reset
() {}
67
param_type
param
()
const
{
return
m_cfg
; }
69
void
param
(
const
param_type
&cfg) {
m_cfg
= cfg; }
70
72
result_type
min
()
const
{
return
-std::numeric_limits<double>::infinity(); }
74
result_type
max
()
const
{
return
std::numeric_limits<double>::infinity(); }
75
77
template
<
typename
Generator>
78
result_type
operator()
(
Generator
&
generator
) {
79
return
(*
this
)(
generator
,
m_cfg
);
80
}
82
template
<
typename
Generator>
83
result_type
operator()
(
Generator
&
generator
,
const
param_type
¶ms) {
84
const
auto
z
= std::uniform_real_distribution<double>()(generator);
85
return
params.
location
+ params.
scale
*
quantile
(
z
);
86
}
87
89
friend
bool
operator==
(
const
LandauDistribution
&lhs,
90
const
LandauDistribution
&rhs) {
91
return
lhs.
m_cfg
== rhs.
m_cfg
;
92
}
93
friend
bool
operator!=
(
const
LandauDistribution
&lhs,
94
const
LandauDistribution
&rhs) {
95
return
!(lhs == rhs);
96
}
97
98
private
:
99
param_type
m_cfg
;
100
101
static
double
quantile
(
double
z
);
102
};
103
104
}
// namespace ActsFatras
acts
blob
master
Fatras
include
ActsFatras
Utilities
LandauDistribution.hpp
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:25
using
1.8.2 with
ECCE GitHub integration