CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/RecoTracker/TransientTrackingRecHit/src/TSiPixelRecHit.cc

Go to the documentation of this file.
00001 #include "RecoTracker/TransientTrackingRecHit/interface/TSiPixelRecHit.h"
00002 #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h"
00003 #include "RecoLocalTracker/ClusterParameterEstimator/interface/PixelClusterParameterEstimator.h"
00004 #include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
00005 #include<typeinfo>
00006 
00007 TSiPixelRecHit::RecHitPointer TSiPixelRecHit::clone (const TrajectoryStateOnSurface& ts) const
00008 {
00009   if (theCPE == 0){
00010     return new TSiPixelRecHit( det(), &theHitData, 0, weight(), getAnnealingFactor(),false);
00011   }else{
00012     const SiPixelCluster& clust = *specificHit()->cluster();  
00013     PixelClusterParameterEstimator::LocalValues lv = 
00014       theCPE->localParameters( clust, *detUnit(), ts);
00015     return TSiPixelRecHit::build( lv.first, lv.second, det(), specificHit()->cluster(), theCPE, weight(), getAnnealingFactor());
00016   }
00017 }
00018 
00019 const GeomDetUnit* TSiPixelRecHit::detUnit() const
00020 {
00021   return static_cast<const GeomDetUnit*>(det());
00022 }
00023 
00024 
00025 
00026 // This private constructor copies the TrackingRecHit.  It should be used when the 
00027 // TrackingRecHit exist already in some collection.
00028 TSiPixelRecHit::TSiPixelRecHit(const GeomDet * geom, const SiPixelRecHit* rh, 
00029                                const PixelClusterParameterEstimator* cpe,
00030                                float weight, float annealing,
00031                                bool computeCoarseLocalPosition) : 
00032   TransientTrackingRecHit(geom, *rh, weight, annealing), theHitData(*rh), theCPE(cpe)
00033 {
00034   if (! (rh->hasPositionAndError() || !computeCoarseLocalPosition)) {
00035     const GeomDetUnit* gdu = dynamic_cast<const GeomDetUnit*>(geom);
00036     if (gdu){
00037       PixelClusterParameterEstimator::LocalValues lval= theCPE->localParameters(*rh->cluster(), *gdu);
00038       LogDebug("TSiPixelRecHit")<<"calculating coarse position/error.";
00039       theHitData = SiPixelRecHit(lval.first, lval.second,geom->geographicalId(),rh->cluster());
00040     }else{
00041       edm::LogError("TSiPixelRecHit") << " geomdet does not cast into geomdet unit. cannot create pixel local parameters.";
00042     }
00043   }
00044 
00045   // Additionally, fill the SiPixeRecHitQuality from the PixelCPE.
00046   theHitData.setRawQualityWord( cpe->rawQualityWord() );
00047   theClusterProbComputationFlag = cpe->clusterProbComputationFlag(); 
00048 
00049 }
00050 
00051 
00052 
00053 // Another private constructor.  It creates the TrackingRecHit internally, 
00054 // avoiding redundent cloning.
00055 TSiPixelRecHit::TSiPixelRecHit( const LocalPoint& pos, const LocalError& err,
00056                                 const GeomDet* det, 
00057                                 //                              const SiPixelCluster& clust,
00058                                 clusterRef clust,
00059                                 const PixelClusterParameterEstimator* cpe,
00060                                 float weight, float annealing) :
00061   TransientTrackingRecHit(det,weight, annealing), 
00062   theHitData( pos, err, det->geographicalId(), clust),
00063   theCPE(cpe)
00064 {
00065   // Additionally, fill the SiPixeRecHitQuality from the PixelCPE.
00066   theHitData.setRawQualityWord( cpe->rawQualityWord() );
00067   theClusterProbComputationFlag = cpe->clusterProbComputationFlag(); 
00068 }
00069 
00070 
00071 
00072 
00073 /*
00074 SiPixelRecHit( const LocalPoint&, const LocalError&,
00075                  const DetId&, 
00076                  const SiPixelCluster * cluster);  
00077 */