12 #if !defined(__CINT__) || defined(__MAKECINT__) 17 #include <TGraphErrors.h> 35 Double_t A = pow(n/fabs(alpha),n)*exp(-pow(alpha,2)/2);
36 Double_t B = n/fabs(alpha) - fabs(alpha);
38 if ((x[0]-mean)/sigma>-alpha)
39 return N*width*TMath::Gaus(x[0],mean,sigma,1);
41 return N/(sqrt(TMath::TwoPi())*
sigma)*width*A*pow(B-(x[0]-mean)/
sigma,-n);
50 Double_t gaus = par[0] * TMath::Exp( -(x[0]-par[1])*(x[0]-par[1]) /
52 Double_t back = par[3] + par[4]*x[0] + par[5]*x[0]*x[0] + par[6]*x[0]*x[0]*x[0];
62 Double_t gaus = par[0] * TMath::Exp( -(x[0]-par[1])*(x[0]-par[1]) /
64 Double_t back = par[3] + par[4]*x[0] + par[5]*x[0]*x[0];
74 Double_t gaus = par[0] * TMath::Exp( -(x[0]-par[1])*(x[0]-par[1]) /
76 Double_t back = par[3] + par[4]*x[0];
86 Double_t gaus = par[0] * TMath::Exp( -(x[0]-par[1])*(x[0]-par[1]) /
98 if ( x[0] > 0.425 && x[0] < 0.65 )
104 return par[0] + par[1]*x[0];
121 return par[0] + par[1]*x[0];
135 if ( num == 0 || den == 0 )
return 0.;
139 return num/den * TMath::Sqrt( ( numErr * numErr ) / ( num * num ) +
140 ( denErr * denErr ) / ( den * den ) );
153 if ( !gDen || !gNum )
155 printf(
"Graph num %p or graph den %p not available\n",gNum,gDen);
158 const Int_t nBins = gNum->GetN();
159 if ( nBins != gDen->GetN() )
161 printf(
"Cannot divide %s with %d bins and %s with %d bins!\n",
162 gNum->GetName(),nBins,gDen->GetName(),gDen->GetN());
170 for (
Int_t ibin = 0; ibin < nBins; ibin++)
174 Double_t numErr = gNum->GetEY()[ibin];
175 Double_t denErr = gDen->GetEY()[ibin];
177 x [ibin] = gNum->GetX ()[ibin];
178 xErr[ibin] = gNum->GetEX()[ibin];
180 if ( num == 0 || den == 0 )
187 ratio [ibin] = num / den ;
213 for(
Int_t ibin = binMin; ibin <= binMax; ibin++)
217 integral += h->GetBinContent(ibin);
218 integralErr += h->GetBinError (ibin) * h->GetBinError(ibin);
222 if ( integralErr > 0 ) integralErr = TMath::Sqrt(integralErr);
238 Int_t binMin = h->FindBin(minX);
239 Int_t binMax = h->FindBin(maxX)-1;
241 integral, integralErr );
262 for(
Int_t ibin = 0; ibin < graph->GetN(); ibin++)
264 Float_t x = graph->GetX()[ibin];
265 Float_t y = graph->GetY()[ibin];
266 Float_t yE = graph->GetEY()[ibin];
267 if(x < min || x > max )
269 graph->SetPoint (ibin,x, value );
270 graph->SetPointError(ibin,x, valueErr);
273 if(yE > errFraction*y)
276 graph->SetPoint (ibin,x,value );
277 graph->SetPointError(ibin,x,valueErr);
287 for(
Int_t ibin = 1; ibin < h->GetNbinsX();ibin++)
289 Double_t width = h->GetBinWidth(ibin);
290 Double_t content = h->GetBinContent(ibin);
292 h->SetBinContent(ibin,content/width);
static Double_t FunctionCrystalBall(Double_t *x, Double_t *par)
static Double_t FunctionTruncatedPolPi0(Double_t *x, Double_t *par)
static void ScaleBinBySize(TH1D *h)
Scale histogram bins by its size.
static Double_t FunctionGaussPol0(Double_t *x, Double_t *par)
static Double_t FunctionGaussPol1(Double_t *x, Double_t *par)
static TGraphErrors * DivideGraphs(TGraphErrors *gNum, TGraphErrors *gDen)
static Double_t GetFractionError(Double_t num, Double_t den, Double_t numErr, Double_t denErr)
void RemovePointsOutOfRangeOrLargeErrorFromGraph(TGraphErrors *graph, Double_t min, Double_t max, Float_t errFraction=0.5, Float_t value=-1, Float_t valueErr=0)
static Double_t FunctionGaussPol3(Double_t *x, Double_t *par)
static void GetRangeIntegralAndError(TH1D *h, Int_t binMin, Int_t binMax, Double_t &integral, Double_t &integralErr)
static Double_t FunctionGaussPol2(Double_t *x, Double_t *par)
static Double_t FunctionTruncatedPolEta(Double_t *x, Double_t *par)