64 for (std::size_t i = 0; i < pdfList.
size(); ++i) {
65 auto pdf =
static_cast<const RooAbsPdf *
>(pdfList.
at(i));
66 auto coef =
static_cast<const RooAbsReal *
>(coefList.
at(i));
77 if (
auto pdfDeps = std::unique_ptr<RooArgSet>{pdf->getObservables(nset)}) {
82 if (
auto coefDeps = std::unique_ptr<RooArgSet>{coef ? coef->getObservables(nset) : nullptr}) {
86 std::unique_ptr<RooAbsReal>
snorm;
87 auto name = std::string(addPdf.
GetName()) +
"_" + pdf->GetName() +
"_SupNorm";
89 snorm = std::make_unique<RooRealIntegral>(
name.c_str(),
"Supplemental normalization integral",
92 <<
" making supplemental normalization set " <<
supNSet <<
" for pdf component "
93 << pdf->GetName() << std::endl;
97 auto snormTerm = std::unique_ptr<RooAbsReal>(pdf->createIntegral(
nset2,
nset2, normRange.c_str()));
109 if (verboseEval > 1) {
111 <<
") synching supplemental normalization list for norm"
112 << (nset ? *nset :
RooArgSet()) << std::endl;
130 std::unique_ptr<RooAbsReal>
pdfProj;
136 <<
") --> pdfProj = " <<
pdfProj->GetName() << std::endl;
138 <<
") PP = " <<
pdfProj->GetName() << std::endl;
145 auto deps = std::unique_ptr<RooArgSet>{pdf->getParameters(
RooArgSet())};
148 std::unique_ptr<RooAbsReal>
snorm;
149 auto name = std::string(addPdf.
GetName()) +
"_" + pdf->GetName() +
"_ProjSupNorm";
151 snorm = std::make_unique<RooRealIntegral>(
name.c_str(),
"Projection Supplemental normalization integral",
154 <<
") SN = " <<
snorm->GetName() << std::endl;
162 pdf->getObservables(tmp);
163 auto int1 = std::unique_ptr<RooAbsReal>{pdf->createIntegral(tmp, tmp, normRange.c_str())};
164 auto int2 = std::unique_ptr<RooAbsReal>{pdf->createIntegral(tmp, tmp,
refCoefNormRange.c_str())};
174void AddCacheElem::print()
const
177 std::cout <<
"+++ " <<
name <<
":" << std::endl;
178 for (
auto const &arg :
vec) {
183 std::cout <<
"nullptr" << std::endl;
226void RooAddHelpers::updateCoefficients(
RooAbsPdf const &addPdf, std::vector<double> &
coefCache,
237 for (
auto arg : pdfList) {
238 auto pdf =
static_cast<RooAbsPdf *
>(arg);
246 <<
") WARNING: total number of expected events is 0" << std::endl;
248 for (std::size_t
j = 0;
j < pdfList.
size();
j++) {
260 <<
") WARNING: sum of coefficients is zero 0" << std::endl;
278 std::stringstream
msg;
280 msg <<
"RooAddPdf::updateCoefCache(" << addPdf.
GetName()
281 <<
" WARNING: sum of PDF coefficients not in range [0-1], value=" << 1 -
lastCoef;
283 msg <<
" (no more will be printed)";
285 oocoutW(&addPdf, Eval) <<
msg.str() << std::endl;
292 if (!cache.doProjection()) {
298 for (std::size_t i = 0; i < pdfList.
size(); i++) {
299 coefCache[i] *= cache.projVal(i) / cache.projSuppNormVal(i) * cache.rangeProjScaleFactor(i);
305 for (std::size_t i = 0; i < pdfList.
size(); ++i) {
306 ooccoutD(&addPdf, Caching) <<
" ALEX: POST-SYNC coef[" << i <<
"] = " <<
coefCache[i]
308 <<
" ) " << std::endl;
314 <<
") sum of coefficients is zero." << std::endl;
317 for (std::size_t i = 0; i < pdfList.
size(); i++) {
ROOT::RRangeCast< T, false, Range_t > static_range_cast(Range_t &&coll)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
const_iterator begin() const
const_iterator end() const
RooFit::OwningPtr< RooArgSet > getObservables(const RooArgSet &set, bool valueOnly=true) const
Given a set of possible observables, return the observables that this PDF depends on.
OperMode operMode() const
Query the operation mode of this node.
Storage_t::size_type size() const
Abstract interface for all probability density functions.
const char * normRange() const
Abstract base class for objects that represent a real value and implements functionality common to al...
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
static RooMsgService & instance()
Return reference to singleton instance.
static RooConstVar & value(double value)
Return a constant value object with given value.
const char * GetName() const override
Returns name of object.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
static double packFloatIntoNaN(float payload)
Pack float into mantissa of a NaN.