| # Gaudi Framework, version v21r7p1 |

Home |  | Generated: 15 Feb 2010

# HepRndm::Engine< TYPE > Class Template Reference

`#include <HepRndmEngine.h>`

Inheritance diagram for HepRndm::Engine< TYPE >:

[legend]
Collaboration diagram for HepRndm::Engine< TYPE >:

[legend]

List of all members.

## Public Member Functions
| Engine (const std::string &name, ISvcLocator *loc)
| Standard Constructor.
virtual | ~Engine ()
| Standard Destructor.
virtual StatusCode | initialize ()
| Initialize the Engine.
virtual StatusCode | finalize ()
| Finalize the Engine.
virtual StatusCode | initializeEngine ()
| Create/Initialize new HepEngine....
virtual double | rndm () const
| Single shot / This was declared "virtual double rndm()" which causes / compiler warnings since the signature if different than / that for RndmEngine::rndm(). I've assumed that the difference / is an error. If it is in fact a deliberate addition of a / new function, remove the "const" below and uncomment the / subsequent lines.
StatusCode | setSeeds (const std::vector< long > &seed)
| virtual double rndm() const { return BaseEngine::rndm( ); }
StatusCode | seeds (std::vector< long > &seed) const
| Retrieve seeds.
template<>
StatusCode | initializeEngine ()
template<>
StatusCode | initializeEngine ()
template<>
StatusCode | initializeEngine ()
template<>
StatusCode | initializeEngine ()
template<>
StatusCode | initializeEngine ()
template<>
StatusCode | initializeEngine ()
template<>
StatusCode | initializeEngine ()
template<>
StatusCode | initializeEngine ()
template<>
StatusCode | initializeEngine ()
template<>
StatusCode | initializeEngine ()
template<>
StatusCode | initializeEngine ()
## Protected Attributes
std::vector< long > | m_seeds
int | m_row
int | m_col
int | m_lux
bool | m_useTable
bool | m_setSingleton

## Detailed Description

### template<class TYPE>
class HepRndm::Engine< TYPE >

Definition at line 25 of file HepRndmEngine.h.

## Constructor & Destructor Documentation

template<class TYPE>

HepRndm::Engine< TYPE >::Engine | ( | const std::string & | name,
|  | ISvcLocator * | loc |
| ) |  |  | `[inline]`

Standard Constructor.

Definition at line 54 of file HepRndmEngines.cpp.

    00055   : BaseEngine (nam, loc)    {
    00056     declareProperty("Seeds",       m_seeds);
    00057     declareProperty("Column",      m_col = 0);
    00058     declareProperty("Row",         m_row = 1);
    00059     declareProperty("Luxury",      m_lux = 3);
    00060     declareProperty("UseTable",    m_useTable     = false);
    00061     declareProperty("SetSingleton",m_setSingleton = false);
    00062   }

template<class TYPE>

HepRndm::Engine< TYPE >::~Engine | ( |  | ) | `[inline, virtual]`

Standard Destructor.

Definition at line 65 of file HepRndmEngines.cpp.

    00065                                                        {
    00066   }

## Member Function Documentation

template<class TYPE>

StatusCode HepRndm::Engine< TYPE >::initialize | ( |  | ) | `[inline, virtual]`

Initialize the Engine.

Reimplemented from RndmEngine.

Definition at line 69 of file HepRndmEngines.cpp.

    00069                                                                      {
    00070     m_seeds.erase(m_seeds.begin(), m_seeds.end());
    00071     StatusCode status = RndmEngine::initialize();
    00072     if ( m_seeds.size() == 0 )  {
    00073       // Default seeds
    00074       long theSeed = 1234567;
    00075       m_seeds.push_back(theSeed);
    00076       m_seeds.push_back(0);
    00077     }
    00078     MsgStream log(msgSvc(), name());
    00079     if ( status.isSuccess() )   {
    00080       status = initializeEngine();
    00081       if ( status.isSuccess() )   {
    00082         log << MSG::INFO << "Generator engine type:"
    00083                   << System::typeinfoName(typeid(TYPE))
    00084                   << endmsg;
    00085         if ( m_useTable )   {
    00086           if ( m_row > 214 || m_col > 1 )   {
    00087             log << MSG::ERROR << "Generator engine seed table has dimension [215][2], you gave:"
    00088                 << " Row=" << m_row << " Column:" << m_col << endmsg;
    00089             status = StatusCode::FAILURE;
    00090           }
    00091           else    {
    00092             log << MSG::INFO << "Generator engine seeds from table."
    00093                 << " Row=" << m_row << " Column:" << m_col << endmsg;
    00094           }
    00095         }
    00096         log << "Current Seed:" << m_hepEngine->getSeed();
    00097         log << " Luxury:" << m_lux;
    00098         log << endmsg;
    00099         // Use the default static engine if required (e.g. for GEANT4)
    00100         if ( m_setSingleton )   {
    00101           HepRandom::setTheEngine(m_hepEngine);
    00102           log << "This is the GEANT4 engine!" << endmsg;
    00103         }
    00104         return status;
    00105       }
    00106     }
    00107     log << MSG::ERROR << "Cannot initialze random engine of type:"
    00108           << System::typeinfoName(typeid(TYPE))
    00109         << endmsg;
    00110     return status;
    00111   }

