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 
TkRotation< float >
SmartPropagator::theGenProp
Propagator * theGenProp
Definition: SmartPropagator.h:107
MessageLogger.h
TrackerBounds::halfLength
static float halfLength()
Definition: TrackerBounds.h:33
SmartPropagator::initTkVolume
void initTkVolume(float epsilon)
build the tracker volume
Definition: SmartPropagator.cc:73
pos
Definition: PixelAliasList.h:18
SimpleCylinderBounds.h
TrackerBounds::radius
static float radius()
Definition: TrackerBounds.h:32
Surface
Definition: Surface.h:36
BoundCylinder.h
FreeTrajectoryState::position
GlobalPoint position() const
Definition: FreeTrajectoryState.h:67
SmartPropagator::~SmartPropagator
~SmartPropagator() override
Definition: SmartPropagator.cc:67
geometryDiff.epsilon
int epsilon
Definition: geometryDiff.py:26
SimpleCylinderBounds
Definition: SimpleCylinderBounds.h:19
Propagator
Definition: Propagator.h:44
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
TrajectoryStateOnSurface::freeState
FreeTrajectoryState const * freeState(bool withErrors=true) const
Definition: TrajectoryStateOnSurface.h:58
SmartPropagator::getGenPropagator
const Propagator * getGenPropagator() const
return the propagator used outside tracker
Definition: SmartPropagator.cc:157
TrackerBounds.h
clone
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
SmartPropagator::getTkPropagator
const Propagator * getTkPropagator() const
return the propagator used inside tracker
Definition: SmartPropagator.cc:155
Point3DBase< float, GlobalTag >
runTauDisplay.gp
gp
Definition: runTauDisplay.py:431
SmartPropagator::propagateWithPath
std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const FreeTrajectoryState &fts, const Plane &plane) const override
Definition: SmartPropagator.cc:89
SmartPropagator::theTkProp
Propagator * theTkProp
Definition: SmartPropagator.h:106
Cylinder::build
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=nullptr)
Definition: Cylinder.h:45
SmartPropagator::SmartPropagator
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.
Definition: SmartPropagator.cc:36
SmartPropagator::theTkVolume
ReferenceCountingPointer< Cylinder > theTkVolume
Definition: SmartPropagator.h:109
SmartPropagator.h
SmartPropagator
Definition: SmartPropagator.h:34
GloballyPositioned::position
const PositionType & position() const
Definition: GloballyPositioned.h:36
SmartPropagator::insideTkVol
bool insideTkVol(const FreeTrajectoryState &fts) const
true if a fts is inside tracker volume
Definition: SmartPropagator.cc:125
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
Propagator::clone
virtual Propagator * clone() const =0
PropagationDirection
PropagationDirection
Definition: PropagationDirection.h:4
Plane
Definition: Plane.h:16
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
BoundCylinder
Propagator::propagateWithPath
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const FreeTrajectoryState &, const Surface &) const final
Definition: Propagator.cc:10
BoundPlane.h
Cylinder
Definition: Cylinder.h:19
MagneticField
Definition: MagneticField.h:19
GlobalPoint.h
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23