File indexing completed on 2024-04-06 12:31:33
0001 #include "TrackingTools/MaterialEffects/interface/MultipleScatteringUpdator.h"
0002 #include "DataFormats/GeometrySurface/interface/MediumProperties.h"
0003
0004 #include "DataFormats/Math/interface/approx_log.h"
0005
0006 void oldMUcompute(const TrajectoryStateOnSurface& TSoS, const PropagationDirection propDir, double mass, double ptmin);
0007
0008
0009
0010
0011
0012
0013
0014 void MultipleScatteringUpdator::compute(const TrajectoryStateOnSurface& TSoS,
0015 const PropagationDirection propDir,
0016 Effect& effect) const {
0017
0018
0019
0020 const Surface& surface = TSoS.surface();
0021
0022
0023
0024
0025 const MediumProperties& mp = surface.mediumProperties();
0026 if UNLIKELY (mp.radLen() == 0)
0027 return;
0028
0029
0030 LocalVector d = TSoS.localMomentum();
0031 float p2 = d.mag2();
0032 d *= 1.f / sqrt(p2);
0033 float xf = 1.f / std::abs(d.z());
0034
0035 constexpr float amscon = 1.8496e-4;
0036 const float m2 = mass() * mass();
0037 float e2 = p2 + m2;
0038 float beta2 = p2 / e2;
0039
0040 float radLen = mp.radLen() * xf;
0041 float sigt2 = 0.;
0042
0043
0044 float fact = 1.f + 0.038f * unsafe_logf<2>(radLen);
0045 fact *= fact;
0046 float a = fact / (beta2 * p2);
0047 sigt2 = amscon * radLen * a;
0048
0049 if (thePtMin > 0) {
0050 #ifdef DBG_MSU
0051 std::cout << "Original rms scattering = " << sqrt(sigt2);
0052 #endif
0053
0054
0055 AlgebraicSymMatrix55 const& covMatrix = TSoS.localError().matrix();
0056 float error2_QoverP = covMatrix(0, 0);
0057
0058
0059
0060 sigt2 *= 1.f + error2_QoverP * (p2 + m2 * beta2 * (5.f + 3.f * p2 * error2_QoverP));
0061 #ifdef DBG_MSU
0062 std::cout << " new = " << sqrt(sigt2);
0063 #endif
0064
0065
0066 float pMin2 = thePtMin * thePtMin * (p2 / TSoS.globalMomentum().perp2());
0067
0068 float betaMin2 = pMin2 / (pMin2 + m2);
0069 float a_max = fact / (betaMin2 * pMin2);
0070 float sigt2_max = amscon * radLen * a_max;
0071 if (sigt2 > sigt2_max)
0072 sigt2 = sigt2_max;
0073 #ifdef DBG_MSU
0074 std::cout << " after P constraint (" << pMin << ") = " << sqrt(sigt2);
0075 std::cout << " for track with 1/p=" << 1 / p << "+-" << sqrt(error2_QoverP) << std::endl;
0076 #endif
0077 }
0078
0079 float isl2 = 1.f / d.perp2();
0080 float cl2 = (d.z() * d.z());
0081 float cf2 = (d.x() * d.x()) * isl2;
0082 float sf2 = (d.y() * d.y()) * isl2;
0083
0084
0085 float den = 1.f / (cl2 * cl2);
0086 using namespace materialEffect;
0087 effect.deltaCov[msxx] += (den * sigt2) * (sf2 * cl2 + cf2);
0088 effect.deltaCov[msxy] += (den * sigt2) * (d.x() * d.y());
0089 effect.deltaCov[msyy] += (den * sigt2) * (cf2 * cl2 + sf2);
0090
0091
0092
0093
0094
0095 }
0096
0097
0098
0099
0100
0101 void oldMUcompute(const TrajectoryStateOnSurface& TSoS, const PropagationDirection propDir, float mass, float thePtMin) {
0102
0103
0104
0105 const Surface& surface = TSoS.surface();
0106
0107
0108
0109
0110 if (surface.mediumProperties().isValid()) {
0111
0112 LocalVector d = TSoS.localMomentum();
0113 float p = d.mag();
0114 d *= 1. / p;
0115
0116 const MediumProperties& mp = surface.mediumProperties();
0117 float xf = 1. / fabs(d.z());
0118
0119 const float amscon = 1.8496e-4;
0120 const float m = mass;
0121 float e = sqrt(p * p + m * m);
0122 float beta = p / e;
0123
0124 float radLen = mp.radLen() * xf;
0125 float sigt2 = 0.;
0126 if (radLen > 0) {
0127
0128 float a = (1. + 0.038 * log(radLen)) / (beta * p);
0129 a *= a;
0130 sigt2 = amscon * radLen * a;
0131 if (thePtMin > 0) {
0132 #ifdef DBG_MSU
0133 std::cout << "Original rms scattering = " << sqrt(sigt2);
0134 #endif
0135
0136
0137 AlgebraicSymMatrix55 covMatrix = TSoS.localError().matrix();
0138 float error2_QoverP = covMatrix(0, 0);
0139
0140
0141
0142 sigt2 *= (1. + (p * p) * error2_QoverP * (1. + 5 * m * m / (e * e) + 3 * m * m * beta * beta * error2_QoverP));
0143 #ifdef DBG_MSU
0144 std::cout << " new = " << sqrt(sigt2);
0145 #endif
0146
0147
0148 float pMin = thePtMin * (TSoS.globalMomentum().mag() / TSoS.globalMomentum().perp());
0149
0150 float betaMin = pMin / sqrt(pMin * pMin + m * m);
0151 float a_max = (1. + 0.038 * log(radLen)) / (betaMin * pMin);
0152 a_max *= a_max;
0153 float sigt2_max = amscon * radLen * a_max;
0154 if (sigt2 > sigt2_max)
0155 sigt2 = sigt2_max;
0156 #ifdef DBG_MSU
0157 std::cout << " after P constraint (" << pMin << ") = " << sqrt(sigt2);
0158 std::cout << " for track with 1/p=" << 1 / p << "+-" << sqrt(error2_QoverP) << std::endl;
0159 #endif
0160 }
0161 }
0162 float sl = d.perp();
0163 float cl = d.z();
0164 float cf = d.x() / sl;
0165 float sf = d.y() / sl;
0166
0167
0168 std::cout << "old " << sigt2 * (sf * sf * cl * cl + cf * cf) / (cl * cl * cl * cl) << " "
0169 << sigt2 * (cf * sf * sl * sl) / (cl * cl * cl * cl) << " "
0170 << sigt2 * (cf * cf * cl * cl + sf * sf) / (cl * cl * cl * cl) << std::endl;
0171 }
0172 }