CMS 3D CMS Logo

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 /* Constructor */
37  const Propagator* aGenProp,
38  const MagneticField* field,
40  float epsilon)
41  : Propagator(dir), theTkProp(aTkProp->clone()), theGenProp(aGenProp->clone()), theField(field) {
43 }
44 
46  const Propagator& aGenProp,
47  const MagneticField* field,
49  float epsilon)
50  : Propagator(dir), theTkProp(aTkProp.clone()), theGenProp(aGenProp.clone()), theField(field) {
52 }
53 
55  : Propagator(aProp.propagationDirection()), theTkProp(nullptr), theGenProp(nullptr) {
56  if (aProp.theTkProp)
57  theTkProp = aProp.getTkPropagator()->clone();
58  if (aProp.theGenProp)
59  theTkProp = aProp.getGenPropagator()->clone();
60 
61  //SL since it's a copy constructor, then the TkVolume has been already
62  //initialized
63  // initTkVolume(epsilon);
64 }
65 
66 /* Destructor */
68  delete theTkProp;
69  delete theGenProp;
70 }
71 
72 /* Operations */
74  //
75  // fill tracker dimensions
76  //
77  float radius = TrackerBounds::radius();
78  float r_out = radius + epsilon / 2;
79  float r_in = r_out - epsilon;
80  float z_max = TrackerBounds::halfLength();
81  float z_min = -z_max;
82 
83  Surface::PositionType pos(0, 0, 0); // centered at the global origin
84  Surface::RotationType rot; // unit matrix - barrel cylinder orientation
85 
86  theTkVolume = Cylinder::build(radius, pos, rot, new SimpleCylinderBounds(r_in, r_out, z_min, z_max));
87 }
88 
89 std::pair<TrajectoryStateOnSurface, double> SmartPropagator::propagateWithPath(const FreeTrajectoryState& fts,
90  const Plane& plane) const {
91  if (insideTkVol(fts) && insideTkVol(plane)) {
92  return getTkPropagator()->propagateWithPath(fts, plane);
93  } else {
94  return getGenPropagator()->propagateWithPath(fts, plane);
95  }
96 }
97 
98 std::pair<TrajectoryStateOnSurface, double> SmartPropagator::propagateWithPath(const FreeTrajectoryState& fts,
99  const Cylinder& cylinder) const {
100  if (insideTkVol(fts) && insideTkVol(cylinder)) {
101  return getTkPropagator()->propagateWithPath(fts, cylinder);
102  } else {
103  return getGenPropagator()->propagateWithPath(fts, cylinder);
104  }
105 }
106 
107 std::pair<TrajectoryStateOnSurface, double> SmartPropagator::propagateWithPath(const TrajectoryStateOnSurface& fts,
108  const Plane& plane) const {
109  if (insideTkVol(*fts.freeState()) && insideTkVol(plane)) {
110  return getTkPropagator()->propagateWithPath(fts, plane);
111  } else {
112  return getGenPropagator()->propagateWithPath(fts, plane);
113  }
114 }
115 
116 std::pair<TrajectoryStateOnSurface, double> SmartPropagator::propagateWithPath(const TrajectoryStateOnSurface& fts,
117  const Cylinder& cylinder) const {
118  if (insideTkVol(*fts.freeState()) && insideTkVol(cylinder)) {
119  return getTkPropagator()->propagateWithPath(fts, cylinder);
120  } else {
121  return getGenPropagator()->propagateWithPath(fts, cylinder);
122  }
123 }
124 
126  GlobalPoint gp = fts.position();
127  // LocalPoint lp = theTkVolume()->toLocal(gp);
128  // return theTkVolume()->bounds().inside(lp);
129 
130  return ((gp.perp() <= TrackerBounds::radius() + 10.) && (fabs(gp.z()) <= TrackerBounds::halfLength() + 10.));
131 }
132 
133 bool SmartPropagator::insideTkVol(const Surface& surface) const {
134  const GlobalPoint& gp = surface.position();
135  // LocalPoint lp = theTkVolume()->toLocal(gp);
136 
137  // return theTkVolume()->bounds().inside(lp);
138  return ((gp.perp() <= TrackerBounds::radius() + 10.) && (fabs(gp.z()) <= TrackerBounds::halfLength() + 10.));
139 }
140 
141 bool SmartPropagator::insideTkVol(const BoundCylinder& cylin) const {
142  GlobalPoint gp(cylin.radius(), 0., (cylin.bounds().length()) / 2.);
143  // LocalPoint lp = theTkVolume()->toLocal(gp);
144  // return theTkVolume()->bounds().inside(lp);
145  return ((gp.perp() <= TrackerBounds::radius() + 10.) && (fabs(gp.z()) <= TrackerBounds::halfLength() + 10.));
146 }
147 
148 bool SmartPropagator::insideTkVol(const Plane& plane) const {
149  const GlobalPoint& gp = plane.position();
150  // LocalPoint lp = theTkVolume()->toLocal(gp);
151  // return theTkVolume()->bounds().inside(lp);
152  return ((gp.perp() <= TrackerBounds::radius() + 10.) && (fabs(gp.z()) <= TrackerBounds::halfLength() + 10.));
153 }
154 
156 
Propagator * theGenProp
void initTkVolume(float epsilon)
build the tracker volume
virtual Propagator * clone() const =0
static float halfLength()
Definition: TrackerBounds.h:33
PropagationDirection
Definition: Plane.h:16
bool insideTkVol(const FreeTrajectoryState &fts) const
true if a fts is inside tracker volume
GlobalPoint position() const
const Propagator * getTkPropagator() const
return the propagator used inside tracker
std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const FreeTrajectoryState &fts, const Plane &plane) const override
Propagator * theTkProp
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const FreeTrajectoryState &, const Surface &) const final
Definition: Propagator.cc:10
static float radius()
Definition: TrackerBounds.h:32
const PositionType & position() const
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=nullptr)
Definition: Cylinder.h:45
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
~SmartPropagator() override
FreeTrajectoryState const * freeState(bool withErrors=true) const
const Propagator * getGenPropagator() const
return the propagator used outside tracker