Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:27:35

0001 #ifndef TkPixelMeasurementDet_H
0002 #define TkPixelMeasurementDet_H
0003 
0004 #include "TrackingTools/MeasurementDet/interface/MeasurementDet.h"
0005 #include "RecoLocalTracker/ClusterParameterEstimator/interface/PixelClusterParameterEstimator.h"
0006 //#include "DataFormats/SiPixelCluster/interface/SiPixelClusterFwd.h"
0007 #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h"
0008 #include "DataFormats/Common/interface/Handle.h"
0009 #include "DataFormats/Common/interface/DetSetVector.h"
0010 #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h"
0011 #include "RecoTracker/MeasurementDet/interface/MeasurementTrackerEvent.h"
0012 #include "RecoTracker/MeasurementDet/src/TkMeasurementDetSet.h"
0013 
0014 class TrackingRecHit;
0015 class LocalTrajectoryParameters;
0016 
0017 class dso_hidden TkPixelMeasurementDet final : public MeasurementDet {
0018 public:
0019   typedef edm::Ref<edmNew::DetSetVector<SiPixelCluster>, SiPixelCluster> SiPixelClusterRef;
0020 
0021   typedef edmNew::DetSet<SiPixelCluster> detset;
0022   typedef detset::const_iterator const_iterator;
0023   typedef PixelClusterParameterEstimator::LocalValues LocalValues;
0024 
0025   TkPixelMeasurementDet(const GeomDet* gdet, PxMeasurementConditionSet& conditionSet);
0026 
0027   void update(PxMeasurementDetSet& data, const detset& detSet) {
0028     data.update(index(), detSet);
0029     data.setActiveThisEvent(index(), true);
0030   }
0031 
0032   void setEmpty(PxMeasurementDetSet& data) { data.setEmpty(index()); }
0033   bool isEmpty(const PxMeasurementDetSet& data) const { return data.empty(index()); }
0034 
0035   ~TkPixelMeasurementDet() override {}
0036 
0037   // all hits
0038   RecHitContainer recHits(const TrajectoryStateOnSurface&, const MeasurementTrackerEvent& dat) const override;
0039 
0040   // only hits compatible with tsos
0041   RecHitContainer compHits(const TrajectoryStateOnSurface&,
0042                            const MeasurementTrackerEvent& dat,
0043                            float xl,
0044                            float yl) const;
0045 
0046   // simple hits
0047   bool recHits(SimpleHitContainer& result,
0048                const TrajectoryStateOnSurface& stateOnThisDet,
0049                const MeasurementEstimator&,
0050                const MeasurementTrackerEvent& data) const override {
0051     assert("not implemented for Pixel yet" == nullptr);
0052   }
0053 
0054   bool measurements(const TrajectoryStateOnSurface& stateOnThisDet,
0055                     const MeasurementEstimator& est,
0056                     const MeasurementTrackerEvent& dat,
0057                     TempMeasurements& result) const override;
0058 
0059   const PixelGeomDetUnit& specificGeomDet() const { return static_cast<PixelGeomDetUnit const&>(fastGeomDet()); }
0060 
0061   TrackingRecHit::RecHitPointer buildRecHit(const SiPixelClusterRef& cluster,
0062                                             const LocalTrajectoryParameters& ltp) const;
0063 
0064   /** \brief Turn on/off the module for reconstruction, for the full run or lumi (using info from DB, usually). */
0065   void setActive(bool active) { conditionSet().setActive(index(), active); }
0066   /** \brief Turn on/off the module for reconstruction for one events.
0067              This per-event flag is cleared by any call to 'update' or 'setEmpty'  */
0068   void setActiveThisEvent(PxMeasurementDetSet& data, bool active) const { data.setActiveThisEvent(index(), active); }
0069   /** \brief Is this module active in reconstruction? It must be both 'setActiveThisEvent' and 'setActive'. */
0070   bool isActive(const MeasurementTrackerEvent& data) const override { return data.pixelData().isActive(index()); }
0071 
0072   bool hasBadComponents(const TrajectoryStateOnSurface& tsos, const MeasurementTrackerEvent& dat) const override;
0073 
0074   /** \brief Sets the list of bad ROCs, identified by the positions of their centers in the local coordinate frame*/
0075   void setBadRocPositions(std::vector<LocalPoint>& positions) { badRocPositions_.swap(positions); }
0076   /** \brief Clear the list of bad ROCs */
0077   void clearBadRocPositions() { badRocPositions_.clear(); }
0078 
0079   const PxMeasurementDetSet::BadFEDChannelPositions* getBadFEDChannelPositions(
0080       const MeasurementTrackerEvent& data) const {
0081     return data.pixelData().getBadFEDChannelPositions(index());
0082   }
0083 
0084   int index() const { return index_; }
0085   void setIndex(int i) { index_ = i; }
0086 
0087 private:
0088   unsigned int id_;
0089   std::vector<LocalPoint> badRocPositions_;
0090 
0091   int index_;
0092   PxMeasurementConditionSet* theDetConditions;
0093   PxMeasurementConditionSet& conditionSet() { return *theDetConditions; }
0094   const PxMeasurementConditionSet& conditionSet() const { return *theDetConditions; }
0095 
0096   const PixelClusterParameterEstimator* cpe() const { return conditionSet().pixelCPE(); }
0097 
0098 public:
0099   inline bool accept(SiPixelClusterRefNew& r, const std::vector<bool> skipClusters) const {
0100     if (skipClusters.empty())
0101       return true;
0102     if (r.key() >= skipClusters.size()) {
0103       edm::LogError("IndexMisMatch") << r.key() << " is larger than: " << skipClusters.size() << " no skipping done";
0104       return true;
0105     }
0106     return not skipClusters[r.key()];
0107   }
0108 };
0109 
0110 #endif