template<class TYPE>

StatusCode HepRndm::Engine< TYPE >::finalize | ( | void |  | ) | `[inline, virtual]`

Finalize the Engine.

Reimplemented from RndmEngine.

Definition at line 114 of file HepRndmEngines.cpp.

    00114                                                                    {
    00115     if ( m_hepEngine )   {
    00116       HepRandom::setTheEngine(0);
    00117       delete m_hepEngine;
    00118     }
    00119     m_seeds.clear();
    00120     m_hepEngine = 0;
    00121     return RndmEngine::finalize();
    00122   }

template<class TYPE>

virtual StatusCode HepRndm::Engine< TYPE >::initializeEngine | ( |  | ) | `[virtual]`

Create/Initialize new HepEngine....

template<class TYPE>

double HepRndm::Engine< TYPE >::rndm | ( |  | ) | const`[inline, virtual]`

Single shot / This was declared "virtual double rndm()" which causes / compiler warnings since the signature if different than / that for RndmEngine::rndm(). I've assumed that the difference / is an error. If it is in fact a deliberate addition of a / new function, remove the "const" below and uncomment the / subsequent lines.

Reimplemented from RndmEngine.

Definition at line 125 of file HepRndmEngines.cpp.

    00125                                                          {
    00126     return m_hepEngine->flat();
    00127   }

template<class TYPE>

StatusCode HepRndm::Engine< TYPE >::setSeeds | ( | const std::vector< long > & | seed | ) | `[inline]`

virtual double rndm() const { return BaseEngine::rndm( ); }

Set seeds

Definition at line 130 of file HepRndmEngines.cpp.

    00130                                                                                        {
    00131     typedef std::vector<long> seed_t;
    00132     m_seeds.clear();
    00133     for ( seed_t::const_iterator i = seed.begin(); i < seed.end(); i++ )   {
    00134       m_seeds.push_back(*i);
    00135     }
    00136     if ( m_seeds.size() > 0 )   {
    00137       if ( m_seeds.back() != 0 )    {
    00138         m_seeds.push_back(0);
    00139       }
    00140       m_hepEngine->setSeeds(&m_seeds[0], m_lux);
    00141       return StatusCode::SUCCESS;
    00142     }
    00143     return StatusCode::FAILURE;
    00144   }

template<class TYPE>

StatusCode HepRndm::Engine< TYPE >::seeds | ( | std::vector< long > & | seed | ) | const`[inline]`

Retrieve seeds.

Definition at line 147 of file HepRndmEngines.cpp.

    00147                                                                                     {
    00148     /*
    00149     const long *s = m_hepEngine->getSeeds();
    00150     for ( size_t i = 0; i < NUMBER_OF_SEEDS; i++ )   {
    00151       seed.push_back(s[i]);
    00152       if ( m_seeds.size() > i )
    00153         m_seeds[i] = s[i];
    00154       else
    00155         m_seeds.push_back(s[i]);
    00156     }
    00157     */
    00158     seed.push_back(m_hepEngine->getSeed());
    00159     return StatusCode::SUCCESS;
    00160   }

template<>

StatusCode HepRndm::Engine< DualRand >::initializeEngine | ( |  | ) | `[inline]`

Definition at line 163 of file HepRndmEngines.cpp.

    00163                                                              {
    00164     m_hepEngine = (m_useTable) ? new DualRand(m_row, m_col) : new DualRand(m_seeds[0]);
    00165     return StatusCode::SUCCESS;
    00166   }

template<>

StatusCode HepRndm::Engine< TripleRand >::initializeEngine | ( |  | ) | `[inline]`

Definition at line 168 of file HepRndmEngines.cpp.

    00168                                                                {
    00169     m_hepEngine = (m_useTable) ? new TripleRand(m_row, m_col) : new TripleRand(m_seeds[0]);
    00170     return StatusCode::SUCCESS;
    00171   }

template<>

StatusCode HepRndm::Engine< DRand48Engine >::initializeEngine | ( |  | ) | `[inline]`

Definition at line 173 of file HepRndmEngines.cpp.

    00173                                                                   {
    00174     m_hepEngine = (m_useTable) ? new DRand48Engine(m_row, m_col) : new DRand48Engine(m_seeds[0]);
    00175     return StatusCode::SUCCESS;
    00176   }

