How to set range for RooFormulaVar created var?


I used :

RooFormulaVar f4pi(“f4pi”,“f4pi”,"(netac-f2k2pi837.-f4k108.-f6pi681-fkskpi156.)/1532.",RooArgList(netac,f2k2pi,f4k,f6pi,fkskpi)) ;

to creat f4pi variable. I would like to constraint it to be from 0 to 1. How should I do? It seems

f4pi.setRange(0, 1.) ;
does not work. Thanks in advance!


The setRange() method only works for lvalues (i.e. object you
can set the value of, such as RooRealVar or generally anything
that inherits from RooAbsRealLValue). Since a RooFormulaVar is
a non-invertible function it is not an lvalue and you cannot do that.

If you send a bit more detail about what you aim to accomplish I might be able to suggest a solution.