43using std::string, std::vector;
57 _parList(
"parList",
"List of morph parameters",
this),
58 _obsList(
"obsList",
"List of observables",
this),
60 _pdfList(
"pdfList",
"List of pdfs",
this),
83 _parList(
"parList",
"List of morph parameters",
this),
84 _obsList(
"obsList",
"List of observables",
this),
85 _pdfList(
"pdfList",
"List of pdfs",
this),
93 for (
int i = 0; i <
mrefpoints.GetNrows(); ++i) {
94 for (
int j = 0;
j <
grid.numBoundaries(); ++
j) {
123 _parList(
"parList",
"List of morph parameters",
this),
124 _obsList(
"obsList",
"List of observables",
this),
125 _pdfList(
"pdfList",
"List of pdfs",
this),
134 coutE(InputArguments) <<
"RooMomentMorphFuncND::ctor(" <<
GetName() <<
") ERROR: mref " <<
mref->GetName()
135 <<
" is not of type RooAbsReal" << std::endl;
136 throw string(
"RooMomentMorphFuncND::ctor() ERROR mref is not of type RooAbsReal");
139 coutW(InputArguments) <<
"RooMomentMorphFuncND::ctor(" <<
GetName() <<
") WARNING mref point " << i
140 <<
" is not a constant, taking a snapshot of its value" << std::endl;
149 for (
int j = 0;
j <
grid.numBoundaries(); ++
j) {
177 _parList(
"parList",
this,
other._parList),
178 _obsList(
"obsList",
this,
other._obsList),
179 _referenceGrid(
other._referenceGrid),
180 _pdfList(
"pdfList",
this,
other._pdfList),
181 _setting(
other._setting),
182 _useHorizMorph(
other._useHorizMorph),
183 _isPdfMode{
other._isPdfMode}
209 int depth = std::pow(2, nPar);
212 coutE(InputArguments) <<
"RooMomentMorphFuncND::initialize(" <<
GetName() <<
") ERROR: nPar != nDim"
213 <<
": " << nPar <<
" !=" <<
nDim << std::endl;
218 coutE(InputArguments) <<
"RooMomentMorphFuncND::initialize(" <<
GetName() <<
") ERROR: nPdf != nRef"
219 <<
": " <<
nPdf <<
" !=" <<
nRef << std::endl;
230 for (
int k = 0; k <
nPdf; ++k) {
234 dm2.push_back(delta);
253 for (
int k = 0; k <
nPdf; ++k) {
255 for (
int i = 0; i <
nCombs; i++) {
257 for (
int ix = 0; ix < nPar; ix++) {
258 double delta = dm[k][ix];
259 tmpDm *= std::pow(delta,
static_cast<double>(
output[i][ix]));
279 for (
unsigned int i = 0; i <
other._grid.size(); i++) {
338 int nBins = bins.size();
340 for (
int i = 0; i < nBins; i++) {
349std::unique_ptr<RooAbsArg>
373 for (
auto const &
attr :
b->attributes()) {
374 if (
attr.rfind(
"ORIGNAME:", 0) == 0)
378 b->setAttribute(
attr.c_str(),
false);
389 for (
int i = 0; i <
nFrac; ++i) {
391 std::string
newName = std::string{frac->GetName()} +
"_compiled";
393 std::make_unique<RooFit::Detail::RooMomentMorphFraction>(
newName.c_str(), frac->GetTitle(), *
this, i));
399 for (
int i = 0; i <
nFrac; ++i) {
449 auto *cache =
_parent->getCache(
nullptr);
450 if (cache->_tracker->hasChanged(
true)) {
451 cache->calculateFractions(*
_parent,
false);
453 return cache->frac(
_index)->getVal();
488 for (
int i = 0; i < 3 *
nPdf; ++i) {
496 }
else if (i < 2 *
nPdf) {
504 std::unique_ptr<RooAbsReal>
theSum;
511 for (
int i = 0; i <
nPdf; ++i) {
512 for (
int j = 0;
j < nObs; ++
j) {
516 mom->setLocalNoDirtyInhibit(
true);
517 mom->mean()->setLocalNoDirtyInhibit(
true);
527 for (
int j = 0;
j < nObs; ++
j) {
530 for (
int i = 0; i <
nPdf; ++i) {
564 *offsets[
sij(i,
j)]);
635 if (cache->
_tracker->hasChanged(
true)) {
638 return cache->
_sum.get();
646 if (cache->
_tracker->hasChanged(
true)) {
658 return static_cast<RooRealVar *
>(_frac.at(i));
664 return static_cast<RooRealVar *
>(_frac.at(i));
671 int nPar =
self._parList.size();
681 dm2.push_back(delta);
688 for (
int ix = 0; ix <
self._referenceGrid._nnuis[
idim]; ix++) {
701 for (
int i = 0; i <
nCombs; i++) {
703 for (
int ix = 0; ix < nPar; ix++) {
704 double delta =
dm2[ix];
705 tmpDm *= std::pow(delta,
static_cast<double>(
output[i][ix]));
712 for (
int i = 0; i <
nPdf; ++i) {
715 for (
int j = 0;
j <
nPdf; ++
j) {
733 std::cout <<
"NonLinear fraction " <<
ffrac << std::endl;
735 frac(
nPdf + i)->Print();
736 frac(2 *
nPdf + i)->Print();
741 for (
int i = 0; i <
nPdf; ++i) {
742 if (frac(i)->
getVal() < 0)
743 const_cast<RooRealVar *
>(frac(i))->setVal(0.);
752 for (
int i = 0; i <
nPdf; ++i) {
759 std::vector<double>
mtmp;
763 mtmp.push_back(
m->getVal());
768 int depth = std::pow(2, nPar);
775 for (
int ix = 0; ix < nPar; ix++) {
792 for (
int i = 0; i <
depth; ++i) {
805 frac(
nPdf +
self._squareIdx[i])->getVal();
811 std::cout <<
"Linear fraction " <<
ffrac << std::endl;
812 frac(
self._squareIdx[i])->Print();
813 frac(
nPdf +
self._squareIdx[i])->Print();
814 frac(2 *
nPdf +
self._squareIdx[i])->Print();
837 int depth = std::pow(2, nPar);
844 boundaries[
idim].push_back(lo);
845 boundaries[
idim].push_back(
hi);
877 for (
int ix = 0; ix < nPar; ix++) {
881 for (
int k = 0; k <
depth; ++k) {
900 (*_MSqr) = M.Invert();
906 if (allVars.
size() == 1) {
913 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 ...
void markAsCompiled(RooAbsArg &arg) const
void compileServers(RooAbsArg &arg, RooArgSet const &normSet)
void markSubtreeAsCompiled(RooAbsArg &arg) const
Mark arg and every branch node reachable through its server tree as already compiled.
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...