Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
DividedHisto.h
1/*
2 * HalDividedHisto1D.h
3 *
4 * Created on: 30-04-2022
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9#ifndef HALDIVIDEDHISTO1D_H_
10#define HALDIVIDEDHISTO1D_H_
11
12#include "Object.h"
13
14#include <TH2.h>
15#include <TH3.h>
16#include <TString.h>
17
18
28namespace Hal {
29 class HistoStyle;
30 class HistogramAxisConf;
31 class DividedHisto1D : public Object {
32 friend class HistoStyle;
33
34 private:
38 Bool_t fNumIsCloned;
42 Bool_t fDenIsCloned;
43
44 protected:
48 TH1* fNum;
52 TH1* fDen;
56 Bool_t fBinomial;
60 const Int_t fDim;
64 Double_t* fNormMin; //[fDim]
68 Double_t* fNormMax; //[fDim]
72 Double_t fScale;
76 TString fAxisName;
80 TString fComment;
84 TList* fLabels;
89 DividedHisto1D(TString name, const Int_t dim);
95 virtual void Folding1D(Double_t val, Option_t* axis);
100 virtual void Normalize(TH1* h) const;
107 virtual TString CommonExtract(Int_t counter, TString dir) const;
112 virtual void SetHistoName(TH1* h) const;
116 virtual TString GetPic() const;
118 virtual void ApplyStyle(const HistoStyle& h);
119
120 public:
129 DividedHisto1D(TString name) : DividedHisto1D(name, 1) {};
138 DividedHisto1D(TString name, Int_t nbins, Double_t min, Double_t max, Char_t type = 'D');
144 DividedHisto1D(TString name, const HistogramAxisConf& conf, Char_t type = 'D');
149 DividedHisto1D(const DividedHisto1D& other);
160 void SetScale(Double_t scale);
165 void SetAxisName(TString name);
170 TH1* GetNum() const;
175 TH1* GetDen() const;
181 TH1* GetHist(Bool_t normalized = kTRUE) const;
186 void SetOwnerNum(Bool_t own) { fNumIsCloned = own; };
191 void SetOwnerDen(Bool_t own) { fDenIsCloned = own; };
196 void SetOwner(Bool_t own) { fNumIsCloned = fDenIsCloned = own; };
204 void SetNorm(Double_t min, Double_t max, Int_t axis = 0);
209 void AddLabel(TString label);
214 void SetBinomial(Bool_t binomial);
219 void SetComment(TString comment);
225 void FillNum(Double_t x, Double_t weight) { fNum->Fill(x, weight); };
231 void FillDen(Double_t x, Double_t weight) { fDen->Fill(x, weight); };
238 virtual void AddNum(TH1* num, Option_t* opt = "");
245 virtual void AddDen(TH1* den, Option_t* opt = "");
253 virtual void AddNumDen(TH1* num, TH1* den, Option_t* opt = "");
259 virtual void AddScaled(const DividedHisto1D& other, Double_t scale = 1);
269 void Fold1D(Double_t val, Option_t* opt = "x");
276 virtual void Rebin(Int_t ngroup, Option_t* opt);
281 virtual void Add(const Object* h);
286 virtual void Browse(TBrowser* b);
291 virtual void FillNumObj(TObject* /*obj*/) {};
296 virtual void FillDenObj(TObject* /*obj*/) {};
297 virtual void Print(Option_t* opt) const;
302 virtual void SetDirectory(TDirectory* dir = nullptr);
307 Int_t GetNDim() const { return fDim; };
312 Int_t GetLabelsNo() const;
317 Bool_t IsBinomial() const { return fBinomial; };
322 Bool_t IsDenOwner() const { return fDenIsCloned; };
327 Bool_t IsNumOwner() const { return fNumIsCloned; };
332 Bool_t IsOwner() const { return (fNumIsCloned && fDenIsCloned); };
338 Double_t GetNormMin(Int_t no = 0) const;
344 Double_t GetNormMax(Int_t no = 0) const;
349 Double_t GetScale() const;
356 Double_t CalculateNorm(Double_t min, Double_t max) const;
361 virtual Long64_t Merge(TCollection* collection);
366 TString GetAxisName() const { return fAxisName; };
371 TList* GetLabelList() const { return fLabels; };
377 TString GetLabel(Int_t i) const;
382 TString GetExtractType() const;
387 TString GetComment() const { return fComment; };
393 virtual void Draw(Option_t* opt = "all");
400 virtual TString HTMLExtract(Int_t counter = 0, TString dir = " ") const;
406 virtual TObject* GetSpecial(TString opt) const { return nullptr; }
407 virtual ~DividedHisto1D();
408 ClassDef(DividedHisto1D, 4)
409 };
414 protected:
415 virtual void Normalize(TH1* h) const;
416 virtual void SetHistoName(TH1* h) const;
424 virtual void Folding2D(Double_t valX, Double_t valY, Option_t* opt);
425 virtual void Folding1D(Double_t val, Option_t* axis);
431 DividedHisto2D(TString name, const Int_t dim) : DividedHisto1D(name, dim) {};
445 TH1D* Projection2DTo1D(Double_t min, Double_t max, Option_t* opt) const;
446
447 public:
456 DividedHisto2D(TString name) : DividedHisto1D(name, 2) {};
468 DividedHisto2D(TString name,
469 Int_t binsX,
470 Double_t minX,
471 Double_t maxX,
472 Int_t binsY,
473 Double_t minY,
474 Double_t maxY,
475 Char_t type = 'D');
476 DividedHisto2D(TString name, const HistogramAxisConf& axX, const HistogramAxisConf& axY, Char_t type = 'D');
481 DividedHisto2D(const DividedHisto2D& other);
497 void Fold2D(Double_t valX, Double_t valY, Option_t* opt = "xy");
504 void FillNum(Double_t x, Double_t y, Double_t weight) { ((TH2*) fNum)->Fill(x, y, weight); };
511 void FillDen(Double_t x, Double_t y, Double_t weight) { ((TH2*) fDen)->Fill(x, y, weight); };
512 virtual TString HTMLExtract(Int_t counter = 0, TString dir = " ") const;
520 virtual void Rebin(Int_t ngroup, Option_t* opt);
534 TH1D* GetProjection1D(Double_t min, Double_t max, Option_t* opt) const { return Projection2DTo1D(min, max, opt); }
543 Double_t CalculateNorm(Double_t minX, Double_t maxX, Double_t minY, Double_t maxY) const;
544 virtual void Browse(TBrowser* b);
552 ClassDef(DividedHisto2D, 2)
553 };
558 protected:
559 void Normalize(TH1* h) const;
560 virtual void SetHistoName(TH1* h) const;
561 virtual void Folding1D(Double_t val, Option_t* axis);
562 virtual void Folding2D(Double_t valX, Double_t valY, Option_t* opt);
577 virtual TH1D* Projection3DTo1D(Double_t min1, Double_t max1, Double_t min2, Double_t max2, Option_t* opt) const;
578
579 public:
589 DividedHisto3D(TString name) : DividedHisto2D(name, 3) {};
598 DividedHisto3D(TString name,
599 const HistogramAxisConf& axX,
600 const HistogramAxisConf& axY,
601 const HistogramAxisConf& axZ,
602 Char_t type = 'D');
617 DividedHisto3D(TString name,
618 Int_t binsX,
619 Double_t minX,
620 Double_t maxX,
621 Int_t binsY,
622 Double_t minY,
623 Double_t maxY,
624 Int_t binsZ,
625 Double_t minZ,
626 Double_t maxZ,
627 Char_t type = 'D');
632 DividedHisto3D(const DividedHisto3D& other);
640 void FillNum(Double_t x, Double_t y, Double_t z, Double_t weight) { ((TH3*) fNum)->Fill(x, y, z, weight); };
648 void FillDen(Double_t x, Double_t y, Double_t z, Double_t weight) { ((TH3*) fDen)->Fill(x, y, z, weight); };
663 TH1D* GetProjection1D(Double_t min1, Double_t max1, Double_t min2, Double_t max2, Option_t* opt) const {
664 return Projection3DTo1D(min1, max1, min2, max2, opt);
665 }
673 virtual void Rebin(Int_t ngroup, Option_t* opt);
683 virtual void Fold3D(Double_t valX, Double_t valY, Double_t valZ, Option_t* opt);
697 virtual TH2D* GetProjection2D(Double_t min, Double_t max, Option_t* opt) const;
708 Double_t CalculateNorm(Double_t minX, Double_t maxX, Double_t minY, Double_t maxY, Double_t minZ, Double_t maxZ) const;
715 virtual TString HTMLExtract(Int_t counter = 0, TString dir = " ") const;
717 ClassDef(DividedHisto3D, 3)
718 };
719} // namespace Hal
720#endif /* HALDIVIDEDHISTO1D_H_ */
void SetScale(Double_t scale)
void SetAxisName(TString name)
virtual TString CommonExtract(Int_t counter, TString dir) const
TList * GetLabelList() const
virtual void AddNum(TH1 *num, Option_t *opt="")
virtual void FillNumObj(TObject *)
Double_t CalculateNorm(Double_t min, Double_t max) const
Double_t GetNormMax(Int_t no=0) const
TString GetLabel(Int_t i) const
virtual void ApplyStyle(const HistoStyle &h)
void SetComment(TString comment)
Double_t GetNormMin(Int_t no=0) const
virtual TString HTMLExtract(Int_t counter=0, TString dir=" ") const
virtual void SetDirectory(TDirectory *dir=nullptr)
Int_t GetNDim() const
DividedHisto1D(TString name)
virtual void Normalize(TH1 *h) const
void AddLabel(TString label)
void SetOwnerNum(Bool_t own)
TString GetComment() const
Bool_t IsBinomial() const
TString GetExtractType() const
Bool_t IsDenOwner() const
virtual void SetHistoName(TH1 *h) const
virtual void Rebin(Int_t ngroup, Option_t *opt)
virtual void FillDenObj(TObject *)
virtual TObject * GetSpecial(TString opt) const
Int_t GetLabelsNo() const
void Fold1D(Double_t val, Option_t *opt="x")
void SetNorm(Double_t min, Double_t max, Int_t axis=0)
Bool_t IsOwner() const
void SetOwner(Bool_t own)
Double_t GetScale() const
Bool_t IsNumOwner() const
virtual void Draw(Option_t *opt="all")
TH1 * GetHist(Bool_t normalized=kTRUE) const
virtual void AddNumDen(TH1 *num, TH1 *den, Option_t *opt="")
virtual void Add(const Object *h)
void FillNum(Double_t x, Double_t weight)
virtual TString GetPic() const
virtual void AddScaled(const DividedHisto1D &other, Double_t scale=1)
void FillDen(Double_t x, Double_t weight)
virtual void AddDen(TH1 *den, Option_t *opt="")
TString GetAxisName() const
virtual void Browse(TBrowser *b)
virtual void Folding1D(Double_t val, Option_t *axis)
void SetBinomial(Bool_t binomial)
virtual Long64_t Merge(TCollection *collection)
DividedHisto1D & operator=(const DividedHisto1D &other)
void SetOwnerDen(Bool_t own)
virtual void Folding1D(Double_t val, Option_t *axis)
virtual void Rebin(Int_t ngroup, Option_t *opt)
void FillNum(Double_t x, Double_t y, Double_t weight)
void Fold2D(Double_t valX, Double_t valY, Option_t *opt="xy")
Double_t CalculateNorm(Double_t minX, Double_t maxX, Double_t minY, Double_t maxY) const
virtual void Normalize(TH1 *h) const
virtual void Browse(TBrowser *b)
virtual TString HTMLExtract(Int_t counter=0, TString dir=" ") const
TH1D * Projection2DTo1D(Double_t min, Double_t max, Option_t *opt) const
TH1D * GetProjection1D(Double_t min, Double_t max, Option_t *opt) const
DividedHisto2D(TString name)
virtual void SetHistoName(TH1 *h) const
void FillDen(Double_t x, Double_t y, Double_t weight)
virtual void Folding2D(Double_t valX, Double_t valY, Option_t *opt)
DividedHisto2D(TString name, const Int_t dim)
DividedHisto2D & operator=(const DividedHisto2D &other)
virtual void Folding1D(Double_t val, Option_t *axis)
void FillDen(Double_t x, Double_t y, Double_t z, Double_t weight)
virtual void SetHistoName(TH1 *h) const
virtual void Fold3D(Double_t valX, Double_t valY, Double_t valZ, Option_t *opt)
virtual TH1D * Projection3DTo1D(Double_t min1, Double_t max1, Double_t min2, Double_t max2, Option_t *opt) const
virtual void Folding2D(Double_t valX, Double_t valY, Option_t *opt)
virtual TString HTMLExtract(Int_t counter=0, TString dir=" ") const
TH1D * GetProjection1D(Double_t min1, Double_t max1, Double_t min2, Double_t max2, Option_t *opt) const
DividedHisto3D(TString name)
virtual TH2D * GetProjection2D(Double_t min, Double_t max, Option_t *opt) const
void FillNum(Double_t x, Double_t y, Double_t z, Double_t weight)
Double_t CalculateNorm(Double_t minX, Double_t maxX, Double_t minY, Double_t maxY, Double_t minZ, Double_t maxZ) const
virtual void Rebin(Int_t ngroup, Option_t *opt)
DividedHisto3D & operator=(const DividedHisto3D &other)
void Normalize(TH1 *h) const