20 #include "MaterialEffects.h"
21 #include "Exception.h"
30 #include <TDatabasePDG.h>
31 #include "MonopoleConstants.h"
40 MaterialEffects* MaterialEffects::instance_ =
nullptr;
43 MaterialEffects::MaterialEffects():
45 energyLossBetheBloch_(true), noiseBetheBloch_(true),
47 energyLossBrems_(true), noiseBrems_(true),
48 ignoreBoundariesBetweenEqualMaterials_(true),
63 materialInterface_(nullptr),
68 MaterialEffects::~MaterialEffects()
70 if (materialInterface_ !=
nullptr)
delete materialInterface_;
73 MaterialEffects* MaterialEffects::getInstance()
75 if (instance_ ==
nullptr) instance_ =
new MaterialEffects();
79 void MaterialEffects::destruct()
81 if (instance_ !=
nullptr) {
89 if (materialInterface_ !=
nullptr) {
90 std::string msg(
"MaterialEffects::initMaterialInterface(): Already initialized! ");
91 std::runtime_error err(msg);
93 materialInterface_ = matIfc;
98 void MaterialEffects::setMscModel(
const std::string& modelName)
100 if (modelName == std::string(
"GEANE")) {
102 }
else if (modelName == std::string(
"Highland")) {
105 std::string errorMsg = std::string(
"There is no MSC model called \"") + modelName +
"\". Maybe it is not implemented or you misspelled the model name";
106 Exception exc(errorMsg, __LINE__, __FILE__);
114 double MaterialEffects::effects(
const std::vector<RKStep>& steps,
115 int materialsFXStart,
123 debugOut <<
" MaterialEffects::effects \n";
134 if (noEffects_)
return 0.;
136 if (materialInterface_ ==
nullptr) {
137 std::string msg(
"MaterialEffects hasn't been initialized with a correct AbsMaterialInterface pointer!");
138 std::runtime_error err(msg);
142 bool doNoise(noise !=
nullptr);
145 getParticleParameters();
149 for ( std::vector<RKStep>::const_iterator it = steps.begin() + materialsFXStart; it != steps.begin() + materialsFXStop; ++it) {
151 double realPath = it->matStep_.stepSize_;
152 if (fabs(realPath) < 1.E-8) {
162 debugOut <<
"stepSize = " << it->matStep_.stepSize_ <<
"\t";
163 it->matStep_.material_.Print();
169 realPath = fabs(realPath);
170 stepSize_ = realPath;
173 const Material& currentMaterial = it->matStep_.material_;
174 matDensity_ = currentMaterial.density;
175 matZ_ = currentMaterial.
Z;
176 matA_ = currentMaterial.
A;
178 mEE_ = currentMaterial.
mEE;
183 momLoss += momentumLoss(stepSign, mom - momLoss,
false);
187 double p(0), gammaSquare(0), gamma(0), betaSquare(0);
188 this->getMomGammaBeta(E_, p, gammaSquare, gamma, betaSquare);
189 double pSquare = p*p;
191 if (pdg_ == c_monopolePDGCode) {
192 charge_ = mag_charge_ * mom / hypot(mom, mass_);
195 if (energyLossBetheBloch_ && noiseBetheBloch_)
196 this->noiseBetheBloch(*noise, p, betaSquare, gamma, gammaSquare);
199 this->noiseCoulomb(*noise, *((
M1x3*) &it->state7_[3]), pSquare, betaSquare);
201 if (energyLossBrems_ && noiseBrems_)
202 this->noiseBrems(*noise, pSquare, betaSquare);
209 if (momLoss >= mom) {
210 Exception exc(
"MaterialEffects::effects ==> momLoss >= momentum, aborting extrapolation!",__LINE__,__FILE__);
229 static const double maxRelMomLoss = .01;
230 static const double Pmin = 4.E-3;
231 static const double minStep = 1.E-4;
235 std::ostringstream sstream;
236 sstream <<
"MaterialEffects::stepper ==> momentum too low: " << mom*1000. <<
" MeV";
237 Exception exc(sstream.str(),__LINE__,__FILE__);
246 if (materialInterface_ ==
nullptr) {
247 std::string msg(
"MaterialEffects hasn't been initialized with a correct AbsMaterialInterface pointer!");
248 std::runtime_error err(msg);
252 if (relMomLoss > maxRelMomLoss) {
253 limits.setLimit(stp_momLoss, 0);
258 double sMax = limits.getLowestLimitSignedVal();
260 if (fabs(sMax) < minStep)
266 getParticleParameters();
270 state7[0] += limits.getStepSign() * minStep * state7[3];
271 state7[1] += limits.getStepSign() * minStep * state7[4];
272 state7[2] += limits.getStepSign() * minStep * state7[5];
274 materialInterface_->initTrack(state7[0], state7[1], state7[2],
275 limits.getStepSign() * state7[3], limits.getStepSign() * state7[4], limits.getStepSign() * state7[5]);
278 currentMaterial = materialInterface_->getMaterialParameters();
279 matDensity_ = currentMaterial.density;
280 matZ_ = currentMaterial.
Z;
281 matA_ = currentMaterial.
A;
283 mEE_ = currentMaterial.
mEE;
286 debugOut <<
" currentMaterial "; currentMaterial.Print();
290 double relMomLossPer_cm(0);
294 relMomLossPer_cm = this->momentumLoss(limits.getStepSign(), mom,
true) / mom;
297 double maxStepMomLoss = fabs((maxRelMomLoss - fabs(relMomLoss)) / relMomLossPer_cm);
298 limits.setLimit(stp_momLoss, maxStepMomLoss);
301 debugOut <<
" momLoss exceeded after a step of " << maxStepMomLoss
302 <<
"; relMomLoss up to now = " << relMomLoss <<
"\n";
307 sMax = limits.getLowestLimitSignedVal();
309 stepSize_ = limits.getStepSign() * minStep;
311 double boundaryStep(sMax);
313 for (
unsigned int i=0; i<100; ++i) {
315 debugOut <<
" find next boundary\n";
317 double step = materialInterface_->findNextBoundary(rep, state7, boundaryStep, varField);
321 debugOut <<
" materialInterface_ returned a step of 0 \n";
326 boundaryStep -= step;
329 debugOut <<
" made a step of " << step <<
"\n";
332 if (! ignoreBoundariesBetweenEqualMaterials_)
335 if (fabs(stepSize_) >= fabs(sMax))
339 rep->
RKPropagate(state7,
nullptr, SA, step, varField);
342 state7[0] += limits.getStepSign() * minStep * state7[3];
343 state7[1] += limits.getStepSign() * minStep * state7[4];
344 state7[2] += limits.getStepSign() * minStep * state7[5];
346 materialInterface_->initTrack(state7[0], state7[1], state7[2],
347 limits.getStepSign() * state7[3], limits.getStepSign() * state7[4], limits.getStepSign() * state7[5]);
349 Material materialAfter = materialInterface_->getMaterialParameters();
352 debugOut <<
" material after step: "; materialAfter.Print();
355 if (materialAfter != currentMaterial)
359 limits.setLimit(stp_boundary, stepSize_);
362 relMomLoss += relMomLossPer_cm * limits.getLowestLimitVal();
366 void MaterialEffects::getParticleParameters()
368 TParticlePDG* part = TDatabasePDG::Instance()->GetParticle(pdg_);
369 charge_ = part->Charge() / 3.;
370 mass_ = part->Mass();
374 void MaterialEffects::getMomGammaBeta(
double Energy,
375 double& mom,
double& gammaSquare,
double& gamma,
double& betaSquare)
const {
377 if (Energy <= mass_) {
378 Exception exc(
"MaterialEffects::getMomGammaBeta - Energy <= mass",__LINE__,__FILE__);
382 gamma = Energy/mass_;
383 gammaSquare = gamma*gamma;
384 betaSquare = 1.-1./gammaSquare;
385 mom = Energy*
sqrt(betaSquare);
392 double MaterialEffects::momentumLoss(
double stepSign,
double mom,
bool linear)
394 double E0 = hypot(mom, mass_);
395 double step = stepSize_*stepSign;
411 double dEdx1 = dEdx(E0);
417 double E1 = E0 - dEdx1*step/2.;
418 double dEdx2 = dEdx(E1);
420 double E2 = E0 - dEdx2*step/2.;
421 double dEdx3 = dEdx(E2);
423 double E3 = E0 - dEdx3*step;
424 double dEdx4 = dEdx(E3);
426 dEdx_ = (dEdx1 + 2.*dEdx2 + 2.*dEdx3 + dEdx4)/6.;
429 E_ = E0 - dEdx_*step*0.5;
431 double dE = step*dEdx_;
435 if (E0 - dE <= mass_) {
437 return momLoss = mom;
439 else momLoss = mom -
sqrt(pow(E0 - dE, 2) - mass_*mass_);
442 debugOut <<
" MaterialEffects::momentumLoss: mom = " << mom <<
"; E0 = " << E0
443 <<
"; dEdx = " << dEdx_
444 <<
"; dE = " << dE <<
"; mass = " << mass_ <<
"\n";
453 double MaterialEffects::dEdx(
double Energy) {
455 double mom(0), gammaSquare(0), gamma(0), betaSquare(0);
456 this->getMomGammaBeta(Energy, mom, gammaSquare, gamma, betaSquare);
457 if (pdg_ == c_monopolePDGCode) {
458 charge_ = mag_charge_ *
sqrt(betaSquare);
463 if (energyLossBetheBloch_)
464 result += dEdxBetheBloch(betaSquare, gamma, gammaSquare);
466 if (energyLossBrems_)
467 result += dEdxBrems(mom);
473 double MaterialEffects::dEdxBetheBloch(
double betaSquare,
double gamma,
double gammaSquare)
const
475 static const double betaGammaMin(0.05);
476 if (betaSquare*gammaSquare < betaGammaMin*betaGammaMin) {
477 Exception exc(
"MaterialEffects::dEdxBetheBloch ==> beta*gamma < 0.05, Bethe-Bloch implementation not valid anymore!",__LINE__,__FILE__);
483 double result( 0.307075 * matZ_ / matA_ * matDensity_ / betaSquare * charge_ * charge_ );
484 double massRatio( me_ / mass_ );
485 double argument( gammaSquare * betaSquare * me_ * 1.E3 * 2. / ((1.E-6 * mEE_) *
486 sqrt(1. + 2. * gamma * massRatio + massRatio * massRatio)) );
487 result *= log(argument) - betaSquare;
497 void MaterialEffects::noiseBetheBloch(
M7x7& noise,
double mom,
double betaSquare,
double gamma,
double gammaSquare)
const
502 double sigma2E ( 0. );
503 double zeta ( 153.4E3 * charge_ * charge_ / betaSquare * matZ_ / matA_ * matDensity_ * fabs(stepSize_) );
504 double Emax ( 2.E9 * me_ * betaSquare * gammaSquare / (1. + 2.*gamma * me_ / mass_ + (me_ / mass_) * (me_ / mass_)) );
505 double kappa ( zeta / Emax );
508 sigma2E += zeta * Emax * (1. - betaSquare / 2.);
511 double I = 16. * pow(matZ_, 0.9);
513 if (matZ_ > 2.) f2 = 2. / matZ_;
515 double e2 = 10.*matZ_ * matZ_;
516 double e1 = pow((I / pow(e2, f2)), 1. / f1);
518 double mbbgg2 = 2.E9 * mass_ * betaSquare * gammaSquare;
519 double Sigma1 = dEdx_ * 1.0E9 * f1 / e1 * (log(mbbgg2 / e1) - betaSquare) / (log(mbbgg2 / I) - betaSquare) * 0.6;
520 double Sigma2 = dEdx_ * 1.0E9 * f2 / e2 * (log(mbbgg2 / e2) - betaSquare) / (log(mbbgg2 / I) - betaSquare) * 0.6;
521 double Sigma3 = dEdx_ * 1.0E9 * Emax / (I * (Emax + I) * log((Emax + I) / I)) * 0.4;
523 double Nc = (Sigma1 + Sigma2 + Sigma3) * fabs(stepSize_);
526 double sigmaalpha = 15.76;
528 double RLAMED = -0.422784 - betaSquare - log(zeta / Emax);
529 double RLAMAX = 0.60715 + 1.1934 * RLAMED + (0.67794 + 0.052382 * RLAMED) * exp(0.94753 + 0.74442 * RLAMED);
531 if (RLAMAX <= 1010.) {
532 sigmaalpha = 1.975560
533 + 9.898841e-02 * RLAMAX
534 - 2.828670e-04 * RLAMAX * RLAMAX
535 + 5.345406e-07 * pow(RLAMAX, 3.)
536 - 4.942035e-10 * pow(RLAMAX, 4.)
537 + 1.729807e-13 * pow(RLAMAX, 5.);
538 }
else { sigmaalpha = 1.871887E+01 + 1.296254E-02 * RLAMAX; }
540 if (sigmaalpha > 54.6) sigmaalpha = 54.6;
541 sigma2E += sigmaalpha * sigmaalpha * zeta * zeta;
543 static const double alpha = 0.996;
544 double Ealpha = I / (1. - (alpha * Emax / (Emax + I)));
545 double meanE32 = I * (Emax + I) / Emax * (Ealpha - I);
546 sigma2E += fabs(stepSize_) * (Sigma1 * e1 * e1 + Sigma2 * e2 * e2 + Sigma3 * meanE32);
553 noise[6 * 7 + 6] += charge_*charge_/betaSquare / pow(mom, 4) * sigma2E;
557 void MaterialEffects::noiseCoulomb(
M7x7& noise,
558 const M1x3& direction,
double momSquare,
double betaSquare)
const
563 assert(mscModelCode_ == 0 || mscModelCode_ == 1);
564 const double step = fabs(stepSize_);
565 const double step2 = step * step;
566 if (mscModelCode_ == 0) {
567 sigma2 = 225.E-6 * charge_ * charge_ / (betaSquare * momSquare) * step / radiationLength_ * matZ_ / (matZ_ + 1) * log(159.*pow(matZ_, -1. / 3.)) / log(287.*pow(matZ_, -0.5));
569 }
else if (mscModelCode_ == 1) {
570 double stepOverRadLength = step / radiationLength_;
571 double logCor = (1 + 0.038 * log(stepOverRadLength));
572 sigma2 = 0.0136 * 0.0136 * charge_ * charge_ / (betaSquare * momSquare) * stepOverRadLength * logCor * logCor;
575 sigma2 = (sigma2 > 0.0 ? sigma2 : 0.0);
579 std::fill(noiseAfter.begin(), noiseAfter.end(), 0);
581 const M1x3& a = direction;
584 noiseAfter[0 * 7 + 0] = sigma2 * step2 / 3.0 * (1 - a[0]*a[0]);
585 noiseAfter[1 * 7 + 0] = -sigma2 * step2 / 3.0 * a[0]*a[1];
586 noiseAfter[2 * 7 + 0] = -sigma2 * step2 / 3.0 * a[0]*a[2];
587 noiseAfter[3 * 7 + 0] = sigma2 * step * 0.5 * (1 - a[0]*a[0]);
588 noiseAfter[4 * 7 + 0] = -sigma2 * step * 0.5 * a[0]*a[1];
589 noiseAfter[5 * 7 + 0] = -sigma2 * step * 0.5 * a[0]*a[1];
590 noiseAfter[0 * 7 + 1] = noiseAfter[1 * 7 + 0];
591 noiseAfter[1 * 7 + 1] = sigma2 * step2 / 3.0 * (1 - a[1]*a[1]);
592 noiseAfter[2 * 7 + 1] = -sigma2 * step2 / 3.0 * a[1]*a[2];
593 noiseAfter[3 * 7 + 1] = noiseAfter[4 * 7 + 0];
594 noiseAfter[4 * 7 + 1] = sigma2 * step * 0.5 * (1 - a[1] * a[1]);
595 noiseAfter[5 * 7 + 1] = -sigma2 * step * 0.5 * a[1]*a[2];
596 noiseAfter[0 * 7 + 2] = noiseAfter[2 * 7 + 0];
597 noiseAfter[1 * 7 + 2] = noiseAfter[2 * 7 + 1];
598 noiseAfter[2 * 7 + 2] = sigma2 * step2 / 3.0 * (1 - a[2]*a[2]);
599 noiseAfter[3 * 7 + 2] = noiseAfter[5 * 7 + 0];
600 noiseAfter[4 * 7 + 2] = noiseAfter[5 * 7 + 1];
601 noiseAfter[5 * 7 + 2] = sigma2 * step * 0.5 * (1 - a[2]*a[2]);
602 noiseAfter[0 * 7 + 3] = noiseAfter[3 * 7 + 0];
603 noiseAfter[1 * 7 + 3] = noiseAfter[3 * 7 + 1];
604 noiseAfter[2 * 7 + 3] = noiseAfter[3 * 7 + 2];
605 noiseAfter[3 * 7 + 3] = sigma2 * (1 - a[0]*a[0]);
606 noiseAfter[4 * 7 + 3] = -sigma2 * a[0]*a[1];
607 noiseAfter[5 * 7 + 3] = -sigma2 * a[0]*a[2];
608 noiseAfter[0 * 7 + 4] = noiseAfter[4 * 7 + 0];
609 noiseAfter[1 * 7 + 4] = noiseAfter[4 * 7 + 1];
610 noiseAfter[2 * 7 + 4] = noiseAfter[4 * 7 + 2];
611 noiseAfter[3 * 7 + 4] = noiseAfter[4 * 7 + 3];
612 noiseAfter[4 * 7 + 4] = sigma2 * (1 - a[1]*a[1]);
613 noiseAfter[5 * 7 + 4] = -sigma2 * a[1]*a[2];
614 noiseAfter[0 * 7 + 5] = noiseAfter[5 * 7 + 0];
615 noiseAfter[1 * 7 + 5] = noiseAfter[5 * 7 + 1];
616 noiseAfter[2 * 7 + 5] = noiseAfter[5 * 7 + 2];
617 noiseAfter[3 * 7 + 5] = noiseAfter[5 * 7 + 3];
618 noiseAfter[4 * 7 + 5] = noiseAfter[5 * 7 + 4];
619 noiseAfter[5 * 7 + 5] = sigma2 * (1 - a[2]*a[2]);
622 for (
unsigned int i = 0; i < 7 * 7; ++i) {
623 noise[i] += noiseAfter[i];
628 double MaterialEffects::dEdxBrems(
double mom)
const
633 if (abs(pdg_) != 11)
return 0;
636 static const double C[101] = { 0.0, -0.960613E-01, 0.631029E-01, -0.142819E-01, 0.150437E-02, -0.733286E-04, 0.131404E-05, 0.859343E-01, -0.529023E-01, 0.131899E-01, -0.159201E-02, 0.926958E-04, -0.208439E-05, -0.684096E+01, 0.370364E+01, -0.786752E+00, 0.822670E-01, -0.424710E-02, 0.867980E-04, -0.200856E+01, 0.129573E+01, -0.306533E+00, 0.343682E-01, -0.185931E-02, 0.392432E-04, 0.127538E+01, -0.515705E+00, 0.820644E-01, -0.641997E-02, 0.245913E-03, -0.365789E-05, 0.115792E+00, -0.463143E-01, 0.725442E-02, -0.556266E-03, 0.208049E-04, -0.300895E-06, -0.271082E-01, 0.173949E-01, -0.452531E-02, 0.569405E-03, -0.344856E-04, 0.803964E-06, 0.419855E-02, -0.277188E-02, 0.737658E-03, -0.939463E-04, 0.569748E-05, -0.131737E-06, -0.318752E-03, 0.215144E-03, -0.579787E-04, 0.737972E-05, -0.441485E-06, 0.994726E-08, 0.938233E-05, -0.651642E-05, 0.177303E-05, -0.224680E-06, 0.132080E-07, -0.288593E-09, -0.245667E-03, 0.833406E-04, -0.129217E-04, 0.915099E-06, -0.247179E-07, 0.147696E-03, -0.498793E-04, 0.402375E-05, 0.989281E-07, -0.133378E-07, -0.737702E-02, 0.333057E-02, -0.553141E-03, 0.402464E-04, -0.107977E-05, -0.641533E-02, 0.290113E-02, -0.477641E-03, 0.342008E-04, -0.900582E-06, 0.574303E-05, 0.908521E-04, -0.256900E-04, 0.239921E-05, -0.741271E-07, -0.341260E-04, 0.971711E-05, -0.172031E-06, -0.119455E-06, 0.704166E-08, 0.341740E-05, -0.775867E-06, -0.653231E-07, 0.225605E-07, -0.114860E-08, -0.119391E-06, 0.194885E-07, 0.588959E-08, -0.127589E-08, 0.608247E-10};
637 static const double xi = 2.51, beta = 0.99, vl = 0.00004;
640 static const double C[101] = { 0.0, 0.834459E-02, 0.443979E-02, -0.101420E-02, 0.963240E-04, -0.409769E-05, 0.642589E-07, 0.464473E-02, -0.290378E-02, 0.547457E-03, -0.426949E-04, 0.137760E-05, -0.131050E-07, -0.547866E-02, 0.156218E-02, -0.167352E-03, 0.101026E-04, -0.427518E-06, 0.949555E-08, -0.406862E-02, 0.208317E-02, -0.374766E-03, 0.317610E-04, -0.130533E-05, 0.211051E-07, 0.158941E-02, -0.385362E-03, 0.315564E-04, -0.734968E-06, -0.230387E-07, 0.971174E-09, 0.467219E-03, -0.154047E-03, 0.202400E-04, -0.132438E-05, 0.431474E-07, -0.559750E-09, -0.220958E-02, 0.100698E-02, -0.596464E-04, -0.124653E-04, 0.142999E-05, -0.394378E-07, 0.477447E-03, -0.184952E-03, -0.152614E-04, 0.848418E-05, -0.736136E-06, 0.190192E-07, -0.552930E-04, 0.209858E-04, 0.290001E-05, -0.133254E-05, 0.116971E-06, -0.309716E-08, 0.212117E-05, -0.103884E-05, -0.110912E-06, 0.655143E-07, -0.613013E-08, 0.169207E-09, 0.301125E-04, -0.461920E-04, 0.871485E-05, -0.622331E-06, 0.151800E-07, -0.478023E-04, 0.247530E-04, -0.381763E-05, 0.232819E-06, -0.494487E-08, -0.336230E-04, 0.223822E-04, -0.384583E-05, 0.252867E-06, -0.572599E-08, 0.105335E-04, -0.567074E-06, -0.216564E-06, 0.237268E-07, -0.658131E-09, 0.282025E-05, -0.671965E-06, 0.565858E-07, -0.193843E-08, 0.211839E-10, 0.157544E-04, -0.304104E-05, -0.624410E-06, 0.120124E-06, -0.457445E-08, -0.188222E-05, -0.407118E-06, 0.375106E-06, -0.466881E-07, 0.158312E-08, 0.945037E-07, 0.564718E-07, -0.319231E-07, 0.371926E-08, -0.123111E-09};
641 static const double xi = 2.10, beta = 1.00, vl = 0.001;
644 double BCUT = 10000.;
646 static const double THIGH = 100., CHIGH = 50.;
647 double dedxBrems = 0.;
652 if (BCUT > mom) BCUT = mom;
671 double X = log(T / me_);
672 double Y = log(kc / (
E * vl));
676 double S = 0., YY = 1.;
678 for (
unsigned int I = 1; I <= 2; ++I) {
680 for (
unsigned int J = 1; J <= 6; ++J) {
688 for (
unsigned int I = 3; I <= 6; ++I) {
690 for (
unsigned int J = 1; J <= 6; ++J) {
703 for (
unsigned int I = 1; I <= 2; ++I) {
705 for (
unsigned int J = 1; J <= 5; ++J) {
707 SS += C[
K] * XX * YY;
713 for (
unsigned int I = 3; I <= 5; ++I) {
715 for (
unsigned int J = 1; J <= 5; ++J) {
719 SS += C[
K] * XX * YY;
730 CORR = 1. / (1. + 0.805485E-10 * matDensity_ * matZ_ *
E *
E / (matA_ * kc * kc));
736 double FAC = matZ_ * (matZ_ + xi) *
E *
E / (
E + me_);
738 FAC *= kc * CORR / T;
740 FAC *= exp(beta * log(kc * CORR / T));
750 S = (1. - 0.5 * RAT + 2.*RAT * RAT / 9.);
752 S /= 1. - 0.5 * RAT + 2.*RAT * RAT / 9.;
755 S = BCUT * (1. - 0.5 * RAT + 2.*RAT * RAT / 9.);
757 S /= kc * (1. - 0.5 * RAT + 2.*RAT * RAT / 9.);
762 dedxBrems *= 0.60221367 * matDensity_ / matA_;
772 static const double AA = 7522100., A1 = 0.415, A3 = 0.0021, A5 = 0.00054;
776 double X = log(AA * mom / (matZ_ * matZ_));
778 if (X >= +9.) ETA = 1.;
780 double W = A1 * X + A3 * pow(X, 3.) + A5 * pow(X, 5.);
781 ETA = 0.5 +
atan(W) / M_PI;
788 else if (ETA > 0.9999)
791 double E0 = BCUT / mom;
797 factor = ETA * (1. - pow(1. - E0, 1. / ETA)) / E0;
801 return factor * dedxBrems;
805 void MaterialEffects::noiseBrems(
M7x7& noise,
double momSquare,
double betaSquare)
const
812 if (abs(pdg_) != 11)
return;
814 double minusXOverLn2 = -1.442695 * fabs(stepSize_) / radiationLength_;
815 double sigma2E = 1.44*(pow(3., minusXOverLn2) - pow(4., minusXOverLn2)) * momSquare;
816 sigma2E = std::max(sigma2E, 0.0);
819 noise[6 * 7 + 6] += charge_*charge_/betaSquare / pow(momSquare, 2) * sigma2E;
823 void MaterialEffects::setDebugLvl(
unsigned int lvl) {
825 if (materialInterface_ and debugLvl_ > 1)
826 materialInterface_->setDebugLvl(debugLvl_-1);
830 void MaterialEffects::drawdEdx(
int pdg) {
832 this->getParticleParameters();
836 materialInterface_->initTrack(0, 0, 0, 1, 1, 1);
837 auto currentMaterial = materialInterface_->getMaterialParameters();
838 matDensity_ = currentMaterial.density;
839 matZ_ = currentMaterial.Z;
840 matA_ = currentMaterial.A;
841 radiationLength_ = currentMaterial.radiationLength;
842 mEE_ = currentMaterial.mEE;
844 double minMom = 0.00001;
845 double maxMom = 10000;
847 double logStepSize = (log10(maxMom) - log10(minMom)) / (nSteps-1);
849 TH1D hdEdxBethe(
"dEdxBethe",
"dEdxBethe; log10(mom)", nSteps, log10(minMom), log10(maxMom));
850 TH1D hdEdxBrems(
"dEdxBrems",
"dEdxBrems; log10(mom)", nSteps, log10(minMom), log10(maxMom));
852 for (
int i=0; i<nSteps; ++i) {
853 double mom = pow(10., log10(minMom) + i*logStepSize);
854 double E = hypot(mom, mass_);
855 if (pdg_ == c_monopolePDGCode) {
856 charge_ = mag_charge_ * mom /
E;
859 energyLossBrems_ =
false;
860 energyLossBetheBloch_ =
true;
863 hdEdxBethe.Fill(log10(mom), dEdx(
E));
872 energyLossBrems_ =
true;
873 energyLossBetheBloch_ =
false;
875 hdEdxBrems.Fill(log10(mom), dEdx(
E));
882 energyLossBrems_ =
true;
883 energyLossBetheBloch_ =
true;
886 std::stringstream convert;
888 Result = convert.str();
890 TFile outfile(
"dEdx_" + TString(Result) +
".root",
"recreate");
Abstract base class for geometry interfacing.
Exception class for error handling in GENFIT (provides storage for diagnostic information)
void setFatal(bool b=true)
Set fatal flag.
virtual const char * what() const noexcept
Standard error message handling for exceptions. use like "std::cerr << e.what();".
AbsTrackRep with 5D track parameterization in plane coordinates: (q/p, u', v', u, v)
virtual double RKPropagate(M1x7 &state7, M7x7 *jacobian, M1x3 &SA, double S, bool varField=true, bool calcOnlyLastRowOfJ=false) const
The actual Runge Kutta propagation.
Helper to store different limits on the stepsize for the RKTRackRep.
double sqrt(double a)
sqrt for double
double atan(double a)
atan for double
Defines for I/O streams used for error and debug printing.
std::ostream debugOut
Default stream for debug output.
std::ostream errorOut
Default stream for error output.
double Z
Density in g / cm^3.
double mEE
Radiation Length in cm.
double radiationLength
Mass number in g / mol.