Skip to content

[RF] Asymmetry plots with RooFit #14255

Open
@Sanjeedabd

Description

@Sanjeedabd

Check duplicate issues.

  • Checked for duplicates

Description

Unable to get he asymmetry projections using RooSimultaneous by using the argument
Asymmetry(const [RooCategory](https://root.cern.ch/doc/master/classRooCategory.html)& c)

Reproducer

This code is written by Jonas Rembser:

void repro()
{
   using namespace RooFit;

   RooWorkspace ws;
   ws.factory("Gaussian::gauss_A(x_A[-10, 10], -1.0, 1.0)");
   ws.factory("Gaussian::gauss_B(x_B[-10, 10], +1.0, 1.0)");
   ws.factory("ExtendPdf::pdf_A(gauss_A, n_A[10000.])");
   ws.factory("ExtendPdf::pdf_B(gauss_B, n_B[10000.])");
   ws.factory("SIMUL::simPdf(sample[A=-1, B=+1], A=pdf_A, B=pdf_B)");

   RooRealVar &xA = *ws.var("x_A");
   RooRealVar &xB = *ws.var("x_B");
   RooCategory &sample = *ws.cat("sample");

   std::unique_ptr<RooDataSet> data{ws.pdf("simPdf")->generate({xA, xB, sample})};

   auto frame = ws.var("x_A")->frame();
   ws.pdf("simPdf")->plotOn(frame, Asymmetry(sample), ProjWData(sample, *data));

   frame->Draw();
}

ROOT version

6.28/04

Installation method

pre-built binary

Operating system

Ubuntu, 20.04

Additional context

What made me open this issue?

I have the working code for a weighted 2D simultaneous PDF. It has 2 mass variables which I fit and two separate datasets corresponding to the D0 and D0bar samples. How do I get the asymmetry of as a function of the two mass variables from the D0 and D0bar PDFs corresponding to each mass variable.

I can do it for histograms using TH1::GetAsymmetry but I am not able to do it in the Roofit code. Here’s the code that I am using:
asym_proj_forum.zip. The root file can be found at:
https://drive.google.com/file/d/1g9iV072zb0h3qGo4Ui5EcYxtDJkc8wNL/view?usp=sharing

I posted this issue on root forum and it was suggested that I create a github issue. One can follow the discussion here

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions