File indexing completed on 2024-04-06 12:28:12
0001 #include "RecoTracker/MeasurementDet/interface/MeasurementTrackerEvent.h"
0002 #include "RecoTracker/MeasurementDet/src/TkMeasurementDetSet.h"
0003
0004 MeasurementTrackerEvent::~MeasurementTrackerEvent() {
0005 if (theOwner) {
0006
0007 delete theStripData;
0008 theStripData = nullptr;
0009 delete thePixelData;
0010 thePixelData = nullptr;
0011 delete thePhase2OTData;
0012 thePhase2OTData = nullptr;
0013 }
0014 }
0015
0016 MeasurementTrackerEvent::MeasurementTrackerEvent(MeasurementTrackerEvent &&other) {
0017 theTracker = other.theTracker;
0018 theStripData = other.theStripData;
0019 thePixelData = other.thePixelData;
0020 thePhase2OTData = other.thePhase2OTData;
0021 thePhase2OTVectorHits = other.thePhase2OTVectorHits;
0022 thePhase2OTVectorHitsRej = other.thePhase2OTVectorHitsRej;
0023 theOwner = other.theOwner;
0024 other.theOwner = false;
0025 theStripClustersToSkip = std::move(other.theStripClustersToSkip);
0026 thePixelClustersToSkip = std::move(other.thePixelClustersToSkip);
0027 }
0028 MeasurementTrackerEvent &MeasurementTrackerEvent::operator=(MeasurementTrackerEvent &&other) {
0029 theTracker = other.theTracker;
0030 theStripData = other.theStripData;
0031 thePixelData = other.thePixelData;
0032 thePhase2OTData = other.thePhase2OTData;
0033 thePhase2OTVectorHits = other.thePhase2OTVectorHits;
0034 thePhase2OTVectorHitsRej = other.thePhase2OTVectorHitsRej;
0035 theOwner = other.theOwner;
0036 other.theOwner = false;
0037 theStripClustersToSkip = std::move(other.theStripClustersToSkip);
0038 thePixelClustersToSkip = std::move(other.thePixelClustersToSkip);
0039 return *this;
0040 }
0041
0042 MeasurementTrackerEvent::MeasurementTrackerEvent(
0043 const MeasurementTrackerEvent &trackerEvent,
0044 const edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > &stripClustersToSkip,
0045 const edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > &pixelClustersToSkip)
0046 : theTracker(trackerEvent.theTracker),
0047 theStripData(trackerEvent.theStripData),
0048 thePixelData(trackerEvent.thePixelData),
0049 thePhase2OTData(nullptr),
0050 thePhase2OTVectorHits(nullptr),
0051 thePhase2OTVectorHitsRej(nullptr),
0052 theOwner(false) {
0053
0054 if (stripClustersToSkip.refProd().id() != theStripData->handle().id()) {
0055 edm::LogError("ProductIdMismatch") << "The strip masking does not point to the strip collection of clusters: "
0056 << stripClustersToSkip.refProd().id() << "!=" << theStripData->handle().id();
0057 throw cms::Exception("Configuration")
0058 << "The strip masking does not point to the strip collection of clusters: "
0059 << stripClustersToSkip.refProd().id() << "!=" << theStripData->handle().id() << "\n";
0060 }
0061
0062 if (pixelClustersToSkip.refProd().id() != thePixelData->handle().id()) {
0063 edm::LogError("ProductIdMismatch") << "The pixel masking does not point to the proper collection of clusters: "
0064 << pixelClustersToSkip.refProd().id() << "!=" << thePixelData->handle().id();
0065 throw cms::Exception("Configuration")
0066 << "The pixel masking does not point to the proper collection of clusters: "
0067 << pixelClustersToSkip.refProd().id() << "!=" << thePixelData->handle().id() << "\n";
0068 }
0069
0070 theStripClustersToSkip.resize(stripClustersToSkip.size());
0071 stripClustersToSkip.copyMaskTo(theStripClustersToSkip);
0072
0073 thePixelClustersToSkip.resize(pixelClustersToSkip.size());
0074 pixelClustersToSkip.copyMaskTo(thePixelClustersToSkip);
0075 }
0076
0077
0078 MeasurementTrackerEvent::MeasurementTrackerEvent(
0079 const MeasurementTrackerEvent &trackerEvent,
0080 const edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > &pixelClustersToSkip,
0081 const edm::ContainerMask<edmNew::DetSetVector<Phase2TrackerCluster1D> > &phase2OTClustersToSkip)
0082 : theTracker(trackerEvent.theTracker),
0083 theStripData(nullptr),
0084 thePixelData(trackerEvent.thePixelData),
0085 thePhase2OTData(trackerEvent.thePhase2OTData),
0086 thePhase2OTVectorHits(trackerEvent.thePhase2OTVectorHits),
0087 thePhase2OTVectorHitsRej(trackerEvent.thePhase2OTVectorHitsRej),
0088 theOwner(false) {
0089 if (pixelClustersToSkip.refProd().id() != thePixelData->handle().id()) {
0090 edm::LogError("ProductIdMismatch") << "The pixel masking does not point to the proper collection of clusters: "
0091 << pixelClustersToSkip.refProd().id() << "!=" << thePixelData->handle().id();
0092 throw cms::Exception("Configuration")
0093 << "The pixel masking does not point to the proper collection of clusters: "
0094 << pixelClustersToSkip.refProd().id() << "!=" << thePixelData->handle().id() << "\n";
0095 }
0096
0097 if (phase2OTClustersToSkip.refProd().id() != thePhase2OTData->handle().id()) {
0098 edm::LogError("ProductIdMismatch") << "The pixel masking does not point to the proper collection of clusters: "
0099 << pixelClustersToSkip.refProd().id() << "!=" << thePixelData->handle().id();
0100 throw cms::Exception("Configuration")
0101 << "The pixel masking does not point to the proper collection of clusters: "
0102 << pixelClustersToSkip.refProd().id() << "!=" << thePixelData->handle().id() << "\n";
0103 }
0104
0105 thePixelClustersToSkip.resize(pixelClustersToSkip.size());
0106 pixelClustersToSkip.copyMaskTo(thePixelClustersToSkip);
0107
0108 thePhase2OTClustersToSkip.resize(phase2OTClustersToSkip.size());
0109 phase2OTClustersToSkip.copyMaskTo(thePhase2OTClustersToSkip);
0110 }