CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/RecoTracker/TransientTrackingRecHit/interface/TSiStripRecHit1D.h

Go to the documentation of this file.
00001 #ifndef RECOTRACKER_TRANSIENTRACKINGRECHIT_TSiStripRecHit1D_H
00002 #define RECOTRACKER_TRANSIENTRACKINGRECHIT_TSiStripRecHit1D_H
00003 
00004 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit1D.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 
00013 class TSiStripRecHit1D : public TransientTrackingRecHit{
00014 public:
00015 
00016   typedef SiStripRecHit1D::ClusterRef SiStripClusterRef;
00017   
00018   typedef edm::LazyGetter<SiStripCluster>::value_ref  SiStripRegionalClusterRef;
00019 
00020   virtual ~TSiStripRecHit1D() {}
00021 
00022   
00023   virtual void getKfComponents( KfComponentsHolder & holder ) const {
00024       HelpertRecHit2DLocalPos().getKfComponents(holder, theHitData, *det()); 
00025   }
00026  
00027 
00028   virtual AlgebraicVector parameters() const {return theHitData.parameters();}
00029 
00030   
00031   virtual AlgebraicSymMatrix parametersError() const {
00032     return HelpertRecHit2DLocalPos().parError( theHitData.localPositionError(), *det()); 
00033     //    return theHitData->parametersError();
00034   }
00035   
00036 
00037   virtual AlgebraicMatrix projectionMatrix() const {return theHitData.projectionMatrix();}
00038   virtual int dimension() const {return theHitData.dimension();}
00039 
00040   virtual LocalPoint localPosition() const {return theHitData.localPosition();}
00041   virtual LocalError localPositionError() const {return theHitData.localPositionError();}
00042 
00043   virtual const TrackingRecHit * hit() const {return &theHitData;};
00044   
00045   virtual std::vector<const TrackingRecHit*> recHits() const {
00046     return hit()->recHits();
00047   }
00048   virtual std::vector<TrackingRecHit*> recHits() {
00049     return theHitData.recHits();
00050   }
00051 
00052   virtual const GeomDetUnit* detUnit() const;
00053 
00054   virtual bool canImproveWithTrack() const {return true;}
00055 
00056   //RC virtual TSiStripRecHit2DLocalPos* clone(const TrajectoryStateOnSurface& ts) const;
00057   virtual RecHitPointer clone(const TrajectoryStateOnSurface& ts) const;
00058 
00059   // Extension of the TransientTrackingRecHit interface
00060 
00061   const SiStripRecHit1D* specificHit() const {return &theHitData;};
00062   const StripClusterParameterEstimator* cpe() const {return theCPE;}
00063 
00064   static RecHitPointer build( const GeomDet * geom, const SiStripRecHit1D* rh,
00065                               const StripClusterParameterEstimator* cpe,
00066                               float weight=1., float annealing=1.,
00067                               bool computeCoarseLocalPosition=false) {
00068     return RecHitPointer( new TSiStripRecHit1D( geom, rh, cpe, weight, annealing,computeCoarseLocalPosition));
00069   }
00070 
00071   static RecHitPointer build( const LocalPoint& pos, const LocalError& err,
00072                               const GeomDet* det,
00073                               const SiStripClusterRef clust,
00074                               const StripClusterParameterEstimator* cpe,
00075                               float weight=1., float annealing=1.) {
00076     return RecHitPointer( new TSiStripRecHit1D( pos, err, det, clust, cpe, weight, annealing));
00077   }
00078 
00079   static RecHitPointer build( const LocalPoint& pos, const LocalError& err,
00080                               const GeomDet* det,
00081                               const SiStripRegionalClusterRef clust,
00082                               const StripClusterParameterEstimator* cpe,
00083                               float weight=1., float annealing=1.) {
00084     return RecHitPointer( new TSiStripRecHit1D( pos, err, det, clust, cpe, weight, annealing));
00085   }
00086 
00087 
00088 
00089 private:
00090 
00091   SiStripRecHit1D              theHitData;
00092   const StripClusterParameterEstimator* theCPE;
00093 
00094   TSiStripRecHit1D (const GeomDet * geom, const SiStripRecHit1D* rh,
00095                     const StripClusterParameterEstimator* cpe,
00096                     float weight, float annealing,
00097                     bool computeCoarseLocalPosition) : 
00098     TransientTrackingRecHit(geom, weight, annealing), theCPE(cpe) 
00099     {
00100       if (rh->hasPositionAndError() || !computeCoarseLocalPosition)
00101         theHitData = SiStripRecHit1D(*rh);
00102       else{
00103       const GeomDetUnit* gdu = dynamic_cast<const GeomDetUnit*>(geom);
00104       LogDebug("TSiStripRecHit2DLocalPos")<<"calculating coarse position/error.";
00105       if (gdu){
00106         if (rh->cluster().isNonnull()){
00107           StripClusterParameterEstimator::LocalValues lval= theCPE->localParameters(*rh->cluster(), *gdu);
00108           LocalError le(lval.second.xx(),0.,DBL_MAX); //Correct??
00109           theHitData = SiStripRecHit1D(lval.first, le, geom->geographicalId(),rh->cluster());
00110         }else{
00111           StripClusterParameterEstimator::LocalValues lval= theCPE->localParameters(*rh->cluster_regional(), *gdu);
00112           LocalError le(lval.second.xx(),0.,DBL_MAX); //Correct??
00113           theHitData = SiStripRecHit1D(lval.first, le, geom->geographicalId(),rh->cluster_regional());
00114         }
00115       }else{
00116         edm::LogError("TSiStripRecHit2DLocalPos")<<" geomdet does not cast into geomdet unit. cannot create strip local parameters.";
00117         theHitData = SiStripRecHit1D(*rh);
00118       }
00119       }
00120     }
00121 
00123   TSiStripRecHit1D( const LocalPoint& pos, const LocalError& err,
00124                     const GeomDet* det,
00125                     const SiStripClusterRef clust,
00126                     const StripClusterParameterEstimator* cpe,
00127                     float weight, float annealing) :
00128     TransientTrackingRecHit(det, weight, annealing), theHitData(pos, err, det->geographicalId(), clust), 
00129     theCPE(cpe){} 
00130 
00131   //  TSiStripRecHit2DLocalPos( const TSiStripRecHit2DLocalPos& other ) :
00132   //  TransientTrackingRecHit( other.det()), 
00133   //  theHitData( other.specificHit()->clone()),
00134   //  theCPE( other.cpe()) {}
00135 
00136   TSiStripRecHit1D( const LocalPoint& pos, const LocalError& err,
00137                     const GeomDet* det,
00138                     const SiStripRegionalClusterRef clust,                          
00139                     const StripClusterParameterEstimator* cpe,
00140                     float weight, float annealing) :
00141     TransientTrackingRecHit(det, weight, annealing), theHitData(pos, err, det->geographicalId(), clust), 
00142     theCPE(cpe){} 
00143   
00144   
00145 
00146   virtual TSiStripRecHit1D* clone() const {
00147     return new TSiStripRecHit1D(*this);
00148   }
00149 
00150 };
00151 
00152 #endif