CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/RecoTracker/MeasurementDet/plugins/TkStripMeasurementDet.h

Go to the documentation of this file.
00001 #ifndef TkStripMeasurementDet_H
00002 #define TkStripMeasurementDet_H
00003 
00004 #include "TrackingTools/MeasurementDet/interface/MeasurementDet.h"
00005 #include "TkMeasurementDetSet.h"
00006 #include "RecoLocalTracker/ClusterParameterEstimator/interface/StripClusterParameterEstimator.h"
00007 #include "DataFormats/SiStripCluster/interface/SiStripClusterCollection.h"
00008 #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
00009 #include "DataFormats/Common/interface/DetSetVector.h"
00010 #include "DataFormats/Common/interface/DetSetVectorNew.h"
00011 #include "DataFormats/SiStripCluster/interface/SiStripCluster.h"
00012 #include "DataFormats/Common/interface/Handle.h"
00013 #include "CondFormats/SiStripObjects/interface/SiStripNoises.h"
00014 #include "CondFormats/SiStripObjects/interface/SiStripBadStrip.h"
00015 #include "DataFormats/Common/interface/RefGetter.h"
00016 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h"
00017 
00018 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00019 
00020 class TransientTrackingRecHit;
00021 
00022 class TkStripMeasurementDet : public MeasurementDet {
00023 public:
00024   
00025   typedef StripClusterParameterEstimator::LocalValues    LocalValues;
00026   typedef StripClusterParameterEstimator::VLocalValues    VLocalValues;
00027   
00028   typedef SiStripRecHit2D::ClusterRef SiStripClusterRef;
00029   
00030   typedef edm::LazyGetter<SiStripCluster>::value_ref  SiStripRegionalClusterRef;
00031   
00032   typedef edmNew::DetSet<SiStripCluster> detset;
00033   typedef detset::const_iterator new_const_iterator;
00034   
00035   typedef std::vector<SiStripCluster>::const_iterator const_iterator;
00036   
00037   virtual ~TkStripMeasurementDet(){}
00038   
00039   TkStripMeasurementDet( const GeomDet* gdet, StMeasurementDetSet & dets);
00040 
00041 
00042   void setIndex(int i) { index_=i;}
00043   
00044   void update( const detset &detSet ) { 
00045     theDets().update(index(),detSet);
00046   }
00047   void update( std::vector<SiStripCluster>::const_iterator begin ,std::vector<SiStripCluster>::const_iterator end ) { 
00048     theDets().update(index(), begin, end);
00049   }
00050   
00051   bool isRegional() const { return theDets().isRegional();}
00052   
00053   void setEmpty(){ theDets().setEmpty(index()); }
00054   
00055   bool  isEmpty() const {return theDets().empty(index());}
00056   
00057   int index() const { return index_;}
00058 
00059   unsigned int rawId() const { return theDets().id(index()); }
00060   unsigned char subId() const { return theDets().subId(index());}
00061   
00062   
00063   const detset & theSet() const {return theDets().detSet(index());}
00064   const detset & detSet() const {return theDets().detSet(index());}
00065   detset & detSet() { return theDets().detSet(index());}
00066   unsigned int beginClusterI() const {return theDets().beginClusterI(index());}
00067   unsigned int endClusterI() const {return theDets().endClusterI(index());}
00068   
00069   int  size() const {return endClusterI() - beginClusterI() ; }
00070   
00071   
00073   bool isActive() const { return theDets().isActive(index()); }
00074   
00075   //TO BE IMPLEMENTED
00076   bool hasBadComponents( const TrajectoryStateOnSurface &tsos ) const {return false;}
00077   
00078   
00079   
00080   virtual RecHitContainer recHits( const TrajectoryStateOnSurface&) const;
00081   void simpleRecHits( const TrajectoryStateOnSurface& ts, std::vector<SiStripRecHit2D> &result) const ;
00082   
00083   virtual std::vector<TrajectoryMeasurement> 
00084   fastMeasurements( const TrajectoryStateOnSurface& stateOnThisDet, 
00085                     const TrajectoryStateOnSurface& startingState, 
00086                     const Propagator&, 
00087                     const MeasurementEstimator&) const;
00088   
00089   const StripGeomDetUnit& specificGeomDet() const {return static_cast<StripGeomDetUnit const &>(fastGeomDet());}
00090   
00091   TransientTrackingRecHit::RecHitPointer
00092   buildRecHit( const SiStripClusterRef&, const TrajectoryStateOnSurface& ltp) const;
00093   
00094   TransientTrackingRecHit::RecHitPointer
00095   buildRecHit( const SiStripRegionalClusterRef&, const TrajectoryStateOnSurface& ltp) const;
00096   
00097   
00098   TkStripMeasurementDet::RecHitContainer 
00099   buildRecHits( const SiStripClusterRef&, const TrajectoryStateOnSurface& ltp) const;
00100   
00101   TkStripMeasurementDet::RecHitContainer 
00102   buildRecHits( const SiStripRegionalClusterRef&, const TrajectoryStateOnSurface& ltp) const;
00103   
00104   
00107   void setActive(bool active) { theDets().setActive(index(),active);}
00110   void setActiveThisEvent(bool active) {  theDets().setActiveThisEvent(index(),active); }
00111   
00113   bool hasAllGoodChannels() const { return (!hasAny128StripBad()) && badStripBlocks().empty(); }
00114   
00116   void set128StripStatus(bool good, int idx=-1) {
00117     theDets().set128StripStatus(index(),good,idx);
00118   }
00119   
00120   typedef StMeasurementDetSet::BadStripCuts BadStripCuts;
00121   
00123   bool testStrips(float utraj, float uerr) const;
00124   
00125   typedef StMeasurementDetSet::BadStripBlock BadStripBlock;
00126   
00127   std::vector<BadStripBlock> & getBadStripBlocks() { return theDets().getBadStripBlocks(index()); }
00128   std::vector<BadStripBlock> const & badStripBlocks() const { return theDets().badStripBlocks(index()); }
00129 
00130   bool maskBad128StripBlocks() const { return theDets().maskBad128StripBlocks();}
00131   
00132 
00133   
00134 private:
00135   
00136   StMeasurementDetSet  & theDets() { return *theDets_;}
00137   StMeasurementDetSet  & theDets() const { return *theDets_;}
00138   
00139   StMeasurementDetSet * theDets_;
00140   int index_;
00141   
00142 
00143 
00144   edm::Handle<edmNew::DetSetVector<SiStripCluster> > const & handle() const { return theDets().handle();}
00145   edm::Handle<edm::LazyGetter<SiStripCluster> > const & regionalHandle() const { return theDets().regionalHandle();}
00146   
00147   const StripClusterParameterEstimator* cpe() const { return  theDets().stripCPE(); }
00148   
00149   
00150   const std::vector<bool> & skipClusters() const {  return  theDets().clusterToSkip();}
00151   
00152   // --- regional unpacking
00153   
00154   int totalStrips() const { return theDets().totalStrips(index()); }
00155   BadStripCuts const & badStripCuts() const { return theDets().badStripCuts(index());}
00156   
00157   bool hasAny128StripBad() const { return  theDets().hasAny128StripBad(index()); } 
00158   
00159   
00160   
00161   
00162   inline bool isMasked(const SiStripCluster &cluster) const {
00163     return theDets().isMasked(index(), cluster);
00164   }
00165   
00166   template<class ClusterRefT>
00167   void buildSimpleRecHit( const ClusterRefT& cluster,
00168                           const TrajectoryStateOnSurface& ltp,
00169                           std::vector<SiStripRecHit2D>& res) const;
00170   
00171   
00172   
00173 public:
00174   inline bool accept(SiStripClusterRef & r) const {
00175     if(skipClusters().empty()) return true;
00176     if (r.key()>=skipClusters().size()){
00177       edm::LogError("WrongStripMasking")<<r.key()<<" is larger than: "<<skipClusters().size()<<" no skipping done";
00178       return true;
00179     }
00180     return (not (skipClusters()[r.key()]));
00181   }
00182   inline bool accept(SiStripRegionalClusterRef &r) const{
00183     if(skipClusters().empty()) return true;
00184     if (r.key()>=skipClusters().size()){
00185       LogDebug("TkStripMeasurementDet")<<r.key()<<" is larger than: "<<skipClusters().size()
00186                                        <<"\n This must be a new cluster, and therefore should not be skiped most likely.";
00187       return true;
00188     }
00189     return (not (skipClusters()[r.key()]));
00190   }
00191 
00192 };
00193 
00194 #endif