CMS 3D CMS Logo

PropagateToCal.cc
Go to the documentation of this file.
2 
3 PropagateToCal::PropagateToCal(double radius, double minZ, double maxZ, bool theIgnoreMaterial) {
4  radius_ = radius;
5  maxZ_ = maxZ;
6  minZ_ = minZ;
7  theIgnoreMaterial_ = theIgnoreMaterial;
8  if (maxZ_ < minZ_ || radius < 0.0)
9  throw cms::Exception("BadConfig") << "PropagateToCal: CalMaxZ (" << maxZ_ << ") smaller than CalMinZ (" << minZ_
10  << ") or invalid radius (" << radius_ << ").";
11 }
12 
14 
16  GlobalVector& Cand,
17  int charge,
18  const MagneticField* field) const {
20  bool result = true;
21  typedef std::pair<TrajectoryStateOnSurface, double> TsosPath;
22 
23  SteppingHelixPropagator propagator(field); // should we somehow take it from ESetup???
24  propagator.setMaterialMode(theIgnoreMaterial_); // no material effects if set to true
25  propagator.setNoErrorPropagation(true);
26 
28  const Surface::RotationType dummyRot;
29 
31  Cylinder::ConstCylinderPointer theTargetCylinder =
32  Cylinder::build(radius_, Surface::PositionType(0., 0., 0.), dummyRot);
33 
35  Plane::ConstPlanePointer theTargetPlaneMin = Plane::build(Surface::PositionType(0., 0., minZ_), dummyRot);
36 
38  Plane::ConstPlanePointer theTargetPlaneMax = Plane::build(Surface::PositionType(0., 0., maxZ_), dummyRot);
39 
40  TsosPath aTsosPath(propagator.propagateWithPath(fts, *theTargetCylinder));
41  if (!aTsosPath.first.isValid()) {
42  result = false;
43  } else if (aTsosPath.first.globalPosition().z() < theTargetPlaneMin->position().z()) {
44  // If on cylinder, but outside minimum z, try minimum z-plane:
45  // (Would it be possible to miss rdius on plane, but reach cylinder afterwards in z-range?
46  // No, at least not in B-field parallel to z-axis which is cylinder axis.)
47  aTsosPath = propagator.propagateWithPath(fts, *theTargetPlaneMin);
48  if (!aTsosPath.first.isValid() || aTsosPath.first.globalPosition().perp() > theTargetCylinder->radius()) {
49  result = false;
50  }
51  } else if (aTsosPath.first.globalPosition().z() > theTargetPlaneMax->position().z()) {
52  // Analog for outside maximum z:
53  aTsosPath = propagator.propagateWithPath(fts, *theTargetPlaneMax);
54  if (!aTsosPath.first.isValid() || aTsosPath.first.globalPosition().perp() > theTargetCylinder->radius()) {
55  result = false;
56  }
57  }
60  if (result) {
61  Cand = GlobalVector(aTsosPath.first.globalPosition().x(),
62  aTsosPath.first.globalPosition().y(),
63  aTsosPath.first.globalPosition().z());
64  }
65  return result;
66 }
double radius_
whether or not propagation should ignore material
static PlanePointer build(Args &&... args)
Definition: Plane.h:33
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=nullptr)
Definition: Cylinder.h:45
bool propagate(const GlobalPoint &vertex, GlobalVector &Cand, int charge, const MagneticField *bField) const
Global3DVector GlobalVector
Definition: GlobalVector.h:10