Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 6 additions & 6 deletions roofit/roofit/inc/RooMomentMorphFuncND.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class RooMomentMorphFuncND : public RooAbsReal {
_grid.push_back(binning_y.clone());
_grid.push_back(binning_z.clone());
};
Grid2(const std::vector<RooAbsBinning *> binnings)
Grid2(std::vector<RooAbsBinning *> const &binnings)
{
for (unsigned int i = 0; i < binnings.size(); i++) {
_grid.push_back(binnings[i]->clone());
Expand Down Expand Up @@ -129,16 +129,16 @@ class RooMomentMorphFuncND : public RooAbsReal {
friend class CacheElem;
friend class Grid2;

mutable RooObjCacheManager _cacheMgr; ///<! Transient cache manager
mutable RooArgSet *_curNormSet;
mutable RooObjCacheManager _cacheMgr; ///<! Transient cache manager
mutable RooArgSet *_curNormSet = nullptr; ///<! Transient cache manager

RooListProxy _parList;
RooSetProxy _obsList;
mutable Grid2 _referenceGrid;
RooListProxy _pdfList;

mutable TMatrixD *_M;
mutable TMatrixD *_MSqr;
mutable std::unique_ptr<TMatrixD> _M;
mutable std::unique_ptr<TMatrixD> _MSqr;
mutable std::vector<std::vector<double>> _squareVec;
mutable std::vector<int> _squareIdx;

Expand All @@ -147,7 +147,7 @@ class RooMomentMorphFuncND : public RooAbsReal {

inline int sij(const int &i, const int &j) const { return (i * _obsList.getSize() + j); }

ClassDefOverride(RooMomentMorphFuncND, 2);
ClassDefOverride(RooMomentMorphFuncND, 3);
};

#endif
12 changes: 6 additions & 6 deletions roofit/roofit/inc/RooMomentMorphND.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class RooMomentMorphND : public RooAbsPdf {
_grid.push_back(binning_y.clone());
_grid.push_back(binning_z.clone());
};
Grid2(const std::vector<RooAbsBinning *> binnings)
Grid2(std::vector<RooAbsBinning *> const &binnings)
{
for (unsigned int i = 0; i < binnings.size(); i++) {
_grid.push_back(binnings[i]->clone());
Expand Down Expand Up @@ -127,16 +127,16 @@ class RooMomentMorphND : public RooAbsPdf {
friend class CacheElem;
friend class Grid2;

mutable RooObjCacheManager _cacheMgr; ///<! Transient cache manager
mutable RooArgSet *_curNormSet;
mutable RooObjCacheManager _cacheMgr; ///<! Transient cache manager
mutable RooArgSet *_curNormSet = nullptr; ///<! Transient cache manager

RooListProxy _parList;
RooSetProxy _obsList;
mutable Grid2 _referenceGrid;
RooListProxy _pdfList;

mutable TMatrixD *_M;
mutable TMatrixD *_MSqr;
mutable std::unique_ptr<TMatrixD> _M;
mutable std::unique_ptr<TMatrixD> _MSqr;
mutable std::vector<std::vector<double>> _squareVec;
mutable std::vector<int> _squareIdx;

Expand All @@ -145,7 +145,7 @@ class RooMomentMorphND : public RooAbsPdf {

inline int sij(const int &i, const int &j) const { return (i * _obsList.getSize() + j); }

ClassDefOverride(RooMomentMorphND, 2);
ClassDefOverride(RooMomentMorphND, 3);
};

#endif
25 changes: 12 additions & 13 deletions roofit/roofit/src/RooMomentMorphFuncND.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ ClassImp(RooMomentMorphFuncND::Grid2);

//_____________________________________________________________________________
RooMomentMorphFuncND::RooMomentMorphFuncND()
: _cacheMgr(this, 10, true, true), _curNormSet(0), _M(0), _MSqr(0), _setting(RooMomentMorphFuncND::Linear),
_useHorizMorph(true)
: _cacheMgr(this, 10, true, true), _setting(RooMomentMorphFuncND::Linear), _useHorizMorph(true)
{
TRACE_CREATE;
}
Expand Down Expand Up @@ -157,10 +156,10 @@ RooMomentMorphFuncND::RooMomentMorphFuncND(const char *name, const char *title,

//_____________________________________________________________________________
RooMomentMorphFuncND::RooMomentMorphFuncND(const RooMomentMorphFuncND &other, const char *name)
: RooMomentMorphFuncND::Base_t(other, name), _cacheMgr(other._cacheMgr, this), _curNormSet(0),
: RooMomentMorphFuncND::Base_t(other, name), _cacheMgr(other._cacheMgr, this),
_parList("parList", this, other._parList), _obsList("obsList", this, other._obsList),
_referenceGrid(other._referenceGrid), _pdfList("pdfList", this, other._pdfList), _M(0), _MSqr(0),
_setting(other._setting), _useHorizMorph(other._useHorizMorph)
_referenceGrid(other._referenceGrid), _pdfList("pdfList", this, other._pdfList), _setting(other._setting),
_useHorizMorph(other._useHorizMorph)
{
// general initialization
initialize();
Expand All @@ -171,11 +170,6 @@ RooMomentMorphFuncND::RooMomentMorphFuncND(const RooMomentMorphFuncND &other, co
//_____________________________________________________________________________
RooMomentMorphFuncND::~RooMomentMorphFuncND()
{
if (_M)
delete _M;
if (_MSqr)
delete _MSqr;

TRACE_DESTROY;
}

Expand Down Expand Up @@ -232,8 +226,8 @@ void RooMomentMorphFuncND::initialize()
}

// Transformation matrix for NonLinear settings
_M = new TMatrixD(nPdf, nPdf);
_MSqr = new TMatrixD(depth, depth);
_M = std::make_unique<TMatrixD>(nPdf, nPdf);
_MSqr = std::make_unique<TMatrixD>(depth, depth);
if (_setting == NonLinear || _setting == NonLinearPosFractions || _setting == NonLinearLinFractions) {
TMatrixD M(nPdf, nPdf);

Expand Down Expand Up @@ -289,7 +283,12 @@ RooMomentMorphFuncND::Grid2::Grid2(const RooMomentMorphFuncND::Grid2 &other)
}

//_____________________________________________________________________________
RooMomentMorphFuncND::Grid2::~Grid2() {}
RooMomentMorphFuncND::Grid2::~Grid2()
{
for (RooAbsBinning *binning : _grid) {
delete binning;
}
}

//_____________________________________________________________________________
void RooMomentMorphFuncND::Grid2::addPdf(const RooMomentMorphFuncND::Base_t &pdf, int bin_x)
Expand Down
26 changes: 12 additions & 14 deletions roofit/roofit/src/RooMomentMorphND.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ ClassImp(RooMomentMorphND);

//_____________________________________________________________________________
RooMomentMorphND::RooMomentMorphND()
: _cacheMgr(this, 10, true, true), _curNormSet(0), _M(0), _MSqr(0), _setting(RooMomentMorphND::Linear),
_useHorizMorph(true)
: _cacheMgr(this, 10, true, true), _setting(RooMomentMorphND::Linear), _useHorizMorph(true)
{
TRACE_CREATE;
}
Expand Down Expand Up @@ -154,10 +153,9 @@ RooMomentMorphND::RooMomentMorphND(const char *name, const char *title, RooAbsRe

//_____________________________________________________________________________
RooMomentMorphND::RooMomentMorphND(const RooMomentMorphND &other, const char *name)
: RooMomentMorphND::Base_t(other, name), _cacheMgr(other._cacheMgr, this), _curNormSet(0),
_parList("parList", this, other._parList), _obsList("obsList", this, other._obsList),
_referenceGrid(other._referenceGrid), _pdfList("pdfList", this, other._pdfList), _M(0), _MSqr(0),
_setting(other._setting), _useHorizMorph(other._useHorizMorph)
: RooMomentMorphND::Base_t(other, name), _cacheMgr(other._cacheMgr, this), _parList("parList", this, other._parList),
_obsList("obsList", this, other._obsList), _referenceGrid(other._referenceGrid),
_pdfList("pdfList", this, other._pdfList), _setting(other._setting), _useHorizMorph(other._useHorizMorph)
{
// general initialization
initialize();
Expand All @@ -168,11 +166,6 @@ RooMomentMorphND::RooMomentMorphND(const RooMomentMorphND &other, const char *na
//_____________________________________________________________________________
RooMomentMorphND::~RooMomentMorphND()
{
if (_M)
delete _M;
if (_MSqr)
delete _MSqr;

TRACE_DESTROY;
}

Expand Down Expand Up @@ -229,8 +222,8 @@ void RooMomentMorphND::initialize()
}

// Transformation matrix for NonLinear settings
_M = new TMatrixD(nPdf, nPdf);
_MSqr = new TMatrixD(depth, depth);
_M = std::make_unique<TMatrixD>(nPdf, nPdf);
_MSqr = std::make_unique<TMatrixD>(depth, depth);
if (_setting == NonLinear || _setting == NonLinearPosFractions || _setting == NonLinearLinFractions) {
TMatrixD M(nPdf, nPdf);

Expand Down Expand Up @@ -286,7 +279,12 @@ RooMomentMorphND::Grid2::Grid2(const RooMomentMorphND::Grid2 &other)
}

//_____________________________________________________________________________
RooMomentMorphND::Grid2::~Grid2() {}
RooMomentMorphND::Grid2::~Grid2()
{
for (RooAbsBinning *binning : _grid) {
delete binning;
}
}

//_____________________________________________________________________________
void RooMomentMorphND::Grid2::addPdf(const RooMomentMorphND::Base_t &pdf, int bin_x)
Expand Down