StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RandExponential.cc
1 /***************************************************************************
2  *
3  * $Id: RandExponential.cc,v 1.3 2016/01/22 17:10:49 smirnovd Exp $
4  *
5  * Author: Gabriele Cosmo - Created: 17th May 1996
6  * modified for SCL bl
7  ***************************************************************************
8  *
9  * Description:
10  * RandExponential.cc,v 1.3 1997/08/12 00:38:38 gcosmo
11  * -----------------------------------------------------------------------
12  * HEP Random
13  * --- RandExponential ---
14  * class implementation file
15  * -----------------------------------------------------------------------
16  * This file is part of Geant4 (simulation toolkit for HEP).
17  *
18  ***************************************************************************
19  *
20  * $Log: RandExponential.cc,v $
21  * Revision 1.3 2016/01/22 17:10:49 smirnovd
22  * StarClassLibrary: Removed deprecated storage class specifier 'register'
23  *
24  * This keyword is deprecated since C++11 and serves no purpose
25  *
26  * "
27  * The register specifier is only allowed for objects declared at block scope and
28  * in function parameter lists. It indicates automatic storage duration, which is
29  * the default for these kinds of declarations. Additionally, the presence of this
30  * keyword may be used as a hint for the optimizer to store the value of this
31  * variable in a CPU register.
32  * "
33  *
34  * Revision 1.2 1999/12/07 23:43:04 ullrich
35  * Modified to get rid of warnings on Linux.
36  *
37  * Revision 1.1 1999/01/30 03:59:00 fisyak
38  * Root Version of StarClassLibrary
39  *
40  * Revision 1.1 1999/01/23 00:29:06 ullrich
41  * Initial Revision
42  *
43  **************************************************************************/
44 #include "RandExponential.h"
45 
46 RandExponential::~RandExponential() {
47  if ( deleteEngine ) delete localEngine;
48 }
49 
50 HepDouble RandExponential::operator()() {
51  return fire();
52 }
53 
54 void RandExponential::shootArray( const HepInt size, HepDouble* vect,
55  HepDouble mean )
56 {
57  HepInt i;
58 
59  for (i=0; i<size; ++i)
60  vect[i] = shoot(mean);
61 }
62 
63 void
64 #ifndef ST_NO_TEMPLATE_DEF_ARGS
65 RandExponential::shootArray( vector<HepDouble>& vec,
66  HepDouble mean )
67 #else
68 RandExponential::shootArray( vector<HepDouble,allocator<HepDouble> >& vec,
69  HepDouble mean )
70 #endif
71 {
72  for (unsigned int i=0; i<vec.size(); ++i)
73  vec[i] = shoot(mean);
74 }
75 
76 void RandExponential::shootArray( HepRandomEngine* anEngine, const HepInt size,
77  HepDouble* vect, HepDouble mean )
78 {
79  for (int i=0; i<size; ++i)
80  vect[i] = shoot(anEngine, mean);
81 }
82 
83 void
84 #ifndef ST_NO_TEMPLATE_DEF_ARGS
85 RandExponential::shootArray( HepRandomEngine* anEngine,
86  vector<HepDouble>& vec, HepDouble mean )
87 #else
88 RandExponential::shootArray( HepRandomEngine* anEngine,
89  vector<HepDouble, allocator<HepDouble> >& vec,
90  HepDouble mean )
91 #endif
92 {
93  for (unsigned int i=0; i<vec.size(); ++i)
94  vec[i] = shoot(anEngine, mean);
95 }
96 
97 void RandExponential::fireArray( const HepInt size, HepDouble* vect,
98  HepDouble mean )
99 {
100  HepInt i;
101 
102  for (i=0; i<size; ++i)
103  vect[i] = fire(mean);
104 }
105 
106 void
107 #ifndef ST_NO_TEMPLATE_DEF_ARGS
108 RandExponential::fireArray( vector<HepDouble>& vec,
109  HepDouble mean )
110 #else
111 RandExponential::fireArray( vector<HepDouble, allocator<HepDouble> >& vec,
112  HepDouble mean )
113 #endif
114 {
115  for (unsigned int i=0; i<vec.size(); ++i)
116  vec[i] = fire(mean);
117 }