Belle II Software development
UnknowVar Struct Reference

variable with uncertainty from boot-strap replicas More...

Public Member Functions

void add (double x)
 add value to the replicas
 
double getMean ()
 Get mean value.
 
double getSigma ()
 Get standard deviation.
 
double getLimit (double v)
 Get quantile (v=0.5 -> median, v=0.16,v=0.84 68% confidence interval)
 
void printStat (TString n)
 Print variable of name n with stat-info.
 
std::vector< double > getStats ()
 Get basic stats.
 

Public Attributes

std::vector< double > vars
 vector of variable values for all replicas
 

Detailed Description

variable with uncertainty from boot-strap replicas

Definition at line 213 of file BeamSpotStandAlone.cc.

Member Function Documentation

◆ add()

void add ( double  x)
inline

add value to the replicas

Definition at line 215 of file BeamSpotStandAlone.cc.

◆ getLimit()

double getLimit ( double  v)
inline

Get quantile (v=0.5 -> median, v=0.16,v=0.84 68% confidence interval)

Definition at line 239 of file BeamSpotStandAlone.cc.

240 {
241 B2ASSERT("Must be at least one replica", vars.size() >= 1);
242 double indx = (vars.size() - 1) * v;
243 sort(vars.begin(), vars.end());
244 int I = indx;
245 double r = indx - I;
246 return vars[I] * (1 - r) + vars[I + 1] * r;
247 }
std::vector< double > vars
vector of variable values for all replicas

◆ getMean()

double getMean ( )
inline

Get mean value.

Definition at line 218 of file BeamSpotStandAlone.cc.

219 {
220 B2ASSERT("Must be at least one replica", vars.size() >= 1);
221 return accumulate(vars.begin(), vars.end(), 0.) / vars.size();
222 }

◆ getSigma()

double getSigma ( )
inline

Get standard deviation.

Definition at line 225 of file BeamSpotStandAlone.cc.

226 {
227 B2ASSERT("Must be at least one replica", vars.size() >= 1);
228 double m = getMean();
229 double s = 0;
230 for (auto x : vars)
231 s += pow(x - m, 2);
232 if (vars.size() > 1)
233 return sqrt(s / (vars.size() - 1));
234 else
235 return 0; //dummy unc. for single replica
236 }
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28

◆ getStats()

std::vector< double > getStats ( )
inline

Get basic stats.

Definition at line 258 of file BeamSpotStandAlone.cc.

259 {
260 return {getLimit(0.50), getLimit(0.16), getLimit(1 - 0.16)};
261 }
double getLimit(double v)
Get quantile (v=0.5 -> median, v=0.16,v=0.84 68% confidence interval)

◆ printStat()

void printStat ( TString  n)
inline

Print variable of name n with stat-info.

Definition at line 250 of file BeamSpotStandAlone.cc.

251 {
252 B2ASSERT("Must be at least one replica", vars.size() >= 1);
253 B2INFO(n << " : " << getMean() << "+-" << getSigma() << " : " << getLimit(0.50) << " (" << getLimit(0.16) << " , " << getLimit(
254 1 - 0.16) << " )");
255 }
double getSigma()
Get standard deviation.

Member Data Documentation

◆ vars

std::vector<double> vars

vector of variable values for all replicas

Definition at line 214 of file BeamSpotStandAlone.cc.


The documentation for this struct was generated from the following file: