CMS 3D CMS Logo

SmartPropagator.cc

Go to the documentation of this file.
00001 /******* \class SmartPropagator *******
00002  *
00003  * Description: A propagator which use different algorithm to propagate inside
00004  * or outside tracker
00005  *  
00006  *
00007  * \author : Stefano Lacaprara - INFN Padova <stefano.lacaprara@pd.infn.it>
00008  * \porting author: Chang Liu - Purdue University 
00009  * $Date: 2007/03/07 16:46:17 $
00010  * $Revision: 1.6 $
00011  *
00012  * Modification:
00013  *
00014  *********************************/
00015 
00016 /* This Class Header */
00017 #include "TrackingTools/GeomPropagators/interface/SmartPropagator.h"
00018 
00019 /* Collaborating Class Header */
00020 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00021 #include "DataFormats/GeometrySurface/interface/BoundPlane.h"
00022 #include "DataFormats/GeometrySurface/interface/SimpleCylinderBounds.h"
00023 
00024 #include "TrackingTools/DetLayers/interface/BarrelDetLayer.h"
00025 #include "TrackingTools/GeomPropagators/interface/TrackerBounds.h"
00026 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00027 
00028 /* Base Class Headers */
00029 
00030 /* C++ Headers */
00031 
00032 /* ====================================================================== */
00033 
00034 /* static member */
00035 ReferenceCountingPointer<BoundCylinder> & SmartPropagator::theTkVolume() {
00036   static ReferenceCountingPointer<BoundCylinder> local=0;
00037   return local;
00038 }
00039 
00040 
00041 
00042 /* Constructor */ 
00043 SmartPropagator::SmartPropagator(Propagator* aTkProp, Propagator* aGenProp, const MagneticField* field,
00044                                  PropagationDirection dir, float epsilon) :
00045   Propagator(dir), theTkProp(aTkProp->clone()), theGenProp(aGenProp->clone()), theField(field) { 
00046 
00047   if (theTkVolume()==0) initTkVolume(epsilon);
00048 
00049 }
00050 
00051 
00052 SmartPropagator::SmartPropagator(const Propagator& aTkProp, const Propagator& aGenProp,const MagneticField* field,
00053                                  PropagationDirection dir, float epsilon) :
00054   Propagator(dir), theTkProp(aTkProp.clone()), theGenProp(aGenProp.clone()), theField(field) {
00055 
00056   if (theTkVolume()==0) initTkVolume(epsilon);
00057 
00058 }
00059 
00060 
00061 SmartPropagator::SmartPropagator(const SmartPropagator& aProp) :
00062   Propagator(aProp.propagationDirection()), theTkProp(0), theGenProp(0) { 
00063     if (aProp.theTkProp)
00064       theTkProp=aProp.getTkPropagator()->clone();
00065     if (aProp.theGenProp)
00066       theTkProp=aProp.getGenPropagator()->clone();
00067 
00068     //SL since it's a copy constructor, then the TkVolume has been already
00069     //initialized
00070     //if (theTkVolume==0) initTkVolume(epsilon);
00071 
00072   }
00073 
00074 /* Destructor */ 
00075 SmartPropagator::~SmartPropagator() {
00076 
00077   delete theTkProp;
00078   delete theGenProp;
00079 
00080 }
00081 
00082 
00083 /* Operations */ 
00084 void SmartPropagator::initTkVolume(float epsilon) {
00085 
00086   //
00087   // fill tracker dimensions
00088   //
00089   float radius = TrackerBounds::radius();
00090   float r_out  = radius + epsilon/2;
00091   float r_in   = r_out - epsilon;
00092   float z_max  = TrackerBounds::halfLength();
00093   float z_min  = - z_max;
00094 
00095   Surface::PositionType pos(0,0,0); // centered at the global origin
00096   Surface::RotationType rot; // unit matrix - barrel cylinder orientation
00097 
00098   theTkVolume() = BoundCylinder::build(pos, rot, radius, SimpleCylinderBounds(r_in, r_out, z_min, z_max));
00099 
00100 }
00101 
00102 
00103 TrajectoryStateOnSurface SmartPropagator::propagate(const FreeTrajectoryState& fts, 
00104                                                     const Surface& surface) const {
00105   return Propagator::propagate( fts, surface);
00106 }
00107 
00108 
00109 TrajectoryStateOnSurface SmartPropagator::propagate(const FreeTrajectoryState& fts, 
00110                                                     const Plane& plane) const {
00111 
00112   if (insideTkVol(fts) && insideTkVol(plane)) {
00113     return getTkPropagator()->propagate(fts, plane);
00114   } else {
00115     return getGenPropagator()->propagate(fts, plane);
00116   }
00117 
00118 }
00119 
00120 
00121 TrajectoryStateOnSurface SmartPropagator::propagate(const FreeTrajectoryState& fts, 
00122                                                     const Cylinder& cylinder) const {
00123   if (insideTkVol(fts) && insideTkVol(cylinder)) {
00124     return getTkPropagator()->propagate(fts, cylinder);
00125   } else {
00126     return getGenPropagator()->propagate(fts, cylinder);
00127   }
00128 
00129 }
00130 
00131 std::pair<TrajectoryStateOnSurface,double> 
00132 SmartPropagator::propagateWithPath(const FreeTrajectoryState& fts, 
00133                                    const Plane& plane) const 
00134 {
00135   if (insideTkVol(fts) && insideTkVol(plane)) {
00136     return getTkPropagator()->propagateWithPath(fts, plane);
00137   } else {
00138     return getGenPropagator()->propagateWithPath(fts, plane);
00139   }
00140 }
00141 
00142 std::pair<TrajectoryStateOnSurface,double> 
00143 SmartPropagator::propagateWithPath(const FreeTrajectoryState& fts, 
00144                                    const Cylinder& cylinder) const
00145 {
00146   if (insideTkVol(fts) && insideTkVol(cylinder)) {
00147     return getTkPropagator()->propagateWithPath(fts, cylinder);
00148   } else {
00149     return getGenPropagator()->propagateWithPath(fts, cylinder);
00150   }
00151 }
00152 
00153 bool SmartPropagator::insideTkVol(const FreeTrajectoryState& fts) const {
00154 
00155   GlobalPoint gp = fts.position();
00156 //  LocalPoint lp = theTkVolume()->toLocal(gp);
00157 //  return theTkVolume()->bounds().inside(lp);
00158 
00159   return ( (gp.perp()<= TrackerBounds::radius()+10.) && (fabs(gp.z())<= TrackerBounds::halfLength()+10.) );
00160 }
00161 
00162 
00163 bool SmartPropagator::insideTkVol(const Surface& surface) const {
00164 
00165   GlobalPoint gp = surface.position();
00166  // LocalPoint lp = theTkVolume()->toLocal(gp);
00167 
00168  // return theTkVolume()->bounds().inside(lp);
00169   return ( (gp.perp()<= TrackerBounds::radius()+10.) && (fabs(gp.z())<= TrackerBounds::halfLength()+10.) );
00170 
00171 
00172 }
00173 
00174 
00175 bool SmartPropagator::insideTkVol( const BoundCylinder& cylin)  const {
00176 
00177   GlobalPoint gp(cylin.radius(),0.,(cylin.bounds().length())/2.);
00178 //  LocalPoint lp = theTkVolume()->toLocal(gp);
00179 //  return theTkVolume()->bounds().inside(lp);
00180   return ( (gp.perp()<= TrackerBounds::radius()+10.) && (fabs(gp.z())<= TrackerBounds::halfLength()+10.) );
00181 
00182 
00183 }
00184 
00185 
00186 bool SmartPropagator::insideTkVol( const Plane& plane)  const {
00187 
00188   GlobalPoint gp = plane.position();
00189 //  LocalPoint lp = theTkVolume()->toLocal(gp);
00190 //  return theTkVolume()->bounds().inside(lp);
00191   return ( (gp.perp()<= TrackerBounds::radius()+10.) && (fabs(gp.z())<= TrackerBounds::halfLength()+10.) );
00192 
00193 
00194 }
00195 
00196 
00197 Propagator* SmartPropagator::getTkPropagator() const {
00198 
00199   return theTkProp;
00200 
00201 }
00202 
00203 
00204 Propagator* SmartPropagator::getGenPropagator() const {
00205 
00206   return theGenProp;
00207 
00208 }
00209 
00210 

Generated on Tue Jun 9 17:48:17 2009 for CMSSW by  doxygen 1.5.4