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 */
71 
72  delete theTkProp;
73  delete theGenProp;
74 
75 }
76 
77 
78 /* Operations */
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 
99 std::pair<TrajectoryStateOnSurface,double>
101  const Plane& plane) const
102 {
103  if (insideTkVol(fts) && insideTkVol(plane)) {
104  return getTkPropagator()->propagateWithPath(fts, plane);
105  } else {
106  return getGenPropagator()->propagateWithPath(fts, plane);
107  }
108 }
109 
110 std::pair<TrajectoryStateOnSurface,double>
112  const Cylinder& cylinder) const
113 {
114  if (insideTkVol(fts) && insideTkVol(cylinder)) {
115  return getTkPropagator()->propagateWithPath(fts, cylinder);
116  } else {
117  return getGenPropagator()->propagateWithPath(fts, cylinder);
118  }
119 }
120 
121 
122 std::pair<TrajectoryStateOnSurface,double>
124  const Plane& plane) const
125 {
126  if (insideTkVol(*fts.freeState()) && insideTkVol(plane)) {
127  return getTkPropagator()->propagateWithPath(fts, plane);
128  } else {
129  return getGenPropagator()->propagateWithPath(fts, plane);
130  }
131 }
132 
133 std::pair<TrajectoryStateOnSurface,double>
135  const Cylinder& cylinder) const
136 {
137  if (insideTkVol(*fts.freeState()) && insideTkVol(cylinder)) {
138  return getTkPropagator()->propagateWithPath(fts, cylinder);
139  } else {
140  return getGenPropagator()->propagateWithPath(fts, cylinder);
141  }
142 }
143 
145 
146  GlobalPoint gp = fts.position();
147 // LocalPoint lp = theTkVolume()->toLocal(gp);
148 // return theTkVolume()->bounds().inside(lp);
149 
150  return ( (gp.perp()<= TrackerBounds::radius()+10.) && (fabs(gp.z())<= TrackerBounds::halfLength()+10.) );
151 }
152 
153 
154 bool SmartPropagator::insideTkVol(const Surface& surface) const {
155 
156  GlobalPoint gp = surface.position();
157  // LocalPoint lp = theTkVolume()->toLocal(gp);
158 
159  // return theTkVolume()->bounds().inside(lp);
160  return ( (gp.perp()<= TrackerBounds::radius()+10.) && (fabs(gp.z())<= TrackerBounds::halfLength()+10.) );
161 
162 
163 }
164 
165 
166 bool SmartPropagator::insideTkVol( const BoundCylinder& cylin) const {
167 
168  GlobalPoint gp(cylin.radius(),0.,(cylin.bounds().length())/2.);
169 // LocalPoint lp = theTkVolume()->toLocal(gp);
170 // return theTkVolume()->bounds().inside(lp);
171  return ( (gp.perp()<= TrackerBounds::radius()+10.) && (fabs(gp.z())<= TrackerBounds::halfLength()+10.) );
172 
173 
174 }
175 
176 
177 bool SmartPropagator::insideTkVol( const Plane& plane) const {
178 
179  GlobalPoint gp = plane.position();
180 // LocalPoint lp = theTkVolume()->toLocal(gp);
181 // return theTkVolume()->bounds().inside(lp);
182  return ( (gp.perp()<= TrackerBounds::radius()+10.) && (fabs(gp.z())<= TrackerBounds::halfLength()+10.) );
183 
184 
185 }
186 
187 
189 
190  return theTkProp;
191 
192 }
193 
194 
196 
197  return theGenProp;
198 
199 }
200 
201 
Propagator * theGenProp
virtual ~SmartPropagator()
T perp() const
Definition: PV3DBase.h:72
void initTkVolume(float epsilon)
build the tracker volume
const Propagator * getTkPropagator() const
return the propagator used inside tracker
virtual Propagator * clone() const =0
static float halfLength()
Definition: TrackerBounds.h:34
PropagationDirection
Definition: Plane.h:17
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=0)
Definition: Cylinder.h:51
bool insideTkVol(const FreeTrajectoryState &fts) const
true if a fts is inside tracker volume
std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const FreeTrajectoryState &fts, const Plane &plane) const override
FreeTrajectoryState const * freeState(bool withErrors=true) const
Propagator * theTkProp
T z() const
Definition: PV3DBase.h:64
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const FreeTrajectoryState &, const Surface &) const final
Definition: Propagator.cc:15
static float radius()
Definition: TrackerBounds.h:33
GlobalPoint position() const
SmartPropagator(const Propagator *aTkProp, const Propagator *aGenProp, const MagneticField *field, PropagationDirection dir=alongMomentum, float epsilon=5)
Defines which propagator is used inside Tk and which outside.
ReferenceCountingPointer< Cylinder > theTkVolume
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
dbl *** dir
Definition: mlp_gen.cc:35
const PositionType & position() const
const Propagator * getGenPropagator() const
return the propagator used outside tracker