39 for (
Int_t i = 0; i <
n; i++) {
96 Warning(
"Fill",
"Sum of weights is zero - ignore current data point");
103 fM2 += w * rr * rr / (tW *
fW);
116 Printf(
" OBJ: TStatistic\t %s \t Mean = %.5g +- %.4g \t RMS = %.5g \t Count = %lld \t Min = %.5g \t Max = %.5g",
139 std::vector<TStatistic*> statPtrs;
140 if (this->
fN != 0LL) statPtrs.push_back(
this);
143 if ((statPtr =
dynamic_cast<TStatistic *
>(o)) && statPtr->
fN != 0LL) {
144 statPtrs.push_back(statPtr);
149 const auto nStatsPtrs = statPtrs.size();
152 if (nStatsPtrs == 0)
return 0;
156 auto firstStatPtr = statPtrs[0];
157 auto N = firstStatPtr->fN;
158 auto M = firstStatPtr->fM;
159 auto M2 = firstStatPtr->fM2;
160 auto W = firstStatPtr->fW;
161 auto W2 = firstStatPtr->fW2;
162 auto Min = firstStatPtr->fMin;
163 auto Max = firstStatPtr->fMax;
164 for (
auto i = 1U; i < nStatsPtrs; ++i) {
165 auto c = statPtrs[i];
166 double temp = (
c->fW) / (W)*M -
c->fM;
167 M2 +=
c->fM2 + W / (
c->fW * (
c->fW + W)) * temp * temp;
172 Min = (
c->fMin < Min) ?
c->fMin : Min;
173 Max = (
c->fMax > Max) ?
c->fMax : Max;
int Int_t
Signed integer 4 bytes (int).
double Double_t
Double 8 bytes.
const char Option_t
Option string (const char).
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
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.
TString fName
Name given to the TStatistic object.
Double_t GetMeanErr() const
Double_t fW2
Sum of squared weights.
~TStatistic() override
TStatistic destructor.
void Print(Option_t *="") const override
Print the content of the object.
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.
Double_t fMin
Minimum value in the TStatistic object.
Double_t fMax
Maximum value in the TStatistic 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.
void CallRecursiveRemoveIfNeeded(TObject &obj)
call RecursiveRemove for obj if gROOT is valid and obj.TestBit(kMustCleanup) is true.