Skip to content

Range synchronization for histograms filled in parallel in auto-bin mode #902

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion hist/hist/inc/TAxis.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ class TAxis : public TNamed, public TAttAxis {
return (fXbins.GetSize() != 0);
}
virtual void LabelsOption(Option_t *option="h"); // *MENU*
void RotateTitle(Bool_t rotate=kTRUE); // *TOGGLE* *GETTER=GetRotateTitle
virtual void Print(Option_t *) const;
void RotateTitle(Bool_t rotate = kTRUE); // *TOGGLE* *GETTER=GetRotateTitle
virtual void SaveAttributes(std::ostream &out, const char *name, const char *subname);
virtual void Set(Int_t nbins, Double_t xmin, Double_t xmax);
virtual void Set(Int_t nbins, const Float_t *xbins);
Expand Down
683 changes: 372 additions & 311 deletions hist/hist/inc/TH1.h

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion hist/hist/inc/TH2.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class TH2 : public TH1 {
Double_t fTsumwy2; //Total Sum of weight*Y*Y
Double_t fTsumwxy; //Total Sum of weight*X*Y

static void *fgCallbackCtx; ///<!Global context setting for the function to be called back
static CallbackFunc_t fgCallbackFunc; ///<!Global callback function setting, for example to get ranges

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments above :)

TH2();
TH2(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
,Int_t nbinsy,Double_t ylow,Double_t yup);
Expand All @@ -57,14 +60,18 @@ class TH2 : public TH1 {
Int_t Fill(Double_t); //MayNotUse
Int_t Fill(const char*, Double_t) { return Fill(0);} //MayNotUse

virtual void RecalculateAxes(Double_t *b, Int_t n);
virtual TList *GetListWithRanges(const char *n);
virtual Bool_t HasNoLimits();
virtual Int_t SetRangesFromList(TList *axl);

private:

TH2(const TH2&);
TH2& operator=(const TH2&); // Not implemented

public:
virtual ~TH2();
virtual Int_t BufferEmpty(Int_t action=0);
virtual void Copy(TObject &hnew) const;
virtual Int_t Fill(Double_t x, Double_t y);
virtual Int_t Fill(Double_t x, Double_t y, Double_t w);
Expand Down Expand Up @@ -123,6 +130,8 @@ class TH2 : public TH1 {
virtual Int_t ShowPeaks(Double_t sigma=2, Option_t *option="", Double_t threshold=0.05); // *MENU*
virtual void Smooth(Int_t ntimes=1, Option_t *option=""); // *MENU*

static void SetGlobalCallbackFunc(void *c, CallbackFunc_t f);

ClassDef(TH2,4) //2-Dim histogram base class
};

Expand Down
11 changes: 10 additions & 1 deletion hist/hist/inc/TH3.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class TH3 : public TH1, public TAtt3D {
Double_t fTsumwxz; //Total Sum of weight*X*Z
Double_t fTsumwyz; //Total Sum of weight*Y*Z

static void *fgCallbackCtx; ///<!Global context setting for the function to be called back
static CallbackFunc_t fgCallbackFunc; ///<!Global callback function setting, for example to get ranges

TH3();
TH3(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
,Int_t nbinsy,Double_t ylow,Double_t yup
Expand All @@ -62,14 +65,18 @@ class TH3 : public TH1, public TAtt3D {
Int_t Fill(const char*,Double_t,Double_t) {return Fill(0);} //MayNotUse
Int_t Fill(const char*,const char*,Double_t) {return Fill(0);} //MayNotUse

virtual void RecalculateAxes(Double_t *b, Int_t n);
virtual TList *GetListWithRanges(const char *n);
virtual Bool_t HasNoLimits();
virtual Int_t SetRangesFromList(TList *axl);

private:

TH3(const TH3&);
TH3& operator=(const TH3&); // Not implemented

public:
virtual ~TH3();
virtual Int_t BufferEmpty(Int_t action=0);
virtual void Copy(TObject &hnew) const;
virtual Int_t Fill(Double_t x, Double_t y, Double_t z);
virtual Int_t Fill(Double_t x, Double_t y, Double_t z, Double_t w);
Expand Down Expand Up @@ -128,6 +135,8 @@ class TH3 : public TH1, public TAtt3D {
virtual void SetBinContent(Int_t binx, Int_t biny, Int_t binz, Double_t content) { SetBinContent(GetBin(binx, biny, binz), content); }
virtual void SetShowProjection(const char *option="xy",Int_t nbins=1); // *MENU*

static void SetGlobalCallbackFunc(void *c, CallbackFunc_t f);

protected:

virtual TH1D *DoProject1D(const char* name, const char * title, int imin1, int imax1, int imin2, int imax2,
Expand Down
7 changes: 7 additions & 0 deletions hist/hist/src/TAxis.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1192,3 +1192,10 @@ void TAxis::ZoomOut(Double_t factor, Double_t offset)
if (first==GetFirst() && last==GetLast()) { first--; last++; }
SetRange(first,last);
}

////////////////////////////////////////////////////////////////////////////////
/// Print axis bins and ranges
void TAxis::Print(Option_t *) const
{
Printf(" %s\t%s \tNbins= %d, \tmin= %g, \tmax=%g", GetName(), GetTitle(), GetNbins(), GetXmin(), GetXmax());
}
Loading