File indexing completed on 2024-04-06 12:31:33
0001 #include "TrackingTools/TrajectoryState/interface/SurfaceSideDefinition.h"
0002 #include "TrackingTools/MaterialEffects/interface/MaterialEffectsUpdator.h"
0003
0004 using namespace SurfaceSideDefinition;
0005
0006
0007
0008 MaterialEffectsUpdator::MaterialEffectsUpdator(float mass) : theMass(mass) {}
0009
0010 MaterialEffectsUpdator::~MaterialEffectsUpdator() {}
0011
0012
0013
0014
0015 TrajectoryStateOnSurface MaterialEffectsUpdator::updateState(const TrajectoryStateOnSurface& TSoS,
0016 const PropagationDirection propDir) const {
0017 TrajectoryStateOnSurface shallowCopy = TSoS;
0018
0019 return updateStateInPlace(shallowCopy, propDir) ? shallowCopy : TrajectoryStateOnSurface();
0020 }
0021
0022
0023
0024
0025
0026 bool MaterialEffectsUpdator::updateStateInPlace(TrajectoryStateOnSurface& TSoS,
0027 const PropagationDirection propDir) const {
0028
0029
0030
0031
0032
0033
0034 const Surface& surface = TSoS.surface();
0035 if (!surface.mediumProperties().isValid() || propDir == anyDirection || TSoS.surfaceSide() == atCenterOfSurface)
0036 return true;
0037
0038
0039
0040 if ((propDir == alongMomentum && TSoS.surfaceSide() == afterSurface) ||
0041 (propDir == oppositeToMomentum && TSoS.surfaceSide() == beforeSurface))
0042 return true;
0043
0044
0045
0046 LocalTrajectoryParameters lp = TSoS.localParameters();
0047 Effect effect;
0048 compute(TSoS, propDir, effect);
0049 if (!lp.updateP(effect.deltaP))
0050 return false;
0051
0052
0053
0054 SurfaceSide side = propDir == alongMomentum ? afterSurface : beforeSurface;
0055 if (TSoS.hasError()) {
0056 AlgebraicSymMatrix55 eloc = TSoS.localError().matrix();
0057 effect.deltaCov.add(eloc);
0058
0059
0060 TSoS.update(lp, eloc, side);
0061 } else {
0062 TSoS.update(lp, side);
0063
0064 }
0065 return true;
0066 }