CMS 3D CMS Logo

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