CMS 3D CMS Logo

GsfMaterialEffectsUpdator.cc
Go to the documentation of this file.
2 
7 //
8 // Update of the trajectory state (implemented in base class since general for
9 // all classes returning deltaPs and deltaCovs.
10 //
11 
12 using namespace SurfaceSideDefinition;
13 
15  const PropagationDirection propDir) const {
16  //
17  // get components of input state and check if material is associated to surface
18  //
19  const Surface& surface = TSoS.surface();
20  if (!surface.mediumProperties().isValid())
21  return TSoS;
23  // single input state?
24  if (!TSoS.singleState())
25  throw cms::Exception("LogicError") << "GsfMaterialEffectsUpdator::updateState used with MultiTSOS";
26  auto weight = TSoS.weight();
27 //
28 // Get components (will force recalculation, if necessary)
29 //
30 #if __clang__
31  std::vector<Effect> effects(size());
32  compute(TSoS, propDir, effects.data());
33 #else
34  Effect effects[size()];
35  compute(TSoS, propDir, effects);
36 #endif
37 
38  //
39  // prepare output vector
40  //
42  //
43  // loop over components
44  //
45  LogDebug("GsfMaterialEffectsUpdator") << "found " << size() << " components "
46  << " input state has weight " << TSoS.weight();
47  for (auto const& effect : effects) {
48  LogDebug("GsfMaterialEffectsUpdatorDETAIL") << "w, dp, sigp = " << effect.weight << ", " << effect.deltaP << ", "
49  << std::sqrt(effect.deltaCov[materialEffect::elos]);
50  //
51  // Update momentum. In case of failure: return invalid state.
52  // Use deltaP method to ensure update of cache, if necessary!
53  //
55  if (!lp.updateP(effect.deltaP))
56  return TrajectoryStateOnSurface();
57  //
58  // Update covariance matrix?
59  //
60  if (TSoS.hasError()) {
61  AlgebraicSymMatrix55 eloc = TSoS.localError().matrix();
62  effect.deltaCov.add(eloc);
63  result.addState(TrajectoryStateOnSurface(weight * effect.weight,
64  lp,
66  surface,
67  &(TSoS.globalParameters().magneticField()),
68  side));
69  LogDebug("GsfMaterialEffectsUpdatorDETAIL") << "adding state with weight " << weight * effect.weight;
70  } else {
71  result.addState(TrajectoryStateOnSurface(lp, surface, &(TSoS.globalParameters().magneticField()), side));
72  }
73  }
74  LogDebug("GsfMaterialEffectsUpdator") << " output state has weight " << result.combinedState().weight();
75  return result.combinedState();
76 }
#define LogDebug(id)
size
Write out results.
const LocalTrajectoryParameters & localParameters() const
void addState(const TrajectoryStateOnSurface)
Definition: weight.py:1
PropagationDirection
const T & data() const
Definition: ProxyBase11.h:51
const SurfaceType & surface() const
T sqrt(T t)
Definition: SSEVec.h:19
const AlgebraicSymMatrix55 & matrix() const
const LocalTrajectoryError & localError() const
virtual TrajectoryStateOnSurface updateState(const TrajectoryStateOnSurface &TSoS, const PropagationDirection propDir) const
const GlobalTrajectoryParameters & globalParameters() const
def compute(min, max)
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
const MagneticField & magneticField() const
bool isValid() const
const MediumProperties & mediumProperties() const
Definition: Surface.h:85
bool updateP(float dP)
Update of momentum by a scalar dP.