test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 {
18  // if ( propWithPathTimer1==0 ) defineTimer();
19 }
20 
22  const FullConvolutionWithMaterial& aConvolutor) :
23  Propagator(aGsfPropagator.propagationDirection()),
24  theGeometricalPropagator(aGsfPropagator.clone()),
25  theConvolutor(aConvolutor.clone()),
26  theMaterialLocation(atDestination)
27 {
28  // if ( propWithPathTimer1==0 ) defineTimer();
29 }
30 
31 // void
32 // GsfPropagatorWithMaterial::defineTimer()
33 // {
34 // if ( propWithPathTimer1==0 ) {
35 // propWithPathTimer1 =
36 // &(*TimingReport::current())[string("GsfPropagatorWithMaterial:toPlane")];
37 // propWithPathTimer2 =
38 // &(*TimingReport::current())[string("GsfPropagatorWithMaterial:toCylinder")];
39 // static SimpleConfigurable<bool> timeConf(false,"GsfPropagatorWithMaterial:activateTiming");
40 // if ( timeConf.value() ) {
41 // propWithPathTimer1->switchCPU(false);
42 // propWithPathTimer2->switchCPU(false);
43 // }
44 // else {
45 // propWithPathTimer1->switchOn(false);
46 // propWithPathTimer2->switchOn(false);
47 // }
48 // }
49 // }
50 
51 std::pair<TrajectoryStateOnSurface,double>
53  const Plane& plane) const {
54  // TimeMe t1(*propWithPathTimer1,false);
55  //
56  // add material before propagation?
57  //
58  TrajectoryStateOnSurface stateAtSource;
59  if ( materialAtSource() )
60  stateAtSource = convoluteStateWithMaterial(tsos,propagationDirection());
61  else
62  stateAtSource = tsos;
63  if ( !stateAtSource.isValid() ) return TsosWP(stateAtSource,0.);
64  //
65  // geometrical propagation
66  //
67  TsosWP propStateWP(theGeometricalPropagator->propagateWithPath(stateAtSource,plane));
68  if ( !(propStateWP.first).isValid() ) return propStateWP;
69  //
70  // return convoluted state
71  //
72  return convoluteWithMaterial(propStateWP);
73 }
74 
75 std::pair<TrajectoryStateOnSurface,double>
77  const Cylinder& cylinder) const {
78  // TimeMe t2(*propWithPathTimer2,false);
79  //
80  // add material before propagation?
81  //
82  TrajectoryStateOnSurface stateAtSource;
83  if ( materialAtSource() )
84  stateAtSource = convoluteStateWithMaterial(tsos,propagationDirection());
85  else
86  stateAtSource = tsos;
87  if ( !stateAtSource.isValid() ) return TsosWP(stateAtSource,0.);
88  //
89  // geometrical propagation
90  //
91  TsosWP propStateWP(theGeometricalPropagator->propagateWithPath(stateAtSource,cylinder));
92  if ( !(propStateWP.first).isValid() ) return propStateWP;
93  //
94  // return convoluted state
95  //
96  return convoluteWithMaterial(propStateWP);
97 }
98 
99 std::pair<TrajectoryStateOnSurface,double>
101  const Plane& plane) const {
102  static std::atomic<int> nWarn(0);
103  if ( nWarn++<5 )
104  edm::LogInfo("GsfPropagatorWithMaterial")
105  << "GsfPropagatorWithMaterial used from FTS: input state might have been collapsed!";
106  TsosWP propStateWP = theGeometricalPropagator->propagateWithPath(fts,plane);
107  if ( !(propStateWP.first).isValid() || materialAtSource() ) return propStateWP;
108  //
109  // return convoluted state
110  //
111  return convoluteWithMaterial(propStateWP);
112 }
113 
114 std::pair<TrajectoryStateOnSurface,double>
116  const Cylinder& cylinder) const {
117  static std::atomic<int> nWarn(0);
118  if ( nWarn++<5 )
119  edm::LogInfo("GsfPropagatorWithMaterial")
120  << "GsfPropagatorWithMaterial used from FTS: input state might have been collapsed!";
121  TsosWP propStateWP = theGeometricalPropagator->propagateWithPath(fts,cylinder);
122  if ( !(propStateWP.first).isValid() || materialAtSource() ) return propStateWP;
123  //
124  // return convoluted state
125  //
126  return convoluteWithMaterial(propStateWP);
127 }
128 
129 
133 }
134 
135 std::pair<TrajectoryStateOnSurface,double>
137 {
138  //
139  // convolute with material
140  //
141  PropagationDirection propDir = PropagationDirectionFromPath()(aStateWithPath.second,
143  return TsosWP((*theConvolutor)(aStateWithPath.first,propDir),
144  aStateWithPath.second);
145 }
146 
149  const PropagationDirection propDir) const
150 {
151  //
152  // convolute with material
153  //
154  return (*theConvolutor)(tsos,propDir);
155 }
156 
157 bool
161  throw cms::Exception("LogicError")
162  << "PropagatorWithMaterial: propagation direction = anyDirection is "
163  << "incompatible with adding of material at source";
164  }
165  }
168 }
169 
170 // TimingReport::Item* GsfPropagatorWithMaterial::propWithPathTimer1(0);
171 // TimingReport::Item* GsfPropagatorWithMaterial::propWithPathTimer2(0);
virtual void setPropagationDirection(PropagationDirection dir)
Definition: Propagator.h:140
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const TrajectoryStateOnSurface &, const Plane &) const override
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:151
PropagationDirection
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const TrajectoryStateOnSurface &, const Plane &) const override
Definition: Plane.h:17
TrajectoryStateOnSurface convoluteStateWithMaterial(const TrajectoryStateOnSurface, const PropagationDirection) const
Convolution of state with material effects.
std::pair< TrajectoryStateOnSurface, double > TsosWP
GsfPropagatorWithMaterial(const Propagator &Propagator, const GsfMaterialEffectsUpdator &MEUpdator)
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?
DeepCopyPointerByClone< GsfPropagatorAdapter > theGeometricalPropagator
virtual void setPropagationDirection(PropagationDirection dir) override
DeepCopyPointerByClone< FullConvolutionWithMaterial > theConvolutor
virtual void setPropagationDirection(PropagationDirection dir) override
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
dbl *** dir
Definition: mlp_gen.cc:35