template<>

StatusCode HepRndm::Engine< Hurd160Engine >::initializeEngine | ( |  | ) | `[inline]`

Definition at line 178 of file HepRndmEngines.cpp.

    00178                                                                   {
    00179     m_hepEngine = (m_useTable) ? new Hurd160Engine(m_row, m_col) : new Hurd160Engine(m_seeds[0]);
    00180     return StatusCode::SUCCESS;
    00181   }

template<>

StatusCode HepRndm::Engine< Hurd288Engine >::initializeEngine | ( |  | ) | `[inline]`

Definition at line 183 of file HepRndmEngines.cpp.

    00183                                                                   {
    00184     m_hepEngine = (m_useTable) ? new Hurd288Engine(m_row, m_col) : new Hurd288Engine(m_seeds[0]);
    00185     return StatusCode::SUCCESS;
    00186   }

template<>

StatusCode HepRndm::Engine< RanecuEngine >::initializeEngine | ( |  | ) | `[inline]`

Definition at line 188 of file HepRndmEngines.cpp.

    00188                                                                  {
    00189     m_hepEngine = (m_useTable) ? new RanecuEngine(m_row) : new RanecuEngine(m_seeds[0]);
    00190     return StatusCode::SUCCESS;
    00191   }

template<>

StatusCode HepRndm::Engine< RanshiEngine >::initializeEngine | ( |  | ) | `[inline]`

Definition at line 193 of file HepRndmEngines.cpp.

    00193                                                                  {
    00194     m_hepEngine = (m_useTable) ? new RanshiEngine(m_row, m_col) : new RanshiEngine(m_seeds[0]);
    00195     return StatusCode::SUCCESS;
    00196   }

template<>

StatusCode HepRndm::Engine< RanluxEngine >::initializeEngine | ( |  | ) | `[inline]`

Definition at line 198 of file HepRndmEngines.cpp.

    00198                                                                  {
    00199     m_hepEngine = (m_useTable) ? new RanluxEngine(m_row, m_col, m_lux) : new RanluxEngine(m_seeds[0], m_lux);
    00200     return StatusCode::SUCCESS;
    00201   }

template<>

StatusCode HepRndm::Engine< Ranlux64Engine >::initializeEngine | ( |  | ) | `[inline]`

Definition at line 203 of file HepRndmEngines.cpp.

    00203                                                                    {
    00204     m_hepEngine = (m_useTable) ? new Ranlux64Engine(m_row, m_col, m_lux) : new Ranlux64Engine(m_seeds[0], m_lux);
    00205     return StatusCode::SUCCESS;
    00206   }

template<>

StatusCode HepRndm::Engine< MTwistEngine >::initializeEngine | ( |  | ) | `[inline]`

Definition at line 208 of file HepRndmEngines.cpp.

    00208                                                                  {
    00209     m_hepEngine = (m_useTable) ? new MTwistEngine(m_row, m_col) : new MTwistEngine(m_seeds[0]);
    00210     return StatusCode::SUCCESS;
    00211   }

template<>

StatusCode HepRndm::Engine< HepJamesRandom >::initializeEngine | ( |  | ) | `[inline]`

Definition at line 213 of file HepRndmEngines.cpp.

    00213                                                                    {
    00214     m_hepEngine = (m_useTable) ? new HepJamesRandom(m_row, m_col) : new HepJamesRandom(m_seeds[0]);
    00215     return StatusCode::SUCCESS;
    00216   }

## Member Data Documentation

template<class TYPE>

std::vector<long> HepRndm::Engine< TYPE >::m_seeds`[mutable, protected]`

Definition at line 28 of file HepRndmEngine.h.

template<class TYPE>

int HepRndm::Engine< TYPE >::m_row`[protected]`

Definition at line 30 of file HepRndmEngine.h.

template<class TYPE>

int HepRndm::Engine< TYPE >::m_col`[protected]`

Definition at line 30 of file HepRndmEngine.h.

template<class TYPE>

int HepRndm::Engine< TYPE >::m_lux`[protected]`

Definition at line 30 of file HepRndmEngine.h.

template<class TYPE>

bool HepRndm::Engine< TYPE >::m_useTable`[protected]`

Definition at line 31 of file HepRndmEngine.h.

template<class TYPE>

bool HepRndm::Engine< TYPE >::m_setSingleton`[protected]`

Definition at line 31 of file HepRndmEngine.h.

The documentation for this class was generated from the following files:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r7p1/GaudiSvc/src/RndmGenSvc/HepRndmEngine.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r7p1/GaudiSvc/src/RndmGenSvc/HepRndmEngines.cpp