CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/TrackPropagation/RungeKutta/interface/RKTestPropagator.h

Go to the documentation of this file.
00001 #ifndef RKTestPropagator_H
00002 #define RKTestPropagator_H
00003 
00004 #include "MagneticField/VolumeGeometry/interface/MagneticFieldProvider.h"
00005 #include "TrackPropagation/RungeKutta/interface/RKPropagatorInS.h"
00006 
00008 //
00009 // Wrapper to test RKPropagatorInS in central volume using Veikko's 
00010 // parametrized field... Martijn Mulders 29/6/07
00011 //
00013 
00014 
00015 class GlobalTrajectoryParameters;
00016 class GlobalParametersWithPath;
00017 class MagVolume;
00018 class RKLocalFieldProvider;
00019 class CartesianStateAdaptor;
00020 
00021 
00022 class RKTestField : public MagneticField
00023 {
00024  public:
00025   virtual GlobalVector inTesla ( const GlobalPoint& ) const {return GlobalVector(0,0,4);}
00026 };
00027 
00028 class RKTestFieldProvider : public MagneticFieldProvider<float> {
00029 public:
00030 
00031 RKTestFieldProvider (const MagneticField* field) : theField(field) {}
00032 
00033  virtual LocalVectorType valueInTesla( const LocalPointType& lp) const {
00034    // NOTE: the following transformation only works for the central volume
00035    // where global and local coordinates are numerically equal !
00036    GlobalPoint gp(lp.x(), lp.y(), lp.z());
00037    GlobalVector gv =  theField->inTesla(gp);
00038    return LocalVectorType(gv.x(),gv.y(),gv.z());
00039  }
00040 
00041  private:
00042 
00043  const MagneticField* theField; 
00044 
00045 };
00046 
00047 class RKTestMagVolume : public MagVolume {
00048 public:
00049   RKTestMagVolume( const PositionType& pos, const RotationType& rot, 
00050                        DDSolidShape shape, const MagneticFieldProvider<float> * mfp) :
00051     MagVolume( pos, rot, shape, mfp) {}
00052 
00053   virtual bool inside( const GlobalPoint& gp, double tolerance=0.) const {return true;}
00054 
00056   virtual const std::vector<VolumeSide>& faces() const {return theFaces;}
00057 
00058 private:
00059   std::vector<VolumeSide> theFaces;
00060   
00061 };
00062 
00063 #include "DataFormats/GeometryCommonDetAlgo/interface/DeepCopyPointerByClone.h"
00064 
00065 class RKTestPropagator : public Propagator {
00066  public:
00067 
00068 
00069 
00070   explicit RKTestPropagator( const MagneticField* field, PropagationDirection dir = alongMomentum,
00071                              double tolerance = 5.e-5) :
00072     theTolerance(tolerance),
00073     theRealField(field),
00074     RKField(field),
00075     RKVol(RKTestMagVolume(MagVolume::PositionType(0,0,0), MagVolume::RotationType(),ddshapeless, &RKField ) ),
00076     theRKProp(new RKPropagatorInS(RKVol, dir, tolerance)) {}  
00077 
00078   virtual TrajectoryStateOnSurface 
00079     propagate (const FreeTrajectoryState& state, const Plane& plane) const {return theRKProp->propagate(state,plane);}
00080   
00081   virtual TrajectoryStateOnSurface 
00082     propagate (const FreeTrajectoryState& state, const Cylinder& cyl) const {
00083     return theRKProp->propagate(state,cyl);}
00084 
00085   virtual std::pair< TrajectoryStateOnSurface, double> 
00086     propagateWithPath (const FreeTrajectoryState& state, const Plane& plane) const {
00087     return theRKProp->propagateWithPath(state,plane);}
00088 
00089   virtual std::pair< TrajectoryStateOnSurface, double> 
00090     propagateWithPath (const FreeTrajectoryState& state, const Cylinder& cyl) const {return theRKProp->propagateWithPath(state,cyl);}
00091 
00092   TrajectoryStateOnSurface propagate(const TrajectoryStateOnSurface& ts, 
00093                                      const Plane& plane) const {return theRKProp->propagate(ts,plane);}
00094 
00095   virtual void setPropagationDirection(PropagationDirection dir) const {
00096     theRKProp->setPropagationDirection(dir);
00097   }
00098 
00099   virtual PropagationDirection propagationDirection() const {
00100     return theRKProp->propagationDirection();
00101   }
00102   
00103 
00104   Propagator* clone() const
00105     {
00106 
00107       return new RKTestPropagator(magneticField(),propagationDirection(),theTolerance);
00108 
00109     }
00110 
00111   virtual const MagneticField* magneticField() const { return theRealField;}
00112 
00113 
00114  private:
00115   float theTolerance;
00116   const MagneticField* theRealField;
00117   RKTestFieldProvider RKField;
00118   RKTestMagVolume  RKVol;
00119   DeepCopyPointerByClone<Propagator> theRKProp;  
00120 };
00121 
00122 #endif