/usr/include/root/TFoamSampler.h is in libroot-math-foam-dev 5.34.19+dfsg-1.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | // @(#)root/mathcore:$Id$
// Author: L. Moneta Fri Sep 22 15:06:47 2006
/**********************************************************************
* *
* Copyright (c) 2006 LCG ROOT Math Team, CERN/PH-SFT *
* *
* *
**********************************************************************/
// Header file for class TFoamSampler
#ifndef ROOT_TFoamSampler
#define ROOT_TFoamSampler
#ifndef ROOT_Math_DistSampler
#include "Math/DistSampler.h"
#endif
namespace ROOT {
namespace Fit {
class DataRange;
class BinData;
class UnBinData;
}
namespace Math {
}
}
class TFoamIntegrand;
class TRandom;
class TF1;
class TFoam;
//_______________________________________________________________________________
/**
TFoamSampler class
class implementing the ROOT::Math::DistSampler interface using FOAM
for sampling arbitrary distributions.
*/
class TFoamSampler : public ROOT::Math::DistSampler {
public:
/// default constructor
TFoamSampler();
/// virtual destructor
virtual ~TFoamSampler();
using DistSampler::SetFunction;
/// set the parent function distribution to use for random sampling (one dim case)
void SetFunction(const ROOT::Math::IGenFunction & func) {
fFunc1D = &func;
SetFunction<const ROOT::Math::IGenFunction>(func, 1);
}
/// set the Function using a TF1 pointer
void SetFunction(TF1 * pdf);
/**
initialize the generators with the default options
*/
bool Init(const char * = "");
/**
initialize the generators with the fiven options
*/
bool Init(const ROOT::Math::DistSamplerOptions & opt );
/**
Set the random engine to be used
Needs to be called before Init to have effect
*/
void SetRandom(TRandom * r);
/**
Set the random seed for the TRandom instances used by the sampler
classes
Needs to be called before Init to have effect
*/
void SetSeed(unsigned int seed);
/**
Get the random engine used by the sampler
*/
TRandom * GetRandom();
/**
sample one event in multi-dimension by filling the given array
return false if sampling failed
*/
bool Sample(double * x);
/**
sample one bin given an estimated of the pdf in the bin
(this can be function value at the center or its integral in the bin
divided by the bin width)
By default do not do random sample, just return the function values
*/
bool SampleBin(double prob, double & value, double *error = 0);
protected:
private:
// private member
// bool fOneDim; // flag to indicate if the function is 1 dimension
// bool fHasMode; // flag to indicate if a mode is set
// bool fHasArea; // flag to indicate if a area is set
// double fMode; // mode of dist
// double fArea; // area of dist
const ROOT::Math::IGenFunction * fFunc1D; // 1D function pointer
TFoam * fFoam; // foam engine class
TFoamIntegrand * fFoamDist; // foam distribution interface
//ClassDef(TFoamSampler,1) //Distribution sampler class based on FOAM
};
#endif /* ROOT_TFoamSampler */
|