116 :
TH1D(name,title,nbins,xlow,xup)
127 :
TH1D(name,title,nbins,xbins)
138 :
TH1D(name,title,nbins,xbins)
150 :
TH1D(name,title,nbins,xbins)
167 :
TH1D(name,title,nbins,xlow,xup)
242 Error(
"Add",
"Function not implemented for TProfile");
253 Error(
"Add",
"Attempt to add a non-existing profile");
257 Error(
"Add",
"Attempt to add a non-profile object");
274 Error(
"Add",
"Attempt to add a non-existing profile");
278 Error(
"Add",
"Attempt to add a non-profile object");
282 Error(
"Add",
"Attempt to add a non-profile object");
317 if (!nbentries)
return 0;
320 if (action == 0)
return 0;
321 nbentries = -nbentries;
330 for (
Int_t i=1;i<nbentries;i++) {
332 if (x < xmin) xmin =
x;
333 if (x > xmax) xmax =
x;
349 for (
Int_t i=0;i<nbentries;i++) {
350 Fill(buffer[3*i+2],buffer[3*i+3],buffer[3*i+1]);
374 nbentries = -nbentries;
403 for (
int bin=0;bin<
fNcells;bin++) {
416 Fatal(
"Copy",
"Cannot copy a TProfile in a %s",obj.IsA()->
GetName());
428 Error(
"Divide",
"Function not implemented for TProfile");
442 Error(
"Divide",
"Attempt to divide a non-existing profile");
446 Error(
"Divide",
"Attempt to divide by a non-profile or non-histogram object");
458 Error(
"Divide",
"Attempt to divide profiles with different number of bins");
475 for (bin=0;bin<=nbinsx+1;bin++) {
477 if (cu1) c1 = cu1[bin];
492 if (er1) e1 = er1[bin];
496 else fSumw2.
fArray[bin] = (e0*c1*c1 + e1*c0*c0)/(c12*c12);
504 Warning(
"Divide",
"Cannot preserve during the division of profiles the sum of bin weight square");
525 Error(
"Divide",
"Attempt to divide a non-existing profile");
529 Error(
"Divide",
"Attempt to divide a non-profile object");
534 Error(
"Divide",
"Attempt to divide by a non-profile object");
545 Error(
"Divide",
"Attempt to divide profiles with different number of bins");
549 Error(
"Divide",
"Coefficient of dividing profile cannot be zero");
554 printf(
"WARNING!!: The algorithm in TProfile::Divide computing the errors is not accurate\n");
555 printf(
" Instead of Divide(TProfile *h1, TProfile *h2, do:\n");
556 printf(
" TH1D *p1 = h1->ProjectionX();\n");
557 printf(
" TH1D *p2 = h2->ProjectionX();\n");
558 printf(
" p1->Divide(p2);\n");
576 for (bin=0;bin<=nbinsx+1;bin++) {
579 if (b2) w = c1*b1/(c2*b2);
601 fSumw2.
fArray[bin] = ac1*ac2*(e1*b2*b2 + e2*b1*b1)/(b22*b22);
611 Warning(
"Divide",
"Cannot preserve during the division of profiles the sum of bin weight square");
755 for (i=0;i<ntimes;i+=stride) {
767 for (i=ifirst;i<ntimes;i+=stride) {
799 if (bin < 0 || bin >=
fNcells)
return 0;
812 if (bin < 0 || bin >=
fNcells)
return 0;
898 for (bin=0;bin<6;bin++) stats[bin] = 0;
904 if (firstBinX == 1) firstBinX = 0;
907 for (binx = firstBinX; binx <= lastBinX; binx++) {
968 Warning(
"LabelsOption",
"Cannot sort. No labels");
1001 if (sort < 0)
return;
1011 TIter nextold(labels);
1013 while ((obj=nextold())) {
1019 for (i=1;i<=
n;i++) {
1028 for (i=1;i<=
n;i++) {
1029 fArray[i] = sumw[a[i-1]];
1033 for (i=1;i<=
n;i++) {
1034 obj = labold->
At(a[i-1]);
1040 const UInt_t kUsed = 1<<18;
1044 for (i=1;i<=
n;i++) {
1045 const char *label =
"zzzzzzzzzzzz";
1046 for (j=1;j<=
n;j++) {
1047 obj = labold->
At(j-1);
1049 if (obj->
TestBit(kUsed))
continue;
1051 if (strcmp(label,obj->
GetName()) < 0)
continue;
1062 for (i=1;i<=
n;i++) {
1063 obj = labels->
At(i-1);
1068 for (i=1;i<=
n;i++) {
1073 for (i=1;i<=
n;i++) {
1081 if (sumw)
delete [] sumw;
1082 if (cont)
delete [] cont;
1083 if (errors)
delete [] errors;
1084 if (ent)
delete [] ent;
1116 Error(
"Multiply",
"Attempt to multiply by a null function");
1126 for (i=0;i<10;i++) {s1[i] = 0;}
1134 for (bin=0;bin<=nbinsx+1;bin++) {
1156 Error(
"Multiply",
"Multiplication of profile histograms not implemented");
1168 Error(
"Multiply",
"Multiplication of profile histograms not implemented");
1202 if (pname ==
"_px") {
1208 if (bins->
fN == 0) {
1221 if (computeErrors || binWeight || (binEntries &&
fBinSumw2.
fN) ) h1->
Sumw2();
1225 for (
Int_t bin =0;bin<=nx+1;bin++) {
1229 else if (binWeight) cont =
fArray[bin];
1319 if ((ngroup <= 0) || (ngroup > nbins)) {
1320 Error(
"Rebin",
"Illegal value of ngroup=%d",ngroup);
1323 if (!newname && xbins) {
1324 Error(
"Rebin",
"if xbins is specified, newname must be given");
1328 Int_t newbins = nbins/ngroup;
1330 Int_t nbg = nbins/ngroup;
1331 if (nbg*ngroup != nbins) {
1332 Warning(
"Rebin",
"ngroup=%d must be an exact divider of nbins=%d",ngroup,nbins);
1355 for (bin=0;bin<=nbins+1;bin++) {
1356 oldBins[bin] = cu1[bin];
1357 oldCount[bin] = en1[bin];
1358 oldErrors[bin] = er1[bin];
1359 if (ew1 &&
fBinSumw2.
fN) oldBinw2[bin] = ew1[bin];
1364 if ((newname && strlen(newname) > 0) || xbins) {
1370 if(!xbins && (newbins*ngroup != nbins)) {
1386 hnew->
SetBins(newbins,xmin,xmax);
1403 Int_t oldbin = startbin;
1404 Double_t binContent, binCount, binError, binSumw2;
1405 for (bin = 1;bin<=newbins;bin++) {
1412 Int_t imax = ngroup;
1414 for (i=0;i<ngroup;i++) {
1415 if((hnew ==
this && (oldbin+i > nbins)) ||
1422 binContent += oldBins[oldbin+i];
1423 binCount += oldCount[oldbin+i];
1424 binError += oldErrors[oldbin+i];
1428 cu2[bin] = binContent;
1429 er2[bin] = binError;
1430 en2[bin] = binCount;
1439 for(i=0;i<startbin;i++)
1441 binContent += oldBins[i];
1442 binCount += oldCount[i];
1443 binError += oldErrors[i];
1446 hnew->
fArray[0] = binContent;
1448 hnew->
fSumw2[0] = binError;
1456 for(i=oldbin;i<=nbins+1;i++)
1458 binContent += oldBins[i];
1459 binCount += oldCount[i];
1460 binError += oldErrors[i];
1463 hnew->
fArray[newbins+1] = binContent;
1465 hnew->
fSumw2[newbins+1] = binError;
1471 delete [] oldErrors;
1472 if (oldBinw2)
delete [] oldBinw2;
1530 if (i != 0) out <<
", ";
1533 out <<
"}; " << std::endl;
1537 out<<
" "<<std::endl;
1542 static Int_t hcounter = 0;
1547 histName += hcounter;
1549 const char *hname = histName.
Data();
1562 for (bin=0;bin<
fNcells;bin++) {
1565 out<<
" "<<hname<<
"->SetBinEntries("<<bin<<
","<<bi<<
");"<<std::endl;
1569 for (bin=0;bin<
fNcells;bin++) {
1572 out<<
" "<<hname<<
"->SetBinContent("<<bin<<
","<<bc<<
");"<<std::endl;
1577 for (bin=0;bin<
fNcells;bin++) {
1580 out<<
" "<<hname<<
"->SetBinError("<<bin<<
","<<be<<
");"<<std::endl;
1649 if (buffersize <= 0) {
1653 if (buffersize < 100) buffersize = 100;
1689 void TProfile::Streamer(
TBuffer &R__b)
1699 TH1D::Streamer(R__b);
Int_t GetFirst() const
Return first bin on the axis i.e.
virtual const char * GetTitle() const
Returns title of object.
virtual void SetBinsLength(Int_t n=-1)
Set total number of bins including under/overflow Reallocate bin contents array.
static void SetBinEntries(T *p, Int_t bin, Double_t w)
static void Scale(T *p, Double_t c1, Option_t *option)
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this profile by a constant c1.
TH1D * ProjectionX(const char *name="_px", Option_t *option="e") const
Project this profile into a 1-D histogram along X.
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual void SetMaximum(Double_t maximum=-1111)
virtual void LabelsOption(Option_t *option="h", Option_t *axis="X")
Set option(s) to draw axis with labels option = "a" sort by alphabetic order = ">" sort by decreasing...
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual Double_t GetBinEntries(Int_t bin) const
Return bin entries of a Profile histogram.
static Double_t GetBinError(T *p, Int_t bin)
Collectable string class.
virtual Double_t GetBinEffectiveEntries(Int_t bin) const
Return bin effective entries for a weighted filled Profile histogram.
static void SetErrorOption(T *p, Option_t *opt)
static void LabelsInflate(T *p, Option_t *)
static Bool_t fgStatOverflows
flag to add histograms to the directory
void ToUpper()
Change string to upper case.
Buffer base class used for serializing objects.
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
virtual void SetMinimum(Double_t minimum=-1111)
static THLimitsFinder * GetLimitsFinder()
Return pointer to the current finder.
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
Short_t Min(Short_t a, Short_t b)
void ToLower()
Change string to lower-case.
virtual Int_t GetNbinsX() const
const TKDTreeBinning * bins
void Copy(TArrayD &array) const
virtual Int_t FindGoodLimits(TH1 *h, Double_t xmin, Double_t xmax)
compute the best axis limits for the X axis.
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
TObject * Clone(const char *newname=0) const
Make a complete copy of the underlying object.
static void BuildArray(T *p)
const char * Data() const
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
static Bool_t fgApproximate
virtual Bool_t Multiply(TF1 *h1, Double_t c1=1)
Performs the operation: this = this*c1*f1.
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
virtual void LabelsInflate(Option_t *axis="X")
Double the number of bins for axis.
Option_t * GetErrorOption() const
Return option to compute profile errors.
virtual Long64_t Merge(TCollection *list)
Merge all histograms in the collection in this histogram.
virtual Int_t BufferEmpty(Int_t action=0)
Fill histogram with all entries in the buffer.
virtual void AddBinContent(Int_t bin)
Increment bin content by 1.
static double p2(double t, double a, double b, double c)
static void LabelsDeflate(T *p, Option_t *)
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.
TString & Append(const char *cs)
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)
static T * ExtendAxis(T *p, Double_t x, TAxis *axis)
virtual TArrayD * GetSumw2()
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void SetBinError(Int_t bin, Double_t error)
see convention for numbering bins in TH1::GetBin
virtual void Copy(TObject &hnew) const
Copy a Profile histogram to a new profile histogram.
virtual void GetStats(Double_t *stats) const
fill the array stats from the contents of this profile The array stats must be correctly dimensionned...
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
virtual void ImportAttributes(const TAxis *axis)
Copy axis attributes to this.
void Clear(Option_t *option="")
Remove all objects from the list.
Class to manage histogram axis.
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
virtual void SetBinsLength(Int_t n=-1)
Set total number of bins including under/overflow Reallocate bin contents array.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
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...
Collection abstract base class.
Bool_t TestBit(UInt_t f) const
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 void PutStats(Double_t *stats)
Replace current statistics with the values in array stats.
Int_t Fill(const Double_t *v)
virtual const char * GetName() const
Returns name of object.
static double p1(double t, double a, double b)
1-D histogram with a double per channel (see TH1 documentation)}
virtual Double_t GetBinError(Int_t bin) const
Return bin error of a Profile histogram.
virtual void Copy(TObject &hnew) const
Copy this to newth1.
virtual Int_t FindBin(Double_t x)
Find bin number corresponding to abscissa x.
static Bool_t Add(T *p, const TH1 *h1, const TH1 *h2, Double_t c1, Double_t c2=1)
virtual Double_t GetBinContent(Int_t bin) const
Return bin content of a Profile histogram.
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
virtual Int_t GetSize() const
virtual Bool_t Divide(TF1 *h1, Double_t c1=1)
Performs the operation: this = this/(c1*f1) This function is not implemented for the TProfile...
virtual const char * GetName() const
Returns name of object.
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, eg TProfile, TProfile2D.
static Double_t GetBinEffectiveEntries(T *p, Int_t bin)
Double_t fTsumwy
True when TProfile::Scale is called.
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
virtual void SetBinLabel(Int_t bin, const char *label)
Set label for bin.
Array of doubles (64 bits per element).
Int_t GetLast() const
Return last bin on the axis i.e.
void SetBins(const Int_t *nbins, const Double_t *range)
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
Mother of all ROOT objects.
virtual void SetBinEntries(Int_t bin, Double_t w)
Set the number of entries in bin.
THashList * GetLabels() const
virtual void SetBuffer(Int_t buffersize, Option_t *option="")
set the buffer size in units of 8 bytes (double)
static Bool_t RejectedPoint()
See TF1::RejectPoint above.
void FillN(Int_t, const Double_t *, const Double_t *, Int_t)
Fill this histogram with an array x and weights w.
virtual void Add(TObject *obj)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual ~TProfile()
Default destructor for Profile histograms.
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 Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
virtual Bool_t CanExtendAllAxes() const
returns true if all axes are extendable
static void Approximate(Bool_t approx=kTRUE)
static function set the fgApproximate flag.
virtual void SetEntries(Double_t n)
virtual Bool_t Add(TF1 *h1, Double_t c1=1, Option_t *option="")
Performs the operation: this = this + c1*f1.
static void Sumw2(T *p, Bool_t flag)
const TArrayD * GetXbins() const
Double_t Sqrt(Double_t x)
virtual void Sumw2(Bool_t flag=kTRUE)
Create/delete structure to store sum of squares of weights per bin — This is needed to compute the c...
virtual Bool_t IsInside(const Double_t *x) const
return kTRUE if the point is inside the function range
virtual void Set(Int_t nbins, Double_t xmin, Double_t xmax)
Initialize axis with fix bins.
virtual Double_t GetBinError(Int_t bin) const
Return value of error associated to bin number bin.
virtual Double_t EvalPar(const Double_t *x, const Double_t *params=0)
Evaluate function with given coordinates and parameters.
virtual void SetErrorOption(Option_t *option="")
Set option to compute profile errors.
static Long64_t Merge(T *p, TCollection *list)
virtual void LabelsDeflate(Option_t *axis="X")
Reduce the number of bins for this axis to the number of bins having a label.
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
TH1 * Rebin(Int_t ngroup=2, const char *newname="", const Double_t *xbins=0)
Rebin this profile grouping ngroup bins together case 1 xbins=0if newname is not blank a new temporar...
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.