CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MaterialEffectsUpdator.cc
Go to the documentation of this file.
3 
4 using namespace SurfaceSideDefinition;
5 
6 // static initialization
8 
9 
10 
14  theMass(mass),
15  theLastOverP(0),
16  theLastDxdz(0),
17  theLastRL(0),
18  theLastPropDir(anyDirection),
19  theDeltaP(0.),
20  theDeltaCov() {}
21 
23 
28  const PropagationDirection propDir) const {
29  TrajectoryStateOnSurface shallowCopy = TSoS;
30  // A TSOS is a proxy. Its contents will be really copied only if/when the updateStateInPlace attempts to change them
31  return updateStateInPlace(shallowCopy, propDir) ? shallowCopy : TrajectoryStateOnSurface();
32 }
33 
34 
38  // check for material
39  if ( !TSoS.surface().mediumProperties() ) return 0.;
40  // check for change (avoid using compute method if possible)
41  if ( newArguments(TSoS,propDir) ) compute(TSoS,propDir);
42  return theDeltaP;
43 }
44 
45 
49  const PropagationDirection propDir) const {
50  // check for material
51  if ( !TSoS.surface().mediumProperties() ) return theNullMatrix;
52  // check for change (avoid using compute method if possible)
53  if ( newArguments(TSoS,propDir) ) compute(TSoS,propDir);
54  return theDeltaCov;
55 }
56 
57 
58 //
59 // Update of the trajectory state (implemented in base class since general for
60 // all classes returning deltaP and deltaCov.
61 //
63  const PropagationDirection propDir) const {
64  //
65  // Check if
66  // - material is associated to surface
67  // - propagation direction is not anyDirection
68  // - side of surface is not atCenterOfSurface (could be handled with 50% material?)
69  //
70  const Surface& surface = TSoS.surface();
71  if ( !surface.mediumProperties() || propDir==anyDirection ||
72  TSoS.surfaceSide()==atCenterOfSurface ) return true;
73  //
74  // Check, if already on right side of surface
75  //
76  if ( (propDir==alongMomentum && TSoS.surfaceSide()==afterSurface ) ||
77  (propDir==oppositeToMomentum && TSoS.surfaceSide()==beforeSurface ) ) return true;
78  //
79  // Update momentum. In case of failure: return invalid state
80  //
82  if ( !lp.updateP(deltaP(TSoS,propDir)) )
83  return false;
84  //
85  // Update covariance matrix?
86  //
88  if ( TSoS.hasError() ) {
89  AlgebraicSymMatrix55 eloc = TSoS.localError().matrix() + deltaLocalError(TSoS,propDir);
90  //TSoS = TrajectoryStateOnSurface(lp,LocalTrajectoryError(eloc),surface, &(TSoS.globalParameters().magneticField()),side);
91  TSoS.update(lp,LocalTrajectoryError(eloc),surface,
92  &(TSoS.globalParameters().magneticField()),side);
93  }
94  else {
95  TSoS.update(lp,surface,&(TSoS.globalParameters().magneticField()),side);
96  //TSoS = TrajectoryStateOnSurface(lp,surface,&(TSoS.globalParameters().magneticField()),side);
97  }
98  return true;
99 }
100 
102  // check that track as same momentum and direction, surface has same radLen
103  // it optimize also against multiple evaluations on different "surfaces"
104  // belonging to contigous detectors with same radLem
105  bool ok =
106  theLastOverP != TSoS.localParameters().qbp() ||
107  theLastDxdz != TSoS.localParameters().dxdz() ||
108  theLastRL != TSoS.surface().mediumProperties()->radLen() ||
109  theLastPropDir != propDir;
110  if (ok) {
111  theLastOverP = TSoS.localParameters().qbp();
112  theLastDxdz = TSoS.localParameters().dxdz();
114  theLastPropDir = propDir;
115  }
116  return ok;
117 }
118 
float radLen() const
void update(const LocalTrajectoryParameters &p, const Surface &aSurface, const MagneticField *field, const SurfaceSide side=SurfaceSideDefinition::atCenterOfSurface)
const LocalTrajectoryParameters & localParameters() const
bool newArguments(const TrajectoryStateOnSurface &TSoS, PropagationDirection propDir) const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
virtual bool updateStateInPlace(TrajectoryStateOnSurface &TSoS, const PropagationDirection propDir) const
PropagationDirection
bool updateP(double dP)
Update of momentum by a scalar dP.
const MediumProperties * mediumProperties() const
Definition: Surface.h:93
virtual TrajectoryStateOnSurface updateState(const TrajectoryStateOnSurface &TSoS, const PropagationDirection propDir) const
SurfaceSide surfaceSide() const
Position relative to material, defined relative to momentum vector.
PropagationDirection theLastPropDir
const AlgebraicSymMatrix55 & matrix() const
const LocalTrajectoryError & localError() const
virtual const AlgebraicSymMatrix55 & deltaLocalError(const TrajectoryStateOnSurface &TSoS, const PropagationDirection propDir) const
virtual double deltaP(const TrajectoryStateOnSurface &TSoS, const PropagationDirection propDir) const
const GlobalTrajectoryParameters & globalParameters() const
tuple mass
Definition: scaleCards.py:27
const Surface & surface() const
static AlgebraicSymMatrix55 theNullMatrix
const MagneticField & magneticField() const
AlgebraicSymMatrix55 theDeltaCov
virtual void compute(const TrajectoryStateOnSurface &, const PropagationDirection) const =0