Skip to content

Commit

Permalink
Merge pull request #191 from gpetruc/74x-root6
Browse files Browse the repository at this point in the history
Fixes to make the code run in ROOT 6.02
  • Loading branch information
gpetruc committed May 13, 2015
2 parents ea2ab5a + d35352f commit 31cc693
Show file tree
Hide file tree
Showing 89 changed files with 407 additions and 379 deletions.
4 changes: 2 additions & 2 deletions interface/Asymptotic.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
*
*
*/
#include "../interface/LimitAlgo.h"
#include "../interface/utils.h"
#include "HiggsAnalysis/CombinedLimit/interface/LimitAlgo.h"
#include "HiggsAnalysis/CombinedLimit/interface/utils.h"
#include <memory>
class RooRealVar;
#include <RooAbsReal.h>
Expand Down
2 changes: 1 addition & 1 deletion interface/AsymptoticNew.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
*/

#include "../interface/LimitAlgo.h"
#include "HiggsAnalysis/CombinedLimit/interface/LimitAlgo.h"
#include <memory>
class RooRealVar;

Expand Down
2 changes: 1 addition & 1 deletion interface/BayesianFlatPrior.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
*
*/
#include "../interface/LimitAlgo.h"
#include "HiggsAnalysis/CombinedLimit/interface/LimitAlgo.h"

