33 : _curNormSet(0), _mref(0), _M(0), _useHorizMorph(true)
36 _varItr = _varList.createIterator();
37 _pdfItr = _pdfList.createIterator();
43 :
RooAbsReal(
name, title), _cacheMgr(this, 10,
kTRUE,
kTRUE),
m(
"m",
"m", this, _m),
44 _varList(
"varList",
"List of variables", this), _pdfList(
"pdfList",
"List of pdfs", this), _setting(setting),
55 <<
" is not of type RooAbsReal" << endl;
56 throw string(
"RooPolyMorh::ctor() ERROR variable is not of type RooAbsReal");
68 <<
" is not of type RooAbsReal" << endl;
69 throw string(
"RooMomentMorhFunc::ctor() ERROR func is not of type RooAbsReal");
86 :
RooAbsReal(
name, title), _cacheMgr(this, 10,
kTRUE,
kTRUE),
m(
"m",
"m", this, _m),
87 _varList(
"varList",
"List of variables", this), _pdfList(
"pdfList",
"List of pdfs", this), _setting(setting),
98 <<
" is not of type RooAbsReal" << endl;
99 throw string(
"RooMomentMorh::ctor() ERROR variable is not of type RooAbsReal");
111 <<
" is not of type RooAbsReal" << endl;
112 throw string(
"RooMomentMorh::ctor() ERROR function is not of type RooAbsReal");
125 <<
" is not of type RooAbsReal" << endl;
126 throw string(
"RooPolyMorh::ctor() ERROR mref is not of type RooAbsReal");
130 <<
" is not a constant, taking a snapshot of its value" << endl;
132 (*_mref)[i] = mref->
getVal();
145 :
RooAbsReal(other,
name), _cacheMgr(other._cacheMgr, this), _curNormSet(0),
m(
"m", this, other.
m),
146 _varList(
"varList", this, other._varList), _pdfList(
"pdfList", this, other._pdfList), _setting(other._setting),
147 _useHorizMorph(other._useHorizMorph)
188 (*dm)[i] = (*_mref)[i] - (*_mref)[0];
214 vector<RooAbsReal *> meanrv(nPdf * nVar,
null);
215 vector<RooAbsReal *> sigmarv(nPdf * nVar,
null);
216 vector<RooAbsReal *> myrms(nVar,
null);
217 vector<RooAbsReal *> mypos(nVar,
null);
218 vector<RooAbsReal *> slope(nPdf * nVar,
null);
219 vector<RooAbsReal *> offs(nPdf * nVar,
null);
220 vector<RooAbsReal *> transVar(nPdf * nVar,
null);
221 vector<RooAbsReal *> transPdf(nPdf,
null);
230 for (
Int_t i = 0; i < 2 * nPdf; ++i) {
231 std::string fracName =
Form(
"frac_%d", i);
244 std::string sumfuncName =
Form(
"%s_sumfunc",
GetName());
249 for (
Int_t i = 0; i < nPdf; ++i) {
250 for (
Int_t j = 0; j < nVar; ++j) {
252 std::string meanName =
Form(
"%s_mean_%d_%d",
GetName(), i, j);
253 std::string sigmaName =
Form(
"%s_sigma_%d_%d",
GetName(), i, j);
261 sigmarv[
ij(i, j)] = mom;
262 meanrv[
ij(i, j)] = mom->
mean();
264 ownedComps.
add(*sigmarv[
ij(i, j)]);
269 for (
Int_t j = 0; j < nVar; ++j) {
272 for (
Int_t i = 0; i < nPdf; ++i) {
273 meanList.
add(*meanrv[
ij(i, j)]);
274 rmsList.
add(*sigmarv[
ij(i, j)]);
276 std::string myrmsName =
Form(
"%s_rms_%d",
GetName(), j);
277 std::string myposName =
Form(
"%s_pos_%d",
GetName(), j);
278 myrms[j] =
new RooAddition(myrmsName.c_str(), myrmsName.c_str(), rmsList, coefList2);
279 mypos[j] =
new RooAddition(myposName.c_str(), myposName.c_str(), meanList, coefList2);
288 for (
Int_t i = 0; i < nPdf; ++i) {
293 std::string pdfName =
Form(
"pdf_%d", i);
296 for (
Int_t j = 0; j < nVar; ++j) {
298 std::string slopeName =
Form(
"%s_slope_%d_%d",
GetName(), i, j);
299 std::string offsetName =
Form(
"%s_offset_%d_%d",
GetName(), i, j);
306 std::string transVarName =
Form(
"%s_transVar_%d_%d",
GetName(), i, j);
311 new RooLinearVar(transVarName.c_str(), transVarName.c_str(), *var, *slope[
ij(i, j)], *offs[
ij(i, j)]);
317 ownedComps.
add(*transVar[
ij(i, j)]);
321 transPdfList.
add(*transPdf[i]);
322 ownedComps.
add(*transPdf[i]);
325 theSumFunc =
new RooRealSumFunc(sumfuncName.c_str(), sumfuncName.c_str(), transPdfList, coefList);
336 std::string trackerName =
Form(
"%s_frac_tracker",
GetName());
340 cache =
new CacheElem(*theSumFunc, *tracker, fracl);
424 double sumposfrac = 0.;
425 for (
Int_t i = 0; i < nPdf; ++i) {
427 for (
Int_t j = 0; j < nPdf; ++j) {
428 ffrac += (*self.
_M)(j, i) * (j == 0 ? 1. :
TMath::Power(dm, (
double)j));
435 ((
RooRealVar *)frac(nPdf + i))->setVal(ffrac);
437 cout << ffrac << endl;
442 int imin = self.
idxmin(self.
m);
443 int imax = self.
idxmax(self.
m);
444 double mfrac = (self.
m - (*self.
_mref)[imin]) / ((*self.
_mref)[imax] - (*self.
_mref)[imin]);
457 for (
Int_t i = 0; i < 2 * nPdf; ++i) ((
RooRealVar *)frac(i))->setVal(0.);
459 ((
RooRealVar *)frac(imin))->setVal(1. - mfrac);
460 ((
RooRealVar *)frac(nPdf + imin))->setVal(1. - mfrac);
462 ((
RooRealVar *)frac(nPdf + imax))->setVal(mfrac);
463 }
else if (imax == imin) {
465 ((
RooRealVar *)frac(nPdf + imin))->setVal(1.);
471 ((
RooRealVar *)frac(imin))->setVal(1. - mfrac);
473 }
else if (imax == imin) {
478 for (
Int_t i = 0; i < nPdf; ++i) {
492 double mmin = -DBL_MAX;
493 for (
Int_t i = 0; i < nPdf; ++i)
494 if ((*
_mref)[i] > mmin && (*
_mref)[i] <= mval) {
506 double mmax = DBL_MAX;
507 for (
Int_t i = 0; i < nPdf; ++i)
508 if ((*
_mref)[i] < mmax && (*
_mref)[i] >= mval) {
TMatrixT< Double_t > TMatrixD
char * Form(const char *fmt,...)
TVectorT< Double_t > TVectorD
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
void addServer(RooAbsArg &server, Bool_t valueProp=kTRUE, Bool_t shapeProp=kFALSE)
Register another RooAbsArg as a server to us, ie, declare that we depend on it.
Bool_t addOwnedComponents(const RooArgSet &comps)
Take ownership of the contents of 'comps'.
void setLocalNoDirtyInhibit(Bool_t flag) const
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
TIterator * createIterator(Bool_t dir=kIterForward) const
RooAbsMoment represents the first, second, or third order derivative of any RooAbsReal as calculated ...
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
const RooArgSet * nset() const
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &, Double_t, Double_t) const
friend class RooRealSumFunc
virtual std::list< Double_t > * binBoundaries(RooAbsRealLValue &, Double_t, Double_t) const
Double_t getVal(const RooArgSet *set=0) const
Evaluate object. Returns either cached value or triggers a recalculation.
virtual Bool_t isBinnedDistribution(const RooArgSet &) const
RooAbsMoment * sigma(RooRealVar &obs)
RooAddition calculates the sum of a set of RooAbsReal terms, or when constructed with two sets,...
RooAbsArg * at(Int_t idx) const
RooArgSet is a container object that can hold multiple RooAbsArg objects.
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
T * getObj(const RooArgSet *nset, Int_t *sterileIndex=0, const TNamed *isetRangeName=0)
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=0)
RooChangeTracker is a meta object that tracks value changes in a given set of RooAbsArgs by registeri...
Bool_t hasChanged(Bool_t clearState)
Returns true if state has changes since last call with clearState=kTRUE If clearState is true,...
RooConstVar represent a constant real-valued object.
void replaceArg(const RooAbsArg &orig, const RooAbsArg &subst)
Replace any occurence of arg 'orig' with arg 'subst'.
RooAbsArg * build(const char *masterCatState, Bool_t verbose=kFALSE)
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...
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Reimplementation of standard RooArgList::add()
void calculateFractions(const RooMomentMorphFunc &self, Bool_t verbose=kTRUE) const
RooRealVar * frac(Int_t i)
RooChangeTracker * _tracker
virtual RooArgList containedArgs(Action)
virtual ~RooMomentMorphFunc()
TIterator * _pdfItr
do not persist
virtual Double_t getVal(const RooArgSet *set=0) const
friend class CacheElem
Current normalization set.
RooArgSet * _curNormSet
The cache manager.
RooObjCacheManager _cacheMgr
CacheElem * getCache(const RooArgSet *nset) const
virtual std::list< Double_t > * binBoundaries(RooAbsRealLValue &, Double_t, Double_t) const
RooAbsReal * sumFunc(const RooArgSet *nset)
Bool_t isBinnedDistribution(const RooArgSet &obs) const
int idxmin(const double &m) const
Double_t evaluate() const
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
Int_t ij(const Int_t &i, const Int_t &j) const
int idxmax(const double &m) const
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const
const RooAbsReal & arg() const
RooRealVar represents a fundamental (non-derived) real valued object.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Overloaded RooArgSet::add() method inserts 'var' into set and registers 'var' as server to owner with...
Iterator abstract base class.
virtual TObject * Next()=0
TMatrixT< Element > & Invert(Double_t *det=0)
Invert the matrix and calculate its determinant.
virtual const char * GetName() const
Returns name of object.
constexpr Double_t PiOver2()
LongDouble_t Power(LongDouble_t x, LongDouble_t y)