5 #include <FairLogger.h>
7 #include <Math/Point2D.h>
8 #include <Math/Point2Dfwd.h>
9 #include <Math/Point3D.h>
10 #include <Math/Point3Dfwd.h>
11 #include <Math/Vector2D.h>
12 #include <Math/Vector2Dfwd.h>
13 #include <Math/Vector3D.h>
14 #include <Math/Vector3Dfwd.h>
20 constexpr
auto c = 29979.2;
22 constexpr
auto me = 0.511e6;
34 LOG(debug) << input <<
" to " << offsetHit;
35 auto corrHit = SolveEqn(offsetHit / 10,
true) * 10;
42 auto corrHit = SolveEqn(offsetHit / 10,
false) * 10;
51 auto minStepSize = 2 * fMobilityElec *
me /
c2;
52 if (fStepSize < minStepSize) {
53 LOG(error) <<
"Using unphysical step size: " << fStepSize <<
" reseting to minimum step size:" << minStepSize;
54 fStepSize = minStepSize;
58 double timeToDrift = ele.Z() / fDriftVel;
59 int nBins = std::floor(timeToDrift / fStepSize);
60 LOG(debug) <<
"Drifting to " << ele.Z() <<
" in " << nBins <<
" steps of size " << fStepSize;
62 double pos = ele.rho();
65 for (
int i = 0; i < nBins; ++i) {
68 auto z = ele.Z() - i * fStepSize * fDriftVel;
70 LOG(error) <<
"Space charge correction tried to bypass the pad plane!";
75 if (GetEField ==
nullptr) {
76 LOG(fatal) <<
"The distrotion field was never set!";
78 Efield = GetEField(pos, z);
80 LOG(debug2) <<
"Field " << Efield <<
" V/cm rho: " << pos <<
" cm and z: " << z <<
" cm.";
86 double v = Efield * fMobilityElec;
96 auto dT = timeToDrift - nBins * fStepSize;
97 auto z = dT * fDriftVel;
98 auto Efield = GetEField(pos, z);
101 double v = Efield * fMobilityElec;
107 return XYZPoint(ROOT::Math::RhoZPhiPoint(pos, ele.Z(), ele.phi()));
117 LOG(debug) <<
"Setting mobility to: " << fMobilityElec;
123 fMobilityElec = fDriftVel / fEFieldZ;
128 fMobilityElec = fDriftVel / fEFieldZ;