60 RooTFoamBinding(
const RooAbsReal &pdf,
const RooArgSet &observables)
61 : _binding(std::make_unique<RooRealBinding>(pdf, observables, &_nset, false, nullptr))
63 _nset.add(observables);
69 for (
int i = 0; i < ndim; i++) {
70 x[i] = xvec[i] * (_binding->getMaxLimit(i) - _binding->getMinLimit(i)) + _binding->getMinLimit(i);
72 double ret = (*_binding)(
x);
76 RooRealBinding &binding() {
return *_binding; }
80 std::unique_ptr<RooRealBinding> _binding;
88void RooFoamGenerator::registerSampler(RooNumGenFactory& fact)
91 RooRealVar nSample(
"nSample",
"Number of samples per cell",200,0,1e6) ;
92 RooRealVar nCell1D(
"nCell1D",
"Number of cells for 1-dim generation",30,0,1e6) ;
93 RooRealVar nCell2D(
"nCell2D",
"Number of cells for 2-dim generation",500,0,1e6) ;
94 RooRealVar nCell3D(
"nCell3D",
"Number of cells for 3-dim generation",5000,0,1e6) ;
95 RooRealVar nCellND(
"nCellND",
"Number of cells for N-dim generation",10000,0,1e6) ;
96 RooRealVar chatLevel(
"chatLevel",
"TFOAM 'chat level' (verbosity)",0,0,2) ;
98 RooFoamGenerator*
proto =
new RooFoamGenerator ;
99 fact.storeProtoSampler(
proto,
RooArgSet(nSample,nCell1D,nCell2D,nCell3D,nCellND,chatLevel)) ;
108 RooAbsNumGenerator(func,genVars,
verbose,maxFuncVal)
110 _binding = std::make_unique<RooTFoamBinding>(*_funcClone,_realVars) ;
112 _tfoam = std::make_unique<TFoam>(
"TFOAM") ;
113 _tfoam->SetkDim(_realVars.size()) ;
114 _tfoam->SetRho(_binding.get()) ;
116 switch(_realVars.size()) {
125 _tfoam->Initialize() ;
127 _vec.resize(_realVars.size());
128 _xmin.resize(_realVars.size());
129 _range.resize(_realVars.size());
133 _xmin[i] = var->getMin() ;
134 _range[i] = var->getMax() - var->getMin() ;
145 if(event->size() == 1)
return event;
147 _tfoam->MakeEvent() ;
148 _tfoam->GetMCvect(_vec.data()) ;
152 for (
auto arg : _realVars) {
154 var->
setVal(_xmin[i] + _range[i]*_vec[i]) ;
160std::string
const& RooFoamGenerator::generatorName()
const {
161 static const std::string
name =
"RooFoamGenerator";
ROOT::RRangeCast< T, false, Range_t > static_range_cast(Range_t &&coll)
int Int_t
Signed integer 4 bytes (int).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
double getRealValue(const char *name, double defVal=0.0, bool verbose=false) const
Get value of a RooAbsReal stored in set with given name.
Storage_t const & get() const
Const access to the underlying stl container.
Abstract base class for objects that represent a real value and implements functionality common to al...
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Holds the configuration parameters of the various numeric integrators used by RooRealIntegral.
const RooArgSet & getConfigSection(const char *name) const
Retrieve configuration information specific to integrator with given name.
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
Variable that can be changed from the outside.
void setVal(double value) override
Set value of variable to 'value'.
Abstract class representing n-dimensional real positive integrand function.
virtual Double_t Density(Int_t ndim, Double_t *)=0