CMS 3D CMS Logo

TkPixelMeasurementDet.cc

Go to the documentation of this file.
00001 #include "RecoTracker/MeasurementDet/interface/TkPixelMeasurementDet.h"
00002 #include "TrackingTools/TransientTrackingRecHit/interface/InvalidTransientRecHit.h"
00003 #include "Geometry/CommonTopologies/interface/PixelTopology.h"
00004 #include "TrackingTools/MeasurementDet/interface/MeasurementDetException.h"
00005 #include "TrackingTools/PatternTools/interface/TrajectoryMeasurement.h"
00006 #include "RecoTracker/TransientTrackingRecHit/interface/TSiPixelRecHit.h"
00007 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h"
00008 #include "TrackingTools/PatternTools/interface/MeasurementEstimator.h"
00009 #include "TrackingTools/PatternTools/interface/TrajMeasLessEstim.h"
00010 
00011 TkPixelMeasurementDet::TkPixelMeasurementDet( const GeomDet* gdet,
00012                                               const PixelClusterParameterEstimator* cpe) : 
00013     MeasurementDet (gdet),
00014     theCPE(cpe),
00015     empty(true),
00016     active_(true)
00017   {
00018     thePixelGDU = dynamic_cast<const PixelGeomDetUnit*>(gdet);
00019     if (thePixelGDU == 0) {
00020       throw MeasurementDetException( "TkPixelMeasurementDet constructed with a GeomDet which is not a PixelGeomDetUnit");
00021     }
00022   }
00023 
00024 std::vector<TrajectoryMeasurement> 
00025 TkPixelMeasurementDet::fastMeasurements( const TrajectoryStateOnSurface& stateOnThisDet, 
00026                                          const TrajectoryStateOnSurface& startingState, 
00027                                          const Propagator&, 
00028                                          const MeasurementEstimator& est) const
00029 {
00030   std::vector<TrajectoryMeasurement> result;
00031 
00032   if (active_ == false) {
00033     result.push_back( TrajectoryMeasurement( stateOnThisDet, 
00034                 InvalidTransientRecHit::build(&geomDet(), TrackingRecHit::inactive), 
00035                 0.F));
00036     return result;
00037   }
00038  
00039   MeasurementDet::RecHitContainer allHits = recHits( stateOnThisDet);
00040   for (RecHitContainer::const_iterator ihit=allHits.begin();
00041        ihit != allHits.end(); ihit++) {
00042     std::pair<bool,double> diffEst = est.estimate( stateOnThisDet, **ihit);
00043     if ( diffEst.first) {
00044       result.push_back( TrajectoryMeasurement( stateOnThisDet, *ihit, 
00045                                                diffEst.second));
00046     }
00047     //RC else delete *ihit; // we own allHits and have to delete the ones we don't return
00048   }
00049   if ( result.empty()) {
00050     // create a TrajectoryMeasurement with an invalid RecHit and zero estimate
00051     result.push_back( TrajectoryMeasurement( stateOnThisDet, 
00052                                              InvalidTransientRecHit::build(&geomDet()), 0.F)); 
00053   }
00054   else {
00055     // sort results according to estimator value
00056     if ( result.size() > 1) {
00057       sort( result.begin(), result.end(), TrajMeasLessEstim());
00058     }
00059   }
00060   return result;
00061 }
00062 
00063 TransientTrackingRecHit::RecHitPointer
00064 TkPixelMeasurementDet::buildRecHit( const SiPixelClusterRef & cluster,
00065                                     const LocalTrajectoryParameters & ltp) const
00066 {
00067   const GeomDetUnit& gdu( specificGeomDet());
00068   LocalValues lv = theCPE->localParameters( * cluster, gdu, ltp );
00069   return TSiPixelRecHit::build( lv.first, lv.second, &geomDet(), cluster, theCPE);
00070 }
00071 
00072 TkPixelMeasurementDet::RecHitContainer 
00073 TkPixelMeasurementDet::recHits( const TrajectoryStateOnSurface& ts ) const
00074 {
00075   RecHitContainer result;
00076   if (empty == true ) return result;
00077   if (active_ == false) return result; 
00078   for ( const_iterator ci = detSet_.begin(); ci != detSet_.end(); ++ ci ) {
00079     SiPixelClusterRef cluster = edmNew::makeRefTo( handle_, ci ); 
00080     result.push_back( buildRecHit( cluster, ts.localParameters() ) );
00081   }
00082   return result;
00083 }

Generated on Tue Jun 9 17:45:29 2009 for CMSSW by  doxygen 1.5.4