ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/auterman/PhysicsTools/IsolationUtils/src/PropagateToCal.cc
Revision: 1.1.1.1 (vendor branch)
Committed: Wed May 23 17:29:36 2007 UTC (17 years, 11 months ago) by auterman
Content type: text/plain
Branch: tex, PatCrossCleaner, Demo, SusyScan, scripts, IsolationUtils, MAIN
CVS Tags: start, HEAD
Changes since 1.1: +0 -0 lines
Log Message:

File Contents

# User Rev Content
1 auterman 1.1 #include "PhysicsTools/IsolationUtils/interface/PropagateToCal.h"
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    
18     PropagateToCal::~PropagateToCal()
19     {
20     }
21    
22    
23     bool PropagateToCal::propagate(const GlobalPoint& vertex,
24     GlobalVector& Cand, int charge, const MagneticField * field) const
25     {
26     ///the code is inspired by Gero's CosmicGenFilterHelix class:
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    
37     /// target cylinder, around z-axis
38     Cylinder::ConstCylinderPointer theTargetCylinder =
39     Cylinder::build(Surface::PositionType(0.,0.,0.), dummyRot, radius_);
40    
41     /// plane closing cylinder at 'negative' side
42     Plane::ConstPlanePointer theTargetPlaneMin =
43     Plane::build(Surface::PositionType(0.,0.,minZ_), dummyRot);
44    
45     /// plane closing cylinder at 'positive' side
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     }
69     ///The result is the vector connecting the extrapolation endPoint on the Calorimeter surface and
70     ///the origin of the coordinate system, point (0,0,0).
71     if (result) {
72     Cand = GlobalVector(aTsosPath.first.globalPosition().x(),
73     aTsosPath.first.globalPosition().y(),
74     aTsosPath.first.globalPosition().z() );
75     }
76     return result;///Successfully propagated to the calorimeter or not
77     }