ATLAS Offline Software
Loading...
Searching...
No Matches
PixeldEdxData Class Reference

#include <PixeldEdxData.h>

Collaboration diagram for PixeldEdxData:

Public Member Functions

void setPar (const int i, const double param)
void setPosNeg (const bool posneg)
void setFunctionType (const std::string &fun)
void setBetheBlochType (const std::string &bb)
void setMinimumdEdxForMass (const double mindedxMass)
double dEdxPdf (const double dedx, const double signedP, const double mass, const std::array< double, 9 > &par, const int offset) const
double fdEdxZero (const double x, const std::array< double, 9 > &par) const
double getPar (const int i, const int j) const
std::array< double, 3 > getP (const double dedxArg, const double signedP, const int nGoodPixels) const
std::array< double, 9 > getFirstNPar (const double p, const int nGoodPixels, const int np) const
double getMass (const double dedx, const double signedP, const int nGoodPixels) const
double getdEdx (const double p, const double mass, const int nGoodPixels) const
double getdEdx (const double p, const double mass, const std::array< double, 9 > &par) const
std::vector< float > getLikelihoods (const double dedx2, const double p2, const int nGoodPixels) const

Static Public Member Functions

static double crystalBall (const double x, const double x0, const double sig, const double alp, const double n)
static double asymGaus (const double x, const double x0, const double sig, const double asym)
static double moyal (const double x, const double Ep, const double R)
static double dEdx_5p_BG_aleph (const double xbg, const std::array< double, 9 > &pp)
static double dEdx_5p_aleph (const double p, double mass, const std::array< double, 9 > &pp)
static double dEdx_5p_BG (const double xbg, const std::array< double, 9 > &pp)
static double dEdx_5p (const double p, const double mass, const std::array< double, 9 > &pp)
static double dEdx_BG (const double xbg, const std::array< double, 9 > &pp)
static double dEdx_def (const double p, const double mass, const std::array< double, 9 > &pp)
static double dEdx_3p (const double p, const double mass, const std::array< double, 9 > &pp)

Private Attributes

std::unordered_map< uint32_t, std::vector< double > > m_par
bool m_posneg {}
std::string m_fun
std::string m_bb
double m_mindedxformass {}

Static Private Attributes

static constexpr double m_piMass = 0.13957
static constexpr double m_kMass = 0.49368
static constexpr double m_pMass = 0.93827

Detailed Description

Definition at line 23 of file PixeldEdxData.h.

Member Function Documentation

◆ asymGaus()

double PixeldEdxData::asymGaus ( const double x,
const double x0,
const double sig,
const double asym )
static

Definition at line 164 of file PixeldEdxData.cxx.

164 {
165 double sigp = sig*asym;
166 double sigm = sig/asym;
167 double fun;
168 if (x>x0) { fun = TMath::Gaus(x,x0,sigp,false); }
169 else { fun = TMath::Gaus(x,x0,sigm,false); }
170 return fun/(std::sqrt(2*M_PI)*((sigp*0.5) + (sigm*0.5)));
171}
#define M_PI
#define x

◆ crystalBall()

double PixeldEdxData::crystalBall ( const double x,
const double x0,
const double sig,
const double alp,
const double n )
static

Definition at line 152 of file PixeldEdxData.cxx.

152 {
153 double A = std::pow(n/std::abs(alp),n)*std::exp(-std::pow(std::abs(alp),2)*0.5);
154 double B = n/std::abs(alp)-std::abs(alp);
155 double pull = (x-x0)/sig;
156 double N = sig*(n/alp*(1/(n-1))*std::exp(-alp*alp*0.5)+std::sqrt(M_PI_2)*(1+std::erf(alp*M_SQRT1_2)));
157 if (pull<alp){
158 return std::exp(-pull*pull*0.5)/N;
159 }
160 return A*std::pow(B+pull,-n)/N;
161}

◆ dEdx_3p()

double PixeldEdxData::dEdx_3p ( const double p,
const double mass,
const std::array< double, 9 > & pp )
static

Definition at line 216 of file PixeldEdxData.cxx.

216 {
217 double bg = p/mass;
218 return dEdx_BG(bg,pp);
219}
static double dEdx_BG(const double xbg, const std::array< double, 9 > &pp)

◆ dEdx_5p()

