CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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,
18  bool useOldAnalPropLogic)
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 UNLIKELY (!updateOk)
35  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 UNLIKELY (!updateOk)
47  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 UNLIKELY (!updateOk)
61  newTsosWP.first = TrajectoryStateOnSurface();
62  }
63  if UNLIKELY (!newTsosWP.first.isValid())
64  return newTsosWP;
65  //
66  // geometrical propagation
67  //
68  newTsosWP = theGeometricalPropagator->propagateWithPath(newTsosWP.first, plane);
69  if UNLIKELY (!newTsosWP.first.isValid() || materialAtSource())
70  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 UNLIKELY (!updateOk)
77  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 UNLIKELY (!updateOk)
90  newTsosWP.first = TrajectoryStateOnSurface();
91  }
92  if UNLIKELY (!newTsosWP.first.isValid())
93  return newTsosWP;
94  //
95  // geometrical propagation
96  //
97  newTsosWP = theGeometricalPropagator->propagateWithPath(newTsosWP.first, cylinder);
98  if UNLIKELY (!(newTsosWP.first).isValid() || materialAtSource())
99  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 UNLIKELY (!updateOk)
106  newTsosWP.first = TrajectoryStateOnSurface();
107  return newTsosWP;
108 }
109 
113 }
114 
117  throw cms::Exception("TrackingTools/MaterialEffects",
118  "PropagatorWithMaterial: propagation direction = anyDirection is incompatible with adding of "
119  "material at source");
120 
121  return theMaterialLocation == atSource ||
123 }
std::pair< TrajectoryStateOnSurface, double > TsosWP
tuple propagator
virtual void setPropagationDirection(PropagationDirection dir)
Definition: Propagator.h:130
bool materialAtSource() const
Inclusion of material at the source?
constexpr float ptMin
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139
virtual bool updateStateInPlace(TrajectoryStateOnSurface &TSoS, const PropagationDirection propDir) const
PropagatorWithMaterial(PropagationDirection dir, const float mass, const MagneticField *mf=nullptr, const float maxDPhi=1.6, bool useRungeKutta=false, float ptMin=-1., bool useOldGeoPropLogic=true)
PropagationDirection
Definition: Plane.h:16
tuple useRungeKutta
DeepCopyPointerByClone< MaterialEffectsUpdator > theMEUpdator
DeepCopyPointerByClone< Propagator > theGeometricalPropagator
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const FreeTrajectoryState &, const Surface &) const final
Definition: Propagator.cc:10
MaterialLocation theMaterialLocation
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
void setPropagationDirection(PropagationDirection dir) override
Propagation direction.
std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const TrajectoryStateOnSurface &tsos, const Plane &plane) const override
#define UNLIKELY(x)
Definition: Likely.h:21