cms-analysis / CombineHarvester

CMSSW package for the creation, editing and analysis of combine datacards and workspaces
cms-analysis.github.io/CombineHarvester/
15 stars 180 forks source link

Setting the wrong nominal mass point while performing a fit with morphing #187

Open greyxray opened 5 years ago

greyxray commented 5 years ago

Hi!

The nominal mass point gets an unexpected value when calling BuildRooMorphing with the file parameter, for example when creating the workspace and datacards including:

...
RooRealVar scannedParameter("scannedParameter", "scannedParameter", -4.0, 18.0);
RooWorkspace ws("htt", "htt");
ch::CombineHarvester cb;
...
string b = cb.cp().channel({channel}).bin_set().at(0);
string p = cb.cp().bin({b}).signals().process_set().at(0);
TFile debug('debug.root', "RECREATE");
ch::BuildRooMorphing(ws, cb, b, p, scannedParameter, "norm", true, true, false, debug);
...

and calling then FitDiagnostics and PostFitShapesFromWorkspace to have a look on the pre/postfits one gets as a prefit the plot that corresponds to scannedParameter=18 in this example, so to the last value set in RooRealVar. My colleague pointed me that the actual reason for this is the way the RooRealVar is handed along in the Morphing process (as a pointer) and the fact that its value gets modified when writing the debug file. One can come around it by not using the file parameter, not by using the --setParameters option. I believe it's not a wanted behaviour?

Thank you for your assistence!

Best regards, Olena