StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RandFlat.cc
1 /***************************************************************************
2  *
3  * $Id: RandFlat.cc,v 1.3 2016/01/22 17:10:50 smirnovd Exp $
4  *
5  * Author: Gabriele Cosmo - Created: 17th May 1995
6  * modified for SCL bl
7  ***************************************************************************
8  *
9  * Description:
10  * RandFlat.cc,v 1.3 1997/08/12 00:38:40
11  * -----------------------------------------------------------------------
12  * HEP Random
13  * --- RandFlat ---
14  * class implementation file
15  * -----------------------------------------------------------------------
16  * This file is part of Geant4 (simulation toolkit for HEP).
17  *
18  ***************************************************************************
19  *
20  * $Log: RandFlat.cc,v $
21  * Revision 1.3 2016/01/22 17:10:50 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:07 ullrich
41  * Initial Revision
42  *
43  **************************************************************************/
44 #include "RandFlat.h"
45 
46 const HepInt RandFlat::MSBBits= 15;
47 const unsigned long RandFlat::MSB= 1ul<<RandFlat::MSBBits;
48 unsigned long RandFlat::staticRandomInt= 0;
49 unsigned long RandFlat::staticFirstUnusedBit= 0;
50 
51 RandFlat::~RandFlat() {
52  if ( deleteEngine ) delete localEngine;
53 }
54 
55 HepDouble RandFlat::operator()() {
56  return fire();
57 }
58 
59 void RandFlat::shootArray( const HepInt size, HepDouble* vect,
60  HepDouble lx, HepDouble dx )
61 {
62  HepInt i;
63 
64  for (i=0; i<size; ++i)
65  vect[i] = shoot(lx,dx);
66 }
67 
68 void
69 #ifndef ST_NO_TEMPLATE_DEF_ARGS
70 RandFlat::shootArray( vector<HepDouble>& vec, HepDouble lx, HepDouble dx )
71 #else
72 RandFlat::shootArray( vector<HepDouble,allocator<HepDouble> >& vec, HepDouble lx, HepDouble dx )
73 #endif
74 {
75  for (unsigned int i=0; i<vec.size(); ++i)
76  vec[i] = shoot(lx,dx);
77 }
78 
79 void RandFlat::shootArray( HepRandomEngine* anEngine,
80  const HepInt size, HepDouble* vect,
81  HepDouble lx, HepDouble dx )
82 {
83  for (int i=0; i<size; ++i)
84  vect[i] = shoot(anEngine,lx,dx);
85 }
86 
87 
88 #ifndef ST_NO_TEMPLATE_DEF_ARGS
89 void RandFlat::shootArray( HepRandomEngine* anEngine,
90  vector<HepDouble>& vec,
91  HepDouble lx, HepDouble dx )
92 #else
93 void RandFlat::shootArray( HepRandomEngine* anEngine,
94  vector<HepDouble,allocator<HepDouble> >& vec,
95  HepDouble lx, HepDouble dx )
96 #endif
97 {
98  for (unsigned int i=0; i<vec.size(); ++i)
99  vec[i] = shoot(anEngine,lx,dx);
100 }
101 
102 void RandFlat::fireArray( const HepInt size, HepDouble* vect,
103  HepDouble lx, HepDouble dx )
104 {
105  HepInt i;
106 
107  for (i=0; i<size; ++i)
108  vect[i] = fire(lx,dx);
109 }
110 
111 #ifndef ST_NO_TEMPLATE_DEF_ARGS
112 void RandFlat::fireArray( vector<HepDouble>& vec, HepDouble lx, HepDouble dx )
113 #else
114 void RandFlat::fireArray( vector<HepDouble,allocator<HepDouble> >& vec, HepDouble lx, HepDouble dx )
115 #endif
116 {
117  for (unsigned int i=0; i<vec.size(); ++i)
118  vec[i] = fire(lx,dx);
119 }