diff --git a/DQM/TrackingMonitor/interface/TrackBuildingAnalyzer.h b/DQM/TrackingMonitor/interface/TrackBuildingAnalyzer.h index 5a8447d840532..1892b64ab8d39 100644 --- a/DQM/TrackingMonitor/interface/TrackBuildingAnalyzer.h +++ b/DQM/TrackingMonitor/interface/TrackBuildingAnalyzer.h @@ -60,7 +60,7 @@ class TrackBuildingAnalyzer { const std::vector& mvaCollections, const std::vector& qualityMaskCollections); void analyze(const reco::CandidateView& regionCandidates); - void analyze(const edm::OwnVector& regions); + void analyze(const std::vector>& regions); void analyze(const TrackingRegionsSeedingLayerSets& regions); private: diff --git a/DQM/TrackingMonitor/interface/TrackingMonitor.h b/DQM/TrackingMonitor/interface/TrackingMonitor.h index 14d812c6d9db3..b96d3bcf524dd 100644 --- a/DQM/TrackingMonitor/interface/TrackingMonitor.h +++ b/DQM/TrackingMonitor/interface/TrackingMonitor.h @@ -13,6 +13,8 @@ Monitoring source for general quantities related to tracks. #include #include +#include + #include "FWCore/Utilities/interface/EDGetToken.h" #include "FWCore/Utilities/interface/ESGetToken.h" #include "FWCore/Framework/interface/Frameworkfwd.h" @@ -41,7 +43,6 @@ Monitoring source for general quantities related to tracks. #include "DataFormats/Scalers/interface/LumiScalers.h" #include "DataFormats/OnlineMetaData/interface/OnlineLuminosityRecord.h" -#include "DataFormats/Common/interface/OwnVector.h" #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h" #include "RecoTracker/TkTrackingRegions/interface/TrackingRegionsSeedingLayerSets.h" @@ -93,12 +94,12 @@ class TrackingMonitor : public DQMEDAnalyzer { edm::EDGetTokenT bsSrcToken_; edm::EDGetTokenT pvSrcToken_; - edm::EDGetTokenT > allTrackToken_; - edm::EDGetTokenT > trackToken_; + edm::EDGetTokenT> allTrackToken_; + edm::EDGetTokenT> trackToken_; edm::EDGetTokenT trackCandidateToken_; - edm::EDGetTokenT > seedToken_; - edm::EDGetTokenT > seedStopInfoToken_; - edm::EDGetTokenT > regionToken_; + edm::EDGetTokenT> seedToken_; + edm::EDGetTokenT> seedStopInfoToken_; + edm::EDGetTokenT>> regionToken_; edm::EDGetTokenT regionLayerSetsToken_; edm::EDGetTokenT regionCandidateToken_; @@ -107,11 +108,11 @@ class TrackingMonitor : public DQMEDAnalyzer { edm::InputTag stripClusterInputTag_; edm::InputTag pixelClusterInputTag_; - edm::EDGetTokenT > stripClustersToken_; - edm::EDGetTokenT > pixelClustersToken_; + edm::EDGetTokenT> stripClustersToken_; + edm::EDGetTokenT> pixelClustersToken_; - std::vector, edm::EDGetTokenT > > mvaQualityTokens_; - edm::EDGetTokenT > mvaTrackToken_; + std::vector, edm::EDGetTokenT>> mvaQualityTokens_; + edm::EDGetTokenT> mvaTrackToken_; edm::ESGetToken magneticFieldToken_; edm::ESGetToken transientTrackingRecHitBuilderToken_; diff --git a/DQM/TrackingMonitor/src/TrackBuildingAnalyzer.cc b/DQM/TrackingMonitor/src/TrackBuildingAnalyzer.cc index 6990ad599f74f..4f50428ceee51 100644 --- a/DQM/TrackingMonitor/src/TrackBuildingAnalyzer.cc +++ b/DQM/TrackingMonitor/src/TrackBuildingAnalyzer.cc @@ -104,7 +104,7 @@ void TrackBuildingAnalyzer::initHisto(DQMStore::IBooker& ibooker, const edm::Par edm::InputTag seedProducer = iConfig.getParameter("SeedProducer"); edm::InputTag tcProducer = iConfig.getParameter("TCProducer"); - std::vector mvaProducers = iConfig.getParameter >("MVAProducers"); + std::vector mvaProducers = iConfig.getParameter>("MVAProducers"); edm::InputTag regionProducer = iConfig.getParameter("RegionProducer"); // if (doAllPlots){doAllSeedPlots=true; doTCPlots=true;} @@ -715,11 +715,13 @@ void TrackBuildingAnalyzer::analyze(const reco::CandidateView& regionCandidates) } } -void TrackBuildingAnalyzer::analyze(const edm::OwnVector& regions) { analyzeRegions(regions); } +void TrackBuildingAnalyzer::analyze(const std::vector>& regions) { + analyzeRegions(regions); +} void TrackBuildingAnalyzer::analyze(const TrackingRegionsSeedingLayerSets& regions) { analyzeRegions(regions); } namespace { - const TrackingRegion* regionPtr(const TrackingRegion& region) { return ®ion; } + const TrackingRegion* regionPtr(const std::unique_ptr& region) { return region.get(); } const TrackingRegion* regionPtr(const TrackingRegionsSeedingLayerSets::RegionLayers& regionLayers) { return &(regionLayers.region()); } diff --git a/DQM/TrackingMonitor/src/TrackingMonitor.cc b/DQM/TrackingMonitor/src/TrackingMonitor.cc index d1f14a03303b2..1f6ccc10a78d0 100644 --- a/DQM/TrackingMonitor/src/TrackingMonitor.cc +++ b/DQM/TrackingMonitor/src/TrackingMonitor.cc @@ -151,7 +151,7 @@ TrackingMonitor::TrackingMonitor(const edm::ParameterSet& iConfig) if (doRegionPlots) { const auto& regionTag = iConfig.getParameter("RegionProducer"); if (!regionTag.label().empty()) { - regionToken_ = consumes >(regionTag); + regionToken_ = consumes(regionTag); } const auto& regionLayersTag = iConfig.getParameter("RegionSeedingLayersProducer"); if (!regionLayersTag.label().empty()) { @@ -993,8 +993,7 @@ void TrackingMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& i // plots for tracking regions if (doRegionPlots) { if (!regionToken_.isUninitialized()) { - edm::Handle > hregions = iEvent.getHandle(regionToken_); - const auto& regions = *hregions; + auto const& regions = iEvent.get(regionToken_); NumberOfTrackingRegions->Fill(regions.size()); theTrackBuildingAnalyzer->analyze(regions); diff --git a/FastSimulation/Tracking/plugins/TrajectorySeedProducer.cc b/FastSimulation/Tracking/plugins/TrajectorySeedProducer.cc index 98091eec00090..af5ff0910900f 100644 --- a/FastSimulation/Tracking/plugins/TrajectorySeedProducer.cc +++ b/FastSimulation/Tracking/plugins/TrajectorySeedProducer.cc @@ -61,7 +61,7 @@ class TrajectorySeedProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT recHitCombinationsToken; edm::EDGetTokenT> hitMasksToken; - edm::EDGetTokenT> trackingRegionToken; + edm::EDGetTokenT>> trackingRegionToken; const edm::ESGetToken trackerTopologyESToken_; // other data members @@ -128,7 +128,7 @@ TrajectorySeedProducer::TrajectorySeedProducer(const edm::ParameterSet& conf) : } /// regions - trackingRegionToken = consumes>(conf.getParameter("trackingRegions")); + trackingRegionToken = consumes(conf.getParameter("trackingRegions")); // seed creator const edm::ParameterSet& seedCreatorPSet = conf.getParameter("SeedCreatorPSet"); @@ -154,9 +154,7 @@ void TrajectorySeedProducer::produce(edm::Event& e, const edm::EventSetup& es) { std::unique_ptr output(new TrajectorySeedCollection()); // read the regions; - edm::Handle> hregions; - e.getByToken(trackingRegionToken, hregions); - const auto& regions = *hregions; + auto const& regions = e.get(trackingRegionToken); // and make sure there is at least one region if (regions.empty()) { e.put(std::move(output)); @@ -187,7 +185,7 @@ void TrajectorySeedProducer::produce(edm::Event& e, const edm::EventSetup& es) { for (const auto& region : regions) { // set the region used in the selector if (seedFinderSelector) { - seedFinderSelector->setTrackingRegion(®ion); + seedFinderSelector->setTrackingRegion(region.get()); } // find hits compatible with the seed requirements @@ -204,7 +202,7 @@ void TrajectorySeedProducer::produce(edm::Event& e, const edm::EventSetup& es) { fastTrackingUtilities::setRecHitCombinationIndex(seedHits, icomb); // create the seed - seedCreator->init(region, es, nullptr); + seedCreator->init(*region, es, nullptr); seedCreator->makeSeed(*output, SeedingHitSet(&seedHits[0], &seedHits[1], diff --git a/RecoTracker/FinalTrackSelectors/plugins/TrackSelectorByRegion.cc b/RecoTracker/FinalTrackSelectors/plugins/TrackSelectorByRegion.cc index f8541fc2c8333..a7c76c603afc9 100644 --- a/RecoTracker/FinalTrackSelectors/plugins/TrackSelectorByRegion.cc +++ b/RecoTracker/FinalTrackSelectors/plugins/TrackSelectorByRegion.cc @@ -8,7 +8,6 @@ #include "DataFormats/TrackReco/interface/TrackFwd.h" #include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/Common/interface/OwnVector.h" #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h" #include @@ -20,7 +19,7 @@ class TrackSelectorByRegion final : public edm::global::EDProducer<> { : produceCollection_(conf.getParameter("produceTrackCollection")), produceMask_(conf.getParameter("produceMask")), tracksToken_(consumes(conf.getParameter("tracks"))), - inputTrkRegionToken_(consumes>(conf.getParameter("regions"))), + inputTrkRegionToken_(consumes(conf.getParameter("regions"))), outputTracksToken_(produceCollection_ ? produces() : edm::EDPutTokenT{}), outputMaskToken_(produceMask_ ? produces>() : edm::EDPutTokenT>{}) {} @@ -46,7 +45,7 @@ class TrackSelectorByRegion final : public edm::global::EDProducer<> { MaskCollection mask(tracks.size(), false); // output mask for (auto const& region : regions) { - region.checkTracks(tracks, mask); + region->checkTracks(tracks, mask); } if (produceCollection_) { @@ -71,7 +70,7 @@ class TrackSelectorByRegion final : public edm::global::EDProducer<> { const bool produceCollection_; const bool produceMask_; const edm::EDGetTokenT tracksToken_; - const edm::EDGetTokenT> inputTrkRegionToken_; + const edm::EDGetTokenT>> inputTrkRegionToken_; const edm::EDPutTokenT outputTracksToken_; const edm::EDPutTokenT> outputMaskToken_; }; diff --git a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc index 4248ca8d44396..a779f77663c88 100644 --- a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc +++ b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc @@ -10,7 +10,6 @@ #include "FWCore/Utilities/interface/RunningAverage.h" #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h" -#include "DataFormats/Common/interface/OwnVector.h" #include "TrackingTools/TransientTrackingRecHit/interface/SeedingLayerSetsHits.h" #include "RecoTracker/TkTrackingRegions/interface/TrackingRegionsSeedingLayerSets.h" #include "RecoTracker/TkHitPairs/interface/LayerHitMapCache.h" @@ -18,6 +17,9 @@ #include "RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h" #include "RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h" +#include +#include + namespace { class ImplBase; } @@ -260,7 +262,7 @@ namespace { public: class const_iterator { public: - using internal_iterator_type = edm::OwnVector::const_iterator; + using internal_iterator_type = std::vector>::const_iterator; using value_type = RegionLayers; using difference_type = internal_iterator_type::difference_type; @@ -268,7 +270,7 @@ namespace { const std::vector* layerPairs) : iter_(iter), layerPairs_(layerPairs) {} - value_type operator*() const { return value_type(&(*iter_), layerPairs_); } + value_type operator*() const { return value_type(&(**iter_), layerPairs_); } const_iterator& operator++() { ++iter_; @@ -289,7 +291,7 @@ namespace { }; EventTmp(const SeedingLayerSetsHits* seedingLayerSetsHits, - const edm::OwnVector* regions, + const std::vector>* regions, const std::vector& layerPairBegins) : seedingLayerSetsHits_(seedingLayerSetsHits), regions_(regions) { // construct the pairs from the sets @@ -349,7 +351,7 @@ namespace { private: const SeedingLayerSetsHits* seedingLayerSetsHits_; - const edm::OwnVector* regions_; + const std::vector>* regions_; std::vector layerPairs; }; @@ -359,7 +361,7 @@ namespace { edm::ConsumesCollector iC) : layerPairBegins_(layerPairBegins), seedingLayerToken_(iC.consumes(seedingLayerTag)), - regionToken_(iC.consumes>(regionTag)) {} + regionToken_(iC.consumes(regionTag)) {} EventTmp beginEvent(const edm::Event& iEvent) const { edm::Handle hlayers; @@ -370,16 +372,14 @@ namespace { << "HitPairEDProducer expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= 2, got " << layers->numberOfLayersInSet() << ". This is likely caused by a configuration error of this module, or SeedingLayersEDProducer."; - edm::Handle> hregions; - iEvent.getByToken(regionToken_, hregions); - - return EventTmp(layers, hregions.product(), *layerPairBegins_); + auto const& regions = iEvent.get(regionToken_); + return EventTmp(layers, ®ions, *layerPairBegins_); } private: const std::vector* layerPairBegins_; edm::EDGetTokenT seedingLayerToken_; - edm::EDGetTokenT> regionToken_; + edm::EDGetTokenT>> regionToken_; }; ///// diff --git a/RecoTracker/TkTrackingRegions/interface/TrackingRegionEDProducerT.h b/RecoTracker/TkTrackingRegions/interface/TrackingRegionEDProducerT.h index 98d9cee821052..7ca20a82f3b94 100644 --- a/RecoTracker/TkTrackingRegions/interface/TrackingRegionEDProducerT.h +++ b/RecoTracker/TkTrackingRegions/interface/TrackingRegionEDProducerT.h @@ -4,21 +4,18 @@ #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/EDPutToken.h" #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h" -#include "DataFormats/Common/interface/OwnVector.h" + +#include +#include template class TrackingRegionEDProducerT : public edm::stream::EDProducer<> { public: - // using OwnVector as vector and vector cause problems - // I can't get dictionary compiled with unique_ptr - // shared_ptr fails with runtime error "Class name 'TrackingRegionstdshared_ptrs' contains an underscore ('_'), which is illegal in the name of a product." - using ProductType = edm::OwnVector; - - TrackingRegionEDProducerT(const edm::ParameterSet& iConfig) : regionProducer_(iConfig, consumesCollector()) { - produces(); - } + TrackingRegionEDProducerT(const edm::ParameterSet& iConfig) + : regionsPutToken_{produces()}, regionProducer_(iConfig, consumesCollector()) {} ~TrackingRegionEDProducerT() override = default; @@ -28,16 +25,11 @@ class TrackingRegionEDProducerT : public edm::stream::EDProducer<> { void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override { auto regions = regionProducer_.regions(iEvent, iSetup); - auto ret = std::make_unique(); - ret->reserve(regions.size()); - for (auto& regionPtr : regions) { - ret->push_back(regionPtr.release()); - } - - iEvent.put(std::move(ret)); + iEvent.emplace(regionsPutToken_, std::move(regions)); } private: + edm::EDPutTokenT>> regionsPutToken_; T_TrackingRegionProducer regionProducer_; }; diff --git a/RecoTracker/TkTrackingRegions/src/classes.h b/RecoTracker/TkTrackingRegions/src/classes.h index 2656fdc37dcde..22b7a846c9c55 100644 --- a/RecoTracker/TkTrackingRegions/src/classes.h +++ b/RecoTracker/TkTrackingRegions/src/classes.h @@ -1,13 +1,6 @@ #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h" #include "RecoTracker/TkTrackingRegions/interface/TrackingRegionsSeedingLayerSets.h" -#include "DataFormats/Common/interface/OwnVector.h" #include "DataFormats/Common/interface/Wrapper.h" -namespace RecoTracker_TkTrackingRegions { - struct dictionary { - edm::OwnVector ovtr; - edm::Wrapper > wovtr; - - edm::Wrapper wtrsls; - }; -} // namespace RecoTracker_TkTrackingRegions +#include +#include diff --git a/RecoTracker/TkTrackingRegions/src/classes_def.xml b/RecoTracker/TkTrackingRegions/src/classes_def.xml index 1e410182ad4bc..68014a2bede19 100644 --- a/RecoTracker/TkTrackingRegions/src/classes_def.xml +++ b/RecoTracker/TkTrackingRegions/src/classes_def.xml @@ -1,7 +1,7 @@ - - + +