CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/RecoTracker/TransientTrackingRecHit/interface/TSiStripRecHit2DLocalPos.h

Go to the documentation of this file.
00001 #ifndef RECOTRACKER_TRANSIENTRACKINGRECHIT_TSiStripRecHit2DLocalPos_H
00002 #define RECOTRACKER_TRANSIENTRACKINGRECHIT_TSiStripRecHit2DLocalPos_H
00003 
00004 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h"
00005 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
00006 #include "RecoLocalTracker/ClusterParameterEstimator/interface/StripClusterParameterEstimator.h"
00007 #include "TrackingTools/TransientTrackingRecHit/interface/HelpertRecHit2DLocalPos.h"
00008 #include "DataFormats/Common/interface/RefGetter.h"
00009 #include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
00010 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00011 
00012 class TSiStripRecHit2DLocalPos GCC11_FINAL : public TransientTrackingRecHit{
00013 public:
00014   
00015   typedef SiStripRecHit2D::ClusterRef SiStripClusterRef;
00016   
00017   typedef edm::LazyGetter<SiStripCluster>::value_ref  SiStripRegionalClusterRef;
00018   
00019   virtual ~TSiStripRecHit2DLocalPos() {}
00020   
00021   
00022   virtual void getKfComponents( KfComponentsHolder & holder ) const {
00023     HelpertRecHit2DLocalPos().getKfComponents(holder, theHitData, *det()); 
00024   }
00025   
00026   virtual AlgebraicVector parameters() const {return theHitData.parameters();}
00027   virtual AlgebraicSymMatrix parametersError() const {
00028     return HelpertRecHit2DLocalPos().parError( theHitData.localPositionError(), *det()); 
00029     //    return theHitData->parametersError();
00030   }
00031   
00032   virtual AlgebraicMatrix projectionMatrix() const {return theHitData.projectionMatrix();}
00033   virtual int dimension() const {return theHitData.dimension();}
00034   
00035   virtual LocalPoint localPosition() const {return theHitData.localPosition();}
00036   virtual LocalError localPositionError() const {return theHitData.localPositionError();}
00037   
00038   virtual const TrackingRecHit * hit() const {return &theHitData;};
00039   
00040   virtual std::vector<const TrackingRecHit*> recHits() const {
00041     return hit()->recHits();
00042   }
00043   virtual std::vector<TrackingRecHit*> recHits() {
00044     return theHitData.recHits();
00045   }
00046   
00047   virtual const GeomDetUnit* detUnit() const;
00048   
00049   virtual bool canImproveWithTrack() const {return true;}
00050   
00051   //RC virtual TSiStripRecHit2DLocalPos* clone(const TrajectoryStateOnSurface& ts) const;
00052   virtual RecHitPointer clone(const TrajectoryStateOnSurface& ts) const;
00053   
00054   // Extension of the TransientTrackingRecHit interface
00055   
00056   const SiStripRecHit2D* specificHit() const {return &theHitData;};
00057   const StripClusterParameterEstimator* cpe() const {return theCPE;}
00058   
00059   static RecHitPointer build( const GeomDet * geom, const SiStripRecHit2D* rh,
00060                               const StripClusterParameterEstimator* cpe,
00061                               bool computeCoarseLocalPosition=false) {
00062     return RecHitPointer( new TSiStripRecHit2DLocalPos( geom, rh, cpe,computeCoarseLocalPosition));
00063   }
00064   
00065   
00066   static RecHitPointer build( const LocalPoint& pos, const LocalError& err,
00067                               const GeomDet* det,
00068                               const OmniClusterRef & clust,
00069                               const StripClusterParameterEstimator* cpe) {
00070     return RecHitPointer( new TSiStripRecHit2DLocalPos( pos, err, det, clust, cpe));
00071   }
00072 
00073   static RecHitPointer build( const LocalPoint& pos, const LocalError& err,
00074                               const GeomDet* det,
00075                               const SiStripClusterRef & clust,
00076                               const StripClusterParameterEstimator* cpe) {
00077     return RecHitPointer( new TSiStripRecHit2DLocalPos( pos, err, det, OmniClusterRef(clust), cpe));
00078   }
00079   
00080   static RecHitPointer build( const LocalPoint& pos, const LocalError& err,
00081                               const GeomDet* det,
00082                               const SiStripRegionalClusterRef & clust,
00083                               const StripClusterParameterEstimator* cpe) {
00084     return RecHitPointer( new TSiStripRecHit2DLocalPos( pos, err, det, OmniClusterRef(clust), cpe));
00085   }
00086   
00087   
00088   
00089 private:
00090   
00091   const StripClusterParameterEstimator* theCPE;
00092   SiStripRecHit2D              theHitData;
00093  
00094 
00095  
00096   TSiStripRecHit2DLocalPos (const GeomDet * geom, const SiStripRecHit2D* rh,
00097                             const StripClusterParameterEstimator* cpe,
00098                             bool computeCoarseLocalPosition) : 
00099     TransientTrackingRecHit(geom), theCPE(cpe) 
00100   {
00101     if (rh->hasPositionAndError() || !computeCoarseLocalPosition) {
00102       theHitData = SiStripRecHit2D(*rh);
00103       return;
00104     }
00105 
00106     if (computeCoarseLocalPosition && !cpe){
00107       edm::LogError("TSiStripRecHit2DLocalPos")<<" trying to compute coarse local position but CPE is not provided. Not computing local position from disk for the transient tracking rechit.";
00108       theHitData = SiStripRecHit2D(*rh);
00109       return;
00110     }
00111     
00112     const GeomDetUnit* gdu = dynamic_cast<const GeomDetUnit*>(geom);
00113     LogDebug("TSiStripRecHit2DLocalPos")<<"calculating coarse position/error.";
00114     if (gdu){
00115       StripClusterParameterEstimator::LocalValues lval= theCPE->localParameters(rh->stripCluster(), *gdu);
00116       theHitData = SiStripRecHit2D(lval.first, lval.second, geom->geographicalId(),rh->omniCluster());
00117     } else{
00118       edm::LogError("TSiStripRecHit2DLocalPos")<<" geomdet does not cast into geomdet unit. cannot create strip local parameters.";
00119     theHitData = SiStripRecHit2D(*rh);
00120     }
00121   }
00122   
00124   TSiStripRecHit2DLocalPos( const LocalPoint& pos, const LocalError& err,
00125                             const GeomDet* det,
00126                             const OmniClusterRef & clust,
00127                             const StripClusterParameterEstimator* cpe) :
00128     TransientTrackingRecHit(det), 
00129     theCPE(cpe), theHitData(pos, err, det->geographicalId(), clust) {} 
00130     
00131   virtual TSiStripRecHit2DLocalPos* clone() const {
00132     return new TSiStripRecHit2DLocalPos(*this);
00133   }
00134   
00135   virtual ConstRecHitContainer transientHits() const;
00136   
00137 };
00138 
00139 #endif