Skip to content

Commit

Permalink
Merge pull request #951 from cms-analysis/fixMultiPdf_constr_root630
Browse files Browse the repository at this point in the history
Fix copy constructors in RooMultiPdf for ROOT v6.30
  • Loading branch information
anigamova authored Jun 7, 2024
2 parents e01973e + 8875760 commit d29052f
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions src/RooMultiPdf.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ ClassImp(RooMultiPdf)
RooMultiPdf::RooMultiPdf(const char *name, const char *title, RooCategory& _x, const RooArgList& _c) :
RooAbsPdf(name, title), //Why is this here? just to use the names to be used?
c("_pdfs","The list of pdfs",this),
corr("_corrs","The list of correction factors",this),
x("_index","the pdf index",this,_x)
{
int count=0;
Expand All @@ -46,24 +47,13 @@ RooMultiPdf::RooMultiPdf(const char *name, const char *title, RooCategory& _x, c

//_____________________________________________________________________________
RooMultiPdf::RooMultiPdf(const RooMultiPdf& other, const char* name) :
RooAbsPdf(other, name),c("_pdfs",this,RooListProxy()),x("_index",this,other.x)
RooAbsPdf(other, name),c("_pdfs",this,other.c),corr("_corrs",this,other.corr),x("_index",this,other.x)
{

fIndex=other.fIndex;
nPdfs=other.nPdfs;

for (RooAbsArg *fPdf : other.c) {
c.add(*fPdf);
std::unique_ptr<RooArgSet> variables(fPdf->getVariables());
std::unique_ptr<RooAbsCollection> nonConstVariables(variables->selectByAttrib("Constant", false));

RooConstVar *tmp = new RooConstVar(Form("const%s",fPdf->GetName())
,"",nonConstVariables->getSize());
corr.add(*tmp);
}

_oldIndex=fIndex;
cFactor=other.cFactor; // correction to 2*NLL by default is -> 2*0.5 per param
cFactor=other.cFactor; // correction to 2*NLL by default is -> 2*0.5 per param
}

bool RooMultiPdf::checkIndexDirty() const {
Expand Down

0 comments on commit d29052f

Please sign in to comment.