double PixeldEdxData::dEdx_5p ( const double p,
const double mass,
const std::array< double, 9 > & pp )
static

Definition at line 197 of file PixeldEdxData.cxx.

197 {
198 double bg = p/mass;
199 return dEdx_5p_BG(bg,pp);
200}
static double dEdx_5p_BG(const double xbg, const std::array< double, 9 > &pp)

◆ dEdx_5p_aleph()

double PixeldEdxData::dEdx_5p_aleph ( const double p,
double mass,
const std::array< double, 9 > & pp )
static

Definition at line 185 of file PixeldEdxData.cxx.

185 {
186 double bg = p/mass;
187 return dEdx_5p_BG_aleph(bg,pp);
188}
static double dEdx_5p_BG_aleph(const double xbg, const std::array< double, 9 > &pp)

◆ dEdx_5p_BG()

double PixeldEdxData::dEdx_5p_BG ( const double xbg,
const std::array< double, 9 > & pp )
static

Definition at line 190 of file PixeldEdxData.cxx.

190 {
191 double gamma = std::sqrt(xbg*xbg+1);
192 double beta = std::sqrt(1.-1./(gamma*gamma));
193 double fdedx = pp[0]/std::pow(beta,pp[2])*std::log(1+std::pow(std::abs(pp[1])*beta*gamma,pp[4]))-pp[3];
194 return fdedx;
195}

◆ dEdx_5p_BG_aleph()

double PixeldEdxData::dEdx_5p_BG_aleph ( const double xbg,
const std::array< double, 9 > & pp )
static

Definition at line 179 of file PixeldEdxData.cxx.

179 {
180 double gamma = std::sqrt(xbg*xbg+1.);
181 double beta = std::sqrt(1.-1./(gamma*gamma));
182 return pp[0]/std::pow(beta,pp[3])*(pp[1]-std::pow(beta,pp[3])-std::log(pp[2]+1./std::pow(beta*gamma,pp[4])));
183}

◆ dEdx_BG()

double PixeldEdxData::dEdx_BG ( const double xbg,
const std::array< double, 9 > & pp )
static

Definition at line 202 of file PixeldEdxData.cxx.

202 {
203 double gamma = std::sqrt(xbg*xbg+1);
204 double beta = std::sqrt(1-1/(gamma*gamma));
205 double beta2 = beta*beta;
206 double gamma2 = gamma*gamma;
207 double fdedx = (pp[0]/std::pow(beta2,pp[2]))*(std::log(std::abs(pp[1])*beta2*gamma2))-pp[0];
208 return fdedx;
209}

◆ dEdx_def()

double PixeldEdxData::dEdx_def ( const double p,
const double mass,
const std::array< double, 9 > & pp )
static

Definition at line 211 of file PixeldEdxData.cxx.

211 {
212 double bg = p/mass;
213 return dEdx_BG(bg,pp);
214}

◆ dEdxPdf()

double PixeldEdxData::dEdxPdf ( const double dedx,
const double signedP,
const double mass,
const std::array< double, 9 > & par,
const int offset ) const

Definition at line 30 of file PixeldEdxData.cxx.

30 {
31 const auto p = std::abs(signedP);
32
33 double x0 = getdEdx(p,mass,par);
34
35 double pLG[4]={1,1,1,1};
36
37 if (m_fun=="AG") {
38 x0 = std::log(x0) - 9.4;
39 pLG[1] = x0;
40 pLG[0] = par[offset]+par[offset+2];
41 pLG[3] = par[offset+1]+par[offset+3];
42 return asymGaus(dedx, pLG[1], pLG[0], pLG[3]);
43 }
44 else if (m_fun=="CB") {
45 x0 = std::log(x0) - 9.4;
46 pLG[0] = x0;
47 pLG[1] = par[offset];
48 pLG[2] = par[offset+1];
49 pLG[3] = par[offset+2];
50 return crystalBall(dedx, pLG[0], pLG[1], pLG[2], pLG[3]);
51 }
52 return 0;
53}
static double crystalBall(const double x, const double x0, const double sig, const double alp, const double n)
double getdEdx(const double p, const double mass, const int nGoodPixels) const
std::string m_fun
static double asymGaus(const double x, const double x0, const double sig, const double asym)

◆ fdEdxZero()

double PixeldEdxData::fdEdxZero ( const double x,
const std::array< double, 9 > & par ) const

