CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SmartPropagator.cc
Go to the documentation of this file.
1 /******* \class SmartPropagator *******
2  *
3  * Description: A propagator which use different algorithm to propagate inside
4  * or outside tracker
5  *
6  *
7  * \author : Stefano Lacaprara - INFN Padova <stefano.lacaprara@pd.infn.it>
8  * \porting author: Chang Liu - Purdue University
9  *
10  * Modification:
11  *
12  *********************************/
13 
14 /* This Class Header */
16 
17 /* Collaborating Class Header */
21 
23 
26 
27 /* Base Class Headers */
28 
29 /* C++ Headers */
30 
31 /* ====================================================================== */
32 
33 /* static member */
34 
35 
36 
37 /* Constructor */
38 SmartPropagator::SmartPropagator(const Propagator* aTkProp, const Propagator* aGenProp, const MagneticField* field,
40  Propagator(dir), theTkProp(aTkProp->clone()), theGenProp(aGenProp->clone()), theField(field) {
41 
42  initTkVolume(epsilon);
43 
44 }
45 
46 
47 SmartPropagator::SmartPropagator(const Propagator& aTkProp, const Propagator& aGenProp,const MagneticField* field,
49  Propagator(dir), theTkProp(aTkProp.clone()), theGenProp(aGenProp.clone()), theField(field) {
50 
51  initTkVolume(epsilon);
52 
53 }
54 
55 
57  Propagator(aProp.propagationDirection()), theTkProp(0), theGenProp(0) {
58  if (aProp.theTkProp)
59  theTkProp=aProp.getTkPropagator()->clone();
60  if (aProp.theGenProp)
61  theTkProp=aProp.getGenPropagator()->clone();
62 
63  //SL since it's a copy constructor, then the TkVolume has been already
64  //initialized
65  // initTkVolume(epsilon);
66 
67  }
68 
69 /* Destructor */
70 SmartPropagator::~SmartPropagator() {
71 
72  delete theTkProp;
73  delete theGenProp;
74 
75 }
76 
77 
78 /* Operations */
79 void SmartPropagator::initTkVolume(float epsilon) {
80 
81  //
82  // fill tracker dimensions
83  //
84  float radius = TrackerBounds::radius();
85  float r_out = radius + epsilon/2;
86  float r_in = r_out - epsilon;
87  float z_max = TrackerBounds::halfLength();
88  float z_min = - z_max;
89 
90  Surface::PositionType pos(0,0,0); // centered at the global origin
91  Surface::RotationType rot; // unit matrix - barrel cylinder orientation
92 
93  theTkVolume = Cylinder::build(radius, pos, rot, new SimpleCylinderBounds(r_in, r_out, z_min, z_max));
94 
95 }
96 
97 
98 TrajectoryStateOnSurface SmartPropagator::propagate(const FreeTrajectoryState& fts,
99  const Surface& surface) const {
100  return Propagator::propagate( fts, surface);
101 }
102 
103 
104 TrajectoryStateOnSurface SmartPropagator::propagate(const FreeTrajectoryState& fts,
105  const Plane& plane) const {
106 
107  if (insideTkVol(fts) && insideTkVol(plane)) {
108  return getTkPropagator()->propagate(fts, plane);
109  } else {
110  return getGenPropagator()->propagate(fts, plane);
111  }
112 
113 }
114 
115 
116 TrajectoryStateOnSurface SmartPropagator::propagate(const FreeTrajectoryState& fts,
117  const Cylinder& cylinder) const {
118  if (insideTkVol(fts) && insideTkVol(cylinder)) {
119  return getTkPropagator()->propagate(fts, cylinder);
120  } else {
121  return getGenPropagator()->propagate(fts, cylinder);
122  }
123 
124 }
125 
126 std::pair<TrajectoryStateOnSurface,double>
127 SmartPropagator::propagateWithPath(const FreeTrajectoryState& fts,
128  const Plane& plane) const
129 {
130  if (insideTkVol(fts) && insideTkVol(plane)) {
131  return getTkPropagator()->propagateWithPath(fts, plane);
132  } else {
133  return getGenPropagator()->propagateWithPath(fts, plane);
134  }
135 }
136 
137 std::pair<TrajectoryStateOnSurface,double>
138 SmartPropagator::propagateWithPath(const FreeTrajectoryState& fts,
139  const Cylinder& cylinder) const
140 {
141  if (insideTkVol(fts) && insideTkVol(cylinder)) {
142  return getTkPropagator()->propagateWithPath(fts, cylinder);
143  } else {
144  return getGenPropagator()->propagateWithPath(fts, cylinder);
145  }
146 }
147 
148 bool SmartPropagator::insideTkVol(const FreeTrajectoryState& fts) const {
149 
150  GlobalPoint gp = fts.position();
151 // LocalPoint lp = theTkVolume()->toLocal(gp);
152 // return theTkVolume()->bounds().inside(lp);
153 
154  return ( (gp.perp()<= TrackerBounds::radius()+10.) && (fabs(gp.z())<= TrackerBounds::halfLength()+10.) );
155 }
156 
157 
158 bool SmartPropagator::insideTkVol(const Surface& surface) const {
159 
160  GlobalPoint gp = surface.position();
161  // LocalPoint lp = theTkVolume()->toLocal(gp);
162 
163  // return theTkVolume()->bounds().inside(lp);
164  return ( (gp.perp()<= TrackerBounds::radius()+10.) && (fabs(gp.z())<= TrackerBounds::halfLength()+10.) );
165 
166 
167 }
168 
169 
170 bool SmartPropagator::insideTkVol( const BoundCylinder& cylin) const {
171 
172  GlobalPoint gp(cylin.radius(),0.,(cylin.bounds().length())/2.);
173 // LocalPoint lp = theTkVolume()->toLocal(gp);
174 // return theTkVolume()->bounds().inside(lp);
175  return ( (gp.perp()<= TrackerBounds::radius()+10.) && (fabs(gp.z())<= TrackerBounds::halfLength()+10.) );
176 
177 
178 }
179 
180 
181 bool SmartPropagator::insideTkVol( const Plane& plane) const {
182 
183  GlobalPoint gp = plane.position();
184 // LocalPoint lp = theTkVolume()->toLocal(gp);
185 // return theTkVolume()->bounds().inside(lp);
186  return ( (gp.perp()<= TrackerBounds::radius()+10.) && (fabs(gp.z())<= TrackerBounds::halfLength()+10.) );
187 
188 
189 }
190 
191 
192 const Propagator* SmartPropagator::getTkPropagator() const {
193 
194  return theTkProp;
195 
196 }
197 
198 
199 const Propagator* SmartPropagator::getGenPropagator() const {
200 
201  return theGenProp;
202 
203 }
204 
205 
T perp() const
Definition: PV3DBase.h:72
static float halfLength()
Definition: TrackerBounds.h:34
PropagationDirection
Definition: Plane.h:17
tuple field
Definition: statics.py:62
T z() const
Definition: PV3DBase.h:64
static float radius()
Definition: TrackerBounds.h:33
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:12
GlobalPoint position() const
tuple clone
Definition: statics.py:58
dbl *** dir
Definition: mlp_gen.cc:35
const double epsilon
const PositionType & position() const