60 fAxes.AddAtAndExpand(axis, i);
73 fAxes.AddAtAndExpand(
a.Clone(), i++);
80 const std::vector<std::vector<double>> &xbins)
85 Error(
"THnBase",
"Mismatched number of dimensions %d with number of bin edge vectors %zu", fNdimensions,
89 if (
Int_t(xbins[i].
size()) != (nbins[i] + 1)) {
90 Error(
"THnBase",
"Mismatched number of bins %d with number of bin edges %zu", nbins[i], xbins[i].
size());
92 TAxis *axis =
new TAxis(nbins[i], xbins[i].data());
94 fAxes.AddAtAndExpand(axis, i);
108 fAxes.AddAtAndExpand(axis, i);
133 fAxes.AddAtAndExpand(axis, i);
195 Int_t chunkSize = 1024 * 16;
197 chunkSize = ((
const THnSparse*)
this)->GetChunkSize();
199 ret->Init(
name, title, axes, keepTargetAxis, chunkSize);
213 ::Error(
"THnBase::Init",
"Input parameter `axes` is null, no axes were provided at initialization");
217 const TAxis* axis =
nullptr;
220 while ((axis = (
TAxis*)iAxis())) {
222 ::Error(
"THnBase::Init",
"Input parameter `axes` has a null element in the array, cannot create new axis");
235 Int_t nBins = binLast - binFirst + 1;
247 fAxes.AddAtAndExpand(reqaxis, pos++);
266 Bool_t keepTargetAxis )
const {
268 ::Error(
"THnBase::CreateHist",
"Input parameter `axes` is null, no axes were provided at creation");
271 const int ndim = axes->
GetSize();
276 hist =
new TH1D(
name, title, 1, 0., 1.);
278 hist =
new TH2D(
name, title, 1, 0., 1., 1, 0., 1.);
280 hist =
new TH3D(
name, title, 1, 0., 1., 1, 0., 1., 1, 0., 1.);
282 Error(
"CreateHist",
"Cannot create histogram %s with %d dimensions!",
name, ndim);
288 TAxis* reqaxis = (TAxis*)(*axes)[
d];
290 ::Error(
"THnBase::CreateHist",
"Input parameter `axes` has a null element in the position %d of the array, cannot create new axis",
d);
298 Int_t nBins = binLast - binFirst + 1;
319 while (
auto lb =
static_cast<TObjString *
>(iL())) {
339 ::Error(
"THnBase::CreateHnAny",
"Input parameter `h` is null, no histogram was provided upon creation");
343 int ndim =
h->GetDimension();
346 ::Error(
"THnBase::CreateHnAny",
"Can only handle 1..3 dimensional histograms!");
351 int nbins[3] = {0,0,0};
352 double minRange[3] = {0.,0.,0.};
353 double maxRange[3] = {0.,0.,0.};
354 const TAxis* axis[3] = {
h->GetXaxis(),
h->GetYaxis(),
h->GetZaxis() };
355 for (
int i = 0; i < ndim; ++i) {
357 minRange[i] = axis[i]->
GetXmin();
358 maxRange[i] = axis[i]->
GetXmax();
366 const char* cname(
h->ClassName() );
367 if (cname[0] ==
'T' && cname[1] ==
'H'
368 && cname[2] >=
'1' && cname[2] <=
'3' && cname[4] == 0) {
370#define R__THNBCASE(TAG) \
372s = new _NAME2_(THnSparse,TAG)(name, title, ndim, nbins, \
373minRange, maxRange, chunkSize); \
375s = new _NAME2_(THn,TAG)(name, title, ndim, nbins, \
376minRange, maxRange); \
391 ::Warning(
"THnSparse::CreateHnAny",
"Unknown Type of Histogram");
395 for (
int i = 0; i < ndim; ++i) {
402 ::Warning(
"THnSparse::CreateHnAny",
"Unknown Type of Histogram");
420 ::Error(
"THnBase::CreateHnAny",
"Input parameter `hn` is null, no histogram was provided upon creation");
425 if (sparse) type = hn->
IsA();
435 hn->
Error(
"CreateHnAny",
"Type %s not implemented; please inform the ROOT team!",
442 if (!sparse) type = hn->
IsA();
456 hn->
Error(
"CreateHnAny",
"Unhandled type %s, not deriving from THn nor THnSparse!",
461 hn->
Error(
"CreateHnAny",
"Unhandled type %s, please inform the ROOT team!",
482 ::Error(
"THnBase::Add",
"Input parameter `hist` is null, no histogram was provided");
487 for (
int i = 0; i < nbins; ++i) {
490 if (!value && !error)
continue;
528 if (!fitOption.
Chi2) fitOption.
Like =
true;
549 Error(
"THnBase::GetBinCenter",
550 "Mismatched number of dimensions %d with bin index vector size %zu, returning an empty vector.",
555 std::generate(centers.begin(), centers.end(), [i = 0, &idx,
this]()
mutable {
556 auto bincenter = GetAxis(i)->GetBinCenter(idx[i]);
578 const Int_t nStaticBins = 40;
579 Int_t bin[nStaticBins];
613 if (coord[i] < min || coord[i] > max)
643 Ssiz_t posInsert = title.First(
';');
644 if (posInsert ==
kNPOS) {
645 title +=
" projection ";
649 for (
Int_t d = ndim - 1;
d >= 0; --
d) {
652 title.Insert(posInsert,
", ");
654 title.Insert(posInsert,
" projection ");
666 Bool_t* hadRange =
nullptr;
667 Bool_t ignoreTargetRange = (option && (strchr(option,
'A') || strchr(option,
'a')));
668 Bool_t keepTargetAxis = ignoreTargetRange || (option && (strchr(option,
'O') || strchr(option,
'o')));
669 if (ignoreTargetRange) {
670 hadRange =
new Bool_t[ndim];
683 if (keepTargetAxis) {
697 Bool_t wantErrors = haveErrors || (option && (strchr(option,
'E') || strchr(option,
'e')));
699 if (wantNDim && wantErrors)
705 std::unique_ptr<ROOT::Internal::THnBaseBinIter> iter{
CreateIter(
true )};
707 while ((myLinBin = iter->Next()) >= 0) {
711 bins[
d] = iter->GetCoord(dim[
d]);
715 if (binOffset > 0) --binOffset;
716 bins[
d] -= binOffset;
722 if (ndim == 1) targetLinBin = bins[0];
723 else if (ndim == 2) targetLinBin = hist->
GetBin(bins[0], bins[1]);
724 else if (ndim == 3) targetLinBin = hist->
GetBin(bins[0], bins[1], bins[2]);
756 if (!iter->HaveSkippedBin()) {
796 std::unique_ptr<ROOT::Internal::THnBaseBinIter> iter{
CreateIter(
false)};
797 while ((i = iter->Next()) >= 0) {
816 Warning(
"RebinnedAdd",
"Different number of dimensions, cannot carry out operation on the histograms");
836 std::unique_ptr<ROOT::Internal::THnBaseBinIter> iter{
h->CreateIter(
false)};
839 while ((i = iter->Next(coord)) >= 0) {
842 Double_t err2 = haveErrors ?
h->GetBinError2(i) *
c *
c : 0;
843 if (sparse &&
v == 0 && err2 == 0) {
850 x[j] =
h->GetAxis(j)->GetBinCenter(coord[j]);
922 const TObject* addMeObj =
nullptr;
923 while ((addMeObj = iter())) {
932 while ((addMeObj = iter())) {
935 Error(
"Merge",
"Object named %s is not THnBase! Skipping it.",
960 if (wantErrors)
Sumw2();
966 std::unique_ptr<ROOT::Internal::THnBaseBinIter> iter{
CreateIter(
false)};
968 while ((i = iter->Next(coord)) >= 0) {
974 if (idxh >= 0)
v2 =
h->GetBinContent(idxh);
979 if (idxh >= 0) err2 =
h->GetBinError(idxh) *
v1;
1004 if (wantErrors)
Sumw2();
1007 std::unique_ptr<ROOT::Internal::THnBaseBinIter> iter{
CreateIter(
false)};
1009 while ((i = iter->Next(coord)) >= 0) {
1016 if (!
f->IsInside(
x))
1054 if (wantErrors)
Sumw2();
1060 std::unique_ptr<ROOT::Internal::THnBaseBinIter> iter{
CreateIter(
false)};
1062 while ((i = iter->Next(coord)) >= 0) {
1072 Warning(
"Divide(h)",
"Histogram h has empty bins - division by zero! Setting bin to 0.");
1081 Double_t err = (err1 * err1 + err2 * err2) / (b22 * b22);
1109 Error(
"Divide",
"Coefficient of dividing histogram cannot be zero");
1129 std::unique_ptr<ROOT::Internal::THnBaseBinIter> iter{
h1->CreateIter(
false)};
1131 while ((i = iter->Next(coord)) >= 0) {
1141 Warning(
"Divide(h1, h2)",
"Histogram h2 has empty bins - division by zero! Setting bin to 0.");
1156 errSq =
TMath::Abs( ( (1. - 2.*w) * err1 * err1 + err2 * err2 ) / (
v2 *
v2) );
1164 errSq =
c1 *
c2 * (err1 * err1 + err2 * err2) / (b22 * b22);
1183 Warning(tag,
"Different number of dimensions, cannot carry out operation on the histograms");
1188 Warning(tag,
"Different number of bins on axis %i, cannot carry out operation on the histograms", dim);
1211 fTitle.ReplaceAll(
"#semicolon", 10,
";", 1);
1215 while(titleStr.
Tokenize(axisTitle, from,
";")) {
1217 ::Error(
"THnBase::SetTitle",
"Trying to assign a title to axis %d for a %d-dimensional histogram.", dim + 1,
fNdimensions);
1220 if (overrideAxesTitle || (strlen(
GetAxis(dim)->
GetTitle()) == 0 && !overrideAxesTitle)) {
1273 Ssiz_t posInsert = title.First(
';');
1274 if (posInsert ==
kNPOS) {
1279 for (
Int_t d = ndim - 1;
d >= 0; --
d)
1281 title.Insert(posInsert,
" rebin ");
1294 for (
Int_t i = 0; i < newbins + 1; ++i)
1297 else edges[i] = newaxis->
GetXmax();
1298 newaxis->
Set(newbins, edges);
1308 Bool_t wantErrors = haveErrors;
1314 std::unique_ptr<ROOT::Internal::THnBaseBinIter> iter{
CreateIter(
false)};
1315 while ((i = iter->Next(coord)) >= 0) {
1328 h->AddBinContent(idxh,
v);
1364 std::unique_ptr<ROOT::Internal::THnBaseBinIter> iter{
CreateIter(respectAxisRange)};
1366 while ((myLinBin = iter->Next()) >= 0) {
1391 Error(
"ComputeIntegral",
"The histogram must have at least one bin.");
1402 std::unique_ptr<ROOT::Internal::THnBaseBinIter> iter{
CreateIter(
false)};
1403 while ((i = iter->Next(coord)) >= 0) {
1407 bool regularBin =
true;
1416 if (!regularBin)
v = 0.;
1424 Error(
"ComputeIntegral",
"Integral = 0, no hits in histogram bins (excluding over/underflow).");
1473 if (
v == 0. &&
err == 0. && options && strchr(options,
'0')) {
1503 if (from < 0) from = 0;
1504 if (howmany == -1) howmany =
GetNbins();
1508 if (options && (strchr(options,
'x') || strchr(options,
'X'))) {
1512 bin[dim] = from % nbins[dim];
1516 for (
Long64_t i = 0; i < howmany; ++i) {
1517 if (!
PrintBin(-1, bin, options) || !strchr(options,
'0'))
1523 if (bin[dim] >= nbins[dim] + 2) {
1535 for (
Long64_t i = from; i < from + howmany; ++i) {
1553 Bool_t optAxis = options && (strchr(options,
'A') || (strchr(options,
'a')));
1554 Bool_t optMem = options && (strchr(options,
'M') || (strchr(options,
'm')));
1555 Bool_t optStat = options && (strchr(options,
'S') || (strchr(options,
's')));
1556 Bool_t optContent = options && (strchr(options,
'C') || (strchr(options,
'c')));
1564 Printf(
" axis %d \"%s\": %d bins (%g..%g), %s bin sizes", dim,
1566 (axis->
GetXbins() ?
"variable" :
"fixed"));
1582 Printf(
" coordinates stored in %d chunks of %d entries\n %g of bins filled using %g of memory compared to an array",
1652 axisName = TString::Format(
"axis%d", axis);
1676 fProj->Draw(
b ?
b->GetDrawOption() :
"");
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int).
int Ssiz_t
String size (currently int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
long long Long64_t
Portable signed long integer 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.
class describing the range in the coordinates it supports multiple range in a coordinate.
void AddRange(unsigned int icoord, double xmin, double xmax)
add a range [xmin,xmax] for the new coordinate icoord Adding a range does not delete existing one,...
virtual ~THnBaseBinIter()
Destruct a bin iterator.
TBrowser helper for THnBase.
~THnBaseBrowsable() override
Destruct a THnBaseBrowsable.
THnBaseBrowsable(THnBase *hist, Int_t axis)
Construct a THnBaseBrowsable.
void Browse(TBrowser *b) override
Browse an axis of a THnBase, i.e. draw its projection.
Double_t At(Int_t i) const
const Double_t * GetArray() const
Abstract array base class.
Class to manage histogram axis.
virtual void SetBinLabel(Int_t bin, const char *label)
Set label for bin.
const char * GetTitle() const override
Returns title of object.
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
const TArrayD * GetXbins() const
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
virtual void Set(Int_t nbins, Double_t xmin, Double_t xmax)
Initialize axis with fix bins.
Int_t GetLast() const
Return last bin on the axis i.e.
virtual void SetRange(Int_t first=0, Int_t last=0)
Set the viewing range for the axis using bin numbers.
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Int_t GetFirst() const
Return first bin on the axis i.e.
THashList * GetLabels() const
Using a TBrowser one can browse all ROOT objects.
TClass instances represent classes, structs and namespaces in the ROOT type system.
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Collection abstract base class.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
static void RejectPoint(Bool_t reject=kTRUE)
Provides an indirection to the TFitResult class and with a semantics identical to a TFitResult pointe...
1-D histogram with a double per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
virtual Double_t GetEffectiveEntries() const
Number of effective entries of the histogram.
virtual void Rebuild(Option_t *option="")
Using the current bin info, recompute the arrays for contents and errors.
virtual Double_t GetBinError(Int_t bin) const
Return value of error associated to bin number bin.
static Int_t FitOptionsMake(Option_t *option, Foption_t &Foption)
Decode string choptin and fill fitOption structure.
virtual void GetBinXYZ(Int_t binglobal, Int_t &binx, Int_t &biny, Int_t &binz) const
Return binx, biny, binz corresponding to the global bin number globalbin see TH1::GetBin function abo...
virtual Int_t GetNcells() const
virtual Int_t GetBin(Int_t binx, Int_t biny=0, Int_t binz=0) const
Return Global bin number corresponding to binx,y,z.
virtual void SetBinError(Int_t bin, Double_t error)
Set the bin Error Note that this resets the bin eror option to be of Normal Type and for the non-empt...
virtual void ResetStats()
Reset the statistics including the number of entries and replace with values calculated from bin cont...
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual void AddBinContent(Int_t bin)=0
Increment bin content by 1.
virtual void SetEntries(Double_t n)
2-D histogram with a double per channel (see TH1 documentation)
3-D histogram with a double per channel (see TH1 documentation)
Multidimensional histogram base.
virtual ROOT::Internal::THnBaseBinIter * CreateIter(Bool_t respectAxisRange) const =0
void SetEntries(Double_t entries)
virtual void SetFilledBins(Long64_t)
void Browse(TBrowser *b) override
Browse a THnSparse: create an entry (ROOT::THnSparseBrowsable) for each dimension.
virtual void InitStorage(Int_t *nbins, Int_t chunkSize)=0
Double_t GetBinError(const Int_t *idx) const
void SetBinError(const Int_t *idx, Double_t e)
Double_t fEntries
Number of entries, spread over chunks.
Double_t GetSumw2() const
Bool_t IsInRange(Int_t *coord) const
Check whether bin coord is in range, as defined by TAxis::SetRange().
enum THnBase::@366367013115141032213255324241017243103266117157 fIntegralStatus
! status of integral
TFitResultPtr Fit(TF1 *f1, Option_t *option="", Option_t *goption="")
Fit a THnSparse with function f.
void AddBinContent(const Int_t *x, Double_t v=1.)
void Scale(Double_t c)
Scale contents and errors of this histogram by c: this = this * c It does not modify the histogram's ...
virtual void SetBinError2(Long64_t bin, Double_t e2)=0
TObjArray * GetListOfAxes()
TH1 * CreateHist(const char *name, const char *title, const TObjArray *axes, Bool_t keepTargetAxis) const
Create an empty histogram with name and title with a given set of axes.
Bool_t PrintBin(Long64_t idx, Int_t *coord, Option_t *options) const
Print one bin.
Double_t GetSumwx(Int_t dim) const
Bool_t CheckConsistency(const THnBase *h, const char *tag) const
Consistency check on (some of) the parameters of two histograms (for operations).
Int_t GetNdimensions() const
~THnBase() override
Destruct a THnBase.
static THnBase * CreateHnAny(const char *name, const char *title, const TH1 *h1, Bool_t sparse, Int_t chunkSize=1024 *16)
Create a THn / THnSparse object from a histogram deriving from TH1.
TArrayD fTsumwx2
Total sum of weight*X*X for each dimension.
void ResetBase(Option_t *option="")
Clear the histogram.
virtual Long64_t GetNbins() const =0
THnBase * RebinBase(Int_t group) const
Combine the content of "group" neighboring bins into a new bin and return the resulting THnBase.
TClass * IsA() const override
TObjArray fAxes
Axes of the histogram.
void SetBinEdges(Int_t idim, const Double_t *bins)
Set the axis # of bins and bin limits on dimension idim.
Bool_t GetCalculateErrors() const
void AddInternal(const THnBase *h, Double_t c, Bool_t rebinned)
Add() implementation for both rebinned histograms and those with identical binning.
void SetTitle(const char *title) override
Change (i.e.
void PrintEntries(Long64_t from=0, Long64_t howmany=-1, Option_t *options=nullptr) const
Print "howmany" entries starting at "from".
Double_t GetBinContent(const Int_t *idx) const
void Add(const THnBase *h, Double_t c=1.)
Add contents of h scaled by c to this histogram: this = this + c * h Note that if h has Sumw2 set,...
Double_t fTsumw2
Total sum of weights squared; -1 if no errors are calculated.
virtual void Reserve(Long64_t)
Double_t GetEntries() const
std::vector< Double_t > GetBinCenter(const std::vector< Int_t > &idx) const
THnBase::GetBinCenter.
virtual Double_t GetBinError2(Long64_t linidx) const =0
virtual void Reset(Option_t *option="")=0
void SetBinContent(const Int_t *idx, Double_t v)
void Multiply(const THnBase *h)
Multiply this histogram by histogram h this = this * h Note that if h has Sumw2 set,...
Double_t Integral(Bool_t respectAxisRange) const
Compute integral (sum of counts) of histogram in all dimensions.
void Divide(const THnBase *h)
Divide this histogram by h this = this/(h) Note that if h has Sumw2 set, Sumw2 is automatically calle...
void Print(Option_t *option="") const override
Print a THnBase.
Double_t GetSumwx2(Int_t dim) const
TObjArray fBrowsables
! Browser-helpers for each axis
TObject * ProjectionAny(Int_t ndim, const Int_t *dim, Bool_t wantNDim, Option_t *option="") const
Project all bins into a ndim-dimensional THn / THnSparse (whatever *this is) or if (ndim < 4 and !...
void GetRandom(Double_t *rand, Bool_t subBinRandom=kTRUE)
Generate an n-dimensional random tuple based on the histogrammed distribution.
TAxis * GetAxis(Int_t dim) const
THnBase * CloneEmpty(const char *name, const char *title, const TObjArray *axes, Bool_t keepTargetAxis) const
Create a new THnBase object that is of the same type as *this, but with dimensions and bins given by ...
Long64_t Merge(TCollection *list)
Merge this with a list of THnBase's.
Double_t fTsumw
Total sum of weights.
virtual Long64_t GetBin(const Int_t *idx) const =0
Double_t ComputeIntegral()
Compute integral (normalized cumulative sum of bins) w/o under/overflows The result is stored in fInt...
virtual void AddBinError2(Long64_t bin, Double_t e2)=0
void RebinnedAdd(const THnBase *h, Double_t c=1.)
Add contents of h scaled by c to this histogram: this = this + c * h Note that if h has Sumw2 set,...
void SetTitleImpl(const char *title, bool overrideAxesTitle)
Int_t fNdimensions
Number of dimensions.
void Init(const char *name, const char *title, const TObjArray *axes, Bool_t keepTargetAxis, Int_t chunkSize=1024 *16)
Initialize axes and name.
THnBase & operator=(const THnBase &other)
std::vector< Double_t > fIntegral
! vector with bin weight sums
TArrayD fTsumwx
Total sum of weight*X for each dimension.
ROOT::Internal::THnBaseBinIter * fIter
Efficient multidimensional histogram.
Double_t GetSparseFractionBins() const
Return the amount of filled bins over all bins.
Double_t GetSparseFractionMem() const
Return the amount of used memory over memory that would be used by a non-sparse n-dimensional histogr...
Int_t GetChunkSize() const
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
virtual void SetName(const char *name)
Set the name of the TNamed.
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
virtual void SetNameTitle(const char *name, const char *title)
Set all the TNamed parameters (name and title).
Int_t GetEntriesFast() const
void AddAt(TObject *obj, Int_t idx) override
Add object at position ids.
void Clear(Option_t *option="") override
Remove all objects from the array.
TObject * At(Int_t idx) const override
Bool_t TestBit(UInt_t f) const
virtual const char * GetName() const
Returns name of object.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
TObject()
TObject constructor.
void ToLower()
Change string to lower-case.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
TString & Remove(Ssiz_t pos)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
TFitResultPtr FitObject(TH1 *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
fitting function for a TH1 (called from TH1::Fit)
Double_t Floor(Double_t x)
Rounds x downward, returning the largest integral value that is not greater than x.
Double_t Sqrt(Double_t x)
Returns the square root of x.
Int_t CeilNint(Double_t x)
Returns the nearest integer of TMath::Ceil(x).
Long64_t BinarySearch(Long64_t n, const T *array, T value)
Binary search in an array of n values to locate value.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
static uint64_t sum(uint64_t i)