class BayesianFlatPrior : public LimitAlgo {
public:
Expand Down
2 changes: 1 addition & 1 deletion interface/BayesianToyMC.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
*
*/
#include "../interface/LimitAlgo.h"
#include "HiggsAnalysis/CombinedLimit/interface/LimitAlgo.h"
class RooArgSet;

class BayesianToyMC : public LimitAlgo {
Expand Down
4 changes: 2 additions & 2 deletions interface/BestFitSigmaTestStat.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class RooMinimizer;
#include <RooAbsData.h>
#include <RooArgSet.h>
#include <RooStats/TestStatistic.h>
#include "../interface/RooSimultaneousOpt.h"
#include "../interface/CachingNLL.h"
#include "HiggsAnalysis/CombinedLimit/interface/RooSimultaneousOpt.h"
#include "HiggsAnalysis/CombinedLimit/interface/CachingNLL.h"

class BestFitSigmaTestStat : public RooStats::TestStatistic {
public:
Expand Down
4 changes: 2 additions & 2 deletions interface/CachingMultiPdf.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef CachingMultiPdf_h
#define CachingMultiPdf_h

#include "../interface/RooMultiPdf.h"
#include "../interface/CachingNLL.h"
#include "HiggsAnalysis/CombinedLimit/interface/RooMultiPdf.h"
#include "HiggsAnalysis/CombinedLimit/interface/CachingNLL.h"
#include <RooAbsData.h>
#include <RooAddPdf.h>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion interface/CachingNLL.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <RooSimultaneous.h>
#include <RooGaussian.h>
#include <RooProduct.h>
#include "../interface/SimpleGaussianConstraint.h"
#include "HiggsAnalysis/CombinedLimit/interface/SimpleGaussianConstraint.h"
#include <boost/ptr_container/ptr_vector.hpp>

class RooMultiPdf;
Expand Down
2 changes: 1 addition & 1 deletion interface/CascadeMinimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class RooRealVar;
#include <RooArgSet.h>
#include <RooListProxy.h>
#include <RooSetProxy.h>
#include "../interface/RooMinimizerOpt.h"
#include "HiggsAnalysis/CombinedLimit/interface/RooMinimizerOpt.h"
#include <boost/program_options.hpp>

class CascadeMinimizer {
Expand Down
2 changes: 1 addition & 1 deletion interface/ChannelCompatibilityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
*
*/
#include "../interface/FitterAlgoBase.h"
#include "HiggsAnalysis/CombinedLimit/interface/FitterAlgoBase.h"

class ChannelCompatibilityCheck : public FitterAlgoBase {
public:
Expand Down
4 changes: 2 additions & 2 deletions interface/FitterAlgoBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
*
*
*/
#include "../interface/LimitAlgo.h"
#include "../interface/ProfileLikelihood.h"
#include "HiggsAnalysis/CombinedLimit/interface/LimitAlgo.h"
#include "HiggsAnalysis/CombinedLimit/interface/ProfileLikelihood.h"
class RooFitResult;
class RooMinimizer;
class RooCmdArg;
Expand Down
2 changes: 1 addition & 1 deletion interface/GenerateOnly.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
*
*/
#include "../interface/LimitAlgo.h"
#include "HiggsAnalysis/CombinedLimit/interface/LimitAlgo.h"

class RooAbsPdf; class RooRealVar; class RooAbsData; class RooArgSet;

Expand Down
4 changes: 2 additions & 2 deletions interface/GoodnessOfFit.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
*
*
*/
#include "../interface/LimitAlgo.h"
#include "../interface/ProfileLikelihood.h"
#include "HiggsAnalysis/CombinedLimit/interface/LimitAlgo.h"
#include "HiggsAnalysis/CombinedLimit/interface/ProfileLikelihood.h"

class GoodnessOfFit : public LimitAlgo {
public:
Expand Down
2 changes: 1 addition & 1 deletion interface/HybridNew.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
*
*/
#include "../interface/LimitAlgo.h"
#include "HiggsAnalysis/CombinedLimit/interface/LimitAlgo.h"
#include <algorithm>
#include <RooStats/ModelConfig.h>
#include <RooStats/HybridCalculator.h>
Expand Down
2 changes: 1 addition & 1 deletion interface/MarkovChainMC.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
*
*/
#include "../interface/LimitAlgo.h"
#include "HiggsAnalysis/CombinedLimit/interface/LimitAlgo.h"
#include <TList.h>
class RooArgSet;
namespace RooStats { class MarkovChain; }
Expand Down
2 changes: 1 addition & 1 deletion interface/MaxLikelihoodFit.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
*
*/
#include "../interface/FitterAlgoBase.h"
#include "HiggsAnalysis/CombinedLimit/interface/FitterAlgoBase.h"
#include <TTree.h>
#include <RooArgList.h>
#include <RooFitResult.h>
Expand Down
2 changes: 1 addition & 1 deletion interface/MultiDimFit.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
*
*/
#include "../interface/FitterAlgoBase.h"
#include "HiggsAnalysis/CombinedLimit/interface/FitterAlgoBase.h"
#include <RooRealVar.h>
#include <vector>

Expand Down
2 changes: 1 addition & 1 deletion interface/ProfileLikelihood.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
*
*/
#include "../interface/LimitAlgo.h"
#include "HiggsAnalysis/CombinedLimit/interface/LimitAlgo.h"

class RooAbsPdf; class RooRealVar; class RooAbsData; class RooArgSet;

Expand Down
4 changes: 2 additions & 2 deletions interface/ProfiledLikelihoodRatioTestStatExt.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class RooMinimizerOpt;
#include <RooAbsData.h>
#include <RooArgSet.h>
#include <RooStats/TestStatistic.h>
#include "../interface/RooSimultaneousOpt.h"
#include "../interface/CachingNLL.h"
#include "HiggsAnalysis/CombinedLimit/interface/RooSimultaneousOpt.h"
#include "HiggsAnalysis/CombinedLimit/interface/CachingNLL.h"

namespace nllutils {
bool robustMinimize(RooAbsReal &nll, RooMinimizerOpt &minimizer, int verbosity=0, bool zeroPoint=false);
Expand Down
2 changes: 1 addition & 1 deletion interface/VectorizedSimplePdfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <RooExponential.h>
#include <RooAbsData.h>
#include "../interface/HGGRooPdfs.h"
#include "HiggsAnalysis/CombinedLimit/interface/HGGRooPdfs.h"
#include <vector>

class VectorizedExponential {
Expand Down
4 changes: 2 additions & 2 deletions interface/VerticalInterpHistPdf.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include "RooRealProxy.h"
#include "RooListProxy.h"
#include "TH1.h"
#include "../interface/SimpleCacheSentry.h"
#include "../interface/FastTemplate.h"
#include "HiggsAnalysis/CombinedLimit/interface/SimpleCacheSentry.h"
#include "HiggsAnalysis/CombinedLimit/interface/FastTemplate.h"
#include <cmath>

class FastVerticalInterpHistPdf;
Expand Down
20 changes: 19 additions & 1 deletion python/ModelTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@
ROOFIT_EXPR = "expr"
ROOFIT_EXPR_PDF = "EXPR"

class SafeWorkspaceImporter():
"""Class that provides the RooWorkspace::import method, but makes sure we call the proper
overload of it, since in ROOT 6 sometimes PyROOT calls the wrong one"""
def __init__(self,wsp):
self.wsp = wsp
self.imp = getattr(wsp,"import")
def __call__(self,*args):
if len(args) != 1:
self.imp(*args)
elif args[0].Class().InheritsFrom("RooAbsReal") or args[0].Class().InheritsFrom("RooArgSet") or args[0].Class().InheritsFrom("RooAbsData"):
self.imp(args[0], ROOT.RooCmdArg()) # force the proper overload to be called
else:
self.imp(*args)

class ModelBuilderBase():
"""This class defines the basic stuff for a model builder, and it's an interface on top of RooWorkspace::factory or HLF files"""
def __init__(self,options):
Expand All @@ -17,7 +31,8 @@ def __init__(self,options):
ROOT.gSystem.Load("libHiggsAnalysisCombinedLimit")
ROOT.TH1.AddDirectory(False)
self.out = ROOT.RooWorkspace("w","w");
self.out._import = getattr(self.out,"import") # workaround: import is a python keyword
#self.out._import = getattr(self.out,"import") # workaround: import is a python keyword
self.out._import = SafeWorkspaceImporter(self.out)
self.out.dont_delete = []
if options.verbose == 0:
ROOT.RooMsgService.instance().setGlobalKillBelow(ROOT.RooFit.ERROR)
Expand All @@ -34,10 +49,13 @@ def __init__(self,options):
global ROOFIT_EXPR;
ROOFIT_EXPR = "cexpr"
def factory_(self,X):
if self.options.verbose >= 7:
print "RooWorkspace::factory('%s')" % X
if (len(X) > 1000):
print "Executing factory with a string of length ",len(X)," > 1000, could trigger a bug: ",X
ret = self.out.factory(X);
if ret:
if self.options.verbose >= 7: print " ---> ",ret
self.out.dont_delete.append(ret)
return ret
else:
Expand Down
10 changes: 5 additions & 5 deletions src/AsimovUtils.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../interface/AsimovUtils.h"
#include "HiggsAnalysis/CombinedLimit/interface/AsimovUtils.h"

#include <memory>
#include <stdexcept>
Expand All @@ -7,10 +7,10 @@
#include <RooArgSet.h>
#include <RooProdPdf.h>
#include <RooUniform.h>
#include "../interface/utils.h"
#include "../interface/ToyMCSamplerOpt.h"
#include "../interface/CloseCoutSentry.h"
#include "../interface/CascadeMinimizer.h"
#include "HiggsAnalysis/CombinedLimit/interface/utils.h"
#include "HiggsAnalysis/CombinedLimit/interface/ToyMCSamplerOpt.h"
#include "HiggsAnalysis/CombinedLimit/interface/CloseCoutSentry.h"
#include "HiggsAnalysis/CombinedLimit/interface/CascadeMinimizer.h"

RooAbsData *asimovutils::asimovDatasetNominal(RooStats::ModelConfig *mc, double poiValue, int verbose) {
RooArgSet poi(*mc->GetParametersOfInterest());
Expand Down
2 changes: 1 addition & 1 deletion src/AsymPow.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../interface/AsymPow.h"
#include "HiggsAnalysis/CombinedLimit/interface/AsymPow.h"

#include <cmath>
#include <cassert>
Expand Down
20 changes: 10 additions & 10 deletions src/Asymptotic.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <stdexcept>

#include "../interface/Asymptotic.h"
#include "HiggsAnalysis/CombinedLimit/interface/Asymptotic.h"
#include <RooRealVar.h>
#include <RooArgSet.h>
#include <RooAbsPdf.h>
Expand All @@ -9,15 +9,15 @@
#include <RooCategory.h>
#include <RooStats/ModelConfig.h>
#include <Math/DistFuncMathCore.h>
#include "../interface/Combine.h"
#include "../interface/CloseCoutSentry.h"
#include "../interface/RooFitGlobalKillSentry.h"
#include "../interface/ProfiledLikelihoodRatioTestStatExt.h"
#include "../interface/ToyMCSamplerOpt.h"
#include "../interface/ProfileLikelihood.h"
#include "../interface/CascadeMinimizer.h"
#include "../interface/utils.h"
#include "../interface/AsimovUtils.h"
#include "HiggsAnalysis/CombinedLimit/interface/Combine.h"
#include "HiggsAnalysis/CombinedLimit/interface/CloseCoutSentry.h"
#include "HiggsAnalysis/CombinedLimit/interface/RooFitGlobalKillSentry.h"
#include "HiggsAnalysis/CombinedLimit/interface/ProfiledLikelihoodRatioTestStatExt.h"
#include "HiggsAnalysis/CombinedLimit/interface/ToyMCSamplerOpt.h"
#include "HiggsAnalysis/CombinedLimit/interface/ProfileLikelihood.h"
#include "HiggsAnalysis/CombinedLimit/interface/CascadeMinimizer.h"
#include "HiggsAnalysis/CombinedLimit/interface/utils.h"
#include "HiggsAnalysis/CombinedLimit/interface/AsimovUtils.h"

#include <boost/bind.hpp>

Expand Down
12 changes: 6 additions & 6 deletions src/AsymptoticNew.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
#include <RooStats/HypoTestInverter.h>
#include <RooStats/HypoTestInverterResult.h>
#include "RooStats/AsymptoticCalculator.h"
#include "../interface/AsymptoticNew.h"
#include "../interface/Combine.h"
#include "../interface/CloseCoutSentry.h"
#include "../interface/RooFitGlobalKillSentry.h"
#include "../interface/ProfiledLikelihoodRatioTestStatExt.h"
#include "../interface/utils.h"
#include "HiggsAnalysis/CombinedLimit/interface/AsymptoticNew.h"
#include "HiggsAnalysis/CombinedLimit/interface/Combine.h"
#include "HiggsAnalysis/CombinedLimit/interface/CloseCoutSentry.h"
#include "HiggsAnalysis/CombinedLimit/interface/RooFitGlobalKillSentry.h"
#include "HiggsAnalysis/CombinedLimit/interface/ProfiledLikelihoodRatioTestStatExt.h"
#include "HiggsAnalysis/CombinedLimit/interface/utils.h"

using namespace RooStats;

Expand Down
2 changes: 1 addition & 1 deletion src/AtlasPdfs.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ END_HTML
#include "RooMsgService.h"
#include "TMath.h"

#include "../interface/AtlasPdfs.h"
#include "HiggsAnalysis/CombinedLimit/interface/AtlasPdfs.h"

ClassImp(RooStats::HistFactory::RooBSplineBases)

Expand Down
4 changes: 2 additions & 2 deletions src/BayesianFlatPrior.cc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include <stdexcept>
#include "../interface/BayesianFlatPrior.h"
#include "HiggsAnalysis/CombinedLimit/interface/BayesianFlatPrior.h"
#include "RooRealVar.h"
#include "RooArgSet.h"
#include "RooUniform.h"
#include "RooWorkspace.h"
#include "RooPlot.h"
#include "TCanvas.h"
#include "../interface/Combine.h"
#include "HiggsAnalysis/CombinedLimit/interface/Combine.h"
#include "RooStats/BayesianCalculator.h"
#include "RooStats/SimpleInterval.h"
#include "RooStats/ModelConfig.h"
Expand Down
8 changes: 4 additions & 4 deletions src/BayesianToyMC.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <stdexcept>
#include <cmath>
#include "../interface/BayesianToyMC.h"
#include "HiggsAnalysis/CombinedLimit/interface/BayesianToyMC.h"
#include "RooRealVar.h"
#include "RooArgSet.h"
#include "RooUniform.h"
Expand All @@ -13,9 +13,9 @@
#include "RooStats/RooStatsUtils.h"
#include <Math/DistFuncMathCore.h>

#include "../interface/Combine.h"
#include "../interface/CachingNLL.h"
#include "../interface/utils.h"
#include "HiggsAnalysis/CombinedLimit/interface/Combine.h"
#include "HiggsAnalysis/CombinedLimit/interface/CachingNLL.h"
#include "HiggsAnalysis/CombinedLimit/interface/utils.h"

using namespace RooStats;

Expand Down
14 changes: 7 additions & 7 deletions src/BestFitSigmaTestStat.cc
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#include "../interface/ProfiledLikelihoodRatioTestStatExt.h"
#include "../interface/BestFitSigmaTestStat.h"
#include "../interface/CascadeMinimizer.h"
#include "../interface/CloseCoutSentry.h"
#include "../interface/utils.h"
#include "HiggsAnalysis/CombinedLimit/interface/ProfiledLikelihoodRatioTestStatExt.h"
#include "HiggsAnalysis/CombinedLimit/interface/BestFitSigmaTestStat.h"
#include "HiggsAnalysis/CombinedLimit/interface/CascadeMinimizer.h"
#include "HiggsAnalysis/CombinedLimit/interface/CloseCoutSentry.h"
#include "HiggsAnalysis/CombinedLimit/interface/utils.h"
#include <stdexcept>
#include <RooRealVar.h>
#include "../interface/RooMinimizerOpt.h"
#include "HiggsAnalysis/CombinedLimit/interface/RooMinimizerOpt.h"
#include <RooFitResult.h>
#include <RooSimultaneous.h>
#include <RooCategory.h>
#include <RooRandom.h>
#include <Math/MinimizerOptions.h>
#include <RooStats/RooStatsUtils.h>
#include "../interface/ProfilingTools.h"
#include "HiggsAnalysis/CombinedLimit/interface/ProfilingTools.h"

//---- Uncomment this and run with --perfCounters to get statistics of successful and failed fits
#define DEBUG_FIT_STATUS
Expand Down
2 changes: 1 addition & 1 deletion src/CachingMultiPdf.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../interface/CachingMultiPdf.h"
#include "HiggsAnalysis/CombinedLimit/interface/CachingMultiPdf.h"
#include "vectorized.h"

// Uncomment do do regression testing wrt uncached multipdf
Expand Down
Loading

0 comments on commit 31cc693

Please sign in to comment.