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()
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 }
MaterialEffectsUpdator::updateStateInPlace
virtual bool updateStateInPlace(TrajectoryStateOnSurface &TSoS, const PropagationDirection propDir) const
Definition: MaterialEffectsUpdator.cc:26
PropagatorWithMaterial::theMEUpdator
DeepCopyPointerByClone< MaterialEffectsUpdator > theMEUpdator
Definition: PropagatorWithMaterial.h:99
anyDirection
Definition: PropagationDirection.h:4
PropagatorWithMaterial::theMaterialLocation
MaterialLocation theMaterialLocation
Definition: PropagatorWithMaterial.h:102
PropagationDirectionFromPath
Definition: PropagationDirectionFromPath.h:8
PropagatorWithMaterial::materialAtSource
bool materialAtSource() const
Inclusion of material at the source?
Definition: PropagatorWithMaterial.cc:115
CombinedMaterialEffectsUpdator
Definition: CombinedMaterialEffectsUpdator.h:18
ptMin
constexpr float ptMin
Definition: PhotonIDValueMapProducer.cc:155
PropagatorWithMaterial::propagateWithPath
std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const TrajectoryStateOnSurface &tsos, const Plane &plane) const override
Definition: PropagatorWithMaterial.cc:52
HLT_FULL_cff.maxDPhi
maxDPhi
Definition: HLT_FULL_cff.py:9162
PropagatorWithMaterial::atDestination
Definition: PropagatorWithMaterial.h:69
PropagatorWithMaterial::setPropagationDirection
void setPropagationDirection(PropagationDirection dir) override
Propagation direction.
Definition: PropagatorWithMaterial.cc:110
Propagator
Definition: Propagator.h:44
UNLIKELY
#define UNLIKELY(x)
Definition: Likely.h:21
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
TrackCandidateProducer_cfi.propagator
propagator
Definition: TrackCandidateProducer_cfi.py:17
clone
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
HLTSiStripMonitoring_cff.useRungeKutta
useRungeKutta
Definition: HLTSiStripMonitoring_cff.py:138
Propagator::propagationDirection
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139
Propagator::setPropagationDirection
virtual void setPropagationDirection(PropagationDirection dir)
Definition: Propagator.h:130
CombinedMaterialEffectsUpdator.h
AnalyticalPropagator_cfi.AnalyticalPropagator
AnalyticalPropagator
Definition: AnalyticalPropagator_cfi.py:3
PropagatorWithMaterial.h
PropagatorWithMaterial::TsosWP
std::pair< TrajectoryStateOnSurface, double > TsosWP
Definition: PropagatorWithMaterial.h:100
PropagatorWithMaterial::PropagatorWithMaterial
PropagatorWithMaterial(PropagationDirection dir, const float mass, const MagneticField *mf=nullptr, const float maxDPhi=1.6, bool useRungeKutta=false, float ptMin=-1., bool useOldGeoPropLogic=true)
Definition: PropagatorWithMaterial.cc:12
AnalyticalPropagator.h
PropagatorWithMaterial::atSource
Definition: PropagatorWithMaterial.h:69
PropagatorWithMaterialForMTD_cfi.useOldAnalPropLogic
useOldAnalPropLogic
Definition: PropagatorWithMaterialForMTD_cfi.py:11
std
Definition: JetResolutionObject.h:76
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
PropagatorWithMaterial::~PropagatorWithMaterial
~PropagatorWithMaterial() override
Definition: PropagatorWithMaterial.cc:10
Exception
Definition: hltDiff.cc:245
PropagationDirection
PropagationDirection
Definition: PropagationDirection.h:4
Plane
Definition: Plane.h:16
EgHLTOffHistBins_cfi.mass
mass
Definition: EgHLTOffHistBins_cfi.py:34
PropagationDirectionFromPath.h
Propagator::propagateWithPath
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const FreeTrajectoryState &, const Surface &) const final
Definition: Propagator.cc:10
Exception.h
PropagatorWithMaterial::fromDirection
Definition: PropagatorWithMaterial.h:69
Cylinder
Definition: Cylinder.h:19
PropagatorWithMaterial::theGeometricalPropagator
DeepCopyPointerByClone< Propagator > theGeometricalPropagator
Definition: PropagatorWithMaterial.h:96
MagneticField
Definition: MagneticField.h:19
alongMomentum
Definition: PropagationDirection.h:4
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23