File indexing completed on 2024-04-06 12:05:19
0001 #ifndef DataFormats_TrackerRecHit2D_ClusterRemovalInfo_h
0002 #define DataFormats_TrackerRecHit2D_ClusterRemovalInfo_h
0003
0004 #include "DataFormats/Common/interface/RefProd.h"
0005 #include "DataFormats/Common/interface/Handle.h"
0006 #include "DataFormats/Common/interface/OrphanHandle.h"
0007 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h"
0008 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h"
0009 #include "DataFormats/TrackerRecHit2D/interface/Phase2TrackerRecHit1D.h"
0010
0011 namespace reco {
0012
0013 class ClusterRemovalInfo {
0014 public:
0015 typedef SiStripRecHit2D::ClusterRef::product_type SiStripClusters;
0016 typedef SiPixelRecHit::ClusterRef::product_type SiPixelClusters;
0017 typedef Phase2TrackerRecHit1D::ClusterRef::product_type Phase2TrackerCluster1Ds;
0018 typedef edm::RefProd<SiStripClusters> SiStripClusterRefProd;
0019 typedef edm::RefProd<SiPixelClusters> SiPixelClusterRefProd;
0020 typedef edm::RefProd<Phase2TrackerCluster1Ds> Phase2TrackerCluster1DRefProd;
0021
0022 typedef std::vector<uint32_t> Indices;
0023
0024 ClusterRemovalInfo() {}
0025
0026 ClusterRemovalInfo(const edm::Handle<SiPixelClusters> &pixelClusters,
0027 const edm::Handle<SiStripClusters> &stripClusters)
0028 : pixelProd_(pixelClusters), stripProd_(stripClusters), phase2OTProd_() {}
0029
0030 ClusterRemovalInfo(const edm::Handle<SiPixelClusters> &pixelClusters,
0031 const edm::Handle<Phase2TrackerCluster1Ds> &phase2OTClusters)
0032 : pixelProd_(pixelClusters), stripProd_(), phase2OTProd_(phase2OTClusters) {}
0033
0034 ClusterRemovalInfo(const edm::Handle<SiPixelClusters> &pixelClusters)
0035 : pixelProd_(pixelClusters), stripProd_(), phase2OTProd_() {}
0036
0037 ClusterRemovalInfo(const edm::Handle<SiStripClusters> &stripClusters)
0038 : pixelProd_(), stripProd_(stripClusters), phase2OTProd_() {}
0039
0040 ClusterRemovalInfo(const edm::Handle<Phase2TrackerCluster1Ds> &phase2OTClusters)
0041 : pixelProd_(), stripProd_(), phase2OTProd_(phase2OTClusters) {}
0042
0043 void getOldClustersFrom(const ClusterRemovalInfo &other) {
0044 stripProd_ = other.stripProd_;
0045 pixelProd_ = other.pixelProd_;
0046 phase2OTProd_ = other.phase2OTProd_;
0047 }
0048
0049 Indices &pixelIndices() { return pixelIndices_; }
0050 Indices &stripIndices() { return stripIndices_; }
0051 Indices &phase2OTIndices() { return phase2OTIndices_; }
0052
0053 const Indices &pixelIndices() const { return pixelIndices_; }
0054 const Indices &stripIndices() const { return stripIndices_; }
0055 const Indices &phase2OTIndices() const { return phase2OTIndices_; }
0056
0057 const SiPixelClusterRefProd &pixelRefProd() const { return pixelProd_; }
0058 const SiStripClusterRefProd &stripRefProd() const { return stripProd_; }
0059 const Phase2TrackerCluster1DRefProd &phase2OTRefProd() const { return phase2OTProd_; }
0060 const SiPixelClusterRefProd &pixelNewRefProd() const { return pixelNewProd_; }
0061 const SiStripClusterRefProd &stripNewRefProd() const { return stripNewProd_; }
0062 const Phase2TrackerCluster1DRefProd &phase2OTNewRefProd() const { return phase2OTNewProd_; }
0063
0064 void setNewPixelClusters(const edm::OrphanHandle<SiPixelClusters> &pixels) {
0065 pixelNewProd_ = SiPixelClusterRefProd(pixels);
0066 }
0067 void setNewStripClusters(const edm::OrphanHandle<SiStripClusters> &strips) {
0068 stripNewProd_ = SiStripClusterRefProd(strips);
0069 }
0070 void setNewPhase2OTClusters(const edm::OrphanHandle<Phase2TrackerCluster1Ds> &phase2OTs) {
0071 phase2OTNewProd_ = Phase2TrackerCluster1DRefProd(phase2OTs);
0072 }
0073
0074 bool hasPixel() const { return pixelProd_.isNonnull(); }
0075 bool hasStrip() const { return stripProd_.isNonnull(); }
0076 bool hasPhase2OT() const { return phase2OTProd_.isNonnull(); }
0077
0078 void swap(reco::ClusterRemovalInfo &other);
0079
0080 private:
0081 SiPixelClusterRefProd pixelProd_;
0082 SiStripClusterRefProd stripProd_;
0083 Phase2TrackerCluster1DRefProd phase2OTProd_;
0084 SiPixelClusterRefProd pixelNewProd_;
0085 SiStripClusterRefProd stripNewProd_;
0086 Phase2TrackerCluster1DRefProd phase2OTNewProd_;
0087 Indices stripIndices_, pixelIndices_, phase2OTIndices_;
0088 };
0089
0090 void swap(reco::ClusterRemovalInfo &cri1, reco::ClusterRemovalInfo &cri2);
0091
0092 }
0093
0094 #endif