33using std::cout, std::endl, std::string, std::vector;
48 m(
"m",
"m", this, _m),
49 _varList(
"varList",
"List of variables", this),
50 _pdfList(
"pdfList",
"List of pdfs", this),
69 m(
"m",
"m", this, _m),
70 _varList(
"varList",
"List of variables", this),
71 _pdfList(
"pdfList",
"List of pdfs", this),
84 for (
auto *mref : mrefList) {
86 coutE(InputArguments) <<
"RooMomentMorphFunc::ctor(" <<
GetName() <<
") ERROR: mref " << mref->GetName()
87 <<
" is not of type RooAbsReal" << endl;
88 throw string(
"RooPolyMorh::ctor() ERROR mref is not of type RooAbsReal");
91 coutW(InputArguments) <<
"RooMomentMorphFunc::ctor(" <<
GetName() <<
") WARNING mref point " <<
i
92 <<
" is not a constant, taking a snapshot of its value" << endl;
106 m(
"m", this, other.
m),
134 if (nPdf !=
_mref->GetNrows()) {
135 coutE(InputArguments) <<
"RooMomentMorphFunc::initialize(" <<
GetName() <<
") ERROR: nPdf != nRefPoints" << endl;
145 (*dm)[
i] = (*_mref)[
i] - (*_mref)[0];
151 for (
Int_t j = 1; j <
_mref->GetNrows(); ++j) {
152 M(
i, j) = std::pow((*dm)[
i], (
double)j);
171 vector<RooAbsReal *> meanrv(nPdf * nVar, null);
172 vector<RooAbsReal *> sigmarv(nPdf * nVar, null);
173 vector<RooAbsReal *> myrms(nVar, null);
174 vector<RooAbsReal *> mypos(nVar, null);
175 vector<RooAbsReal *> slope(nPdf * nVar, null);
176 vector<RooAbsReal *> offs(nPdf * nVar, null);
177 vector<RooAbsReal *> transVar(nPdf * nVar, null);
178 vector<RooAbsReal *> transPdf(nPdf, null);
187 for (
Int_t i = 0;
i < 2 * nPdf; ++
i) {
188 std::string fracName =
Form(
"frac_%d",
i);
202 std::string sumfuncName =
Form(
"%s_sumfunc",
GetName());
208 for (
Int_t j = 0; j < nVar; ++j) {
210 std::string meanName =
Form(
"%s_mean_%d_%d",
GetName(),
i, j);
211 std::string sigmaName =
Form(
"%s_sigma_%d_%d",
GetName(),
i, j);
219 sigmarv[
ij(
i, j)] = mom;
220 meanrv[
ij(
i, j)] = mom->
mean();
222 ownedComps.
add(*sigmarv[
ij(
i, j)]);
227 for (
Int_t j = 0; j < nVar; ++j) {
231 meanList.
add(*meanrv[
ij(
i, j)]);
232 rmsList.
add(*sigmarv[
ij(
i, j)]);
234 std::string myrmsName =
Form(
"%s_rms_%d",
GetName(), j);
235 std::string myposName =
Form(
"%s_pos_%d",
GetName(), j);
236 myrms[j] =
new RooAddition(myrmsName.c_str(), myrmsName.c_str(), rmsList, coefList2);
237 mypos[j] =
new RooAddition(myposName.c_str(), myposName.c_str(), meanList, coefList2);
246 std::string pdfName =
Form(
"pdf_%d",
i);
249 for (
Int_t j = 0; j < nVar; ++j) {
251 std::string slopeName =
Form(
"%s_slope_%d_%d",
GetName(),
i, j);
252 std::string offsetName =
Form(
"%s_offset_%d_%d",
GetName(),
i, j);
259 std::string transVarName =
Form(
"%s_transVar_%d_%d",
GetName(),
i, j);
264 new RooLinearVar(transVarName.c_str(), transVarName.c_str(), var, *slope[
ij(
i, j)], *offs[
ij(
i, j)]);
270 ownedComps.
add(*transVar[
ij(
i, j)]);
274 transPdfList.
add(*transPdf[
i]);
275 ownedComps.
add(*transPdf[
i]);
278 theSumFunc =
new RooRealSumFunc(sumfuncName.c_str(), sumfuncName.c_str(), transPdfList, coefList);
289 std::string trackerName =
Form(
"%s_frac_tracker",
GetName());
293 cache =
new CacheElem(*theSumFunc, *tracker, fracl);
294 _cacheMgr.setObj(
nullptr,
nullptr, cache,
nullptr);
374 double dm = self.
m - (*self.
_mref)[0];
377 double sumposfrac = 0.;
380 for (
Int_t j = 0; j < nPdf; ++j) {
381 ffrac += (*self.
_M)(j,
i) * (j == 0 ? 1. : std::pow(dm, (
double)j));
390 cout << ffrac << endl;
395 int imin = self.
idxmin(self.
m);
396 int imax = self.
idxmax(self.
m);
397 double mfrac = (self.
m - (*self.
_mref)[imin]) / ((*self.
_mref)[imax] - (*self.
_mref)[imin]);
416 }
else if (imax == imin) {
426 }
else if (imax == imin) {
445 double mmin = -DBL_MAX;
460 double mmax = DBL_MAX;
true
Register systematic variations for multiple existing columns using auto-generated tags.
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
TMatrixT< Double_t > TMatrixD
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
TVectorT< Double_t > TVectorD
void setLocalNoDirtyInhibit(bool flag) const
bool addOwnedComponents(const RooAbsCollection &comps)
Take ownership of the contents of 'comps'.
void addServer(RooAbsArg &server, bool valueProp=true, bool shapeProp=false, std::size_t refCount=1)
Register another RooAbsArg as a server to us, ie, declare that we depend on it.
RooAbsArg()
Default constructor.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Storage_t::size_type size() const
Abstract interface for all probability density functions.
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
virtual std::list< double > * binBoundaries(RooAbsRealLValue &obs, double xlo, double xhi) const
Retrieve bin boundaries if this distribution is binned in obs.
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
virtual double getValV(const RooArgSet *normalisationSet=nullptr) const
Return value of object.
RooAbsReal()
coverity[UNINIT_CTOR] Default constructor
friend class RooRealSumFunc
virtual bool isBinnedDistribution(const RooArgSet &) const
Tests if the distribution is binned. Unless overridden by derived classes, this always returns false.
virtual std::list< double > * plotSamplingHint(RooAbsRealLValue &obs, double xlo, double xhi) const
Interface for returning an optional hint for initial sampling points when constructing a curve projec...
RooAbsMoment * sigma(RooRealVar &obs)
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.
Meta object that tracks value changes in a given set of RooAbsArgs by registering itself as value cli...
bool hasChanged(bool clearState)
Returns true if state has changed since last call with clearState=true.
Represents a constant real-valued object.
RooCustomizer is a factory class to produce clones of a prototype composite PDF object with the same ...
void replaceArg(const RooAbsArg &orig, const RooAbsArg &subst)
Replace any occurrence of arg 'orig' with arg 'subst'.
RooAbsArg * build(const char *masterCatState, bool verbose=false)
Build a clone of the prototype executing all registered 'replace' rules and 'split' rules for the mas...
RooLinearVar is the most general form of a derived real-valued object that can be used by RooRealInte...
void calculateFractions(const RooMomentMorphFunc &self, bool verbose=true) const
RooRealVar * frac(Int_t i)
RooChangeTracker * _tracker
RooArgList containedArgs(Action) override
double getValV(const RooArgSet *set=nullptr) const override
Return value of object.
~RooMomentMorphFunc() override
friend class CacheElem
Current normalization set.
RooArgSet * _curNormSet
The cache manager.
bool isBinnedDistribution(const RooArgSet &obs) const override
Tests if the distribution is binned. Unless overridden by derived classes, this always returns false.
RooObjCacheManager _cacheMgr
CacheElem * getCache(const RooArgSet *nset) const
double evaluate() const override
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
RooAbsReal * sumFunc(const RooArgSet *nset)
int idxmin(const double &m) const
std::list< double > * binBoundaries(RooAbsRealLValue &, double, double) const override
Retrieve bin boundaries if this distribution is binned in obs.
std::list< double > * plotSamplingHint(RooAbsRealLValue &obs, double xlo, double xhi) const override
Interface for returning an optional hint for initial sampling points when constructing a curve projec...
Int_t ij(const Int_t &i, const Int_t &j) const
int idxmax(const double &m) const
Variable that can be changed from the outside.
const char * GetName() const override
Returns name of object.
constexpr Double_t PiOver2()