CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_6/src/RecoTracker/MeasurementDet/plugins/TkPixelMeasurementDet.h

Go to the documentation of this file.
00001 #ifndef TkPixelMeasurementDet_H
00002 #define TkPixelMeasurementDet_H
00003 
00004 #include "TrackingTools/MeasurementDet/interface/MeasurementDet.h"
00005 #include "RecoLocalTracker/ClusterParameterEstimator/interface/PixelClusterParameterEstimator.h"
00006 //#include "DataFormats/SiPixelCluster/interface/SiPixelClusterFwd.h"
00007 #include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h"
00008 #include "DataFormats/Common/interface/Handle.h"
00009 #include "DataFormats/Common/interface/DetSetVector.h"
00010 #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h"
00011 
00012 class TransientTrackingRecHit;
00013 class LocalTrajectoryParameters;
00014 
00015 class TkPixelMeasurementDet : public MeasurementDet {
00016 public:
00017 
00018   typedef edm::Ref<edmNew::DetSetVector<SiPixelCluster>, SiPixelCluster> SiPixelClusterRef;
00019   
00020   typedef edmNew::DetSet<SiPixelCluster> detset;
00021   typedef detset::const_iterator const_iterator;
00022   typedef PixelClusterParameterEstimator::LocalValues    LocalValues;
00023 
00024   TkPixelMeasurementDet( const GeomDet* gdet,
00025                          const PixelClusterParameterEstimator* cpe);
00026 
00027   void update( const detset & detSet, 
00028                const edm::Handle<edmNew::DetSetVector<SiPixelCluster> > & h,
00029                unsigned int id ) { 
00030     detSet_ = detSet; 
00031     handle_ = h;
00032     id_ = id;
00033     empty = false;
00034     activeThisEvent_ = true;
00035   }
00036 
00037   void setEmpty(){empty = true; activeThisEvent_ = true; }
00038 
00039   virtual ~TkPixelMeasurementDet() { }
00040 
00041   virtual RecHitContainer recHits( const TrajectoryStateOnSurface& ) const;
00042 
00043   virtual std::vector<TrajectoryMeasurement> 
00044   fastMeasurements( const TrajectoryStateOnSurface& stateOnThisDet, 
00045                     const TrajectoryStateOnSurface& startingState, 
00046                     const Propagator&, 
00047                     const MeasurementEstimator&) const;
00048 
00049   const PixelGeomDetUnit& specificGeomDet() const {return static_cast<PixelGeomDetUnit const &>(fastGeomDet());}
00050 
00051   TransientTrackingRecHit::RecHitPointer 
00052   buildRecHit( const SiPixelClusterRef & cluster,
00053                const LocalTrajectoryParameters & ltp) const;
00054 
00057   void setActive(bool active) { activeThisPeriod_ = active; activeThisEvent_ = true; if (!active) empty = true; }
00060   void setActiveThisEvent(bool active) { activeThisEvent_ = active;  if (!active) empty = true; }
00062   bool isActive() const { return activeThisEvent_ && activeThisPeriod_; }
00063 
00064   bool hasBadComponents( const TrajectoryStateOnSurface &tsos ) const ; 
00065 
00067   void setBadRocPositions(std::vector< LocalPoint > & positions) { badRocPositions_.swap(positions); }
00069   void clearBadRocPositions() { badRocPositions_.clear(); }
00070 private:
00071 
00072   const PixelClusterParameterEstimator* theCPE;
00073   edm::Handle<edmNew::DetSetVector<SiPixelCluster> > handle_;
00074   detset detSet_;
00075   std::vector< LocalPoint > badRocPositions_;
00076   const std::vector<bool>* skipClusters_;
00077   unsigned int id_;
00078   bool empty;
00079   bool activeThisEvent_, activeThisPeriod_;
00080   
00081  public:
00082 
00083   inline bool accept(SiPixelClusterRefNew & r) const {
00084     
00085     if(0==skipClusters_ || skipClusters_->empty()) return true;
00086     if (r.key()>=skipClusters_->size()){
00087       edm::LogError("IndexMisMatch")<<r.key()<<" is larger than: "<<skipClusters_->size()<<" no skipping done";
00088       return true;
00089     }
00090     return not (*skipClusters_)[r.key()];
00091   }
00092 
00093   void setClusterToSkip(const std::vector<bool>*skip ){
00094      skipClusters_ = skip;
00095   }
00096 };
00097 
00098 #endif