CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/src/RecoTracker/TransientTrackingRecHit/src/TSiStripRecHit1D.cc

Go to the documentation of this file.
00001 #include "RecoTracker/TransientTrackingRecHit/interface/TSiStripRecHit1D.h"
00002 #include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
00003 #include "DataFormats/SiStripCluster/interface/SiStripCluster.h"
00004 #include "RecoLocalTracker/ClusterParameterEstimator/interface/StripClusterParameterEstimator.h"
00005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00006 
00007 #include<limits>
00008 
00009 TSiStripRecHit1D::TSiStripRecHit1D (const GeomDet * geom, const SiStripRecHit1D* rh,
00010                                     const StripClusterParameterEstimator* cpe,
00011                                     bool computeCoarseLocalPosition) : 
00012 TransientTrackingRecHit(geom), theCPE(cpe) 
00013 {
00014   if (rh->hasPositionAndError() || !computeCoarseLocalPosition)
00015     theHitData = SiStripRecHit1D(*rh);
00016   else{
00017     const GeomDetUnit* gdu = dynamic_cast<const GeomDetUnit*>(geom);
00018     LogDebug("TSiStripRecHit2DLocalPos")<<"calculating coarse position/error.";
00019     if (gdu){
00020       if (rh->cluster().isNonnull()){
00021         StripClusterParameterEstimator::LocalValues lval= theCPE->localParameters(*rh->cluster(), *gdu);
00022         LocalError le(lval.second.xx(),0.,std::numeric_limits<float>::max()); //Correct??
00023         theHitData = SiStripRecHit1D(lval.first, le, geom->geographicalId(),rh->cluster());
00024       }else{
00025         StripClusterParameterEstimator::LocalValues lval= theCPE->localParameters(*rh->cluster_regional(), *gdu);
00026         LocalError le(lval.second.xx(),0.,std::numeric_limits<float>::max()); //Correct??
00027         theHitData = SiStripRecHit1D(lval.first, le, geom->geographicalId(),rh->cluster_regional());
00028         }
00029     }else{
00030       edm::LogError("TSiStripRecHit2DLocalPos")<<" geomdet does not cast into geomdet unit. cannot create strip local parameters.";
00031       theHitData = SiStripRecHit1D(*rh);
00032     }
00033   }
00034 }
00035 
00036 TransientTrackingRecHit::RecHitPointer
00037 TSiStripRecHit1D::clone (const TrajectoryStateOnSurface& ts) const
00038 {
00039   if (theCPE != 0) {
00041     const SiStripCluster&  clust = specificHit()->stripCluster();  
00042     StripClusterParameterEstimator::LocalValues lv = 
00043       theCPE->localParameters( clust, *detUnit(), ts);
00044     LocalError le(lv.second.xx(),0.,std::numeric_limits<float>::max()); //Correct??
00045     return TSiStripRecHit1D::build( lv.first, le, det(), specificHit()->omniClusterRef(), theCPE);
00046   }
00047   else {
00048     //FIXME. It should report the problem with a LogWarning;
00049     return clone();
00050   }
00051 }
00052 
00053 const GeomDetUnit* TSiStripRecHit1D::detUnit() const
00054 {
00055   return static_cast<const GeomDetUnit*>(det());
00056 }