40using std::string, std::vector;
53 _parList(
"parList",
"List of morph parameters",
this),
54 _obsList(
"obsList",
"List of observables",
this),
56 _pdfList(
"pdfList",
"List of pdfs",
this),
78 _parList(
"parList",
"List of morph parameters",
this),
79 _obsList(
"obsList",
"List of observables",
this),
80 _pdfList(
"pdfList",
"List of pdfs",
this),
88 for (
int i = 0; i <
mrefpoints.GetNrows(); ++i) {
89 for (
int j = 0;
j <
grid.numBoundaries(); ++
j) {
117 _parList(
"parList",
"List of morph parameters",
this),
118 _obsList(
"obsList",
"List of observables",
this),
119 _pdfList(
"pdfList",
"List of pdfs",
this),
128 coutE(InputArguments) <<
"RooMomentMorphFuncND::ctor(" <<
GetName() <<
") ERROR: mref " <<
mref->GetName()
129 <<
" is not of type RooAbsReal" << std::endl;
130 throw string(
"RooMomentMorphFuncND::ctor() ERROR mref is not of type RooAbsReal");
133 coutW(InputArguments) <<
"RooMomentMorphFuncND::ctor(" <<
GetName() <<
") WARNING mref point " << i
134 <<
" is not a constant, taking a snapshot of its value" << std::endl;
143 for (
int j = 0;
j <
grid.numBoundaries(); ++
j) {
170 _parList(
"parList",
this,
other._parList),
171 _obsList(
"obsList",
this,
other._obsList),
172 _referenceGrid(
other._referenceGrid),
173 _pdfList(
"pdfList",
this,
other._pdfList),
174 _setting(
other._setting),
175 _useHorizMorph(
other._useHorizMorph),
176 _isPdfMode{
other._isPdfMode}
200 int depth = std::pow(2, nPar);
203 coutE(InputArguments) <<
"RooMomentMorphFuncND::initialize(" <<
GetName() <<
") ERROR: nPar != nDim"
204 <<
": " << nPar <<
" !=" <<
nDim << std::endl;
209 coutE(InputArguments) <<
"RooMomentMorphFuncND::initialize(" <<
GetName() <<
") ERROR: nPdf != nRef"
210 <<
": " <<
nPdf <<
" !=" <<
nRef << std::endl;
221 for (
int k = 0; k <
nPdf; ++k) {
225 dm2.push_back(delta);
242 int nCombs = output.size();
244 for (
int k = 0; k <
nPdf; ++k) {
246 for (
int i = 0; i <
nCombs; i++) {
248 for (
int ix = 0; ix < nPar; ix++) {
249 double delta = dm[k][ix];
250 tmpDm *= std::pow(delta,
static_cast<double>(output[i][ix]));
270 for (
unsigned int i = 0; i <
other._grid.size(); i++) {
329 int nBins = bins.size();
331 for (
int i = 0; i < nBins; i++) {
340std::unique_ptr<RooAbsArg>
364 for (
auto const &
attr :
b->attributes()) {
365 if (
attr.rfind(
"ORIGNAME:", 0) == 0)
369 b->setAttribute(
attr.c_str(),
false);
380 for (
int i = 0; i <
nFrac; ++i) {
382 std::string
newName = std::string{frac->GetName()} +
"_compiled";
384 std::make_unique<RooFit::Detail::RooMomentMorphFraction>(
newName.c_str(), frac->GetTitle(), *
this, i));
390 for (
int i = 0; i <
nFrac; ++i) {
409 ctx.markAsCompiled(*
b);
440 auto *cache =
_parent->getCache(
nullptr);
441 if (cache->_tracker->hasChanged(
true)) {
442 cache->calculateFractions(*
_parent,
false);
444 return cache->frac(
_index)->getVal();
479 for (
int i = 0; i < 3 *
nPdf; ++i) {
487 }
else if (i < 2 *
nPdf) {
495 std::unique_ptr<RooAbsReal>
theSum;
502 for (
int i = 0; i <
nPdf; ++i) {
503 for (
int j = 0;
j < nObs; ++
j) {
507 mom->setLocalNoDirtyInhibit(
true);
508 mom->mean()->setLocalNoDirtyInhibit(
true);
518 for (
int j = 0;
j < nObs; ++
j) {
521 for (
int i = 0; i <
nPdf; ++i) {
555 *offsets[
sij(i,
j)]);
626 if (cache->
_tracker->hasChanged(
true)) {
629 return cache->
_sum.get();
637 if (cache->
_tracker->hasChanged(
true)) {
649 return static_cast<RooRealVar *
>(_frac.at(i));
655 return static_cast<RooRealVar *
>(_frac.at(i));
662 int nPar =
self._parList.size();
672 dm2.push_back(delta);
679 for (
int ix = 0; ix <
self._referenceGrid._nnuis[
idim]; ix++) {
687 int nCombs = output.size();
692 for (
int i = 0; i <
nCombs; i++) {
694 for (
int ix = 0; ix < nPar; ix++) {
695 double delta =
dm2[ix];
696 tmpDm *= std::pow(delta,
static_cast<double>(output[i][ix]));
703 for (
int i = 0; i <
nPdf; ++i) {
706 for (
int j = 0;
j <
nPdf; ++
j) {
724 std::cout <<
"NonLinear fraction " <<
ffrac << std::endl;
726 frac(
nPdf + i)->Print();
727 frac(2 *
nPdf + i)->Print();
732 for (
int i = 0; i <
nPdf; ++i) {
733 if (frac(i)->
getVal() < 0)
734 const_cast<RooRealVar *
>(frac(i))->setVal(0.);
743 for (
int i = 0; i <
nPdf; ++i) {
750 std::vector<double>
mtmp;
754 mtmp.push_back(
m->getVal());
759 int depth = std::pow(2, nPar);
766 for (
int ix = 0; ix < nPar; ix++) {
783 for (
int i = 0; i <
depth; ++i) {
796 frac(
nPdf +
self._squareIdx[i])->getVal();
802 std::cout <<
"Linear fraction " <<
ffrac << std::endl;
803 frac(
self._squareIdx[i])->Print();
804 frac(
nPdf +
self._squareIdx[i])->Print();
805 frac(2 *
nPdf +
self._squareIdx[i])->Print();
828 int depth = std::pow(2, nPar);
835 boundaries[
idim].push_back(lo);
836 boundaries[
idim].push_back(
hi);
858 coutE(InputArguments) <<
"RooMomentMorphFuncND::findShape(" <<
GetName()
859 <<
") ERROR: no reference pdf found for grid corner (";
860 for (
unsigned int ix = 0; ix <
_squareVec[
isq].size(); ++ix) {
863 ccoutE(InputArguments) <<
") of the hypercube enclosing the current morphing "
864 <<
"parameter point. The reference grid is missing a pdf at this "
865 <<
"coordinate -- check that RooMomentMorphFuncND::Grid::addPdf() was "
866 <<
"called for every corner of the parameter range." << std::endl;
867 throw string(
"RooMomentMorphFuncND::findShape() ERROR: incomplete reference grid");
887 for (
int ix = 0; ix < nPar; ix++) {
891 for (
int k = 0; k <
depth; ++k) {
910 (*_MSqr) = M.Invert();
916 if (allVars.
size() == 1) {
923 std::cout <<
"Currently BinIntegrator only knows how to deal with 1-d " << std::endl;
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t attr
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
const_iterator begin() const
const_iterator end() const
Abstract base class for RooRealVar binning definitions.
Abstract container object that can hold multiple RooAbsArg objects.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Storage_t::size_type size() const
RooAbsArg * first() const
bool addTyped(const RooAbsCollection &list, bool silent=false)
Adds elements of a given RooAbsCollection to the container if they match the specified type.
const RooArgSet * nset() const
Abstract base class for objects that represent a real value and implements functionality common to al...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
virtual double getValV(const RooArgSet *normalisationSet=nullptr) const
Return value of object.
RooNumIntConfig * specialIntegratorConfig() const
Returns the specialized integrator configuration for this RooAbsReal.
Calculates the sum of a set of RooAbsReal terms, or when constructed with two sets,...
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.
Implements a RooAbsBinning in terms of an array of boundary values, posing no constraints on the choi...
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=nullptr)
Setter function without integration set.
T * getObj(const RooArgSet *nset, Int_t *sterileIndex=nullptr, const TNamed *isetRangeName=nullptr)
Getter function without integration set.
bool setLabel(const char *label, bool printError=true) override
Set value by specifying the name of the desired state.
bool add(const RooAbsArg &var, bool valueServer, bool shapeServer, bool silent)
Overloaded RooCollection_t::add() method insert object into set and registers object as server to own...
Represents a constant real-valued object.
RooCustomizer is a factory class to produce clones of a prototype composite PDF object with the same ...
Helper compute-graph node that exposes one of the morph mixing fractions to the RooFit::Evaluator.
const RooMomentMorphFuncND * _parent
! morph that owns the cache (not owned)
double evaluate() const override
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
RooLinearVar is the most general form of a derived real-valued object that can be used by RooRealInte...
void calculateFractions(const RooMomentMorphFuncND &self, bool verbose=true) const
std::unique_ptr< RooChangeTracker > _tracker
std::unique_ptr< RooAbsReal > _sum
RooArgList containedArgs(Action) override
CacheElem(std::unique_ptr< RooAbsReal > &&sumFunc, std::unique_ptr< RooChangeTracker > &&tracker, const RooArgList &flist)
std::vector< int > _nnuis
void addBinning(const RooAbsBinning &binning)
std::vector< RooAbsBinning * > _grid
std::vector< std::vector< double > > _nref
void addPdf(const RooAbsReal &func, int bin_x)
RooObjCacheManager _cacheMgr
! Transient cache manager
std::unique_ptr< TMatrixD > _MSqr
void findShape(const std::vector< double > &x) const
double evaluate() const override
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
RooAbsReal * sumFunc(const RooArgSet *nset)
CacheElem * getCache(const RooArgSet *nset) const
std::unique_ptr< TMatrixD > _M
RooArgSet * _curNormSet
! Transient cache manager
bool setBinIntegrator(RooArgSet &allVars)
double getValV(const RooArgSet *set=nullptr) const override
Return value of object.
std::vector< std::vector< double > > _squareVec
int sij(const int &i, const int &j) const
std::unique_ptr< RooAbsArg > compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext &ctx) const override
~RooMomentMorphFuncND() override
std::vector< int > _squareIdx
const RooArgSet & getConfigSection(const char *name) const
Retrieve configuration information specific to integrator with given name.
Variable that can be changed from the outside.
const char * GetName() const override
Returns name of object.
void cartesianProduct(std::vector< std::vector< T > > &out, std::vector< std::vector< T > > &in)
bool nextCombination(const Iterator first, Iterator k, const Iterator last)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...