Skip to content

Commit

Permalink
Merge pull request #283 from smonig/UseMCstatWithTauFW
Browse files Browse the repository at this point in the history
Use m cstat with tau fw
  • Loading branch information
ajgilbert authored Oct 21, 2022
2 parents 84ebbde + e62468c commit 128e41e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CombinePdfs/interface/Python.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
#include "boost/python/type_id.hpp"
#include "TPython.h"
#include "CombineHarvester/CombinePdfs/interface/MorphFunctions.h"
#include "CombineHarvester/CombinePdfs/interface/CMSHistFuncFactory.h"

namespace bp = boost::python;

void BuildRooMorphingPy(bp::object & ws, ch::CombineHarvester& cb,
std::string const& bin, std::string const& process,
bp::object & mass_var, std::string norm_postfix,
bool allow_morph, bool verbose, bool force_template_limit, bp::object & file);

void BuildCMSHistFuncFactoryPy(bp::object &ws, ch::CombineHarvester& cb, bp::object & mass_var, std::string const& process);
3 changes: 3 additions & 0 deletions CombinePdfs/python/morphing.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@

def BuildRooMorphing(ws, cb, bin, process, mass_var, norm_postfix='norm', allow_morph=True, verbose=False, force_template_limit=False, file=None):
return BuildRooMorphingX(ws, cb, bin, process, mass_var, norm_postfix, allow_morph, verbose, force_template_limit, file)

def BuildCMSHistFuncFactory(ws, cb, mass_vars, process):
return BuildCMSHistFuncFactoryX(ws, cb, mass_vars, process)
2 changes: 1 addition & 1 deletion CombinePdfs/src/CMSHistFuncFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace ch {
3) Remove morphing proc errors
*/

CMSHistFuncFactory::CMSHistFuncFactory() : v_(1), hist_mode_(0), rebin_(true) {}
CMSHistFuncFactory::CMSHistFuncFactory() : v_(1), hist_mode_(0), rebin_(false) {}

void CMSHistFuncFactory::Run(ch::CombineHarvester &cb, RooWorkspace &ws, std::map<std::string, std::string> process_vs_norm_postfix_map) {
for (auto const& bin : cb.bin_set()) {
Expand Down
12 changes: 12 additions & 0 deletions CombinePdfs/src/Python.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "CombineHarvester/CombinePdfs/interface/Python.h"
#include "CombineHarvester/CombinePdfs/interface/MorphFunctions.h"
#include "CombineHarvester/CombinePdfs/interface/CMSHistFuncFactory.h"
#include "boost/python.hpp"
#include "TFile.h"
namespace py = boost::python;
Expand All @@ -18,7 +19,18 @@ void BuildRooMorphingPy(bp::object & ws, ch::CombineHarvester& cb,
BuildRooMorphing(*ws_, cb, bin, process, *mass_var_, norm_postfix, allow_morph, verbose, force_template_limit, file_);
}


void BuildCMSHistFuncFactoryPy(bp::object &ws, ch::CombineHarvester& cb, bp::object &mass_var, std::string const& process){
RooWorkspace *ws_ = (RooWorkspace*)(TPython::ObjectProxy_AsVoidPtr(ws.ptr()));
RooAbsReal *mass_var_ = (RooAbsReal*)(TPython::ObjectProxy_AsVoidPtr(mass_var.ptr()));
ch::CMSHistFuncFactory f;
std::map<std::string, RooAbsReal*> morphVars = {{process, mass_var_}};
f.SetHorizontalMorphingVariable(morphVars);
f.Run(cb, *ws_);
}

BOOST_PYTHON_MODULE(libCombineHarvesterCombinePdfs)
{
py::def("BuildRooMorphingX", BuildRooMorphingPy);
py::def("BuildCMSHistFuncFactoryX", BuildCMSHistFuncFactoryPy);
}

0 comments on commit 128e41e

Please sign in to comment.