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  * $Date: 2009/07/05 19:56:54 $
10  * $Revision: 1.7 $
11  *
12  * Modification:
13  *
14  *********************************/
15 
16 /* This Class Header */
18 
19 /* Collaborating Class Header */
23 
25 
28 
29 /* Base Class Headers */
30 
31 /* C++ Headers */
32 
33 /* ====================================================================== */
34 
35 /* static member */
38  return local;
39 }
40 
41 
42 
43 /* Constructor */
46  Propagator(dir), theTkProp(aTkProp->clone()), theGenProp(aGenProp->clone()), theField(field) {
47 
48  if (theTkVolume()==0) initTkVolume(epsilon);
49 
50 }
51 
52 
53 SmartPropagator::SmartPropagator(const Propagator& aTkProp, const Propagator& aGenProp,const MagneticField* field,
55  Propagator(dir), theTkProp(aTkProp.clone()), theGenProp(aGenProp.clone()), theField(field) {
56 
57  if (theTkVolume()==0) initTkVolume(epsilon);
58 
59 }
60 
61 
63  Propagator(aProp.propagationDirection()), theTkProp(0), theGenProp(0) {
64  if (aProp.theTkProp)
65  theTkProp=aProp.getTkPropagator()->clone();
66  if (aProp.theGenProp)
67  theTkProp=aProp.getGenPropagator()->clone();
68 
69  //SL since it's a copy constructor, then the TkVolume has been already
70  //initialized
71  //if (theTkVolume==0) initTkVolume(epsilon);
72 
73  }
74 
75 /* Destructor */
77 
78  delete theTkProp;
79  delete theGenProp;
80 
81 }
82 
83 
84 /* Operations */
86 
87  //
88  // fill tracker dimensions
89  //
90  float radius = TrackerBounds::radius();
91  float r_out = radius + epsilon/2;
92  float r_in = r_out - epsilon;
93  float z_max = TrackerBounds::halfLength();
94  float z_min = - z_max;
95 
96  Surface::PositionType pos(0,0,0); // centered at the global origin
97  Surface::RotationType rot; // unit matrix - barrel cylinder orientation
98 
99  theTkVolume() = BoundCylinder::build(pos, rot, radius, SimpleCylinderBounds(r_in, r_out, z_min, z_max));
100 
101 }
102 
103 
105  const Surface& surface) const {
106  return Propagator::propagate( fts, surface);
107 }
108 
109 
111  const Plane& plane) const {
112 
113  if (insideTkVol(fts) && insideTkVol(plane)) {
114  return getTkPropagator()->propagate(fts, plane);
115  } else {
116  return getGenPropagator()->propagate(fts, plane);
117  }
118 
119 }
120 
121 
123  const Cylinder& cylinder) const {
124  if (insideTkVol(fts) && insideTkVol(cylinder)) {
125  return getTkPropagator()->propagate(fts, cylinder);
126  } else {
127  return getGenPropagator()->propagate(fts, cylinder);
128  }
129 
130 }
131 
132 std::pair<TrajectoryStateOnSurface,double>
134  const Plane& plane) const
135 {
136  if (insideTkVol(fts) && insideTkVol(plane)) {
137  return getTkPropagator()->propagateWithPath(fts, plane);
138  } else {
139  return getGenPropagator()->propagateWithPath(fts, plane);
140  }
141 }
142 
143 std::pair<TrajectoryStateOnSurface,double>
145  const Cylinder& cylinder) const
146 {
147  if (insideTkVol(fts) && insideTkVol(cylinder)) {
148  return getTkPropagator()->propagateWithPath(fts, cylinder);
149  } else {
150  return getGenPropagator()->propagateWithPath(fts, cylinder);
151  }
152 }
153 
155 
156  GlobalPoint gp = fts.position();
157 // LocalPoint lp = theTkVolume()->toLocal(gp);
158 // return theTkVolume()->bounds().inside(lp);
159 
160  return ( (gp.perp()<= TrackerBounds::radius()+10.) && (fabs(gp.z())<= TrackerBounds::halfLength()+10.) );
161 }
162 
163 
164 bool SmartPropagator::insideTkVol(const Surface& surface) const {
165 
166  GlobalPoint gp = surface.position();
167  // LocalPoint lp = theTkVolume()->toLocal(gp);
168 
169  // return theTkVolume()->bounds().inside(lp);
170  return ( (gp.perp()<= TrackerBounds::radius()+10.) && (fabs(gp.z())<= TrackerBounds::halfLength()+10.) );
171 
172 
173 }
174 
175 
176 bool SmartPropagator::insideTkVol( const BoundCylinder& cylin) const {
177 
178  GlobalPoint gp(cylin.radius(),0.,(cylin.bounds().length())/2.);
179 // LocalPoint lp = theTkVolume()->toLocal(gp);
180 // return theTkVolume()->bounds().inside(lp);
181  return ( (gp.perp()<= TrackerBounds::radius()+10.) && (fabs(gp.z())<= TrackerBounds::halfLength()+10.) );
182 
183 
184 }
185 
186 
187 bool SmartPropagator::insideTkVol( const Plane& plane) const {
188 
189  GlobalPoint gp = plane.position();
190 // LocalPoint lp = theTkVolume()->toLocal(gp);
191 // return theTkVolume()->bounds().inside(lp);
192  return ( (gp.perp()<= TrackerBounds::radius()+10.) && (fabs(gp.z())<= TrackerBounds::halfLength()+10.) );
193 
194 
195 }
196 
197 
199 
200  return theTkProp;
201 
202 }
203 
204 
206 
207  return theGenProp;
208 
209 }
210 
211 
Propagator * theGenProp
std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const FreeTrajectoryState &fts, const Surface &surface) const
virtual ~SmartPropagator()
virtual float length() const =0
T perp() const
Definition: PV3DBase.h:71
static void initTkVolume(float epsilon)
build the tracker volume
SmartPropagator(Propagator *aTkProp, Propagator *aGenProp, const MagneticField *field, PropagationDirection dir=alongMomentum, float epsilon=5)
Defines which propagator is used inside Tk and which outside.
Propagator * getTkPropagator() const
return the propagator used inside tracker
virtual Propagator * clone() const =0
static BoundCylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, const Bounds *bounds, MediumProperties *mp=0)
Definition: BoundCylinder.h:29
static float halfLength()
Definition: TrackerBounds.h:36
PropagationDirection
Definition: Plane.h:17
static ReferenceCountingPointer< BoundCylinder > & theTkVolume()
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:77
bool insideTkVol(const FreeTrajectoryState &fts) const
true if a fts is inside tracker volume
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:55
Propagator * theTkProp
T z() const
Definition: PV3DBase.h:63
static float radius()
Definition: TrackerBounds.h:35
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:12
GlobalPoint position() const
const Bounds & bounds() const
Definition: BoundSurface.h:89
Propagator * getGenPropagator() const
return the propagator used outside tracker
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
TrajectoryStateOnSurface propagate(const FreeTrajectoryState &fts, const Surface &surface) const
dbl *** dir
Definition: mlp_gen.cc:35
const double epsilon
const PositionType & position() const