diff --git a/Configuration/PyReleaseValidation/python/relval_standard.py b/Configuration/PyReleaseValidation/python/relval_standard.py index 1c70eed0547a1..5d1d659ad8df9 100644 --- a/Configuration/PyReleaseValidation/python/relval_standard.py +++ b/Configuration/PyReleaseValidation/python/relval_standard.py @@ -132,7 +132,6 @@ workflows[140.5611] = ['RunHI2018reMINIAOD',['RunHI2018AOD','REMINIAODHID18','HARVESTHI18MINIAOD']] workflows[140.57] = ['RunHI2018Reduced',['RunHI2018Reduced','RECOHID18','HARVESTDHI18']] workflows[140.58] = ['',['RunHI2018','RAWPRIMEHI18','RECOHID18APPROXCLUSTERS','HARVESTDHI18']] -workflows[140.60] = ['',['RunHI2022','RECOHID22APPROXCLUSTERS','HARVESTDHI22']] workflows[140.61] = ['',['RunHI2022FullFormat','RECOHID22','HARVESTDHI22']] ### run2 2015B 50ns ### diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index 654b97e6fca78..c9ffc41e63ee2 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -2192,27 +2192,6 @@ def lhegensim2018ml(fragment,howMuch): '-n':'100' } -steps['RAWPRIMEHI22']={ '--scenario':'pp', - '--conditions':'auto:run3_data_prompt', - '-s':'REPACK:DigiToApproxClusterRaw', - '--datatier':'GEN-SIM-DIGI-RAW-HLTDEBUG', - '--eventcontent':'REPACKRAW', - '--era':'Run3_pp_on_PbPb_approxSiStripClusters', - '-n':'10', - '--customise_commands':'\"process.hltSiStripRawToDigi.ProductLabel=\'rawDataCollector\';process.hltScalersRawToDigi.scalersInputTag=\'rawDataCollector\'\"', - '--process':'REHLT' -} - -steps['RECOHID22APPROXCLUSTERS']=merge([{ '--scenario':'pp', - '--conditions':'auto:run3_data_prompt', - '-s':'RAW2DIGI,L1Reco,RECO,DQM:@commonFakeHLT+@standardDQMFakeHLT', - '--datatier':'AOD,DQMIO', - '--eventcontent':'AOD,DQM', - '--era':'Run3_pp_on_PbPb_approxSiStripClusters', - '--repacked':'', - '-n':'100' - },steps['RECOHID15']]) - steps['RECOHID22']=merge([{ '--scenario':'pp', '--conditions':'auto:run3_data_prompt', '-s':'RAW2DIGI,L1Reco,RECO,DQM:@commonFakeHLT+@standardDQMFakeHLT', diff --git a/DQM/SiStripMonitorApproximateCluster/plugins/SiStripMonitorApproximateCluster.cc b/DQM/SiStripMonitorApproximateCluster/plugins/SiStripMonitorApproximateCluster.cc index 7c0c8d5167c12..b497c4513c806 100644 --- a/DQM/SiStripMonitorApproximateCluster/plugins/SiStripMonitorApproximateCluster.cc +++ b/DQM/SiStripMonitorApproximateCluster/plugins/SiStripMonitorApproximateCluster.cc @@ -21,6 +21,7 @@ #include "DQMServices/Core/interface/MonitorElement.h" #include "DataFormats/Common/interface/DetSet.h" #include "DataFormats/Common/interface/DetSetVectorNew.h" +#include "DataFormats/SiStripCluster/interface/SiStripApproximateClusterCollection.h" #include "DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h" #include "DataFormats/SiStripCluster/interface/SiStripCluster.h" #include "FWCore/Framework/interface/Event.h" @@ -102,7 +103,7 @@ class SiStripMonitorApproximateCluster : public DQMEDAnalyzer { MonitorElement* h_deltaEndStrip_{nullptr}; // Event Data - edm::EDGetTokenT> approxClustersToken_; + edm::EDGetTokenT approxClustersToken_; edm::EDGetTokenT> stripClustersToken_; const edmNew::DetSetVector* stripClusterCollection_; @@ -117,7 +118,7 @@ SiStripMonitorApproximateCluster::SiStripMonitorApproximateCluster(const edm::Pa : folder_(iConfig.getParameter("folder")), compareClusters_(iConfig.getParameter("compareClusters")), // Poducer name of input StripClusterCollection - approxClustersToken_(consumes>( + approxClustersToken_(consumes( iConfig.getParameter("ApproxClustersProducer"))) { tkGeomToken_ = esConsumes(); if (compareClusters_) { @@ -139,7 +140,7 @@ void SiStripMonitorApproximateCluster::analyze(const edm::Event& iEvent, const e const auto tkDets = tkGeom->dets(); // get collection of DetSetVector of clusters from Event - edm::Handle> approx_cluster_detsetvector; + edm::Handle approx_cluster_detsetvector; iEvent.getByToken(approxClustersToken_, approx_cluster_detsetvector); if (!approx_cluster_detsetvector.isValid()) { edm::LogError("SiStripMonitorApproximateCluster") @@ -164,11 +165,11 @@ void SiStripMonitorApproximateCluster::analyze(const edm::Event& iEvent, const e } int nApproxClusters{0}; - const edmNew::DetSetVector* clusterCollection = approx_cluster_detsetvector.product(); + const SiStripApproximateClusterCollection* clusterCollection = approx_cluster_detsetvector.product(); for (const auto& detClusters : *clusterCollection) { edmNew::DetSet strip_clusters_detset; - const auto& detid = detClusters.detId(); // get the detid of the current detset + const auto& detid = detClusters.id(); // get the detid of the current detset // starts here comaparison with regular clusters if (compareClusters_) { @@ -233,6 +234,7 @@ void SiStripMonitorApproximateCluster::analyze(const edm::Event& iEvent, const e } // loop on clusters in a detset } // loop on the detset vector + h_nclusters_->Fill(nApproxClusters); } diff --git a/DataFormats/SiStripCluster/interface/SiStripApproximateClusterCollection.h b/DataFormats/SiStripCluster/interface/SiStripApproximateClusterCollection.h new file mode 100644 index 0000000000000..a582b25a4eab1 --- /dev/null +++ b/DataFormats/SiStripCluster/interface/SiStripApproximateClusterCollection.h @@ -0,0 +1,107 @@ +#ifndef DataFormats_SiStripCluster_SiStripApproximateClusterCollection_h +#define DataFormats_SiStripCluster_SiStripApproximateClusterCollection_h + +#include + +#include "DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h" + +/** + * This class provides a minimal interface that resembles + * edmNew::DetSetVector, but is crafted such that we are comfortable + * to provide an infinite backwards compatibility guarantee for it + * (like all RAW data). Any modifications need to be made with care. + * Please consult core software group if in doubt. +**/ +class SiStripApproximateClusterCollection { +public: + // Helper classes to make creation and iteration easier + class Filler { + public: + void push_back(SiStripApproximateCluster const& cluster) { clusters_.push_back(cluster); } + + private: + friend SiStripApproximateClusterCollection; + Filler(std::vector& clusters) : clusters_(clusters) {} + + std::vector& clusters_; + }; + + class const_iterator; + class DetSet { + public: + using const_iterator = std::vector::const_iterator; + + unsigned int id() const { return coll_->detIds_[detIndex_]; } + + const_iterator begin() const { return coll_->clusters_.begin() + clusBegin_; } + const_iterator cbegin() const { return begin(); } + const_iterator end() const { return coll_->clusters_.begin() + clusEnd_; } + const_iterator cend() const { return end(); } + + private: + friend SiStripApproximateClusterCollection::const_iterator; + DetSet(SiStripApproximateClusterCollection const* coll, unsigned int detIndex) + : coll_(coll), + detIndex_(detIndex), + clusBegin_(coll_->beginIndices_[detIndex]), + clusEnd_(detIndex == coll_->beginIndices_.size() - 1 ? coll->clusters_.size() + : coll_->beginIndices_[detIndex + 1]) {} + + SiStripApproximateClusterCollection const* const coll_; + unsigned int const detIndex_; + unsigned int const clusBegin_; + unsigned int const clusEnd_; + }; + + class const_iterator { + public: + DetSet operator*() const { return DetSet(coll_, index_); } + + const_iterator& operator++() { + ++index_; + if (index_ == coll_->detIds_.size()) { + *this = const_iterator(); + } + return *this; + } + + const_iterator operator++(int) { + const_iterator clone = *this; + ++(*this); + return clone; + } + + bool operator==(const_iterator const& other) const { return coll_ == other.coll_ and index_ == other.index_; } + bool operator!=(const_iterator const& other) const { return not operator==(other); } + + private: + friend SiStripApproximateClusterCollection; + // default-constructed object acts as the sentinel + const_iterator() = default; + const_iterator(SiStripApproximateClusterCollection const* coll) : coll_(coll) {} + + SiStripApproximateClusterCollection const* coll_ = nullptr; + unsigned int index_ = 0; + }; + + // Actual public interface + SiStripApproximateClusterCollection() = default; + + void reserve(std::size_t dets, std::size_t clusters); + Filler beginDet(unsigned int detId); + + const_iterator begin() const { return const_iterator(this); } + const_iterator cbegin() const { return begin(); } + const_iterator end() const { return const_iterator(); } + const_iterator cend() const { return end(); } + +private: + // The detIds_ and beginIndices_ have one element for each Det. An + // element of beginIndices_ points to the first cluster of the Det + // in clusters_. + std::vector detIds_; // DetId for the Det + std::vector beginIndices_; + std::vector clusters_; +}; + +#endif diff --git a/DataFormats/SiStripCluster/src/SiStripApproximateClusterCollection.cc b/DataFormats/SiStripCluster/src/SiStripApproximateClusterCollection.cc new file mode 100644 index 0000000000000..6723971dc428e --- /dev/null +++ b/DataFormats/SiStripCluster/src/SiStripApproximateClusterCollection.cc @@ -0,0 +1,13 @@ +#include "DataFormats/SiStripCluster/interface/SiStripApproximateClusterCollection.h" + +void SiStripApproximateClusterCollection::reserve(std::size_t dets, std::size_t clusters) { + detIds_.reserve(dets); + beginIndices_.reserve(dets); + clusters_.reserve(clusters); +} + +SiStripApproximateClusterCollection::Filler SiStripApproximateClusterCollection::beginDet(unsigned int detId) { + detIds_.push_back(detId); + beginIndices_.push_back(clusters_.size()); + return Filler(clusters_); +} diff --git a/DataFormats/SiStripCluster/src/classes.h b/DataFormats/SiStripCluster/src/classes.h index 00819e76d08a4..94eafdf2ecac7 100644 --- a/DataFormats/SiStripCluster/src/classes.h +++ b/DataFormats/SiStripCluster/src/classes.h @@ -7,6 +7,7 @@ #include "DataFormats/SiStripCluster/interface/SiStripCluster.h" #include "DataFormats/SiStripCluster/interface/SiStripClustersSOA.h" #include "DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h" +#include "DataFormats/SiStripCluster/interface/SiStripApproximateClusterCollection.h" #include "DataFormats/Common/interface/ContainerMask.h" #endif // SISTRIPCLUSTER_CLASSES_H diff --git a/DataFormats/SiStripCluster/src/classes_def.xml b/DataFormats/SiStripCluster/src/classes_def.xml index 3efcd26a23881..fa475a9e1ae50 100755 --- a/DataFormats/SiStripCluster/src/classes_def.xml +++ b/DataFormats/SiStripCluster/src/classes_def.xml @@ -31,6 +31,10 @@ + + + + diff --git a/RecoLocalTracker/SiStripClusterizer/plugins/SiStripApprox2Clusters.cc b/RecoLocalTracker/SiStripClusterizer/plugins/SiStripApprox2Clusters.cc index 3dc01b9311077..803c8949f90c6 100644 --- a/RecoLocalTracker/SiStripClusterizer/plugins/SiStripApprox2Clusters.cc +++ b/RecoLocalTracker/SiStripClusterizer/plugins/SiStripApprox2Clusters.cc @@ -1,6 +1,6 @@ -#include "DataFormats/Common/interface/DetSetVector.h" #include "DataFormats/Common/interface/DetSetVectorNew.h" #include "DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h" +#include "DataFormats/SiStripCluster/interface/SiStripApproximateClusterCollection.h" #include "DataFormats/SiStripCluster/interface/SiStripCluster.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/Frameworkfwd.h" @@ -25,13 +25,12 @@ class SiStripApprox2Clusters : public edm::global::EDProducer<> { static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - edm::EDGetTokenT> clusterToken_; + edm::EDGetTokenT clusterToken_; edm::ESGetToken tkGeomToken_; }; SiStripApprox2Clusters::SiStripApprox2Clusters(const edm::ParameterSet& conf) { - clusterToken_ = consumes>( - conf.getParameter("inputApproxClusters")); + clusterToken_ = consumes(conf.getParameter("inputApproxClusters")); tkGeomToken_ = esConsumes(); produces>(); } diff --git a/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusters2ApproxClusters.cc b/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusters2ApproxClusters.cc index fd9a784fcb5a8..e50b5886686cb 100644 --- a/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusters2ApproxClusters.cc +++ b/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusters2ApproxClusters.cc @@ -9,10 +9,11 @@ #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "DataFormats/GeometryVector/interface/LocalPoint.h" #include "DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h" +#include "DataFormats/SiStripCluster/interface/SiStripApproximateClusterCollection.h" #include "DataFormats/SiStripCluster/interface/SiStripCluster.h" +#include "DataFormats/SiStripCommon/interface/ConstantsForHardwareSystems.h" #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/TrackReco/interface/TrackBase.h" -#include "DataFormats/SiStripCommon/interface/ConstantsForHardwareSystems.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/stream/EDProducer.h" @@ -83,13 +84,13 @@ SiStripClusters2ApproxClusters::SiStripClusters2ApproxClusters(const edm::Parame csfToken_ = esConsumes(edm::ESInputTag("", csfLabel_)); stripNoiseToken_ = esConsumes(); - - produces >(); + produces(); } void SiStripClusters2ApproxClusters::produce(edm::Event& event, edm::EventSetup const& iSetup) { - auto result = std::make_unique >(); const auto& clusterCollection = event.get(clusterToken); + auto result = std::make_unique(); + result->reserve(clusterCollection.size(), clusterCollection.dataSize()); auto const beamSpotHandle = event.getHandle(beamSpotToken_); auto const& bs = beamSpotHandle.isValid() ? *beamSpotHandle : reco::BeamSpot(); @@ -103,7 +104,7 @@ void SiStripClusters2ApproxClusters::produce(edm::Event& event, edm::EventSetup const auto& theNoise_ = &iSetup.getData(stripNoiseToken_); for (const auto& detClusters : clusterCollection) { - edmNew::DetSetVector::FastFiller ff{*result, detClusters.id()}; + auto ff = result->beginDet(detClusters.id()); unsigned int detId = detClusters.id(); const GeomDet* det = tkGeom->idToDet(detId);