How to determine position of maximum of one component of RooFitResult


I fitted a dataset by generating a RooFitResult via .fitTo , in the following way:

RooAddPdf pdfA("pdfA", "pdfA", RooArgList(histpdfMCSignaljPsi, histpdfMCSignalPsi,p2), RooArgList(MCSignalJPsi,MCSignalPsi, MCBkg));
RooFitResult *resultA = (RooFitResult *)pdfA.fitTo(dhData, Save(kTRUE),Range("x"));

Where “histpdfMCSignaljPsi” and “histpdfMCSignalPsi” are RooHistPdfs derived from MC-Simulations, to serve as fit templates… I would now like to determine where “histpdfMCSignaljPsi” and “histpdfMCSignalPsi” peak respectively, to determine the invariant mass of the signals. I am unsure how to go about this, I tried to use things like “->getMaxVal(x);”, but this only gives me a maximum value, not the invariant mass. The other problem is that I can not manage to call it on the fitted signal, only on the “histpdfMCSignalPsi”, which is not what I want…

I would be very thankful if anyone could help me with this.

All the best

If you only need to find the point in which your RooHistPdf has the maximum value, that is exactly the same point in the dataset you used to create that RooHistPdf.
If you just want to get that value directly from RooHistPdf, you can call pdf->dataHist(), which returns a RooDataHist and you can do a scan in bins to find the maximum bin and the corresponding centre value.


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