![]() |
AliPhysics
ed8caee (ed8caee)
|
Public Types | |
enum | { kC, kDelta, kXi, kSigma, kN, kA } |
Public Member Functions | |
Double_t | NEstimate (Double_t x, Double_t delta, Double_t xi, Double_t sigma, Int_t n, Double_t *a) |
Double_t | Evaluate (Double_t x) const |
Double_t | Evaluate (Double_t x, Double_t &e) const |
Double_t | EstimateNParticles (Double_t x, Short_t maxN=-1) |
Double_t | EstimateNParticles (Double_t x, Double_t &e, Short_t maxN=-1) |
Double_t | RandomEstimateNParticles (Double_t x, Short_t maxN=-1) |
void | Draw (Option_t *option="") |
Double_t | GetC () const |
Double_t | GetDelta () const |
Double_t | GetXi () const |
Double_t | GetSigma () const |
UShort_t | GetN () const |
Double_t | GetA (Int_t i) const |
Double_t * | GetAs () const |
Double_t | GetEC () const |
Double_t | GetEDelta () const |
Double_t | GetEXi () const |
Double_t | GetESigma () const |
UShort_t | GetEN () const |
Double_t | GetEA (Int_t i) const |
Double_t * | GetEAs () const |
Static Public Member Functions | |
static Double_t | Landau (Double_t x, Double_t delta, Double_t xi) |
static Double_t | LandauGaus (Double_t x, Double_t delta, Double_t xi, Double_t sigma) |
static Double_t | ILandauGaus (Int_t i, Double_t x, Double_t delta, Double_t xi, Double_t sigma) |
static Double_t | IdLandauGausdPar (Int_t i, Double_t x, UShort_t ipar, Double_t dPar, Double_t delta, Double_t xi, Double_t sigma) |
static Double_t | NLandauGaus (Double_t x, Double_t delta, Double_t xi, Double_t sigma, Int_t n, Double_t *a) |
Public Attributes | |
TF1 * | fF |
Static Public Attributes | |
static const Double_t | fgkMPShift = -0.22278298 |
MP shift. More... | |
static const Double_t | fgkInvRoot2Pi = 1. / TMath::Sqrt(2*TMath::Pi()) |
1 / sqrt(2 * pi) More... | |
static const Double_t | fgkConvNSigma = 5 |
Number of sigmas to integrate over. More... | |
static const Double_t | fgkConvNSteps = 100 |
Number of steps in integration. More... | |
Definition at line 40 of file TestELossDist.C.
anonymous enum |
Enumeration of parameters
Enumerator | |
---|---|
kC |
Constant. |
kDelta |
MPV of landau. |
kXi |
Width of landau. |
kSigma |
Sigma of gaussian. |
kN |
Number of particles. |
kA |
Weights. |
Definition at line 46 of file TestELossDist.C.
|
inline |
Draw the function
option | Drawing option |
Definition at line 689 of file TestELossDist.C.
Referenced by Generator::Draw().
Evaluate
\[ E(x;\Delta,\xi,\sigma,\mathbf{a}) = \frac{\sum_{i=1}^{n} i a_i f_i(x;\Delta,\xi,\sigma)}{ f_N(x;\Delta,\xi,\sigma)} = \frac{\sum_{i=1}^{n} i a_i f(x;\Delta_i,\xi_i,\sigma_i)}{ \sum_{i=1}^{n} a_i f(x;\Delta_i,\xi_i,\sigma_i)} \]
If the denominator is less than \(10^{-4}\), then 0 is returned.
x | Where to evaluate \( E\) |
maxN | Maximum number of weights |
Definition at line 576 of file TestELossDist.C.
Referenced by Generator::Draw().
Evaluate
\[ E(x;\Delta,\xi,\sigma,\mathbf{a}) = \frac{\sum_{i=1}^{n} i a_i f_i(x;\Delta,\xi,\sigma)}{ f_N(x;\Delta,\xi,\sigma,\mathbf{a})} = \frac{\sum_{i=1}^{n} i a_i f(x;\Delta_i,\xi_i,\sigma_i)}{ \sum_{i=1}^{n} a_i f(x;\Delta_i,\xi_i,\sigma_i)} \]
If \(f_N(x;\Delta,\xi,\sigma,\mathbf{a})<10^{-4}\) then 0 is returned.
This also calculatues the error \(\delta E\) of the function value at \(x\):
\[ \delta^2 E = \left(\frac{\partial E}{\partial\Delta_p}\right)^2\delta^2\Delta_p+ \left(\frac{\partial E}{\partial\xi }\right)^2\delta^2\xi+ \left(\frac{\partial E}{\partial\sigma }\right)^2\delta^2\sigma+ \sum_{i=2}^N\left(\frac{\partial E}{\partial a_i}\right)^2\delta^2a_i \]
The partial derivatives are evaluated numerically.
x | Where to evaluate \( E\) |
e | On return, \(\delta E|_{x}\) |
maxN | Maximum number of weights |
Definition at line 615 of file TestELossDist.C.
Calculate the partial derivative of the function \(E(\Delta;\Delta_p,\xi,\sigma,\mathbf{a})\) with respect to one of the parameters \(\Delta_{p}\), \(\xi\), \(\sigma\), or \(a_i\). Note for that
\begin{eqnarray*} \frac{\partial E}{\partial C} & \equiv & 0\\ \frac{\partial E}{\partial a_1} & \equiv & 0\\ \frac{\partial E}{\partial N} & \equiv & 0\\ @f{eqnarray*} @param x Where to evaluate the derivative @param ipar Parameter to differentiate relative to @param dPar Variation in parameter to use in calculation @param delta @f$\Delta_{p}@f$ @param xi @f$\xi@f$ @param sigma @f$\sigma@f$ @param n @f$N@f$ @param a @f$\mathbf{a} = (a_2,...,a_N)@f$ @return @f$\partial E/\partial p|_{x}@f$ */ Double_t DEstimatePar(Double_t x, Int_t ipar, Double_t delta, Double_t xi, Double_t sigma, UShort_t n, Double_t* a, Double_t dPar=0.001) { Double_t dp = dPar; Double_t d2 = dPar / 2; Double_t y1 = 0; Double_t y2 = 0; Double_t y3 = 0; Double_t y4 = 0; switch (ipar) { case Function::kC: case Function::kN: return 0; case Function::kDelta: y1 = NEstimate(x, delta+dp, xi, sigma, n, a); y2 = NEstimate(x, delta+d2, xi, sigma, n, a); y3 = NEstimate(x, delta-d2, xi, sigma, n, a); y4 = NEstimate(x, delta-dp, xi, sigma, n, a); break; case Function::kXi: y1 = NEstimate(x, delta, xi+dp, sigma, n, a); y2 = NEstimate(x, delta, xi+d2, sigma, n, a); y3 = NEstimate(x, delta, xi-d2, sigma, n, a); y4 = NEstimate(x, delta, xi-dp, sigma, n, a); break; case Function::kSigma: y1 = NEstimate(x, delta, xi, sigma+dp, n, a); y2 = NEstimate(x, delta, xi, sigma+d2, n, a); y3 = NEstimate(x, delta, xi, sigma-d2, n, a); y4 = NEstimate(x, delta, xi, sigma-dp, n, a); break; default: { Int_t j = ipar-kA; if (j+1 > n) return 0; Double_t aa = a[j]; a[j] = aa+dp; y1 = NEstimate(x, delta, xi, sigma, n, a); a[j] = aa+d2; y2 = NEstimate(x, delta, xi, sigma, n, a); a[j] = aa-d2; y3 = NEstimate(x, delta, xi, sigma, n, a); a[j] = aa-dp; y4 = NEstimate(x, delta, xi, sigma, n, a); a[j] = aa; } break; } Double_t d0 = y1 - y4; Double_t d1 = 2 * (y2 - y3); Double_t g = 1/(2*dp) * (4*d1 - d0) / 3; return g; } /** Generate a TF1 object of @f$ f_I@f$ @param n @f$ n@f$ - the number of particles @param c Constant @param delta @f$ \Delta@f$ @param xi @f$ \xi_1@f$ @param sigma @f$ \sigma_1@f$ @param a Array of @f$a_i@f$ for @f$i > 1@f$ @param xmin Least value of range @param xmax Largest value of range @return Newly allocated TF1 object */ static TF1* MakeFunc(Int_t n, Double_t c, Double_t delta, Double_t xi, Double_t sigma, Double_t* a, Double_t xmin, Double_t xmax) { Int_t nPar = kN + n; TF1* f = new TF1(Form("landGaus%d",n), &landauGausN, xmin, xmax, nPar); f->SetNpx(500); f->SetParName(kC, "C"); f->SetParName(kDelta, "#Delta_{p}"); f->SetParName(kXi, "#xi"); f->SetParName(kSigma, "#sigma"); f->SetParName(kN, "N"); f->SetParameter(kC, c); f->SetParameter(kDelta, delta); f->SetParameter(kXi, xi); f->SetParameter(kSigma, sigma); f->FixParameter(kN, n); f->SetParLimits(kDelta, xmin, 4); f->SetParLimits(kXi, 0.00, 4); f->SetParLimits(kSigma, 0.01, 0.11); for (Int_t i = 2; i <= n; i++) { Int_t j = i-2; f->SetParName(kA+j, Form("a_{%d}", i)); f->SetParameter(kA+j, a[j]); f->SetParLimits(kA+j, 0, 1); } return f; } /** Make a ROOT TF1 function object corresponding to a single component for @f$ i@f$ particles @param i Number of particles @param c @f$C@f$ @param delta @f$ \Delta@f$ @param xi @f$ \xi_1@f$ @param sigma @f$ \sigma_1@f$ @param xmin Minimum of range of @f$\Delta@f$ @param xmax Maximum of range of @f$\Delta@f$ @return Pointer to newly allocated ROOT TF1 object */ static TF1* MakeIFunc(Int_t i, Double_t c, Double_t delta, Double_t xi, Double_t sigma, Double_t xmin, Double_t xmax) { Int_t nPar = 5; TF1* f = new TF1(Form("landGausI%d",i), &landauGausI, xmin, xmax, nPar); f->SetNpx(100); f->SetParName(kC, "C"); f->SetParName(kDelta, "#Delta_{p}"); f->SetParName(kXi, "#xi"); f->SetParName(kSigma, "#sigma"); f->SetParName(kN, "N"); f->SetParameter(kC, c); f->SetParameter(kDelta, delta); f->SetParameter(kXi, xi); f->SetParameter(kSigma, sigma); f->FixParameter(kN, i); return f; } // --- Object code ------------------------------------------------- /** Constructor @param n @param c @param delta @param xi @param sigma @param a @param xmin @param xmax @return */ Function(Int_t n, Double_t c, Double_t delta, Double_t xi, Double_t sigma, Double_t* a, Double_t xmin, Double_t xmax) : fF(MakeFunc(n, c, delta, xi, sigma, a, xmin, xmax)) {} Function(TF1* f) : fF(f) {} /** Get pointer to ROOT TF1 object @return Pointer to TF1 object */ TF1* GetF1() { return fF; } /** Evaluate the function at @a x @f[ f_N(x;\Delta,\xi,\sigma) = \sum_{i=1}^{n} a_i f(x;\Delta_i,\xi_i,\sigma_i) \]
x | Where to evaluate |
Definition at line 503 of file TestELossDist.C.
Referenced by Generator::Draw(), and RandomEstimateNParticles().
Evaluate the function at x
\[ f_N(x;\Delta,\xi,\sigma) = \sum_{i=1}^{n} a_i f(x;\Delta_i,\xi_i,\sigma_i) \]
This also calculates the error on the point like
\[ \delta^2 f_N = \left(\frac{\partial f_N}{\partial\Delta_p}\right)^2\delta^2\Delta_p+ \left(\frac{\partial f_N}{\partial\xi }\right)^2\delta^2\xi+ \left(\frac{\partial f_N}{\partial\sigma }\right)^2\delta^2\sigma+ \sum_{i=2}^N\left(\frac{\partial f_N}{\partial a_i}\right)^2\delta^2a_i \]
x | Where to evaluate |
e | On return, contains the error \(\delta f_N\) on the function value |
Definition at line 529 of file TestELossDist.C.
Definition at line 701 of file TestELossDist.C.
Referenced by Generator::Draw(), Evaluate(), and RandomEstimateNParticles().
|
inline |
Definition at line 703 of file TestELossDist.C.
Referenced by EstimateNParticles().
|
inline |
|
inline |
Definition at line 693 of file TestELossDist.C.
Referenced by Generator::Draw(), EstimateNParticles(), Evaluate(), and RandomEstimateNParticles().
Definition at line 715 of file TestELossDist.C.
Referenced by EstimateNParticles(), and Evaluate().
|
inline |
Definition at line 717 of file TestELossDist.C.
|
inline |
Definition at line 705 of file TestELossDist.C.
|
inline |
Definition at line 707 of file TestELossDist.C.
Referenced by EstimateNParticles(), and Evaluate().
|
inline |
Definition at line 713 of file TestELossDist.C.
|
inline |
Definition at line 711 of file TestELossDist.C.
Referenced by EstimateNParticles(), and Evaluate().
|
inline |
Definition at line 709 of file TestELossDist.C.
Referenced by EstimateNParticles(), and Evaluate().
|
inline |
Definition at line 699 of file TestELossDist.C.
Referenced by EstimateNParticles(), Evaluate(), and RandomEstimateNParticles().
|
inline |
Definition at line 697 of file TestELossDist.C.
Referenced by Generator::Draw(), EstimateNParticles(), Evaluate(), and RandomEstimateNParticles().
|
inline |
Definition at line 695 of file TestELossDist.C.
Referenced by Generator::Draw(), EstimateNParticles(), Evaluate(), and RandomEstimateNParticles().
|
inlinestatic |
Numerically evaluate
\[ \left.\frac{\partial f_i}{\partial p_i}\right|_{x} \]
where \( p_i\) is the \( i^{\mbox{th}}\) parameter. The mapping of the parameters is given by
This is the partial derivative with respect to the parameter of the response function corresponding to \( i\) particles i.e., with the substitutions
\[ \Delta \rightarrow \Delta_i = i(\Delta + \xi\log(i))\\ \xi \rightarrow \xi_i = i \xi\\ \sigma \rightarrow \sigma_i = \sqrt{i}\sigma\\ \]
i | \( i\) |
x | Where to evaluate |
ipar | Parameter number |
dPar | \( \epsilon\delta p_i\) for some value of \(\epsilon\) |
delta | \( \Delta\) |
xi | \( \xi\) |
sigma | \( \sigma\) |
Definition at line 206 of file TestELossDist.C.
Referenced by Evaluate().
|
inlinestatic |
Evaluate
\[ f_i(x;\Delta,\xi,\sigma) = f(x;\Delta_i,\xi_i,\sigma_i) \]
corresponding to \( i\) particles i.e., with the substitutions
\begin{eqnarray*} \Delta \rightarrow \Delta_i &=& i(\Delta + \xi\log(i))\\ \xi \rightarrow \xi_i &=& i \xi\\ \sigma \rightarrow \sigma_i &=& \sqrt{i}\sigma\\ \end{eqnarray*}
x | Where to evaluate |
delta | \( \Delta\) |
xi | \( \xi\) |
sigma | \( \sigma\) |
i | \( i \) |
Definition at line 160 of file TestELossDist.C.
Referenced by Evaluate(), IdLandauGausdPar(), landauGausI(), NEstimate(), NLandauGaus(), and RandomEstimateNParticles().
Evaluate shifted landay
\[ f'_{L}(x;\Delta,\xi) = f_L(x;\Delta+0.22278298\xi) \]
where \( f_{L}\) is the ROOT implementation of the Landau distribution (known to have \( \Delta_{p}=-0.22278298\) for \(\Delta=0,\xi=1\).
x | Where to evaluate \( f'_{L}\) |
delta | Most probable value |
xi | The 'width' of the distribution |
Definition at line 84 of file TestELossDist.C.
Referenced by ILandauGaus().
|
inlinestatic |
Calculate the value of a Landau convolved with a Gaussian
\[ f(x;\Delta,\xi,\sigma') = \frac{1}{\sigma' \sqrt{2 \pi}} \int_{-\infty}^{+\infty} d\Delta' f'_{L}(x;\Delta',\xi) \exp{-\frac{(\Delta-\Delta')^2}{2\sigma^2}} \]
where \( f'_{L}\) is the Landau distribution, \( \Delta\) the energy loss, \( \xi\) the width of the Landau, and \(\sigma\) is the variance of the Gaussian.
Note that this function uses the constants fgkConvNSteps and fgkConvNSigma
References:
x | where to evaluate \( f\) |
delta | \( \Delta\) of \( f(x;\Delta,\xi,\sigma')\) |
xi | \( \xi\) of \( f(x;\Delta,\xi,\sigma')\) |
sigma | \( \sigma\) of Gaussian |
Definition at line 118 of file TestELossDist.C.
Referenced by ILandauGaus(), landauGaus1(), NEstimate(), and NLandauGaus().
|
inline |
Calculate the the estimate of number of particle contribtutions at energy loss x
\[ E(\Delta;\Delta_p,\xi,\sigma,\mathbf{a}) = \frac{\sum_{i=1}^N i a_i f_i(x;\Delta_p,\xi,\sigma)}{ \sum_{i=1}^N a_i f_i(x;\Delta_p,\xi,\sigma)} \]
where \(a_1=1\)
x | Energy loss \(\Delta\) |
delta | \(\Delta_{p}\) |
xi | \(\xi\) |
sigma | \(\sigma\) |
n | Maximum number of particles \(N\) |
a | Weights \(a_i\) for \(i=2,...,N\) |
Definition at line 304 of file TestELossDist.C.
Referenced by EstimateNParticles().
|
inlinestatic |
Evaluate
\[ f_N(x;\Delta,\xi,\sigma') = \sum_{i=1}^N a_i f_i(x;\Delta,\xi,\sigma'a) \]
where \( f(x;\Delta,\xi,\sigma')\) is the convolution of a Landau with a Gaussian (see LandauGaus). Note that \( a_1 = 1\), \(\Delta_i = i(\Delta_1 + \xi\log(i))\), \(\xi_i=i\xi_1\), and \(\sigma_i'^2 = \sigma_n^2 + i\sigma_1^2\).
References:
x | Where to evaluate \( f_N\) |
delta | \( \Delta_1\) |
xi | \( \xi_1\) |
sigma | \( \sigma_1\) |
n | \( N\) in the sum above. |
a | Array of size \( N-1\) of the weights \( a_i\) for \( i > 1\) |
Definition at line 277 of file TestELossDist.C.
Referenced by landauGausN().
Estimate the number of particles by calculating the weights
\[ w_i = a_i f_i(x;\Delta_p,\xi,\sigma) \]
and then draw a random number \(r\) in the range \([0,\sum_i^N w_i]\) and return the \(i\) for which \(w_{i-1} < @r \leq w_{i}\) (notem \(w_{-1}=0\)).
x | Where to evaluate the component functions |
maxN | Maximum weight to use |
Definition at line 654 of file TestELossDist.C.
Referenced by Generator::Draw().
TF1* Function::fF |
The ROOT object
Definition at line 719 of file TestELossDist.C.
Referenced by Draw(), Evaluate(), GetA(), GetAs(), GetC(), GetDelta(), GetEA(), GetEAs(), GetEC(), GetEDelta(), GetESigma(), GetEXi(), GetN(), GetSigma(), GetXi(), and NEstimate().
|
static |
Number of sigmas to integrate over.
Definition at line 65 of file TestELossDist.C.
|
static |
Number of steps in integration.
Definition at line 67 of file TestELossDist.C.
|
static |
1 / sqrt(2 * pi)
Definition at line 63 of file TestELossDist.C.
|
static |
MP shift.
Definition at line 61 of file TestELossDist.C.
Referenced by Generator::Generate1Signal(), and LandauGaus().