| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# 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.

## Detailed Description

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

Definition at line 25 of file HepRndmEngine.h.

## 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.
StatusCode | setSeeds (const std::vector< long > &seed)
| Set seeds.
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

## Constructor & Destructor Documentation

template<class TYPE>

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

Standard Constructor.

Definition at line 53 of file HepRndmEngines.cpp.

References Service::declareProperty(), HepRndm::Engine< TYPE >::m_col, HepRndm::Engine< TYPE >::m_lux, HepRndm::Engine< TYPE >::m_row, HepRndm::Engine< TYPE >::m_seeds, HepRndm::Engine< TYPE >::m_setSingleton, and HepRndm::Engine< TYPE >::m_useTable.

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

template<class TYPE>

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

Standard Destructor.

Definition at line 64 of file HepRndmEngines.cpp.

    00064                                                        {
    00065   }

## Member Function Documentation

template<class TYPE>

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

Initialize the Engine.

Reimplemented from RndmEngine.

Definition at line 68 of file HepRndmEngines.cpp.

References std::vector< _Tp, _Alloc >::begin(), std::vector< _Tp, _Alloc >::end(), endmsg(), std::vector< _Tp, _Alloc >::erase(), MSG::ERROR, StatusCode::FAILURE, MSG::INFO, RndmEngine::initialize(), HepRndm::Engine< TYPE >::initializeEngine(), StatusCode::isSuccess(), HepRndm::Engine< TYPE >::m_col, HepRndm::BaseEngine::m_hepEngine, HepRndm::Engine< TYPE >::m_lux, HepRndm::Engine< TYPE >::m_row, HepRndm::Engine< TYPE >::m_seeds, HepRndm::Engine< TYPE >::m_setSingleton, HepRndm::Engine< TYPE >::m_useTable, Service::messageService(), Service::name(), std::vector< _Tp, _Alloc >::push_back(), std::vector< _Tp, _Alloc >::size(), and System::typeinfoName().

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

template<class TYPE>

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

Finalize the Engine.

Reimplemented from RndmEngine.

Definition at line 113 of file HepRndmEngines.cpp.

References std::vector< _Tp, _Alloc >::clear(), RndmEngine::finalize(), HepRndm::BaseEngine::m_hepEngine, and HepRndm::Engine< TYPE >::m_seeds.

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

template<class TYPE>

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

Create/Initialize new HepEngine....

Referenced by HepRndm::Engine< TYPE >::initialize().

template<class TYPE>

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

Single shot.

Reimplemented from RndmEngine.

Definition at line 124 of file HepRndmEngines.cpp.

References HepRndm::BaseEngine::m_hepEngine.

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

template<class TYPE>

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

Set seeds.

Implements IRndmEngine.

Definition at line 129 of file HepRndmEngines.cpp.

References std::vector< _Tp, _Alloc >::back(), std::vector< _Tp, _Alloc >::begin(), std::vector< _Tp, _Alloc >::clear(), std::vector< _Tp, _Alloc >::end(), StatusCode::FAILURE, HepRndm::BaseEngine::m_hepEngine, HepRndm::Engine< TYPE >::m_lux, HepRndm::Engine< TYPE >::m_seeds, std::vector< _Tp, _Alloc >::push_back(), std::vector< _Tp, _Alloc >::size(), and StatusCode::SUCCESS.

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

template<class TYPE>

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

Retrieve seeds.

Implements IRndmEngine.

Definition at line 146 of file HepRndmEngines.cpp.

References HepRndm::BaseEngine::m_hepEngine, std::vector< _Tp, _Alloc >::push_back(), and StatusCode::SUCCESS.

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

template<>

StatusCode HepRndm::Engine< DualRand >::initializeEngine | ( |  | ) |

Definition at line 162 of file HepRndmEngines.cpp.

References HepRndm::Engine< TYPE >::m_col, HepRndm::BaseEngine::m_hepEngine, HepRndm::Engine< TYPE >::m_row, HepRndm::Engine< TYPE >::m_seeds, HepRndm::Engine< TYPE >::m_useTable, and StatusCode::SUCCESS.

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

template<>

StatusCode HepRndm::Engine< TripleRand >::initializeEngine | ( |  | ) |

Definition at line 167 of file HepRndmEngines.cpp.

References HepRndm::Engine< TYPE >::m_col, HepRndm::BaseEngine::m_hepEngine, HepRndm::Engine< TYPE >::m_row, HepRndm::Engine< TYPE >::m_seeds, HepRndm::Engine< TYPE >::m_useTable, and StatusCode::SUCCESS.

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

template<>

StatusCode HepRndm::Engine< DRand48Engine >::initializeEngine | ( |  | ) |

Definition at line 172 of file HepRndmEngines.cpp.

References HepRndm::Engine< TYPE >::m_col, HepRndm::BaseEngine::m_hepEngine, HepRndm::Engine< TYPE >::m_row, HepRndm::Engine< TYPE >::m_seeds, HepRndm::Engine< TYPE >::m_useTable, and StatusCode::SUCCESS.

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

template<>

StatusCode HepRndm::Engine< Hurd160Engine >::initializeEngine | ( |  | ) |

Definition at line 177 of file HepRndmEngines.cpp.

