-
Notifications
You must be signed in to change notification settings - Fork 182
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
Add 2D plotting script PostFit2DShapesFromWorkspace.cpp #327
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
The code introduces a lot of duplication, which is not ideal. That said, it can be merged pending a number of issues (see the code comments for details).
std::string var_name_y; | ||
if (data_obj) { | ||
var_name = data_obj->get()->first()->GetName(); | ||
RooArgSet* temp_vars = (RooArgSet*)data_obj->get()->Clone(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we own the memory for temp_vars
here? Need a delete
somewhere?
CombineTools/src/CombineHarvester.cc
Outdated
RooArgSet* temp_vars = (RooArgSet*)data_obj->get()->Clone(); | ||
RooAbsArg* temp_xvar = data_obj->get()->first(); | ||
temp_vars->remove(*temp_xvar,true,true); | ||
var_name_y = temp_vars->first()->GetName(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we not need to check the data object actually has two observables first? Won't this crash if we only have one?
CombineTools/src/CombineHarvester.cc
Outdated
entry->set_observable( | ||
(RooRealVar*)entry->pdf()->findServer(var_name.c_str())); | ||
} | ||
entry->set_observable_y( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, surely we only want to call this if there is a 2nd observables?
@@ -79,6 +84,7 @@ class Process : public Object { | |||
RooAbsData* data_; | |||
RooAbsReal* norm_; | |||
RooRealVar* cached_obs_; | |||
RooRealVar* cached_obsy_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Process.cc, need to handle this new data member correctly in all constructors, assignment and swap methods.
std::string var_name_y = "CMS_th1y"; | ||
if (data_obj) { | ||
var_name = data_obj->get()->first()->GetName(); | ||
RooArgSet* temp_vars = (RooArgSet*)data_obj->get()->Clone(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check memory ownership of cloned object
Thank you for the review @ajgilbert |
Thanks, I think you could run on any set of 1D cards. For example there are some in the tutorials section: https://github.com/cms-analysis/HiggsAnalysis-CombinedLimit/tree/main/data/tutorials/htt/125 |
I ran the following:
where the datacard_part2.txt is slightly changed from the one in Combine repository tutorial. The output plots look reasonable. I'm attaching the datacard and a screenshot of one of the output plots (cannot upload .root files here) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented the requested changes:
- add a flag to ensure that we run 2D part of the code only if we have more than one observables
- delete temporarily needed objects
- update Process.cc to properly handle new class members
🎉 Thanks for getting this over the line @mroguljic and @ajgilbert! And glad to see it's still providing value 😄 |
Resurrection of this PR. I just checked that it compiles on el9.
@ajgilbert your comment on code duplication still stands, but it has been some time since the linked PR and I'm not sure if these functionalities have been added.