| # Gaudi Framework, version v21r11 |

Home |  | Generated: 30 Sep 2010

# RndmEngine.cpp

Go to the documentation of this file.

    00001 //====================================================================
    00002 //      Random Engine implementation
    00003 //--------------------------------------------------------------------
    00004 //
    00005 //      Package    : Gaudi/RndmGen ( The LHCb Offline System)
    00006 //      Author     : M.Frank
    00007 //  History    :
    00008 // +---------+----------------------------------------------+---------
    00009 // |    Date |                 Comment                      | Who
    00010 // +---------+----------------------------------------------+---------
    00011 // | 29/10/99| Initial version                              | MF
    00012 // +---------+----------------------------------------------+---------
    00013 //
    00014 //====================================================================
    00015 #define GAUDI_RANDOMGENSVC_RndmEngine_CPP
    00016
    00017 // STL include files
    00018 #include <cfloat>
    00019
    00020 // Framework include files
    00021 #include "GaudiKernel/IMessageSvc.h"
    00022 #include "GaudiKernel/ISvcLocator.h"
    00023 #include "GaudiKernel/IIncidentSvc.h"
    00024 #include "GaudiKernel/IOpaqueAddress.h"
    00025 #include "GaudiKernel/IDataProviderSvc.h"
    00026 #include "GaudiKernel/DataObject.h"
    00027 #include "GaudiKernel/MsgStream.h"
    00028 #include "RndmEngine.h"
    00029
    00031 RndmEngine::RndmEngine(const std::string& name, ISvcLocator* loc)
    00032 : base_class(name, loc)
    00033 {
    00034 }
    00035
    00037 RndmEngine::~RndmEngine()   {
    00038 }
    00039
    00041 StatusCode RndmEngine::initialize()   {
    00042   StatusCode status = Service::initialize();
    00043   if ( status.isSuccess() )   {
    00044     status = setProperties();
    00045     if ( status.isSuccess() )   {
    00046       m_pIncidentSvc = serviceLocator()->service("IncidentSvc");
    00047       if (!m_pIncidentSvc.isValid()) {
    00048         status = StatusCode::FAILURE;
    00049       }
    00050     }
    00051   }
    00052   return status;
    00053 }
    00054
    00056 StatusCode RndmEngine::finalize()   {
    00057   m_pIncidentSvc = 0; // release
    00058   return Service::finalize();
    00059 }
    00060
    00062
    00063 StreamBuffer& RndmEngine::serialize(StreamBuffer& str)    {
    00064   return str;
    00065 }
    00066
    00068 StreamBuffer& RndmEngine::serialize(StreamBuffer& str) const    {
    00069   return str;
    00070 }
    00071
    00073 double RndmEngine::rndm() const   {
    00074   return DBL_MAX;
    00075 }
    00076
    00078 void RndmEngine::handle (const Incident& /* inc */ )    {
    00079 }
    00080
    00087 StatusCode RndmEngine::rndmArray( std::vector<double>& array, long howmany, long start) const   {
    00088   long cnt = start;
    00089   array.resize(start+howmany);
    00090   for ( long i = start, num = start+howmany; i < num; i++ )     {
    00091     array[cnt++] = rndm();
    00092   }
    00093   return StatusCode::SUCCESS;
    00094 }
    00095