References HepRndm::Engine< TYPE >::m_col, HepRndm::BaseEngine::m_hepEngine, HepRndm::Engine< TYPE >::m_row, HepRndm::Engine< TYPE >::m_seeds, HepRndm::Engine< TYPE >::m_useTable, and StatusCode::SUCCESS.

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

template<>

StatusCode HepRndm::Engine< Hurd288Engine >::initializeEngine | ( |  | ) |

Definition at line 182 of file HepRndmEngines.cpp.

References HepRndm::Engine< TYPE >::m_col, HepRndm::BaseEngine::m_hepEngine, HepRndm::Engine< TYPE >::m_row, HepRndm::Engine< TYPE >::m_seeds, HepRndm::Engine< TYPE >::m_useTable, and StatusCode::SUCCESS.

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

template<>

StatusCode HepRndm::Engine< RanecuEngine >::initializeEngine | ( |  | ) |

Definition at line 187 of file HepRndmEngines.cpp.

References HepRndm::BaseEngine::m_hepEngine, HepRndm::Engine< TYPE >::m_row, HepRndm::Engine< TYPE >::m_seeds, HepRndm::Engine< TYPE >::m_useTable, and StatusCode::SUCCESS.

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

template<>

StatusCode HepRndm::Engine< RanshiEngine >::initializeEngine | ( |  | ) |

Definition at line 192 of file HepRndmEngines.cpp.

References HepRndm::Engine< TYPE >::m_col, HepRndm::BaseEngine::m_hepEngine, HepRndm::Engine< TYPE >::m_row, HepRndm::Engine< TYPE >::m_seeds, HepRndm::Engine< TYPE >::m_useTable, and StatusCode::SUCCESS.

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

template<>

StatusCode HepRndm::Engine< RanluxEngine >::initializeEngine | ( |  | ) |

Definition at line 197 of file HepRndmEngines.cpp.

References HepRndm::Engine< TYPE >::m_col, HepRndm::BaseEngine::m_hepEngine, HepRndm::Engine< TYPE >::m_lux, HepRndm::Engine< TYPE >::m_row, HepRndm::Engine< TYPE >::m_seeds, HepRndm::Engine< TYPE >::m_useTable, and StatusCode::SUCCESS.

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

template<>

StatusCode HepRndm::Engine< Ranlux64Engine >::initializeEngine | ( |  | ) |

Definition at line 202 of file HepRndmEngines.cpp.

References HepRndm::Engine< TYPE >::m_col, HepRndm::BaseEngine::m_hepEngine, HepRndm::Engine< TYPE >::m_lux, HepRndm::Engine< TYPE >::m_row, HepRndm::Engine< TYPE >::m_seeds, HepRndm::Engine< TYPE >::m_useTable, and StatusCode::SUCCESS.

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

template<>

StatusCode HepRndm::Engine< MTwistEngine >::initializeEngine | ( |  | ) |

Definition at line 207 of file HepRndmEngines.cpp.

References HepRndm::Engine< TYPE >::m_col, HepRndm::BaseEngine::m_hepEngine, HepRndm::Engine< TYPE >::m_row, HepRndm::Engine< TYPE >::m_seeds, HepRndm::Engine< TYPE >::m_useTable, and StatusCode::SUCCESS.

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

template<>

StatusCode HepRndm::Engine< HepJamesRandom >::initializeEngine | ( |  | ) |

Definition at line 212 of file HepRndmEngines.cpp.

References HepRndm::Engine< TYPE >::m_col, HepRndm::BaseEngine::m_hepEngine, HepRndm::Engine< TYPE >::m_row, HepRndm::Engine< TYPE >::m_seeds, HepRndm::Engine< TYPE >::m_useTable, and StatusCode::SUCCESS.

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

## Member Data Documentation

template<class TYPE>

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

Definition at line 28 of file HepRndmEngine.h.

Referenced by HepRndm::Engine< TYPE >::Engine(), HepRndm::Engine< TYPE >::finalize(), HepRndm::Engine< TYPE >::initialize(), HepRndm::Engine< TYPE >::initializeEngine(), and HepRndm::Engine< TYPE >::setSeeds().

template<class TYPE>

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

Definition at line 30 of file HepRndmEngine.h.

Referenced by HepRndm::Engine< TYPE >::Engine(), HepRndm::Engine< TYPE >::initialize(), and HepRndm::Engine< TYPE >::initializeEngine().

template<class TYPE>

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

Definition at line 30 of file HepRndmEngine.h.

Referenced by HepRndm::Engine< TYPE >::Engine(), HepRndm::Engine< TYPE >::initialize(), and HepRndm::Engine< TYPE >::initializeEngine().

template<class TYPE>

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

Definition at line 30 of file HepRndmEngine.h.

Referenced by HepRndm::Engine< TYPE >::Engine(), HepRndm::Engine< TYPE >::initialize(), HepRndm::Engine< TYPE >::initializeEngine(), and HepRndm::Engine< TYPE >::setSeeds().

template<class TYPE>

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

Definition at line 31 of file HepRndmEngine.h.

Referenced by HepRndm::Engine< TYPE >::Engine(), HepRndm::Engine< TYPE >::initialize(), and HepRndm::Engine< TYPE >::initializeEngine().

template<class TYPE>

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

Definition at line 31 of file HepRndmEngine.h.

Referenced by HepRndm::Engine< TYPE >::Engine(), and HepRndm::Engine< TYPE >::initialize().

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

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