KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
KVHistoManipulator.h
Go to the documentation of this file.
1 /*
2 $Id: KVHistoManipulator.h,v 1.8 2009/04/07 14:54:15 ebonnet Exp $
3 $Revision: 1.8 $
4 $Date: 2009/04/07 14:54:15 $
5 */
6 
9 
10 #ifndef __KVHISTOMANIPULATOR_H
11 #define __KVHISTOMANIPULATOR_H
12 
13 #include "Riostream.h"
14 
15 #include "TH1.h"
16 #include "TH2.h"
17 #include "TCutG.h"
18 #include "KVList.h"
19 #include "TString.h"
20 #include "TGraph.h"
21 #include "TGraphErrors.h"
22 #include "TMath.h"
23 
24 class TCanvas;
25 class KVNumberList;
26 class TMultiGraph;
27 
37 
38 public:
39 
40  void init(void)
41  {
42 
43  }
44 
46  virtual ~KVHistoManipulator(void);
47 
48  void SetVisDebug(Bool_t on = kTRUE)
49  {
58  kVisDebug = on;
59  };
61  {
62  return kVisDebug;
63  };
64 
65  Int_t CutStatBin(TH1* hh, Int_t stat_min = -1, Int_t stat_max = -1);
66 
67  Int_t Apply_TCutG(TH2* hh, TCutG* cut, TString mode = "in");
68 
69  TH1* ScaleHisto(TH1* hh, TF1* fx, TF1* fy = NULL, Int_t nx = -1, Int_t ny = -1,
70  Double_t xmin = -1., Double_t xmax = -1., Double_t ymin = -1., Double_t ymax = -1., Option_t* norm = "");
71  TGraph* ScaleGraph(TGraph* hh, TF1* fx, TF1* fy);
72 
73  TH1* CentreeReduite(TH1* hh, Int_t nx = -1, Int_t ny = -1, Double_t xmin = -1., Double_t xmax = -1., Double_t ymin = -1., Double_t ymax = -1.);
74  TH2* CentreeReduiteX(TH2* hh, Int_t nx = -1, Double_t xmin = -1., Double_t xmax = -1.);
75  TH2* CentreeReduiteY(TH2* hh, Int_t ny = -1, Double_t ymin = -1., Double_t ymax = -1.);
76 
77  TH2* RenormaliseHisto(TH2* hh, Int_t bmin = -1, Int_t bmax = -1, TString axis = "X", Double_t valref = 1);
78  TH2* RenormaliseHisto(TH2* hh, Double_t valmin, Double_t valmax, TString axis = "X", Double_t valref = 1);
79 
80  TH1* CumulatedHisto(TH1* hh, TString direction = "C", Int_t bmin = -1, Int_t bmax = -1, Option_t* norm = "surf");
81  TH1* CumulatedHisto(TH1* hh, Double_t xmin, Double_t xmax, const TString& direction = "C", Option_t* norm = "surf");
82  TH1* GetDerivative(TH1* hh, Int_t order);
83 
84  TGraphErrors* GetMomentEvolution(TH2* hh, TString momentx, TString momenty, TString axis = "Y", Double_t stat_min = 0);
86  TGraph* LinkGraphs(TGraph* grx, TGraph* gry);
87 
88  KVList* Give_ProjectionList(TH2* hh, Double_t MinIntegral = -1, TString axis = "X");
89  KVNumberList* Saucisson(TH1* hh, Int_t ntranches = 10);
90  TH2* PermuteAxis(TH2* hh);
92  TGraphErrors* MakeGraphFrom(TProfile* pf, Bool_t Error = kTRUE);
93 
94  void DefinePattern(TH1* ob, TString titleX = "42 0.08 0.8", TString titleY = "42 0.07 1.2", TString labelX = "42 0.05 0.005", TString labelY = "42 0.05 0.006");
95  void DefinePattern(TGraph* ob, TString titleX = "42 0.08 0.8", TString titleY = "42 0.07 1.2", TString labelX = "42 0.05 0.005", TString labelY = "42 0.05 0.006");
96  void DefinePattern(TF1* ob, TString titleX = "42 0.08 0.8", TString titleY = "42 0.07 1.2", TString labelX = "42 0.05 0.005", TString labelY = "42 0.05 0.006");
97  void DefinePattern(TAxis* ax, TString title = "42 0.08 0.8", TString label = "42 0.05 0.005");
98 
99  void DefineLineStyle(TAttLine* ob, TString line);
100  void DefineMarkerStyle(TAttMarker* ob, TString marker);
101  void DefineStyle(TObject* ob, TString line, TString marker);
102 
103  void DefineTitle(TH1* ob, TString xtit, TString ytit);
104  void DefineTitle(TGraph* ob, TString xtit, TString ytit);
105  void DefineTitle(TF1* ob, TString xtit, TString ytit);
106 
107  Double_t GetX(TH1* ob, Double_t val, Double_t eps = 1.e-07, Int_t nmax = 50, Double_t xmin = -1.0, Double_t xmax = -1.0);
108  Double_t GetXWithLimits(TH1* ob, Double_t val, Double_t xmin = -1.0, Double_t xmax = -1.0, Double_t eps = 1.e-07, Int_t nmax = 50)
109  {
111  return GetX(ob, val, eps, nmax, xmin, xmax);
112  }
113  TF1* RescaleX(TH1* hist1, TH1* hist2, Int_t degree, Double_t* params,
114  Int_t npoints = -1, const Char_t* direction = "C",
115  Double_t xmin = -1, Double_t xmax = -1, Double_t qmin = 0.05, Double_t qmax = 0.95,
116  Double_t eps = 1.e-07);
117  void RescaleX(TH1* hist1, TH1* hist2, TF1* scale_func, Int_t npoints = 2,
118  const Char_t* direction = "C", Double_t xmin = -1, Double_t xmax = -1, Double_t qmin = 0.05, Double_t qmax = 0.95,
119  Double_t eps = 1.e-07);
120  TH1* MakeHistoRescaleX(TH1* hist1, TH1* hist2, Int_t degree, Double_t* params,
121  Option_t* opt = "", Int_t npoints = -1, const Char_t* direction = "C",
122  Double_t xmin = -1, Double_t xmax = -1, Double_t qmin = 0.05, Double_t qmax = 0.95,
123  Double_t eps = 1.e-07);
124  TH1* MakeHistoRescaleX(TH1* hist1, TH1* hist2, TF1* scale_func, Int_t npoints = 2,
125  Option_t* opt = "", const Char_t* direction = "C",
126  Double_t xmin = -1, Double_t xmax = -1, Double_t qmin = 0.05, Double_t qmax = 0.95,
127  Double_t eps = 1.e-07);
128 
129  Double_t GetChisquare(TH1* h1, TF1* f1, Bool_t norm = kTRUE, Bool_t err = kTRUE, Double_t* para = nullptr);
130  Double_t GetLikelihood(TH1* h1, TF1* f1, Bool_t norm = kTRUE, Double_t* para = nullptr);
131 
132  TGraph* DivideGraphs(TGraph* G1, TGraph* G2);
133  TGraph* ComputeNewGraphFrom(TGraph* g0, TGraph* g1, const TString& formula);
134  std::vector<Double_t> GetLimits(TGraph* G1);
135  std::vector<Double_t> GetLimits(TProfile* G1);
136  std::vector<Double_t> GetLimits(TMultiGraph* mgr);
137  std::vector<Double_t> GetLimits(TSeqCollection* mgr);
138  void ApplyCurrentLimitsToAllCanvas(Bool_t AlsoLog = kFALSE);
140 
141  ClassDef(KVHistoManipulator, 1) //Propose differentes operations sur les histo
142 };
143 
146 
147 #endif
int Int_t
#define R__EXTERN
R__EXTERN KVHistoManipulator * gHistoManipulator
................ global variable
char Char_t
bool Bool_t
double Double_t
const char Option_t
#define ClassDef(name, id)
float xmin
float xmax
Toolkit for various operations on histograms & graphs not provided by ROOT.
TF1 * RescaleX(TH1 *hist1, TH1 *hist2, Int_t degree, Double_t *params, Int_t npoints=-1, const Char_t *direction="C", Double_t xmin=-1, Double_t xmax=-1, Double_t qmin=0.05, Double_t qmax=0.95, Double_t eps=1.e-07)
KVHistoManipulator()
Default constructor.
void DefineMarkerStyle(TAttMarker *ob, TString marker)
TH1 * MakeHistoRescaleX(TH1 *hist1, TH1 *hist2, Int_t degree, Double_t *params, Option_t *opt="", Int_t npoints=-1, const Char_t *direction="C", Double_t xmin=-1, Double_t xmax=-1, Double_t qmin=0.05, Double_t qmax=0.95, Double_t eps=1.e-07)
Bool_t kVisDebug
= kTRUE for visual debugging
TH2 * CentreeReduiteX(TH2 *hh, Int_t nx=-1, Double_t xmin=-1., Double_t xmax=-1.)
std::vector< Double_t > GetLimits(TGraph *G1)
TGraph * ComputeNewGraphFrom(TGraph *g0, TGraph *g1, const TString &formula)
Double_t GetXWithLimits(TH1 *ob, Double_t val, Double_t xmin=-1.0, Double_t xmax=-1.0, Double_t eps=1.e-07, Int_t nmax=50)
TH2 * CentreeReduiteY(TH2 *hh, Int_t ny=-1, Double_t ymin=-1., Double_t ymax=-1.)
void DefineStyle(TObject *ob, TString line, TString marker)
Double_t GetX(TH1 *ob, Double_t val, Double_t eps=1.e-07, Int_t nmax=50, Double_t xmin=-1.0, Double_t xmax=-1.0)
Double_t GetChisquare(TH1 *h1, TF1 *f1, Bool_t norm=kTRUE, Bool_t err=kTRUE, Double_t *para=nullptr)
KVNumberList * Saucisson(TH1 *hh, Int_t ntranches=10)
TGraph * ScaleGraph(TGraph *hh, TF1 *fx, TF1 *fy)
TGraph * LinkGraphs(TGraph *grx, TGraph *gry)
void DefinePattern(TH1 *ob, TString titleX="42 0.08 0.8", TString titleY="42 0.07 1.2", TString labelX="42 0.05 0.005", TString labelY="42 0.05 0.006")
virtual ~KVHistoManipulator(void)
void SetVisDebug(Bool_t on=kTRUE)
TH2 * RenormaliseHisto(TH2 *hh, Int_t bmin=-1, Int_t bmax=-1, TString axis="X", Double_t valref=1)
Int_t CutStatBin(TH1 *hh, Int_t stat_min=-1, Int_t stat_max=-1)
TGraphErrors * GetMomentEvolution(TH2 *hh, TString momentx, TString momenty, TString axis="Y", Double_t stat_min=0)
void DefineTitle(TH1 *ob, TString xtit, TString ytit)
TGraph * ExtractMeanAndSigmaFromProfile(TProfile *pf, TGraph *&sigma)
void ApplyCurrentLimitsToAllCanvas(Bool_t AlsoLog=kFALSE)
TH1 * CentreeReduite(TH1 *hh, Int_t nx=-1, Int_t ny=-1, Double_t xmin=-1., Double_t xmax=-1., Double_t ymin=-1., Double_t ymax=-1.)
TCanvas * fVDCanvas
used for visual debugging
TH1 * ScaleHisto(TH1 *hh, TF1 *fx, TF1 *fy=NULL, Int_t nx=-1, Int_t ny=-1, Double_t xmin=-1., Double_t xmax=-1., Double_t ymin=-1., Double_t ymax=-1., Option_t *norm="")
TGraph * DivideGraphs(TGraph *G1, TGraph *G2)
Double_t GetLikelihood(TH1 *h1, TF1 *f1, Bool_t norm=kTRUE, Double_t *para=nullptr)
KVList * Give_ProjectionList(TH2 *hh, Double_t MinIntegral=-1, TString axis="X")
TGraphErrors * MakeGraphFrom(TProfile *pf, Bool_t Error=kTRUE)
TH1 * CumulatedHisto(TH1 *hh, TString direction="C", Int_t bmin=-1, Int_t bmax=-1, Option_t *norm="surf")
TH1 * GetDerivative(TH1 *hh, Int_t order)
void DefineLineStyle(TAttLine *ob, TString line)
Double_t GetCorrelationFactor(TH2 *hh)
Bool_t IsVisDebug() const
Int_t Apply_TCutG(TH2 *hh, TCutG *cut, TString mode="in")
Extended TList class which owns its objects by default.
Definition: KVList.h:27
Strings used to represent a set of ranges of values.
Definition: KVNumberList.h:83