| # Gaudi Framework, version v22r0 |

Home |  | Generated: 9 Feb 2011

# RndmGen.cpp

Go to the documentation of this file.

    00001 //====================================================================
    00002 //      Random RndmGen class implementation
    00003 //--------------------------------------------------------------------
    00004 //
    00005 //      Package    : Gaudi/RndmGen ( The LHCb Offline System)
    00006 //      Author     : M.Frank
    00007 //  History    :
    00008 //  +---------+----------------------------------------------+--------+
    00009 //  |    Date |                 Comment                      | Who    |
    00010 //  +---------+----------------------------------------------+--------+
    00011 //  | 21/11/99| Initial version.                             | MF     |
    00012 //  +---------+----------------------------------------------+--------+
    00013 //====================================================================
    00014 #define GAUDI_RANDOMGENSVC_RNDMGEN_CPP
    00015
    00016 #include <cfloat>
    00017 #include "GaudiKernel/ISvcLocator.h"
    00018 #include "GaudiKernel/IRndmEngine.h"
    00019 #include "RndmGen.h"
    00020
    00022 RndmGen::RndmGen(IInterface* engine) : m_params(0), m_engine(0)   {
    00023   if ( 0 != engine )  {
    00024     engine->queryInterface(IRndmEngine::interfaceID(), pp_cast<void>(&m_engine)).ignore();
    00025   }
    00026 }
    00027
    00029 RndmGen::~RndmGen()   {
    00030   if ( m_engine ) m_engine->release();
    00031   m_engine = 0;
    00032   if ( m_params ) delete m_params;
    00033   m_params = 0;
    00034 }
    00035
    00037 StatusCode RndmGen::initialize(const IRndmGen::Param& par)   {
    00038   m_params = par.clone();
    00039   return (0==m_engine) ? StatusCode::FAILURE : StatusCode::SUCCESS;
    00040 }
    00041
    00043 StatusCode RndmGen::finalize()   {
    00044   return StatusCode::SUCCESS;
    00045 }
    00046
    00048 double RndmGen::shoot()  const  {
    00049   return DBL_MAX;
    00050 }
    00051
    00053 StatusCode RndmGen::shootArray( std::vector<double>& array, long howmany, long start) const {
    00054   if ( 0 != m_engine )    {
    00055     long cnt = start;
    00056     array.resize(start+howmany);
    00057     for ( long i = start, num = start+howmany; i < num; i++ )     {
    00058       array[cnt++] = shoot();
    00059     }
    00060     return StatusCode::SUCCESS;
    00061   }
    00062   return StatusCode::FAILURE;
    00063 }
    00064

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines