CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PropagatorWithMaterial.cc
Go to the documentation of this file.
6 #include <string>
7 
8 using namespace std;
9 
10 PropagatorWithMaterial::~PropagatorWithMaterial(){}
11 
12 
13 PropagatorWithMaterial::PropagatorWithMaterial (PropagationDirection dir,
14  const float mass,
15  const MagneticField * mf,
16  const float maxDPhi,
17  bool useRungeKutta,
18  float ptMin,bool useOldAnalPropLogic) :
19  Propagator(dir),
20  rkProduct(mf,dir),
21  theGeometricalPropagator(useRungeKutta ?
22  rkProduct.propagator.clone() :
23  new AnalyticalPropagator(mf,dir,maxDPhi,useOldAnalPropLogic)
24  ),
25  theMEUpdator(new CombinedMaterialEffectsUpdator(mass, ptMin)),
26  theMaterialLocation(atDestination), field(mf),useRungeKutta_(useRungeKutta) {
27 
28 
29 }
30 
31 pair<TrajectoryStateOnSurface,double>
32 PropagatorWithMaterial::propagateWithPath (const FreeTrajectoryState& fts,
33  const Plane& plane) const {
34  TsosWP newTsosWP = theGeometricalPropagator->propagateWithPath(fts,plane);
35  if ( (newTsosWP.first).isValid() && !materialAtSource() ) {
36  bool updateOk = theMEUpdator->updateStateInPlace(newTsosWP.first,
37  PropagationDirectionFromPath()(newTsosWP.second,
38  propagationDirection()));
39  if unlikely(!updateOk) newTsosWP.first = TrajectoryStateOnSurface();
40  }
41  return newTsosWP;
42 }
43 
44 pair<TrajectoryStateOnSurface,double>
45 PropagatorWithMaterial::propagateWithPath (const FreeTrajectoryState& fts,
46  const Cylinder& cylinder) const {
47  TsosWP newTsosWP = theGeometricalPropagator->propagateWithPath(fts,cylinder);
48  if ( (newTsosWP.first).isValid() && !materialAtSource() ) {
49  bool updateOk = theMEUpdator->updateStateInPlace(newTsosWP.first,
50  PropagationDirectionFromPath()(newTsosWP.second,
51  propagationDirection()));
52  if unlikely(!updateOk) newTsosWP.first = TrajectoryStateOnSurface();
53  }
54  return newTsosWP;
55 }
56 
57 
58 pair<TrajectoryStateOnSurface,double>
59 PropagatorWithMaterial::propagateWithPath (const TrajectoryStateOnSurface& tsos,
60  const Plane& plane) const {
61  //
62  // add material at starting surface, if requested
63  //
64  TsosWP newTsosWP(tsos,0.);
65  if ( materialAtSource() ) {
66  bool updateOk = theMEUpdator->updateStateInPlace(newTsosWP.first,propagationDirection());
67  if unlikely(!updateOk) newTsosWP.first = TrajectoryStateOnSurface();
68  }
69  if unlikely( !newTsosWP.first.isValid() ) return newTsosWP;
70  //
71  // geometrical propagation
72  //
73  newTsosWP = theGeometricalPropagator->propagateWithPath(newTsosWP.first,plane);
74  if unlikely( !newTsosWP.first.isValid() || materialAtSource() ) return newTsosWP;
75  //
76  // add material at destination surface, if requested
77  //
78  bool updateOk = theMEUpdator->updateStateInPlace(newTsosWP.first,
80  propagationDirection()));
81  if unlikely(!updateOk) newTsosWP.first = TrajectoryStateOnSurface();
82  return newTsosWP;
83 }
84 
85 pair<TrajectoryStateOnSurface,double>
86 PropagatorWithMaterial::propagateWithPath (const TrajectoryStateOnSurface& tsos,
87  const Cylinder& cylinder) const {
88  //
89  // add material at starting surface, if requested
90  //
91  TsosWP newTsosWP(tsos,0.);
92  if ( materialAtSource() ) {
93  bool updateOk = theMEUpdator->updateStateInPlace(newTsosWP.first,propagationDirection());
94  if unlikely(!updateOk) newTsosWP.first = TrajectoryStateOnSurface();
95  }
96  if unlikely( !newTsosWP.first.isValid() ) return newTsosWP;
97  //
98  // geometrical propagation
99  //
100  newTsosWP = theGeometricalPropagator->propagateWithPath(newTsosWP.first,cylinder);
101  if unlikely( !(newTsosWP.first).isValid() || materialAtSource() ) return newTsosWP;
102  //
103  // add material at destination surface, if requested
104  //
105  bool updateOk = theMEUpdator->updateStateInPlace(newTsosWP.first,
106  PropagationDirectionFromPath()(newTsosWP.second,
107  propagationDirection()));
108  if unlikely(!updateOk) newTsosWP.first = TrajectoryStateOnSurface();
109  return newTsosWP;
110 }
111 
112 void PropagatorWithMaterial::setPropagationDirection (PropagationDirection dir) const {
113  theGeometricalPropagator->setPropagationDirection(dir);
115 }
116 
117 bool
118 PropagatorWithMaterial::materialAtSource() const {
119  if unlikely( (propagationDirection()==anyDirection) && (theMaterialLocation!=atDestination) )
120  throw cms::Exception("TrackingTools/MaterialEffects",
121  "PropagatorWithMaterial: propagation direction = anyDirection is incompatible with adding of material at source");
122 
123  return theMaterialLocation==atSource || (theMaterialLocation==fromDirection&&
124  propagationDirection()==alongMomentum);
125 }
PropagationDirection
Definition: Plane.h:17
tuple field
Definition: statics.py:62
U second(std::pair< T, U > const &p)
#define unlikely(x)
Definition: Likely.h:21
bool first
Definition: L1TdeRCT.cc:79
string const
Definition: compareJSON.py:14
return(e1-e2)*(e1-e2)+dp *dp
if(dp >Float(M_PI)) dp-
tuple clone
Definition: statics.py:58
virtual void setPropagationDirection(PropagationDirection dir) const
Definition: Propagator.h:134
dbl *** dir
Definition: mlp_gen.cc:35
static std::string const source
Definition: EdmProvDump.cc:43
list at
Definition: asciidump.py:428