File indexing completed on 2024-04-06 12:31:29
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include "TrackingTools/GeomPropagators/interface/SmartPropagator.h"
0016
0017
0018 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0019 #include "DataFormats/GeometrySurface/interface/BoundPlane.h"
0020 #include "DataFormats/GeometrySurface/interface/SimpleCylinderBounds.h"
0021
0022 #include <DataFormats/GeometrySurface/interface/BoundCylinder.h>
0023
0024 #include "TrackingTools/GeomPropagators/interface/TrackerBounds.h"
0025 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 SmartPropagator::SmartPropagator(const Propagator* aTkProp,
0037 const Propagator* aGenProp,
0038 const MagneticField* field,
0039 PropagationDirection dir,
0040 float epsilon)
0041 : Propagator(dir), theTkProp(aTkProp->clone()), theGenProp(aGenProp->clone()), theField(field) {
0042 initTkVolume(epsilon);
0043 }
0044
0045 SmartPropagator::SmartPropagator(const Propagator& aTkProp,
0046 const Propagator& aGenProp,
0047 const MagneticField* field,
0048 PropagationDirection dir,
0049 float epsilon)
0050 : Propagator(dir), theTkProp(aTkProp.clone()), theGenProp(aGenProp.clone()), theField(field) {
0051 initTkVolume(epsilon);
0052 }
0053
0054 SmartPropagator::SmartPropagator(const SmartPropagator& aProp)
0055 : Propagator(aProp.propagationDirection()), theTkProp(nullptr), theGenProp(nullptr) {
0056 if (aProp.theTkProp)
0057 theTkProp = aProp.getTkPropagator()->clone();
0058 if (aProp.theGenProp)
0059 theTkProp = aProp.getGenPropagator()->clone();
0060
0061
0062
0063
0064 }
0065
0066
0067 SmartPropagator::~SmartPropagator() {
0068 delete theTkProp;
0069 delete theGenProp;
0070 }
0071
0072
0073 void SmartPropagator::initTkVolume(float epsilon) {
0074
0075
0076
0077 float radius = TrackerBounds::radius();
0078 float r_out = radius + epsilon / 2;
0079 float r_in = r_out - epsilon;
0080 float z_max = TrackerBounds::halfLength();
0081 float z_min = -z_max;
0082
0083 Surface::PositionType pos(0, 0, 0);
0084 Surface::RotationType rot;
0085
0086 theTkVolume = Cylinder::build(radius, pos, rot, new SimpleCylinderBounds(r_in, r_out, z_min, z_max));
0087 }
0088
0089 std::pair<TrajectoryStateOnSurface, double> SmartPropagator::propagateWithPath(const FreeTrajectoryState& fts,
0090 const Plane& plane) const {
0091 if (insideTkVol(fts) && insideTkVol(plane)) {
0092 return getTkPropagator()->propagateWithPath(fts, plane);
0093 } else {
0094 return getGenPropagator()->propagateWithPath(fts, plane);
0095 }
0096 }
0097
0098 std::pair<TrajectoryStateOnSurface, double> SmartPropagator::propagateWithPath(const FreeTrajectoryState& fts,
0099 const Cylinder& cylinder) const {
0100 if (insideTkVol(fts) && insideTkVol(cylinder)) {
0101 return getTkPropagator()->propagateWithPath(fts, cylinder);
0102 } else {
0103 return getGenPropagator()->propagateWithPath(fts, cylinder);
0104 }
0105 }
0106
0107 std::pair<TrajectoryStateOnSurface, double> SmartPropagator::propagateWithPath(const TrajectoryStateOnSurface& fts,
0108 const Plane& plane) const {
0109 if (insideTkVol(*fts.freeState()) && insideTkVol(plane)) {
0110 return getTkPropagator()->propagateWithPath(fts, plane);
0111 } else {
0112 return getGenPropagator()->propagateWithPath(fts, plane);
0113 }
0114 }
0115
0116 std::pair<TrajectoryStateOnSurface, double> SmartPropagator::propagateWithPath(const TrajectoryStateOnSurface& fts,
0117 const Cylinder& cylinder) const {
0118 if (insideTkVol(*fts.freeState()) && insideTkVol(cylinder)) {
0119 return getTkPropagator()->propagateWithPath(fts, cylinder);
0120 } else {
0121 return getGenPropagator()->propagateWithPath(fts, cylinder);
0122 }
0123 }
0124
0125 bool SmartPropagator::insideTkVol(const FreeTrajectoryState& fts) const {
0126 GlobalPoint gp = fts.position();
0127
0128
0129
0130 return ((gp.perp() <= TrackerBounds::radius() + 10.) && (fabs(gp.z()) <= TrackerBounds::halfLength() + 10.));
0131 }
0132
0133 bool SmartPropagator::insideTkVol(const Surface& surface) const {
0134 const GlobalPoint& gp = surface.position();
0135
0136
0137
0138 return ((gp.perp() <= TrackerBounds::radius() + 10.) && (fabs(gp.z()) <= TrackerBounds::halfLength() + 10.));
0139 }
0140
0141 bool SmartPropagator::insideTkVol(const BoundCylinder& cylin) const {
0142 GlobalPoint gp(cylin.radius(), 0., (cylin.bounds().length()) / 2.);
0143
0144
0145 return ((gp.perp() <= TrackerBounds::radius() + 10.) && (fabs(gp.z()) <= TrackerBounds::halfLength() + 10.));
0146 }
0147
0148 bool SmartPropagator::insideTkVol(const Plane& plane) const {
0149 const GlobalPoint& gp = plane.position();
0150
0151
0152 return ((gp.perp() <= TrackerBounds::radius() + 10.) && (fabs(gp.z()) <= TrackerBounds::halfLength() + 10.));
0153 }
0154
0155 const Propagator* SmartPropagator::getTkPropagator() const { return theTkProp; }
0156
0157 const Propagator* SmartPropagator::getGenPropagator() const { return theGenProp; }