CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/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 "RecoLocalTracker/SiPixelRecHits/interface/PixelCPEBase.h"
00005 #include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
00006 
00007 
00008 TSiPixelRecHit::RecHitPointer TSiPixelRecHit::clone (const TrajectoryStateOnSurface& ts) const
00009 {
00010   if (theCPE == 0){
00011     return new TSiPixelRecHit( det(), &theHitData, 0, weight(), getAnnealingFactor(),false);
00012   }else{
00013     const SiPixelCluster& clust = *specificHit()->cluster();  
00014     PixelClusterParameterEstimator::LocalValues lv = 
00015       theCPE->localParameters( clust, *detUnit(), ts);
00016     return TSiPixelRecHit::build( lv.first, lv.second, det(), specificHit()->cluster(), theCPE, weight(), getAnnealingFactor());
00017   }
00018 }
00019 
00020 const GeomDetUnit* TSiPixelRecHit::detUnit() const
00021 {
00022   return static_cast<const GeomDetUnit*>(det());
00023 }
00024 
00025 
00026 
00027 // This private constructor copies the TrackingRecHit.  It should be used when the 
00028 // TrackingRecHit exist already in some collection.
00029 TSiPixelRecHit::TSiPixelRecHit(const GeomDet * geom, const SiPixelRecHit* rh, 
00030                                const PixelClusterParameterEstimator* cpe,
00031                                float weight, float annealing,
00032                                bool computeCoarseLocalPosition) : 
00033   TransientTrackingRecHit(geom, *rh, weight, annealing), theCPE(cpe) 
00034 {
00035   if (rh->hasPositionAndError() || !computeCoarseLocalPosition)
00036     theHitData = SiPixelRecHit(*rh);
00037   else{
00038     const GeomDetUnit* gdu = dynamic_cast<const GeomDetUnit*>(geom);
00039     if (gdu){
00040       PixelClusterParameterEstimator::LocalValues lval= theCPE->localParameters(*rh->cluster(), *gdu);
00041       LogDebug("TSiPixelRecHit")<<"calculating coarse position/error.";
00042       theHitData = SiPixelRecHit(lval.first, lval.second,geom->geographicalId(),rh->cluster());
00043     }else{
00044       edm::LogError("TSiPixelRecHit") << " geomdet does not cast into geomdet unit. cannot create pixel local parameters.";
00045       theHitData = SiPixelRecHit(*rh);
00046     }
00047   }
00048 
00049   // Additionally, fill the SiPixeRecHitQuality from the PixelCPE.
00050   const PixelCPEBase * cpeB = dynamic_cast< const PixelCPEBase* >( cpe );
00051   if (cpeB) {
00052     theHitData.setRawQualityWord( cpeB->rawQualityWord() );
00053     theClusterProbComputationFlag = cpeB->clusterProbComputationFlag(); 
00054   }
00055   // else {
00056     //  Huh?  We are using the obsolete CPEFromDetPosition???
00057     //  &&& Possibly complain in here.
00058 
00059     //  &&& In fact, a better long-term option is to simply move this interface
00060     //  &&&   into the ClusterParameterEstimator and make it a real interface
00061     //  &&&   class.
00062   //  }
00063 
00064 }
00065 
00066 
00067 
00068 // Another private constructor.  It creates the TrackingRecHit internally, 
00069 // avoiding redundent cloning.
00070 TSiPixelRecHit::TSiPixelRecHit( const LocalPoint& pos, const LocalError& err,
00071                                 const GeomDet* det, 
00072                                 //                              const SiPixelCluster& clust,
00073                                 clusterRef clust,
00074                                 const PixelClusterParameterEstimator* cpe,
00075                                 float weight, float annealing) :
00076   TransientTrackingRecHit(det,weight, annealing), 
00077   theHitData( pos, err, det->geographicalId(), clust),
00078   theCPE(cpe)
00079 {
00080   // Additionally, fill the SiPixeRecHitQuality from the PixelCPE.
00081   const PixelCPEBase * cpeB = dynamic_cast< const PixelCPEBase* >( cpe );
00082   if (cpeB) {
00083     theHitData.setRawQualityWord( cpeB->rawQualityWord() );
00084     theClusterProbComputationFlag = cpeB->clusterProbComputationFlag(); 
00085   }
00086   // else {
00087     //  Huh?  We are using the obsolete CPEFromDetPosition???
00088     //  &&& Possibly complain in here.
00089 
00090     //  &&& In fact, a better long-term option is to simply move this interface
00091     //  &&&   into the ClusterParameterEstimator and make it a real interface
00092     //  &&&   class.
00093   //  }
00094 }
00095 
00096 
00097 
00098 
00099 /*
00100 SiPixelRecHit( const LocalPoint&, const LocalError&,
00101                  const DetId&, 
00102                  const SiPixelCluster * cluster);  
00103 */