CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/Alignment/ReferenceTrajectories/src/BeamSpotTransientTrackingRecHit.h

Go to the documentation of this file.
00001 #ifndef BeamSpotTransientTrackingRecHit_H
00002 #define BeamSpotTransientTrackingRecHit_H
00003 
00015 #include <iostream>
00016 
00017 #include "DataFormats/CLHEP/interface/AlgebraicObjects.h" 
00018 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00019 #include "DataFormats/GeometryCommonDetAlgo/interface/ErrorFrameTransformer.h"
00020 
00021 #include "Alignment/CommonAlignment/interface/AlignableBeamSpot.h"
00022 
00023 #include "BeamSpotGeomDet.h"
00024 
00025 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
00026 
00027 class BeamSpotTransientTrackingRecHit: public TransientTrackingRecHit {
00028  public:
00029 
00030   typedef TrackingRecHit::Type Type;
00031   
00032   BeamSpotTransientTrackingRecHit(const reco::BeamSpot &beamSpot,
00033                                   const BeamSpotGeomDet * geom,
00034                                   double phi)
00035     :TransientTrackingRecHit(geom, AlignableBeamSpot::detId(), valid, 1.0, 1.0) {
00036 
00037     beamSpotGlobalPosition_ = GlobalPoint(beamSpot.x0(), beamSpot.y0(), beamSpot.z0());
00038     beamSpotLocalPosition_ = det()->toLocal(beamSpotGlobalPosition_);
00039 
00040     beamSpotLocalError_ = LocalError(sqrt(beamSpot.BeamWidthX()*cos(phi)*beamSpot.BeamWidthX()*cos(phi) +
00041                                           beamSpot.BeamWidthY()*sin(phi)*beamSpot.BeamWidthY()*sin(phi)),
00042                                      0.0, beamSpot.sigmaZ());
00043     beamSpotGlobalError_ = ErrorFrameTransformer().transform(beamSpotLocalError_, det()->surface());
00044     
00045     beamSpotErrorRPhi_ = beamSpotGlobalPosition_.perp()*sqrt(beamSpotGlobalError_.phierr(beamSpotGlobalPosition_)); 
00046     beamSpotErrorR_ = sqrt(beamSpotGlobalError_.rerr(beamSpotGlobalPosition_));
00047     beamSpotErrorZ_ = sqrt(beamSpotGlobalError_.czz());
00048   }
00049     
00050   virtual ~BeamSpotTransientTrackingRecHit() {}
00051 
00052   virtual GlobalPoint globalPosition() const { return beamSpotGlobalPosition_; }
00053   virtual GlobalError globalPositionError() const { return beamSpotGlobalError_; }
00054 
00055   virtual LocalPoint localPosition() const { return beamSpotLocalPosition_; }
00056   virtual LocalError localPositionError() const { return beamSpotLocalError_; }
00057 
00058   float errorGlobalR() const { return beamSpotErrorR_; }
00059   float errorGlobalZ() const { return beamSpotErrorZ_; }
00060   float errorGlobalRPhi() const { return beamSpotErrorRPhi_; }
00061 
00062   virtual AlgebraicVector parameters() const;
00063   virtual AlgebraicSymMatrix parametersError() const;
00064   virtual int dimension() const { return 1; }
00065 
00066   virtual const TrackingRecHit * hit() const { return 0; }
00067 
00068   virtual std::vector<const TrackingRecHit*> recHits() const {
00069     return std::vector<const TrackingRecHit*>();
00070   }
00071   virtual std::vector<TrackingRecHit*> recHits() {
00072     return std::vector<TrackingRecHit*>();
00073   }
00074 
00075   virtual const Surface * surface() const { return &(det()->surface()); }
00076 
00077   virtual AlgebraicMatrix projectionMatrix() const {
00078     if (!isInitialized) initialize();
00079     return theProjectionMatrix;
00080   }
00081 
00082  protected:
00083 
00084   GlobalPoint beamSpotGlobalPosition_;
00085   GlobalError beamSpotGlobalError_;  
00086   float beamSpotErrorR_, beamSpotErrorZ_, beamSpotErrorRPhi_;
00087   LocalPoint beamSpotLocalPosition_;
00088   LocalError beamSpotLocalError_;
00089 
00090  private:
00091   
00092   // should not have assignment operator (?)
00093   BeamSpotTransientTrackingRecHit & operator= (const BeamSpotTransientTrackingRecHit & t) {
00094      return *(this);
00095   }
00096 
00097   // hide the clone method for ReferenceCounted. Warning: this method is still 
00098   // accessible via the bas class TrackingRecHit interface!
00099    virtual BeamSpotTransientTrackingRecHit * clone() const {
00100      return new BeamSpotTransientTrackingRecHit(*this);
00101    }
00102    
00103    static bool isInitialized;
00104    static AlgebraicMatrix theProjectionMatrix;
00105    void initialize() const;
00106 };
00107 
00108 #endif
00109