00001 #ifndef DataFormats_TrackerRecHit2D_ClusterRemovalInfo_h 00002 #define DataFormats_TrackerRecHit2D_ClusterRemovalInfo_h 00003 00004 #include "DataFormats/Common/interface/RefProd.h" 00005 #include "DataFormats/Common/interface/Handle.h" 00006 #include "DataFormats/Common/interface/OrphanHandle.h" 00007 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h" 00008 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" 00009 00010 namespace reco { 00011 00012 class ClusterRemovalInfo { 00013 public: 00014 typedef SiStripRecHit2D::ClusterRef::product_type SiStripClusters; 00015 typedef SiPixelRecHit::ClusterRef::product_type SiPixelClusters; 00016 typedef edm::RefProd<SiStripClusters> SiStripClusterRefProd; 00017 typedef edm::RefProd<SiPixelClusters> SiPixelClusterRefProd; 00018 00019 typedef std::vector<uint32_t> Indices; 00020 00021 ClusterRemovalInfo() {} 00022 00023 ClusterRemovalInfo(const edm::Handle<SiPixelClusters> &pixelClusters, 00024 const edm::Handle<SiStripClusters> &stripClusters) : 00025 pixelProd_(pixelClusters), stripProd_(stripClusters) { } 00026 00027 ClusterRemovalInfo(const edm::Handle<SiPixelClusters> &pixelClusters) : 00028 pixelProd_(pixelClusters), stripProd_() { } 00029 00030 ClusterRemovalInfo(const edm::Handle<SiStripClusters> &stripClusters) : 00031 pixelProd_(), stripProd_(stripClusters) { } 00032 00033 00034 void getOldClustersFrom(const ClusterRemovalInfo &other) { 00035 stripProd_ = other.stripProd_; 00036 pixelProd_ = other.pixelProd_; 00037 } 00038 00039 Indices & pixelIndices() { return pixelIndices_; } 00040 Indices & stripIndices() { return stripIndices_; } 00041 00042 const Indices & pixelIndices() const { return pixelIndices_; } 00043 const Indices & stripIndices() const { return stripIndices_; } 00044 00045 const SiPixelClusterRefProd & pixelRefProd() const { return pixelProd_; } 00046 const SiStripClusterRefProd & stripRefProd() const { return stripProd_; } 00047 const SiPixelClusterRefProd & pixelNewRefProd() const { return pixelNewProd_; } 00048 const SiStripClusterRefProd & stripNewRefProd() const { return stripNewProd_; } 00049 00050 void setNewPixelClusters(const edm::OrphanHandle<SiPixelClusters> &pixels) { pixelNewProd_ = SiPixelClusterRefProd(pixels); } 00051 void setNewStripClusters(const edm::OrphanHandle<SiStripClusters> &strips) { stripNewProd_ = SiStripClusterRefProd(strips); } 00052 00053 bool hasPixel() const { return pixelProd_.isNonnull(); } 00054 bool hasStrip() const { return stripProd_.isNonnull(); } 00055 00056 void swap(reco::ClusterRemovalInfo &other) ; 00057 private: 00058 SiPixelClusterRefProd pixelProd_; 00059 SiStripClusterRefProd stripProd_; 00060 SiPixelClusterRefProd pixelNewProd_; 00061 SiStripClusterRefProd stripNewProd_; 00062 Indices stripIndices_, pixelIndices_; 00063 }; 00064 00065 void swap(reco::ClusterRemovalInfo &cri1, reco::ClusterRemovalInfo &cri2) ; 00066 00067 } 00068 00069 #endif