#include "RooAddPdf.h" #include "RooWorkspace.h" #include "RooPlot.h" #include #include #include #include #include "TCanvas.h" #include "TAxis.h" #include "TFile.h" #include "TH1.h" #include #include #include "RooHistPdf.h" #include "TTree.h" #include "TROOT.h" void hepfile() { using namespace RooFit; /* TFile *file1 = new TFile("HEPData-ins1725190-v3-root.root", "READ"); TH1* hh = (TH1*)file1->Get("Dielectron invariant mass spectrum/Hist1D_y1") ; TTree* tree1 = (TTree*)file1->Get("Dielectron invariant mass spectrum/Hist1D_y1") ; RooRealVar t("t","Reconstructed mass", 1800,2500); //RooDataHist data("data","dataset with x", mass,hh) ; //RooDataSet data1("data1", "data1", tree1, mass ); */ // Observable RooRealVar t("t","Reconstructed mass", 1800,2500); // Theoretical model RooRealVar ml("ml","mean landau", 3.14 ) ; RooAbsPdf* myPdf = RooClassFactory::makePdfInstance("RooMyPdf", " (2*t) / (3.1415*sqrt(abs((t*t - 2000*2000)*(2098*2098 - t*t))))", RooArgSet(t)) ; // Detector response function RooRealVar mg("mg","mg", 0 ) ; RooRealVar sg("sg","sg", 0.03, 0.01, 0.1 ) ; RooGaussian gauss("gauss","gauss",t, mg, sg) ; //t.setBins(100) ; RooFFTConvPdf lxg("lxg","landau (X) gauss",t, *myPdf, gauss) ; RooDataSet* data = lxg.generate(t,10000) ; RooPlot* frame = t.frame() ; data->plotOn(frame) ; myPdf->plotOn(frame,LineStyle(kDashed), LineColor(kRed), Normalization(1.0)); lxg.plotOn(frame, Normalization(1.0)); frame->Draw(); }