Definition at line 55 of file PixeldEdxData.cxx.

55 {
56 return getdEdx(par[6],x,par)-par[5];
57}

◆ getdEdx() [1/2]

double PixeldEdxData::getdEdx ( const double p,
const double mass,
const int nGoodPixels ) const

Definition at line 133 of file PixeldEdxData.cxx.

133 {
134 if (nGoodPixels<=0) { return -2; }
135 const auto & par = getFirstNPar(signedP,nGoodPixels,5);
136 const auto p = std::abs(signedP);
137 if (m_bb=="3p") { return dEdx_3p(p,mass,par); }
138 else if (m_bb=="5p") { return dEdx_5p(p,mass,par); }
139 else if (m_bb=="5p_aleph") { return dEdx_5p_aleph(p,mass,par); }
140 return 0;
141}
std::string m_bb
static double dEdx_5p_aleph(const double p, double mass, const std::array< double, 9 > &pp)
static double dEdx_5p(const double p, const double mass, const std::array< double, 9 > &pp)
std::array< double, 9 > getFirstNPar(const double p, const int nGoodPixels, const int np) const
static double dEdx_3p(const double p, const double mass, const std::array< double, 9 > &pp)

◆ getdEdx() [2/2]

double PixeldEdxData::getdEdx ( const double p,
const double mass,
const std::array< double, 9 > & par ) const

Definition at line 143 of file PixeldEdxData.cxx.

143 {
144 const auto p = std::abs(signedP);
145 if (m_bb=="3p") { return dEdx_3p(p,mass,par); }
146 else if (m_bb=="5p") { return dEdx_5p(p,mass,par); }
147 else if (m_bb=="5p_aleph") { return dEdx_5p_aleph(p,mass,par); }
148 return 0;
149}

◆ getFirstNPar()

std::array< double, 9 > PixeldEdxData::getFirstNPar ( const double p,
const int nGoodPixels,
const int np ) const

Definition at line 93 of file PixeldEdxData.cxx.

93 {
94 std::array<double,9> par{};
95 auto setNGoodPixels{nGoodPixels};
96 if (setNGoodPixels>5) { setNGoodPixels=5; }
97 if (p<0 && m_posneg) { setNGoodPixels += 5; }
98 for (int i=0;i<npar;i++){
99 par[i] = getPar(setNGoodPixels-1,i);
100 }
101 return par;
102}
double getPar(const int i, const int j) const

◆ getLikelihoods()

std::vector< float > PixeldEdxData::getLikelihoods ( const double dedx2,
const double p2,
const int nGoodPixels ) const

Definition at line 222 of file PixeldEdxData.cxx.

222 {
223 double dedx=dedx2;
224 double p=p2*0.001;
225 std::vector<float> vecResult(3,-1);
226 if (nGoodPixels>0){
227 const auto & array { getP(dedx,p,nGoodPixels)};
228 std::copy(array.begin(), array.end(),vecResult.begin());
229 }
230 return vecResult;
231}
std::array< double, 3 > getP(const double dedxArg, const double signedP, const int nGoodPixels) const

◆ getMass()

double PixeldEdxData::getMass ( const double dedx,
const double signedP,
const int nGoodPixels ) const

Definition at line 104 of file PixeldEdxData.cxx.

104 {
105
106 if (dedx<m_mindedxformass) { return m_piMass; }
107
108 if (nGoodPixels<=0) { return -2; }
109 auto par = getFirstNPar(signedP,nGoodPixels,5);
110
111 const auto p = std::abs(signedP);
112
113 par[5] = dedx;
114 par[6] = p;
115
116 double xmin=0;
117 double xmax=14000;
118
119 double xmed = (xmin+xmax)*0.5;
120 double prec=1e-6;
121
122 if (dedx<15000){ return m_piMass; }
123
124 do {
125 if (fdEdxZero(xmed,par)==0) { return xmed; }
126 if (fdEdxZero(xmed,par)*fdEdxZero(xmax,par)>0) { xmax=xmed; }
127 else { xmin=xmed; }
128 xmed=(xmin+xmax)*0.5;
129 } while (std::abs(xmax-xmin)>prec);
130 return xmed;
131}
double m_mindedxformass
static constexpr double m_piMass
double fdEdxZero(const double x, const std::array< double, 9 > &par) const
double xmax
Definition listroot.cxx:61
double xmin
Definition listroot.cxx:60

