-
Notifications
You must be signed in to change notification settings - Fork 393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PDFs for B2G-23-008 analysis #876
base: main
Are you sure you want to change the base?
Conversation
Hello @anmalara! I have tome questions and suggestions about this: why not use
Maybe an alternative approach to this could be to simply define a header with free inlined functions to use in RooGenericPdfs? That would be a slimmer and more future-proof solution, and it could even be inspected by compiler plugins for automatic differentiation like Clad because it's in the headers. E.g.: #ifndef customPdfs_h
#define customPdfs_h
inline double expGaussExp(double x, double p0, double p1, double p2, double p3)
{
Double_t std=(x-p0)/p1;
Double_t result=0;
if (std<-p2){
result=exp(p2*p2/2.+p2*std);
} else if (-p2<=std && std<p3){
result=exp(-0.5*pow(std, 2));
} else {
result=exp(p3*p3/2.-p3*std);
}
return result;
}
#endif // customPdfs_h Then it could be used like this C++: #include <TInterpreter.h>
#include <RooGenericPdf.h>
#include <RooRealVar.h>
#include <RooWorkspace.h>
void initCustomPdfs()
{
static bool hasInit = false;
if(hasInit) return;
gInterpreter->ProcessLine("#include \"customPdfs.h\"");
hasInit = true;
}
auto expGaussExpFormula = "expGaussExp(x[0], x[1], x[2], x[3], x[4])";
void example()
{
initCustomPdfs();
RooRealVar x{"x", "x", 1.0, 0.0, 10.0};
RooRealVar p0{"p0", "p0", 1.0, 0.0, 10.0};
RooRealVar p1{"p1", "p1", 1.0, 0.0, 10.0};
RooRealVar p2{"p2", "p2", 1.0, 0.0, 10.0};
RooRealVar p3{"p3", "p3", 1.0, 0.0, 10.0};
RooGenericPdf expGaussExp{"expGaussExp", expGaussExpFormula, {x, p0, p1, p2, p3}};
expGaussExp.Print();
} That would at least be my suggestion from my role as the RooFit maintainer :) In ROOT, we put quite a bit an emphasis on the interfaces where users pass string formulas, because that just very flexible (see also RDataFrame). Sorry for chiming in as a non-CMS member, but I think it's important to know there are superior and more maintainable alternatives. I'm also very much welcoming other ideas and suggestions on how to make the |
Hi @guitargeek, thanks for your feedback. I agree with the idea of having simplified code. I wasn't aware of the method you suggested. I think I have a compiled version with the changes you suggested for all functions. I cannot test if it actually works because the workspaces I had used the old class definition. This will take longer to check since I would need to recreate them first. |
hi @guitargeek, sorry to go back to this only now. Thanks,
|
Hi! I can really recommend updating ROOT here. The 6.14 series is from 2018, which is quite old, and the problem is fixed since ROOT 6.20. In the combine docs, the recommended environment is CMSSW_11_3_4, which comes with ROOT 6.22.09. What is the specific reason for using the much older environment? By the way, also according to the combine docs, the previously recommended CMSSW version was CMSSW_10_2_X with combine v8, which used ROOT 6.12.07. So also given the fact that you are using a ROOT version that combine doesn't support explicitly, it would probably be very good to upgrade ROOT. |
Hi @guitargeek, Thanks for looking into it. I see the problem. Although I see the point of moving to the latest recommended version, this would require some extra work needed in my workflow to update to these different releases. I'd prefer to not move at this stage of my analysis (unblinded already). Maybe @anigamova have some suggestions since I'd like to have a working setup in the next release. |
No description provided.