CMS 3D CMS Logo

GsfPropagatorWithMaterial.cc
Go to the documentation of this file.
2 
8 
9 #include <atomic>
10 
12  const GsfMaterialEffectsUpdator& aMEUpdator)
13  : Propagator(aPropagator.propagationDirection()),
14  theGeometricalPropagator(new GsfPropagatorAdapter(aPropagator)),
15  theConvolutor(new FullConvolutionWithMaterial(aMEUpdator)),
16  theMaterialLocation(atDestination) {}
17 
19  const FullConvolutionWithMaterial& aConvolutor)
20  : Propagator(aGsfPropagator.propagationDirection()),
21  theGeometricalPropagator(aGsfPropagator.clone()),
22  theConvolutor(aConvolutor.clone()),
23  theMaterialLocation(atDestination) {}
24 
25 std::pair<TrajectoryStateOnSurface, double> GsfPropagatorWithMaterial::propagateWithPath(
26  const TrajectoryStateOnSurface& tsos, const Plane& plane) const {
27  // add material before propagation?
28  //
29  TrajectoryStateOnSurface stateAtSource;
30  if (materialAtSource())
31  stateAtSource = convoluteStateWithMaterial(tsos, propagationDirection());
32  else
33  stateAtSource = tsos;
34  if (!stateAtSource.isValid())
35  return TsosWP(stateAtSource, 0.);
36  //
37  // geometrical propagation
38  //
39  TsosWP propStateWP(theGeometricalPropagator->propagateWithPath(stateAtSource, plane));
40  if (!(propStateWP.first).isValid())
41  return propStateWP;
42  //
43  // return convoluted state
44  //
45  return convoluteWithMaterial(propStateWP);
46 }
47 
48 std::pair<TrajectoryStateOnSurface, double> GsfPropagatorWithMaterial::propagateWithPath(
49  const TrajectoryStateOnSurface& tsos, const Cylinder& cylinder) const {
50  // add material before propagation?
51  //
52  TrajectoryStateOnSurface stateAtSource;
53  if (materialAtSource())
54  stateAtSource = convoluteStateWithMaterial(tsos, propagationDirection());
55  else
56  stateAtSource = tsos;
57  if (!stateAtSource.isValid())
58  return TsosWP(stateAtSource, 0.);
59  //
60  // geometrical propagation
61  //
62  TsosWP propStateWP(theGeometricalPropagator->propagateWithPath(stateAtSource, cylinder));
63  if (!(propStateWP.first).isValid())
64  return propStateWP;
65  //
66  // return convoluted state
67  //
68  return convoluteWithMaterial(propStateWP);
69 }
70 
71 std::pair<TrajectoryStateOnSurface, double> GsfPropagatorWithMaterial::propagateWithPath(const FreeTrajectoryState& fts,
72  const Plane& plane) const {
73  static std::atomic<int> nWarn(0);
74  if (nWarn++ < 5)
75  edm::LogInfo("GsfPropagatorWithMaterial")
76  << "GsfPropagatorWithMaterial used from FTS: input state might have been collapsed!";
77  TsosWP propStateWP = theGeometricalPropagator->propagateWithPath(fts, plane);
78  if (!(propStateWP.first).isValid() || materialAtSource())
79  return propStateWP;
80  //
81  // return convoluted state
82  //
83  return convoluteWithMaterial(propStateWP);
84 }
85 
86 std::pair<TrajectoryStateOnSurface, double> GsfPropagatorWithMaterial::propagateWithPath(
87  const FreeTrajectoryState& fts, const Cylinder& cylinder) const {
88  static std::atomic<int> nWarn(0);
89  if (nWarn++ < 5)
90  edm::LogInfo("GsfPropagatorWithMaterial")
91  << "GsfPropagatorWithMaterial used from FTS: input state might have been collapsed!";
92  TsosWP propStateWP = theGeometricalPropagator->propagateWithPath(fts, cylinder);
93  if (!(propStateWP.first).isValid() || materialAtSource())
94  return propStateWP;
95  //
96  // return convoluted state
97  //
98  return convoluteWithMaterial(propStateWP);
99 }
100 
104 }
105 
106 std::pair<TrajectoryStateOnSurface, double> GsfPropagatorWithMaterial::convoluteWithMaterial(
107  const TsosWP& aStateWithPath) const {
108  //
109  // convolute with material
110  //
111  PropagationDirection propDir = PropagationDirectionFromPath()(aStateWithPath.second, propagationDirection());
112  return TsosWP((*theConvolutor)(aStateWithPath.first, propDir), aStateWithPath.second);
113 }
114 
116  const TrajectoryStateOnSurface tsos, const PropagationDirection propDir) const {
117  //
118  // convolute with material
119  //
120  return (*theConvolutor)(tsos, propDir);
121 }
122 
126  throw cms::Exception("LogicError") << "PropagatorWithMaterial: propagation direction = anyDirection is "
127  << "incompatible with adding of material at source";
128  }
129  }
130  return theMaterialLocation == atSource ||
132 }
virtual void setPropagationDirection(PropagationDirection dir)
Definition: Propagator.h:130
std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const TrajectoryStateOnSurface &, const Plane &) const override
std::pair< TrajectoryStateOnSurface, double > TsosWP
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139
PropagationDirection
std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const TrajectoryStateOnSurface &, const Plane &) const override
Definition: Plane.h:16
GsfPropagatorWithMaterial(const Propagator &Propagator, const GsfMaterialEffectsUpdator &MEUpdator)
DeepCopyPointerByClone< GsfPropagatorAdapter > theGeometricalPropagator
void setPropagationDirection(PropagationDirection dir) override
DeepCopyPointerByClone< FullConvolutionWithMaterial > theConvolutor
void setPropagationDirection(PropagationDirection dir) override
Log< level::Info, false > LogInfo
std::pair< TrajectoryStateOnSurface, double > convoluteWithMaterial(const std::pair< TrajectoryStateOnSurface, double > &) const
Convolution of state+path with material effects.
bool materialAtSource() const
Inclusion of material at the source?
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
TrajectoryStateOnSurface convoluteStateWithMaterial(const TrajectoryStateOnSurface, const PropagationDirection) const
Convolution of state with material effects.