Temporarily switch this off, it doesn't work. Don't know why, however.
274 const RooArgSet *obs =
data_->get();
277 RooAddPdf *addpdf = 0;
278 RooRealSumPdf *sumpdf = 0;
279 if ((addpdf = dynamic_cast<RooAddPdf *>(
pdf_)) != 0) {
281 int npdf = addpdf->coefList().getSize();
284 for (
int i = 0;
i < npdf; ++
i) {
285 RooAbsReal * coeff =
dynamic_cast<RooAbsReal*
>(addpdf->coefList().at(
i));
286 RooAbsPdf * pdfi =
dynamic_cast<RooAbsPdf *
>(addpdf->pdfList().at(
i));
288 pdfs_.push_back(CachingPdf(pdfi, obs));
290 }
else if ((sumpdf = dynamic_cast<RooRealSumPdf *>(
pdf_)) != 0) {
292 int npdf = sumpdf->coefList().getSize();
296 for (
int i = 0;
i < npdf; ++
i) {
297 RooAbsReal * coeff =
dynamic_cast<RooAbsReal*
>(sumpdf->coefList().at(
i));
298 RooAbsReal * funci =
dynamic_cast<RooAbsReal*
>(sumpdf->funcList().at(
i));
300 if (0 &&
typeid(*funci) ==
typeid(RooProduct)) {
301 RooArgList obsDep, obsInd;
304 std::cout <<
"Entry " <<
i <<
": coef name " << (coeff ? coeff->GetName() :
"null") <<
305 " type " << (coeff ? coeff->ClassName() :
"n/a") << std::endl;
306 std::cout <<
" " <<
"; func name " << (funci ? funci->GetName() :
"null") <<
307 " type " << (funci ? funci->ClassName() :
"n/a") << std::endl;
308 std::cout <<
"Terms depending on observables: " << std::endl; obsDep.Print(
"V");
309 std::cout <<
"Terms not depending on observables: " << std::endl; obsInd.Print(
"V");
310 if (obsInd.getSize() > 1) {
311 coeff =
new RooProduct(TString::Format(
"%s_x_%s_obsIndep", coeff->GetName(), funci->GetName()),
"", RooArgSet(obsInd));
312 addOwnedComponents(RooArgSet(*coeff));
314 if (obsDep.getSize() > 1) {
315 funci =
new RooProduct(TString::Format(
"%s_obsDep", funci->GetName()),
"", RooArgSet(obsInd));
316 addOwnedComponents(RooArgSet(*funci));
317 }
else if (obsDep.getSize() == 1) {
318 funci = (RooAbsReal *) obsDep.first();
319 }
else throw std::logic_error(
"No part of pdf depends on observables?");
322 pdfs_.push_back(CachingPdf(funci, obs));
323 integrals_.push_back(funci->createIntegral(*obs));
326 std::string errmsg =
"ERROR: CachingAddNLL: Pdf ";
327 errmsg +=
pdf_->GetName();
328 errmsg +=
" is neither a RooAddPdf nor a RooRealSumPdf, but a ";
329 errmsg +=
pdf_->ClassName();
330 throw std::invalid_argument(errmsg);
334 std::auto_ptr<TIterator> iter(
params->createIterator());
335 for (RooAbsArg *
a = (RooAbsArg *) iter->Next();
a != 0;
a = (RooAbsArg *) iter->Next()) {
336 RooRealVar *rrv =
dynamic_cast<RooRealVar *
>(
a);
338 if (rrv != 0)
params_.add(*rrv);
void factorizeFunc(const RooArgSet &observables, RooAbsReal &pdf, RooArgList &obsTerms, RooArgList &otherTerms, bool debug=false)
factorize a RooAbsReal
std::vector< CachingPdf > pdfs_
std::vector< RooAbsReal * > integrals_
std::vector< RooAbsReal * > coeffs_