20 #include <TGraphErrors.h>
21 #include <TGraphAsymmErrors.h>
42 TGraph* BuildGraph(TString,TString,
int N,
double *x,
double *y,
int closed);
44 TGraph* BuildGraph(TString,TString,
double xmin,
double xmax,
double ymin,
double ymax);
46 bool CompareGraphs(TGraph &g1, TGraph &g2);
48 double ComputeEffEntries(TH1&,TString opt=
"");
49 double ComputeIntegral(TH1&,TString opt=
"");
51 double* CreateBinsArray(
int,
double xmin,
double xmax);
53 std::vector<TString> DirFileList(TString path, TString ext,TString opt);
55 void FillHistoFast(TH1F &,
double x,
double w);
56 void FillHistoFast(TH2F &,
double x,
double y,
double w);
58 int GetBin(
int nx,
int binx);
60 int GetBin(
int nx,
int binx,
int ny,
int biny);
62 TString GetBinRangeLabel(TH1 &h,
int bin, TString axis);
64 TObject* GetObjFromFile(TString file, TString obj);
66 float GetOutliers(TH1&);
68 TGraphAsymmErrors* GetPoissonErrors(TH1 &h, TString =
"");
70 void ImportBinning(TH2F *h2, TH1F *hx, TH1F *hy);
72 void ImportBinning(TH1F *h, TH1F *hx);
73 template <
typename T>
bool IsTotalInside(T xp, T yp, Int_t np, T *x, T *y);
75 bool IsInsideRectangular(TGraph *g,
double x,
double y);
77 bool IsTH1(
const TObject& );
78 bool IsTH2(
const TObject& );
79 bool IsTH2Poly(
const TObject& );
81 bool IsTH1F(
const TObject& );
82 bool IsTH2F(
const TObject& );
84 TH2F* InvertAxis(TH2 &,
int opt=0);
86 void MeanAndRMS(std::vector<double> *val, std::vector<double> *w,
double &mean,
double &rms);
87 void MeanAndRMSOld(std::vector<double> *val, std::vector<double> *w,
double &mean,
double &rms);
89 double Normalize(TH1&,
double norm,TString opt=
"");
91 void Poisson(TH1 &in, TH1 &out,
int opt=0);
93 void Poisson(TH1 &,
int opt=0);
95 TH1F* newTH1F(TString name, TString title,
int nbins,
double low,
double up);
96 TH2F* newTH2F(TString name, TString title,
int nbinsx,
double lowx,
double upx
97 ,
int nbinsy,
double lowy,
double upy);
100 bool OverlappingRectangulars(TGraph &g1, TGraph &g2);
102 void PrintHistoInfo(TObject *h);
104 TH1F* RatioHist1D(TString name,TString tit,TH1F &hnum, TH1F& hden,
double hmin,
double hmax,TString opt=
"");
106 bool SameBinning(TH1 &h1, TH1 &h2);
112 return TMath::AreEqualRel(val,0.,std::numeric_limits<T>::epsilon());
116 static TRandom fRandom;
118 static TString STR_ERROR =
" !!!!!! ";
119 static TString STR_WARNING =
" ###### ";
131 template <
typename T>
bool RootUtils::IsTotalInside(T xp, T yp, Int_t np, T *x, T *y)
144 Bool_t oddNodes = kFALSE;
146 for (i=0; i<np; i++) {
148 bool y_range_1_1=(y[i]<yp);
149 bool y_range_1_2=(y[j]>yp);
151 bool y_range_2_1=(y[j]<yp);
152 bool y_range_2_2=(y[i]>yp);
157 if( y_range_1_1 && TMath::AreEqualRel(y[i],yp,1e-5) ) y_range_1_1=
false;
158 if( y_range_1_2 && TMath::AreEqualRel(y[j],yp,1e-5) ) y_range_1_2=
false;
160 if( y_range_2_1 && TMath::AreEqualRel(y[j],yp,1e-5) ) y_range_2_1=
false;
161 if( y_range_2_2 && TMath::AreEqualRel(y[i],yp,1e-5) ) y_range_2_2=
false;
163 bool y_range_1 = y_range_1_1 && y_range_1_2;
164 bool y_range_2 = y_range_2_1 && y_range_2_2;
167 if( y_range_1 || y_range_2 ){
171 if (x[i]+(yp-y[i])/(y[j]-y[i])*(x[j]-x[i])<xp) {
172 oddNodes = !oddNodes;