11 #include "StdEdxModel.h"
14 #include "St_spline3C.h"
16 #define ggderiv ggderiv_
18 #define ggderiv GGDERIV
21 void type_of_call ggderiv(Double_t &, Double_t &, Double_t &, Double_t &, Double_t &, Double_t *);
34 StdEdxModel::StdEdxModel() : fScale(1)
38 cout <<
"StdEdxModel:: use StTpcRSMaker model for dE/dx calculations" << endl;
39 memset(beg, 0, end-beg+1);
40 TDirectory *dir = gDirectory;
43 if ( ! Stspline3LndNdxL10::instance()) NFiles = 1;
44 if ( Stspline3LndNdxL10::instance()->IsValid()) NFiles = 1;
46 const Char_t *path =
".:./StarDb/dEdxModel:$STAR/StarDb/dEdxModel";
48 const Char_t *Files[2] = {
"dNdE_Bichsel.root",
"dNdx_Bichsel.root"};
50 const Char_t *Files[2] = {
"dNdx_Heed.root",
"dNdx_Heed.root"};
52 #define __Warn_Hist__(__HIST__) {m ## __HIST__ = (TH1D *) pFile->Get(#__HIST__); \
53 if (m ## __HIST__) {Warning("StdEdxModel","Histogram %s/%s has been found",m ## __HIST__->GetName(),m ## __HIST__->GetTitle()); m ## __HIST__->SetDirectory(0);}}
54 for (Int_t i = 0; i < NFiles; i++) {
55 Char_t *file = gSystem->Which(path,Files[i],kReadPermission);
56 if (! file) Fatal(
"StdEdxModel",
"File %s has not been found in path %s",Files[i],path);
57 else Warning(
"StdEdxModel",
"File %s has been found as %s",Files[i],file);
58 TFile *pFile =
new TFile(file);
61 __Warn_Hist__(dNdxL10);
62 __Warn_Hist__(LndNdxL10);
63 __Warn_Hist__(LndNdxL10Smooth);
64 mLndNdxL10Spline5 = (TSpline5 *) pFile->Get(
"LndNdxL10Spline5");
if (mLndNdxL10Spline5) {Warning(
"StdEdxModel",
"TSpline5 %s has been found",mLndNdxL10Smooth->GetName());}
65 assert(mdNdx || mdNdxL10);
67 mdNdEL10 = (TH1D *) pFile->Get(
"dNdEL10"); assert(mdNdEL10); Warning(
"StdEdxModel",
"Histogram %s/%s has been found",mdNdEL10->GetName(),mdNdEL10->GetTitle()); mdNdEL10->SetDirectory(0);
74 fGGaus =
new TF1(
"GGaus",ggaus, -1., 5., 5);
75 fGGaus->SetParNames(
"NormL",
"mu",
"sigma",
"alpha",
"k");
76 fGGaus->SetParameters(0,0,0.3,0.1,0);
77 fGGaus->FixParameter(4,0.0);
79 fGausExp =
new TF1(
"GausExp",gausexp, -5., 5., 5);
80 fGausExp->SetParNames(
"NormL",
"mu",
"sigma",
"k",
"l");
81 fGausExp->SetParameters(0,0,0.3,5.,0);
82 fGausExp->FixParameter(4,0.0);
86 Double_t dEdxMIPLog = TMath::Log(2.62463815285237434); ;
87 Double_t MIPBetaGamma10 = TMath::Log10(4.);
89 Double_t pars[3] = { 1.0, 1.0, 0.13956995};
90 Double_t dEdxLog = zMP(&MIPBetaGamma10, pars);
91 fLogkeVperElectron = dEdxMIPLog - dEdxLog;
92 cout <<
"StdEdxModel:: set scale = " << Form(
"%5.1f",1e3*keVperElectron()) <<
" eV/electron" << endl;
95 StdEdxModel::~StdEdxModel() {
99 SafeDelete(mLndNdxL10);
100 SafeDelete(mLndNdxL10Smooth);
101 SafeDelete(mLndNdxL10Spline5);
103 SafeDelete(fGausExp);
110 Double_t StdEdxModel::dNdx(Double_t poverm, Double_t charge) {
111 if (!fgStdEdxModel) instance();
112 fTmaxL10eV = tmaxL10eV(poverm);
113 Double_t Q_eff = TMath::Abs(charge);
115 Double_t beta = poverm/TMath::Sqrt(1.0 + poverm*poverm);
117 Double_t w1 = 1.034 - 0.1777*TMath::Exp(-0.08114*Q_eff);
118 Double_t w2 = beta*TMath::Power(Q_eff,-2./3.);
119 Double_t w3 = 121.4139*w2 + 0.0378*TMath::Sin(190.7165*w2);
120 Q_eff *= 1. -w1*TMath::Exp(-w3);
123 if ( Stspline3LndNdxL10::instance() && Stspline3LndNdxL10::instance()->IsValid()) {
124 dNdx = TMath::Exp(Stspline3LndNdxL10::instance()->Func()->Eval(TMath::Log10(poverm)));
126 if (mLndNdxL10Spline5) {
127 dNdx = TMath::Exp(mLndNdxL10Spline5->Eval(TMath::Log10(poverm)));
128 }
else if (mLndNdxL10Smooth) {
129 dNdx = TMath::Exp(mLndNdxL10Smooth->Interpolate(TMath::Log10(poverm)));
130 }
else if (mLndNdxL10) {
131 dNdx = TMath::Exp(mLndNdxL10->Interpolate(TMath::Log10(poverm)));
132 }
else if (mdNdxL10) {
133 dNdx = mdNdxL10->Interpolate(TMath::Log10(poverm));
135 dNdx = mdNdx->Interpolate(poverm);
138 return fScale*Q_eff*Q_eff*dNdx;
141 Double_t StdEdxModel::dNdxL10func(Double_t *x, Double_t *p) {
142 Double_t bgL10 = x[0];
143 Double_t bg = TMath::Power(10., bgL10);
144 return instance()->dNdx(bg, 1.);
147 TF1 *StdEdxModel::dNdxL10F() {
148 TF1 *f =
new TF1(
"dNdxL10F",dNdxL10func,-2,5,0);
152 Double_t StdEdxModel::dNdE() {
153 static Double_t cLog10 = TMath::Log(10.);
154 Double_t dE = TMath::Exp(cLog10*mdNdEL10->GetRandom());
158 Double_t StdEdxModel::gausw(Double_t *x, Double_t *p) {
162 Double_t NormL = p[0];
165 Double_t alpha = p[3];
166 Double_t t = (X - ksi)/w;
167 Double_t v = t/TMath::Sqrt2();
168 Double_t G = TMath::Exp(NormL)*TMath::Gaus(t,0,1,kTRUE);
169 Double_t GA = TMath::Gaus(alpha*t,0,1,kTRUE);
170 Double_t E = (1. + TMath::Erf(alpha*v));
172 if (k == 0)
return V;
173 Double_t dVdNormL = V;
174 if (k == 1)
return dVdNormL;
218 Double_t dVdksi = - (V + G/w*GA*alpha/TMath::Sqrt2())/w;
219 if (k == 2)
return dVdksi;
221 Double_t dVdw = - (2*V + G/w*GA*alpha/TMath::Sqrt2())/w;
222 if (k == 3)
return dVdw;
223 Double_t dVdalpha = GA*v;
227 Double_t StdEdxModel::ggaus(Double_t *x, Double_t *p) {
228 return ggausD(x,p,0);
231 Double_t StdEdxModel::ggausD(Double_t *x, Double_t *p, Double_t *der) {
233 Double_t NormL = p[0];
235 Double_t sigma = p[2];
236 Double_t alpha = p[3];
239 if (TMath::Abs(alpha) > 1e-7) {
240 Double_t delta =alpha/TMath::Sqrt(1 + alpha*alpha);
241 Double_t muz = delta/TMath::Sqrt(TMath::PiOver2());
242 Double_t sigmaz = TMath::Sqrt(1 - muz*muz);
243 Double_t gamma1 = (4 - TMath::Pi())/2 * TMath::Power(delta*TMath::Sqrt(2./TMath::Pi()), 3)
244 / TMath::Power(1 - 2*delta*delta/TMath::Pi(), 1.5);
245 Double_t m_0 = muz - gamma1*sigmaz/2 - TMath::Sign(1.,alpha)/2*TMath::Exp(-2*TMath::Pi()/TMath::Abs(alpha));
246 w = sigma/TMath::Sqrt(1 - 2* delta*delta/TMath::Pi());
250 Double_t par[5] = {NormL, ksi, w, alpha, 0};
251 Double_t V = gausw(x, par);
297 der[0] = der[1] = der[2] = 0;
298 ggderiv(x[0], ksi, sigma, w, alpha, der);
303 Double_t StdEdxModel::gausexp(Double_t *x, Double_t *p) {
304 return gausexpD(x,p);
307 Double_t StdEdxModel::gausexpD(Double_t *x, Double_t *p, Double_t *der) {
311 Double_t normL = p[0];
313 Double_t sigma = p[2];
315 Double_t t = (x[0] - mu)/sigma;
325 V = TMath::Exp(-t*t/2);
328 V = TMath::Exp(k*k/2 - k*t);
352 static Double_t SQ2pi = TMath::Sqrt(TMath::Pi())/TMath::Sqrt2();
353 Double_t D = SQ2pi*(1 + TMath::Erf(k/TMath::Sqrt2()));
354 Double_t C = TMath::Exp(-k*k/2)/k;
355 Double_t N = (D + C)*sigma;
356 Double_t Prob = TMath::Exp(normL)*V/N;
358 Double_t dtdM = -1./sigma;
359 Double_t dtdS = -t /sigma;
360 Double_t dDdk = TMath::Exp(-k*k/2.);
361 Double_t dCdk = - C*(k + 1./(k*k));
362 Double_t dNdk = (dDdk + dCdk) * sigma;
363 Double_t dPdM = Prob * dVdt / V * dtdM;
364 Double_t dPdS = Prob * dVdt / V * dtdS;
365 Double_t dPdk = Prob *(dVdk / V - dNdk / N);
382 void StdEdxModel::Parameters(Double_t Np, Double_t *parameters, Double_t *dPardNp) {
383 parameters[0] = parameters[1] = parameters[2] = 0;
384 if (Np <= 1.0)
return;
385 for (Int_t l = 0; l < 3; l++) {
389 parameters[l] =
Parameter(Np, l, &dPardNp[l]);
394 Double_t StdEdxModel::Parameter(Double_t Np, Int_t l, Double_t *dPardNp) {
396 static Double_t parsA[2] = { 5.4634, -0.57598};
397 static Double_t parsS[3] = { 1.6924, -1.2912, 0.24698};
398 static Double_t parsM[8] = { -4.3432, 4.6327, -1.9522, 0.4691, -0.066615, 0.0055111, -0.00024531, 4.5394e-06};
399 Double_t x = TMath::Log(Np);
400 Double_t dxdNp = 1./Np;
402 Double_t alpha = parsA[0] + x * parsA[1];
403 if (dPardNp) dPardNp[0] = parsA[1] * dxdNp;
406 Double_t xx = (x > 0) ? TMath::Log(x) : 0;
407 Double_t sigma = parsS[0] + xx * ( parsS[1] + xx * parsS[2]);
409 Double_t dxxdx = 1./xx;
410 Double_t dxxdNp = dxxdx * dxdNp;
411 dPardNp[0] = (parsS[1] + 2 * xx * parsS[2]) * dxxdNp;
415 Double_t mu = fpol7F->EvalPar(&x, parsM);
417 static Double_t parsMD[7] = {0};
419 for (Int_t i = 0; i < 7; i++) {
420 parsMD[i] = (i+1)*parsM[i+1];
423 dPardNp[0] = fpol6F->EvalPar(&x, parsMD) * dxdNp;
432 Double_t StdEdxModel::MukeV(Double_t Np) {
433 return Parameter(Np, 0) + fLogkeVperElectron + TMath::Log(Np);
436 Double_t StdEdxModel::funParam(Double_t *x, Double_t *p) {
438 if (l < 0 || l > 2)
return 0;
439 Double_t Np = TMath::Exp(x[0]);
440 return StdEdxModel::instance()->Parameter(Np, l);
443 TF1 *StdEdxModel::FParam(Int_t l) {
444 const Char_t *fNames[3] = {
"MuPar",
"sigmaPar",
"alphaPar"};
446 if (l < 0 || l > 2)
return f;
447 f = (TF1 *) gROOT->GetListOfFunctions()->FindObject(fNames[l]);
449 f =
new TF1(fNames[l],funParam,1.5,12,1);
450 f->SetParName(0,fNames[l]);
451 f->SetParameter(0,l);
452 cout <<
"Create FParam with name " << f->GetName() << endl;
458 Double_t StdEdxModel::Prob(Double_t ee, Double_t Np, Double_t *der) {
463 V = ggaus(&ee, params);
465 Double_t dPardNp[3] = {0};
467 Double_t dVdP[3] = {0};
468 V = ggausD(&ee, params, dVdP);
470 for (Int_t l = 0; l < 3; l++) der[0] += dVdP[l]*dPardNp[l];
471 static Int_t _debug = 0;
473 Double_t xP = TMath::Log(Np);
474 Double_t D = instance()->FProbP()->Derivative(xP,&ee)/Np;
475 cout <<
"estimated derivative (xP = " << xP <<
", ee = " << ee <<
") = " << der[0] <<
" calculated derivative = " << D << endl;
481 Double_t StdEdxModel::funcProb(Double_t *x, Double_t *p) {
482 return instance()->Prob(x[0],p[0]);
485 TF1 *StdEdxModel::FProb() {
486 const Char_t *name =
"GGProb";
487 TF1 *f = (TF1 *) gROOT->GetListOfFunctions()->FindObject(name);
489 f =
new TF1(name,funcProb,-1,4,1);
490 f->SetParName(0,
"Np");
491 f->SetParameter(0,32);
492 cout <<
"Create FProb with name " << f->GetName() << endl;
497 Double_t StdEdxModel::funcProbP(Double_t *x, Double_t *p) {
498 if (p[0] < 1)
return 0;
499 return instance()->Prob(TMath::Log(p[0]),x[0]);
502 TF1 *StdEdxModel::FProbP() {
503 const Char_t *name =
"GGProbP";
504 TF1 *f = (TF1 *) gROOT->GetListOfFunctions()->FindObject(name);
506 f =
new TF1(name,funcProbP,2,12,1);
507 f->SetParName(0,
"x");
508 f->SetParameter(0,1);
509 cout <<
"Create FProbP with name " << f->GetName() << endl;
514 Double_t StdEdxModel::funcProbDer(Double_t *x, Double_t *p) {
516 instance()->Prob(x[0], p[0], &der);
520 TF1 *StdEdxModel::FProbDer() {
521 const Char_t *name =
"GGProbDer";
522 TF1 *f = (TF1 *) gROOT->GetListOfFunctions()->FindObject(name);
524 f =
new TF1(name,funcProbDer,-1,4,1);
525 f->SetParName(0,
"Np");
526 f->SetParameter(0,32);
527 cout <<
"Create FProb with name " << f->GetName() << endl;
533 Double_t StdEdxModel::ProbEx(Double_t ee, Double_t Np, Double_t *der) {
534 Double_t params[5] = {0};
538 V = gausexp(&ee, params);
540 Double_t dPardNp[3] = {0};
542 Double_t dVdP[3] = {0};
543 V = gausexpD(&ee, params, dVdP);
545 for (Int_t l = 0; l < 3; l++) der[0] += dVdP[l]*dPardNp[l];
551 Double_t StdEdxModel::ProbdEGeVlog(Double_t dEGeVLog, Double_t Np, Double_t *der) {
552 Double_t ee = Logne(dEGeVLog) - TMath::Log(Np);
553 return Prob(ee, Np, der);
556 Double_t StdEdxModel::zMP(Double_t *x, Double_t *p) {
557 Double_t bgL10 = x[0];
558 Double_t pOverMRC = TMath::Power(10., bgL10);
560 Double_t log2dx = p[0];
561 Double_t charge = p[1];
562 Double_t mass = p[2];
563 Double_t dx = TMath::Power( 2., log2dx);
564 Double_t dNdx = StdEdxModel::instance()->dNdxEff(pOverMRC, charge, mass);
565 Double_t Np = dNdx*dx;
571 Double_t dEkeVLog = instance()->MukeV(Np);
572 Double_t dEdxLog = dEkeVLog - TMath::Log(dx);
573 Double_t dEdxCor = 0;
576 if ( EL && EL->IsValid() && EL->InRange(bgL10)) {
577 dEdxCor = StElectonsDEV_dEdx::instance()->Func()->Eval(bgL10);
578 static TF1 *elCor1 = 0;
580 Double_t pars1[4] = {-0.2100929, 0.1500455, -0.02743834, 0.001894849};
581 Double_t pars2[4] = {-0.04352509, 0.03437069, -0.002851349, -0.0003568138};
582 Double_t pars[4] = {0};
583 for (Int_t i = 0; i < 4; i++) pars[i] = pars1[i] + pars2[i];
584 elCor1 =
new TF1(
"dEdxElCor1",
"pol3",2.0,3.5); elCor1->SetParameters(pars);
586 dEdxCor += elCor1->Eval(bgL10);
587 dEdxCor += -7.63891e-03 - 3.57110e-03 ;
589 static Double_t pionM = 0.13956995;
590 static Double_t protonM = 0.9382723;
591 static Double_t mPionL10 = TMath::Log10(pionM);
592 static Double_t mProtonL10 = TMath::Log10(protonM);
593 static Double_t dML10 = mProtonL10 - mPionL10;
594 Double_t dEdxCorPion = 0;
595 Double_t dEdxCorProton = 0;
597 if ( PI && PI->IsValid() && PI->InRange(bgL10)) {
598 dEdxCorPion = PI->Func()->Eval(bgL10);
599 static TF1 *piCor1 = 0;
601 Double_t pars[4] = {0.008567411, 0.01817216, -0.004932309, -0.001434306};
602 piCor1 =
new TF1(
"dEdxPiCor1",
"pol3",-0.2,1.6); piCor1->SetParameters(pars);
604 dEdxCorPion += piCor1->Eval(bgL10);
607 if (P &&P->IsValid() &&P->InRange(bgL10)) {
608 dEdxCorProton = P->Func()->Eval(bgL10);
609 static TF1 *protonCor1 = 0;
611 Double_t pars[6] = {0.01745018 + 0.005654033 - 3.57110e-03 , 0.005726225 -0.00228347, 0.004416636, -0.02814983, 0.1824491, -0.2114645};
613 protonCor1 =
new TF1(
"dEdxProtonCor1",
"pol5",-0.5,0.8); protonCor1->SetParameters(pars);
615 dEdxCorProton += protonCor1->Eval(bgL10);
617 Double_t mL10 = TMath::Log10(mass);
618 dEdxCor += dEdxCorPion + (dEdxCorProton - dEdxCorPion)*(mL10 - mPionL10)/dML10;
623 return dEdxLog + dEdxCor;
626 TF1 *StdEdxModel::ZMP(Double_t log2dx, Double_t charge, Double_t mass) {
627 TString fName(Form(
"New%i",(
int)(2*(log2dx+2))));
628 TF1 *f = (TF1 *) gROOT->GetListOfFunctions()->FindObject(fName);
630 f =
new TF1(fName,zMP,-2,5,3);
632 f->SetParNames(
"log2dx",
"charge",
"mass");
633 f->SetParameter(0,log2dx);
634 f->SetParameter(1, charge);
635 f->SetParameter(2, mass);
636 cout <<
"Create ZMPNew with name " << f->GetName() <<
" for log2dx = " << log2dx <<
" and mass = " << mass << endl;
641 void StdEdxModel::InitPar() {
642 fpol2F = (TF1 *) gROOT->GetListOfFunctions()->FindObject(
"pol2");
643 fpol5F = (TF1 *) gROOT->GetListOfFunctions()->FindObject(
"pol5");
644 fpol6F = (TF1 *) gROOT->GetListOfFunctions()->FindObject(
"pol6");
645 fpol7F = (TF1 *) gROOT->GetListOfFunctions()->FindObject(
"pol7");
646 if (! fpol2F || ! fpol5F || ! fpol6F || ! fpol7F) {
647 TF1::InitStandardFunctions();
648 fpol2F = (TF1 *) gROOT->GetListOfFunctions()->FindObject(
"pol2");
649 fpol5F = (TF1 *) gROOT->GetListOfFunctions()->FindObject(
"pol5");
650 fpol6F = (TF1 *) gROOT->GetListOfFunctions()->FindObject(
"pol6");
651 fpol7F = (TF1 *) gROOT->GetListOfFunctions()->FindObject(
"pol7");
655 Double_t StdEdxModel::tmaxL10eV(Double_t bg) {
656 static Double_t Tcut = 1e-4;
657 static Double_t m_e = 0.51099907e-3;
658 Double_t bg2 = bg*bg;
660 Double_t tMax = 2*m_e*bg2;
661 return TMath::Log10(1e9*TMath::Min(Tcut, tMax));
664 Double_t StdEdxModel::saturationTanH(Double_t *x, Double_t *p) {
666 return p[0]+p[1]*TMath::TanH(p[2]+x[0]*(p[3]+x[0]*(p[4] + x[0]*(p[5] +x[0]*(p[6] + x[0]*p[7])))));
669 TF1 *StdEdxModel::SaturTanH() {
672 f =
new TF1(
"SaturTanHF",StdEdxModel::saturationTanH,-5,5,8);
673 Double_t pars[8] = { -0.060944, -0.014597, 1.6066, -3.4821, 3.4131, -1.3879, 0.26295, -0.019545};
674 f->SetParNames(
"offset",
"slope",
"a0",
"a1",
"a2",
"a3",
"a4",
"a5",
"a6");
675 f->SetParameters(pars);
680 Double_t StdEdxModel::saturationFunc(Double_t *x, Double_t *p) {
681 return (p[0] + p[1]*TMath::TanH(p[2]*(x[0] - p[3])))*(1 + x[0]*(p[4] + x[0]*(p[5] + x[0]*p[6])));
684 TF1 *StdEdxModel::Saturation(Int_t particle) {
687 Double_t params[1][7] = {{ 0., 1., 1., 0., 0.0, 0.0, 0.0}};
711 f =
new TF1(
"SaturationF",StdEdxModel::saturationFunc,-5,5,7);
712 f->SetParNames(
"offset",
"slope",
"scale",
"shift",
"decay",
"decay2",
"decay3");
714 f->SetParameters(params[particle]);
718 Double_t StdEdxModel::bgCorrected(Double_t bgRC) {
720 Double_t pars[3] = {-0.00020089, 0.0031976, 0.0062467};
721 static TF1 *pol2 = 0;
723 pol2 = (TF1 *) gROOT->GetListOfFunctions()->FindObject(
"pol2");
725 TF1::InitStandardFunctions();
726 pol2 = (TF1 *) gROOT->GetListOfFunctions()->FindObject(
"pol2");
730 Double_t bgRC2 = bgRC*bgRC;
731 Double_t beta2RC = bgRC2/(bgRC2 + 1);
732 Double_t betaRCL10 = 0.5*TMath::Log(beta2RC);
733 Double_t bgMC = bgRC;
734 if (betaRCL10 < -0.5) bgMC += pol2->EvalPar(&betaRCL10, pars);
738 TH1D *StdEdxModel::protonEff() {
742 TH1D *eff =
new TH1D(
"protonEff",
"",100,-2.0,0.0);
743 Double_t corr[102] = { 0,
744 0.8300, 0.8335, 0.8367, 0.8396, 0.8422, 0.8446, 0.8467, 0.8485, 0.8501, 0.8516,
745 0.8575, 0.8635, 0.8691, 0.8741, 0.8784, 0.8822, 0.8853, 0.8879, 0.8901, 0.8920,
746 0.8935, 0.8948, 0.8959, 0.8968, 0.8975, 0.8981, 0.8987, 0.8991, 0.8995, 0.8999,
747 0.9002, 0.9004, 0.9006, 0.9008, 0.9010, 0.9012, 0.9013, 0.9014, 0.9016, 0.9018,
748 0.9020, 0.9021, 0.9022, 0.9023, 0.9024, 0.9025, 0.9025, 0.9026, 0.9026, 0.9027,
749 0.9027, 0.9028, 0.9028, 0.9028, 0.9029, 0.9029, 0.9029, 0.9029, 0.9029, 0.9030,
750 0.9030, 0.9030, 0.9030, 0.9030, 0.9030, 0.9030, 0.9030, 0.9030, 0.9030, 0.9031,
751 0.9031, 0.9031, 0.9031, 0.9031, 0.9031, 0.9031, 0.9031, 0.9031, 0.9031, 0.9031,
752 0.9031, 0.9031, 0.9031, 0.9031, 0.9031, 0.9031, 0.9031, 0.9031, 0.9031, 0.9031,
753 0.9031, 0.9031, 0.9031, 0.9031, 0.9031, 0.9031, 0.9031, 0.9031, 0.9031, 0.9031,
756 eff->SetDirectory(0);
758 eff->SetFillColor(19);
759 eff->SetFillStyle(0);
760 eff->SetLineColor(9);
761 eff->SetLineWidth(3);
762 eff->SetMarkerStyle(20);
763 eff->GetXaxis()->SetTitleOffset(1.2);
768 Double_t StdEdxModel::NpCorrection(Double_t betagamma) {
769 Double_t bgL10 = TMath::Log10(betagamma);
770 bgL10 = TMath::Max(-2.0, TMath::Min(-1e-3,bgL10));
771 static TH1D *eff = 0;
772 if (! eff) eff = protonEff();
774 return eff->Interpolate(bgL10);
777 Double_t StdEdxModel::dNdxEff(Double_t poverm, Double_t charge, Double_t mass) {
778 if (!fgStdEdxModel) instance();
779 Double_t bgMC = bgCorrected(poverm);
780 Double_t dNdxMC = dNdx(bgMC, charge);
781 Double_t dNdx = dNdxMC*NpCorrection(poverm);
785 Double_t StdEdxModel::dNdxEffL10func(Double_t *x, Double_t *p) {
786 Double_t bg = TMath::Power(10., x[0]);
787 return instance()->dNdxEff(bg, 1., 0.13956995);
790 TF1 *StdEdxModel::dNdxEffL10F() {
791 TF1 *f =
new TF1(
"dNdxEffL10F",dNdxEffL10func,-2,5,0);
795 Double_t StdEdxModel::extremevalueG(Double_t *x, Double_t *p) {
796 Double_t normL = p[0];
798 Double_t sigmaI = p[2];
799 Double_t phase = p[3];
800 Double_t sigmaG = p[4];
801 Double_t t = (mu - x[0])*sigmaI;
802 Double_t frac = TMath::Sin(phase);
804 return TMath::Exp(normL)*((1. - frac)*TMath::Abs(sigmaI)*TMath::Exp(t - TMath::Exp(t)) + frac*TMath::Gaus(t, 0., sigmaG, kTRUE));
807 TF1 *StdEdxModel::ExValG() {
808 TString fName(
"ExValG");
809 TF1 *f = (TF1 *) gROOT->GetListOfFunctions()->FindObject(fName);
811 f =
new TF1(fName, extremevalueG, -2, 5, 5);
812 f->SetParNames(
"normL",
"mu",
"sigmaI",
"phase",
"sigmaG");
813 f->SetParLimits(2, 0.1, 10.0);
814 f->SetParLimits(3, 0., TMath::PiOver2());
816 f->FixParameter(4, 1.0);
818 f->SetParameters(0., 0., 2.5, 0.75, 1.0);