CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
16  const PropagationDirection propDir) const {
17  //
18  // get components of input state and check if material is associated to surface
19  //
20  const Surface& surface = TSoS.surface();
21  if ( !surface.mediumProperties().isValid() ) return TSoS;
23  // single input state?
24  if ( TSoS.components().size()>1 )
25  throw cms::Exception("LogicError") << "GsfMaterialEffectsUpdator::updateState used with MultiTSOS";
26  double weight = TSoS.weight();
27  //
28  // Get components (will force recalculation, if necessary)
29  //
30  Effect effects[size()];
31  compute(TSoS,propDir,effects);
32 
33  //
34  // prepare output vector
35  //
37  //
38  // loop over components
39  //
40  // edm::LogDebug("GsfMaterialEffectsUpdator") << "found " << Ws.size() << " components\n"
41  // << " input state has weight " << TSoS.weight();
42  for ( auto const & effect : effects ) {
43  // edm::LogDebug("GsfMaterialEffectsUpdator") << "w, dp, sigp = "
44  // << Ws[ic] << ", "
45  // << dPs[ic] << ", "
46  // << sqrt((deltaErrors[ic])[0][0]);
47  //
48  // Update momentum. In case of failure: return invalid state.
49  // Use deltaP method to ensure update of cache, if necessary!
50  //
52  if ( !lp.updateP(effect.deltaP) )
53  return TrajectoryStateOnSurface();
54  //
55  // Update covariance matrix?
56  //
57  if ( TSoS.hasError() ) {
58  AlgebraicSymMatrix55 eloc = TSoS.localError().matrix();
59  effect.deltaCov.add(eloc);
62  surface,
63  &(TSoS.globalParameters().magneticField()),
64  side,
65  weight*effect.weight));
66  // edm::LogDebug("GsfMaterialEffectsUpdator")
67  // << "adding state with weight " << weight*Ws[ic];
68  }
69  else {
70  result.addState(TrajectoryStateOnSurface(lp,surface,
71  &(TSoS.globalParameters().magneticField()),
72  side));
73  }
74  }
75  // edm::LogDebug("GsfMaterialEffectsUpdator")
76  // << " output state has weight " << result.combinedState().weight();
77  return result.combinedState();
78 }
79 
const LocalTrajectoryParameters & localParameters() const
void addState(const TrajectoryStateOnSurface)
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
PropagationDirection
bool updateP(double dP)
Update of momentum by a scalar dP.
const SurfaceType & surface() const
tuple result
Definition: query.py:137
const AlgebraicSymMatrix55 & matrix() const
const LocalTrajectoryError & localError() const
virtual TrajectoryStateOnSurface updateState(const TrajectoryStateOnSurface &TSoS, const PropagationDirection propDir) const
const GlobalTrajectoryParameters & globalParameters() const
const MagneticField & magneticField() const
int weight
Definition: histoStyle.py:50
bool isValid() const
std::vector< TrajectoryStateOnSurface > components() const
const MediumProperties & mediumProperties() const
Definition: Surface.h:120
tuple size
Write out results.