NCFS-Pack
A generic (astro)particle physics analysis framework
 
Loading...
Searching...
No Matches
NcRandom.h
Go to the documentation of this file.
1#ifndef NcRandom_h
2#define NcRandom_h
3// Copyright(c) 1997 NCFS/IIHE, All Rights Reserved.
4// See cxx source for full Copyright notice.
5
6#include <math.h>
7
8#include "TObject.h"
9
10#include "NcMath.h"
11#include "NcTimestamp.h"
12
14
15class NcRandom : public TObject
16{
17 public:
18 NcRandom(); // Constructor with default sequence
19 NcRandom(Int_t seed,NcTimestamp* ts=0); // Constructor with user defined seed
20 NcRandom(Int_t seed,Int_t cnt1,Int_t cnt2,NcTimestamp* ts=0); // User defined starting point
21 virtual ~NcRandom(); // Destructor
22 Int_t GetSeed() const; // Provide current seed value
23 Int_t GetCnt1() const; // Provide current counter value cnt1
24 Int_t GetCnt2() const; // Provide current counter value cnt2
25 void Data() const; // Print current seed, cnt1 and cnt2
26 Float_t Uniform(); // Uniform dist. within <0,1>
27 Float_t Uniform(Float_t a,Float_t b); // Uniform dist. within <a,b>
28 void Uniform(Float_t* vec,Int_t n); // n uniform randoms in <0,1>
29 void Uniform(Float_t* vec,Int_t n,Float_t a,Float_t b); // see above
30 Float_t Gauss(); // Gaussian dist. with mean=0 sigma=1
31 Float_t Gauss(Float_t mean,Float_t sigma); // Gaussian dist. with mean and sigma
32 void Gauss(Float_t* vec,Int_t n); // n Gaussian randoms mean=0 sigma=1
33 void Gauss(Float_t* vec,Int_t n,Float_t mean,Float_t sigma); // see above
34 Float_t Poisson(Float_t mean); // Poisson dist. with certain mean
35 void Poisson(Float_t* vec,Int_t n,Float_t mean); // n Poisson randoms with mean
36 void SetUser(Float_t a,Float_t b,Int_t n,Float_t (*f)(Float_t)); // Specify user dist. f(x)
37 void SetUser(Float_t* x,Float_t* y,Int_t n); // Specify user dist. arrays
38 Float_t User(); // Provide random in [a,b] according to user distribution
39 void User(Float_t* vec,Int_t n); // n randoms in [a,b] from user dist.
40 Double_t RanBm(Double_t nr,Double_t n,Int_t m,Double_t* p=0,Double_t* na=0,Double_t* psia=0,Double_t psi0=-1,Int_t f=0,TH1* psih=0,Int_t ncut=0,Double_t* nrx=0);// Random B_m
41
42 private:
43 Int_t fI,fJ,fSeed,fCnt1,fCnt2,fClip; // Indices, seed and counters
44 Float_t fU[97],fC,fCd,fCm; // The Fibonacci parameters
45 void Start(Int_t seed,Int_t cnt1,Int_t cnt2,NcTimestamp* ts); // Start at certain point
46 void Unpack(Int_t seed,Int_t& i,Int_t& j,Int_t& k,Int_t& l); // Unpack the seed
47 void Uniform(Int_t n); // n uniform randoms for quick skipping
48 Int_t fNa;
49 Float_t* fXa;
50 Float_t* fYa;
51 Float_t fYamin,fYamax;
52 Int_t* fIbins;
53
54 ClassDef(NcRandom,3) // Generate universal random numbers and sequences on all common machines.
55};
56#endif
Float_t fYamax
! The min. and max. y values of the area function
Definition NcRandom.h:51
void Unpack(Int_t seed, Int_t &i, Int_t &j, Int_t &k, Int_t &l)
Definition NcRandom.cxx:371
Float_t Gauss()
Definition NcRandom.cxx:728
Int_t fI
Definition NcRandom.h:43
Int_t fCnt1
Definition NcRandom.h:43
Float_t * fXa
! The binned x values of the area function
Definition NcRandom.h:49
Int_t GetCnt2() const
Definition NcRandom.cxx:453
Double_t RanBm(Double_t nr, Double_t n, Int_t m, Double_t *p=0, Double_t *na=0, Double_t *psia=0, Double_t psi0=-1, Int_t f=0, TH1 *psih=0, Int_t ncut=0, Double_t *nrx=0)
Int_t fCnt2
Definition NcRandom.h:43
Float_t fCm
Definition NcRandom.h:44
void Start(Int_t seed, Int_t cnt1, Int_t cnt2, NcTimestamp *ts)
Definition NcRandom.cxx:244
Float_t * fYa
! The corresponding y values of the area function
Definition NcRandom.h:50
Float_t User()
void Data() const
Definition NcRandom.cxx:464
Int_t fClip
Definition NcRandom.h:43
Int_t GetCnt1() const
Definition NcRandom.cxx:442
Int_t GetSeed() const
Definition NcRandom.cxx:431
Int_t fJ
Definition NcRandom.h:43
virtual ~NcRandom()
Definition NcRandom.cxx:228
Float_t fU[97]
Definition NcRandom.h:44
void SetUser(Float_t a, Float_t b, Int_t n, Float_t(*f)(Float_t))
Definition NcRandom.cxx:915
Float_t fYamin
Definition NcRandom.h:51
Int_t * fIbins
! The bin numbers of the random x candidates
Definition NcRandom.h:52
Float_t fC
Definition NcRandom.h:44
Float_t Uniform()
Definition NcRandom.cxx:476
Float_t fCd
Definition NcRandom.h:44
Int_t fSeed
Definition NcRandom.h:43
Float_t Poisson(Float_t mean)
Definition NcRandom.cxx:793
Int_t fNa
! The number of bins of the area function
Definition NcRandom.h:48
Handling of timestamps for (astro)particle physics research.
Definition NcTimestamp.h:20