CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h

Go to the documentation of this file.
00001 #ifndef TrajectoryStateOnSurface_H
00002 #define TrajectoryStateOnSurface_H
00003 
00004 #include "TrackingTools/TrajectoryState/interface/BasicTrajectoryState.h"
00005 #include "TrackingTools/TrajectoryState/interface/SurfaceSideDefinition.h"
00006 
00007 #include <iosfwd>
00008 
00015 class TrajectoryStateOnSurface : private  BasicTrajectoryState::Proxy {
00016 
00017   typedef BasicTrajectoryState::SurfaceType SurfaceType;
00018   typedef BasicTrajectoryState::SurfaceSide SurfaceSide;
00019   typedef BasicTrajectoryState::Proxy             Base;
00020 
00021 public:
00022   // construct
00023   TrajectoryStateOnSurface() {}
00025 
00026   // invalid state
00027   explicit TrajectoryStateOnSurface(const SurfaceType& aSurface);
00028 
00029 
00030   TrajectoryStateOnSurface( BasicTrajectoryState* p) : Base(p) {}
00034   TrajectoryStateOnSurface( const FreeTrajectoryState& fts,
00035                             const SurfaceType& aSurface,
00036                             const SurfaceSide side = SurfaceSideDefinition::atCenterOfSurface);
00040   TrajectoryStateOnSurface( const GlobalTrajectoryParameters& gp,
00041                             const SurfaceType& aSurface,
00042                             const SurfaceSide side = SurfaceSideDefinition::atCenterOfSurface);
00046   TrajectoryStateOnSurface( const GlobalTrajectoryParameters& gp,
00047                             const CartesianTrajectoryError& err,
00048                             const SurfaceType& aSurface,
00049                             const SurfaceSide side = SurfaceSideDefinition::atCenterOfSurface);
00054   TrajectoryStateOnSurface( const GlobalTrajectoryParameters& gp,
00055                             const CurvilinearTrajectoryError& err,
00056                             const SurfaceType& aSurface,
00057                             const SurfaceSide side = SurfaceSideDefinition::atCenterOfSurface, 
00058                             double weight = 1.);
00063   TrajectoryStateOnSurface( const GlobalTrajectoryParameters& gp,
00064                             const CurvilinearTrajectoryError& err,
00065                             const SurfaceType& aSurface,
00066                             double weight);
00070   TrajectoryStateOnSurface( const LocalTrajectoryParameters& p,
00071                             const SurfaceType& aSurface,
00072                             const MagneticField* field,
00073                             const SurfaceSide side = SurfaceSideDefinition::atCenterOfSurface);
00078   TrajectoryStateOnSurface( const LocalTrajectoryParameters& p,
00079                             const LocalTrajectoryError& err,
00080                             const SurfaceType& aSurface,
00081                             const MagneticField* field,
00082                             const SurfaceSide side = SurfaceSideDefinition::atCenterOfSurface, 
00083                             double weight = 1.);
00088   TrajectoryStateOnSurface( const LocalTrajectoryParameters& p,
00089                             const LocalTrajectoryError& err,
00090                             const SurfaceType& aSurface,
00091                             const MagneticField* field,
00092                             double weight);
00093 
00094   ~TrajectoryStateOnSurface() {}
00095 
00096 #if defined( __GXX_EXPERIMENTAL_CXX0X__)
00097 
00098  TrajectoryStateOnSurface(TrajectoryStateOnSurface const & rh)  noexcept :
00099     Base(rh){}
00100 
00101 
00102   TrajectoryStateOnSurface(TrajectoryStateOnSurface && rh)  noexcept :
00103     Base(std::forward<Base>(rh)){}
00104     
00105   TrajectoryStateOnSurface & operator=(TrajectoryStateOnSurface && rh)  noexcept {
00106     Base::swap(rh);
00107     return *this;
00108   }
00109 
00110  TrajectoryStateOnSurface & operator=(TrajectoryStateOnSurface const & rh)  noexcept {
00111     Base::operator=(rh);
00112     return *this;
00113   }
00114 
00115 
00116 #endif
00117 
00118   void swap(TrajectoryStateOnSurface & rh)  noexcept {
00119     Base::swap(rh);
00120   }
00121 
00122 
00123   bool isValid() const {
00124     return Base::isValid() && data().isValid();
00125   }
00126 
00127   bool hasError() const {
00128     return data().hasError();
00129   }
00130 
00131   FreeTrajectoryState* freeState(bool withErrors = true) const {
00132     return data().freeTrajectoryState();
00133   }
00134 
00135   FreeTrajectoryState* freeTrajectoryState(bool withErrors = true) const {
00136     return freeState();
00137   }
00138 
00139   const MagneticField *magneticField() const { return data().magneticField(); }
00140 
00141   const GlobalTrajectoryParameters& globalParameters() const {
00142     return data().globalParameters();
00143   }
00144   GlobalPoint globalPosition() const {
00145     return data().globalPosition();
00146   }
00147   GlobalVector globalMomentum() const {
00148     return data().globalMomentum();
00149   }
00150   GlobalVector globalDirection() const {
00151     return data().globalDirection();
00152   }
00153   TrackCharge charge() const {
00154     return data().charge();
00155   }
00156   double signedInverseMomentum() const {
00157     return data().signedInverseMomentum();
00158   }
00159   double transverseCurvature() const {
00160     return data().transverseCurvature();
00161   }
00162   const CartesianTrajectoryError cartesianError() const {
00163     return data().cartesianError();
00164   }
00165   const CurvilinearTrajectoryError& curvilinearError() const {
00166     return data().curvilinearError();
00167   }
00168   const LocalTrajectoryParameters& localParameters() const {
00169     return data().localParameters();
00170   }
00171   LocalPoint localPosition() const {
00172     return data().localPosition();
00173   }
00174   LocalVector localMomentum() const {
00175     return data().localMomentum();
00176   }
00177   LocalVector localDirection() const {
00178     return data().localDirection();
00179   }
00180   const LocalTrajectoryError& localError() const {
00181     return data().localError();
00182   }
00183   const SurfaceType& surface() const {
00184     return data().surface();
00185   }
00186 
00187   double weight() const {return data().weight();} 
00188 
00189   void rescaleError(double factor) {
00190     unsharedData().rescaleError(factor);
00191   }
00192 
00193   std::vector<TrajectoryStateOnSurface> components() const {
00194     return data().components();
00195   }
00196   /*
00197   std::vector<TrajectoryStateOnSurface> components() const {
00198     std::vector<BasicTrajectoryState::RCPtr> c( data().components());
00199     std::vector<TrajectoryStateOnSurface> result; 
00200     result.reserve(c.size());
00201     for (std::vector<BasicTrajectoryState::RCPtr>::iterator i=c.begin();
00202          i != c.end(); i++) result.push_back(&(**i));
00203     return result;
00204   }
00205   */
00206 
00208   SurfaceSide surfaceSide() const {
00209     return data().surfaceSide();
00210   }
00211 
00217   void update( const LocalTrajectoryParameters& p,
00218                const SurfaceType& aSurface,
00219                const MagneticField* field,
00220                const SurfaceSide side = SurfaceSideDefinition::atCenterOfSurface);
00227   void update( const LocalTrajectoryParameters& p,
00228                const LocalTrajectoryError& err,
00229                const SurfaceType& aSurface,
00230                const MagneticField* field,
00231                const SurfaceSide side = SurfaceSideDefinition::atCenterOfSurface, 
00232                double weight = 1.);
00233 
00234 };
00235 
00236 inline void swap( TrajectoryStateOnSurface & rh,  TrajectoryStateOnSurface & lh) {
00237   // use base swap
00238   rh.swap(lh);
00239 }
00240 
00241 std::ostream& operator<<(std::ostream& os, const TrajectoryStateOnSurface & tsos);
00242 #endif