createHistogram with RooDataSet variables function

Dear all,
I would like to create a TH2F from a 4-dimensional RooDataSet using the square of two variables in the RooDataSet.
It should be possible according to root.cern.ch/doc/master/classRo … a24d369b89

So I create the RooDataSet as follows:

  RooRealVar massKPi("massKPi","m(K^{-}#pi^{+}) [GeV]",1.,0.6,2.2);
  RooRealVar massPsiPi("massMuMuPi","m(#psi#pi^{+}) [GeV]",4.,3.3,4.8);
  RooRealVar cosMuMu("cosMuMu","cos(J/#psi)",0.,-1,1); // cosine of the psi(nS) helicity angle
  RooRealVar phi("phi","#phi",0.25,-TMath::Pi(),TMath::Pi());

  RooArgSet kinematcVars(massKPi, cosMuMu, massPsiPi, phi);

  RooDataSet* data = model->generate(kinematcVars, 1000) ;

but when I use the createHistogram method I am not able to square the two variables:

  TH1* dalitz = data->createHistogram("massKPi*massKPi, massPsiPi*massPsiPi") ;

gives:
[#0] ERROR:InputArguments – RooAbsData::createHistogram(Kstars_signalData) ERROR: dataset does not contain an observable named massKPi*massKPi

I also tried using a RooFormulaVar as argument of the createHistogram method and I got:

Many thanks for your help,
Leonardo

Hi,

I think this is an error in the documentation. The functions is accepting only RooAbsRealLValue, which are basically RooRealVar, thus variables and not functions of variables

Lorenzo