◆ getP()

std::array< double, 3 > PixeldEdxData::getP ( const double dedxArg,
const double signedP,
const int nGoodPixels ) const

Definition at line 71 of file PixeldEdxData.cxx.

71 {
72 std::array<double,3> vhypo{-2,-2,-2};
73 if (nGoodPixels<=0) { return vhypo; }
74 const auto & par = getFirstNPar(signedP,nGoodPixels,9);
75 const auto p = std::fabs(signedP);
76
77 const auto dedx = std::log(dedxArg)-9.4;
78
79 double pk = dEdxPdf(dedx,p,m_kMass ,par,5);
80 double pp = dEdxPdf(dedx,p,m_pMass ,par,5);
81 double ppi = dEdxPdf(dedx,p,m_piMass,par,5);
82
83 if (ppi+pk+pp>=0) {
84 vhypo = {ppi, pk,pp};
85 }
86 else {
87 vhypo ={-1,-1,-1};
88 }
89 return vhypo;
90}
static constexpr double m_kMass
double dEdxPdf(const double dedx, const double signedP, const double mass, const std::array< double, 9 > &par, const int offset) const
static constexpr double m_pMass

◆ getPar()

double PixeldEdxData::getPar ( const int i,
const int j ) const

Definition at line 59 of file PixeldEdxData.cxx.

59 {
60 auto itr = m_par.find(i);
61 if (itr!=m_par.end()) {
62 const std::vector<double> &param = itr->second;
63 if (j<(int)param.size()) {
64 return param[j];
65 }
66 }
67 return 0;
68}
std::unordered_map< uint32_t, std::vector< double > > m_par

◆ moyal()

double PixeldEdxData::moyal ( const double x,
const double Ep,
const double R )
static

Definition at line 174 of file PixeldEdxData.cxx.

174 {
175 double lambda = (x-Ep)/R;
176 return std::sqrt(std::exp(-lambda-std::exp(-lambda))*M_1_PI*0.5);
177}

◆ setBetheBlochType()

void PixeldEdxData::setBetheBlochType ( const std::string & bb)

Definition at line 22 of file PixeldEdxData.cxx.

22 {
23 m_bb = bb;
24}

◆ setFunctionType()

void PixeldEdxData::setFunctionType ( const std::string & fun)

Definition at line 18 of file PixeldEdxData.cxx.

18 {
19 m_fun = fun;
20}

◆ setMinimumdEdxForMass()

void PixeldEdxData::setMinimumdEdxForMass ( const double mindedxMass)

Definition at line 26 of file PixeldEdxData.cxx.

26 {
27 m_mindedxformass = mindedxMass;
28}

◆ setPar()

void PixeldEdxData::setPar ( const int i,
const double param )

Definition at line 10 of file PixeldEdxData.cxx.

10 {
11 m_par[i].push_back(param);
12}

◆ setPosNeg()

void PixeldEdxData::setPosNeg ( const bool posneg)

Definition at line 14 of file PixeldEdxData.cxx.

14 {
15 m_posneg = posneg;
16}

Member Data Documentation

◆ m_bb

std::string PixeldEdxData::m_bb
private

Definition at line 66 of file PixeldEdxData.h.

◆ m_fun

std::string PixeldEdxData::m_fun
private

Definition at line 65 of file PixeldEdxData.h.

◆ m_kMass

double PixeldEdxData::m_kMass = 0.49368
staticconstexprprivate

Definition at line 60 of file PixeldEdxData.h.

◆ m_mindedxformass

double PixeldEdxData::m_mindedxformass {}
private

Definition at line 67 of file PixeldEdxData.h.

67{};

◆ m_par

std::unordered_map<uint32_t,std::vector<double> > PixeldEdxData::m_par
private

Definition at line 63 of file PixeldEdxData.h.

◆ m_piMass

double PixeldEdxData::m_piMass = 0.13957
staticconstexprprivate

Definition at line 59 of file PixeldEdxData.h.

◆ m_pMass

double PixeldEdxData::m_pMass = 0.93827
staticconstexprprivate

Definition at line 61 of file PixeldEdxData.h.

◆ m_posneg

bool PixeldEdxData::m_posneg {}
private

Definition at line 64 of file PixeldEdxData.h.

64{};

The documentation for this class was generated from the following files: