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() ) 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  std::vector<double> Ws = weights(TSoS,propDir);
31  if ( Ws.empty() ) return TrajectoryStateOnSurface();
32  std::vector<double> dPs = deltaPs(TSoS,propDir);
33  if ( dPs.size()!=Ws.size() )
34  throw cms::Exception("LogicError")
35  << "GsfMaterialEffectsUpdator: inconsistency in number of components";
36  std::vector<AlgebraicSymMatrix55> deltaErrors;
37  if ( TSoS.hasError() )
38  deltaErrors = deltaLocalErrors(TSoS,propDir);
39  //
40  // prepare output vector
41  //
43  //
44  // loop over components
45  //
46  // edm::LogDebug("GsfMaterialEffectsUpdator") << "found " << Ws.size() << " components\n"
47  // << " input state has weight " << TSoS.weight();
48  for ( unsigned int ic=0; ic<Ws.size(); ic++ ) {
49  // edm::LogDebug("GsfMaterialEffectsUpdator") << "w, dp, sigp = "
50  // << Ws[ic] << ", "
51  // << dPs[ic] << ", "
52  // << sqrt((deltaErrors[ic])[0][0]);
53  //
54  // Update momentum. In case of failure: return invalid state.
55  // Use deltaP method to ensure update of cache, if necessary!
56  //
58  if ( !lp.updateP(dPs[ic]) )
59  return TrajectoryStateOnSurface();
60  //
61  // Update covariance matrix?
62  //
63  if ( TSoS.hasError() ) {
64  AlgebraicSymMatrix55 eloc = TSoS.localError().matrix();
65  eloc += deltaErrors[ic];
68  surface,
69  &(TSoS.globalParameters().magneticField()),
70  side,
71  weight*Ws[ic]));
72  // edm::LogDebug("GsfMaterialEffectsUpdator")
73  // << "adding state with weight " << weight*Ws[ic];
74  }
75  else {
76  result.addState(TrajectoryStateOnSurface(lp,surface,
77  &(TSoS.globalParameters().magneticField()),
78  side));
79  }
80  }
81  // edm::LogDebug("GsfMaterialEffectsUpdator")
82  // << " output state has weight " << result.combinedState().weight();
83  return result.combinedState();
84 }
85 
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 MediumProperties * mediumProperties() const
Definition: Surface.h:93
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 Surface & surface() const
const MagneticField & magneticField() const
std::vector< TrajectoryStateOnSurface > components() const