Shifting with RooFormulaVar distorts line shape

Hi everybody,
I have already posted this question in a fairly old thread but since the one did not even belong to me and was from 2013, I thought it might be a good idea to start a new topic in order to not mix to many topics in one thread.
I have a RooHistPdf made from a histogram and want to shift this along the x-axis. Thus (with the help of you) I used RooFormulaVar in order to shift the pdf, which works in the sense that the pdf is shifted. But sadly the result is much distorted and does not really look like the original pdf. The following pictures show my problem:


This is my code to produce the images:

RooRealVar mass("Mass","Missing Mass",0,2000);
RooPlot * Massframe = mass.frame(Title(TString("Missing Mass")));
TFile * g=TFile::Open("../Data/KPlusSigmaStar.root");
TString * HistPost = new TString("FittedTrack_BeamEnergyVsMissingMassKaonPlusBE");
TH2 * HistSigStar2 = (TH2*) g->FindObjectAny(*HistPost);

TH1 * HistSigStar = (TH1*) HistSigStar2->ProjectionX(TString("SigStar_"),1,119)->Rebin(5,0);
RooRealVar shiftSigStar("shiftSigStar","Shift of SigStar",100.0,-1000,1000.0);
RooFormulaVar MassShifted("MassShift","Mass + shiftSigStar",RooArgList(mass,shiftSigStar));
RooDataHist SimSigStar("SimSigStar","Simulation of SigStar",mass,Import(*(HistSigStar)));
RooHistPdf * CurveSigStar = new RooHistPdf("CurveSigStar","Kurve SigStar",MassShifted,mass,SimSigStar);
RooHistPdf * CurveSigStarNorm = new RooHistPdf("CurveSigStar","Kurve SigStar",mass,SimSigStar);
CurveSigStar->plotOn(Massframe);
CurveSigStar->paramOn(Massframe);
CurveSigStarNorm->plotOn(Massframe, LineColor(kRed));
CurveSigStarNorm->paramOn(Massframe);
Massframe->Draw();

If anyone has experience with RooFormulaVar it would be nice if he could help.
Thanks,
Emil

Maybe @jonas or @moneta can help with this

Hi all,
I am still struggling with this problem. Now it affects me even more as I want to fit the shifted shape. I do not understand anything that’s happening, but out of 5 PDFs only one gets fitted (I added them after shifting with RooAddPdf). And still everything is distorted. Has anyone any idea or is there any further information I could give you in order to help me?
Thanks,
Emil

Let’s see if @moneta can help

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.