I’m trying plot a variable from a root file but it’s getting error. Roofit says that it has no entries.
#ifndef __CINT__
#include "RooGlobalFunc.h"
#endif
#include "RooRealVar.h"
#include "RooDataSet.h"
#include "RooDataHist.h"
#include "RooGaussian.h"
#include "TCanvas.h"
#include "RooPlot.h"
#include "TTree.h"
#include "TH1D.h"
#include "TRandom.h"
using namespace RooFit ;
void D_MMimport()
{
// Import TTree
TFile *file = new TFile("KKK_MagUp.root");
TTree* tree = (TTree*)file->Get("DecayTree/D_MM");
// Declare observable x
RooRealVar D_MM("D_MM","D_MM",1920,2020) ;
// Create a binned dataset that imports contents of TH1 and associates its contents to observable 'x'
RooDataSet dh("dh","dh",RooArgSet(D_MM),Import(*tree)) ;
RooPlot* frame = D_MM.frame(Title("Ds"));
dh.plotOn(frame,Binning(100));
dh.ls();
frame->Draw();
}