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 }
anyDirection
Definition: PropagationDirection.h:4
GsfPropagatorAdapter::propagateWithPath
std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const TrajectoryStateOnSurface &, const Plane &) const override
Definition: GsfPropagatorAdapter.cc:11
MessageLogger.h
GsfPropagatorWithMaterial::GsfPropagatorWithMaterial
GsfPropagatorWithMaterial(const Propagator &Propagator, const GsfMaterialEffectsUpdator &MEUpdator)
Definition: GsfPropagatorWithMaterial.cc:11
PropagationDirectionFromPath
Definition: PropagationDirectionFromPath.h:8
GsfPropagatorWithMaterial::fromDirection
Definition: GsfPropagatorWithMaterial.h:64
GsfPropagatorWithMaterial.h
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
GsfPropagatorWithMaterial::materialAtSource
bool materialAtSource() const
Inclusion of material at the source?
Definition: GsfPropagatorWithMaterial.cc:123
GsfPropagatorWithMaterial::setPropagationDirection
void setPropagationDirection(PropagationDirection dir) override
Definition: GsfPropagatorWithMaterial.cc:101
Propagator
Definition: Propagator.h:44
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
GsfPropagatorWithMaterial::propagateWithPath
std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const TrajectoryStateOnSurface &, const Plane &) const override
Definition: GsfPropagatorWithMaterial.cc:25
clone
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
Propagator::propagationDirection
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139
GsfPropagatorWithMaterial::atDestination
Definition: GsfPropagatorWithMaterial.h:64
GsfPropagatorWithMaterial::convoluteStateWithMaterial
TrajectoryStateOnSurface convoluteStateWithMaterial(const TrajectoryStateOnSurface, const PropagationDirection) const
Convolution of state with material effects.
Definition: GsfPropagatorWithMaterial.cc:115
Propagator::setPropagationDirection
virtual void setPropagationDirection(PropagationDirection dir)
Definition: Propagator.h:130
MultiTrajectoryStateAssembler.h
GsfPropagatorWithMaterial::theConvolutor
DeepCopyPointerByClone< FullConvolutionWithMaterial > theConvolutor
Definition: GsfPropagatorWithMaterial.h:100
GsfPropagatorWithMaterial::convoluteWithMaterial
std::pair< TrajectoryStateOnSurface, double > convoluteWithMaterial(const std::pair< TrajectoryStateOnSurface, double > &) const
Convolution of state+path with material effects.
Definition: GsfPropagatorWithMaterial.cc:106
FullConvolutionWithMaterial
Definition: FullConvolutionWithMaterial.h:15
AnalyticalPropagator.h
GsfMaterialEffectsUpdator
Definition: GsfMaterialEffectsUpdator.h:15
GsfPropagatorAdapter::setPropagationDirection
void setPropagationDirection(PropagationDirection dir) override
Definition: GsfPropagatorAdapter.cc:41
GsfPropagatorWithMaterial::atSource
Definition: GsfPropagatorWithMaterial.h:64
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
Exception
Definition: hltDiff.cc:246
GsfPropagatorWithMaterial::theGeometricalPropagator
DeepCopyPointerByClone< GsfPropagatorAdapter > theGeometricalPropagator
Definition: GsfPropagatorWithMaterial.h:98
PropagationDirection
PropagationDirection
Definition: PropagationDirection.h:4
Plane
Definition: Plane.h:16
PropagationDirectionFromPath.h
Exception.h
Cylinder
Definition: Cylinder.h:19
GsfPropagatorWithMaterial::TsosWP
std::pair< TrajectoryStateOnSurface, double > TsosWP
Definition: GsfPropagatorWithMaterial.h:104
GsfPropagatorAdapter
Definition: GsfPropagatorAdapter.h:14
alongMomentum
Definition: PropagationDirection.h:4
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
GsfPropagatorWithMaterial::theMaterialLocation
MaterialLocation theMaterialLocation
Definition: GsfPropagatorWithMaterial.h:102
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23