Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:15:12

0001 /***********************************************************************************\
0002 * (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
0003 *                                                                                   *
0004 * This software is distributed under the terms of the Apache version 2 licence,     *
0005 * copied verbatim in the file "LICENSE".                                            *
0006 *                                                                                   *
0007 * In applying this licence, CERN does not waive the privileges and immunities       *
0008 * granted to it by virtue of its status as an Intergovernmental Organization        *
0009 * or submit itself to any jurisdiction.                                             *
0010 \***********************************************************************************/
0011 #ifndef GAUDIKERNEL_IRNDMGEN_H
0012 #define GAUDIKERNEL_IRNDMGEN_H
0013 
0014 // STL include files
0015 #include <string>
0016 #include <vector>
0017 
0018 // Framework include files
0019 #include <GaudiKernel/IInterface.h>
0020 
0021 // Declaration of the interface ID ( interface id, major version, minor version)
0022 static const InterfaceID IID_IRndmBit( 150, 1, 0 );
0023 static const InterfaceID IID_IRndmFlat( 151, 1, 0 );
0024 static const InterfaceID IID_IRndmChi2( 152, 1, 0 );
0025 static const InterfaceID IID_IRndmGamma( 153, 1, 0 );
0026 static const InterfaceID IID_IRndmGauss( 154, 1, 0 );
0027 static const InterfaceID IID_IRndmLandau( 155, 1, 0 );
0028 static const InterfaceID IID_IRndmPoisson( 156, 1, 0 );
0029 static const InterfaceID IID_IRndmStudentT( 157, 1, 0 );
0030 static const InterfaceID IID_IRndmBinomial( 158, 1, 0 );
0031 static const InterfaceID IID_IRndmExponential( 159, 1, 0 );
0032 static const InterfaceID IID_IRndmBreitWigner( 160, 1, 0 );
0033 static const InterfaceID IID_IRndmBreitWignerCutOff( 161, 1, 0 );
0034 static const InterfaceID IID_IRndmDefinedPdf( 162, 1, 0 );
0035 static const InterfaceID IID_IRndmGaussianTail( 163, 1, 0 );
0036 
0037 /** @class IRndmGen IRndmGen.h GaudiKernel/IRndmGen.h
0038 
0039     Definition of a interface for a generic random number generators.
0040 
0041     @author  M.Frank
0042     @version 1.0
0043 */
0044 class GAUDI_API IRndmGen : virtual public IInterface {
0045 public:
0046   /// InterfaceID
0047   DeclareInterfaceID( IRndmGen, 2, 0 );
0048 
0049   class Param {
0050   protected:
0051     /// Type of the generator
0052     const InterfaceID m_type;
0053 
0054   public:
0055     /// Standard constructor
0056     Param( const InterfaceID& type = IID_IRndmFlat ) : m_type( type ) {}
0057     /// Standard Destructor
0058     virtual ~Param() = default;
0059     /// Parameter's type
0060     virtual const InterfaceID& type() const { return m_type; }
0061     /// Clone parameters
0062     virtual Param* clone() const = 0;
0063   };
0064 
0065   /// Initialize the generator
0066   virtual StatusCode initialize( const IRndmGen::Param& par ) = 0;
0067   /// Finalize the generator
0068   virtual StatusCode finalize() = 0;
0069   /// Random number generator type
0070   virtual const InterfaceID& type() const = 0;
0071   /// Random generator ID
0072   virtual long ID() const = 0;
0073   /// Access to random number generator parameters
0074   virtual const IRndmGen::Param* parameters() const = 0;
0075   /// Single shot returning single random number according to specified distribution
0076   virtual double shoot() const = 0;
0077   /** Multiple shots returning vector with random number according to specified distribution.
0078       @param  array    Array containing random numbers
0079       @param  howmany  fill 'howmany' random numbers into array
0080       @param  start    ... starting at position start
0081       @param Statuscode indicating success or failure
0082   */
0083   virtual StatusCode shootArray( std::vector<double>& array, long howmany, long start = 0 ) const = 0;
0084 
0085   /// Virtual destructor
0086   virtual ~IRndmGen() = default;
0087 };
0088 
0089 #endif // GAUDIKERNEL_IRNDMGEN_H