260 Error(
"Add",
"Function not implemented for TProfile");
271 Error(
"Add",
"Attempt to add a non-existing profile");
275 Error(
"Add",
"Attempt to add a non-profile object");
293 Error(
"Add",
"Attempt to add a non-existing profile");
297 Error(
"Add",
"Attempt to add a non-profile object");
301 Error(
"Add",
"Attempt to add a non-profile object");
339 if (!nbentries)
return 0;
342 if (action == 0)
return 0;
343 nbentries = -nbentries;
352 for (
Int_t i=1;i<nbentries;i++) {
371 for (
Int_t i=0;i<nbentries;i++) {
372 Fill(buffer[3*i+2],buffer[3*i+3],buffer[3*i+1]);
397 nbentries = -nbentries;
426 for (
int bin=0;bin<
fNcells;bin++) {
439 Fatal(
"Copy",
"Cannot copy a TProfile in a %s",obj.IsA()->
GetName());
451 Error(
"Divide",
"Function not implemented for TProfile");
467 Error(
"Divide",
"Attempt to divide a non-existing profile");
471 Error(
"Divide",
"Attempt to divide by a non-profile or non-histogram object");
483 Error(
"Divide",
"Attempt to divide profiles with different number of bins");
500 for (bin=0;bin<=nbinsx+1;bin++) {
502 if (cu1)
c1 = cu1[bin];
517 if (er1) e1 = er1[bin];
529 Warning(
"Divide",
"Cannot preserve during the division of profiles the sum of bin weight square");
550 Error(
"Divide",
"Attempt to divide a non-existing profile");
554 Error(
"Divide",
"Attempt to divide a non-profile object");
559 Error(
"Divide",
"Attempt to divide by a non-profile object");
570 Error(
"Divide",
"Attempt to divide profiles with different number of bins");
574 Error(
"Divide",
"Coefficient of dividing profile cannot be zero");
579 printf(
"WARNING!!: The algorithm in TProfile::Divide computing the errors is not accurate\n");
580 printf(
" Instead of Divide(TProfile *h1, TProfile *h2), do:\n");
581 printf(
" TH1D *p1 = h1->ProjectionX();\n");
582 printf(
" TH1D *p2 = h2->ProjectionX();\n");
583 printf(
" p1->Divide(p2);\n");
601 for (bin=0;bin<=nbinsx+1;bin++) {
604 if (b2) w =
c1*b1/(
c2*b2);
626 fSumw2.
fArray[bin] = ac1*ac2*(e1*b2*b2 + e2*b1*b1)/(b22*b22);
636 Warning(
"Divide",
"Cannot preserve during the division of profiles the sum of bin weight square");
780 for (i=0;i<ntimes;i+=stride) {
792 for (i=ifirst;i<ntimes;i+=stride) {
824 if (bin < 0 || bin >=
fNcells)
return 0;
837 if (bin < 0 || bin >=
fNcells)
return 0;
928 for (bin=0;bin<6;bin++) stats[bin] = 0;
934 if (firstBinX == 1) firstBinX = 0;
937 for (binx = firstBinX; binx <= lastBinX; binx++) {
1001 Warning(
"LabelsOption",
"Cannot sort. No labels");
1034 if (sort < 0)
return;
1043 Int_t lastLabelBin = -1;
1044 for (
Int_t i = 0; i <
n; ++i) {
1046 if (bin < firstLabelBin)
1047 firstLabelBin = bin;
1048 if (bin > lastLabelBin)
1051 if (firstLabelBin != 1 || lastLabelBin - firstLabelBin + 1 !=
n) {
1052 Error(
"LabelsOption",
1053 "%s of TProfile %s contains bins without labels. Sorting will not work correctly - return",
1060 "axis %s of TProfile %s has extra following bins without labels. Sorting will work only for first label bins",
1063 std::vector<Int_t>
a(
n);
1065 std::vector<Double_t> cont(
n);
1066 std::vector<Double_t> sumw(
n);
1067 std::vector<Double_t> errors(
n);
1068 std::vector<Double_t> ent(
n);
1069 std::vector<Double_t> binsw2;
1078 std::vector<TObject *> labold(
n);
1079 for (i = 0; i <
n; i++)
1080 labold[i] =
nullptr;
1081 TIter nextold(labels);
1083 while ((obj=nextold())) {
1086 labold[bin - 1] = obj;
1093 for (i=1;i<=
n;i++) {
1106 for (i=1;i<=
n;i++) {
1113 for (i=0 ;i <
n; i++) {
1123 std::vector<std::string> vecLabels(
n);
1124 for (i = 0; i <
n; i++) {
1125 vecLabels[i] = labold[i]->GetName();
1136 for (i = 0; i <
n; i++) {
1138 labels->
Add(labelObj);
1142 std::cout <<
"bin " << i + 1 <<
" setting new labels for axis " << labold.at(
a[i])->GetName() <<
" from "
1143 <<
a[i] << std::endl;
1146 for (i=0; i <
n; i++) {
1156 bool labelsAreSorted =
kFALSE;
1157 for (i = 0; i <
n; ++i) {
1159 labelsAreSorted =
kTRUE;
1163 if (labelsAreSorted) {
1202 Error(
"Multiply",
"Attempt to multiply by a null function");
1212 for (i=0;i<10;i++) {
s1[i] = 0;}
1220 for (bin=0;bin<=nbinsx+1;bin++) {
1242 Error(
"Multiply",
"Multiplication of profile histograms not implemented");
1254 Error(
"Multiply",
"Multiplication of profile histograms not implemented");
1288 if (pname ==
"_px") {
1294 if (bins->
fN == 0) {
1311 for (
Int_t bin =0;bin<=nx+1;bin++) {
1315 else if (binWeight) cont =
fArray[bin];
1411 if ((ngroup <= 0) || (ngroup > nbins)) {
1412 Error(
"Rebin",
"Illegal value of ngroup=%d",ngroup);
1415 if (!newname && xbins) {
1416 Error(
"Rebin",
"if xbins is specified, newname must be given");
1420 Int_t newbins = nbins/ngroup;
1422 Int_t nbg = nbins/ngroup;
1423 if (nbg*ngroup != nbins) {
1424 Warning(
"Rebin",
"ngroup=%d must be an exact divider of nbins=%d",ngroup,nbins);
1447 for (bin=0;bin<=nbins+1;bin++) {
1448 oldBins[bin] = cu1[bin];
1449 oldCount[bin] = en1[bin];
1450 oldErrors[bin] = er1[bin];
1451 if (ew1 &&
fBinSumw2.
fN) oldBinw2[bin] = ew1[bin];
1456 if ((newname && strlen(newname) > 0) || xbins) {
1462 if(!xbins && (newbins*ngroup != nbins)) {
1495 Int_t oldbin = startbin;
1496 Double_t binContent, binCount, binError, binSumw2;
1497 for (bin = 1;bin<=newbins;bin++) {
1504 Int_t imax = ngroup;
1506 for (i=0;i<ngroup;i++) {
1507 if((hnew ==
this && (oldbin+i > nbins)) ||
1514 binContent += oldBins[oldbin+i];
1515 binCount += oldCount[oldbin+i];
1516 binError += oldErrors[oldbin+i];
1520 cu2[bin] = binContent;
1521 er2[bin] = binError;
1522 en2[bin] = binCount;
1531 for(i=0;i<startbin;i++)
1533 binContent += oldBins[i];
1534 binCount += oldCount[i];
1535 binError += oldErrors[i];
1538 hnew->
fArray[0] = binContent;
1540 hnew->
fSumw2[0] = binError;
1548 for(i=oldbin;i<=nbins+1;i++)
1550 binContent += oldBins[i];
1551 binCount += oldCount[i];
1552 binError += oldErrors[i];
1555 hnew->
fArray[newbins+1] = binContent;
1557 hnew->
fSumw2[newbins+1] = binError;
1563 delete [] oldErrors;
1564 if (oldBinw2)
delete [] oldBinw2;
1623 if (i != 0) out <<
", ";
1626 out <<
"}; " << std::endl;
1630 out<<
" "<<std::endl;
1635 static Int_t hcounter = 0;
1640 histName += hcounter;
1642 const char *hname = histName.
Data();
1655 for (bin=0;bin<
fNcells;bin++) {
1658 out<<
" "<<hname<<
"->SetBinEntries("<<bin<<
","<<bi<<
");"<<std::endl;
1662 for (bin=0;bin<
fNcells;bin++) {
1665 out<<
" "<<hname<<
"->SetBinContent("<<bin<<
","<<bc<<
");"<<std::endl;
1670 for (bin=0;bin<
fNcells;bin++) {
1673 out<<
" "<<hname<<
"->SetBinError("<<bin<<
","<<be<<
");"<<std::endl;
1741 if (buffersize <= 0) {
1745 if (buffersize < 100) buffersize = 100;
1781void TProfile::Streamer(
TBuffer &R__b)
1791 TH1D::Streamer(R__b);
Array of doubles (64 bits per element).
void Copy(TArrayD &array) const
TArrayD()
Default TArrayD ctor.
Class to manage histogram axis.
virtual void SetBinLabel(Int_t bin, const char *label)
Set label for bin.
Bool_t IsAlphanumeric() const
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
const TArrayD * GetXbins() const
virtual Int_t FindBin(Double_t x)
Find bin number corresponding to abscissa x.
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 ImportAttributes(const TAxis *axis)
Copy axis attributes to this.
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
Buffer base class used for serializing objects.
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
Collection abstract base class.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
static void RejectPoint(Bool_t reject=kTRUE)
Static function to set the global flag to reject points the fgRejectPoint global flag is tested by al...
virtual Double_t EvalPar(const Double_t *x, const Double_t *params=0)
Evaluate function with given coordinates and parameters.
static Bool_t RejectedPoint()
See TF1::RejectPoint above.
virtual Bool_t IsInside(const Double_t *x) const
return kTRUE if the point is inside the function range
1-D histogram with a double per channel (see TH1 documentation)}
virtual void Copy(TObject &hnew) const
Copy this to newth1.
virtual void AddBinContent(Int_t bin)
Increment bin content by 1.
virtual void SetBinsLength(Int_t n=-1)
Set total number of bins including under/overflow Reallocate bin contents array.
TH1 is the base class of all histogram classes in ROOT.
Double_t * fBuffer
[fBufferSize] entry buffer
Int_t fNcells
number of bins(1D), cells (2D) +U/Overflows
Double_t fTsumw
Total Sum of weights.
Double_t fTsumw2
Total Sum of squares of weights.
Double_t fTsumwx2
Total Sum of weight*X*X.
virtual Double_t GetBinError(Int_t bin) const
Return value of error associated to bin number bin.
@ kIsNotW
Histogram is forced to be not weighted even when the histogram is filled with weighted different than...
virtual Bool_t CanExtendAllAxes() const
Returns true if all axes are extendable.
TDirectory * fDirectory
!Pointer to directory holding this histogram
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
TObject * Clone(const char *newname=0) const
Make a complete copy of the underlying object.
virtual Int_t GetNbinsX() const
virtual void SetMaximum(Double_t maximum=-1111)
Int_t fBufferSize
fBuffer size
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 SavePrimitiveHelp(std::ostream &out, const char *hname, Option_t *option="")
Helper function for the SavePrimitive functions from TH1 or classes derived from TH1,...
virtual void SetMinimum(Double_t minimum=-1111)
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
Double_t fEntries
Number of entries.
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual TArrayD * GetSumw2()
TAxis fXaxis
X axis descriptor.
TArrayD fSumw2
Array of sum of squares of weights.
Bool_t GetStatOverflowsBehaviour() const
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
virtual void SetEntries(Double_t n)
Double_t fTsumwx
Total Sum of weight*X.
static THLimitsFinder * GetLimitsFinder()
Return pointer to the current finder.
virtual Int_t FindGoodLimits(TH1 *h, Double_t xmin, Double_t xmax)
Compute the best axis limits for the X axis.
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
void Clear(Option_t *option="")
Remove all objects from the list.
virtual void Add(TObject *obj)
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
Collectable string class.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual UInt_t GetUniqueID() const
Return the unique object id.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
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.
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
static void LabelsInflate(T *p, Option_t *)
static Double_t GetBinError(T *p, Int_t bin)
static T * ExtendAxis(T *p, Double_t x, TAxis *axis)
static void Sumw2(T *p, Bool_t flag)
static void SetBinEntries(T *p, Int_t bin, Double_t w)
static void Scale(T *p, Double_t c1, Option_t *option)
static void SetErrorOption(T *p, Option_t *opt)
static Long64_t Merge(T *p, TCollection *list)
static void BuildArray(T *p)
static Bool_t Add(T *p, const TH1 *h1, const TH1 *h2, Double_t c1, Double_t c2=1)
static Double_t GetBinEffectiveEntries(T *p, Int_t bin)
static void LabelsDeflate(T *p, Option_t *)
virtual Double_t GetBinEffectiveEntries(Int_t bin) const
Return bin effective entries for a weighted filled Profile histogram.
virtual Long64_t Merge(TCollection *list)
Merge all histograms in the collection in this histogram.
static Bool_t fgApproximate
virtual Int_t BufferFill(Double_t, Double_t)
accumulate arguments in buffer.
void BuildOptions(Double_t ymin, Double_t ymax, Option_t *option)
Set Profile histogram structure and options.
virtual void Copy(TObject &hnew) const
Copy a Profile histogram to a new profile histogram.
virtual void LabelsDeflate(Option_t *axis="X")
Reduce the number of bins for this axis to the number of bins having a label.
virtual Bool_t Multiply(TF1 *h1, Double_t c1=1)
Performs the operation: this = this*c1*f1.
virtual void ExtendAxis(Double_t x, TAxis *axis)
Profile histogram is resized along x axis such that x is in the axis range.
virtual void LabelsOption(Option_t *option="h", Option_t *axis="X")
Set option(s) to draw axis with labels.
virtual void PutStats(Double_t *stats)
Replace current statistics with the values in array stats.
virtual void SetBuffer(Int_t buffersize, Option_t *option="")
Set the buffer size in units of 8 bytes (double).
virtual void SetBinEntries(Int_t bin, Double_t w)
Set the number of entries in bin.
TH1D * ProjectionX(const char *name="_px", Option_t *option="e") const
Project this profile into a 1-D histogram along X.
virtual void SetErrorOption(Option_t *option="")
Set option to compute profile errors.
virtual Double_t GetBinEntries(Int_t bin) const
Return bin entries of a Profile histogram.
virtual Bool_t Add(TF1 *h1, Double_t c1=1, Option_t *option="")
Performs the operation: this = this + c1*f1.
TProfile()
Default constructor for Profile histograms.
virtual Double_t GetBinError(Int_t bin) const
Return bin error of a Profile histogram.
TH1 * Rebin(Int_t ngroup=2, const char *newname="", const Double_t *xbins=0)
Rebin this profile grouping ngroup bins together.
void FillN(Int_t, const Double_t *, const Double_t *, Int_t)
Fill this histogram with an array x and weights w.
virtual Int_t BufferEmpty(Int_t action=0)
Fill histogram with all entries in the buffer.
virtual void SetBinsLength(Int_t n=-1)
Set total number of bins including under/overflow.
TProfile & operator=(const TProfile &profile)
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this profile by a constant c1.
virtual Double_t GetBinContent(Int_t bin) const
Return bin content of a Profile histogram.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Int_t Fill(const Double_t *v)
Double_t fTsumwy
True when TProfile::Scale is called.
virtual void Sumw2(Bool_t flag=kTRUE)
Create/delete structure to store sum of squares of weights per bin.
void SetBins(const Int_t *nbins, const Double_t *range)
static void Approximate(Bool_t approx=kTRUE)
Static function to set the fgApproximate flag.
virtual ~TProfile()
Default destructor for Profile histograms.
virtual Bool_t Divide(TF1 *h1, Double_t c1=1)
Performs the operation: this = this/(c1*f1).
virtual void LabelsInflate(Option_t *axis="X")
Double the number of bins for axis.
virtual void GetStats(Double_t *stats) const
fill the array stats from the contents of this profile.
Option_t * GetErrorOption() const
Return option to compute profile errors.
void ToLower()
Change string to lower-case.
const char * Data() const
void ToUpper()
Change string to upper case.
TString & Append(const char *cs)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Double_t Sqrt(Double_t x)
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)