Skip to content
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

ROOT 6.22 compatibility (CMSSW 11_2) #648

Merged
merged 21 commits into from
Apr 23, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions interface/HZZ4L_RooCTauPdf_1D.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "TH1.h"
#include "RooDataHist.h"
#include "RooHistFunc.h"
#include "RooListProxy.h"


class HZZ4L_RooCTauPdf_1D : public RooAbsPdf {
Expand Down
1 change: 1 addition & 0 deletions interface/HZZ4L_RooCTauPdf_1D_Expanded.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "TH1.h"
#include "RooDataHist.h"
#include "RooHistFunc.h"
#include "RooListProxy.h"


class HZZ4L_RooCTauPdf_1D_Expanded : public RooAbsPdf {
Expand Down
1 change: 1 addition & 0 deletions interface/HZZ4L_RooCTauPdf_2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "TH1.h"
#include "RooDataHist.h"
#include "RooHistFunc.h"
#include "RooListProxy.h"


class HZZ4L_RooCTauPdf_2D : public RooAbsPdf {
Expand Down
1 change: 1 addition & 0 deletions interface/HZZ4L_RooSpinZeroPdf.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "TH1.h"
#include "RooDataHist.h"
#include "RooHistFunc.h"
#include "RooListProxy.h"
using namespace RooFit;
class HZZ4L_RooSpinZeroPdf : public RooAbsPdf {
protected:
Expand Down
1 change: 1 addition & 0 deletions interface/HZZ4L_RooSpinZeroPdf_1D.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "TH1.h"
#include "RooDataHist.h"
#include "RooHistFunc.h"
#include "RooListProxy.h"
using namespace RooFit;

class HZZ4L_RooSpinZeroPdf_1D : public RooAbsPdf {
Expand Down
1 change: 1 addition & 0 deletions interface/HZZ4L_RooSpinZeroPdf_2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "TH1.h"
#include "RooDataHist.h"
#include "RooHistFunc.h"
#include "RooListProxy.h"

using namespace RooFit;

Expand Down
2 changes: 2 additions & 0 deletions interface/HZZ4L_RooSpinZeroPdf_phase.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include "TH1.h"
#include "RooDataHist.h"
#include "RooHistFunc.h"
#include "RooListProxy.h"

using namespace RooFit;
class HZZ4L_RooSpinZeroPdf_phase : public RooAbsPdf {
protected:
Expand Down
1 change: 1 addition & 0 deletions interface/MultiDimFit.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/
#include "HiggsAnalysis/CombinedLimit/interface/FitterAlgoBase.h"
#include <RooRealVar.h>
#include "TFile.h"
#include <vector>

class MultiDimFit : public FitterAlgoBase {
Expand Down
5 changes: 0 additions & 5 deletions interface/RooMultiPdf.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@
#include <iostream>
#include <vector>

class RooAbsArg;
class RooAbsPdf;
class RooAbsReal;
class RooRealProxy;
class RooArgList;

using namespace std;

Expand Down
4 changes: 3 additions & 1 deletion interface/SimpleCacheSentry.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ class SimpleCacheSentry : public RooAbsArg {
virtual RooAbsArg *createFundamental(const char* newname=0) const { return 0; }
virtual Bool_t readFromStream(std::istream& is, Bool_t compact, Bool_t verbose=kFALSE) { return false; }
virtual void writeToStream(std::ostream& os, Bool_t compact) const { }
virtual Bool_t operator==(const RooAbsArg& other) const { return this == &other; }
virtual Bool_t operator==(const RooAbsArg& other) { return this == &other; }
virtual void syncCache(const RooArgSet* nset=0) {}
virtual void copyCache(const RooAbsArg* source, Bool_t valueOnly=kFALSE, Bool_t setValDirty=kTRUE) {}
virtual void attachToTree(TTree& t, Int_t bufSize=32000) {}
virtual void attachToVStore(RooVectorDataStore& vstore) {}
virtual void setTreeBranchStatus(TTree& t, Bool_t active) {}
virtual void fillTreeBranch(TTree& t) {}
virtual Bool_t isIdentical(const RooAbsArg& other, Bool_t assumeSameType=kFALSE) ;
virtual Bool_t isIdentical(const RooAbsArg& other, Bool_t assumeSameType=kFALSE) const;
virtual Bool_t isIdentical(const RooAbsArg& other, Bool_t assumeSameType=kFALSE) { return const_cast<SimpleCacheSentry*>(this)->isIdentical(other, assumeSameType); };
nsmith- marked this conversation as resolved.
Show resolved Hide resolved
private:
RooSetProxy _deps;
ClassDef(SimpleCacheSentry,1)
Expand Down
7 changes: 5 additions & 2 deletions interface/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,19 @@ namespace utils {
RooArgSet returnAllVars(RooWorkspace *);
bool freezeAllDisassociatedRooMultiPdfParameters(const RooArgSet & multiPdfs, const RooArgSet & allRooMultiPdfParams, bool freeze=true);

#if ROOT_VERSION_CODE < ROOT_VERSION(6,20,0)
// This is a workaround for a bug (?) in RooAddPdf that limits the number of elements
// to 100 when de-serialised from a TFile. We have to access a protected array and reallocate
// it with the correct size
// https://sft.its.cern.ch/jira/browse/ROOT-6008
class RooAddPdfFixer : public RooAddPdf {
public:
RooAddPdfFixer() : RooAddPdf() {}
RooAddPdfFixer(RooAddPdfFixer const& other) : RooAddPdf(other) {}

void Fix(RooAddPdf & fixme);
void FixAll(RooWorkspace & w);
static void Fix(RooAddPdf & fixme);
static void FixAll(RooWorkspace & w);
};
#endif
}
#endif
2 changes: 1 addition & 1 deletion src/CachingNLL.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,7 @@ void cacheutils::CachingSimNLL::splitWithWeights(const RooAbsData &data, const R
//utils::printRDH((RooAbsData*)&data);
for (int i = 0; i < ne; ++i) {
data.get(i); if (data.weight() == 0 && !includeZeroWeightsAny) continue;
int ib = cat->getBin();
int ib = cat->getBin((const char*) 0);
//std::cout << "Event " << i << " of weight " << data.weight() << " is in bin " << ib << " label " << cat->getLabel() << std::endl;
if (data.weight() > 0 || includeZeroWeights[ib]) datasets_[ib]->add(obs, data.weight());
}
Expand Down
7 changes: 4 additions & 3 deletions src/Combine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,11 @@ void Combine::run(TString hlfFile, const std::string &dataset, double &limit, do
mc_bonly->SetPdf(*model_b);
}

#if ROOT_VERSION_CODE < ROOT_VERSION(6,20,0)
// Fix for large RooAddPdfs
utils::RooAddPdfFixer addpdfFixer;
addpdfFixer.FixAll(*w);
utils::RooAddPdfFixer::FixAll(*w);
#endif

// Specific settings should be executed before user specified ranges!
RooRealVar *r = (RooRealVar*)POI->first();
if (!isnan(rMin_)) r->setMin(rMin_);
Expand Down
2 changes: 1 addition & 1 deletion src/SimpleCacheSentry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void SimpleCacheSentry::addFunc(const RooAbsArg &func, const RooArgSet *obs)
}

Bool_t SimpleCacheSentry::isIdentical(const RooAbsArg& other,
Bool_t /*assumeSameType*/) {
Bool_t /*assumeSameType*/) const {
bool ret = kFALSE;
SimpleCacheSentry const& otherSentry = dynamic_cast<SimpleCacheSentry const&>(other);
RooAbsCollection * common = _deps.selectCommon(otherSentry._deps);
Expand Down
2 changes: 1 addition & 1 deletion src/SimplerLikelihoodRatioTestStatExt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ double SimplerLikelihoodRatioTestStatOpt::evalSimNLL(RooAbsData &data, RooSimul
for (i = 0; i < n; ++i) {
data.get(i);
double w = data.weight(); if (w == 0) continue;
int bin = cat->getBin();
int bin = cat->getBin((const char*) 0);
assert(bin < int(components.size()) && "Bin outside range");
if (components[bin] == 0) continue;
sum += -w*components[bin]->getLogVal(obs_);
Expand Down
3 changes: 2 additions & 1 deletion src/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1104,6 +1104,7 @@ bool utils::freezeAllDisassociatedRooMultiPdfParameters(const RooArgSet & multiP
return false;
}

#if ROOT_VERSION_CODE < ROOT_VERSION(6,20,0)
void utils::RooAddPdfFixer::Fix(RooAddPdf & fixme) {
RooAddPdfFixer & fixme_casted = static_cast<RooAddPdfFixer &>(fixme);
delete[] fixme_casted.RooAddPdf::_coefCache;
Expand All @@ -1121,4 +1122,4 @@ void utils::RooAddPdfFixer::FixAll(RooWorkspace & w) {
}
}
}

#endif