source: Sophya/trunk/SophyaLib/NTools/tsfunran.h@ 3601

Last change on this file since 3601 was 3601, checked in by cmv, 16 years ago

adaptation de TsFunRan a RandomGeneratorInterface , cmv 28/04/2009

File size: 1.2 KB
Line 
1// This may look like C code, but it is really -*- C++ -*-
2// Tirages aleatoires sur une fonction (thread safe)
3// C. Magneville 2009
4// DAPNIA/SPP (Saclay) / CEA LAL - IN2P3/CNRS (Orsay)
5
6#ifndef TSFUNRAN_SEEN
7#define TSFUNRAN_SEEN
8
9#include "machdefs.h"
10#include <stdlib.h>
11#include <math.h>
12#include "histos.h"
13#include "tvector.h"
14#include "randinterf.h"
15#include "classfunc.h"
16
17namespace SOPHYA {
18
19class TsFunRan : public Histo {
20public:
21 typedef r_8 (*Func)(r_8);
22 TsFunRan(ClassFunc& f, r_8 xMin=0.0, r_8 xMax=1.0, int_4 nBin=100, bool pdf=true);
23 TsFunRan(Func f, r_8 xMin=0.0, r_8 xMax=1.0, int_4 nBin=100, bool pdf=true);
24 TsFunRan(r_8 *tab, int_4 nBin, bool pdf=true);
25 TsFunRan(r_8 *tab, int_4 nBin, r_8 xMin, r_8 xMax, bool pdf=true);
26 TsFunRan(TVector<r_8>& tab, int_4 nBin, bool pdf=true);
27 TsFunRan(TVector<r_8>& tab, int_4 nBin, r_8 xMin, r_8 xMax, bool pdf=true);
28 TsFunRan(Histo &h, bool pdf=true);
29 TsFunRan(const TsFunRan& fh);
30 TsFunRan(void);
31 virtual ~TsFunRan(void);
32
33 void SetRandomGenerator(RandomGeneratorInterface* rg);
34
35 int_4 BinRandom(void);
36 r_8 Random(void);
37 r_8 RandomInterp(void);
38protected:
39 void create_DF(bool pdf);
40 RandomGeneratorInterface* rg_;
41 bool internal_rg_;
42};
43
44} // namespace SOPHYA
45
46#endif
Note: See TracBrowser for help on using the repository browser.