Sorry, posted in the wrong place. Here’s my “shortest” working example. I was worried to make it too short as something I deleted might be the cause of the memory leak.
{
TTree::SetMaxTreeSize(1000*Long64_t(2000000000));
TFile fq("./small.root");
gSystem->Load("libRooFit.so");
using namespace RooFit;
bool fitbackground = 1;
bool fitsignal = 1;
int numbins = 50;
double d0MassLo = 1.6;
double d0MassHi = 2;
TTree *txCCBar = (TTree*)fq.Get("ccbar");
TTree *txGammaGamma = (TTree*)fq.Get("gammagamma");
TTree *txUDS = (TTree*)fq.Get("uds");
TTree *txBpBm = (TTree*)fq.Get("bpbm");
TTree *txB0B0Bar = (TTree*)fq.Get("b0b0");
TTree *txPi0Pi0 = fq.Get("pi0pi0");
double gamma1PCmsLo = 0.943729679441;
double gamma2PCmsLo = 0.943729679441;
double dStarPCmsLo = 2.78559034799;
double pi0VetoLo = 0.1;
float delMassLo = 0.14390083456;
float delMassHi = 0.14659593506;
int nGammaGammaCreated = 387000;
float nDStard0Pi = 386760000;
RooRealVar d0Mass("d0Mass", "D^{0} Mass", d0MassLo, d0MassHi, "GeV/c^{2}");
RooRealVar delMass("delMass", "M(D^{*+}) - M(D^{0})", 0.139, 0.160, "GeV/c^{2}");
RooRealVar gamma1PCms("gamma1PCms", "P_{CMS}(#gamma_{1})", gamma1PCmsLo, 6., "GeV/c");
RooRealVar gamma2PCms("gamma2PCms", "P_{CMS}(#gamma_{2})", gamma2PCmsLo, 6., "GeV/c");
RooRealVar dStarPCms("dStarPCms", "P_{CMS}(D^{*+})", dStarPCmsLo, 6., "GeV/c");
RooRealVar decayFlag3("decayFlag3", "decayFlag3", -1, 2**30);
RooRealVar pi0background("pi0background", "pi0background", -pi0VetoLo, +pi0VetoLo);
RooRealVar newweight("newweight", "newweight", -1, 2);
RooArgList lsBase(d0Mass, delMass, gamma1PCms, gamma2PCms, dStarPCms, pi0background, decayFlag3, newweight);
newweight = 1;
RooDataSet dsGammaGammaAll("dsGammaGammaAll", "dsGammaGammaAll", txGammaGamma, lsBase);
newweight = 0.585519;
RooDataSet dsCCBarAll("dsCCBarAll", "dsCCBarAll", txCCBar, lsBase);
// dsCCBarAll->addColumn(newweight);
newweight = 1.13608;
RooDataSet dsUDSAll("dsUDSAll", "dsUDSAll", txUDS, lsBase);
// dsUDSAll->addColumn(newweight);
newweight = 0.367369;
RooDataSet dsBpBmAll("dsBpBmAll", "dsBpBmAll", txBpBm, lsBase);
// dsBpBmAll->addColumn(newweight);
newweight = 0.366357;
RooDataSet dsB0B0BarAll("dsB0B0BarAll", "dsB0B0BarAll", txB0B0Bar, lsBase);
// dsB0B0BarAll->addColumn(newweight);
newweight = 0.390763;
RooDataSet dsPi0Pi0All("dsPi0Pi0All", "dsPi0Pi0All", txPi0Pi0, lsBase);
// dsPi0Pi0All->addColumn(newweight);
TString strCutdelMass;
strCutdelMass.Form("(delMass > %f) && (delMass < %f)", delMassLo, delMassHi);
TString ccbarCut;
ccbarCut.Form("%s && !((decayFlag3 & 2**11) == 2**11)", strCutdelMass.Data());
RooDataSet *dxGammaGamma_d0Fit = dsGammaGammaAll.reduce(strCutdelMass);
RooDataSet *dxCCBar_d0Fit = dsCCBarAll.reduce(ccbarCut);
RooDataSet *dxUDS_d0Fit = dsUDSAll.reduce(strCutdelMass);
RooDataSet *dxBpBm_d0Fit = dsBpBmAll.reduce(strCutdelMass);
RooDataSet *dxB0B0Bar_d0Fit = dsB0B0BarAll.reduce(strCutdelMass);
RooDataSet *dxPi0Pi0_d0Fit = dsPi0Pi0All.reduce(strCutdelMass);
int nEvents = dxGammaGamma_d0Fit->numEntries();
cout << "number of signal events" << nEvents << endl;
TRandom3 rand;
RooDataSet *GammaGammaSmall = new RooDataSet("GammaGammaSmall", "GammaGammaSmall", lsBase);
for(Int_t i=0; i<100; i++){
double random_number = rand.Rndm();
int randevent = random_number*(dsGammaGammaAll.numEntries()) + 0.5;
RooArgSet *row = dsGammaGammaAll.get(randevent);
GammaGammaSmall.add(*row);
}
if(fitsignal){
d0Mass.setBins(numbins);
//crystal ball
RooRealVar muGG_d0Mass("muGG_d0Mass", "muGG_d0Mass", 1.853, 1.80, 1.92);
RooRealVar sigGG_d0Mass("sigGG_d0Mass", "sigGG_d0Mass", 0.032, 0.001, 0.1);
RooRealVar alphaGG_d0Mass("alphaGG_d0Mass", "alphaGG_d0Mass", 0.8, -5., 5.);
RooRealVar nGG_d0Mass("nGG_d0Mass", "nGG_d0Mass", 9, -5, 50);
RooCBShape cbGG_d0Mass("cbGG_d0Mass", "cbGG_d0Mass", d0Mass, muGG_d0Mass, sigGG_d0Mass, alphaGG_d0Mass, nGG_d0Mass);
//polynominal background
RooRealVar flatGG_d0Mass1("flatGG_d0Mass1", "flatGG_d0Mass1", 0.5, -5, 5);
RooRealVar flatGG_d0Mass2("flatGG_d0Mass2", "flatGG_d0Mass2", 0.5, -5, 5);
RooRealVar flatGG_d0Mass3("flatGG_d0Mass3", "flatGG_d0Mass3", 0.5, -5, 5);
RooChebychev flatGGBG_d0Mass("flatGGBG_d0Mass", "flatGGBG_d0Mass", d0Mass, RooArgSet(flatGG_d0Mass1, flatGG_d0Mass2, flatGG_d0Mass3));
RooRealVar nSig_d0Mass("nSig_d0Mass", "nSig_d0Mass", 0.9*nEvents, -sqrt(nEvents), nEvents);
RooRealVar nBG_d0Mass("nBG_d0Mass", "nBG_d0Mass", 0.1*nEvents, -sqrt(nEvents), nEvents);
RooAddPdf signal_d0Mass("signal_d0Mass", "signal_d0Mass", RooArgList(cbGG_d0Mass, flatGGBG_d0Mass),
RooArgList(nSig_d0Mass, nBG_d0Mass));
RooAbsCollection* flparams = signal_d0Mass->getParameters(lsBase)->selectByAttrib("Constant",kFALSE) ;
TCanvas *signalPlot_d0Mass = new TCanvas("signalPlot_d0Mass", "signalPlot_d0Mass");
TPad *plotPad = new TPad("plotPad", "plotPad", 0.0, 0.1, 1.0, 1.0);
TPad *residPad = new TPad("residPad", "residePad", 0.0, 0.0, 1.0, 0.1);
plotPad->SetNumber(1);
residPad->SetNumber(2);
plotPad->Draw();
residPad->Draw();
signal_d0Mass.fitTo(*dxGammaGamma_d0Fit, "meh");
RooPlot *pSig_d0Mass = d0Mass.frame();
dxGammaGamma_d0Fit.plotOn(pSig_d0Mass, DataError(RooAbsData::SumW2));
signal_d0Mass.plotOn(pSig_d0Mass,Components(RooArgList(flatGGBG_d0Mass)),LineStyle(kDashed), LineColor(kMagenta));
signal_d0Mass.plotOn(pSig_d0Mass);
Double_t signalchi = pSig_d0Mass->chiSquare();
TPaveText* pbox = new TPaveText(0.68, 0.80, 0.88, 0.88, "BRNDC");
pbox -> AddText(Form("#chi^{2}/%i = %.3f", numbins-(flparams->getSize()), pSig_d0Mass->chiSquare(flparams->getSize())));
pbox -> SetShadowColor(kWhite);
pbox -> SetFillColor(kWhite);
pSig_d0Mass -> addObject(pbox);
RooPlot *frame2_sig = d0Mass.frame() ; // same way you made 'frame'
frame2_sig->SetTitle(";;");
frame2_sig->SetTickLength(0);
frame2_sig->SetTickLength(0, "Y");
RooHist *pullhist_sig = pSig_d0Mass->pullHist();
frame2_sig->SetTitle(";;");
TAxis *yaxis_sig = frame2_sig->GetYaxis();
TAxis *xaxis_sig = frame2_sig->GetXaxis();
yaxis_sig->SetNdivisions(0, -1);
xaxis_sig->SetNdivisions(0, -1);
pullhist_sig->SetMarkerSize(2);
pullhist_sig->SetMarkerStyle(1);
frame2_sig->addObject(pullhist_sig, "P");
frame2_sig->SetMinimum(-5);
frame2_sig->SetMaximum(+5);
signalPlot_d0Mass->cd(1);
pSig_d0Mass -> Draw();
signalPlot_d0Mass->cd(2);
frame2_sig->Draw();
}
if(fitbackground){
d0Mass.setBins(numbins);
int nPi0Events = dsPi0Pi0All.numEntries();
//D -> pi0pi0
RooRealVar muPP_d0Mass("muPP_d0Mass", "muPP_d0Mass", 1.765, 1.60, 1.92);
RooRealVar sigPP_d0Mass("sigPP_d0Mass", "sigPP_d0Mass", 0.01, 0.001, 0.1);
RooRealVar alphaPP_d0Mass("alphaPP_d0Mass", "alphaPP_d0Mass", 1.0, 0.01, 3.0);
RooRealVar nPP_d0Mass("nPP_d0Mass", "nPP_d0Mass", 1, -1, 4);
RooCBShape cbPP_d0Mass("cbPP_d0Mass", "cbPP_d0Mass", d0Mass, muPP_d0Mass, sigPP_d0Mass, alphaPP_d0Mass, nPP_d0Mass);
RooRealVar flatPP_d0Mass1("flatPP_d0Mass1", "flatPP_d0Mass1", 0.5, -5, 5);
RooRealVar flatPP_d0Mass2("flatPP_d0Mass2", "flatPP_d0Mass2", 0.5, -5, 5);
RooRealVar flatPP_d0Mass3("flatPP_d0Mass3", "flatPP_d0Mass3", 0.5, -5, 5);
RooChebychev flatBGPP_d0Mass("flatBGPP_d0Mass", "flatBGPP_d0Mass", d0Mass, RooArgList(flatPP_d0Mass1,flatPP_d0Mass2));
RooRealVar nPi0BG_d0Mass("nPi0BG_d0Mass", "nPi0BG_d0Mass", 0.9*nPi0Events, -sqrt(nPi0Events), nPi0Events);
RooRealVar nBGPP_d0Mass("nBGPP_d0Mass", "nBGPP_d0Mass", 0.1*nPi0Events, -sqrt(nPi0Events), nPi0Events);
RooAddPdf pi0BG_d0Mass("pi0BG_d0Mass", "pi0BG_d0Mass", RooArgList(cbPP_d0Mass, flatBGPP_d0Mass), RooArgList(nPi0BG_d0Mass, nBGPP_d0Mass));
RooAbsCollection* flparams = pi0BG_d0Mass->getParameters(lsBase)->selectByAttrib("Constant",kFALSE);
TCanvas *pi0BGPlot_d0Mass = new TCanvas("pi0BGPlot_d0Mass", "pi0BGPlot_d0Mass");
TPad *plotPad = new TPad("plotPad", "plotPad", 0.0, 0.1, 1.0, 1.0);
TPad *residPad = new TPad("residPad", "residePad", 0.0, 0.0, 1.0, 0.1);
plotPad->SetNumber(1);
residPad->SetNumber(2);
plotPad->Draw();
residPad->Draw();
pi0BG_d0Mass.fitTo(*dxPi0Pi0_d0Fit, "meh");
RooPlot *ppi0_d0Mass = d0Mass.frame();
dxPi0Pi0_d0Fit.plotOn(ppi0_d0Mass, DataError(RooAbsData::SumW2));
pi0BG_d0Mass.plotOn(ppi0_d0Mass,Components(RooArgList(flatBGPP_d0Mass)),LineStyle(kDashed), LineColor(kMagenta));
pi0BG_d0Mass.plotOn(ppi0_d0Mass);
Double_t signalchi = ppi0_d0Mass->chiSquare();
TPaveText* pbox = new TPaveText(0.68, 0.80, 0.88, 0.88, "BRNDC");
pbox -> SetShadowColor(kWhite);
pbox -> SetFillColor(kWhite);
pbox -> AddText(Form("#chi^{2}/%i = %.3f", numbins-(flparams->getSize()), ppi0_d0Mass->chiSquare(flparams->getSize())));
ppi0_d0Mass -> addObject(pbox);
RooPlot* frame2_pi0 = d0Mass.frame() ; // same way you made 'frame'
frame2_pi0->SetTitle(";;");
frame2_pi0->SetTickLength(0);
frame2_pi0->SetTickLength(0, "Y");
RooHist *pullhist_pi0 = ppi0_d0Mass->pullHist();
frame2_pi0->SetTitle(";;");
TAxis *yaxis_pi0 = frame2_pi0->GetYaxis();
TAxis *xaxis_pi0 = frame2_pi0->GetXaxis();
yaxis_pi0->SetNdivisions(0, -1);
xaxis_pi0->SetNdivisions(0, -1);
pullhist_pi0->SetMarkerSize(1);
pullhist_pi0->SetMarkerStyle(1);
frame2_pi0->addObject(pullhist_pi0, "P");
frame2_pi0->SetMinimum(-5);
frame2_pi0->SetMaximum(+5);
pi0BGPlot_d0Mass->cd(1);
ppi0_d0Mass -> Draw();
pi0BGPlot_d0Mass->cd(2);
frame2_pi0->Draw();
dxCCBar_d0Fit->setWeightVar(newweight);
dxUDS_d0Fit->setWeightVar(newweight);
dxBpBm_d0Fit->setWeightVar(newweight);
dxB0B0Bar_d0Fit->setWeightVar(newweight);
dxPi0Pi0_d0Fit->setWeightVar(newweight);
RooDataSet *dxAllBG = new RooDataSet("dxAllBG", "dxAllBG", lsBase);
dxAllBG->append(*dxCCBar_d0Fit);
dxAllBG->append(*dxUDS_d0Fit);
dxAllBG->append(*dxBpBm_d0Fit);
dxAllBG->append(*dxB0B0Bar_d0Fit);
dxAllBG->setWeightVar(newweight);
int nBGEvents = dxAllBG.numEntries();
//polynominal
RooRealVar mCoef("mCoef", "mCoef", -0.4, -1, 1);
RooRealVar qCoef("qCoef", "qCoef", -0.4, -1, 1);
RooArgList coefLs(mCoef, qCoef);
RooChebychev fullBG("fullBG", "fullBG", d0Mass, coefLs);
//SINGLE GAUSSIAN
RooRealVar muGGBG("muGGBG", "muGGBG", 1.85, 1.60, 1.92);
RooRealVar sigGGBG("sigGGBG", "sigGGBG", 0.01, 0.001, 0.1);
RooGaussian cbGGBG("cbGGBG", "cbGGBG", d0Mass, muGGBG, sigGGBG);
RooRealVar npoly("npoly", "npoly", 0.9*nBGEvents, -sqrt(nBGEvents), nBGEvents);
RooRealVar ngaussBG("ngaussBG", "ngaussBG", 0.9*nBGEvents, -sqrt(nBGEvents), nBGEvents);
RooAbsCollection *flparams2 = fullBG.getParameters(lsBase)->selectByAttrib("Constant",kFALSE);
//MAKE STACK:
TH1F *ccbarhisto = new TH1F("ccbarhisto", "ccbarhisto", numbins, d0MassLo, d0MassHi);
TH1F *udshisto = new TH1F("udshisto", "udshisto", numbins, d0MassLo, d0MassHi);
TH1F *bpbmhisto = new TH1F("bpbmhisto", "bpbmhisto", numbins, d0MassLo, d0MassHi);
TH1F *b0b0histo = new TH1F("b0b0histo", "b0b0histo", numbins, d0MassLo, d0MassHi);
TH1F *pi0pi0histo = new TH1F("pi0pi0histo", "pi0pi0histo", numbins, d0MassLo, d0MassHi);
ccbarhisto->SetFillColor(kBlue-10);
udshisto->SetFillColor(kGreen-10);
bpbmhisto->SetFillColor(kCyan-10);
b0b0histo->SetFillColor(kYellow-10);
pi0pi0histo->SetFillColor(kOrange-9);
dxCCBar_d0Fit->fillHistogram(ccbarhisto, d0Mass);
dxUDS_d0Fit->fillHistogram(udshisto, d0Mass);
dxBpBm_d0Fit->fillHistogram(bpbmhisto, d0Mass);
dxB0B0Bar_d0Fit->fillHistogram(b0b0histo, d0Mass);
dxPi0Pi0_d0Fit->fillHistogram(pi0pi0histo, d0Mass);
TCanvas *bgPlot = new TCanvas("bgPlot", "bgPlot");
TPad *plotPad = new TPad("plotPad", "plotPad", 0.0, 0.1, 1.0, 1.0);
TPad *residPad = new TPad("residPad", "residePad", 0.0, 0.0, 1.0, 0.1);
plotPad->SetNumber(1);
residPad->SetNumber(2);
plotPad->Draw();
residPad->Draw();
bgPlot->cd(1);
THStack d;
d.Add(b0b0histo);
d.Add(bpbmhisto);
d.Add(udshisto);
d.Add(ccbarhisto);
// d.Add(pi0pi0histo);
d.Draw("hist");
fullBG.fitTo(*dxAllBG, "mh");
RooPlot *pBG_d0Mass = d0Mass.frame();
dxAllBG->plotOn(pBG_d0Mass, DataError(RooAbsData::SumW2));
fullBG.plotOn(pBG_d0Mass);
Double_t signalchi = pBG_d0Mass->chiSquare();
TPaveText* pbox = new TPaveText(0.68, 0.80, 0.88, 0.88, "BRNDC");
pbox -> SetShadowColor(kWhite);
pbox -> SetFillColor(kWhite);
pbox -> AddText(Form("#chi^{2}/%i = %.3f", numbins-(flparams2->getSize()), pBG_d0Mass->chiSquare(flparams2->getSize())));
pBG_d0Mass -> addObject(pbox);
RooPlot *frame2_bg = d0Mass.frame() ; // same way you made 'frame'
frame2_bg->SetTitle(";;");
frame2_bg->SetTickLength(0);
frame2_bg->SetTickLength(0, "Y");
RooHist *pullhist_bg = pBG_d0Mass->pullHist();
frame2_bg->SetTitle(";;");
TAxis *yaxis_bg = frame2_bg->GetYaxis();
TAxis *xaxis_bg = frame2_bg->GetXaxis();
yaxis_bg->SetNdivisions(0, -1);
xaxis_bg->SetNdivisions(0, -1);
pullhist_bg->SetMarkerSize(1);
pullhist_bg->SetMarkerStyle(1);
frame2_bg->addObject(pullhist_bg, "P");
frame2_bg->SetMinimum(-5);
frame2_bg->SetMaximum(+5);
pBG_d0Mass -> Draw("SAME");
bgPlot->cd(2);
frame2_bg->Draw();
}
if(fitsignal && fitbackground){
RooDataSet *dxNull = new RooDataSet("dxNull", "dxNull", lsBase);
dxNull -> append(*dxCCBar_d0Fit);
dxNull -> append(*dxPi0Pi0_d0Fit);
dxNull -> append(*dxUDS_d0Fit);
dxNull -> append(*dxBpBm_d0Fit);
dxNull -> append(*dxB0B0Bar_d0Fit);
dxNull->append(*GammaGammaSmall);
dxNull->setWeightVar(newweight);
flatGG_d0Mass1.setConstant(kTRUE);
flatGG_d0Mass2.setConstant(kTRUE);
flatGG_d0Mass3.setConstant(kTRUE);
mCoef.setConstant(kTRUE);
muGGBG.setConstant(kTRUE);
muGG_d0Mass.setConstant(kTRUE);
nBG_d0Mass.setConstant(kTRUE);
nSig_d0Mass.setConstant(kTRUE);
nPP_d0Mass.setConstant(kTRUE);
ngaussBG.setConstant(kTRUE);
npoly.setConstant(kTRUE);
qCoef.setConstant(kTRUE);
sigGGBG.setConstant(kTRUE);
sigGG_d0Mass.setConstant(kTRUE);
alphaGG_d0Mass.setConstant(kTRUE);
alphaPP_d0Mass.setConstant(kTRUE);
muPP_d0Mass.setConstant(kTRUE);
nGG_d0Mass.setConstant(kTRUE);
sigPP_d0Mass.setConstant(kTRUE);
int nFullBGEvents = dxNull->numEntries();
int nPi0wcutEvents = dxPi0Pi0_d0Fit->numEntries();
RooRealVar nGammaGamma("nGammaGamma", "nGammaGamma", 0.9*nEvents, -sqrt(nEvents), 1.1*nEvents);
RooRealVar nPi0Pi0("nVPi0", "nVPi0", 0.9*nPi0wcutEvents, -sqrt(nPi0wcutEvents), 1.1*nPi0wcutEvents);
RooRealVar nBG("nBG", "nBG", 0.9*nFullBGEvents, -sqrt(nFullBGEvents), 1.1*nFullBGEvents);
RooAddPdf totald0MassPdf("totald0MassPdf", "totald0MassPdf",
RooArgList(cbGG_d0Mass, cbPP_d0Mass, fullBG),
RooArgList(nGammaGamma, nPi0Pi0, nBG));
RooArgSet *flparams3 = totald0MassPdf->getParameters(lsBase)->selectByAttrib("Constant",kFALSE) ;
//MAKE STACK:
TH1F *gammagammahisto = new TH1F("gammagammahisto", "gammagammahisto", numbins, d0MassLo, d0MassHi);
gammagammahisto->SetFillColor(kMagenta-10);
gammagammahisto->SetLineStyle(1);
gammagammahisto->SetMarkerStyle(1);
GammaGammaSmall->fillHistogram(gammagammahisto, d0Mass);
TCanvas *allPlot_d0Mass = new TCanvas("allPlot_d0Mass", "allPlot_d0Mass");
TPad *plotPad = new TPad("plotPad", "plotPad", 0.0, 0.1, 1.0, 1.0);
TPad *residPad = new TPad("residPad", "residePad", 0.0, 0.0, 1.0, 0.1);
plotPad->SetNumber(1);
residPad->SetNumber(2);
plotPad->Draw();
residPad->Draw();
THStack full;
full.Add(b0b0histo);
full.Add(bpbmhisto);
full.Add(udshisto);
full.Add(ccbarhisto);
full.Add(pi0pi0histo);
full.Add(gammagammahisto);
totald0MassPdf.fitTo(*dxNull, "meh");
//dualgauss.fitTo(*dxNull, "meh");
RooPlot *pAll_d0Mass = d0Mass.frame();
dxNull->plotOn(pAll_d0Mass, DataError(RooAbsData::SumW2));
totald0MassPdf.plotOn(pAll_d0Mass);
Double_t signalchi = pAll_d0Mass->chiSquare();
TPaveText* pbox = new TPaveText(0.68, 0.80, 0.88, 0.88, "BRNDC");
pbox -> SetShadowColor(kWhite);
pbox -> SetFillColor(kWhite);
pbox -> AddText(Form("#chi^{2}/%i = %.3f", numbins-(flparams3->getSize()), pAll_d0Mass->chiSquare(flparams3->getSize())));
pAll_d0Mass -> addObject(pbox);
RooPlot *frame2_full = d0Mass.frame() ; // same way you made 'frame'
frame2_full->SetTitle(";;");
frame2_full->SetTickLength(0);
frame2_full->SetTickLength(0, "Y");
RooHist *pullhist_full = pAll_d0Mass->pullHist();
frame2_full->SetTitle(";;");
TAxis *yaxis_full = frame2_full->GetYaxis();
TAxis *xaxis_full = frame2_full->GetXaxis();
yaxis_full->SetNdivisions(0, -1);
xaxis_full->SetNdivisions(0, -1);
pullhist_full->SetMarkerSize(1);
pullhist_full->SetMarkerStyle(1);
frame2_full->addObject(pullhist_full, "P");
frame2_full->SetMinimum(-5);
frame2_full->SetMaximum(+5);
totald0MassPdf.plotOn(pAll_d0Mass);
totald0MassPdf.plotOn(pAll_d0Mass,Components(RooArgList(fullBG,cbPP_d0Mass)) , LineStyle(kDashed), LineColor(kMagenta));
totald0MassPdf.plotOn(pAll_d0Mass,Components(RooArgList(fullBG)) , LineStyle(kDashed), LineColor(kRed));
totald0MassPdf.paramOn(pAll_d0Mass);
Double_t histomax = full.GetMaximum();
Double_t fitmax = pAll_d0Mass->GetMaximum();
allPlot_d0Mass->cd(1);
if(histomax > fitmax){
full.SetMaximum(histomax);
}
else{
full.SetMaximum(fitmax);
}
full.Draw("hist");
pAll_d0Mass -> Draw("SAME");
allPlot_d0Mass->cd(2);
frame2_full->Draw();
}
}
Please let me know if anything stands out. But I can tell you that if I change the line:
double d0MassLo = 1.7;
to
double d0MassLo = 1.6;
it seems to have less of a problem. Here I am cutting the tail of my fit slightly at 1.7. Could it be that the fit can’t converge which is causing the high CPU/mem usage? It’s strange as this doesn’t cut out much of the fit, I don’t see why it wouldn’t be able to converge.
thanks,
james