31 #include <TGraphErrors.h>
32 #include <TGraphAsymmErrors.h>
53 TGraph* BuildGraph(TString,TString,
int N,
double *x,
double *y,
int closed);
55 TGraph* BuildGraph(TString,TString,
double xmin,
double xmax,
double ymin,
double ymax);
57 bool CompareGraphs(TGraph &g1, TGraph &g2);
59 double ComputeEffEntries(TH1&,TString opt=
"");
60 double ComputeIntegral(TH1&,TString opt=
"");
62 double* CreateBinsArray(
int,
double xmin,
double xmax);
64 std::vector<TString> DirFileList(TString path, TString ext,TString opt);
66 void FillHistoFast(TH1F &,
double x,
double w);
67 void FillHistoFast(TH2F &,
double x,
double y,
double w);
69 int GetBin(
int nx,
int binx);
71 int GetBin(
int nx,
int binx,
int ny,
int biny);
73 TString GetBinRangeLabel(TH1 &h,
int bin, TString axis);
75 TObject* GetObjFromFile(TString file, TString obj);
77 float GetOutliers(TH1&);
79 TGraphAsymmErrors* GetPoissonErrors(TH1 &h, TString =
"");
81 void ImportBinning(TH2F *h2, TH1F *hx, TH1F *hy);
83 void ImportBinning(TH1F *h, TH1F *hx);
84 template <
typename T>
bool IsTotalInside(T xp, T yp, Int_t np, T *x, T *y);
86 bool IsInsideRectangular(TGraph *g,
double x,
double y);
88 bool IsTH1(
const TObject& );
89 bool IsTH2(
const TObject& );
90 bool IsTH2Poly(
const TObject& );
92 bool IsTH1F(
const TObject& );
93 bool IsTH2F(
const TObject& );
95 TH2F* InvertAxis(TH2 &,
int opt=0);
97 void MeanAndRMS(std::vector<double> *val, std::vector<double> *w,
double &mean,
double &rms);
98 void MeanAndRMSOld(std::vector<double> *val, std::vector<double> *w,
double &mean,
double &rms);
100 double Normalize(TH1&,
double norm,TString opt=
"");
102 void Poisson(TH1 &in, TH1 &out,
int opt=0);
104 void Poisson(TH1 &,
int opt=0);
106 TH1F* newTH1F(TString name, TString title,
int nbins,
double low,
double up);
107 TH2F* newTH2F(TString name, TString title,
int nbinsx,
double lowx,
double upx
108 ,
int nbinsy,
double lowy,
double upy);
111 bool OverlappingRectangulars(TGraph &g1, TGraph &g2);
113 void PrintHistoInfo(TObject *h);
115 TH1F* RatioHist1D(TString name,TString tit,TH1F &hnum, TH1F& hden,
double hmin,
double hmax,TString opt=
"");
117 bool SameBinning(TH1 &h1, TH1 &h2);
123 return TMath::AreEqualRel(val,0.,std::numeric_limits<T>::epsilon());
127 static TRandom fRandom;
129 static TString STR_ERROR =
" !!!!!! ";
130 static TString STR_WARNING =
" ###### ";
142 template <
typename T>
bool RootUtils::IsTotalInside(T xp, T yp, Int_t np, T *x, T *y)
155 Bool_t oddNodes = kFALSE;
157 for (i=0; i<np; i++) {
159 bool y_range_1_1=(y[i]<yp);
160 bool y_range_1_2=(y[j]>yp);
162 bool y_range_2_1=(y[j]<yp);
163 bool y_range_2_2=(y[i]>yp);
168 if( y_range_1_1 && TMath::AreEqualRel(y[i],yp,1e-5) ) y_range_1_1=
false;
169 if( y_range_1_2 && TMath::AreEqualRel(y[j],yp,1e-5) ) y_range_1_2=
false;
171 if( y_range_2_1 && TMath::AreEqualRel(y[j],yp,1e-5) ) y_range_2_1=
false;
172 if( y_range_2_2 && TMath::AreEqualRel(y[i],yp,1e-5) ) y_range_2_2=
false;
174 bool y_range_1 = y_range_1_1 && y_range_1_2;
175 bool y_range_2 = y_range_2_1 && y_range_2_2;
178 if( y_range_1 || y_range_2 ){
182 if (x[i]+(yp-y[i])/(y[j]-y[i])*(x[j]-x[i])<xp) {
183 oddNodes = !oddNodes;