ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigAnalysis
TrigInDetAnalysisUser
Resplot
src
BasicRandom.h
Go to the documentation of this file.
1
/* emacs: this is -*- c++ -*- */
22
23
24
#ifndef BASICRANDOM_H
25
#define BASICRANDOM_H
26
27
#include <iostream>
28
29
#include "TRandom3.h"
30
31
32
namespace
Resplot
{
33
34
class
BasicRandom
{
35
36
public
:
37
38
BasicRandom
(
int
shared=
true
,
int
seed=4357)
39
:
m_shared
(shared),
m_random
(0) {
40
if
( shared ) {
43
// static TRandom3 r(seed);
44
m_random
= &
s_random
;
45
if
( seed!=4357)
m_random
->SetSeed(seed);
46
}
47
else
{
48
// m_random = new TRandom3(seed);
49
m_random
= &
s_random
;
50
if
( seed )
m_random
->SetSeed(seed);
51
}
52
}
53
BasicRandom
(
const
BasicRandom
&) =
delete
;
//forbid copying
54
BasicRandom
operator =
(
const
BasicRandom
&) =
delete
;
//forbid assignment
55
56
// virtual ~Random() { delete m_rand; }
57
virtual
~BasicRandom
() {
if
( !
m_shared
)
delete
m_random
; }
58
59
double
exp
() {
return
m_random
->Exp(1); }
60
double
gauss
() {
return
m_random
->Gaus(); }
61
double
uniform
() {
return
m_random
->Uniform(); }
62
63
64
private
:
65
66
bool
m_shared
;
67
static
inline
thread_local
TRandom3
s_random
= {4357};
68
TRandom3*
m_random
;
69
70
};
71
72
}
73
74
#endif
75
76
77
78
79
80
81
82
83
84
Resplot::BasicRandom::BasicRandom
BasicRandom(const BasicRandom &)=delete
Resplot::BasicRandom::m_random
TRandom3 * m_random
Definition
BasicRandom.h:68
Resplot::BasicRandom::operator=
BasicRandom operator=(const BasicRandom &)=delete
Resplot::BasicRandom::BasicRandom
BasicRandom(int shared=true, int seed=4357)
do we ever use a different seed ?? We probably should
Definition
BasicRandom.h:38
Resplot::BasicRandom::exp
double exp()
Definition
BasicRandom.h:59
Resplot::BasicRandom::gauss
double gauss()
Definition
BasicRandom.h:60
Resplot::BasicRandom::m_shared
bool m_shared
Definition
BasicRandom.h:66
Resplot::BasicRandom::s_random
static TRandom3 s_random
Definition
BasicRandom.h:67
Resplot::BasicRandom::uniform
double uniform()
Definition
BasicRandom.h:61
Resplot::BasicRandom::~BasicRandom
virtual ~BasicRandom()
Definition
BasicRandom.h:57
Resplot
Definition
Resplot.h:40
Generated on
for ATLAS Offline Software by
1.17.0