CMS 3D CMS Logo

PropagatorWithMaterial.cc
Go to the documentation of this file.
6 #include <string>
7 
8 using namespace std;
9 
11 
13  const float mass,
14  const MagneticField* mf,
15  const float maxDPhi,
16  bool useRungeKutta,
17  float ptMin,
19  : Propagator(dir),
20  rkProduct(mf, dir),
21  theGeometricalPropagator(useRungeKutta ? rkProduct.propagator.clone()
22  : new AnalyticalPropagator(mf, dir, maxDPhi, useOldAnalPropLogic)),
23  theMEUpdator(new CombinedMaterialEffectsUpdator(mass, ptMin)),
24  theMaterialLocation(atDestination),
25  field(mf),
26  useRungeKutta_(useRungeKutta) {}
27 
28 pair<TrajectoryStateOnSurface, double> PropagatorWithMaterial::propagateWithPath(const FreeTrajectoryState& fts,
29  const Plane& plane) const {
30  TsosWP newTsosWP = theGeometricalPropagator->propagateWithPath(fts, plane);
31  if ((newTsosWP.first).isValid() && !materialAtSource()) {
32  bool updateOk = theMEUpdator->updateStateInPlace(
33  newTsosWP.first, PropagationDirectionFromPath()(newTsosWP.second, propagationDirection()));
34  if
35  UNLIKELY(!updateOk) newTsosWP.first = TrajectoryStateOnSurface();
36  }
37  return newTsosWP;
38 }
39 
40 pair<TrajectoryStateOnSurface, double> PropagatorWithMaterial::propagateWithPath(const FreeTrajectoryState& fts,
41  const Cylinder& cylinder) const {
42  TsosWP newTsosWP = theGeometricalPropagator->propagateWithPath(fts, cylinder);
43  if ((newTsosWP.first).isValid() && !materialAtSource()) {
44  bool updateOk = theMEUpdator->updateStateInPlace(
45  newTsosWP.first, PropagationDirectionFromPath()(newTsosWP.second, propagationDirection()));
46  if
47  UNLIKELY(!updateOk) newTsosWP.first = TrajectoryStateOnSurface();
48  }
49  return newTsosWP;
50 }
51 
52 pair<TrajectoryStateOnSurface, double> PropagatorWithMaterial::propagateWithPath(const TrajectoryStateOnSurface& tsos,
53  const Plane& plane) const {
54  //
55  // add material at starting surface, if requested
56  //
57  TsosWP newTsosWP(tsos, 0.);
58  if (materialAtSource()) {
59  bool updateOk = theMEUpdator->updateStateInPlace(newTsosWP.first, propagationDirection());
60  if
61  UNLIKELY(!updateOk) newTsosWP.first = TrajectoryStateOnSurface();
62  }
63  if
64  UNLIKELY(!newTsosWP.first.isValid()) return newTsosWP;
65  //
66  // geometrical propagation
67  //
68  newTsosWP = theGeometricalPropagator->propagateWithPath(newTsosWP.first, plane);
69  if
70  UNLIKELY(!newTsosWP.first.isValid() || materialAtSource()) return newTsosWP;
71  //
72  // add material at destination surface, if requested
73  //
74  bool updateOk = theMEUpdator->updateStateInPlace(
75  newTsosWP.first, PropagationDirectionFromPath()(newTsosWP.second, propagationDirection()));
76  if
77  UNLIKELY(!updateOk) newTsosWP.first = TrajectoryStateOnSurface();
78  return newTsosWP;
79 }
80 
81 pair<TrajectoryStateOnSurface, double> PropagatorWithMaterial::propagateWithPath(const TrajectoryStateOnSurface& tsos,
82  const Cylinder& cylinder) const {
83  //
84  // add material at starting surface, if requested
85  //
86  TsosWP newTsosWP(tsos, 0.);
87  if (materialAtSource()) {
88  bool updateOk = theMEUpdator->updateStateInPlace(newTsosWP.first, propagationDirection());
89  if
90  UNLIKELY(!updateOk) newTsosWP.first = TrajectoryStateOnSurface();
91  }
92  if
93  UNLIKELY(!newTsosWP.first.isValid()) return newTsosWP;
94  //
95  // geometrical propagation
96  //
97  newTsosWP = theGeometricalPropagator->propagateWithPath(newTsosWP.first, cylinder);
98  if
99  UNLIKELY(!(newTsosWP.first).isValid() || materialAtSource()) return newTsosWP;
100  //
101  // add material at destination surface, if requested
102  //
103  bool updateOk = theMEUpdator->updateStateInPlace(
104  newTsosWP.first, PropagationDirectionFromPath()(newTsosWP.second, propagationDirection()));
105  if
106  UNLIKELY(!updateOk) newTsosWP.first = TrajectoryStateOnSurface();
107  return newTsosWP;
108 }
109 
113 }
114 
116  if
118  throw cms::Exception(
119  "TrackingTools/MaterialEffects",
120  "PropagatorWithMaterial: propagation direction = anyDirection is incompatible with adding of material at source");
121 
122  return theMaterialLocation == atSource ||
124 }
std::pair< TrajectoryStateOnSurface, double > TsosWP
virtual void setPropagationDirection(PropagationDirection dir)
Definition: Propagator.h:130
bool materialAtSource() const
Inclusion of material at the source?
virtual bool updateStateInPlace(TrajectoryStateOnSurface &TSoS, const PropagationDirection propDir) const
PropagationDirection
Definition: Plane.h:16
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139
PropagatorWithMaterial(PropagationDirection dir, const float mass, const MagneticField *mf=0, const float maxDPhi=1.6, bool useRungeKutta=false, float ptMin=-1., bool useOldGeoPropLogic=true)
DeepCopyPointerByClone< MaterialEffectsUpdator > theMEUpdator
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const FreeTrajectoryState &, const Surface &) const final
Definition: Propagator.cc:10
DeepCopyPointerByClone< Propagator > theGeometricalPropagator
MaterialLocation theMaterialLocation
std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const TrajectoryStateOnSurface &tsos, const Plane &plane) const override
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
void setPropagationDirection(PropagationDirection dir) override
Propagation direction.
#define UNLIKELY(x)
Definition: Likely.h:21