CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/TrackingTools/GeomPropagators/src/StateOnTrackerBound.cc

Go to the documentation of this file.
00001 #include "TrackingTools/GeomPropagators/interface/StateOnTrackerBound.h"
00002 #include "TrackingTools/GeomPropagators/interface/Propagator.h"
00003 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
00004 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
00005 #include "TrackingTools/GeomPropagators/interface/TrackerBounds.h"
00006 #include "DataFormats/GeometrySurface/interface/BoundDisk.h"
00007 #include "DataFormats/GeometrySurface/interface/BoundCylinder.h"
00008 
00009 //Ported from ORCA
00010 //  $Date: 2011/02/08 14:59:45 $
00011 //  $Revision: 1.9 $
00012 
00013 StateOnTrackerBound::StateOnTrackerBound( const Propagator* prop) :
00014   thePropagator( prop->clone())
00015 {}
00016  
00017 StateOnTrackerBound::~StateOnTrackerBound()
00018 {
00019   delete thePropagator;
00020 }
00021 
00022 TrajectoryStateOnSurface
00023 StateOnTrackerBound::operator()(const TrajectoryStateOnSurface& tsos) const
00024 {
00025   return operator()(*tsos.freeState());
00026 }
00027 
00028 TrajectoryStateOnSurface 
00029 StateOnTrackerBound::operator()(const FreeTrajectoryState& fts) const
00030 {
00031   // try to guess if propagation should be first to cylinder or first to disk
00032   float tanTheta = (fts.position().perp() > 70 ) ? fts.position().perp()/fts.position().z() : fts.momentum().perp()/fts.momentum().z();
00033   float corner = TrackerBounds::radius() / TrackerBounds::halfLength();
00034 
00035   TrajectoryStateOnSurface firstTry;
00036   if (tanTheta < 0 && fabs(tanTheta) < corner) {
00037      firstTry = 
00038      thePropagator->propagate( fts, TrackerBounds::negativeEndcapDisk());
00039 
00040      if (!firstTry.isValid()) {
00041        return thePropagator->propagate( fts, TrackerBounds::barrelBound());
00042       }
00043      if (firstTry.globalPosition().perp() > TrackerBounds::radius()) {
00044         // the propagation should have gone to the cylinder
00045         return thePropagator->propagate( fts, TrackerBounds::barrelBound());
00046       }
00047       else return firstTry;
00048   }
00049   else if (tanTheta > 0 && fabs(tanTheta) < corner) {
00050       firstTry = 
00051       thePropagator->propagate( fts, TrackerBounds::positiveEndcapDisk());
00052       if (!firstTry.isValid()) {
00053         return thePropagator->propagate( fts, TrackerBounds::barrelBound());
00054       }
00055       if (firstTry.globalPosition().perp() > TrackerBounds::radius()) {
00056         return thePropagator->propagate( fts, TrackerBounds::barrelBound());
00057       }
00058       else return firstTry;
00059   }
00060   else {
00061     // barrel
00062     firstTry = 
00063     thePropagator->propagate( fts, TrackerBounds::barrelBound());
00064     if (!firstTry.isValid()) {
00065        if (tanTheta < 0 ) return thePropagator->propagate( fts,TrackerBounds::negativeEndcapDisk());
00066        if (tanTheta >= 0 ) return thePropagator->propagate( fts,TrackerBounds::positiveEndcapDisk());
00067        return firstTry;
00068      }
00069      if (firstTry.globalPosition().z() < -TrackerBounds::halfLength()) {
00070         // the propagation should have gone to the negative disk
00071         return thePropagator->propagate( fts,
00072                                          TrackerBounds::negativeEndcapDisk());
00073      }
00074      else if (firstTry.globalPosition().z() > TrackerBounds::halfLength()) {
00075         // the propagation should have gone to the positive disk
00076         return thePropagator->propagate( fts,
00077                                          TrackerBounds::positiveEndcapDisk());
00078      }
00079      else return firstTry;
00080   }    
00081   return firstTry;
00082 }