33 : fName(
name), fN(0), fW(0.), fW2(0.), fM(0.), fM2(0.)
36 for (
Int_t i = 0; i <
n; i++) {
83 Warning(
"Fill",
"Sum of weights is zero - ignore current data point");
89 fM2 += w * rr * rr / (tW *
fW);
102 Printf(
" OBJ: TStatistic\t %s = %.5g +- %.4g \t RMS = %.5g \t N = %lld",
122 std::vector<TStatistic*> statPtrs;
123 if (this->
fN != 0LL) statPtrs.push_back(
this);
126 if ((statPtr =
dynamic_cast<TStatistic *
>(o)) && statPtr->
fN != 0LL) {
127 statPtrs.push_back(statPtr);
132 const auto nStatsPtrs = statPtrs.size();
135 if (nStatsPtrs == 0)
return 0;
139 auto firstStatPtr = statPtrs[0];
140 auto N = firstStatPtr->fN;
141 auto M = firstStatPtr->fM;
142 auto M2 = firstStatPtr->fM2;
143 auto W = firstStatPtr->fW;
144 auto W2 = firstStatPtr->fW2;
145 for (
auto i = 1U; i < nStatsPtrs; ++i) {
146 auto c = statPtrs[i];
147 double temp = (
c->fW) / (W)*M -
c->fM;
148 M2 +=
c->fM2 + W / (
c->fW * (
c->fW + W)) * temp * temp;
#define templateClassImp(name)
void Printf(const char *fmt,...)
Collection abstract base class.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
Statistical variable, defined by its mean and variance (RMS).
TString fName
Name given to the TStatistic object.
~TStatistic()
TStatistic destructor.
Double_t GetMeanErr() const
Double_t fW2
Sum of squared weights.
Double_t fW
Sum of weights.
TStatistic(const char *name="")
void Fill(Double_t val, Double_t w=1.)
Increment the entries in the object by one value-weight pair.
void Print(Option_t *="") const
Print the content of the object.
Double_t fM
Sum of elements (i.e. sum of (val * weight) pairs.
Double_t fM2
Second order momentum.
Int_t Merge(TCollection *in)
Merge implementation of TStatistic.
Long64_t fN
Number of fills.
const char * Data() const
void CallRecursiveRemoveIfNeeded(TObject &obj)
call RecursiveRemove for obj if gROOT is valid and obj.TestBit(kMustCleanup) is true.