From e13def53a492d1d9dbca549d6e0ad94d482cb002 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 26 Apr 2016 16:08:57 +0200 Subject: [PATCH 01/69] Add TrackingRegionEDProducerT, and instantiate it with GlobalTrackingRegionFromBeamSpotEDProducer Point is to store TrackingRegions to edm::Event and read them from there. --- RecoTracker/TkTrackingRegions/BuildFile.xml | 1 + .../interface/TrackingRegionEDProducerT.h | 45 +++++++++++++++++++ ...GlobalTrackingRegionProducerFromBeamSpot.h | 40 +++++++++++++++++ .../TkTrackingRegions/plugins/SealModule.cc | 3 ++ RecoTracker/TkTrackingRegions/src/classes.h | 10 +++++ .../TkTrackingRegions/src/classes_def.xml | 5 +++ 6 files changed, 104 insertions(+) create mode 100644 RecoTracker/TkTrackingRegions/interface/TrackingRegionEDProducerT.h create mode 100644 RecoTracker/TkTrackingRegions/src/classes.h create mode 100644 RecoTracker/TkTrackingRegions/src/classes_def.xml diff --git a/RecoTracker/TkTrackingRegions/BuildFile.xml b/RecoTracker/TkTrackingRegions/BuildFile.xml index 93b209f4c16a0..1ce49d49f34e5 100644 --- a/RecoTracker/TkTrackingRegions/BuildFile.xml +++ b/RecoTracker/TkTrackingRegions/BuildFile.xml @@ -1,5 +1,6 @@ + diff --git a/RecoTracker/TkTrackingRegions/interface/TrackingRegionEDProducerT.h b/RecoTracker/TkTrackingRegions/interface/TrackingRegionEDProducerT.h new file mode 100644 index 0000000000000..5d71e9ef264aa --- /dev/null +++ b/RecoTracker/TkTrackingRegions/interface/TrackingRegionEDProducerT.h @@ -0,0 +1,45 @@ +#ifndef RecoTracker_TkTrackingRegions_TrackingRegionEDProducerT_H +#define RecoTracker_TkTrackingRegions_TrackingRegionEDProducerT_H + +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h" +#include "DataFormats/Common/interface/OwnVector.h" + +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() = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + T_TrackingRegionProducer::fillDescriptions(descriptions); + } + + virtual 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)); + } + +private: + T_TrackingRegionProducer regionProducer_; +}; + +#endif diff --git a/RecoTracker/TkTrackingRegions/plugins/GlobalTrackingRegionProducerFromBeamSpot.h b/RecoTracker/TkTrackingRegions/plugins/GlobalTrackingRegionProducerFromBeamSpot.h index 1fbd231c070ea..22fd77512a279 100644 --- a/RecoTracker/TkTrackingRegions/plugins/GlobalTrackingRegionProducerFromBeamSpot.h +++ b/RecoTracker/TkTrackingRegions/plugins/GlobalTrackingRegionProducerFromBeamSpot.h @@ -4,6 +4,8 @@ #include "RecoTracker/TkTrackingRegions/interface/TrackingRegionProducer.h" #include "RecoTracker/TkTrackingRegions/interface/GlobalTrackingRegion.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "DataFormats/BeamSpot/interface/BeamSpot.h" #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Utilities/interface/Exception.h" @@ -36,6 +38,44 @@ class GlobalTrackingRegionProducerFromBeamSpot : public TrackingRegionProducer { virtual ~GlobalTrackingRegionProducerFromBeamSpot(){} + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + { + edm::ParameterSetDescription desc; + + desc.add("precise", true); + desc.add("useMultipleScattering", false); + desc.add("nSigmaZ", 4.0); + desc.add("originHalfLength", 0.0); // this is the default in constructor + desc.add("originRadius", 0.2); + desc.add("ptMin", 0.9); + desc.add("beamSpot", edm::InputTag("offlineBeamSpot")); + + // Only for backwards-compatibility + edm::ParameterSetDescription descRegion; + descRegion.add("RegionPSet", desc); + + descriptions.add("globalTrackingRegionFromBeamSpot", descRegion); + } + + { + edm::ParameterSetDescription desc; + + desc.add("precise", true); + desc.add("useMultipleScattering", false); + desc.add("nSigmaZ", 0.0); // this is the default in constructor + desc.add("originHalfLength", 21.2); + desc.add("originRadius", 0.2); + desc.add("ptMin", 0.9); + desc.add("beamSpot", edm::InputTag("offlineBeamSpot")); + + // Only for backwards-compatibility + edm::ParameterSetDescription descRegion; + descRegion.add("RegionPSet", desc); + + descriptions.add("globalTrackingRegionFromBeamSpotFixedZ", descRegion); + } + } + virtual std::vector > regions(const edm::Event&ev, const edm::EventSetup&) const override { std::vector > result; edm::Handle bsHandle; diff --git a/RecoTracker/TkTrackingRegions/plugins/SealModule.cc b/RecoTracker/TkTrackingRegions/plugins/SealModule.cc index 5ad4b2cbf4c48..ed63c89552e5f 100644 --- a/RecoTracker/TkTrackingRegions/plugins/SealModule.cc +++ b/RecoTracker/TkTrackingRegions/plugins/SealModule.cc @@ -16,3 +16,6 @@ DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, GlobalTrackingRegionWithVertice DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, PointSeededTrackingRegionsProducer, "PointSeededTrackingRegionsProducer"); +#include "RecoTracker/TkTrackingRegions/interface/TrackingRegionEDProducerT.h" +using GlobalTrackinRegionFromBeamSpotEDProducer = TrackingRegionEDProducerT; +DEFINE_FWK_MODULE(GlobalTrackinRegionFromBeamSpotEDProducer); diff --git a/RecoTracker/TkTrackingRegions/src/classes.h b/RecoTracker/TkTrackingRegions/src/classes.h new file mode 100644 index 0000000000000..ffc069a394bfa --- /dev/null +++ b/RecoTracker/TkTrackingRegions/src/classes.h @@ -0,0 +1,10 @@ +#include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h" +#include "DataFormats/Common/interface/OwnVector.h" +#include "DataFormats/Common/interface/Wrapper.h" + +namespace RecoTracker_TkTrackingRegions { + struct dictionary { + edm::OwnVector ovtr; + edm::Wrapper > wovtr; + }; +} diff --git a/RecoTracker/TkTrackingRegions/src/classes_def.xml b/RecoTracker/TkTrackingRegions/src/classes_def.xml new file mode 100644 index 0000000000000..111a5944d4064 --- /dev/null +++ b/RecoTracker/TkTrackingRegions/src/classes_def.xml @@ -0,0 +1,5 @@ + + + + + From af0a6746438c2497a2fffa75f88f1c15f77bcea1 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 28 Apr 2016 10:59:06 +0200 Subject: [PATCH 02/69] Remove Event from TrackingRegion::hits() parameters Nobody uses it, and having it makes the inference of code more difficult. --- .../src/PixelTripletLowPtGenerator.cc | 2 +- .../plugins/PixelQuadrupletGenerator.cc | 2 +- .../plugins/PixelTripletHLTGenerator.cc | 2 +- .../plugins/PixelTripletLargeTipGenerator.cc | 2 +- .../plugins/PixelTripletNoTipGenerator.cc | 2 +- ...airGeneratorFromLayerPairForPhotonConversion.cc | 4 ++-- ...letGeneratorFromLayerPairForPhotonConversion.cc | 4 ++-- .../interface/CosmicTrackingRegion.h | 3 --- .../src/BeamHaloPairGenerator.cc | 4 ++-- .../src/CosmicTrackingRegion.cc | 14 +++++--------- .../src/GenericPairGenerator.cc | 4 ++-- .../src/GenericTripletGenerator.cc | 6 +++--- .../src/SimpleCosmicBONSeeder.cc | 6 +++--- .../TkHitPairs/interface/LayerHitMapCache.h | 4 ++-- .../src/HitPairGeneratorFromLayerPair.cc | 8 ++++---- .../plugins/MultiHitGeneratorFromChi2.cc | 2 +- .../interface/GlobalTrackingRegion.h | 1 - .../interface/RectangularEtaPhiTrackingRegion.h | 1 - .../TkTrackingRegions/interface/TrackingRegion.h | 4 +--- .../TkTrackingRegions/src/GlobalTrackingRegion.cc | 1 - .../src/RectangularEtaPhiTrackingRegion.cc | 1 - 21 files changed, 32 insertions(+), 45 deletions(-) diff --git a/RecoPixelVertexing/PixelLowPtUtilities/src/PixelTripletLowPtGenerator.cc b/RecoPixelVertexing/PixelLowPtUtilities/src/PixelTripletLowPtGenerator.cc index 2fce717685787..fd033abf05c37 100644 --- a/RecoPixelVertexing/PixelLowPtUtilities/src/PixelTripletLowPtGenerator.cc +++ b/RecoPixelVertexing/PixelLowPtUtilities/src/PixelTripletLowPtGenerator.cc @@ -100,7 +100,7 @@ void PixelTripletLowPtGenerator::hitTriplets( // Set aliases const RecHitsSortedInPhi **thirdHitMap = new const RecHitsSortedInPhi*[size]; for(int il=0; il & pred = preds[il]; diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.cc b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.cc index 6c022e82465ad..0565f6d689775 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.cc @@ -71,7 +71,7 @@ void PixelTripletHLTGenerator::hitTriplets(const TrackingRegion& region, vector thirdLayerDetLayer(size,0); for (int il=0; il thirdLayerDetLayer(size,0); for (int il=0; ilinnerLayer(pairLayers).detLayer(); diff --git a/RecoTracker/ConversionSeedGenerators/plugins/HitPairGeneratorFromLayerPairForPhotonConversion.cc b/RecoTracker/ConversionSeedGenerators/plugins/HitPairGeneratorFromLayerPairForPhotonConversion.cc index 84906fdf66f41..6f6d2dea0623a 100644 --- a/RecoTracker/ConversionSeedGenerators/plugins/HitPairGeneratorFromLayerPairForPhotonConversion.cc +++ b/RecoTracker/ConversionSeedGenerators/plugins/HitPairGeneratorFromLayerPairForPhotonConversion.cc @@ -72,10 +72,10 @@ void HitPairGeneratorFromLayerPairForPhotonConversion::hitPairs(const Conversion if(!checkBoundaries(*outerLayerObj.detLayer(),convRegion,50.,60.)) return; //FIXME, the maxSearchR(Z) are not optimized /*get hit sorted in phi for each layer: NB: doesn't apply any region cut*/ - const RecHitsSortedInPhi & innerHitsMap = theLayerCache(innerLayerObj, region, event, es); + const RecHitsSortedInPhi & innerHitsMap = theLayerCache(innerLayerObj, region, es); if (innerHitsMap.empty()) return; - const RecHitsSortedInPhi& outerHitsMap = theLayerCache(outerLayerObj, region, event, es); + const RecHitsSortedInPhi& outerHitsMap = theLayerCache(outerLayerObj, region, es); if (outerHitsMap.empty()) return; /*----------------*/ diff --git a/RecoTracker/ConversionSeedGenerators/plugins/HitQuadrupletGeneratorFromLayerPairForPhotonConversion.cc b/RecoTracker/ConversionSeedGenerators/plugins/HitQuadrupletGeneratorFromLayerPairForPhotonConversion.cc index b947234d08b7e..b841a18349951 100644 --- a/RecoTracker/ConversionSeedGenerators/plugins/HitQuadrupletGeneratorFromLayerPairForPhotonConversion.cc +++ b/RecoTracker/ConversionSeedGenerators/plugins/HitQuadrupletGeneratorFromLayerPairForPhotonConversion.cc @@ -63,10 +63,10 @@ void HitQuadrupletGeneratorFromLayerPairForPhotonConversion::hitPairs(const Trac #endif /*get hit sorted in phi for each layer: NB: doesn't apply any region cut*/ - const RecHitsSortedInPhi & innerHitsMap = theLayerCache(innerLayerObj, region, event, es); + const RecHitsSortedInPhi & innerHitsMap = theLayerCache(innerLayerObj, region, es); if (innerHitsMap.empty()) return; - const RecHitsSortedInPhi& outerHitsMap = theLayerCache(outerLayerObj, region, event, es); + const RecHitsSortedInPhi& outerHitsMap = theLayerCache(outerLayerObj, region, es); if (outerHitsMap.empty()) return; /*----------------*/ diff --git a/RecoTracker/SpecialSeedGenerators/interface/CosmicTrackingRegion.h b/RecoTracker/SpecialSeedGenerators/interface/CosmicTrackingRegion.h index fc2d55f71cb0d..bdb19bfcd5933 100644 --- a/RecoTracker/SpecialSeedGenerators/interface/CosmicTrackingRegion.h +++ b/RecoTracker/SpecialSeedGenerators/interface/CosmicTrackingRegion.h @@ -84,13 +84,11 @@ class CosmicTrackingRegion : public TrackingRegionBase { virtual TrackingRegion::ctfHits hits( - const edm::Event& ev, const edm::EventSetup& es, const ctfseeding::SeedingLayer* layer) const; TrackingRegion::Hits hits( - const edm::Event& ev, const edm::EventSetup& es, const SeedingLayerSetsHits::SeedingLayer& layer) const override; @@ -108,7 +106,6 @@ class CosmicTrackingRegion : public TrackingRegionBase { private: template void hits_( - const edm::Event& ev, const edm::EventSetup& es, const T& layer, TrackingRegion::Hits & result) const; diff --git a/RecoTracker/SpecialSeedGenerators/src/BeamHaloPairGenerator.cc b/RecoTracker/SpecialSeedGenerators/src/BeamHaloPairGenerator.cc index d111a7eb029c6..ba496d01b48b5 100644 --- a/RecoTracker/SpecialSeedGenerators/src/BeamHaloPairGenerator.cc +++ b/RecoTracker/SpecialSeedGenerators/src/BeamHaloPairGenerator.cc @@ -26,8 +26,8 @@ const OrderedSeedingHits& BeamHaloPairGenerator::run(const TrackingRegion& regio if(layers.numberOfLayersInSet() != 2) throw cms::Exception("CtfSpecialSeedGenerator") << "You are using " << layers.numberOfLayersInSet() <<" layers in set instead of 2 "; for(SeedingLayerSetsHits::SeedingLayerSet ls: layers) { - auto innerHits = region.hits(e, es, ls[0]); - auto outerHits = region.hits(e, es, ls[1]); + auto innerHits = region.hits(es, ls[0]); + auto outerHits = region.hits(es, ls[1]); for (auto iOuterHit = outerHits.begin(); iOuterHit != outerHits.end(); iOuterHit++){ for (auto iInnerHit = innerHits.begin(); iInnerHit != innerHits.end(); iInnerHit++){ diff --git a/RecoTracker/SpecialSeedGenerators/src/CosmicTrackingRegion.cc b/RecoTracker/SpecialSeedGenerators/src/CosmicTrackingRegion.cc index 4a5f9053dc6ac..8bf94c5f57818 100644 --- a/RecoTracker/SpecialSeedGenerators/src/CosmicTrackingRegion.cc +++ b/RecoTracker/SpecialSeedGenerators/src/CosmicTrackingRegion.cc @@ -23,31 +23,27 @@ using namespace std; using namespace ctfseeding; -TrackingRegion::ctfHits CosmicTrackingRegion::hits(const edm::Event& ev, - const edm::EventSetup& es, +TrackingRegion::ctfHits CosmicTrackingRegion::hits(const edm::EventSetup& es, const ctfseeding::SeedingLayer* layer) const { TrackingRegion::ctfHits result; TrackingRegion::Hits tmp; - hits_(ev, es, *layer, tmp); + hits_(es, *layer, tmp); result.reserve(tmp.size()); for ( auto h : tmp) result.emplace_back(*h); // not owned return result; } -TrackingRegion::Hits CosmicTrackingRegion::hits(const edm::Event& ev, - const edm::EventSetup& es, +TrackingRegion::Hits CosmicTrackingRegion::hits(const edm::EventSetup& es, const SeedingLayerSetsHits::SeedingLayer& layer) const { TrackingRegion::Hits result; - hits_(ev, es, layer, result); + hits_(es, layer, result); return result; } template -void CosmicTrackingRegion::hits_( - const edm::Event& ev, - const edm::EventSetup& es, +void CosmicTrackingRegion::hits_(const edm::EventSetup& es, const T& layer, TrackingRegion::Hits & result) const { diff --git a/RecoTracker/SpecialSeedGenerators/src/GenericPairGenerator.cc b/RecoTracker/SpecialSeedGenerators/src/GenericPairGenerator.cc index f56daa059cf6e..5f362c68f2885 100644 --- a/RecoTracker/SpecialSeedGenerators/src/GenericPairGenerator.cc +++ b/RecoTracker/SpecialSeedGenerators/src/GenericPairGenerator.cc @@ -26,8 +26,8 @@ const OrderedSeedingHits& GenericPairGenerator::run(const TrackingRegion& region throw cms::Exception("CtfSpecialSeedGenerator") << "You are using " << layers.numberOfLayersInSet() <<" layers in set instead of 2 "; for(SeedingLayerSetsHits::SeedingLayerSet ls: layers) { - auto innerHits = region.hits(e, es, ls[0]); - auto outerHits = region.hits(e, es, ls[1]); + auto innerHits = region.hits(es, ls[0]); + auto outerHits = region.hits(es, ls[1]); for (auto iOuterHit = outerHits.begin(); iOuterHit != outerHits.end(); iOuterHit++){ for (auto iInnerHit = innerHits.begin(); iInnerHit != innerHits.end(); iInnerHit++){ hitPairs.push_back(OrderedHitPair(&(**iInnerHit), diff --git a/RecoTracker/SpecialSeedGenerators/src/GenericTripletGenerator.cc b/RecoTracker/SpecialSeedGenerators/src/GenericTripletGenerator.cc index f4fa17133930d..c0c84d2d5f6ae 100644 --- a/RecoTracker/SpecialSeedGenerators/src/GenericTripletGenerator.cc +++ b/RecoTracker/SpecialSeedGenerators/src/GenericTripletGenerator.cc @@ -27,11 +27,11 @@ const OrderedSeedingHits& GenericTripletGenerator::run(const TrackingRegion& reg throw cms::Exception("CtfSpecialSeedGenerator") << "You are using " << layers.numberOfLayersInSet() <<" layers in set instead of 3 "; std::map radius_triplet_map; for(SeedingLayerSetsHits::SeedingLayerSet ls: layers) { - auto innerHits = region.hits(e, es, ls[0]); + auto innerHits = region.hits(es, ls[0]); //std::cout << "innerHits.size()=" << innerHits.size() << std::endl; - auto middleHits = region.hits(e, es, ls[1]); + auto middleHits = region.hits(es, ls[1]); //std::cout << "middleHits.size()=" << middleHits.size() << std::endl; - auto outerHits = region.hits(e, es, ls[2]); + auto outerHits = region.hits(es, ls[2]); //std::cout << "outerHits.size()=" << outerHits.size() << std::endl; //std::cout << "trying " << innerHits.size()*middleHits.size()*outerHits.size() << " combinations "< 0) { std::cout << "GenericTripletGenerator iLss = " << seedingLayersToString(ls) diff --git a/RecoTracker/TkHitPairs/interface/LayerHitMapCache.h b/RecoTracker/TkHitPairs/interface/LayerHitMapCache.h index 2960ceebc7c38..26f48f0df701c 100644 --- a/RecoTracker/TkHitPairs/interface/LayerHitMapCache.h +++ b/RecoTracker/TkHitPairs/interface/LayerHitMapCache.h @@ -47,12 +47,12 @@ class LayerHitMapCache { const RecHitsSortedInPhi & operator()(const SeedingLayerSetsHits::SeedingLayer& layer, const TrackingRegion & region, - const edm::Event & iEvent, const edm::EventSetup & iSetup) { + const edm::EventSetup & iSetup) { int key = layer.index(); assert (key>=0); const RecHitsSortedInPhi * lhm = theCache.get(key); if (lhm==nullptr) { - lhm=new RecHitsSortedInPhi (region.hits(iEvent,iSetup,layer), region.origin(), layer.detLayer()); + lhm=new RecHitsSortedInPhi (region.hits(iSetup,layer), region.origin(), layer.detLayer()); lhm->theOrigin = region.origin(); LogDebug("LayerHitMapCache")<<" I got"<< lhm->all().second-lhm->all().first<<" hits in the cache for: "< thirdLayerDetLayer(size,0); for (int il=0; il Date: Thu, 28 Apr 2016 09:28:52 +0200 Subject: [PATCH 03/69] Add HitPairEDProducer and IntermediateHitDoublets Produces hit pairs directly to edm::Event, either as a form of vector for SeedCreator, or as IntermediateHitDoublets for triplet generation. --- RecoTracker/TkHitPairs/BuildFile.xml | 1 + .../interface/HitPairGeneratorFromLayerPair.h | 20 +- .../interface/IntermediateHitDoublets.h | 171 ++++++++++++++++++ .../TkHitPairs/interface/LayerHitMapCache.h | 2 + .../TkHitPairs/plugins/HitPairEDProducer.cc | 127 +++++++++++++ .../src/HitPairGeneratorFromLayerPair.cc | 38 +--- .../TkHitPairs/src/IntermediateHitDoublets.cc | 7 + RecoTracker/TkHitPairs/src/classes.h | 11 ++ RecoTracker/TkHitPairs/src/classes_def.xml | 4 + RecoTracker/TkSeedingLayers/BuildFile.xml | 1 + RecoTracker/TkSeedingLayers/src/classes.h | 11 ++ .../TkSeedingLayers/src/classes_def.xml | 4 + 12 files changed, 361 insertions(+), 36 deletions(-) create mode 100644 RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h create mode 100644 RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc create mode 100644 RecoTracker/TkHitPairs/src/IntermediateHitDoublets.cc create mode 100644 RecoTracker/TkHitPairs/src/classes.h create mode 100644 RecoTracker/TkHitPairs/src/classes_def.xml create mode 100644 RecoTracker/TkSeedingLayers/src/classes.h create mode 100644 RecoTracker/TkSeedingLayers/src/classes_def.xml diff --git a/RecoTracker/TkHitPairs/BuildFile.xml b/RecoTracker/TkHitPairs/BuildFile.xml index cf123072ae3d9..e00b6120f8d4d 100644 --- a/RecoTracker/TkHitPairs/BuildFile.xml +++ b/RecoTracker/TkHitPairs/BuildFile.xml @@ -2,6 +2,7 @@ + diff --git a/RecoTracker/TkHitPairs/interface/HitPairGeneratorFromLayerPair.h b/RecoTracker/TkHitPairs/interface/HitPairGeneratorFromLayerPair.h index 7025d2e91c4d6..7cbb9089b31ff 100644 --- a/RecoTracker/TkHitPairs/interface/HitPairGeneratorFromLayerPair.h +++ b/RecoTracker/TkHitPairs/interface/HitPairGeneratorFromLayerPair.h @@ -24,9 +24,23 @@ class HitPairGeneratorFromLayerPair { ~HitPairGeneratorFromLayerPair(); HitDoublets doublets( const TrackingRegion& reg, - const edm::Event & ev, const edm::EventSetup& es, Layers layers); + const edm::Event & ev, const edm::EventSetup& es, Layers layers) { + assert(theLayerCache); + return doublets(reg, ev, es, layers, *theLayerCache); + } HitDoublets doublets( const TrackingRegion& reg, - const edm::Event & ev, const edm::EventSetup& es, const Layer& innerLayer, const Layer& outerLayer); + const edm::Event & ev, const edm::EventSetup& es, const Layer& innerLayer, const Layer& outerLayer) { + assert(theLayerCache); + return doublets(reg, ev, es, innerLayer, outerLayer, *theLayerCache); + } + HitDoublets doublets( const TrackingRegion& reg, + const edm::Event & ev, const edm::EventSetup& es, Layers layers, LayerCacheType& layerCache) { + Layer innerLayerObj = innerLayer(layers); + Layer outerLayerObj = outerLayer(layers); + return doublets(reg, ev, es, innerLayerObj, outerLayerObj, layerCache); + } + HitDoublets doublets( const TrackingRegion& reg, + const edm::Event & ev, const edm::EventSetup& es, const Layer& innerLayer, const Layer& outerLayer, LayerCacheType& layerCache); void hitPairs( const TrackingRegion& reg, OrderedHitPairs & prs, const edm::Event & ev, const edm::EventSetup& es, Layers layers); @@ -46,7 +60,7 @@ class HitPairGeneratorFromLayerPair { Layer outerLayer(const Layers& layers) const { return layers[theOuterLayer]; } private: - LayerCacheType & theLayerCache; + LayerCacheType *theLayerCache; const unsigned int theOuterLayer; const unsigned int theInnerLayer; const unsigned int theMaxElement; diff --git a/RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h b/RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h new file mode 100644 index 0000000000000..239c0b3ba07b7 --- /dev/null +++ b/RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h @@ -0,0 +1,171 @@ +#ifndef RecoTracker_TkHitPairs_IntermediateHitDoublets_h +#define RecoTracker_TkHitPairs_IntermediateHitDoublets_h + +#include "RecoTracker/TkHitPairs/interface/LayerHitMapCache.h" +#include "TrackingTools/TransientTrackingRecHit/interface/SeedingLayerSetsHits.h" + +namespace ihd { + class RegionIndex { + public: + RegionIndex(const TrackingRegion *reg, unsigned int ind): + region_(reg), + layerSetBeginIndex_(ind), + layerSetEndIndex_(ind) + {} + + void setLayerSetsEnd(unsigned int end) { layerSetEndIndex_ = end; } + + const TrackingRegion& region() const { return *region_; } + unsigned int layerSetBeginIndex() const { return layerSetBeginIndex_; } + unsigned int layerSetEndIndex() const { return layerSetEndIndex_; } + + private: + const TrackingRegion *region_; + unsigned int layerSetBeginIndex_; /// index to doublets_, pointing to the beginning of the layer pairs of this region + unsigned int layerSetEndIndex_; /// index to doublets_, pointing to the end of the layer pairs of this region + }; + + template + class RegionLayerHits { + public: + using const_iterator = typename std::vector::const_iterator; + + RegionLayerHits(const TrackingRegion* region, const_iterator begin, const_iterator end): + region_(region), layerSetsBegin_(begin), layerSetsEnd_(end) {} + + const TrackingRegion& region() const { return *region_; } + + const_iterator begin() const { return layerSetsBegin_; } + const_iterator cbegin() const { return begin(); } + const_iterator end() const { return layerSetsEnd_; } + const_iterator cend() const { return end(); } + + private: + const TrackingRegion *region_; + const const_iterator layerSetsBegin_; + const const_iterator layerSetsEnd_; + }; + + template + class const_iterator { + public: + using internal_iterator_type = typename std::vector::const_iterator; + using value_type = ValueType; + using difference_type = internal_iterator_type::difference_type; + + const_iterator(const HitSetType *hst, internal_iterator_type iter): hitSets_(hst), iter_(iter) {} + + value_type operator*() const { + return value_type(&(iter_->region()), + hitSets_->layerSetsBegin() + iter_->layerSetBeginIndex(), + hitSets_->layerSetsBegin() + iter_->layerSetEndIndex()); + } + + const_iterator& operator++() { ++iter_; return *this; } + const_iterator operator++(int) { + const_iterator clone(*this); + ++iter_; + return clone; + } + + bool operator==(const const_iterator& other) const { return iter_ == other.iter_; } + bool operator!=(const const_iterator& other) const { return !operator==(other); } + + private: + const HitSetType *hitSets_; + internal_iterator_type iter_; + }; +} + +/** + * Simple container of temporary information delivered from hit pair + * generator to hit triplet generator via edm::Event. + */ +class IntermediateHitDoublets { +public: + using LayerPair = std::tuple; + using RegionIndex = ihd::RegionIndex; + + class LayerPairHitDoublets { + public: + LayerPairHitDoublets(const SeedingLayerSetsHits::SeedingLayerSet& layerSet, HitDoublets&& doublets, LayerHitMapCache&& cache): + layerPair_(layerSet[0].index(), layerSet[1].index()), + doublets_(std::move(doublets)), + cache_(std::move(cache)) + {} + + SeedingLayerSetsHits::LayerIndex innerLayerIndex() const { return std::get<0>(layerPair_); } + SeedingLayerSetsHits::LayerIndex outerLayerIndex() const { return std::get<1>(layerPair_); } + + const HitDoublets& doublets() const { return doublets_; } + const LayerHitMapCache& cache() const { return cache_; } + + private: + LayerPair layerPair_; + HitDoublets doublets_; + LayerHitMapCache cache_; + }; + + //////////////////// + + using RegionLayerHits = ihd::RegionLayerHits; + + //////////////////// + + using const_iterator = ihd::const_iterator; + + //////////////////// + + IntermediateHitDoublets(): seedingLayers_(nullptr) {} + explicit IntermediateHitDoublets(const SeedingLayerSetsHits *seedingLayers): seedingLayers_(seedingLayers) {} + IntermediateHitDoublets(const IntermediateHitDoublets& rh); // only to make ROOT dictionary generation happy + ~IntermediateHitDoublets() = default; + + void swap(IntermediateHitDoublets& rh) { + std::swap(seedingLayers_, rh.seedingLayers_); + std::swap(regions_, rh.regions_); + std::swap(layerPairs_, rh.layerPairs_); + } + + void reserve(size_t nregions, size_t nlayersets) { + regions_.reserve(nregions); + layerPairs_.reserve(nregions*nlayersets); + } + + void shrink_to_fit() { + regions_.shrink_to_fit(); + layerPairs_.shrink_to_fit(); + } + + void beginRegion(const TrackingRegion *region) { + regions_.emplace_back(region, layerPairs_.size()); + } + + void addDoublets(const SeedingLayerSetsHits::SeedingLayerSet& layerSet, HitDoublets&& doublets, LayerHitMapCache&& cache) { + layerPairs_.emplace_back(layerSet, std::move(doublets), std::move(cache)); + regions_.back().setLayerSetsEnd(layerPairs_.size()); + } + + const SeedingLayerSetsHits& seedingLayerHits() const { return *seedingLayers_; } + size_t regionSize() const { return regions_.size(); } + size_t layerPairsSize() const { return layerPairs_.size(); } + + const_iterator begin() const { return const_iterator(this, regions_.begin()); } + const_iterator cbegin() const { return begin(); } + const_iterator end() const { return const_iterator(this, regions_.end()); } + const_iterator cend() const { return end(); } + + // used internally + std::vector::const_iterator regionsBegin() const { return regions_.begin(); } + std::vector::const_iterator regionsEnd() const { return regions_.end(); } + std::vector::const_iterator layerSetsBegin() const { return layerPairs_.begin(); } + std::vector::const_iterator layerSetsEnd() const { return layerPairs_.end(); } + +private: + const SeedingLayerSetsHits *seedingLayers_; + + std::vector regions_; + std::vector layerPairs_; +}; + +#endif diff --git a/RecoTracker/TkHitPairs/interface/LayerHitMapCache.h b/RecoTracker/TkHitPairs/interface/LayerHitMapCache.h index 26f48f0df701c..55bcccd9e8ad5 100644 --- a/RecoTracker/TkHitPairs/interface/LayerHitMapCache.h +++ b/RecoTracker/TkHitPairs/interface/LayerHitMapCache.h @@ -20,6 +20,7 @@ class LayerHitMapCache { using ValueType = RecHitsSortedInPhi; using KeyType = int; SimpleCache(unsigned int initSize) : theContainer(initSize, nullptr){} + SimpleCache(SimpleCache&& rh): theContainer(std::move(rh.theContainer)) {} ~SimpleCache() { clear(); } void resize(int size) { theContainer.resize(size,nullptr); } const ValueType* get(KeyType key) { return theContainer[key];} @@ -42,6 +43,7 @@ class LayerHitMapCache { typedef SimpleCache Cache; public: LayerHitMapCache(unsigned int initSize=50) : theCache(initSize) { } + LayerHitMapCache(LayerHitMapCache&& rh): theCache(std::move(rh.theCache)) {} void clear() { theCache.clear(); } diff --git a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc new file mode 100644 index 0000000000000..3b1157eeba06e --- /dev/null +++ b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc @@ -0,0 +1,127 @@ +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Utilities/interface/EDGetToken.h" +#include "FWCore/Framework/interface/Event.h" +#include "DataFormats/Common/interface/Handle.h" +#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/TkHitPairs/interface/LayerHitMapCache.h" +#include "RecoTracker/TkHitPairs/interface/HitPairGeneratorFromLayerPair.h" +#include "RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h" +#include "RecoTracker/TkSeedingLayers/interface/SeedingHitSet.h" + +class HitPairEDProducer: public edm::stream::EDProducer<> { +public: + HitPairEDProducer(const edm::ParameterSet& iConfig); + ~HitPairEDProducer() = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + virtual void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override; + +private: + edm::EDGetTokenT seedingLayerToken_; + edm::EDGetTokenT > regionToken_; + + edm::RunningAverage localRA_; + LayerHitMapCache layerCache_; + const unsigned int maxElement_; + + HitPairGeneratorFromLayerPair generator_; + + const bool produceSeedingHitSets_; + const bool produceIntermediateHitDoublets_; +}; + + +HitPairEDProducer::HitPairEDProducer(const edm::ParameterSet& iConfig): + seedingLayerToken_(consumes(iConfig.getParameter("seedingLayers"))), + regionToken_(consumes >(iConfig.getParameter("trackingRegions"))), + maxElement_(iConfig.getParameter("maxElement")), + generator_(0, 1, nullptr, maxElement_), // TODO: make layer indices configurable? + produceSeedingHitSets_(iConfig.getParameter("produceSeedingHitSets")), + produceIntermediateHitDoublets_(iConfig.getParameter("produceIntermediateHitDoublets")) +{ + if(!produceIntermediateHitDoublets_ && !produceSeedingHitSets_) + throw cms::Exception("Configuration") << "HitPairEDProducer requires either produceIntermediateHitDoublets or produceSeedingHitSets to be True. If neither are needed, just remove this module from your sequence/path as it doesn't do anything useful"; + + if(produceSeedingHitSets_) + produces >(); + if(produceIntermediateHitDoublets_) + produces(); +} + +void HitPairEDProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + + desc.add("seedingLayers", edm::InputTag("seedingLayersEDProducer")); + desc.add("trackingRegions", edm::InputTag("globalTrackingRegionFromBeamSpot")); + desc.add("produceSeedingHitSets", false); + desc.add("produceIntermediateHitDoublets", false); + desc.add("maxElement", 0); // default is really 0? Also when used from CombinedHitTripletGenerator? + + descriptions.add("hitPairEDProducer", desc); +} + +void HitPairEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + edm::Handle hlayers; + iEvent.getByToken(seedingLayerToken_, hlayers); + const auto& layers = *hlayers; + if(layers.numberOfLayersInSet() < 2) + throw cms::Exception("Configuration") << "HitPairEDProducer expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= 2, got " << layers.numberOfLayersInSet(); + + edm::Handle > hregions; + iEvent.getByToken(regionToken_, hregions); + const auto& regions = *hregions; + + std::unique_ptr > seedingHitSets; + if(produceSeedingHitSets_) { + seedingHitSets = std::make_unique >(); + seedingHitSets->reserve(localRA_.upper()); + } + std::unique_ptr intermediateHitDoublets; + if(produceIntermediateHitDoublets_) { + intermediateHitDoublets = std::make_unique(&layers); + intermediateHitDoublets->reserve(regions.size(), layers.size()); + } + + for(const TrackingRegion& region: regions) { + if(produceIntermediateHitDoublets_) { + intermediateHitDoublets->beginRegion(®ion); + } + + for(SeedingLayerSetsHits::SeedingLayerSet layerSet: layers) { + LayerHitMapCache hitCache; + auto doublets = generator_.doublets(region, iEvent, iSetup, layerSet, hitCache); + if(doublets.empty()) continue; // don't bother if no pairs from these layers + if(produceSeedingHitSets_) { + for(size_t i=0, size=doublets.size(); iemplace_back(doublets.hit(i, HitDoublets::inner), + doublets.hit(i, HitDoublets::outer)); + } + } + if(produceIntermediateHitDoublets_) { + intermediateHitDoublets->addDoublets(layerSet, std::move(doublets), std::move(hitCache)); + } + } + } + + if(produceSeedingHitSets_) { + seedingHitSets->shrink_to_fit(); + localRA_.update(seedingHitSets->size()); + iEvent.put(std::move(seedingHitSets)); + } + if(produceIntermediateHitDoublets_) { + intermediateHitDoublets->shrink_to_fit(); + iEvent.put(std::move(intermediateHitDoublets)); + } +} + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(HitPairEDProducer); diff --git a/RecoTracker/TkHitPairs/src/HitPairGeneratorFromLayerPair.cc b/RecoTracker/TkHitPairs/src/HitPairGeneratorFromLayerPair.cc index e59df9be12aab..0371236b7a62a 100644 --- a/RecoTracker/TkHitPairs/src/HitPairGeneratorFromLayerPair.cc +++ b/RecoTracker/TkHitPairs/src/HitPairGeneratorFromLayerPair.cc @@ -34,7 +34,7 @@ HitPairGeneratorFromLayerPair::HitPairGeneratorFromLayerPair( unsigned int outer, LayerCacheType* layerCache, unsigned int max) - : theLayerCache(*layerCache), theOuterLayer(outer), theInnerLayer(inner), theMaxElement(max) + : theLayerCache(layerCache), theOuterLayer(outer), theInnerLayer(inner), theMaxElement(max) { } @@ -87,41 +87,13 @@ void HitPairGeneratorFromLayerPair::hitPairs( } HitDoublets HitPairGeneratorFromLayerPair::doublets( const TrackingRegion& region, - const edm::Event & iEvent, const edm::EventSetup& iSetup, Layers layers) { + const edm::Event & iEvent, const edm::EventSetup& iSetup, const Layer& innerLayer, const Layer& outerLayer, + LayerCacheType& layerCache) { - typedef OrderedHitPair::InnerRecHit InnerHit; - typedef OrderedHitPair::OuterRecHit OuterHit; - typedef RecHitsSortedInPhi::Hit Hit; - - Layer innerLayerObj = innerLayer(layers); - Layer outerLayerObj = outerLayer(layers); - - const RecHitsSortedInPhi & innerHitsMap = theLayerCache(innerLayerObj, region, iSetup); - if (innerHitsMap.empty()) return HitDoublets(innerHitsMap,innerHitsMap); - - const RecHitsSortedInPhi& outerHitsMap = theLayerCache(outerLayerObj, region, iSetup); - if (outerHitsMap.empty()) return HitDoublets(innerHitsMap,outerHitsMap); - HitDoublets result(innerHitsMap,outerHitsMap); result.reserve(std::max(innerHitsMap.size(),outerHitsMap.size())); - doublets(region, - *innerLayerObj.detLayer(),*outerLayerObj.detLayer(), - innerHitsMap,outerHitsMap,iSetup,theMaxElement,result); - return result; - -} - - -HitDoublets HitPairGeneratorFromLayerPair::doublets( const TrackingRegion& region, - const edm::Event & iEvent, const edm::EventSetup& iSetup, const Layer& innerLayer, const Layer& outerLayer) { - - typedef OrderedHitPair::InnerRecHit InnerHit; - typedef OrderedHitPair::OuterRecHit OuterHit; - typedef RecHitsSortedInPhi::Hit Hit; - - - const RecHitsSortedInPhi & innerHitsMap = theLayerCache(innerLayer, region, iSetup); + const RecHitsSortedInPhi & innerHitsMap = layerCache(innerLayer, region, iSetup); if (innerHitsMap.empty()) return HitDoublets(innerHitsMap,innerHitsMap); - const RecHitsSortedInPhi& outerHitsMap = theLayerCache(outerLayer, region, iSetup); + const RecHitsSortedInPhi& outerHitsMap = layerCache(outerLayer, region, iSetup); if (outerHitsMap.empty()) return HitDoublets(innerHitsMap,outerHitsMap); HitDoublets result(innerHitsMap,outerHitsMap); result.reserve(std::max(innerHitsMap.size(),outerHitsMap.size())); doublets(region, diff --git a/RecoTracker/TkHitPairs/src/IntermediateHitDoublets.cc b/RecoTracker/TkHitPairs/src/IntermediateHitDoublets.cc new file mode 100644 index 0000000000000..6aec429d14ebf --- /dev/null +++ b/RecoTracker/TkHitPairs/src/IntermediateHitDoublets.cc @@ -0,0 +1,7 @@ +#include "RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h" +#include "FWCore/Utilities/interface/Exception.h" + +IntermediateHitDoublets::IntermediateHitDoublets(const IntermediateHitDoublets& rh) { + throw cms::Exception("Not Implemented") << "The copy constructor of IntermediateHitDoublets should never be called. The function exists only to make ROOT dictionary generation happy."; +} + diff --git a/RecoTracker/TkHitPairs/src/classes.h b/RecoTracker/TkHitPairs/src/classes.h new file mode 100644 index 0000000000000..bad1082a183cc --- /dev/null +++ b/RecoTracker/TkHitPairs/src/classes.h @@ -0,0 +1,11 @@ +#include "RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h" +#include "DataFormats/Common/interface/Wrapper.h" + +#include + +namespace RecoTracker_TkHitPairs { + struct dictionary { + IntermediateHitDoublets ihd; + edm::Wrapper wihd; + }; +} diff --git a/RecoTracker/TkHitPairs/src/classes_def.xml b/RecoTracker/TkHitPairs/src/classes_def.xml new file mode 100644 index 0000000000000..ae8e13fcfa26c --- /dev/null +++ b/RecoTracker/TkHitPairs/src/classes_def.xml @@ -0,0 +1,4 @@ + + + + diff --git a/RecoTracker/TkSeedingLayers/BuildFile.xml b/RecoTracker/TkSeedingLayers/BuildFile.xml index 1ddf32f90252e..5711f340fe0ab 100644 --- a/RecoTracker/TkSeedingLayers/BuildFile.xml +++ b/RecoTracker/TkSeedingLayers/BuildFile.xml @@ -1,5 +1,6 @@ + diff --git a/RecoTracker/TkSeedingLayers/src/classes.h b/RecoTracker/TkSeedingLayers/src/classes.h new file mode 100644 index 0000000000000..4a65739ddea37 --- /dev/null +++ b/RecoTracker/TkSeedingLayers/src/classes.h @@ -0,0 +1,11 @@ +#include "RecoTracker/TkSeedingLayers/interface/SeedingHitSet.h" +#include "DataFormats/Common/interface/Wrapper.h" + +#include + +namespace RecoTracker_TkSeedingLayers { + struct dictionary { + std::vector vshs; + edm::Wrapper > wvshs; + }; +} diff --git a/RecoTracker/TkSeedingLayers/src/classes_def.xml b/RecoTracker/TkSeedingLayers/src/classes_def.xml new file mode 100644 index 0000000000000..9f36952c307c7 --- /dev/null +++ b/RecoTracker/TkSeedingLayers/src/classes_def.xml @@ -0,0 +1,4 @@ + + + + From e60ae230c32977c940c8f268c656e87d4c3cf42e Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 29 Apr 2016 14:43:10 +0200 Subject: [PATCH 04/69] LayerHitMapCache::SimpleCache::add() takes non-const pointer Necessary step before switching from bare pointer to mayown_ptr. And now we can also remove mutable from RecHitsSortedInPhi::theOrigin. --- RecoTracker/TkHitPairs/interface/LayerHitMapCache.h | 9 +++++---- RecoTracker/TkHitPairs/interface/RecHitsSortedInPhi.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/RecoTracker/TkHitPairs/interface/LayerHitMapCache.h b/RecoTracker/TkHitPairs/interface/LayerHitMapCache.h index 55bcccd9e8ad5..082a4f566d790 100644 --- a/RecoTracker/TkHitPairs/interface/LayerHitMapCache.h +++ b/RecoTracker/TkHitPairs/interface/LayerHitMapCache.h @@ -25,7 +25,7 @@ class LayerHitMapCache { void resize(int size) { theContainer.resize(size,nullptr); } const ValueType* get(KeyType key) { return theContainer[key];} /// add object to cache. It is caller responsibility to check that object is not yet there. - void add(KeyType key, const ValueType * value) { + void add(KeyType key, ValueType * value) { if (key>=int(theContainer.size())) resize(key+1); theContainer[key]=value; } @@ -54,10 +54,11 @@ class LayerHitMapCache { assert (key>=0); const RecHitsSortedInPhi * lhm = theCache.get(key); if (lhm==nullptr) { - lhm=new RecHitsSortedInPhi (region.hits(iSetup,layer), region.origin(), layer.detLayer()); - lhm->theOrigin = region.origin(); + auto tmp=new RecHitsSortedInPhi (region.hits(iSetup,layer), region.origin(), layer.detLayer()); + tmp->theOrigin = region.origin(); + theCache.add( key, tmp); + lhm = tmp; LogDebug("LayerHitMapCache")<<" I got"<< lhm->all().second-lhm->all().first<<" hits in the cache for: "<theOrigin << std::endl; diff --git a/RecoTracker/TkHitPairs/interface/RecHitsSortedInPhi.h b/RecoTracker/TkHitPairs/interface/RecHitsSortedInPhi.h index 0db7b68bd24dc..c61736a94db21 100644 --- a/RecoTracker/TkHitPairs/interface/RecHitsSortedInPhi.h +++ b/RecoTracker/TkHitPairs/interface/RecHitsSortedInPhi.h @@ -91,7 +91,7 @@ class RecHitsSortedInPhi { public: - mutable GlobalPoint theOrigin; + GlobalPoint theOrigin; std::vector theHits; From fd3301f4ed9d1b61f79b6e72206ea2d237bb39a3 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 29 Apr 2016 14:43:53 +0200 Subject: [PATCH 05/69] Use mayown_ptr in LayerHitMapCache and provide extend() --- .../TkHitPairs/interface/LayerHitMapCache.h | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/RecoTracker/TkHitPairs/interface/LayerHitMapCache.h b/RecoTracker/TkHitPairs/interface/LayerHitMapCache.h index 082a4f566d790..b399a323b8dd0 100644 --- a/RecoTracker/TkHitPairs/interface/LayerHitMapCache.h +++ b/RecoTracker/TkHitPairs/interface/LayerHitMapCache.h @@ -9,7 +9,7 @@ #include "RecoTracker/TkHitPairs/interface/RecHitsSortedInPhi.h" #include "TrackingTools/TransientTrackingRecHit/interface/SeedingLayerSetsHits.h" #include "FWCore/Framework/interface/EventSetup.h" - +#include "DataFormats/TrackingRecHit/interface/mayown_ptr.h" class LayerHitMapCache { @@ -19,22 +19,32 @@ class LayerHitMapCache { public: using ValueType = RecHitsSortedInPhi; using KeyType = int; - SimpleCache(unsigned int initSize) : theContainer(initSize, nullptr){} + SimpleCache(unsigned int initSize) : theContainer(initSize){} SimpleCache(SimpleCache&& rh): theContainer(std::move(rh.theContainer)) {} ~SimpleCache() { clear(); } - void resize(int size) { theContainer.resize(size,nullptr); } - const ValueType* get(KeyType key) { return theContainer[key];} + void resize(int size) { theContainer.resize(size); } + const ValueType* get(KeyType key) const { return theContainer[key].get();} /// add object to cache. It is caller responsibility to check that object is not yet there. void add(KeyType key, ValueType * value) { if (key>=int(theContainer.size())) resize(key+1); - theContainer[key]=value; + theContainer[key].reset(value); + } + void extend(const SimpleCache& other) { + // N.B. Here we assume that the lifetime of 'other' is longer than of 'this'. + if(other.theContainer.size() > theContainer.size()) + resize(other.theContainer.size()); + + for(size_t i=0, size=other.theContainer.size(); i != size; ++i) { + assert(get(i) == nullptr); // We don't want to override any existing value + theContainer[i].reset(*(other.get(i))); // pass by reference to denote that we don't own it + } } /// emptify cache, delete values associated to Key void clear() { - for ( auto & v : theContainer) { delete v; v=nullptr;} + for ( auto & v : theContainer) { v.reset(); } } private: - std::vector< const ValueType *> theContainer; + std::vector > theContainer; private: SimpleCache(const SimpleCache &) { } }; @@ -46,6 +56,10 @@ class LayerHitMapCache { LayerHitMapCache(LayerHitMapCache&& rh): theCache(std::move(rh.theCache)) {} void clear() { theCache.clear(); } + + void extend(const LayerHitMapCache& other) { + theCache.extend(other.theCache); + } const RecHitsSortedInPhi & operator()(const SeedingLayerSetsHits::SeedingLayer& layer, const TrackingRegion & region, From c8392fa6c547c494c0c8fd37d30cb38b5257cc7f Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 29 Apr 2016 14:39:33 +0200 Subject: [PATCH 06/69] Improve interface of PixelTripletHLTGenerator --- .../plugins/PixelTripletHLTGenerator.cc | 16 ++++++++++++---- .../plugins/PixelTripletHLTGenerator.h | 6 ++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.cc b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.cc index 0565f6d689775..c3a6f31679a8d 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.cc @@ -60,18 +60,26 @@ void PixelTripletHLTGenerator::hitTriplets(const TrackingRegion& region, const SeedingLayerSetsHits::SeedingLayerSet& pairLayers, const std::vector& thirdLayers) { - if (theComparitor) theComparitor->init(ev, es); - auto const & doublets = thePairGenerator->doublets(region,ev,es, pairLayers); - if (doublets.empty()) return; + assert(theLayerCache); + hitTriplets(region, result, ev, es, doublets, thirdLayers, *theLayerCache); +} + +void PixelTripletHLTGenerator::hitTriplets(const TrackingRegion& region, OrderedHitTriplets& result, + const edm::Event& ev, const edm::EventSetup& es, + const HitDoublets& doublets, + const std::vector& thirdLayers, + LayerCacheType& layerCache) { + if (theComparitor) theComparitor->init(ev, es); + int size = thirdLayers.size(); const RecHitsSortedInPhi * thirdHitMap[size]; vector thirdLayerDetLayer(size,0); for (int il=0; il& thirdLayers) override; + void hitTriplets(const TrackingRegion& region, OrderedHitTriplets& trs, + const edm::Event& ev, const edm::EventSetup& es, + const HitDoublets& doublets, + const std::vector& thirdLayers, + LayerCacheType& layerCache); + void hitTriplets( const TrackingRegion& region, OrderedHitTriplets & result, From fb8a09452b33b00bc333ac6fbfa0bdb10e4b4bc4 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 29 Apr 2016 14:39:53 +0200 Subject: [PATCH 07/69] Add HitTripletEDProducerT and IntermediateHitTriplets Produces hit triplets directly to edm::Event, either as a form of vector for SeedCreator, or as IntermediateHitTriplets for quadruplet generation. Also have to bookkeep the 3rd layers where the triplets come from, because the triplets (from a given layer pair) need to be ordered by their 3rd layer for quadruplet generation. --- .../PixelTriplets/BuildFile.xml | 1 + .../interface/HitTripletEDProducerT.h | 160 ++++++++++++++++++ .../HitTripletGeneratorFromPairAndLayers.h | 4 +- .../interface/IntermediateHitTriplets.h | 82 +++++++++ .../plugins/PixelTripletHLTGenerator.cc | 48 +++++- .../plugins/PixelTripletHLTGenerator.h | 13 ++ .../PixelTriplets/plugins/SealModule.cc | 4 + .../HitTripletGeneratorFromPairAndLayers.cc | 5 + .../src/IntermediateHitTriplets.cc | 7 + .../PixelTriplets/src/classes.h | 11 ++ .../PixelTriplets/src/classes_def.xml | 4 + 11 files changed, 329 insertions(+), 10 deletions(-) create mode 100644 RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h create mode 100644 RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h create mode 100644 RecoPixelVertexing/PixelTriplets/src/IntermediateHitTriplets.cc create mode 100644 RecoPixelVertexing/PixelTriplets/src/classes.h create mode 100644 RecoPixelVertexing/PixelTriplets/src/classes_def.xml diff --git a/RecoPixelVertexing/PixelTriplets/BuildFile.xml b/RecoPixelVertexing/PixelTriplets/BuildFile.xml index fda4793133feb..44658ce6bff03 100644 --- a/RecoPixelVertexing/PixelTriplets/BuildFile.xml +++ b/RecoPixelVertexing/PixelTriplets/BuildFile.xml @@ -1,3 +1,4 @@ + diff --git a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h new file mode 100644 index 0000000000000..1739e982d5ab3 --- /dev/null +++ b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h @@ -0,0 +1,160 @@ +#ifndef RecoPixelVertexing_PixelTriplets_HitTripletEDProducerT_H +#define RecoPixelVertexing_PixelTriplets_HitTripletEDProducerT_H + +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Utilities/interface/EDGetToken.h" +#include "FWCore/Framework/interface/Event.h" +#include "DataFormats/Common/interface/Handle.h" +#include "FWCore/Utilities/interface/RunningAverage.h" + +#include "RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h" +#include "RecoTracker/TkSeedingLayers/interface/SeedingHitSet.h" +#include "RecoPixelVertexing/PixelTriplets/interface/OrderedHitTriplets.h" +#include "RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h" +#include "RecoPixelVertexing/PixelTriplets/interface/LayerTriplets.h" + +template +class HitTripletEDProducerT: public edm::stream::EDProducer<> { +public: + HitTripletEDProducerT(const edm::ParameterSet& iConfig); + ~HitTripletEDProducerT() = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + virtual void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override; + +private: + edm::EDGetTokenT doubletToken_; + + edm::RunningAverage localRA_; + + T_HitTripletGenerator generator_; + + const bool produceSeedingHitSets_; + const bool produceIntermediateHitTriplets_; +}; + +template +HitTripletEDProducerT::HitTripletEDProducerT(const edm::ParameterSet& iConfig): + doubletToken_(consumes(iConfig.getParameter("doublets"))), + generator_(iConfig, consumesCollector()), + produceSeedingHitSets_(iConfig.getParameter("produceSeedingHitSets")), + produceIntermediateHitTriplets_(iConfig.getParameter("produceIntermediateHitTriplets")) +{ + if(!produceIntermediateHitTriplets_ && !produceSeedingHitSets_) + throw cms::Exception("Configuration") << "HitTripletEDProducerT requires either produceIntermediateHitTriplets or produceSeedingHitSets to be True. If neither are needed, just remove this module from your sequence/path as it doesn't do anything useful"; + if(produceSeedingHitSets_) + produces >(); + if(produceIntermediateHitTriplets_) + produces(); +} + +template +void HitTripletEDProducerT::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + + desc.add("doublets", edm::InputTag("hitPairEDProducer")); + desc.add("produceSeedingHitSets", false); + desc.add("produceIntermediateHitTriplets", false); + + T_HitTripletGenerator::fillDescriptions(desc); + + auto label = T_HitTripletGenerator::fillDescriptionsLabel() + std::string("EDProducer"); + descriptions.add(label, desc); +} + +template +void HitTripletEDProducerT::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + edm::Handle hdoublets; + iEvent.getByToken(doubletToken_, hdoublets); + const auto& regionDoublets = *hdoublets; + + const SeedingLayerSetsHits& seedingLayerHits = regionDoublets.seedingLayerHits(); + if(seedingLayerHits.numberOfLayersInSet() < 3) { + throw cms::Exception("Configuration") << "HitTripletEDProducerT expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= 3, got " << seedingLayerHits.numberOfLayersInSet(); + } + + std::unique_ptr > seedingHitSets; + if(produceSeedingHitSets_) { + seedingHitSets = std::make_unique >(); + seedingHitSets->reserve(localRA_.upper()); + } + std::unique_ptr intermediateHitTriplets; + if(produceIntermediateHitTriplets_) { + intermediateHitTriplets = std::make_unique(&seedingLayerHits); + intermediateHitTriplets->reserve(regionDoublets.regionSize(), seedingLayerHits.size(), localRA_.upper()); + } + + // match-making of pair and triplet layers + std::vector trilayers = LayerTriplets::layers(seedingLayerHits); + std::vector thirdLayerHitBeginIndices; + thirdLayerHitBeginIndices.reserve(3); // Yes, vector is a bit overkill as there can be at most 3 3rd layers for a doublet. But better be consistent and migrate later everything to e.g. std::array or edm::VecArray. Except with phase1 there can be more than 3 3rd layers... + + OrderedHitTriplets triplets; + triplets.reserve(localRA_.upper()); + size_t triplets_total = 0; + + for(const auto& regionLayerPairs: regionDoublets) { + const TrackingRegion& region = regionLayerPairs.region(); + intermediateHitTriplets->beginRegion(®ion); + + for(const auto& layerPair: regionLayerPairs) { + auto found = std::find_if(trilayers.begin(), trilayers.end(), [&](const LayerTriplets::LayerSetAndLayers& a) { + return a.first[0].index() == layerPair.innerLayerIndex() && a.first[1].index() == layerPair.outerLayerIndex(); + }); + if(found == trilayers.end()) { + auto exp = cms::Exception("LogicError") << "Did not find the layer pair from vector. This is a sign of some internal inconsistency\n"; + exp << "I was looking for layer pair " << layerPair.innerLayerIndex() << "," << layerPair.outerLayerIndex() << ". Triplets have the following pairs:\n"; + for(const auto& a: trilayers) { + exp << " " << a.first[0].index() << "," << a.first[1].index() << ": 3rd layers"; + for(const auto& b: a.second) { + exp << " " << b.index(); + } + exp << "\n"; + } + throw exp; + } + + LayerHitMapCache hitCache; + hitCache.extend(layerPair.cache()); + + thirdLayerHitBeginIndices.clear(); + generator_.hitTriplets(region, triplets, iEvent, iSetup, layerPair.doublets(), found->second, &thirdLayerHitBeginIndices, hitCache); + if(triplets.empty()) + continue; + + triplets_total += triplets.size(); + if(produceSeedingHitSets_) { + for(const auto& trpl: triplets) { + seedingHitSets->emplace_back(trpl.inner(), trpl.middle(), trpl.outer()); + } + } + if(produceIntermediateHitTriplets_) { + if(thirdLayerHitBeginIndices.size() != trilayers.size()) { + throw cms::Exception("LogicError") << "thirdLayerHitBeginIndices.size() " << thirdLayerHitBeginIndices.size() + << " trilayers.size() " << trilayers.size(); + } + for(size_t i=0, size=trilayers.size(); iaddTriplets(found->first, found->second[i], + std::next(triplets.begin(), begin), std::next(triplets.begin(), end), + std::move(hitCache)); + } + } + } + } + localRA_.update(triplets_total); + + if(produceSeedingHitSets_) + iEvent.put(std::move(seedingHitSets)); + if(produceIntermediateHitTriplets_) + iEvent.put(std::move(intermediateHitTriplets)); +} + + +#endif diff --git a/RecoPixelVertexing/PixelTriplets/interface/HitTripletGeneratorFromPairAndLayers.h b/RecoPixelVertexing/PixelTriplets/interface/HitTripletGeneratorFromPairAndLayers.h index b3fa615327711..05c7fcc992268 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/HitTripletGeneratorFromPairAndLayers.h +++ b/RecoPixelVertexing/PixelTriplets/interface/HitTripletGeneratorFromPairAndLayers.h @@ -12,7 +12,7 @@ #include "TrackingTools/TransientTrackingRecHit/interface/SeedingLayerSetsHits.h" #include "RecoTracker/TkHitPairs/interface/LayerHitMapCache.h" -namespace edm { class ParameterSet; class Event; class EventSetup; class ConsumesCollector; } +namespace edm { class ParameterSet; class Event; class EventSetup; class ConsumesCollector; class ParameterSetDescription;} class TrackingRegion; class HitPairGeneratorFromLayerPair; @@ -25,6 +25,8 @@ class HitTripletGeneratorFromPairAndLayers { explicit HitTripletGeneratorFromPairAndLayers(const edm::ParameterSet& pset); virtual ~HitTripletGeneratorFromPairAndLayers(); + static void fillDescriptions(edm::ParameterSetDescription& desc); + void init( std::unique_ptr&& pairs, LayerCacheType* layerCache); const HitPairGeneratorFromLayerPair& pairGenerator() const { return *thePairGenerator; } diff --git a/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h b/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h new file mode 100644 index 0000000000000..79d86fee58da1 --- /dev/null +++ b/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h @@ -0,0 +1,82 @@ +#ifndef RecoPixelVertexing_PixelTriplets_IntermediateHitTriplets_h +#define RecoPixelVertexing_PixelTriplets_IntermediateHitTriplets_h + +#include "RecoTracker/TkHitPairs/interface/LayerHitMapCache.h" +#include "RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h" +#include "TrackingTools/TransientTrackingRecHit/interface/SeedingLayerSetsHits.h" +#include "RecoPixelVertexing/PixelTriplets/interface/OrderedHitTriplets.h" + +/** + * Simple container of temporary information delivered from hit triplet + * generator to hit quadruplet generator via edm::Event. + */ +class IntermediateHitTriplets { +public: + using LayerTriplet = std::tuple; + using RegionIndex = ihd::RegionIndex; + + //////////////////// + + class LayerTripletHitIndex { + public: + LayerTripletHitIndex(const SeedingLayerSetsHits::SeedingLayerSet& layerPair, const SeedingLayerSetsHits::SeedingLayer& thirdLayer, + size_t begin, LayerHitMapCache&& cache): + layerTriplet_(layerPair[0].index(), layerPair[1].index(), thirdLayer.index()), + hitsBegin_(begin), + cache_(std::move(cache)) + {} + + private: + LayerTriplet layerTriplet_; + size_t hitsBegin_; + LayerHitMapCache cache_; + }; + + //////////////////// + + IntermediateHitTriplets(): seedingLayers_(nullptr) {} + explicit IntermediateHitTriplets(const SeedingLayerSetsHits *seedingLayers): seedingLayers_(seedingLayers) {} + IntermediateHitTriplets(const IntermediateHitTriplets& rh); // only to make ROOT dictionary generation happy + ~IntermediateHitTriplets() = default; + + void swap(IntermediateHitTriplets& rh) { + std::swap(seedingLayers_, rh.seedingLayers_); + std::swap(regions_, rh.regions_); + std::swap(layerTriplets_, rh.layerTriplets_); + std::swap(hitTriplets_, rh.hitTriplets_); + } + + void reserve(size_t nregions, size_t nlayersets, size_t ntriplets) { + regions_.reserve(nregions); + layerTriplets_.reserve(nregions*nlayersets); + hitTriplets_.reserve(ntriplets); + } + + void shrink_to_fit() { + regions_.shrink_to_fit(); + layerTriplets_.shrink_to_fit(); + hitTriplets_.shrink_to_fit(); + } + + void beginRegion(const TrackingRegion *region) { + regions_.emplace_back(region, layerTriplets_.size()); + } + + void addTriplets(const SeedingLayerSetsHits::SeedingLayerSet& layerPair, const SeedingLayerSetsHits::SeedingLayer& thirdLayer, + OrderedHitTriplets::iterator hitTripletsBegin, OrderedHitTriplets::iterator hitTripletsEnd, + LayerHitMapCache&& cache) { + layerTriplets_.emplace_back(layerPair, thirdLayer, std::distance(hitTripletsBegin, hitTripletsEnd), std::move(cache)); + std::move(hitTripletsBegin, hitTripletsEnd, std::back_inserter(hitTriplets_)); // probably not much different from std::copy as we're just moving pointers... + } + +private: + const SeedingLayerSetsHits *seedingLayers_; + + std::vector regions_; + std::vector layerTriplets_; + std::vector hitTriplets_; +}; + +#endif diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.cc b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.cc index c3a6f31679a8d..96b880ec5734a 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.cc @@ -1,5 +1,6 @@ #include "RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.h" #include "RecoTracker/TkHitPairs/interface/HitPairGeneratorFromLayerPair.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "ThirdHitPredictionFromInvParabola.h" #include "ThirdHitRZPrediction.h" @@ -53,6 +54,21 @@ PixelTripletHLTGenerator:: PixelTripletHLTGenerator(const edm::ParameterSet& cfg PixelTripletHLTGenerator::~PixelTripletHLTGenerator() {} +void PixelTripletHLTGenerator::fillDescriptions(edm::ParameterSetDescription& desc) { + HitTripletGeneratorFromPairAndLayers::fillDescriptions(desc); + desc.add("extraHitRPhitolerance", 0.032); + desc.add("extraHitRZtolerance", 0.037); + desc.add("useMultScattering", true); + desc.add("useBending", true); + desc.add("useFixedPreFiltering", false); + desc.add("phiPreFiltering", 0.3); + + edm::ParameterSetDescription descComparitor; + descComparitor.add("ComponentName", "none"); + descComparitor.setAllowAnything(); // until we have moved SeedComparitor too to EDProducers + desc.add("SeedComparitorPSet", descComparitor); +} + void PixelTripletHLTGenerator::hitTriplets(const TrackingRegion& region, OrderedHitTriplets & result, const edm::Event & ev, @@ -64,13 +80,14 @@ void PixelTripletHLTGenerator::hitTriplets(const TrackingRegion& region, if (doublets.empty()) return; assert(theLayerCache); - hitTriplets(region, result, ev, es, doublets, thirdLayers, *theLayerCache); + hitTriplets(region, result, ev, es, doublets, thirdLayers, nullptr, *theLayerCache); } void PixelTripletHLTGenerator::hitTriplets(const TrackingRegion& region, OrderedHitTriplets& result, const edm::Event& ev, const edm::EventSetup& es, const HitDoublets& doublets, const std::vector& thirdLayers, + std::vector *thirdLayerHitBeginIndices, LayerCacheType& layerCache) { if (theComparitor) theComparitor->init(ev, es); @@ -82,7 +99,7 @@ void PixelTripletHLTGenerator::hitTriplets(const TrackingRegion& region, Ordered thirdHitMap[il] = &layerCache(thirdLayers[il], region, es); thirdLayerDetLayer[il] = thirdLayers[il].detLayer(); } - hitTriplets(region,result,es,doublets,thirdHitMap,thirdLayerDetLayer,size); + hitTriplets(region, result, es, doublets, thirdHitMap, thirdLayerDetLayer, size, thirdLayerHitBeginIndices); } void PixelTripletHLTGenerator::hitTriplets( @@ -94,14 +111,24 @@ void PixelTripletHLTGenerator::hitTriplets( const std::vector & thirdLayerDetLayer, const int nThirdLayers) { - auto outSeq = doublets.detLayer(HitDoublets::outer)->seqNum(); + hitTriplets(region, result, es, doublets, thirdHitMap, thirdLayerDetLayer, nThirdLayers, nullptr); +} - float regOffset = region.origin().perp(); //try to take account of non-centrality (?) - - declareDynArray(ThirdHitRZPrediction, nThirdLayers, preds); - declareDynArray(ThirdHitCorrection, nThirdLayers, corrections); - - typedef RecHitsSortedInPhi::Hit Hit; +void PixelTripletHLTGenerator::hitTriplets(const TrackingRegion& region, OrderedHitTriplets & result, + const edm::EventSetup & es, + const HitDoublets & doublets, + const RecHitsSortedInPhi ** thirdHitMap, + const std::vector & thirdLayerDetLayer, + const int nThirdLayers, + std::vector *thirdLayerHitBeginIndices) { + auto outSeq = doublets.detLayer(HitDoublets::outer)->seqNum(); + + float regOffset = region.origin().perp(); //try to take account of non-centrality (?) + + declareDynArray(ThirdHitRZPrediction, nThirdLayers, preds); + declareDynArray(ThirdHitCorrection, nThirdLayers, corrections); + + typedef RecHitsSortedInPhi::Hit Hit; using NodeInfo = KDTreeNodeInfo; std::vector layerTree; // re-used throughout @@ -181,6 +208,9 @@ void PixelTripletHLTGenerator::hitTriplets( const DetLayer * layer = thirdLayerDetLayer[il]; auto barrelLayer = layer->isBarrel(); + // to bookkeep the triplets and 3rd layers in triplet EDProducer + if(thirdLayerHitBeginIndices) thirdLayerHitBeginIndices->push_back(result.size()); + if ( (!barrelLayer) & (toPos != std::signbit(layer->position().z())) ) continue; if (hitTree[il].empty()) continue; // Don't bother if no hits diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.h b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.h index cbaf2d2e9f288..843951bd4541b 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.h +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.h @@ -22,10 +22,14 @@ class PixelTripletHLTGenerator : public HitTripletGeneratorFromPairAndLayers { typedef CombinedHitTripletGenerator::LayerCacheType LayerCacheType; public: + PixelTripletHLTGenerator( const edm::ParameterSet& cfg, edm::ConsumesCollector&& iC): PixelTripletHLTGenerator(cfg, iC) {} PixelTripletHLTGenerator( const edm::ParameterSet& cfg, edm::ConsumesCollector& iC); virtual ~PixelTripletHLTGenerator(); + static void fillDescriptions(edm::ParameterSetDescription& desc); + static const char *fillDescriptionsLabel() { return "pixelTripletHLT"; } + virtual void hitTriplets( const TrackingRegion& region, OrderedHitTriplets & trs, const edm::Event & ev, const edm::EventSetup& es, const SeedingLayerSetsHits::SeedingLayerSet& pairLayers, @@ -35,6 +39,7 @@ typedef CombinedHitTripletGenerator::LayerCacheType LayerCacheType; const edm::Event& ev, const edm::EventSetup& es, const HitDoublets& doublets, const std::vector& thirdLayers, + std::vector *thirdLayerHitBeginIndices, LayerCacheType& layerCache); void hitTriplets( @@ -46,6 +51,14 @@ typedef CombinedHitTripletGenerator::LayerCacheType LayerCacheType; const std::vector & thirdLayerDetLayer, const int nThirdLayers)override; + void hitTriplets(const TrackingRegion& region, OrderedHitTriplets & result, + const edm::EventSetup & es, + const HitDoublets & doublets, + const RecHitsSortedInPhi ** thirdHitMap, + const std::vector & thirdLayerDetLayer, + const int nThirdLayers, + std::vector *thirdLayerHitBeginIndices); + private: const bool useFixedPreFiltering; const float extraHitRZtolerance; diff --git a/RecoPixelVertexing/PixelTriplets/plugins/SealModule.cc b/RecoPixelVertexing/PixelTriplets/plugins/SealModule.cc index 0554740965413..f632ab6e82370 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/SealModule.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/SealModule.cc @@ -31,3 +31,7 @@ DEFINE_EDM_PLUGIN(HitQuadrupletGeneratorFromTripletAndLayersFactory, PixelQuadru #include "CAHitQuadrupletGenerator.h" DEFINE_EDM_PLUGIN(OrderedHitsGeneratorFactory, CAHitQuadrupletGenerator, "CAHitQuadrupletGenerator"); + +#include "RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h" +using PixelTripletHLTEDProducer = HitTripletEDProducerT; +DEFINE_FWK_MODULE(PixelTripletHLTEDProducer); diff --git a/RecoPixelVertexing/PixelTriplets/src/HitTripletGeneratorFromPairAndLayers.cc b/RecoPixelVertexing/PixelTriplets/src/HitTripletGeneratorFromPairAndLayers.cc index 12020295c7fed..2b31ace679667 100644 --- a/RecoPixelVertexing/PixelTriplets/src/HitTripletGeneratorFromPairAndLayers.cc +++ b/RecoPixelVertexing/PixelTriplets/src/HitTripletGeneratorFromPairAndLayers.cc @@ -1,6 +1,7 @@ #include "RecoPixelVertexing/PixelTriplets/interface/HitTripletGeneratorFromPairAndLayers.h" #include "RecoTracker/TkHitPairs/interface/HitPairGeneratorFromLayerPair.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" HitTripletGeneratorFromPairAndLayers::HitTripletGeneratorFromPairAndLayers(unsigned int maxElement): theLayerCache(nullptr), @@ -13,6 +14,10 @@ HitTripletGeneratorFromPairAndLayers::HitTripletGeneratorFromPairAndLayers(const HitTripletGeneratorFromPairAndLayers::~HitTripletGeneratorFromPairAndLayers() {} +void HitTripletGeneratorFromPairAndLayers::fillDescriptions(edm::ParameterSetDescription& desc) { + desc.add("maxElement", 100000); +} + void HitTripletGeneratorFromPairAndLayers::init(std::unique_ptr&& pairGenerator, LayerCacheType *layerCache) { thePairGenerator = std::move(pairGenerator); theLayerCache = layerCache; diff --git a/RecoPixelVertexing/PixelTriplets/src/IntermediateHitTriplets.cc b/RecoPixelVertexing/PixelTriplets/src/IntermediateHitTriplets.cc new file mode 100644 index 0000000000000..e25291bc19b6b --- /dev/null +++ b/RecoPixelVertexing/PixelTriplets/src/IntermediateHitTriplets.cc @@ -0,0 +1,7 @@ +#include "RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h" +#include "FWCore/Utilities/interface/Exception.h" + +IntermediateHitTriplets::IntermediateHitTriplets(const IntermediateHitTriplets& rh) { + throw cms::Exception("Not Implemented") << "The copy constructor of IntermediateHitTriplets should never be called. The function exists only to make ROOT dictionary generation happy."; +} + diff --git a/RecoPixelVertexing/PixelTriplets/src/classes.h b/RecoPixelVertexing/PixelTriplets/src/classes.h new file mode 100644 index 0000000000000..465decf805c73 --- /dev/null +++ b/RecoPixelVertexing/PixelTriplets/src/classes.h @@ -0,0 +1,11 @@ +#include "RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h" +#include "DataFormats/Common/interface/Wrapper.h" + +#include + +namespace RecoPixelVertexing_PixelTriplets { + struct dictionary { + IntermediateHitTriplets iht; + edm::Wrapper wiht; + }; +} diff --git a/RecoPixelVertexing/PixelTriplets/src/classes_def.xml b/RecoPixelVertexing/PixelTriplets/src/classes_def.xml new file mode 100644 index 0000000000000..ea89a65a45dbb --- /dev/null +++ b/RecoPixelVertexing/PixelTriplets/src/classes_def.xml @@ -0,0 +1,4 @@ + + + + From 7b07dda756f9012b45e5b147d0b4754a20b7c30a Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Sat, 30 Apr 2016 14:56:00 +0200 Subject: [PATCH 08/69] Fix LayerTriplets for quadruplet layer sets --- RecoPixelVertexing/PixelTriplets/src/LayerTriplets.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/RecoPixelVertexing/PixelTriplets/src/LayerTriplets.cc b/RecoPixelVertexing/PixelTriplets/src/LayerTriplets.cc index b283444ae4e27..5af57a8a5ba33 100644 --- a/RecoPixelVertexing/PixelTriplets/src/LayerTriplets.cc +++ b/RecoPixelVertexing/PixelTriplets/src/LayerTriplets.cc @@ -3,7 +3,7 @@ namespace LayerTriplets { std::vector layers(const SeedingLayerSetsHits& sets) { std::vector result; - if(sets.numberOfLayersInSet() != 3) + if(sets.numberOfLayersInSet() < 3) return result; for(LayerSet set: sets) { @@ -13,7 +13,10 @@ std::vector layers(const SeedingLayerSetsHits& sets) { const LayerSet & resSet = ir->first; if (resSet[0].index() == set[0].index() && resSet[1].index() == set[1].index()) { std::vector& thirds = ir->second; - thirds.push_back( set[2] ); + // 3rd layer can already be there if we are dealing with quadruplet layer sets + auto found = std::find_if(thirds.begin(), thirds.end(), [&](const Layer& l) { return l.index() == set[2].index(); }); + if(found == thirds.end()) + thirds.push_back( set[2] ); added = true; break; } From 556c7635703cfd8dfb3dad8cf5ab35245cec847d Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Mon, 2 May 2016 16:47:05 +0200 Subject: [PATCH 09/69] Produce pairs only for the necessary layers --- RecoTracker/TkHitPairs/plugins/BuildFile.xml | 1 + .../TkHitPairs/plugins/HitPairEDProducer.cc | 24 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/RecoTracker/TkHitPairs/plugins/BuildFile.xml b/RecoTracker/TkHitPairs/plugins/BuildFile.xml index b76e633119491..af7185a4200fb 100644 --- a/RecoTracker/TkHitPairs/plugins/BuildFile.xml +++ b/RecoTracker/TkHitPairs/plugins/BuildFile.xml @@ -1,5 +1,6 @@ + diff --git a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc index 3b1157eeba06e..0234eb7eda439 100644 --- a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc +++ b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc @@ -14,6 +14,7 @@ #include "RecoTracker/TkHitPairs/interface/HitPairGeneratorFromLayerPair.h" #include "RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h" #include "RecoTracker/TkSeedingLayers/interface/SeedingHitSet.h" +#include "RecoPixelVertexing/PixelTriplets/interface/LayerTriplets.h" class HitPairEDProducer: public edm::stream::EDProducer<> { public: @@ -90,14 +91,35 @@ void HitPairEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetu intermediateHitDoublets->reserve(regions.size(), layers.size()); } + LogDebug("HitPairEDProducer") << "Creating doublets for " << regions.size() << " and " << layers.size() << " layer sets"; + + // This is the easiest way to extract the layer pairs from the full + // set of seeding layers. It feels a bit stupid to do it for each + // event given the input is defined in configuration. Maybe do it + // once-per-job in SeedingLayerSetsEDProducer? + std::vector layerPairs; + if(layers.numberOfLayersInSet() > 2) { + std::vector trilayers = LayerTriplets::layers(layers); + layerPairs.reserve(trilayers.size()); + for(const auto& setAndLayers: trilayers) { + layerPairs.push_back(setAndLayers.first); + } + } + else { + layerPairs.reserve(layers.size()); + for(const auto& set: layers) + layerPairs.push_back(set); + } + for(const TrackingRegion& region: regions) { if(produceIntermediateHitDoublets_) { intermediateHitDoublets->beginRegion(®ion); } - for(SeedingLayerSetsHits::SeedingLayerSet layerSet: layers) { + for(SeedingLayerSetsHits::SeedingLayerSet layerSet: layerPairs) { LayerHitMapCache hitCache; auto doublets = generator_.doublets(region, iEvent, iSetup, layerSet, hitCache); + LogTrace("HitPairEDProducer") << " created " << doublets.size() << " doublets for layers " << layerSet[0].index() << "," << layerSet[1].index(); if(doublets.empty()) continue; // don't bother if no pairs from these layers if(produceSeedingHitSets_) { for(size_t i=0, size=doublets.size(); i Date: Tue, 17 May 2016 09:06:46 +0200 Subject: [PATCH 10/69] Switch IntermediateHitTriplets data layout to pair+3rd layers --- .../interface/HitTripletEDProducerT.h | 32 ++++---- .../interface/IntermediateHitTriplets.h | 74 ++++++++++++++----- .../plugins/PixelTripletHLTGenerator.cc | 11 ++- .../plugins/PixelTripletHLTGenerator.h | 4 +- 4 files changed, 82 insertions(+), 39 deletions(-) diff --git a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h index 1739e982d5ab3..5d2187f21140d 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h +++ b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h @@ -91,8 +91,9 @@ void HitTripletEDProducerT::produce(edm::Event& iEvent, c // match-making of pair and triplet layers std::vector trilayers = LayerTriplets::layers(seedingLayerHits); - std::vector thirdLayerHitBeginIndices; - thirdLayerHitBeginIndices.reserve(3); // Yes, vector is a bit overkill as there can be at most 3 3rd layers for a doublet. But better be consistent and migrate later everything to e.g. std::array or edm::VecArray. Except with phase1 there can be more than 3 3rd layers... + std::vector tripletLastLayerIndex; + tripletLastLayerIndex.reserve(localRA_.upper()); + std::vector tripletPermutation; // used to sort the triplets according to their last-hit layer OrderedHitTriplets triplets; triplets.reserve(localRA_.upper()); @@ -118,12 +119,13 @@ void HitTripletEDProducerT::produce(edm::Event& iEvent, c } throw exp; } + const auto& thirdLayers = found->second; LayerHitMapCache hitCache; hitCache.extend(layerPair.cache()); - thirdLayerHitBeginIndices.clear(); - generator_.hitTriplets(region, triplets, iEvent, iSetup, layerPair.doublets(), found->second, &thirdLayerHitBeginIndices, hitCache); + tripletLastLayerIndex.clear(); + generator_.hitTriplets(region, triplets, iEvent, iSetup, layerPair.doublets(), thirdLayers, &tripletLastLayerIndex, hitCache); if(triplets.empty()) continue; @@ -134,18 +136,20 @@ void HitTripletEDProducerT::produce(edm::Event& iEvent, c } } if(produceIntermediateHitTriplets_) { - if(thirdLayerHitBeginIndices.size() != trilayers.size()) { - throw cms::Exception("LogicError") << "thirdLayerHitBeginIndices.size() " << thirdLayerHitBeginIndices.size() - << " trilayers.size() " << trilayers.size(); - } - for(size_t i=0, size=trilayers.size(); iaddTriplets(found->first, found->second[i], - std::next(triplets.begin(), begin), std::next(triplets.begin(), end), - std::move(hitCache)); + if(tripletLastLayerIndex.size() != triplets.size()) { + throw cms::Exception("LogicError") << "tripletLastLayerIndex.size() " << tripletLastLayerIndex.size() + << " triplets.size() " << triplets.size(); } + tripletPermutation.resize(tripletLastLayerIndex.size()); + std::iota(tripletPermutation.begin(), tripletPermutation.end(), 0); // assign 0,1,2,...,N + std::stable_sort(tripletPermutation.begin(), tripletPermutation.end(), [&](size_t i, size_t j) { + return tripletLastLayerIndex[i] < tripletLastLayerIndex[j]; + }); + + intermediateHitTriplets->addTriplets(thirdLayers, triplets, tripletLastLayerIndex, tripletPermutation); } + + triplets.clear(); } } localRA_.update(triplets_total); diff --git a/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h b/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h index 79d86fee58da1..a89b63f580e8d 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h +++ b/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h @@ -12,6 +12,8 @@ */ class IntermediateHitTriplets { public: + using LayerPair = std::tuple; using LayerTriplet = std::tuple; @@ -19,18 +21,31 @@ class IntermediateHitTriplets { //////////////////// - class LayerTripletHitIndex { + class ThirdLayer { public: - LayerTripletHitIndex(const SeedingLayerSetsHits::SeedingLayerSet& layerPair, const SeedingLayerSetsHits::SeedingLayer& thirdLayer, - size_t begin, LayerHitMapCache&& cache): - layerTriplet_(layerPair[0].index(), layerPair[1].index(), thirdLayer.index()), - hitsBegin_(begin), - cache_(std::move(cache)) + ThirdLayer(const SeedingLayerSetsHits::SeedingLayer& thirdLayer, size_t hitsBegin): + thirdLayer_(thirdLayer.index()), hitsBegin_(hitsBegin) {} private: - LayerTriplet layerTriplet_; + SeedingLayerSetsHits::LayerIndex thirdLayer_; size_t hitsBegin_; + }; + + //////////////////// + + class LayerPairAndLayers { + public: + LayerPairAndLayers(const SeedingLayerSetsHits::SeedingLayerSet& layerPair, + size_t thirdLayersBegin, LayerHitMapCache&& cache): + layerPair_(layerPair[0].index(), layerPair[1].index()), + thirdLayersBegin_(thirdLayersBegin), + cache_(std::move(cache)) + {} + + private: + LayerPair layerPair_; + size_t thirdLayersBegin_; LayerHitMapCache cache_; }; @@ -44,38 +59,63 @@ class IntermediateHitTriplets { void swap(IntermediateHitTriplets& rh) { std::swap(seedingLayers_, rh.seedingLayers_); std::swap(regions_, rh.regions_); - std::swap(layerTriplets_, rh.layerTriplets_); + std::swap(layerPairAndLayers_, rh.layerPairAndLayers_); + std::swap(thirdLayers_, rh.thirdLayers_); std::swap(hitTriplets_, rh.hitTriplets_); } void reserve(size_t nregions, size_t nlayersets, size_t ntriplets) { regions_.reserve(nregions); - layerTriplets_.reserve(nregions*nlayersets); + layerPairAndLayers_.reserve(nregions*nlayersets); + thirdLayers_.reserve(nregions*nlayersets); hitTriplets_.reserve(ntriplets); } void shrink_to_fit() { regions_.shrink_to_fit(); - layerTriplets_.shrink_to_fit(); + layerPairAndLayers_.shrink_to_fit(); + thirdLayers_.shrink_to_fit(); hitTriplets_.shrink_to_fit(); } void beginRegion(const TrackingRegion *region) { - regions_.emplace_back(region, layerTriplets_.size()); + regions_.emplace_back(region, layerPairAndLayers_.size()); } - void addTriplets(const SeedingLayerSetsHits::SeedingLayerSet& layerPair, const SeedingLayerSetsHits::SeedingLayer& thirdLayer, - OrderedHitTriplets::iterator hitTripletsBegin, OrderedHitTriplets::iterator hitTripletsEnd, - LayerHitMapCache&& cache) { - layerTriplets_.emplace_back(layerPair, thirdLayer, std::distance(hitTripletsBegin, hitTripletsEnd), std::move(cache)); - std::move(hitTripletsBegin, hitTripletsEnd, std::back_inserter(hitTriplets_)); // probably not much different from std::copy as we're just moving pointers... + void beginPair(const SeedingLayerSetsHits::SeedingLayerSet& layerPair, LayerHitMapCache&& cache) { + layerPairAndLayers_.emplace_back(layerPair, thirdLayers_.size(), std::move(cache)); + }; + + void addTriplets(const std::vector& thirdLayers, + const OrderedHitTriplets& triplets, + const std::vector& thirdLayerIndex, + const std::vector& permutations) { + assert(triplets.size() == thirdLayerIndex.size()); + assert(triplets.size() == permutations.size()); + + int prevLayer = -1; + for(size_t i=0, size=permutations.size(); i regions_; - std::vector layerTriplets_; + std::vector layerPairAndLayers_; + std::vector thirdLayers_; std::vector hitTriplets_; }; diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.cc b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.cc index 96b880ec5734a..dd47c848322d4 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.cc @@ -87,7 +87,7 @@ void PixelTripletHLTGenerator::hitTriplets(const TrackingRegion& region, Ordered const edm::Event& ev, const edm::EventSetup& es, const HitDoublets& doublets, const std::vector& thirdLayers, - std::vector *thirdLayerHitBeginIndices, + std::vector *tripletLastLayerIndex, LayerCacheType& layerCache) { if (theComparitor) theComparitor->init(ev, es); @@ -99,7 +99,7 @@ void PixelTripletHLTGenerator::hitTriplets(const TrackingRegion& region, Ordered thirdHitMap[il] = &layerCache(thirdLayers[il], region, es); thirdLayerDetLayer[il] = thirdLayers[il].detLayer(); } - hitTriplets(region, result, es, doublets, thirdHitMap, thirdLayerDetLayer, size, thirdLayerHitBeginIndices); + hitTriplets(region, result, es, doublets, thirdHitMap, thirdLayerDetLayer, size, tripletLastLayerIndex); } void PixelTripletHLTGenerator::hitTriplets( @@ -120,7 +120,7 @@ void PixelTripletHLTGenerator::hitTriplets(const TrackingRegion& region, Ordered const RecHitsSortedInPhi ** thirdHitMap, const std::vector & thirdLayerDetLayer, const int nThirdLayers, - std::vector *thirdLayerHitBeginIndices) { + std::vector *tripletLastLayerIndex) { auto outSeq = doublets.detLayer(HitDoublets::outer)->seqNum(); float regOffset = region.origin().perp(); //try to take account of non-centrality (?) @@ -208,9 +208,6 @@ void PixelTripletHLTGenerator::hitTriplets(const TrackingRegion& region, Ordered const DetLayer * layer = thirdLayerDetLayer[il]; auto barrelLayer = layer->isBarrel(); - // to bookkeep the triplets and 3rd layers in triplet EDProducer - if(thirdLayerHitBeginIndices) thirdLayerHitBeginIndices->push_back(result.size()); - if ( (!barrelLayer) & (toPos != std::signbit(layer->position().z())) ) continue; if (hitTree[il].empty()) continue; // Don't bother if no hits @@ -349,6 +346,8 @@ void PixelTripletHLTGenerator::hitTriplets(const TrackingRegion& region, Ordered OrderedHitTriplet hittriplet( doublets.hit(ip,HitDoublets::inner), doublets.hit(ip,HitDoublets::outer), hits.theHits[KDdata].hit()); if (!theComparitor || theComparitor->compatible(hittriplet) ) { result.push_back( hittriplet ); + // to bookkeep the triplets and 3rd layers in triplet EDProducer + if(tripletLastLayerIndex) tripletLastLayerIndex->push_back(il); } else { LogDebug("RejectedTriplet") << "rejected triplet from comparitor "; } diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.h b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.h index 843951bd4541b..ae791997d8d0f 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.h +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.h @@ -39,7 +39,7 @@ typedef CombinedHitTripletGenerator::LayerCacheType LayerCacheType; const edm::Event& ev, const edm::EventSetup& es, const HitDoublets& doublets, const std::vector& thirdLayers, - std::vector *thirdLayerHitBeginIndices, + std::vector *tripletLastLayerIndex, LayerCacheType& layerCache); void hitTriplets( @@ -57,7 +57,7 @@ typedef CombinedHitTripletGenerator::LayerCacheType LayerCacheType; const RecHitsSortedInPhi ** thirdHitMap, const std::vector & thirdLayerDetLayer, const int nThirdLayers, - std::vector *thirdLayerHitBeginIndices); + std::vector *tripletLastLayerIndex); private: const bool useFixedPreFiltering; From bb0aa1910d9e60744fae698789e13caf151a608a Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 2 Aug 2016 10:03:21 +0200 Subject: [PATCH 11/69] Finalize IntermediateHitTriplets Especially add end for hits and third layers. Makes life much easier even if requires a bit more memory. --- .../interface/HitTripletEDProducerT.h | 22 ++- .../interface/IntermediateHitTriplets.h | 176 +++++++++++++++++- .../interface/IntermediateHitDoublets.h | 1 + 3 files changed, 188 insertions(+), 11 deletions(-) diff --git a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h index 5d2187f21140d..f5c4950eb7b82 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h +++ b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h @@ -99,11 +99,17 @@ void HitTripletEDProducerT::produce(edm::Event& iEvent, c triplets.reserve(localRA_.upper()); size_t triplets_total = 0; + LogDebug("HitTripletEDProducer") << "Creating triplets for " << regionDoublets.regionSize() << " regions, and " << trilayers.size() << " pair+3rd layers from " << regionDoublets.layerPairsSize() << " layer pairs"; + for(const auto& regionLayerPairs: regionDoublets) { const TrackingRegion& region = regionLayerPairs.region(); intermediateHitTriplets->beginRegion(®ion); + LogTrace("HitTripletEDProducer") << " starting region"; + for(const auto& layerPair: regionLayerPairs) { + LogTrace("HitTripletEDProducer") << " starting layer pair " << layerPair.innerLayerIndex() << "," << layerPair.outerLayerIndex(); + auto found = std::find_if(trilayers.begin(), trilayers.end(), [&](const LayerTriplets::LayerSetAndLayers& a) { return a.first[0].index() == layerPair.innerLayerIndex() && a.first[1].index() == layerPair.outerLayerIndex(); }); @@ -123,11 +129,20 @@ void HitTripletEDProducerT::produce(edm::Event& iEvent, c LayerHitMapCache hitCache; hitCache.extend(layerPair.cache()); + LayerHitMapCache *hitCachePtr = &hitCache; + if(produceIntermediateHitTriplets_) { + hitCachePtr = intermediateHitTriplets->beginPair(layerPair.layerPair(), std::move(hitCache)); + } tripletLastLayerIndex.clear(); - generator_.hitTriplets(region, triplets, iEvent, iSetup, layerPair.doublets(), thirdLayers, &tripletLastLayerIndex, hitCache); - if(triplets.empty()) - continue; + generator_.hitTriplets(region, triplets, iEvent, iSetup, layerPair.doublets(), thirdLayers, &tripletLastLayerIndex, *hitCachePtr); + +#ifdef EDM_ML_DEBUG + LogTrace("HitTripletEDProducer") << " created " << triplets.size() << " triplets for layer pair " << layerPair.innerLayerIndex() << "," << layerPair.outerLayerIndex() << " and 3rd layers"; + for(const auto& l: thirdLayers) { + LogTrace("HitTripletEDProducer") << " " << l.index(); + } +#endif triplets_total += triplets.size(); if(produceSeedingHitSets_) { @@ -146,6 +161,7 @@ void HitTripletEDProducerT::produce(edm::Event& iEvent, c return tripletLastLayerIndex[i] < tripletLastLayerIndex[j]; }); + // empty triplets need to propagate here intermediateHitTriplets->addTriplets(thirdLayers, triplets, tripletLastLayerIndex, tripletPermutation); } diff --git a/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h b/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h index a89b63f580e8d..9d7bf642c922f 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h +++ b/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h @@ -23,34 +23,162 @@ class IntermediateHitTriplets { class ThirdLayer { public: - ThirdLayer(const SeedingLayerSetsHits::SeedingLayer& thirdLayer, size_t hitsBegin): - thirdLayer_(thirdLayer.index()), hitsBegin_(hitsBegin) + ThirdLayer(const SeedingLayerSetsHits::SeedingLayer& thirdLayer, unsigned int hitsBegin): + thirdLayer_(thirdLayer.index()), hitsBegin_(hitsBegin), hitsEnd_(hitsBegin) {} + void setHitsEnd(unsigned int end) { hitsEnd_ = end; } + + SeedingLayerSetsHits::LayerIndex layerIndex() const { return thirdLayer_; } + private: SeedingLayerSetsHits::LayerIndex thirdLayer_; - size_t hitsBegin_; + unsigned int hitsBegin_; + unsigned int hitsEnd_; }; //////////////////// class LayerPairAndLayers { public: - LayerPairAndLayers(const SeedingLayerSetsHits::SeedingLayerSet& layerPair, - size_t thirdLayersBegin, LayerHitMapCache&& cache): - layerPair_(layerPair[0].index(), layerPair[1].index()), + LayerPairAndLayers(const LayerPair& layerPair, + unsigned int thirdLayersBegin, LayerHitMapCache&& cache): + layerPair_(layerPair), thirdLayersBegin_(thirdLayersBegin), + thirdLayersEnd_(thirdLayersBegin), cache_(std::move(cache)) {} + void setThirdLayersEnd(unsigned int end) { thirdLayersEnd_ = end; } + + const LayerPair& layerPair() const { return layerPair_; } + unsigned int thirdLayersBegin() const { return thirdLayersBegin_; } + unsigned int thirdLayersEnd() const { return thirdLayersEnd_; } + + LayerHitMapCache& cache() { return cache_; } + const LayerHitMapCache& cache() const { return cache_; } + private: LayerPair layerPair_; - size_t thirdLayersBegin_; + unsigned int thirdLayersBegin_; + unsigned int thirdLayersEnd_; + // The reason for not storing layer triplets + hit triplets + // directly is in this cache, and in my desire to try to keep + // results unchanged during this refactoring LayerHitMapCache cache_; }; //////////////////// + class LayerTripletHits { + public: + LayerTripletHits(const LayerPairAndLayers *layerPairAndLayers, + const ThirdLayer *thirdLayer): + layerPairAndLayers_(layerPairAndLayers), + thirdLayer_(thirdLayer) + {} + + SeedingLayerSetsHits::LayerIndex innerLayerIndex() const { return std::get<0>(layerPairAndLayers_->layerPair()); } + SeedingLayerSetsHits::LayerIndex middleLayerIndex() const { return std::get<1>(layerPairAndLayers_->layerPair()); } + SeedingLayerSetsHits::LayerIndex outerLayerIndex() const { return thirdLayer_->layerIndex(); } + + const LayerHitMapCache& cache() const { return layerPairAndLayers_->cache(); } + private: + const LayerPairAndLayers *layerPairAndLayers_; + const ThirdLayer *thirdLayer_; + }; + + //////////////////// + + class RegionLayerHits { + public: + using LayerPairAndLayersConstIterator = std::vector::const_iterator; + using ThirdLayerConstIterator = std::vector::const_iterator; + using HitConstIterator = std::vector::const_iterator; + + class const_iterator { + public: + using internal_iterator_type = LayerPairAndLayersConstIterator; + using value_type = LayerTripletHits; + using difference_type = internal_iterator_type::difference_type; + + const_iterator(const RegionLayerHits *regionLayerHits): + regionLayerHits_(regionLayerHits), + iterPair_(regionLayerHits->layerSetsBegin()), + indThird_(iterPair_->thirdLayersBegin()) + { + assert(regionLayerHits->layerSetsBegin() != regionLayerHits->layerSetsEnd()); + } + + value_type operator*() const { + return value_type(&(*iterPair_), &(*(regionLayerHits_->thirdLayerBegin() + indThird_))); + } + + const_iterator& operator++() { + auto nextThird = indThird_+1; + if(nextThird == iterPair_->thirdLayersEnd()) { + ++iterPair_; + indThird_ = iterPair_->thirdLayersBegin(); + } + else { + indThird_ = nextThird; + } + return *this; + } + + const_iterator operator++(int) { + const_iterator clone(*this); + operator++(); + return clone; + } + + bool operator==(const const_iterator& other) const { return iterPair_ == other.iterPair_ && indThird_ == other.indThird_; } + bool operator!=(const const_iterator& other) const { return !operator==(other); } + + private: + const RegionLayerHits *regionLayerHits_; + internal_iterator_type iterPair_; + unsigned int indThird_; + }; + + RegionLayerHits(const TrackingRegion* region, + LayerPairAndLayersConstIterator pairBegin, LayerPairAndLayersConstIterator pairEnd, + ThirdLayerConstIterator thirdBegin, ThirdLayerConstIterator thirdEnd): + region_(region), + layerSetsBegin_(pairBegin), layerSetsEnd_(pairEnd), + thirdBegin_(thirdBegin), thirdEnd_(thirdEnd) + {} + + const TrackingRegion& region() const { return *region_; } + size_t layerPairAndLayersSize() const { return std::distance(layerSetsBegin_, layerSetsEnd_); } + + /* + const_iterator begin() const { return layerSetsBegin_; } + const_iterator cbegin() const { return begin(); } + const_iterator end() const { return layerSetsEnd_; } + const_iterator cend() const { return end(); } + */ + + // used internally + LayerPairAndLayersConstIterator layerSetsBegin() const { return layerSetsBegin_; } + LayerPairAndLayersConstIterator layerSetsEnd() const { return layerSetsEnd_; } + ThirdLayerConstIterator thirdLayerBegin() const { return thirdBegin_; } + ThirdLayerConstIterator thirdLayerEnd() const { return thirdEnd_; } + + private: + const TrackingRegion *region_; + const LayerPairAndLayersConstIterator layerSetsBegin_; + const LayerPairAndLayersConstIterator layerSetsEnd_; + const ThirdLayerConstIterator thirdBegin_; + const ThirdLayerConstIterator thirdEnd_; + }; + + //////////////////// + + using const_iterator = ihd::const_iterator; + + //////////////////// + IntermediateHitTriplets(): seedingLayers_(nullptr) {} explicit IntermediateHitTriplets(const SeedingLayerSetsHits *seedingLayers): seedingLayers_(seedingLayers) {} IntermediateHitTriplets(const IntermediateHitTriplets& rh); // only to make ROOT dictionary generation happy @@ -82,8 +210,9 @@ class IntermediateHitTriplets { regions_.emplace_back(region, layerPairAndLayers_.size()); } - void beginPair(const SeedingLayerSetsHits::SeedingLayerSet& layerPair, LayerHitMapCache&& cache) { + LayerHitMapCache *beginPair(const LayerPair& layerPair, LayerHitMapCache&& cache) { layerPairAndLayers_.emplace_back(layerPair, thirdLayers_.size(), std::move(cache)); + return &(layerPairAndLayers_.back().cache()); }; void addTriplets(const std::vector& thirdLayers, @@ -93,6 +222,13 @@ class IntermediateHitTriplets { assert(triplets.size() == thirdLayerIndex.size()); assert(triplets.size() == permutations.size()); + if(triplets.empty()) { + // In absence of triplets for a layer pair simplest is just + // remove the pair + popPair(); + return; + } + int prevLayer = -1; for(size_t i=0, size=permutations.size(); i::const_iterator regionsBegin() const { return regions_.begin(); } + std::vector::const_iterator regionsEnd() const { return regions_.end(); } + std::vector::const_iterator layerSetsBegin() const { return layerPairAndLayers_.begin(); } + std::vector::const_iterator layerSetsEnd() const { return layerPairAndLayers_.end(); } + private: + // to be called if no triplets are added + void popPair() { + layerPairAndLayers_.pop_back(); + } + const SeedingLayerSetsHits *seedingLayers_; std::vector regions_; diff --git a/RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h b/RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h index 239c0b3ba07b7..6d0d872bb779c 100644 --- a/RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h +++ b/RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h @@ -94,6 +94,7 @@ class IntermediateHitDoublets { cache_(std::move(cache)) {} + const LayerPair& layerPair() const { return layerPair_; } SeedingLayerSetsHits::LayerIndex innerLayerIndex() const { return std::get<0>(layerPair_); } SeedingLayerSetsHits::LayerIndex outerLayerIndex() const { return std::get<1>(layerPair_); } From 8e4d2bc03fdffb17c433512557f55975da663ee2 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 19 Jul 2016 11:18:29 +0200 Subject: [PATCH 12/69] Add PixelQuadrupletEDProducer Not templated as HitTripletProducerT, as all currently existing 3 quadruplet algorithms (PixelQuadrupletGenerator, CAHitQuadrupletGenerator, and QuadrupletSeedMerger) need different interface and hence separate EDProducers. --- .../interface/IntermediateHitTriplets.h | 68 +++++++--- .../plugins/PixelQuadrupletEDProducer.cc | 123 ++++++++++++++++++ .../plugins/PixelQuadrupletGenerator.cc | 51 +++++++- .../plugins/PixelQuadrupletGenerator.h | 12 ++ .../interface/IntermediateHitDoublets.h | 5 +- 5 files changed, 236 insertions(+), 23 deletions(-) create mode 100644 RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc diff --git a/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h b/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h index 9d7bf642c922f..944d1fbc80ed5 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h +++ b/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h @@ -31,6 +31,9 @@ class IntermediateHitTriplets { SeedingLayerSetsHits::LayerIndex layerIndex() const { return thirdLayer_; } + unsigned int tripletsBegin() const { return hitsBegin_; } + unsigned int tripletsEnd() const { return hitsEnd_; } + private: SeedingLayerSetsHits::LayerIndex thirdLayer_; unsigned int hitsBegin_; @@ -72,18 +75,27 @@ class IntermediateHitTriplets { class LayerTripletHits { public: - LayerTripletHits(const LayerPairAndLayers *layerPairAndLayers, + LayerTripletHits(const IntermediateHitTriplets *hitSets, + const LayerPairAndLayers *layerPairAndLayers, const ThirdLayer *thirdLayer): + hitSets_(hitSets), layerPairAndLayers_(layerPairAndLayers), thirdLayer_(thirdLayer) {} + using TripletRange = std::pair::const_iterator, + std::vector::const_iterator>; + SeedingLayerSetsHits::LayerIndex innerLayerIndex() const { return std::get<0>(layerPairAndLayers_->layerPair()); } SeedingLayerSetsHits::LayerIndex middleLayerIndex() const { return std::get<1>(layerPairAndLayers_->layerPair()); } SeedingLayerSetsHits::LayerIndex outerLayerIndex() const { return thirdLayer_->layerIndex(); } + std::vector::const_iterator tripletsBegin() const { return hitSets_->tripletsBegin() + thirdLayer_->tripletsBegin(); } + std::vector::const_iterator tripletsEnd() const { return hitSets_->tripletsBegin() + thirdLayer_->tripletsEnd(); } + const LayerHitMapCache& cache() const { return layerPairAndLayers_->cache(); } private: + const IntermediateHitTriplets *hitSets_; const LayerPairAndLayers *layerPairAndLayers_; const ThirdLayer *thirdLayer_; }; @@ -94,7 +106,7 @@ class IntermediateHitTriplets { public: using LayerPairAndLayersConstIterator = std::vector::const_iterator; using ThirdLayerConstIterator = std::vector::const_iterator; - using HitConstIterator = std::vector::const_iterator; + using TripletConstIterator = std::vector::const_iterator; class const_iterator { public: @@ -102,7 +114,10 @@ class IntermediateHitTriplets { using value_type = LayerTripletHits; using difference_type = internal_iterator_type::difference_type; - const_iterator(const RegionLayerHits *regionLayerHits): + struct end_tag {}; + + const_iterator(const IntermediateHitTriplets *hitSets, const RegionLayerHits *regionLayerHits): + hitSets_(hitSets), regionLayerHits_(regionLayerHits), iterPair_(regionLayerHits->layerSetsBegin()), indThird_(iterPair_->thirdLayersBegin()) @@ -110,15 +125,26 @@ class IntermediateHitTriplets { assert(regionLayerHits->layerSetsBegin() != regionLayerHits->layerSetsEnd()); } + const_iterator(const IntermediateHitTriplets *hitSets, const RegionLayerHits *regionLayerHits, end_tag): + iterPair_(regionLayerHits->layerSetsEnd()), + indThird_(std::numeric_limits::max()) + {} + value_type operator*() const { - return value_type(&(*iterPair_), &(*(regionLayerHits_->thirdLayerBegin() + indThird_))); + assert(static_cast(indThird_) < std::distance(hitSets_->thirdLayersBegin(), hitSets_->thirdLayersEnd())); + return value_type(hitSets_, &(*iterPair_), &(*(hitSets_->thirdLayersBegin() + indThird_))); } const_iterator& operator++() { auto nextThird = indThird_+1; if(nextThird == iterPair_->thirdLayersEnd()) { ++iterPair_; - indThird_ = iterPair_->thirdLayersBegin(); + if(iterPair_ != regionLayerHits_->layerSetsEnd()) { + indThird_ = iterPair_->thirdLayersBegin(); + } + else { + indThird_ = std::numeric_limits::max(); + } } else { indThird_ = nextThird; @@ -136,41 +162,43 @@ class IntermediateHitTriplets { bool operator!=(const const_iterator& other) const { return !operator==(other); } private: + const IntermediateHitTriplets *hitSets_; const RegionLayerHits *regionLayerHits_; internal_iterator_type iterPair_; unsigned int indThird_; }; RegionLayerHits(const TrackingRegion* region, - LayerPairAndLayersConstIterator pairBegin, LayerPairAndLayersConstIterator pairEnd, - ThirdLayerConstIterator thirdBegin, ThirdLayerConstIterator thirdEnd): + const IntermediateHitTriplets *hitSets, + LayerPairAndLayersConstIterator pairBegin, + LayerPairAndLayersConstIterator pairEnd): region_(region), - layerSetsBegin_(pairBegin), layerSetsEnd_(pairEnd), - thirdBegin_(thirdBegin), thirdEnd_(thirdEnd) + hitSets_(hitSets), + layerSetsBegin_(pairBegin), layerSetsEnd_(pairEnd) {} const TrackingRegion& region() const { return *region_; } size_t layerPairAndLayersSize() const { return std::distance(layerSetsBegin_, layerSetsEnd_); } - /* - const_iterator begin() const { return layerSetsBegin_; } + const_iterator begin() const { + if(layerSetsBegin_ != layerSetsEnd_) + return const_iterator(hitSets_, this); + else + return end(); + } const_iterator cbegin() const { return begin(); } - const_iterator end() const { return layerSetsEnd_; } + const_iterator end() const { return const_iterator(hitSets_, this, const_iterator::end_tag()); } const_iterator cend() const { return end(); } - */ // used internally LayerPairAndLayersConstIterator layerSetsBegin() const { return layerSetsBegin_; } LayerPairAndLayersConstIterator layerSetsEnd() const { return layerSetsEnd_; } - ThirdLayerConstIterator thirdLayerBegin() const { return thirdBegin_; } - ThirdLayerConstIterator thirdLayerEnd() const { return thirdEnd_; } private: - const TrackingRegion *region_; + const TrackingRegion *region_ = nullptr; + const IntermediateHitTriplets *hitSets_ = nullptr; const LayerPairAndLayersConstIterator layerSetsBegin_; const LayerPairAndLayersConstIterator layerSetsEnd_; - const ThirdLayerConstIterator thirdBegin_; - const ThirdLayerConstIterator thirdEnd_; }; //////////////////// @@ -264,6 +292,10 @@ class IntermediateHitTriplets { std::vector::const_iterator regionsEnd() const { return regions_.end(); } std::vector::const_iterator layerSetsBegin() const { return layerPairAndLayers_.begin(); } std::vector::const_iterator layerSetsEnd() const { return layerPairAndLayers_.end(); } + std::vector::const_iterator thirdLayersBegin() const { return thirdLayers_.begin(); } + std::vector::const_iterator thirdLayersEnd() const { return thirdLayers_.end(); } + std::vector::const_iterator tripletsBegin() const { return hitTriplets_.begin(); } + std::vector::const_iterator tripletsEnd() const { return hitTriplets_.end(); } private: // to be called if no triplets are added diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc new file mode 100644 index 0000000000000..fee90205b1bf8 --- /dev/null +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc @@ -0,0 +1,123 @@ +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Utilities/interface/EDGetToken.h" +#include "FWCore/Framework/interface/Event.h" +#include "DataFormats/Common/interface/Handle.h" +#include "FWCore/Utilities/interface/RunningAverage.h" + +#include "RecoTracker/TkSeedingLayers/interface/SeedingHitSet.h" +#include "RecoPixelVertexing/PixelTriplets/interface/OrderedHitSeeds.h" +#include "RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h" + +#include "PixelQuadrupletGenerator.h" +#include "LayerQuadruplets.h" + +class PixelQuadrupletEDProducer: public edm::stream::EDProducer<> { +public: + PixelQuadrupletEDProducer(const edm::ParameterSet& iConfig); + ~PixelQuadrupletEDProducer() = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + virtual void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override; + +private: + edm::EDGetTokenT tripletToken_; + + edm::RunningAverage localRA_; + + PixelQuadrupletGenerator generator_; +}; + +PixelQuadrupletEDProducer::PixelQuadrupletEDProducer(const edm::ParameterSet& iConfig): + tripletToken_(consumes(iConfig.getParameter("triplets"))), + generator_(iConfig, consumesCollector()) +{ + produces >(); +} + +void PixelQuadrupletEDProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + + desc.add("triplets", edm::InputTag("hitTripletEDProducer")); + PixelQuadrupletGenerator::fillDescriptions(desc); + + descriptions.add("pixelQuadrupletEDProducer", desc); +} + +void PixelQuadrupletEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + edm::Handle htriplets; + iEvent.getByToken(tripletToken_, htriplets); + const auto& regionTriplets = *htriplets; + + const SeedingLayerSetsHits& seedingLayerHits = regionTriplets.seedingLayerHits(); + if(seedingLayerHits.numberOfLayersInSet() < 4) { + throw cms::Exception("Configuration") << "PixelQuadrupletEDProducer expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= 4, got " << seedingLayerHits.numberOfLayersInSet(); + } + + auto seedingHitSets = std::make_unique >(); + seedingHitSets->reserve(localRA_.upper()); + + // match-making of triplet and quadruplet layers + std::vector quadlayers = LayerQuadruplets::layers(seedingLayerHits); + + LogDebug("PixelQuadrupletEDProducer") << "Creating quadruplets for " << regionTriplets.regionSize() << " regions, and " << quadlayers.size() << " triplet+4th layers from " << regionTriplets.tripletsSize() << " triplets"; + + OrderedHitSeeds quadruplets; + quadruplets.reserve(localRA_.upper()); + + for(const auto& regionLayerPairAndLayers: regionTriplets) { + const TrackingRegion& region = regionLayerPairAndLayers.region(); + + LogTrace("PixelQuadrupletEDProducer") << " starting region, number of layerPair+3rd layers " << regionLayerPairAndLayers.layerPairAndLayersSize(); + + for(const auto& layerTriplet: regionLayerPairAndLayers) { + LogTrace("PixelQuadrupletEDProducer") << " starting layer triplet " << layerTriplet.innerLayerIndex() << "," << layerTriplet.middleLayerIndex() << "," << layerTriplet.outerLayerIndex(); + auto found = std::find_if(quadlayers.begin(), quadlayers.end(), [&](const LayerQuadruplets::LayerSetAndLayers& a) { + return a.first[0].index() == layerTriplet.innerLayerIndex() && + a.first[1].index() == layerTriplet.middleLayerIndex() && + a.first[2].index() == layerTriplet.outerLayerIndex(); + }); + if(found == quadlayers.end()) { + auto exp = cms::Exception("LogicError") << "Did not find the layer triplet from vector. This is a sign of some internal inconsistency\n"; + exp << "I was looking for layer triplet " << layerTriplet.innerLayerIndex() << "," << layerTriplet.middleLayerIndex() << "," << layerTriplet.outerLayerIndex() + << ". Quadruplets have the following triplets:\n"; + for(const auto& a: quadlayers) { + exp << " " << a.first[0].index() << "," << a.first[1].index() << "," << a.first[2].index() << ": 4th layers"; + for(const auto& b: a.second) { + exp << " " << b.index(); + } + exp << "\n"; + } + throw exp; + } + const auto& fourthLayers = found->second; + + LayerHitMapCache hitCache; + hitCache.extend(layerTriplet.cache()); + + generator_.hitQuadruplets(region, quadruplets, iEvent, iSetup, layerTriplet.tripletsBegin(), layerTriplet.tripletsEnd(), fourthLayers, hitCache); + +#ifdef EDM_ML_DEBUG + LogTrace("PixelQuadrupletEDProducer") << " created " << quadruplets.size() << " quadruplets for layer triplet " << layerTriplet.innerLayerIndex() << "," << layerTriplet.middleLayerIndex() << "," << layerTriplet.outerLayerIndex() << " and 4th layers"; + for(const auto& l: fourthLayers) { + LogTrace("PixelQuadrupletEDProducer") << " " << l.index(); + } +#endif + + for(const auto& quad: quadruplets) { + seedingHitSets->emplace_back(quad[0], quad[1], quad[2], quad[3]); + } + quadruplets.clear(); + } + } + localRA_.update(seedingHitSets->size()); + + iEvent.put(std::move(seedingHitSets)); +} + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(PixelQuadrupletEDProducer); diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletGenerator.cc b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletGenerator.cc index a9f6b9c6894f7..bb27c9f82485d 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletGenerator.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletGenerator.cc @@ -2,6 +2,7 @@ #include "ThirdHitRZPrediction.h" #include "RecoPixelVertexing/PixelTriplets/interface/ThirdHitPredictionFromCircle.h" #include "RecoTracker/TkMSParametrization/interface/PixelRecoLineRZ.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "RecoPixelVertexing/PixelTriplets/plugins/KDTreeLinkerAlgo.h" #include "RecoPixelVertexing/PixelTriplets/plugins/KDTreeLinkerTools.h" @@ -50,20 +51,61 @@ PixelQuadrupletGenerator::PixelQuadrupletGenerator(const edm::ParameterSet& cfg, PixelQuadrupletGenerator::~PixelQuadrupletGenerator() {} +void PixelQuadrupletGenerator::fillDescriptions(edm::ParameterSetDescription& desc) { + desc.add("extraHitRZtolerance", 0.1); + desc.add("extraHitRPhitolerance", 0.1); + + edm::ParameterSetDescription descExtraPhi; + descExtraPhi.add("pt1", 0.1); + descExtraPhi.add("pt2", 0.1); + descExtraPhi.add("value1", 999); + descExtraPhi.add("value2", 0.15); + descExtraPhi.add("enabled", false); + desc.add("extraPhiTolerance", descExtraPhi); + + edm::ParameterSetDescription descMaxChi2; + descMaxChi2.add("pt1", 0.2); + descMaxChi2.add("pt2", 1.5); + descMaxChi2.add("value1", 500); + descMaxChi2.add("value2", 50); + descMaxChi2.add("enabled", true); + desc.add("maxChi2", descMaxChi2); + + desc.add("fitFastCircle", false); + desc.add("fitFastCircleChi2Cut", false); + desc.add("useBendingCorrection", false); + + edm::ParameterSetDescription descComparitor; + descComparitor.add("ComponentName", "none"); + descComparitor.setAllowAnything(); // until we have moved SeedComparitor too to EDProducers + desc.add("SeedComparitorPSet", descComparitor); +} + void PixelQuadrupletGenerator::hitQuadruplets(const TrackingRegion& region, OrderedHitSeeds& result, const edm::Event& ev, const edm::EventSetup& es, const SeedingLayerSetsHits::SeedingLayerSet& tripletLayers, const std::vector& fourthLayers) { - if (theComparitor) theComparitor->init(ev, es); - OrderedHitTriplets triplets; theTripletGenerator->hitTriplets(region, triplets, ev, es, tripletLayers, // pair generator picks the correct two layers from these std::vector{tripletLayers[2]}); if(triplets.empty()) return; + assert(theLayerCache); + hitQuadruplets(region, result, ev, es, triplets.begin(), triplets.end(), fourthLayers, *theLayerCache); +} + +void PixelQuadrupletGenerator::hitQuadruplets(const TrackingRegion& region, OrderedHitSeeds& result, + const edm::Event& ev, const edm::EventSetup& es, + OrderedHitTriplets::const_iterator tripletsBegin, + OrderedHitTriplets::const_iterator tripletsEnd, + const std::vector& fourthLayers, + LayerCacheType& layerCache) +{ + if (theComparitor) theComparitor->init(ev, es); + const size_t size = fourthLayers.size(); const RecHitsSortedInPhi *fourthHitMap[size]; @@ -80,7 +122,7 @@ void PixelQuadrupletGenerator::hitQuadruplets(const TrackingRegion& region, Orde // Build KDtrees for(size_t il=0; il!=size; ++il) { - fourthHitMap[il] = &(*theLayerCache)(fourthLayers[il], region, es); + fourthHitMap[il] = &(layerCache)(fourthLayers[il], region, es); auto const& hits = *fourthHitMap[il]; ThirdHitRZPrediction & pred = preds[il]; @@ -122,7 +164,8 @@ void PixelQuadrupletGenerator::hitQuadruplets(const TrackingRegion& region, Orde std::array barrels; // Loop over triplets - for(const auto& triplet: triplets) { + for(auto iTriplet = tripletsBegin; iTriplet != tripletsEnd; ++iTriplet) { + const auto& triplet = *iTriplet; GlobalPoint gp0 = triplet.inner()->globalPosition(); GlobalPoint gp1 = triplet.middle()->globalPosition(); GlobalPoint gp2 = triplet.outer()->globalPosition(); diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletGenerator.h b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletGenerator.h index edf4caa4eef86..85d3141ffdee7 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletGenerator.h +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletGenerator.h @@ -21,15 +21,25 @@ class PixelQuadrupletGenerator : public HitQuadrupletGeneratorFromTripletAndLaye typedef CombinedHitQuadrupletGenerator::LayerCacheType LayerCacheType; public: + PixelQuadrupletGenerator( const edm::ParameterSet& cfg, edm::ConsumesCollector&& iC): PixelQuadrupletGenerator(cfg, iC) {} PixelQuadrupletGenerator( const edm::ParameterSet& cfg, edm::ConsumesCollector& iC); virtual ~PixelQuadrupletGenerator(); + static void fillDescriptions(edm::ParameterSetDescription& desc); + virtual void hitQuadruplets( const TrackingRegion& region, OrderedHitSeeds& result, const edm::Event & ev, const edm::EventSetup& es, const SeedingLayerSetsHits::SeedingLayerSet& tripletLayers, const std::vector& fourthLayers) override; + void hitQuadruplets( const TrackingRegion& region, OrderedHitSeeds& result, + const edm::Event& ev, const edm::EventSetup& es, + OrderedHitTriplets::const_iterator tripletsBegin, + OrderedHitTriplets::const_iterator tripletsEnd, + const std::vector& fourthLayers, + LayerCacheType& layerCache); + private: std::unique_ptr theComparitor; @@ -39,6 +49,8 @@ typedef CombinedHitQuadrupletGenerator::LayerCacheType LayerCacheType; value1_(v1), value2_(v2), curvature1_(c1), curvature2_(c2) {} + static void fillDescriptions(edm::ParameterSetDescription& desc); + float value(float curvature) const { if(value1_ == value2_) // not enabled return value1_; diff --git a/RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h b/RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h index 6d0d872bb779c..26521f57aedef 100644 --- a/RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h +++ b/RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h @@ -30,7 +30,9 @@ namespace ihd { public: using const_iterator = typename std::vector::const_iterator; - RegionLayerHits(const TrackingRegion* region, const_iterator begin, const_iterator end): + // Taking T* to have compatible interface with IntermediateHitTriplets::RegionLayerHits + template + RegionLayerHits(const TrackingRegion* region, const TMP*, const_iterator begin, const_iterator end): region_(region), layerSetsBegin_(begin), layerSetsEnd_(end) {} const TrackingRegion& region() const { return *region_; } @@ -57,6 +59,7 @@ namespace ihd { value_type operator*() const { return value_type(&(iter_->region()), + hitSets_, hitSets_->layerSetsBegin() + iter_->layerSetBeginIndex(), hitSets_->layerSetsBegin() + iter_->layerSetEndIndex()); } From 41a159b2ec4be2c6bd5f09dbf6c0c4c5eef82728 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 29 Jul 2016 12:54:33 +0200 Subject: [PATCH 13/69] Add RegionsSeedingHitSets and migrate {HitPair,HitTriplet,PixelQuadruplet}EDProducers to produce it --- .../interface/HitTripletEDProducerT.h | 21 ++++-- .../plugins/PixelQuadrupletEDProducer.cc | 11 +-- .../interface/RegionsSeedingHitSets.h | 68 +++++++++++++++++++ .../TkHitPairs/plugins/HitPairEDProducer.cc | 18 +++-- RecoTracker/TkHitPairs/src/classes.h | 4 ++ RecoTracker/TkHitPairs/src/classes_def.xml | 2 + 6 files changed, 105 insertions(+), 19 deletions(-) create mode 100644 RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h diff --git a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h index f5c4950eb7b82..fd8ae1440001f 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h +++ b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h @@ -12,7 +12,7 @@ #include "FWCore/Utilities/interface/RunningAverage.h" #include "RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h" -#include "RecoTracker/TkSeedingLayers/interface/SeedingHitSet.h" +#include "RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h" #include "RecoPixelVertexing/PixelTriplets/interface/OrderedHitTriplets.h" #include "RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h" #include "RecoPixelVertexing/PixelTriplets/interface/LayerTriplets.h" @@ -48,7 +48,7 @@ HitTripletEDProducerT::HitTripletEDProducerT(const edm::P if(!produceIntermediateHitTriplets_ && !produceSeedingHitSets_) throw cms::Exception("Configuration") << "HitTripletEDProducerT requires either produceIntermediateHitTriplets or produceSeedingHitSets to be True. If neither are needed, just remove this module from your sequence/path as it doesn't do anything useful"; if(produceSeedingHitSets_) - produces >(); + produces(); if(produceIntermediateHitTriplets_) produces(); } @@ -78,10 +78,10 @@ void HitTripletEDProducerT::produce(edm::Event& iEvent, c throw cms::Exception("Configuration") << "HitTripletEDProducerT expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= 3, got " << seedingLayerHits.numberOfLayersInSet(); } - std::unique_ptr > seedingHitSets; + std::unique_ptr seedingHitSets; if(produceSeedingHitSets_) { - seedingHitSets = std::make_unique >(); - seedingHitSets->reserve(localRA_.upper()); + seedingHitSets = std::make_unique(); + seedingHitSets->reserve(regionDoublets.regionSize(), localRA_.upper()); } std::unique_ptr intermediateHitTriplets; if(produceIntermediateHitTriplets_) { @@ -103,7 +103,14 @@ void HitTripletEDProducerT::produce(edm::Event& iEvent, c for(const auto& regionLayerPairs: regionDoublets) { const TrackingRegion& region = regionLayerPairs.region(); - intermediateHitTriplets->beginRegion(®ion); + + auto seedingHitSetsFiller = RegionsSeedingHitSets::dummyFiller(); + if(produceSeedingHitSets_) { + seedingHitSetsFiller = seedingHitSets->beginRegion(®ion); + } + if(produceIntermediateHitTriplets_) { + intermediateHitTriplets->beginRegion(®ion); + } LogTrace("HitTripletEDProducer") << " starting region"; @@ -147,7 +154,7 @@ void HitTripletEDProducerT::produce(edm::Event& iEvent, c triplets_total += triplets.size(); if(produceSeedingHitSets_) { for(const auto& trpl: triplets) { - seedingHitSets->emplace_back(trpl.inner(), trpl.middle(), trpl.outer()); + seedingHitSetsFiller.emplace_back(trpl.inner(), trpl.middle(), trpl.outer()); } } if(produceIntermediateHitTriplets_) { diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc index fee90205b1bf8..f7bf4c27ef153 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc @@ -8,7 +8,7 @@ #include "DataFormats/Common/interface/Handle.h" #include "FWCore/Utilities/interface/RunningAverage.h" -#include "RecoTracker/TkSeedingLayers/interface/SeedingHitSet.h" +#include "RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h" #include "RecoPixelVertexing/PixelTriplets/interface/OrderedHitSeeds.h" #include "RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h" @@ -36,7 +36,7 @@ PixelQuadrupletEDProducer::PixelQuadrupletEDProducer(const edm::ParameterSet& iC tripletToken_(consumes(iConfig.getParameter("triplets"))), generator_(iConfig, consumesCollector()) { - produces >(); + produces(); } void PixelQuadrupletEDProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -58,8 +58,8 @@ void PixelQuadrupletEDProducer::produce(edm::Event& iEvent, const edm::EventSetu throw cms::Exception("Configuration") << "PixelQuadrupletEDProducer expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= 4, got " << seedingLayerHits.numberOfLayersInSet(); } - auto seedingHitSets = std::make_unique >(); - seedingHitSets->reserve(localRA_.upper()); + auto seedingHitSets = std::make_unique(); + seedingHitSets->reserve(regionTriplets.regionSize(), localRA_.upper()); // match-making of triplet and quadruplet layers std::vector quadlayers = LayerQuadruplets::layers(seedingLayerHits); @@ -71,6 +71,7 @@ void PixelQuadrupletEDProducer::produce(edm::Event& iEvent, const edm::EventSetu for(const auto& regionLayerPairAndLayers: regionTriplets) { const TrackingRegion& region = regionLayerPairAndLayers.region(); + auto seedingHitSetsFiller = seedingHitSets->beginRegion(®ion); LogTrace("PixelQuadrupletEDProducer") << " starting region, number of layerPair+3rd layers " << regionLayerPairAndLayers.layerPairAndLayersSize(); @@ -109,7 +110,7 @@ void PixelQuadrupletEDProducer::produce(edm::Event& iEvent, const edm::EventSetu #endif for(const auto& quad: quadruplets) { - seedingHitSets->emplace_back(quad[0], quad[1], quad[2], quad[3]); + seedingHitSetsFiller.emplace_back(quad[0], quad[1], quad[2], quad[3]); } quadruplets.clear(); } diff --git a/RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h b/RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h new file mode 100644 index 0000000000000..45de9f86db426 --- /dev/null +++ b/RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h @@ -0,0 +1,68 @@ +#ifndef RecoTracker_TkHitPairs_RegionsSeedingHitSets_H +#define RecoTracker_TkHitPairs_RegionsSeedingHitSets_H + +#include "RecoTracker/TkSeedingLayers/interface/SeedingHitSet.h" +#include "RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h" + +// defined in this package instead of RecoTracker/TkSeedingLayers to avoid circular dependencies + +class RegionsSeedingHitSets { +public: + using RegionIndex = ihd::RegionIndex; + + // helper class to enforce correct usage + class RegionFiller { + public: + RegionFiller(): obj_(nullptr) {} + explicit RegionFiller(RegionsSeedingHitSets* obj): obj_(obj) {} + + ~RegionFiller() { + if(obj_) obj_->regions_.back().setLayerSetsEnd(obj_->hitSets_.size()); + } + + bool valid() const { return obj_ != nullptr; } + + template + void emplace_back(Args&&... args) { + obj_->hitSets_.emplace_back(std::forward(args)...); + } + private: + RegionsSeedingHitSets *obj_; + }; + + static RegionFiller dummyFiller() { return RegionFiller(); } + + // constructors + RegionsSeedingHitSets() = default; + ~RegionsSeedingHitSets() = default; + + void swap(RegionsSeedingHitSets& rh) { + regions_.swap(rh.regions_); + hitSets_.swap(rh.hitSets_); + } + + void reserve(size_t nregions, size_t nhitsets) { + regions_.reserve(nregions); + hitSets_.reserve(nhitsets); + } + + void shrink_to_fit() { + regions_.shrink_to_fit(); + hitSets_.shrink_to_fit(); + } + + RegionFiller beginRegion(const TrackingRegion *region) { + regions_.emplace_back(region, hitSets_.size()); + return RegionFiller(this); + } + + bool empty() const { return regions_.empty(); } + size_t regionSize() const { return regions_.size(); } + size_t size() const { return hitSets_.size(); } + +private: + std::vector regions_; + std::vector hitSets_; +}; + +#endif diff --git a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc index 0234eb7eda439..a0377893e7856 100644 --- a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc +++ b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc @@ -13,7 +13,7 @@ #include "RecoTracker/TkHitPairs/interface/LayerHitMapCache.h" #include "RecoTracker/TkHitPairs/interface/HitPairGeneratorFromLayerPair.h" #include "RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h" -#include "RecoTracker/TkSeedingLayers/interface/SeedingHitSet.h" +#include "RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h" #include "RecoPixelVertexing/PixelTriplets/interface/LayerTriplets.h" class HitPairEDProducer: public edm::stream::EDProducer<> { @@ -52,7 +52,7 @@ HitPairEDProducer::HitPairEDProducer(const edm::ParameterSet& iConfig): throw cms::Exception("Configuration") << "HitPairEDProducer requires either produceIntermediateHitDoublets or produceSeedingHitSets to be True. If neither are needed, just remove this module from your sequence/path as it doesn't do anything useful"; if(produceSeedingHitSets_) - produces >(); + produces(); if(produceIntermediateHitDoublets_) produces(); } @@ -80,10 +80,10 @@ void HitPairEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetu iEvent.getByToken(regionToken_, hregions); const auto& regions = *hregions; - std::unique_ptr > seedingHitSets; + std::unique_ptr seedingHitSets; if(produceSeedingHitSets_) { - seedingHitSets = std::make_unique >(); - seedingHitSets->reserve(localRA_.upper()); + seedingHitSets = std::make_unique(); + seedingHitSets->reserve(regions.size(), localRA_.upper()); } std::unique_ptr intermediateHitDoublets; if(produceIntermediateHitDoublets_) { @@ -112,6 +112,10 @@ void HitPairEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetu } for(const TrackingRegion& region: regions) { + auto seedingHitSetsFiller = RegionsSeedingHitSets::dummyFiller(); + if(produceSeedingHitSets_) { + seedingHitSetsFiller = seedingHitSets->beginRegion(®ion); + } if(produceIntermediateHitDoublets_) { intermediateHitDoublets->beginRegion(®ion); } @@ -123,8 +127,8 @@ void HitPairEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetu if(doublets.empty()) continue; // don't bother if no pairs from these layers if(produceSeedingHitSets_) { for(size_t i=0, size=doublets.size(); iemplace_back(doublets.hit(i, HitDoublets::inner), - doublets.hit(i, HitDoublets::outer)); + seedingHitSetsFiller.emplace_back(doublets.hit(i, HitDoublets::inner), + doublets.hit(i, HitDoublets::outer)); } } if(produceIntermediateHitDoublets_) { diff --git a/RecoTracker/TkHitPairs/src/classes.h b/RecoTracker/TkHitPairs/src/classes.h index bad1082a183cc..d1922e53407f4 100644 --- a/RecoTracker/TkHitPairs/src/classes.h +++ b/RecoTracker/TkHitPairs/src/classes.h @@ -1,4 +1,5 @@ #include "RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h" +#include "RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h" #include "DataFormats/Common/interface/Wrapper.h" #include @@ -7,5 +8,8 @@ namespace RecoTracker_TkHitPairs { struct dictionary { IntermediateHitDoublets ihd; edm::Wrapper wihd; + + RegionsSeedingHitSets rshs; + edm::Wrapper wrshs; }; } diff --git a/RecoTracker/TkHitPairs/src/classes_def.xml b/RecoTracker/TkHitPairs/src/classes_def.xml index ae8e13fcfa26c..1bc6b61f2f934 100644 --- a/RecoTracker/TkHitPairs/src/classes_def.xml +++ b/RecoTracker/TkHitPairs/src/classes_def.xml @@ -1,4 +1,6 @@ + + From e0d5382662c7fb62dcfe570128188f9f417953dd Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 29 Jul 2016 11:10:57 +0200 Subject: [PATCH 14/69] Add SeedGeneratorFromSeedingHitsEDProducerT, and instantiate it with SeedFromConsecutiveHitsCreator --- .../interface/RegionsSeedingHitSets.h | 12 +++ .../SeedCreatorFromRegionHitsEDProducerT.h | 95 +++++++++++++++++++ .../TkSeedGenerator/plugins/SealModules.cc | 4 + .../plugins/SeedFromConsecutiveHitsCreator.cc | 13 ++- .../plugins/SeedFromConsecutiveHitsCreator.h | 5 +- 5 files changed, 127 insertions(+), 2 deletions(-) create mode 100644 RecoTracker/TkSeedGenerator/interface/SeedCreatorFromRegionHitsEDProducerT.h diff --git a/RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h b/RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h index 45de9f86db426..20682decbc3c0 100644 --- a/RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h +++ b/RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h @@ -10,6 +10,9 @@ class RegionsSeedingHitSets { public: using RegionIndex = ihd::RegionIndex; + using RegionSeedingHitSets = ihd::RegionLayerHits; + using const_iterator = ihd::const_iterator; + // helper class to enforce correct usage class RegionFiller { public: @@ -60,6 +63,15 @@ class RegionsSeedingHitSets { size_t regionSize() const { return regions_.size(); } size_t size() const { return hitSets_.size(); } + const_iterator begin() const { return const_iterator(this, regions_.begin()); } + const_iterator cbegin() const { return begin(); } + const_iterator end() const { return const_iterator(this, regions_.end()); } + const_iterator cend() const { return end(); } + + // Used internally + std::vector::const_iterator layerSetsBegin() const { return hitSets_.begin(); } + std::vector::const_iterator layerSetsEnd() const { return hitSets_.end(); } + private: std::vector regions_; std::vector hitSets_; diff --git a/RecoTracker/TkSeedGenerator/interface/SeedCreatorFromRegionHitsEDProducerT.h b/RecoTracker/TkSeedGenerator/interface/SeedCreatorFromRegionHitsEDProducerT.h new file mode 100644 index 0000000000000..70a7959e750cb --- /dev/null +++ b/RecoTracker/TkSeedGenerator/interface/SeedCreatorFromRegionHitsEDProducerT.h @@ -0,0 +1,95 @@ +#ifndef RecoTracker_TkSeedGenerator_SeedCreatorFromRegionHitsEDProducerT_H +#define RecoTracker_TkSeedGenerator_SeedCreatorFromRegionHitsEDProducerT_H + +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Utilities/interface/EDGetToken.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "DataFormats/Common/interface/Handle.h" + +#include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h" +#include "RecoTracker/TkSeedingLayers/interface/SeedComparitorFactory.h" +#include "RecoTracker/TkSeedingLayers/interface/SeedComparitor.h" + +#include "RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h" + +template +class SeedCreatorFromRegionHitsEDProducerT: public edm::stream::EDProducer<> { +public: + + SeedCreatorFromRegionHitsEDProducerT(const edm::ParameterSet& iConfig); + ~SeedCreatorFromRegionHitsEDProducerT() = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + virtual void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override; + +private: + edm::EDGetTokenT seedingHitSetsToken_; + T_SeedCreator seedCreator_; + std::unique_ptr comparitor_; +}; + +template +SeedCreatorFromRegionHitsEDProducerT::SeedCreatorFromRegionHitsEDProducerT(const edm::ParameterSet& iConfig): + seedingHitSetsToken_(consumes(iConfig.getParameter("seedingHitSets"))), + seedCreator_(iConfig) +{ + edm::ConsumesCollector iC = consumesCollector(); + edm::ParameterSet comparitorPSet = iConfig.getParameter("SeedComparitorPSet"); + std::string comparitorName = comparitorPSet.getParameter("ComponentName"); + comparitor_.reset((comparitorName == "none") ? nullptr : SeedComparitorFactory::get()->create(comparitorName, comparitorPSet, iC)); + + produces(); +} + +template +void SeedCreatorFromRegionHitsEDProducerT::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + + desc.add("seedingHitSets", edm::InputTag("hitPairEDProducer")); + T_SeedCreator::fillDescriptions(desc); + + edm::ParameterSetDescription descComparitor; + descComparitor.add("ComponentName", "none"); + descComparitor.setAllowAnything(); // until we have moved SeedComparitor too to EDProducers + desc.add("SeedComparitorPSet", descComparitor); + + auto label = std::string("seedCreatorFromRegion") + T_SeedCreator::fillDescriptionsLabel() + "EDProducer"; + descriptions.add(label, desc); +} + +template +void SeedCreatorFromRegionHitsEDProducerT::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + edm::Handle hseedingHitSets; + iEvent.getByToken(seedingHitSetsToken_, hseedingHitSets); + const auto& seedingHitSets = *hseedingHitSets; + + auto seeds = std::make_unique(); + seeds->reserve(seedingHitSets.size()); + + if(comparitor_) + comparitor_->init(iEvent, iSetup); + + for(const auto& regionSeedingHitSets: seedingHitSets) { + const TrackingRegion& region = regionSeedingHitSets.region(); + seedCreator_.init(region, iSetup, comparitor_.get()); + + for(const SeedingHitSet& hits: regionSeedingHitSets) { + // TODO: do we really need a comparitor at this point? It is + // used in triplet and quadruplet generators, as well as inside + // seedCreator. + if(!comparitor_ || comparitor_->compatible(hits)) { + seedCreator_.makeSeed(*seeds, hits); + } + } + } + + seeds->shrink_to_fit(); + iEvent.put(std::move(seeds)); +} + +#endif diff --git a/RecoTracker/TkSeedGenerator/plugins/SealModules.cc b/RecoTracker/TkSeedGenerator/plugins/SealModules.cc index 0c9dd46cfd2f8..edcb1fcd8ac2b 100644 --- a/RecoTracker/TkSeedGenerator/plugins/SealModules.cc +++ b/RecoTracker/TkSeedGenerator/plugins/SealModules.cc @@ -28,3 +28,7 @@ DEFINE_EDM_PLUGIN(OrderedHitsGeneratorFactory, CombinedMultiHitGenerator, "Stand #include "RecoTracker/TkSeedGenerator/interface/MultiHitGeneratorFromPairAndLayers.h" #include "RecoTracker/TkSeedGenerator/interface/MultiHitGeneratorFromPairAndLayersFactory.h" DEFINE_EDM_PLUGIN(MultiHitGeneratorFromPairAndLayersFactory, MultiHitGeneratorFromChi2, "MultiHitGeneratorFromChi2"); + +#include "RecoTracker/TkSeedGenerator/interface/SeedCreatorFromRegionHitsEDProducerT.h" +using SeedCreatorFromRegionConsecutiveHitsEDProducer = SeedCreatorFromRegionHitsEDProducerT; +DEFINE_FWK_MODULE(SeedCreatorFromRegionConsecutiveHitsEDProducer); diff --git a/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsCreator.cc b/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsCreator.cc index bee617d88bd82..853084305e63e 100644 --- a/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsCreator.cc +++ b/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsCreator.cc @@ -5,7 +5,8 @@ #include "RecoTracker/TkSeedGenerator/interface/FastHelix.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include +#include "FWCore/Utilities/interface/ESInputTag.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" #include "TrackingTools/Records/interface/TrackingComponentsRecord.h" #include "TrackingTools/Records/interface/TransientRecHitRecord.h" @@ -24,6 +25,16 @@ namespace { SeedFromConsecutiveHitsCreator::~SeedFromConsecutiveHitsCreator(){} +void SeedFromConsecutiveHitsCreator::fillDescriptions(edm::ParameterSetDescription& desc) { + desc.add("propagator", "PropagatorWithMaterialParabolicMf"); + desc.add("SeedMomentumForBOFF", 5.0); + desc.add("OriginTransverseErrorMultiplier", 1.0); + desc.add("MinOneOverPtError", 1.0); + desc.add("TTRHBuilder", "WithTrackAngle"); + desc.add("magneticField", "ParabolicMf"); + desc.add("forceKinematicWithRegionDirection", false); +} + void SeedFromConsecutiveHitsCreator::init(const TrackingRegion & iregion, const edm::EventSetup& es, const SeedComparitor *ifilter) { diff --git a/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsCreator.h b/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsCreator.h index c0a34c1beddda..f167b68ae7d48 100644 --- a/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsCreator.h +++ b/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsCreator.h @@ -15,7 +15,7 @@ #include "DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h" #include "DataFormats/TrackingRecHit/interface/mayown_ptr.h" - +namespace edm { class ParameterSetDescription; } class FreeTrajectoryState; class dso_hidden SeedFromConsecutiveHitsCreator : public SeedCreator { @@ -34,6 +34,9 @@ class dso_hidden SeedFromConsecutiveHitsCreator : public SeedCreator { //dtor virtual ~SeedFromConsecutiveHitsCreator(); + static void fillDescriptions(edm::ParameterSetDescription& desc); + static const char *fillDescriptionsLabel() { return "ConsecutiveHits"; } + // initialize the "event dependent state" virtual void init(const TrackingRegion & region, const edm::EventSetup& es, From 747d022daa8c35967165474399ea20bc0b2bedea Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Sat, 30 Jul 2016 14:54:58 +0200 Subject: [PATCH 15/69] #ifndef CINT etc. no longer needed --- RecoTracker/TkSeedGenerator/interface/ClusterChecker.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/RecoTracker/TkSeedGenerator/interface/ClusterChecker.h b/RecoTracker/TkSeedGenerator/interface/ClusterChecker.h index f2ee556457bf7..420794b84c73a 100644 --- a/RecoTracker/TkSeedGenerator/interface/ClusterChecker.h +++ b/RecoTracker/TkSeedGenerator/interface/ClusterChecker.h @@ -7,13 +7,7 @@ #include "DataFormats/SiStripCluster/interface/SiStripCluster.h" #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" -#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__) #include "FWCore/Framework/interface/ConsumesCollector.h" -#else -namespace edm { - class ConsumesCollector; -} -#endif namespace edm { class Event; class ParameterSet; } @@ -29,10 +23,8 @@ namespace reco { namespace utils { class ClusterChecker { public: -#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__) ClusterChecker(const edm::ParameterSet & conf, edm::ConsumesCollector & iC) ; ClusterChecker(const edm::ParameterSet & conf, edm::ConsumesCollector && iC) ; -#endif ~ClusterChecker() ; size_t tooManyClusters(const edm::Event & e) const ; @@ -46,10 +38,8 @@ class ClusterChecker { unsigned int maxNrOfPixelClusters_; StringCutObjectSelector selector_; unsigned int ignoreDetsAboveNClusters_; -#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__) edm::EDGetTokenT > token_sc; edm::EDGetTokenT > token_pc; -#endif }; #endif From 95619d64e994c379c6a08aa191c8b19700217beb Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Sat, 30 Jul 2016 15:00:03 +0200 Subject: [PATCH 16/69] Add support for ClusterCheck with ClusterCheckerEDProducer --- .../interface/HitTripletEDProducerT.h | 21 +++++-- .../interface/IntermediateHitTriplets.h | 1 + .../plugins/PixelQuadrupletEDProducer.cc | 4 ++ .../interface/IntermediateHitDoublets.h | 1 + .../TkHitPairs/plugins/HitPairEDProducer.cc | 29 ++++++++-- .../interface/ClusterChecker.h | 4 +- .../plugins/ClusterCheckerEDProducer.cc | 55 +++++++++++++++++++ .../python/clusterCheckerEDProducer_cff.py | 4 ++ .../TkSeedGenerator/src/ClusterChecker.cc | 10 ++++ 9 files changed, 116 insertions(+), 13 deletions(-) create mode 100644 RecoTracker/TkSeedGenerator/plugins/ClusterCheckerEDProducer.cc create mode 100644 RecoTracker/TkSeedGenerator/python/clusterCheckerEDProducer_cff.py diff --git a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h index fd8ae1440001f..22a714f7d2a90 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h +++ b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h @@ -79,16 +79,25 @@ void HitTripletEDProducerT::produce(edm::Event& iEvent, c } std::unique_ptr seedingHitSets; - if(produceSeedingHitSets_) { - seedingHitSets = std::make_unique(); - seedingHitSets->reserve(regionDoublets.regionSize(), localRA_.upper()); - } std::unique_ptr intermediateHitTriplets; - if(produceIntermediateHitTriplets_) { + if(produceSeedingHitSets_) + seedingHitSets = std::make_unique(); + if(produceIntermediateHitTriplets_) intermediateHitTriplets = std::make_unique(&seedingLayerHits); - intermediateHitTriplets->reserve(regionDoublets.regionSize(), seedingLayerHits.size(), localRA_.upper()); + + if(regionDoublets.empty()) { + if(produceSeedingHitSets_) + iEvent.put(std::move(seedingHitSets)); + if(produceIntermediateHitTriplets_) + iEvent.put(std::move(intermediateHitTriplets)); + return; } + if(produceSeedingHitSets_) + seedingHitSets->reserve(regionDoublets.regionSize(), localRA_.upper()); + if(produceIntermediateHitTriplets_) + intermediateHitTriplets->reserve(regionDoublets.regionSize(), seedingLayerHits.size(), localRA_.upper()); + // match-making of pair and triplet layers std::vector trilayers = LayerTriplets::layers(seedingLayerHits); std::vector tripletLastLayerIndex; diff --git a/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h b/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h index 944d1fbc80ed5..eae345ffa9d1d 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h +++ b/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h @@ -279,6 +279,7 @@ class IntermediateHitTriplets { } const SeedingLayerSetsHits& seedingLayerHits() const { return *seedingLayers_; } + bool empty() const { return regions_.empty(); } size_t regionSize() const { return regions_.size(); } size_t tripletsSize() const { return hitTriplets_.size(); } diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc index f7bf4c27ef153..c68205e2719da 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc @@ -59,6 +59,10 @@ void PixelQuadrupletEDProducer::produce(edm::Event& iEvent, const edm::EventSetu } auto seedingHitSets = std::make_unique(); + if(regionTriplets.empty()) { + iEvent.put(std::move(seedingHitSets)); + return; + } seedingHitSets->reserve(regionTriplets.regionSize(), localRA_.upper()); // match-making of triplet and quadruplet layers diff --git a/RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h b/RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h index 26521f57aedef..4d2707a0f1765 100644 --- a/RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h +++ b/RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h @@ -151,6 +151,7 @@ class IntermediateHitDoublets { } const SeedingLayerSetsHits& seedingLayerHits() const { return *seedingLayers_; } + bool empty() const { return regions_.empty(); } size_t regionSize() const { return regions_.size(); } size_t layerPairsSize() const { return layerPairs_.size(); } diff --git a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc index a0377893e7856..c67fd71010c66 100644 --- a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc +++ b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc @@ -28,6 +28,7 @@ class HitPairEDProducer: public edm::stream::EDProducer<> { private: edm::EDGetTokenT seedingLayerToken_; edm::EDGetTokenT > regionToken_; + edm::EDGetTokenT clusterCheckToken_; edm::RunningAverage localRA_; LayerHitMapCache layerCache_; @@ -43,6 +44,7 @@ class HitPairEDProducer: public edm::stream::EDProducer<> { HitPairEDProducer::HitPairEDProducer(const edm::ParameterSet& iConfig): seedingLayerToken_(consumes(iConfig.getParameter("seedingLayers"))), regionToken_(consumes >(iConfig.getParameter("trackingRegions"))), + clusterCheckToken_(consumes(iConfig.getParameter("clusterCheck"))), maxElement_(iConfig.getParameter("maxElement")), generator_(0, 1, nullptr, maxElement_), // TODO: make layer indices configurable? produceSeedingHitSets_(iConfig.getParameter("produceSeedingHitSets")), @@ -62,6 +64,7 @@ void HitPairEDProducer::fillDescriptions(edm::ConfigurationDescriptions& descrip desc.add("seedingLayers", edm::InputTag("seedingLayersEDProducer")); desc.add("trackingRegions", edm::InputTag("globalTrackingRegionFromBeamSpot")); + desc.add("clusterCheck", edm::InputTag("clusterCheckerEDProducer")); desc.add("produceSeedingHitSets", false); desc.add("produceIntermediateHitDoublets", false); desc.add("maxElement", 0); // default is really 0? Also when used from CombinedHitTripletGenerator? @@ -70,6 +73,10 @@ void HitPairEDProducer::fillDescriptions(edm::ConfigurationDescriptions& descrip } void HitPairEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + edm::Handle hclusterCheck; + iEvent.getByToken(clusterCheckToken_, hclusterCheck); + const bool clusterCheckOk = *hclusterCheck; + edm::Handle hlayers; iEvent.getByToken(seedingLayerToken_, hlayers); const auto& layers = *hlayers; @@ -81,16 +88,26 @@ void HitPairEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetu const auto& regions = *hregions; std::unique_ptr seedingHitSets; - if(produceSeedingHitSets_) { - seedingHitSets = std::make_unique(); - seedingHitSets->reserve(regions.size(), localRA_.upper()); - } std::unique_ptr intermediateHitDoublets; - if(produceIntermediateHitDoublets_) { + if(produceSeedingHitSets_) + seedingHitSets = std::make_unique(); + if(produceIntermediateHitDoublets_) intermediateHitDoublets = std::make_unique(&layers); - intermediateHitDoublets->reserve(regions.size(), layers.size()); + + if(!clusterCheckOk) { + if(produceSeedingHitSets_) + iEvent.put(std::move(seedingHitSets)); + if(produceIntermediateHitDoublets_) + iEvent.put(std::move(intermediateHitDoublets)); + return; } + if(produceSeedingHitSets_) + seedingHitSets->reserve(regions.size(), localRA_.upper()); + if(produceIntermediateHitDoublets_) + intermediateHitDoublets->reserve(regions.size(), layers.size()); + + LogDebug("HitPairEDProducer") << "Creating doublets for " << regions.size() << " and " << layers.size() << " layer sets"; // This is the easiest way to extract the layer pairs from the full diff --git a/RecoTracker/TkSeedGenerator/interface/ClusterChecker.h b/RecoTracker/TkSeedGenerator/interface/ClusterChecker.h index 420794b84c73a..411ed981c2071 100644 --- a/RecoTracker/TkSeedGenerator/interface/ClusterChecker.h +++ b/RecoTracker/TkSeedGenerator/interface/ClusterChecker.h @@ -9,7 +9,7 @@ #include "FWCore/Framework/interface/ConsumesCollector.h" -namespace edm { class Event; class ParameterSet; } +namespace edm { class Event; class ParameterSet; class ParameterSetDescription; } namespace reco { namespace utils { struct ClusterTotals { @@ -26,6 +26,8 @@ class ClusterChecker { ClusterChecker(const edm::ParameterSet & conf, edm::ConsumesCollector & iC) ; ClusterChecker(const edm::ParameterSet & conf, edm::ConsumesCollector && iC) ; + static void fillDescriptions(edm::ParameterSetDescription& description); + ~ClusterChecker() ; size_t tooManyClusters(const edm::Event & e) const ; diff --git a/RecoTracker/TkSeedGenerator/plugins/ClusterCheckerEDProducer.cc b/RecoTracker/TkSeedGenerator/plugins/ClusterCheckerEDProducer.cc new file mode 100644 index 0000000000000..94e2bd4c67cdf --- /dev/null +++ b/RecoTracker/TkSeedGenerator/plugins/ClusterCheckerEDProducer.cc @@ -0,0 +1,55 @@ +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" + +#include "RecoTracker/TkSeedGenerator/interface/ClusterChecker.h" + +class ClusterCheckerEDProducer: public edm::stream::EDProducer<> { +public: + + ClusterCheckerEDProducer(const edm::ParameterSet& iConfig); + ~ClusterCheckerEDProducer() = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + virtual void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override; + +private: + ClusterChecker theClusterCheck; + bool theSilentOnClusterCheck; +}; + +ClusterCheckerEDProducer::ClusterCheckerEDProducer(const edm::ParameterSet& iConfig): + theClusterCheck(iConfig, consumesCollector()), + theSilentOnClusterCheck(iConfig.getUntrackedParameter("silentClusterCheck")) +{ + produces(); +} + +void ClusterCheckerEDProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + ClusterChecker::fillDescriptions(desc); + desc.addUntracked("silentClusterCheck", false); + + descriptions.add("clusterCheckerEDProducer", desc); +} + +void ClusterCheckerEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + auto ret = std::make_unique(true); + + //protection for big ass events... + size_t clustsOrZero = theClusterCheck.tooManyClusters(iEvent); + if (clustsOrZero){ + if (!theSilentOnClusterCheck) + edm::LogError("TooManyClusters") << "Found too many clusters (" << clustsOrZero << "), bailing out.\n"; + *ret = false; + } + + iEvent.put(std::move(ret)); +} + + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(ClusterCheckerEDProducer); diff --git a/RecoTracker/TkSeedGenerator/python/clusterCheckerEDProducer_cff.py b/RecoTracker/TkSeedGenerator/python/clusterCheckerEDProducer_cff.py new file mode 100644 index 0000000000000..26c9f9ecd5d3f --- /dev/null +++ b/RecoTracker/TkSeedGenerator/python/clusterCheckerEDProducer_cff.py @@ -0,0 +1,4 @@ +from Configuration.StandardSequences.Eras import eras +from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cfi import * +# Disable too many clusters check until we have an updated cut string for phase1 +eras.phase1Pixel.toModify(clusterCheckerEDProducer, doClusterCheck=False) # FIXME diff --git a/RecoTracker/TkSeedGenerator/src/ClusterChecker.cc b/RecoTracker/TkSeedGenerator/src/ClusterChecker.cc index 71371a6b1fd74..01a70790773ba 100644 --- a/RecoTracker/TkSeedGenerator/src/ClusterChecker.cc +++ b/RecoTracker/TkSeedGenerator/src/ClusterChecker.cc @@ -3,6 +3,7 @@ #include "FWCore/Framework/interface/Event.h" #include "DataFormats/Common/interface/Handle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -33,6 +34,15 @@ ClusterChecker::ClusterChecker(const edm::ParameterSet & conf, } } +void ClusterChecker::fillDescriptions(edm::ParameterSetDescription& desc) { + desc.add("doClusterCheck", true); + desc.add("MaxNumberOfCosmicClusters", 400000); + desc.add("ClusterCollectionLabel", edm::InputTag("siStripClusters")); + desc.add("MaxNumberOfPixelClusters", 40000); + desc.add("PixelClusterCollectionLabel", edm::InputTag("siPixelClusters")); + desc.add("cut", "strip < 400000 && pixel < 40000 && (strip < 50000 + 10*pixel) && (pixel < 5000 + 0.1*strip)"); +} + ClusterChecker::~ClusterChecker() { From 8f1c06301ad21337fda2b03ab2800b6455e94f20 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 26 Apr 2016 16:53:17 +0200 Subject: [PATCH 17/69] Use InitialStepPreSplitting as a testbed --- .../python/InitialStepPreSplitting_cff.py | 103 +++++++++++------- 1 file changed, 63 insertions(+), 40 deletions(-) diff --git a/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py b/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py index eab1aa661d160..f010a7966ec8f 100644 --- a/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py +++ b/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py @@ -18,52 +18,67 @@ layerList = RecoPixelVertexing.PixelTriplets.quadrupletseedmerging_cff.PixelSeedMergerQuadruplets.layerList.value() ) -# seeding -from RecoTracker.TkSeedGenerator.GlobalSeedsFromTriplets_cff import * -from RecoTracker.TkTrackingRegions.GlobalTrackingRegionFromBeamSpot_cfi import RegionPsetFomBeamSpotBlock -from RecoPixelVertexing.PixelTriplets.PixelQuadrupletGenerator_cfi import PixelQuadrupletGenerator as _PixelQuadrupletGenerator -initialStepSeedsPreSplitting = RecoTracker.TkSeedGenerator.GlobalSeedsFromTriplets_cff.globalSeedsFromTriplets.clone( - RegionFactoryPSet = RegionPsetFomBeamSpotBlock.clone( - ComponentName = cms.string('GlobalRegionProducerFromBeamSpot'), - RegionPSet = RegionPsetFomBeamSpotBlock.RegionPSet.clone( +# TrackingRegion +from RecoTracker.TkTrackingRegions.globalTrackingRegionFromBeamSpot_cfi import globalTrackingRegionFromBeamSpot as _globalTrackingRegionFromBeamSpot +initialStepTrackingRegionsPreSplitting = _globalTrackingRegionFromBeamSpot.clone(RegionPSet = dict( ptMin = 0.6, originRadius = 0.02, nSigmaZ = 4.0 - ) - ) - ) -initialStepSeedsPreSplitting.OrderedHitsFactoryPSet.SeedingLayers = 'initialStepSeedLayersPreSplitting' +)) + +# seeding +from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer +initialStepClusterCheckPreSplitting = _clusterCheckerEDProducer.clone( + PixelClusterCollectionLabel = 'siPixelClustersPreSplitting' +) + +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +initialStepHitDoubletsPreSplitting = _hitPairEDProducer.clone( + seedingLayers = "initialStepSeedLayersPreSplitting", + trackingRegions = "initialStepTrackingRegionsPreSplitting", + clusterCheck = "initialStepClusterCheckPreSplitting", + produceIntermediateHitDoublets = True, +) +from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * import RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi -initialStepSeedsPreSplitting.OrderedHitsFactoryPSet.GeneratorPSet.SeedComparitorPSet = RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi.LowPtClusterShapeSeedComparitor.clone() -initialStepSeedsPreSplitting.OrderedHitsFactoryPSet.GeneratorPSet.SeedComparitorPSet.clusterShapeCacheSrc = 'siPixelClusterShapeCachePreSplitting' -initialStepSeedsPreSplitting.ClusterCheckPSet.PixelClusterCollectionLabel = 'siPixelClustersPreSplitting' - -trackingPhase1.toModify(initialStepSeedsPreSplitting, - OrderedHitsFactoryPSet = cms.PSet( - ComponentName = cms.string("CombinedHitQuadrupletGenerator"), - GeneratorPSet = _PixelQuadrupletGenerator.clone( - extraHitRZtolerance = initialStepSeedsPreSplitting.OrderedHitsFactoryPSet.GeneratorPSet.extraHitRZtolerance, - extraHitRPhitolerance = initialStepSeedsPreSplitting.OrderedHitsFactoryPSet.GeneratorPSet.extraHitRPhitolerance, - SeedComparitorPSet = initialStepSeedsPreSplitting.OrderedHitsFactoryPSet.GeneratorPSet.SeedComparitorPSet, - maxChi2 = dict( - pt1 = 0.8, pt2 = 2, - value1 = 200, value2 = 100, - enabled = True, - ), - extraPhiTolerance = dict( - pt1 = 0.6, pt2 = 1, - value1 = 0.15, value2 = 0.1, - enabled = True, - ), - useBendingCorrection = True, - fitFastCircle = True, - fitFastCircleChi2Cut = True, - ), - TripletGeneratorPSet = initialStepSeedsPreSplitting.OrderedHitsFactoryPSet.GeneratorPSet, - SeedingLayers = cms.InputTag('initialStepSeedLayersPreSplitting'), - ) +initialStepHitTripletsPreSplitting = _pixelTripletHLTEDProducer.clone( + doublets = "initialStepHitDoubletsPreSplitting", + maxElement = 1000000, + produceSeedingHitSets = True, + SeedComparitorPSet = RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi.LowPtClusterShapeSeedComparitor.clone( + clusterShapeCacheSrc = 'siPixelClusterShapeCachePreSplitting' + ), +) +from RecoPixelVertexing.PixelTriplets.pixelQuadrupletEDProducer_cfi import pixelQuadrupletEDProducer as _pixelQuadrupletEDProducer +initialStepHitQuadrupletsPreSplitting = _pixelQuadrupletEDProducer.clone( + triplets = "initialStepHitTripletsPreSplitting", + extraHitRZtolerance = initialStepHitTripletsPreSplitting.extraHitRZtolerance, + extraHitRPhitolerance = initialStepHitTripletsPreSplitting.extraHitRPhitolerance, + maxChi2 = dict( + pt1 = 0.8, pt2 = 2, + value1 = 200, value2 = 100, + enabled = True, + ), + extraPhiTolerance = dict( + pt1 = 0.6, pt2 = 1, + value1 = 0.15, value2 = 0.1, + enabled = True, + ), + useBendingCorrection = True, + fitFastCircle = True, + fitFastCircleChi2Cut = True, + SeedComparitorPSet = initialStepHitTripletsPreSplitting.SeedComparitorPSet ) +from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsEDProducer_cfi import seedCreatorFromRegionConsecutiveHitsEDProducer as _seedCreatorFromRegionConsecutiveHitsEDProducer +initialStepSeedsPreSplitting = _seedCreatorFromRegionConsecutiveHitsEDProducer.clone( + seedingHitSets = "initialStepHitTripletsPreSplitting", +) +trackingPhase1.toModify(initialStepHitTripletsPreSplitting, + produceSeedingHitSets = False, + produceIntermediateHitTriplets = True, +) +trackingPhase1.toModify(initialStepSeedsPreSplitting, seedingHitSets = "initialStepHitQuadrupletsPreSplitting") # building @@ -166,6 +181,10 @@ from RecoTracker.MeasurementDet.MeasurementTrackerEventProducer_cfi import MeasurementTrackerEvent from RecoPixelVertexing.PixelLowPtUtilities.siPixelClusterShapeCache_cfi import * InitialStepPreSplitting = cms.Sequence(initialStepSeedLayersPreSplitting* + initialStepTrackingRegionsPreSplitting* + initialStepClusterCheckPreSplitting* + initialStepHitDoubletsPreSplitting* + initialStepHitTripletsPreSplitting* initialStepSeedsPreSplitting* initialStepTrackCandidatesPreSplitting* initialStepTracksPreSplitting* @@ -179,6 +198,10 @@ MeasurementTrackerEvent* siPixelClusterShapeCache) +_InitialStepPreSplitting_trackingPhase1 = InitialStepPreSplitting.copy() +_InitialStepPreSplitting_trackingPhase1.replace(initialStepHitTripletsPreSplitting, initialStepHitTripletsPreSplitting*initialStepHitQuadrupletsPreSplitting) +trackingPhase1.toReplaceWith(InitialStepPreSplitting, _InitialStepPreSplitting_trackingPhase1) + # Although InitialStepPreSplitting is not really part of LowPU/Run1/Phase1PU70 # tracking, we use it to get siPixelClusters and siPixelRecHits # collections for non-splitted pixel clusters. All modules before From 6357ff05a8f47db56f58fd6483cf3cde552bfda2 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 4 Aug 2016 12:38:01 +0200 Subject: [PATCH 18/69] Update seeding layer deduction in TrackValidation_cff --- .../RecoTrack/python/TrackValidation_cff.py | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Validation/RecoTrack/python/TrackValidation_cff.py b/Validation/RecoTrack/python/TrackValidation_cff.py index 00f1341a47f4b..7fd2784051cfa 100644 --- a/Validation/RecoTrack/python/TrackValidation_cff.py +++ b/Validation/RecoTrack/python/TrackValidation_cff.py @@ -176,16 +176,28 @@ def _setForEra(module, eraName, era, **kwargs): def _getSeedingLayers(seedProducers): import RecoTracker.IterativeTracking.iterativeTk_cff as _iterativeTk_cff + def _findDoubletProducer(name): + prod = getattr(_iterativeTk_cff, name) + if hasattr(prod, "triplets"): + return _findDoubletProducer(prod.triplets.getModuleLabel()) + elif hasattr(prod, "doublets"): + return _findDoubletProducer(prod.doublets.getModuleLabel()) + return prod + seedingLayersMerged = [] for seedName in seedProducers: seedProd = getattr(_iterativeTk_cff, seedName) - if not hasattr(seedProd, "OrderedHitsFactoryPSet"): + if hasattr(seedProd, "OrderedHitsFactoryPSet"): + if hasattr(seedProd, "SeedMergerPSet"): + seedingLayersName = seedProd.SeedMergerPSet.layerList.refToPSet_.value() + else: + seedingLayersName = seedProd.OrderedHitsFactoryPSet.SeedingLayers.getModuleLabel() + elif hasattr(seedProd, "seedingHitSets"): + doubletProd = _findDoubletProducer(seedProd.seedingHitSets.getModuleLabel()) + seedingLayersName = doubletProd.seedingLayers.getModuleLabel() + else: continue - if hasattr(seedProd, "SeedMergerPSet"): - seedingLayersName = seedProd.SeedMergerPSet.layerList.refToPSet_.value() - else: - seedingLayersName = seedProd.OrderedHitsFactoryPSet.SeedingLayers.getModuleLabel() seedingLayers = getattr(_iterativeTk_cff, seedingLayersName).layerList.value() for layerSet in seedingLayers: if layerSet not in seedingLayersMerged: From 49db1beb939bfa476820614e6819f1c955649335 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 9 Aug 2016 16:43:15 +0200 Subject: [PATCH 19/69] Add PixelQuadrupletMergerEDProducer --- .../interface/QuadrupletSeedMerger.h | 1 + .../PixelQuadrupletMergerEDProducer.cc | 112 ++++++++++++++++++ .../RecoTrack/python/TrackValidation_cff.py | 13 +- 3 files changed, 120 insertions(+), 6 deletions(-) create mode 100644 RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletMergerEDProducer.cc diff --git a/RecoPixelVertexing/PixelTriplets/interface/QuadrupletSeedMerger.h b/RecoPixelVertexing/PixelTriplets/interface/QuadrupletSeedMerger.h index 0ce6f29c9af98..4788168e34bc6 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/QuadrupletSeedMerger.h +++ b/RecoPixelVertexing/PixelTriplets/interface/QuadrupletSeedMerger.h @@ -77,6 +77,7 @@ class QuadrupletSeedMerger { public: + explicit QuadrupletSeedMerger(const edm::ParameterSet& iConfig, edm::ConsumesCollector&& iC): QuadrupletSeedMerger(iConfig, iC) {} explicit QuadrupletSeedMerger(const edm::ParameterSet& iConfig, edm::ConsumesCollector& iC); QuadrupletSeedMerger(const edm::ParameterSet& iConfig, const edm::ParameterSet& seedCreatorConfig, edm::ConsumesCollector& iC); ~QuadrupletSeedMerger(); diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletMergerEDProducer.cc b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletMergerEDProducer.cc new file mode 100644 index 0000000000000..480cd8147a46f --- /dev/null +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletMergerEDProducer.cc @@ -0,0 +1,112 @@ +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Utilities/interface/EDGetToken.h" +#include "FWCore/Framework/interface/Event.h" +#include "DataFormats/Common/interface/Handle.h" +#include "FWCore/Utilities/interface/RunningAverage.h" + +#include "RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h" +#include "RecoPixelVertexing/PixelTriplets/interface/OrderedHitSeeds.h" +#include "RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h" +#include "RecoPixelVertexing/PixelTriplets/interface/QuadrupletSeedMerger.h" + +class PixelQuadrupletMergerEDProducer: public edm::stream::EDProducer<> { +public: + PixelQuadrupletMergerEDProducer(const edm::ParameterSet& iConfig); + ~PixelQuadrupletMergerEDProducer() = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + virtual void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override; + +private: + edm::EDGetTokenT tripletToken_; + + edm::RunningAverage localRA_; + + QuadrupletSeedMerger merger_; +}; + +PixelQuadrupletMergerEDProducer::PixelQuadrupletMergerEDProducer(const edm::ParameterSet& iConfig): + tripletToken_(consumes(iConfig.getParameter("triplets"))), + merger_(iConfig.getParameter("layerList"), consumesCollector()) +{ + merger_.setTTRHBuilderLabel(iConfig.getParameter("ttrhBuilderLabel")); + merger_.setMergeTriplets(iConfig.getParameter("mergeTriplets")); + merger_.setAddRemainingTriplets(iConfig.getParameter("addRemainingTriplets")); + + produces(); +} + +void PixelQuadrupletMergerEDProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + + desc.add("triplets", edm::InputTag("hitTripletMergerEDProducer")); + desc.add("ttrhBuilderLabel", "PixelTTRHBuilderWithoutAngle"); + desc.add("mergeTriplets", true); + desc.add("addRemainingTriplets", false); + + // This would be really on the responsibility of + // QuadrupletSeedMerger and SeedingLayerSetsBuilder. The former is + // almost obsolete by now (so I don't want to put effort there), and + // the latter is better dealt in the context of SeedingLayersEDProducer. + edm::ParameterSetDescription descLayers; + descLayers.setAllowAnything(); + desc.add("layerList", descLayers); + + descriptions.add("pixelQuadrupletMergerEDProducer", desc); +} + +void PixelQuadrupletMergerEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + edm::Handle htriplets; + iEvent.getByToken(tripletToken_, htriplets); + const auto& regionTriplets = *htriplets; + + auto seedingHitSets = std::make_unique(); + if(regionTriplets.empty()) { + iEvent.put(std::move(seedingHitSets)); + return; + } + seedingHitSets->reserve(regionTriplets.regionSize(), localRA_.upper()); + + OrderedHitSeeds quadruplets; + quadruplets.reserve(localRA_.upper()); + + OrderedHitSeeds tripletsPerRegion; + tripletsPerRegion.reserve(localRA_.upper()); + + LogDebug("PixelQuadrupletMergerEDProducer") << "Creating quadruplets for " << regionTriplets.regionSize() << " regions from " << regionTriplets.tripletsSize() << " triplets"; + merger_.update(iSetup); + + for(const auto& regionLayerPairAndLayers: regionTriplets) { + const TrackingRegion& region = regionLayerPairAndLayers.region(); + auto seedingHitSetsFiller = seedingHitSets->beginRegion(®ion); + + + for(const auto& layerTriplet: regionLayerPairAndLayers) { + tripletsPerRegion.insert(tripletsPerRegion.end(), layerTriplet.tripletsBegin(), layerTriplet.tripletsEnd()); + } + + LogTrace("PixelQuadrupletEDProducer") << " starting region, number of triplets " << tripletsPerRegion.size(); + + const auto& quadruplets = merger_.mergeTriplets(tripletsPerRegion, iSetup); + + LogTrace("PixelQuadrupletEDProducer") << " created " << quadruplets.size() << " quadruplets"; + + for(size_t i=0; i!= quadruplets.size(); ++i) { + const auto& quad = quadruplets[i]; + seedingHitSetsFiller.emplace_back(quad[0], quad[1], quad[2], quad[3]); + } + + tripletsPerRegion.clear(); + } + localRA_.update(seedingHitSets->size()); + + iEvent.put(std::move(seedingHitSets)); +} + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(PixelQuadrupletMergerEDProducer); diff --git a/Validation/RecoTrack/python/TrackValidation_cff.py b/Validation/RecoTrack/python/TrackValidation_cff.py index 7fd2784051cfa..d3538aa8067bd 100644 --- a/Validation/RecoTrack/python/TrackValidation_cff.py +++ b/Validation/RecoTrack/python/TrackValidation_cff.py @@ -176,13 +176,15 @@ def _setForEra(module, eraName, era, **kwargs): def _getSeedingLayers(seedProducers): import RecoTracker.IterativeTracking.iterativeTk_cff as _iterativeTk_cff - def _findDoubletProducer(name): + def _findSeedingLayers(name): prod = getattr(_iterativeTk_cff, name) if hasattr(prod, "triplets"): - return _findDoubletProducer(prod.triplets.getModuleLabel()) + if hasattr(prod, "layerList"): # merger + return prod.layerList.refToPSet_.value() + return _findSeedingLayers(prod.triplets.getModuleLabel()) elif hasattr(prod, "doublets"): - return _findDoubletProducer(prod.doublets.getModuleLabel()) - return prod + return _findSeedingLayers(prod.doublets.getModuleLabel()) + return prod.seedingLayers.getModuleLabel() seedingLayersMerged = [] for seedName in seedProducers: @@ -193,8 +195,7 @@ def _findDoubletProducer(name): else: seedingLayersName = seedProd.OrderedHitsFactoryPSet.SeedingLayers.getModuleLabel() elif hasattr(seedProd, "seedingHitSets"): - doubletProd = _findDoubletProducer(seedProd.seedingHitSets.getModuleLabel()) - seedingLayersName = doubletProd.seedingLayers.getModuleLabel() + seedingLayersName = _findSeedingLayers(seedProd.seedingHitSets.getModuleLabel()) else: continue From d8ed2e3e7b8eaec56b548d9d8c4780c0c6c037a0 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 10 Aug 2016 12:39:46 +0200 Subject: [PATCH 20/69] Add HIMuonTrackingRegionEDProducer --- .../plugins/HIMuonTrackingRegionProducer.h | 16 ++++++ RecoHI/HiMuonAlgos/plugins/SealModule.cc | 4 ++ .../interface/MuonTrackingRegionBuilder.h | 12 ++++ .../src/MuonTrackingRegionBuilder.cc | 56 ++++++++++--------- 4 files changed, 62 insertions(+), 26 deletions(-) diff --git a/RecoHI/HiMuonAlgos/plugins/HIMuonTrackingRegionProducer.h b/RecoHI/HiMuonAlgos/plugins/HIMuonTrackingRegionProducer.h index 07ec1f6cac0f9..4ae1929abffa6 100644 --- a/RecoHI/HiMuonAlgos/plugins/HIMuonTrackingRegionProducer.h +++ b/RecoHI/HiMuonAlgos/plugins/HIMuonTrackingRegionProducer.h @@ -39,6 +39,22 @@ class HIMuonTrackingRegionProducer : public TrackingRegionProducer { virtual ~HIMuonTrackingRegionProducer(){} + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + + desc.add("MuonSrc", edm::InputTag("")); + + edm::ParameterSetDescription descRegion; + MuonTrackingRegionBuilder::fillDescriptions2(descRegion); + desc.add("MuonTrackingRegionBuilder", descRegion); + + edm::ParameterSetDescription descService; + descService.setAllowAnything(); + desc.add("ServiceParameters", descService); + + descriptions.add("HiTrackingRegionEDProducer", desc); + } + virtual std::vector > regions(const edm::Event& ev, const edm::EventSetup& es) const override { // initialize output vector of tracking regions diff --git a/RecoHI/HiMuonAlgos/plugins/SealModule.cc b/RecoHI/HiMuonAlgos/plugins/SealModule.cc index 09eb88f865bf8..43f6ab9b2ea38 100644 --- a/RecoHI/HiMuonAlgos/plugins/SealModule.cc +++ b/RecoHI/HiMuonAlgos/plugins/SealModule.cc @@ -9,3 +9,7 @@ using namespace cms; #include "RecoTracker/TkTrackingRegions/interface/TrackingRegionProducer.h" #include "HIMuonTrackingRegionProducer.h" DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, HIMuonTrackingRegionProducer, "HIMuonTrackingRegionProducer"); + +#include "RecoTracker/TkTrackingRegions/interface/TrackingRegionEDProducerT.h" +using HIMuonTrackingRegionEDProducer = TrackingRegionEDProducerT; +DEFINE_FWK_MODULE(HIMuonTrackingRegionEDProducer); diff --git a/RecoMuon/GlobalTrackingTools/interface/MuonTrackingRegionBuilder.h b/RecoMuon/GlobalTrackingTools/interface/MuonTrackingRegionBuilder.h index 9ad62d9cf072d..78d75fb334d74 100644 --- a/RecoMuon/GlobalTrackingTools/interface/MuonTrackingRegionBuilder.h +++ b/RecoMuon/GlobalTrackingTools/interface/MuonTrackingRegionBuilder.h @@ -62,6 +62,18 @@ class MuonTrackingRegionBuilder : public TrackingRegionProducer { /// Add Fill Descriptions static void fillDescriptions(edm::ParameterSetDescription& descriptions); + // 2016-08-10 MK: I'm pretty sure the fillDescriptions() above is + // not used in practice by any EDModule (it's called by + // L3MuonTrajectoryBuilder::fillDescriptions(), which itself is + // not called by anybody). I'm mainly confused that the + // fillDescriptions() above adds two PSets + // ("MuonTrackingRegionBuilder" and + // "hltMuonTrackingRegionBuilder") to the argument PSet, while to + // me it would make most sense to just fill the PSet (although I + // could be missing something). This is the behaviour of this + // fillDescriptions2() below. + static void fillDescriptions2(edm::ParameterSetDescription& descriptions); + private: void build(const edm::ParameterSet&, edm::ConsumesCollector&); diff --git a/RecoMuon/GlobalTrackingTools/src/MuonTrackingRegionBuilder.cc b/RecoMuon/GlobalTrackingTools/src/MuonTrackingRegionBuilder.cc index c44574828c36e..05ef873bf0eaf 100644 --- a/RecoMuon/GlobalTrackingTools/src/MuonTrackingRegionBuilder.cc +++ b/RecoMuon/GlobalTrackingTools/src/MuonTrackingRegionBuilder.cc @@ -255,32 +255,7 @@ std::unique_ptr MuonTrackingRegionBuilder::regi void MuonTrackingRegionBuilder::fillDescriptions(edm::ParameterSetDescription& descriptions) { { edm::ParameterSetDescription desc; - desc.add("EtaR_UpperLimit_Par1",0.25); - desc.add("DeltaR",0.2); - desc.add("beamSpot",edm::InputTag("")); - desc.add("OnDemand",-1); - desc.add("vertexCollection",edm::InputTag("")); - desc.add("Rescale_phi",3.0); - desc.add("Eta_fixed",false); - desc.add("Rescale_eta",3.0); - desc.add("PhiR_UpperLimit_Par2",0.2); - desc.add("Eta_min",0.05); - desc.add("Phi_fixed",false); - desc.add("Phi_min",0.05); - desc.add("PhiR_UpperLimit_Par1",0.6); - desc.add("EtaR_UpperLimit_Par2",0.15); - desc.add("MeasurementTrackerName",edm::InputTag("")); - desc.add("UseVertex",false); - desc.add("Rescale_Dz",3.0); - desc.add("Pt_fixed",false); - desc.add("Z_fixed",true); - desc.add("Pt_min",1.5); - desc.add("DeltaZ",15.9); - desc.add("DeltaEta",0.2); - desc.add("DeltaPhi",0.2); - desc.add("maxRegions",1); - desc.add("precise",true); - desc.add("input",edm::InputTag("")); + fillDescriptions2(desc); descriptions.add("MuonTrackingRegionBuilder",desc); } { @@ -315,3 +290,32 @@ void MuonTrackingRegionBuilder::fillDescriptions(edm::ParameterSetDescription& d } descriptions.setComment("Build a TrackingRegion around a standalone muon. Options to define region around beamspot or primary vertex and dynamic regions are included."); } + +void MuonTrackingRegionBuilder::fillDescriptions2(edm::ParameterSetDescription& desc) { + desc.add("EtaR_UpperLimit_Par1",0.25); + desc.add("DeltaR",0.2); + desc.add("beamSpot",edm::InputTag("")); + desc.add("OnDemand",-1); + desc.add("vertexCollection",edm::InputTag("")); + desc.add("Rescale_phi",3.0); + desc.add("Eta_fixed",false); + desc.add("Rescale_eta",3.0); + desc.add("PhiR_UpperLimit_Par2",0.2); + desc.add("Eta_min",0.05); + desc.add("Phi_fixed",false); + desc.add("Phi_min",0.05); + desc.add("PhiR_UpperLimit_Par1",0.6); + desc.add("EtaR_UpperLimit_Par2",0.15); + desc.add("MeasurementTrackerName",edm::InputTag("")); + desc.add("UseVertex",false); + desc.add("Rescale_Dz",3.0); + desc.add("Pt_fixed",false); + desc.add("Z_fixed",true); + desc.add("Pt_min",1.5); + desc.add("DeltaZ",15.9); + desc.add("DeltaEta",0.2); + desc.add("DeltaPhi",0.2); + desc.add("maxRegions",1); + desc.add("precise",true); + desc.add("input",edm::InputTag("")); +} From f76a8d286044cb804fbe7d5e1ca5f8900aa60ed5 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 10 Aug 2016 12:57:43 +0200 Subject: [PATCH 21/69] Migrate InitialStep to the new seeding modules --- .../Tracking/python/InitialStep_cff.py | 5 +- .../Tracking/python/SeedingMigration.py | 25 ++++++ .../python/HiRegitMuonInitialStep_cff.py | 51 +++++++---- .../python/HITrackingRegionProducer_cfi.py | 12 +++ .../python/InitialStepPreSplitting_cff.py | 2 +- .../python/InitialStep_cff.py | 85 +++++++++++-------- .../python/clusterCheckerEDProducer_cff.py | 3 +- ...FromRegionConsecutiveHitsEDProducer_cff.py | 11 +++ 8 files changed, 139 insertions(+), 55 deletions(-) create mode 100644 FastSimulation/Tracking/python/SeedingMigration.py create mode 100644 RecoTracker/TkSeedGenerator/python/seedCreatorFromRegionConsecutiveHitsEDProducer_cff.py diff --git a/FastSimulation/Tracking/python/InitialStep_cff.py b/FastSimulation/Tracking/python/InitialStep_cff.py index b2bcaccc2d117..4c56158de9be7 100644 --- a/FastSimulation/Tracking/python/InitialStep_cff.py +++ b/FastSimulation/Tracking/python/InitialStep_cff.py @@ -2,14 +2,15 @@ # import the full tracking equivalent of this file import RecoTracker.IterativeTracking.InitialStep_cff as _standard +from FastSimulation.Tracking.SeedingMigration import _regionProducerToFactoryPSet, _hitSetProducerToFactoryPSet # trajectory seeds import FastSimulation.Tracking.TrajectorySeedProducer_cfi initialStepSeeds = FastSimulation.Tracking.TrajectorySeedProducer_cfi.trajectorySeedProducer.clone( layerList = _standard.initialStepSeedLayers.layerList.value(), - RegionFactoryPSet = _standard.initialStepSeeds.RegionFactoryPSet + RegionFactoryPSet = _regionProducerToFactoryPSet(_standard.initialStepTrackingRegions) ) -initialStepSeeds.seedFinderSelector.pixelTripletGeneratorFactory = _standard.initialStepSeeds.OrderedHitsFactoryPSet.GeneratorPSet +initialStepSeeds.seedFinderSelector.pixelTripletGeneratorFactory = _hitSetProducerToFactoryPSet(_standard.initialStepHitTriplets) initialStepSeeds.seedFinderSelector.pixelTripletGeneratorFactory.SeedComparitorPSet.ComponentName = "none" # track candidates diff --git a/FastSimulation/Tracking/python/SeedingMigration.py b/FastSimulation/Tracking/python/SeedingMigration.py new file mode 100644 index 0000000000000..5b9072134d7a9 --- /dev/null +++ b/FastSimulation/Tracking/python/SeedingMigration.py @@ -0,0 +1,25 @@ +import FWCore.ParameterSet.Config as cms + +def _regionProducerToFactoryPSet(producer): + _map = { + "GlobalTrackinRegionFromBeamSpotEDProducer": "GlobalRegionProducerFromBeamSpot", + } + return cms.PSet( + ComponentName = cms.string(_map[producer._TypedParameterizable__type]), + RegionPSet = producer.RegionPSet.clone(), + ) + +def _copy(old, new, skip=[]): + skipSet = set(skip) + for key in old.parameterNames_(): + if key not in skipSet: + setattr(new, key, getattr(old, key)) + +def _hitSetProducerToFactoryPSet(producer): + _map = { + "PixelTripletHLTEDProducer": "PixelTripletHLTGenerator", + } + ret = cms.PSet() + _copy(producer, ret) + ret.ComponentName = cms.string(_map[producer._TypedParameterizable__type]); + return ret diff --git a/RecoHI/HiMuonAlgos/python/HiRegitMuonInitialStep_cff.py b/RecoHI/HiMuonAlgos/python/HiRegitMuonInitialStep_cff.py index eec5c0e42ae5c..5451c30ff324a 100644 --- a/RecoHI/HiMuonAlgos/python/HiRegitMuonInitialStep_cff.py +++ b/RecoHI/HiMuonAlgos/python/HiRegitMuonInitialStep_cff.py @@ -3,13 +3,24 @@ # pp iterative tracking modified for hiOffline reco (the vertex is the one reconstructed in HI) ################################### 0st step:pixel-triplet seeding, high-pT; from RecoHI.HiTracking.HITrackingRegionProducer_cfi import * -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.vertexCollection = cms.InputTag("hiSelectedVertex") -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonSrc= cms.InputTag("standAloneMuons","UpdatedAtVtx") - -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.Phi_fixed = True -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.Eta_fixed = True -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.DeltaPhi = 0.3 -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.DeltaEta = 0.2 +# Are the following values set to the same in every iteration? If yes, +# why not making the change in HITrackingRegionProducer_cfi directly +# once for all? +hiRegitMuInitialStepTrackingRegions = HiTrackingRegionFactoryFromSTAMuonsEDProducer.clone( + MuonSrc = "standAloneMuons:UpdatedAtVtx", # this is the same as default, why repeat? + MuonTrackingRegionBuilder = dict( + vertexCollection = "hiSelectedVertex", + Phi_fixed = True, + Eta_fixed = True, + DeltaPhi = 0.3, + DeltaEta = 0.2, + # Ok, the following ones are specific to InitialStep + Pt_min = 3.0, + DeltaR = 1, # default = 0.2 + DeltaZ = 1, # this give you the length + Rescale_Dz = 4., # max(DeltaZ_Region,Rescale_Dz*vtx->zError()) + ) +) ################################### from RecoTracker.IterativeTracking.InitialStep_cff import * @@ -18,14 +29,20 @@ hiRegitMuInitialStepSeedLayers = RecoTracker.IterativeTracking.InitialStep_cff.initialStepSeedLayers.clone() # seeding -hiRegitMuInitialStepSeeds = RecoTracker.IterativeTracking.InitialStep_cff.initialStepSeeds.clone() -hiRegitMuInitialStepSeeds.RegionFactoryPSet = HiTrackingRegionFactoryFromSTAMuonsBlock.clone() -hiRegitMuInitialStepSeeds.OrderedHitsFactoryPSet.SeedingLayers = cms.InputTag("hiRegitMuInitialStepSeedLayers") -hiRegitMuInitialStepSeeds.ClusterCheckPSet.doClusterCheck = False # do not check for max number of clusters pixel or strips -hiRegitMuInitialStepSeeds.RegionFactoryPSet.MuonTrackingRegionBuilder.Pt_min = 3.0 -hiRegitMuInitialStepSeeds.RegionFactoryPSet.MuonTrackingRegionBuilder.DeltaR = 1 # default = 0.2 -hiRegitMuInitialStepSeeds.RegionFactoryPSet.MuonTrackingRegionBuilder.DeltaZ = 1 # this give you the length -hiRegitMuInitialStepSeeds.RegionFactoryPSet.MuonTrackingRegionBuilder.Rescale_Dz = 4. # max(DeltaZ_Region,Rescale_Dz*vtx->zError()) +hiRegitMuInitialStepClusterCheck = RecoTracker.IterativeTracking.InitialStep_cff.initialStepClusterCheck.clone( + doClusterCheck = False # do not check for max number of clusters pixel or strips +) +hiRegitMuInitialStepHitDoublets = RecoTracker.IterativeTracking.InitialStep_cff.initialStepHitDoublets.clone( + seedingLayers = "hiRegitMuInitialStepSeedLayers", + trackingRegions = "hiRegitMuInitialStepTrackingRegions", + clusterCheck = "hiRegitMuInitialStepClusterCheck", +) +hiRegitMuInitialStepHitTriplets = RecoTracker.IterativeTracking.InitialStep_cff.initialStepHitTriplets.clone( + doublets = "hiRegitMuInitialStepHitDoublets" +) +hiRegitMuInitialStepSeeds = RecoTracker.IterativeTracking.InitialStep_cff.initialStepSeeds.clone( + seedingHitSets = "hiRegitMuInitialStepHitTriplets" +) # building: feed the new-named seeds @@ -91,6 +108,10 @@ ) hiRegitMuonInitialStep = cms.Sequence(hiRegitMuInitialStepSeedLayers* + hiRegitMuInitialStepTrackingRegions* + hiRegitMuInitialStepClusterCheck* + hiRegitMuInitialStepHitDoublets* + hiRegitMuInitialStepHitTriplets* hiRegitMuInitialStepSeeds* hiRegitMuInitialStepTrackCandidates* hiRegitMuInitialStepTracks* diff --git a/RecoHI/HiTracking/python/HITrackingRegionProducer_cfi.py b/RecoHI/HiTracking/python/HITrackingRegionProducer_cfi.py index 54ebd0558e0a9..07bfb7375464e 100644 --- a/RecoHI/HiTracking/python/HITrackingRegionProducer_cfi.py +++ b/RecoHI/HiTracking/python/HITrackingRegionProducer_cfi.py @@ -88,3 +88,15 @@ HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.vertexCollection = cms.InputTag("hiSelectedVertex") HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.UseVertex = cms.bool(True) HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.Rescale_Dz = cms.double(5.0) + +# for new-style seeding +from RecoHI.HiMuonAlgos.HiTrackingRegionEDProducer_cfi import HiTrackingRegionEDProducer as _HiTrackingRegionEDProducer +HiTrackingRegionFactoryFromSTAMuonsEDProducer = _HiTrackingRegionEDProducer.clone( + MuonSrc = "standAloneMuons:UpdatedAtVtx", + MuonTrackingRegionBuilder = MuonTrackingRegionCommon.MuonTrackingRegionBuilder.clone( + vertexCollection = "hiSelectedVertex", + UseVertex = True, + Rescale_Dz = 5.0, + ), + ServiceParameters = MuonServiceProxy.ServiceParameters, +) diff --git a/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py b/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py index f010a7966ec8f..e1681e1a3056f 100644 --- a/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py +++ b/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py @@ -70,7 +70,7 @@ fitFastCircleChi2Cut = True, SeedComparitorPSet = initialStepHitTripletsPreSplitting.SeedComparitorPSet ) -from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsEDProducer_cfi import seedCreatorFromRegionConsecutiveHitsEDProducer as _seedCreatorFromRegionConsecutiveHitsEDProducer +from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsEDProducer_cff import seedCreatorFromRegionConsecutiveHitsEDProducer as _seedCreatorFromRegionConsecutiveHitsEDProducer initialStepSeedsPreSplitting = _seedCreatorFromRegionConsecutiveHitsEDProducer.clone( seedingHitSets = "initialStepHitTripletsPreSplitting", ) diff --git a/RecoTracker/IterativeTracking/python/InitialStep_cff.py b/RecoTracker/IterativeTracking/python/InitialStep_cff.py index 6fbef95f4846c..b4398b2861cec 100644 --- a/RecoTracker/IterativeTracking/python/InitialStep_cff.py +++ b/RecoTracker/IterativeTracking/python/InitialStep_cff.py @@ -21,48 +21,57 @@ ] ) - -# seeding -from RecoTracker.TkSeedGenerator.GlobalSeedsFromTriplets_cff import * -from RecoTracker.TkTrackingRegions.GlobalTrackingRegionFromBeamSpot_cfi import RegionPsetFomBeamSpotBlock -initialStepSeeds = RecoTracker.TkSeedGenerator.GlobalSeedsFromTriplets_cff.globalSeedsFromTriplets.clone( - RegionFactoryPSet = RegionPsetFomBeamSpotBlock.clone( - ComponentName = cms.string('GlobalRegionProducerFromBeamSpot'), - RegionPSet = RegionPsetFomBeamSpotBlock.RegionPSet.clone( +# TrackingRegion +from RecoTracker.TkTrackingRegions.globalTrackingRegionFromBeamSpot_cfi import globalTrackingRegionFromBeamSpot as _globalTrackingRegionFromBeamSpot +initialStepTrackingRegions = _globalTrackingRegionFromBeamSpot.clone(RegionPSet = dict( ptMin = 0.6, originRadius = 0.02, nSigmaZ = 4.0 - ) - ) - ) -initialStepSeeds.OrderedHitsFactoryPSet.SeedingLayers = 'initialStepSeedLayers' -from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * -import RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi -initialStepSeeds.OrderedHitsFactoryPSet.GeneratorPSet.SeedComparitorPSet = RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi.LowPtClusterShapeSeedComparitor - -_SeedMergerPSet = cms.PSet( - layerList = cms.PSet(refToPSet_ = cms.string("PixelSeedMergerQuadruplets")), - addRemainingTriplets = cms.bool(False), - mergeTriplets = cms.bool(True), - ttrhBuilderLabel = cms.string('PixelTTRHBuilderWithoutAngle') -) +)) from Configuration.Eras.Modifier_trackingPhase1PU70_cff import trackingPhase1PU70 -trackingPhase1PU70.toModify(initialStepSeeds, - RegionFactoryPSet = dict(RegionPSet = dict(ptMin = 0.7)), - SeedMergerPSet = _SeedMergerPSet -) from Configuration.Eras.Modifier_trackingPhase2PU140_cff import trackingPhase2PU140 -trackingPhase2PU140.toModify(initialStepSeeds, - ClusterCheckPSet = dict(doClusterCheck = cms.bool(False)), - OrderedHitsFactoryPSet = dict(GeneratorPSet = dict(maxElement = 0)), - RegionFactoryPSet = dict(RegionPSet = dict(ptMin = 0.8)), - SeedCreatorPSet = dict(magneticField = '', propagator = 'PropagatorWithMaterial'), - SeedMergerPSet = _SeedMergerPSet -) +trackingPhase1PU70.toModify(initialStepTrackingRegions, RegionPSet = dict(ptMin = 0.7)) +trackingPhase2PU140.toModify(initialStepTrackingRegions, RegionPSet = dict(ptMin = 0.8)) +# seeding +from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer +initialStepClusterCheck = _clusterCheckerEDProducer.clone( + PixelClusterCollectionLabel = 'siPixelClusters' +) +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +initialStepHitDoublets = _hitPairEDProducer.clone( + seedingLayers = "initialStepSeedLayers", + trackingRegions = "initialStepTrackingRegions", + clusterCheck = "initialStepClusterCheck", + produceIntermediateHitDoublets = True, +) +from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer +from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * +import RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi +initialStepHitTriplets = _pixelTripletHLTEDProducer.clone( + doublets = "initialStepHitDoublets", + maxElement = 1000000, + produceSeedingHitSets = True, + SeedComparitorPSet = RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi.LowPtClusterShapeSeedComparitor +) +from RecoPixelVertexing.PixelTriplets.pixelQuadrupletMergerEDProducer_cfi import pixelQuadrupletMergerEDProducer as _pixelQuadrupletMergerEDProducer +from RecoPixelVertexing.PixelTriplets.quadrupletseedmerging_cff import * +initialStepHitQuadruplets = _pixelQuadrupletMergerEDProducer.clone( + triplets = "initialStepHitTriplets", + layerList = dict(refToPSet_ = cms.string("PixelSeedMergerQuadruplets")), +) +from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsEDProducer_cff import seedCreatorFromRegionConsecutiveHitsEDProducer as _seedCreatorFromRegionConsecutiveHitsEDProducer +initialStepSeeds = _seedCreatorFromRegionConsecutiveHitsEDProducer.clone( + seedingHitSets = "initialStepHitTriplets", +) from Configuration.Eras.Modifier_trackingLowPU_cff import trackingLowPU -trackingLowPU.toModify(initialStepSeeds, OrderedHitsFactoryPSet = dict(GeneratorPSet = dict(maxElement = 100000))) +trackingLowPU.toModify(initialStepHitTriplets, maxElement=100000) +trackingPhase1PU70.toModify(initialStepHitTriplets, maxElement=0, produceSeedingHitSets=False, produceIntermediateHitTriplets=True) +trackingPhase1PU70.toModify(initialStepSeeds, seedingHitSets="initialStepHitQuadruplets") +trackingPhase2PU140.toModify(initialStepHitTriplets, maxElement=0, produceSeedingHitSets=False, produceIntermediateHitTriplets=True) +trackingPhase2PU140.toModify(initialStepSeeds, seedingHitSets="initialStepHitQuadruplets") + # building import TrackingTools.TrajectoryFiltering.TrajectoryFilter_cff @@ -308,6 +317,10 @@ # Final sequence InitialStep = cms.Sequence(initialStepSeedLayers* + initialStepTrackingRegions* + initialStepClusterCheck* + initialStepHitDoublets* + initialStepHitTriplets* initialStepSeeds* initialStepTrackCandidates* initialStepTracks* @@ -317,7 +330,7 @@ _InitialStep_LowPU = InitialStep.copyAndExclude([firstStepPrimaryVertices, initialStepClassifier1, initialStepClassifier2, initialStepClassifier3]) _InitialStep_LowPU.replace(initialStep, initialStepSelector) trackingLowPU.toReplaceWith(InitialStep, _InitialStep_LowPU) -_InitialStep_Phase1PU70 = InitialStep.copyAndExclude([firstStepPrimaryVertices, initialStepClassifier1, initialStepClassifier2, initialStepClassifier3]) -_InitialStep_Phase1PU70.replace(initialStep, initialStepSelector) +_InitialStep_Phase1PU70 = _InitialStep_LowPU.copy() +_InitialStep_Phase1PU70.replace(initialStepHitTriplets, initialStepHitTriplets+initialStepHitQuadruplets) trackingPhase1PU70.toReplaceWith(InitialStep, _InitialStep_Phase1PU70) trackingPhase2PU140.toReplaceWith(InitialStep, _InitialStep_Phase1PU70) diff --git a/RecoTracker/TkSeedGenerator/python/clusterCheckerEDProducer_cff.py b/RecoTracker/TkSeedGenerator/python/clusterCheckerEDProducer_cff.py index 26c9f9ecd5d3f..b6160b0d5370d 100644 --- a/RecoTracker/TkSeedGenerator/python/clusterCheckerEDProducer_cff.py +++ b/RecoTracker/TkSeedGenerator/python/clusterCheckerEDProducer_cff.py @@ -1,4 +1,5 @@ from Configuration.StandardSequences.Eras import eras from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cfi import * -# Disable too many clusters check until we have an updated cut string for phase1 +# Disable too many clusters check until we have an updated cut string for phase1 and phase2 eras.phase1Pixel.toModify(clusterCheckerEDProducer, doClusterCheck=False) # FIXME +eras.phase2_tracker.toModify(clusterCheckerEDProducer, doClusterCheck=False) # FIXME diff --git a/RecoTracker/TkSeedGenerator/python/seedCreatorFromRegionConsecutiveHitsEDProducer_cff.py b/RecoTracker/TkSeedGenerator/python/seedCreatorFromRegionConsecutiveHitsEDProducer_cff.py new file mode 100644 index 0000000000000..d99e306682358 --- /dev/null +++ b/RecoTracker/TkSeedGenerator/python/seedCreatorFromRegionConsecutiveHitsEDProducer_cff.py @@ -0,0 +1,11 @@ +from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsEDProducer_cfi import * +from Configuration.Eras.Modifier_trackingPhase1PU70_cff import trackingPhase1PU70 +from Configuration.Eras.Modifier_trackingPhase2PU140_cff import trackingPhase2PU140 +trackingPhase1PU70.toModify(seedCreatorFromRegionConsecutiveHitsEDProducer, + magneticField = '', + propagator = 'PropagatorWithMaterial', +) +trackingPhase2PU140.toModify(seedCreatorFromRegionConsecutiveHitsEDProducer, + magneticField = '', + propagator = 'PropagatorWithMaterial', +) From c8ccfb50e428724faa943fa2cb2809e00af9968f Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 11 Aug 2016 12:14:36 +0200 Subject: [PATCH 22/69] "Fix" PixelQuadrupletMergerEDProducer to preserve old behaviour Yes, we really need to produce first triplet seeds, and use hits of those for quadruplet merging. Otherwise there will be differences. Probably later we'll remove this complication (or the whole code). --- .../PixelQuadrupletMergerEDProducer.cc | 70 ++++++++++++++++--- .../python/InitialStep_cff.py | 14 ++++ 2 files changed, 75 insertions(+), 9 deletions(-) diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletMergerEDProducer.cc b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletMergerEDProducer.cc index 480cd8147a46f..21d74f6b02ff4 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletMergerEDProducer.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletMergerEDProducer.cc @@ -10,9 +10,14 @@ #include "RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h" #include "RecoPixelVertexing/PixelTriplets/interface/OrderedHitSeeds.h" -#include "RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h" #include "RecoPixelVertexing/PixelTriplets/interface/QuadrupletSeedMerger.h" +// following are needed only to keep the same results +#include "RecoTracker/TkSeedingLayers/interface/SeedComparitorFactory.h" +#include "RecoTracker/TkSeedingLayers/interface/SeedComparitor.h" +#include "RecoTracker/TkSeedGenerator/interface/SeedCreatorFactory.h" +#include "RecoTracker/TkSeedGenerator/interface/SeedCreator.h" + class PixelQuadrupletMergerEDProducer: public edm::stream::EDProducer<> { public: PixelQuadrupletMergerEDProducer(const edm::ParameterSet& iConfig); @@ -23,21 +28,37 @@ class PixelQuadrupletMergerEDProducer: public edm::stream::EDProducer<> { virtual void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override; private: - edm::EDGetTokenT tripletToken_; + edm::EDGetTokenT tripletToken_; edm::RunningAverage localRA_; QuadrupletSeedMerger merger_; + + // to keep old results + std::unique_ptr comparitor_; + std::unique_ptr seedCreator_; + TrajectorySeedCollection tmpSeedCollection_; // need to keep these in memory because TrajectorySeed owns its RecHits }; PixelQuadrupletMergerEDProducer::PixelQuadrupletMergerEDProducer(const edm::ParameterSet& iConfig): - tripletToken_(consumes(iConfig.getParameter("triplets"))), + tripletToken_(consumes(iConfig.getParameter("triplets"))), merger_(iConfig.getParameter("layerList"), consumesCollector()) { merger_.setTTRHBuilderLabel(iConfig.getParameter("ttrhBuilderLabel")); merger_.setMergeTriplets(iConfig.getParameter("mergeTriplets")); merger_.setAddRemainingTriplets(iConfig.getParameter("addRemainingTriplets")); + edm::ParameterSet comparitorPSet = iConfig.getParameter("SeedComparitorPSet"); + std::string comparitorName = comparitorPSet.getParameter("ComponentName"); + if(comparitorName != "none") { + auto iC = consumesCollector(); + comparitor_.reset(SeedComparitorFactory::get()->create(comparitorName, comparitorPSet, iC)); + } + + edm::ParameterSet creatorPSet = iConfig.getParameter("SeedCreatorPSet"); + std::string creatorName = creatorPSet.getParameter("ComponentName"); + seedCreator_.reset(SeedCreatorFactory::get()->create( creatorName, creatorPSet)); + produces(); } @@ -57,11 +78,23 @@ void PixelQuadrupletMergerEDProducer::fillDescriptions(edm::ConfigurationDescrip descLayers.setAllowAnything(); desc.add("layerList", descLayers); + // to keep old results + edm::ParameterSetDescription descComparitor; + descComparitor.add("ComponentName", "none"); + descComparitor.setAllowAnything(); + desc.add("SeedComparitorPSet", descComparitor); + edm::ParameterSetDescription descCreator; + descCreator.setAllowAnything(); + desc.add("SeedCreatorPSet", descCreator); + descriptions.add("pixelQuadrupletMergerEDProducer", desc); } void PixelQuadrupletMergerEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { - edm::Handle htriplets; + // to keep old results + tmpSeedCollection_.clear(); // safe to clear now + + edm::Handle htriplets; iEvent.getByToken(tripletToken_, htriplets); const auto& regionTriplets = *htriplets; @@ -78,16 +111,35 @@ void PixelQuadrupletMergerEDProducer::produce(edm::Event& iEvent, const edm::Eve OrderedHitSeeds tripletsPerRegion; tripletsPerRegion.reserve(localRA_.upper()); - LogDebug("PixelQuadrupletMergerEDProducer") << "Creating quadruplets for " << regionTriplets.regionSize() << " regions from " << regionTriplets.tripletsSize() << " triplets"; + LogDebug("PixelQuadrupletMergerEDProducer") << "Creating quadruplets for " << regionTriplets.regionSize() << " regions from " << regionTriplets.size() << " triplets"; merger_.update(iSetup); - for(const auto& regionLayerPairAndLayers: regionTriplets) { - const TrackingRegion& region = regionLayerPairAndLayers.region(); + // to keep old results + if(comparitor_) comparitor_->init(iEvent, iSetup); + + for(const auto& regionSeedingHitSets: regionTriplets) { + const TrackingRegion& region = regionSeedingHitSets.region(); auto seedingHitSetsFiller = seedingHitSets->beginRegion(®ion); - for(const auto& layerTriplet: regionLayerPairAndLayers) { - tripletsPerRegion.insert(tripletsPerRegion.end(), layerTriplet.tripletsBegin(), layerTriplet.tripletsEnd()); + // Keeping same resuls has been made really difficult... + // Following is from SeedGeneratorFromRegionHits + seedCreator_->init(region, iSetup, comparitor_.get()); + for(const auto& hits: regionSeedingHitSets) { + if(!comparitor_ || comparitor_->compatible(hits)) { + seedCreator_->makeSeed(tmpSeedCollection_, hits); + } + + } + + // then convert seeds back to hits + // awful, but hopefully only temporary to preserve old results + for(const auto& seed: tmpSeedCollection_) { + auto hitRange = seed.recHits(); + assert(std::distance(hitRange.first, hitRange.second) == 3); + tripletsPerRegion.emplace_back(static_cast(&*(hitRange.first)), + static_cast(&*(hitRange.first+1)), + static_cast(&*(hitRange.first+2))); } LogTrace("PixelQuadrupletEDProducer") << " starting region, number of triplets " << tripletsPerRegion.size(); diff --git a/RecoTracker/IterativeTracking/python/InitialStep_cff.py b/RecoTracker/IterativeTracking/python/InitialStep_cff.py index b4398b2861cec..18dba62a34e49 100644 --- a/RecoTracker/IterativeTracking/python/InitialStep_cff.py +++ b/RecoTracker/IterativeTracking/python/InitialStep_cff.py @@ -65,6 +65,20 @@ initialStepSeeds = _seedCreatorFromRegionConsecutiveHitsEDProducer.clone( seedingHitSets = "initialStepHitTriplets", ) +# temporary... +initialStepHitQuadruplets.SeedCreatorPSet = cms.PSet( + ComponentName = cms.string("SeedFromConsecutiveHitsCreator"), + MinOneOverPtError = initialStepSeeds.MinOneOverPtError, + OriginTransverseErrorMultiplier = initialStepSeeds.OriginTransverseErrorMultiplier, + SeedMomentumForBOFF = initialStepSeeds.SeedMomentumForBOFF, + TTRHBuilder = initialStepSeeds.TTRHBuilder, + forceKinematicWithRegionDirection = initialStepSeeds.forceKinematicWithRegionDirection, + magneticField = initialStepSeeds.magneticField, + propagator = initialStepSeeds.propagator, + +) +initialStepHitQuadruplets.SeedComparitorPSet = initialStepSeeds.SeedComparitorPSet + from Configuration.Eras.Modifier_trackingLowPU_cff import trackingLowPU trackingLowPU.toModify(initialStepHitTriplets, maxElement=100000) trackingPhase1PU70.toModify(initialStepHitTriplets, maxElement=0, produceSeedingHitSets=False, produceIntermediateHitTriplets=True) From 87fe045503dca876766ebbbcd5b670dae7e8ff7a Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 12 Aug 2016 13:49:24 +0200 Subject: [PATCH 23/69] Migrate HighPtTripletStep and LowPtQuadStep --- .../python/HighPtTripletStep_cff.py | 65 ++++---- .../python/LowPtQuadStep_cff.py | 142 ++++++++++-------- 2 files changed, 118 insertions(+), 89 deletions(-) diff --git a/RecoTracker/IterativeTracking/python/HighPtTripletStep_cff.py b/RecoTracker/IterativeTracking/python/HighPtTripletStep_cff.py index 8f9e873db9c17..04d7d275b7dce 100644 --- a/RecoTracker/IterativeTracking/python/HighPtTripletStep_cff.py +++ b/RecoTracker/IterativeTracking/python/HighPtTripletStep_cff.py @@ -51,35 +51,44 @@ 'FPix6_pos+FPix7_pos+FPix9_pos', 'FPix6_neg+FPix7_neg+FPix9_neg'] ) -# SEEDS -from RecoTracker.TkSeedGenerator.GlobalSeedsFromTriplets_cff import * -from RecoTracker.TkTrackingRegions.GlobalTrackingRegionFromBeamSpot_cfi import RegionPsetFomBeamSpotBlock +# TrackingRegion +from RecoTracker.TkTrackingRegions.globalTrackingRegionFromBeamSpot_cfi import globalTrackingRegionFromBeamSpot as _globalTrackingRegionFromBeamSpot +highPtTripletStepTrackingRegions = _globalTrackingRegionFromBeamSpot.clone(RegionPSet = dict( + ptMin = 0.6, + originRadius = 0.02, + nSigmaZ = 4.0 +)) +from Configuration.Eras.Modifier_trackingPhase1PU70_cff import trackingPhase1PU70 +trackingPhase1PU70.toModify(highPtTripletStepTrackingRegions, RegionPSet = dict(ptMin = 0.7)) +trackingPhase2PU140.toModify(highPtTripletStepTrackingRegions, RegionPSet = dict(ptMin = 0.9, originRadius = 0.03)) + +# seeding +from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer +highPtTripletStepClusterCheck = _clusterCheckerEDProducer.clone( + PixelClusterCollectionLabel = 'siPixelClusters' +) +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +highPtTripletStepHitDoublets = _hitPairEDProducer.clone( + seedingLayers = "highPtTripletStepSeedLayers", + trackingRegions = "highPtTripletStepTrackingRegions", + clusterCheck = "highPtTripletStepClusterCheck", + produceIntermediateHitDoublets = True, +) +from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * -import RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi as _LowPtClusterShapeSeedComparitor_cfi -highPtTripletStepSeeds = globalSeedsFromTriplets.clone( - RegionFactoryPSet = RegionPsetFomBeamSpotBlock.clone( - ComponentName = cms.string('GlobalRegionProducerFromBeamSpot'), - RegionPSet = RegionPsetFomBeamSpotBlock.RegionPSet.clone( - ptMin = 0.6, - originRadius = 0.02, - nSigmaZ = 4.0 - ) - ), - OrderedHitsFactoryPSet = dict( - SeedingLayers = 'highPtTripletStepSeedLayers', - GeneratorPSet = dict( - SeedComparitorPSet = _LowPtClusterShapeSeedComparitor_cfi.LowPtClusterShapeSeedComparitor - ) - ) +import RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi +highPtTripletStepHitTriplets = _pixelTripletHLTEDProducer.clone( + doublets = "highPtTripletStepHitDoublets", + maxElement = 1000000, + produceSeedingHitSets = True, + SeedComparitorPSet = RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi.LowPtClusterShapeSeedComparitor ) -from Configuration.Eras.Modifier_trackingPhase1PU70_cff import trackingPhase1PU70 -trackingPhase1PU70.toModify(highPtTripletStepSeeds, RegionFactoryPSet = dict(RegionPSet = dict(ptMin = 0.7))) -trackingPhase2PU140.toModify(highPtTripletStepSeeds, - ClusterCheckPSet = dict(doClusterCheck = False), - RegionFactoryPSet = dict(RegionPSet = dict(ptMin = 0.9, originRadius = 0.03)), - OrderedHitsFactoryPSet = dict( GeneratorPSet = dict(maxElement = 0 ) ), - SeedCreatorPSet = dict(magneticField = '', propagator = 'PropagatorWithMaterial') +from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsEDProducer_cff import seedCreatorFromRegionConsecutiveHitsEDProducer as _seedCreatorFromRegionConsecutiveHitsEDProducer +highPtTripletStepSeeds = _seedCreatorFromRegionConsecutiveHitsEDProducer.clone( + seedingHitSets = "highPtTripletStepHitTriplets", ) +trackingPhase1PU70.toModify(highPtTripletStepHitTriplets, maxElement=0) +trackingPhase2PU140.toModify(highPtTripletStepHitTriplets, maxElement=0) # QUALITY CUTS DURING TRACK BUILDING import TrackingTools.TrajectoryFiltering.TrajectoryFilter_cff as _TrajectoryFilter_cff @@ -309,6 +318,10 @@ # Final sequence HighPtTripletStep = cms.Sequence(highPtTripletStepClusters* highPtTripletStepSeedLayers* + highPtTripletStepTrackingRegions* + highPtTripletStepClusterCheck* + highPtTripletStepHitDoublets* + highPtTripletStepHitTriplets* highPtTripletStepSeeds* highPtTripletStepTrackCandidates* highPtTripletStepTracks* diff --git a/RecoTracker/IterativeTracking/python/LowPtQuadStep_cff.py b/RecoTracker/IterativeTracking/python/LowPtQuadStep_cff.py index e90b5ffff5d2b..549a43c26f11b 100644 --- a/RecoTracker/IterativeTracking/python/LowPtQuadStep_cff.py +++ b/RecoTracker/IterativeTracking/python/LowPtQuadStep_cff.py @@ -19,76 +19,87 @@ layerList = RecoPixelVertexing.PixelTriplets.quadrupletseedmerging_cff.PixelSeedMergerQuadruplets.layerList.value() ) -# SEEDS -import RecoTracker.TkSeedGenerator.GlobalSeedsFromTriplets_cff -from RecoTracker.TkTrackingRegions.GlobalTrackingRegionFromBeamSpot_cfi import RegionPsetFomBeamSpotBlock -from RecoPixelVertexing.PixelTriplets.quadrupletseedmerging_cff import * +# TrackingRegion +from RecoTracker.TkTrackingRegions.globalTrackingRegionFromBeamSpot_cfi import globalTrackingRegionFromBeamSpot as _globalTrackingRegionFromBeamSpot +lowPtQuadStepTrackingRegions = _globalTrackingRegionFromBeamSpot.clone(RegionPSet = dict( + ptMin = 0.2, + originRadius = 0.02, + nSigmaZ = 4.0 +)) +from Configuration.Eras.Modifier_trackingPhase2PU140_cff import trackingPhase2PU140 +trackingPhase2PU140.toModify(lowPtQuadStepTrackingRegions, RegionPSet = dict(ptMin = 0.35)) + + +# seeding +from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer +lowPtQuadStepClusterCheck = _clusterCheckerEDProducer.clone( + PixelClusterCollectionLabel = 'siPixelClusters' +) +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +lowPtQuadStepHitDoublets = _hitPairEDProducer.clone( + seedingLayers = "lowPtQuadStepSeedLayers", + trackingRegions = "lowPtQuadStepTrackingRegions", + clusterCheck = "lowPtQuadStepClusterCheck", + produceIntermediateHitDoublets = True, +) +from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * -from RecoPixelVertexing.PixelTriplets.PixelQuadrupletGenerator_cfi import PixelQuadrupletGenerator as _PixelQuadrupletGenerator -import RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi as _LowPtClusterShapeSeedComparitor_cfi -lowPtQuadStepSeeds = RecoTracker.TkSeedGenerator.GlobalSeedsFromTriplets_cff.globalSeedsFromTriplets.clone( - RegionFactoryPSet = RegionPsetFomBeamSpotBlock.clone( - ComponentName = cms.string('GlobalRegionProducerFromBeamSpot'), - RegionPSet = RegionPsetFomBeamSpotBlock.RegionPSet.clone( - ptMin = 0.2, - originRadius = 0.02, - nSigmaZ = 4.0 - ) +import RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi +lowPtQuadStepHitTriplets = _pixelTripletHLTEDProducer.clone( + doublets = "lowPtQuadStepHitDoublets", + maxElement = 1000000, + produceIntermediateHitTriplets = True, + SeedComparitorPSet = RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi.LowPtClusterShapeSeedComparitor +) +from RecoPixelVertexing.PixelTriplets.pixelQuadrupletEDProducer_cfi import pixelQuadrupletEDProducer as _pixelQuadrupletEDProducer +lowPtQuadStepHitQuadruplets = _pixelQuadrupletEDProducer.clone( + triplets = "lowPtQuadStepHitTriplets", + extraHitRZtolerance = lowPtQuadStepHitTriplets.extraHitRZtolerance, + extraHitRPhitolerance = lowPtQuadStepHitTriplets.extraHitRPhitolerance, + maxChi2 = dict( + pt1 = 0.8 , pt2 = 2, + value1 = 2000, value2 = 100, + enabled = True, ), - OrderedHitsFactoryPSet = dict( - SeedingLayers = 'lowPtQuadStepSeedLayers', - GeneratorPSet = dict( - SeedComparitorPSet = _LowPtClusterShapeSeedComparitor_cfi.LowPtClusterShapeSeedComparitor - ) + extraPhiTolerance = dict( + pt1 = 0.3, pt2 = 1, + value1 = 0.4, value2 = 0.05, + enabled = True, ), + useBendingCorrection = True, + fitFastCircle = True, + fitFastCircleChi2Cut = True, + SeedComparitorPSet = lowPtQuadStepHitTriplets.SeedComparitorPSet, ) -trackingPhase1.toModify(lowPtQuadStepSeeds, - OrderedHitsFactoryPSet = cms.PSet( - ComponentName = cms.string("CombinedHitQuadrupletGenerator"), - GeneratorPSet = _PixelQuadrupletGenerator.clone( - extraHitRZtolerance = lowPtQuadStepSeeds.OrderedHitsFactoryPSet.GeneratorPSet.extraHitRZtolerance, - extraHitRPhitolerance = lowPtQuadStepSeeds.OrderedHitsFactoryPSet.GeneratorPSet.extraHitRPhitolerance, - SeedComparitorPSet = lowPtQuadStepSeeds.OrderedHitsFactoryPSet.GeneratorPSet.SeedComparitorPSet, - maxChi2 = dict( - pt1 = 0.8 , pt2 = 2, - value1 = 2000, value2 = 100, - enabled = True, - ), - extraPhiTolerance = dict( - pt1 = 0.3, pt2 = 1, - value1 = 0.4, value2 = 0.05, - enabled = True, - ), - useBendingCorrection = True, - fitFastCircle = True, - fitFastCircleChi2Cut = True, - ), - TripletGeneratorPSet = lowPtQuadStepSeeds.OrderedHitsFactoryPSet.GeneratorPSet, - SeedingLayers = lowPtQuadStepSeeds.OrderedHitsFactoryPSet.SeedingLayers, - ), +from RecoPixelVertexing.PixelTriplets.pixelQuadrupletMergerEDProducer_cfi import pixelQuadrupletMergerEDProducer as _pixelQuadrupletMergerEDProducer +from RecoPixelVertexing.PixelTriplets.quadrupletseedmerging_cff import * +_lowPtQuadStepHitQuadrupletsMerging = _pixelQuadrupletMergerEDProducer.clone( + triplets = "lowPtQuadStepHitTriplets", + layerList = dict(refToPSet_ = cms.string("PixelSeedMergerQuadruplets")), ) -from Configuration.Eras.Modifier_trackingPhase1PU70_cff import trackingPhase1PU70 -trackingPhase1PU70.toModify(lowPtQuadStepSeeds, - SeedMergerPSet = cms.PSet( - layerList = cms.PSet(refToPSet_ = cms.string("PixelSeedMergerQuadruplets")), - addRemainingTriplets = cms.bool(False), - mergeTriplets = cms.bool(True), - ttrhBuilderLabel = cms.string('PixelTTRHBuilderWithoutAngle') - ) +from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsEDProducer_cff import seedCreatorFromRegionConsecutiveHitsEDProducer as _seedCreatorFromRegionConsecutiveHitsEDProducer +lowPtQuadStepSeeds = _seedCreatorFromRegionConsecutiveHitsEDProducer.clone( + seedingHitSets = "lowPtQuadStepHitQuadruplets", ) -from Configuration.Eras.Modifier_trackingPhase2PU140_cff import trackingPhase2PU140 -trackingPhase2PU140.toModify(lowPtQuadStepSeeds, - ClusterCheckPSet = dict(doClusterCheck = False), - RegionFactoryPSet = dict(RegionPSet = dict(ptMin = 0.35)), - OrderedHitsFactoryPSet = dict( GeneratorPSet = dict(maxElement = 0 ) ), - SeedCreatorPSet = dict( magneticField = '', propagator = 'PropagatorWithMaterial'), - SeedMergerPSet = cms.PSet( - layerList = cms.PSet(refToPSet_ = cms.string("PixelSeedMergerQuadruplets")), - addRemainingTriplets = cms.bool(False), - mergeTriplets = cms.bool(True), - ttrhBuilderLabel = cms.string('PixelTTRHBuilderWithoutAngle') - ) +# temporary... +_lowPtQuadStepHitQuadrupletsMerging.SeedCreatorPSet = cms.PSet( + ComponentName = cms.string("SeedFromConsecutiveHitsCreator"), + MinOneOverPtError = lowPtQuadStepSeeds.MinOneOverPtError, + OriginTransverseErrorMultiplier = lowPtQuadStepSeeds.OriginTransverseErrorMultiplier, + SeedMomentumForBOFF = lowPtQuadStepSeeds.SeedMomentumForBOFF, + TTRHBuilder = lowPtQuadStepSeeds.TTRHBuilder, + forceKinematicWithRegionDirection = lowPtQuadStepSeeds.forceKinematicWithRegionDirection, + magneticField = lowPtQuadStepSeeds.magneticField, + propagator = lowPtQuadStepSeeds.propagator, + ) +_lowPtQuadStepHitQuadrupletsMerging.SeedComparitorPSet = lowPtQuadStepSeeds.SeedComparitorPSet + +from Configuration.Eras.Modifier_trackingPhase1PU70_cff import trackingPhase1PU70 +trackingPhase1PU70.toModify(lowPtQuadStepHitTriplets, maxElement=0, produceIntermediateHitTriplets=False, produceSeedingHitSets=True) +trackingPhase1PU70.toReplaceWith(lowPtQuadStepHitQuadruplets, _lowPtQuadStepHitQuadrupletsMerging) +trackingPhase2PU140.toModify(lowPtQuadStepHitTriplets, maxElement=0, produceIntermediateHitTriplets=False, produceSeedingHitSets=True) +trackingPhase2PU140.toReplaceWith(lowPtQuadStepHitQuadruplets, _lowPtQuadStepHitQuadrupletsMerging) # QUALITY CUTS DURING TRACK BUILDING @@ -282,6 +293,11 @@ # Final sequence LowPtQuadStep = cms.Sequence(lowPtQuadStepClusters* lowPtQuadStepSeedLayers* + lowPtQuadStepTrackingRegions* + lowPtQuadStepClusterCheck* + lowPtQuadStepHitDoublets* + lowPtQuadStepHitTriplets* + lowPtQuadStepHitQuadruplets* lowPtQuadStepSeeds* lowPtQuadStepTrackCandidates* lowPtQuadStepTracks* From 21bfb4de02a8c08365a71b4035f6c69f1dc73eea Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Mon, 15 Aug 2016 11:57:05 +0200 Subject: [PATCH 24/69] Migrate LowPtTripletStep --- .../Tracking/python/LowPtTripletStep_cff.py | 5 +- .../python/LowPtTripletStep_cff.py | 65 ++++++++++--------- 2 files changed, 39 insertions(+), 31 deletions(-) diff --git a/FastSimulation/Tracking/python/LowPtTripletStep_cff.py b/FastSimulation/Tracking/python/LowPtTripletStep_cff.py index a96a8cbcf6620..65df2c7cf3168 100644 --- a/FastSimulation/Tracking/python/LowPtTripletStep_cff.py +++ b/FastSimulation/Tracking/python/LowPtTripletStep_cff.py @@ -2,6 +2,7 @@ # import the full tracking equivalent of this file import RecoTracker.IterativeTracking.LowPtTripletStep_cff as _standard +from FastSimulation.Tracking.SeedingMigration import _regionProducerToFactoryPSet, _hitSetProducerToFactoryPSet # fast tracking mask producer import FastSimulation.Tracking.FastTrackerRecHitMaskProducer_cfi @@ -11,10 +12,10 @@ import FastSimulation.Tracking.TrajectorySeedProducer_cfi lowPtTripletStepSeeds = FastSimulation.Tracking.TrajectorySeedProducer_cfi.trajectorySeedProducer.clone( layerList = _standard.lowPtTripletStepSeedLayers.layerList.value(), - RegionFactoryPSet = _standard.lowPtTripletStepSeeds.RegionFactoryPSet, + RegionFactoryPSet = _regionProducerToFactoryPSet(_standard.lowPtTripletStepTrackingRegions), hitMasks = cms.InputTag("lowPtTripletStepMasks"), ) -lowPtTripletStepSeeds.seedFinderSelector.pixelTripletGeneratorFactory = _standard.lowPtTripletStepSeeds.OrderedHitsFactoryPSet.GeneratorPSet +lowPtTripletStepSeeds.seedFinderSelector.pixelTripletGeneratorFactory = _hitSetProducerToFactoryPSet(_standard.lowPtTripletStepHitTriplets) #lowPtTripletStepSeeds.pixelTripletGeneratorFactory.SeedComparitorPSet=cms.PSet( ComponentName = cms.string( "none" ) ) # track candidates diff --git a/RecoTracker/IterativeTracking/python/LowPtTripletStep_cff.py b/RecoTracker/IterativeTracking/python/LowPtTripletStep_cff.py index dd2021b03a477..556ff6accc3d9 100644 --- a/RecoTracker/IterativeTracking/python/LowPtTripletStep_cff.py +++ b/RecoTracker/IterativeTracking/python/LowPtTripletStep_cff.py @@ -26,8 +26,8 @@ 'BPix1+FPix1_pos+FPix3_pos', 'BPix1+FPix1_neg+FPix3_neg' ] from Configuration.Eras.Modifier_trackingPhase1_cff import trackingPhase1 -trackingPhase1.toModify(lowPtTripletStepSeedLayers, layerList = _layerListForPhase1) from Configuration.Eras.Modifier_trackingPhase1PU70_cff import trackingPhase1PU70 +trackingPhase1.toModify(lowPtTripletStepSeedLayers, layerList = _layerListForPhase1) trackingPhase1PU70.toModify(lowPtTripletStepSeedLayers, layerList = _layerListForPhase1) _layerListForPhase2 = ['BPix1+BPix2+BPix3', 'BPix2+BPix3+BPix4', @@ -46,41 +46,44 @@ from Configuration.Eras.Modifier_trackingPhase2PU140_cff import trackingPhase2PU140 trackingPhase2PU140.toModify(lowPtTripletStepSeedLayers, layerList = _layerListForPhase2) -# SEEDS -import RecoTracker.TkSeedGenerator.GlobalSeedsFromTriplets_cff -from RecoTracker.TkTrackingRegions.GlobalTrackingRegionFromBeamSpot_cfi import RegionPsetFomBeamSpotBlock -lowPtTripletStepSeeds = RecoTracker.TkSeedGenerator.GlobalSeedsFromTriplets_cff.globalSeedsFromTriplets.clone( - RegionFactoryPSet = RegionPsetFomBeamSpotBlock.clone( - ComponentName = cms.string('GlobalRegionProducerFromBeamSpot'), - RegionPSet = RegionPsetFomBeamSpotBlock.RegionPSet.clone( +# TrackingRegion +from RecoTracker.TkTrackingRegions.globalTrackingRegionFromBeamSpot_cfi import globalTrackingRegionFromBeamSpot as _globalTrackingRegionFromBeamSpot +lowPtTripletStepTrackingRegions = _globalTrackingRegionFromBeamSpot.clone(RegionPSet = dict( ptMin = 0.2, originRadius = 0.02, nSigmaZ = 4.0 - ) - ) - ) -lowPtTripletStepSeeds.OrderedHitsFactoryPSet.SeedingLayers = 'lowPtTripletStepSeedLayers' -trackingPhase1.toModify(lowPtTripletStepSeeds, # FIXME: Phase1PU70 value, let's see if we can lower it to Run2 value (0.2) - RegionFactoryPSet = dict(RegionPSet = dict(ptMin = 0.35)), -) -trackingPhase1PU70.toModify(lowPtTripletStepSeeds, - RegionFactoryPSet = dict( - RegionPSet = dict( - ptMin = 0.35, - originRadius = 0.015 - ) - ), +)) +trackingPhase1.toModify(lowPtTripletStepTrackingRegions, RegionPSet = dict(ptMin = 0.35)) # FIXME: Phase1PU70 value, let's see if we can lower it to Run2 value (0.2) +trackingPhase1PU70.toModify(lowPtTripletStepTrackingRegions, RegionPSet = dict(ptMin = 0.35, originRadius = 0.015)) +trackingPhase2PU140.toModify(lowPtTripletStepTrackingRegions, RegionPSet = dict(ptMin = 0.45)) + +# seeding +from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer +lowPtTripletStepClusterCheck = _clusterCheckerEDProducer.clone( + PixelClusterCollectionLabel = 'siPixelClusters' ) -trackingPhase2PU140.toModify(lowPtTripletStepSeeds, - ClusterCheckPSet = dict(doClusterCheck = False), - RegionFactoryPSet = dict(RegionPSet = dict(ptMin = 0.45)), - OrderedHitsFactoryPSet = dict( GeneratorPSet = dict(maxElement = 0 ) ), - SeedCreatorPSet = dict( magneticField = '', propagator = 'PropagatorWithMaterial'), +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +lowPtTripletStepHitDoublets = _hitPairEDProducer.clone( + seedingLayers = "lowPtTripletStepSeedLayers", + trackingRegions = "lowPtTripletStepTrackingRegions", + clusterCheck = "lowPtTripletStepClusterCheck", + produceIntermediateHitDoublets = True, ) - +from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * import RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi -lowPtTripletStepSeeds.OrderedHitsFactoryPSet.GeneratorPSet.SeedComparitorPSet = RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi.LowPtClusterShapeSeedComparitor +lowPtTripletStepHitTriplets = _pixelTripletHLTEDProducer.clone( + doublets = "lowPtTripletStepHitDoublets", + maxElement = 1000000, + produceSeedingHitSets = True, + SeedComparitorPSet = RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi.LowPtClusterShapeSeedComparitor +) +from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsEDProducer_cff import seedCreatorFromRegionConsecutiveHitsEDProducer as _seedCreatorFromRegionConsecutiveHitsEDProducer +lowPtTripletStepSeeds = _seedCreatorFromRegionConsecutiveHitsEDProducer.clone( + seedingHitSets = "lowPtTripletStepHitTriplets", +) +trackingPhase1PU70.toModify(lowPtTripletStepHitTriplets, maxElement=0) +trackingPhase2PU140.toModify(lowPtTripletStepHitTriplets, maxElement=0) # QUALITY CUTS DURING TRACK BUILDING @@ -333,6 +336,10 @@ # Final sequence LowPtTripletStep = cms.Sequence(lowPtTripletStepClusters* lowPtTripletStepSeedLayers* + lowPtTripletStepTrackingRegions* + lowPtTripletStepClusterCheck* + lowPtTripletStepHitDoublets* + lowPtTripletStepHitTriplets* lowPtTripletStepSeeds* lowPtTripletStepTrackCandidates* lowPtTripletStepTracks* From c7fbdd79870e6e5162e97b3446df2b3f0bed9ec4 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Mon, 15 Aug 2016 15:15:52 +0200 Subject: [PATCH 25/69] Add PixelTripletLargeTipEDProducer and SeedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer --- .../plugins/PixelTripletLargeTipGenerator.cc | 43 +++++++++++++++++-- .../plugins/PixelTripletLargeTipGenerator.h | 19 ++++++++ .../PixelTriplets/plugins/SealModule.cc | 3 ++ .../TkSeedGenerator/plugins/SealModules.cc | 3 ++ ...eedFromConsecutiveHitsTripletOnlyCreator.h | 5 +++ ...onsecutiveHitsTripletOnlyEDProducer_cff.py | 11 +++++ 6 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 RecoTracker/TkSeedGenerator/python/seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer_cff.py diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.cc b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.cc index 7ad0f82fbad46..de8d206c3be95 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.cc @@ -1,5 +1,6 @@ #include "RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.h" #include "RecoTracker/TkHitPairs/interface/HitPairGeneratorFromLayerPair.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "RecoPixelVertexing/PixelTriplets/interface/ThirdHitPredictionFromCircle.h" #include "ThirdHitRZPrediction.h" @@ -56,6 +57,18 @@ PixelTripletLargeTipGenerator::PixelTripletLargeTipGenerator(const edm::Paramete PixelTripletLargeTipGenerator::~PixelTripletLargeTipGenerator() {} +void PixelTripletLargeTipGenerator::fillDescriptions(edm::ParameterSetDescription& desc) { + HitTripletGeneratorFromPairAndLayers::fillDescriptions(desc); + // Defaults for the extraHit*tolerance are set to 0 here since that + // was already the case in practice in all offline occurrances. + desc.add("extraHitRPhitolerance", 0); // default in old python was 0.032 + desc.add("extraHitRZtolerance", 0); // default in old python was 0.037 + desc.add("useMultScattering", true); + desc.add("useBending", true); + desc.add("useFixedPreFiltering", false); + desc.add("phiPreFiltering", 0.3); +} + namespace { inline bool intersect(Range &range, const Range &second) @@ -81,16 +94,28 @@ void PixelTripletLargeTipGenerator::hitTriplets(const TrackingRegion& region, if (doublets.empty()) return; + assert(theLayerCache); + hitTriplets(region, result, ev, es, doublets,thirdLayers, nullptr, *theLayerCache); +} + +void PixelTripletLargeTipGenerator::hitTriplets(const TrackingRegion& region, OrderedHitTriplets& result, + const edm::Event& ev, const edm::EventSetup& es, + const HitDoublets& doublets, + const std::vector& thirdLayers, + std::vector *tripletLastLayerIndex, + LayerCacheType& layerCache) { int size = thirdLayers.size(); const RecHitsSortedInPhi * thirdHitMap[size]; vector thirdLayerDetLayer(size,0); for (int il=0; il & thirdLayerDetLayer, const int nThirdLayers) -{ +{ + hitTriplets(region, result, es, doublets, thirdHitMap, thirdLayerDetLayer, nThirdLayers, nullptr); +} + +void PixelTripletLargeTipGenerator::hitTriplets(const TrackingRegion& region, OrderedHitTriplets & result, + const edm::EventSetup & es, + const HitDoublets & doublets, + const RecHitsSortedInPhi ** thirdHitMap, + const std::vector & thirdLayerDetLayer, + const int nThirdLayers, + std::vector *tripletLastLayerIndex) { edm::ESHandle tracker; es.get().get(tracker); @@ -380,6 +415,8 @@ void PixelTripletLargeTipGenerator::hitTriplets( return; } result.emplace_back( doublets.hit(ip,HitDoublets::inner), doublets.hit(ip,HitDoublets::outer), hits.theHits[KDdata].hit()); + // to bookkeep the triplets and 3rd layers in triplet EDProducer + if(tripletLastLayerIndex) tripletLastLayerIndex->push_back(il); } } } diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.h b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.h index 98a80d28b2440..49366049f4e5a 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.h +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.h @@ -21,15 +21,26 @@ class PixelTripletLargeTipGenerator : public HitTripletGeneratorFromPairAndLayer typedef CombinedHitTripletGenerator::LayerCacheType LayerCacheType; public: + PixelTripletLargeTipGenerator( const edm::ParameterSet& cfg, edm::ConsumesCollector&& iC): PixelTripletLargeTipGenerator(cfg, iC) {} PixelTripletLargeTipGenerator( const edm::ParameterSet& cfg, edm::ConsumesCollector& iC); virtual ~PixelTripletLargeTipGenerator(); + static void fillDescriptions(edm::ParameterSetDescription& desc); + static const char *fillDescriptionsLabel() { return "pixelTripletLargeTip"; } + virtual void hitTriplets( const TrackingRegion& region, OrderedHitTriplets & trs, const edm::Event & ev, const edm::EventSetup& es, const SeedingLayerSetsHits::SeedingLayerSet& pairLayers, const std::vector& thirdLayers) override; + void hitTriplets(const TrackingRegion& region, OrderedHitTriplets& trs, + const edm::Event& ev, const edm::EventSetup& es, + const HitDoublets& doublets, + const std::vector& thirdLayers, + std::vector *tripletLastLayerIndex, + LayerCacheType& layerCache); + void hitTriplets( const TrackingRegion& region, OrderedHitTriplets & result, @@ -39,6 +50,14 @@ typedef CombinedHitTripletGenerator::LayerCacheType LayerCacheType; const std::vector & thirdLayerDetLayer, const int nThirdLayers)override; + void hitTriplets(const TrackingRegion& region, OrderedHitTriplets & result, + const edm::EventSetup & es, + const HitDoublets & doublets, + const RecHitsSortedInPhi ** thirdHitMap, + const std::vector & thirdLayerDetLayer, + const int nThirdLayers, + std::vector *tripletLastLayerIndex); + private: const bool useFixedPreFiltering; const float extraHitRZtolerance; diff --git a/RecoPixelVertexing/PixelTriplets/plugins/SealModule.cc b/RecoPixelVertexing/PixelTriplets/plugins/SealModule.cc index f632ab6e82370..3effdec36bff4 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/SealModule.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/SealModule.cc @@ -35,3 +35,6 @@ DEFINE_EDM_PLUGIN(OrderedHitsGeneratorFactory, CAHitQuadrupletGenerator, "CAHitQ #include "RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h" using PixelTripletHLTEDProducer = HitTripletEDProducerT; DEFINE_FWK_MODULE(PixelTripletHLTEDProducer); + +using PixelTripletLargeTipEDProducer = HitTripletEDProducerT; +DEFINE_FWK_MODULE(PixelTripletLargeTipEDProducer); diff --git a/RecoTracker/TkSeedGenerator/plugins/SealModules.cc b/RecoTracker/TkSeedGenerator/plugins/SealModules.cc index edcb1fcd8ac2b..2ad71ffae8943 100644 --- a/RecoTracker/TkSeedGenerator/plugins/SealModules.cc +++ b/RecoTracker/TkSeedGenerator/plugins/SealModules.cc @@ -32,3 +32,6 @@ DEFINE_EDM_PLUGIN(MultiHitGeneratorFromPairAndLayersFactory, MultiHitGeneratorFr #include "RecoTracker/TkSeedGenerator/interface/SeedCreatorFromRegionHitsEDProducerT.h" using SeedCreatorFromRegionConsecutiveHitsEDProducer = SeedCreatorFromRegionHitsEDProducerT; DEFINE_FWK_MODULE(SeedCreatorFromRegionConsecutiveHitsEDProducer); + +using SeedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer = SeedCreatorFromRegionHitsEDProducerT; +DEFINE_FWK_MODULE(SeedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer); diff --git a/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsTripletOnlyCreator.h b/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsTripletOnlyCreator.h index e11178c5cd471..e8a32e6404abf 100644 --- a/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsTripletOnlyCreator.h +++ b/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsTripletOnlyCreator.h @@ -9,6 +9,11 @@ class dso_hidden SeedFromConsecutiveHitsTripletOnlyCreator final : public SeedFr SeedFromConsecutiveHitsTripletOnlyCreator( const edm::ParameterSet & cfg): SeedFromConsecutiveHitsCreator(cfg) { } + static void fillDescriptions(edm::ParameterSetDescription& desc) { + SeedFromConsecutiveHitsCreator::fillDescriptions(desc); + } + static const char *fillDescriptionsLabel() { return "ConsecutiveHitsTripletOnly"; } + virtual ~SeedFromConsecutiveHitsTripletOnlyCreator(){} private: diff --git a/RecoTracker/TkSeedGenerator/python/seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer_cff.py b/RecoTracker/TkSeedGenerator/python/seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer_cff.py new file mode 100644 index 0000000000000..71fd7b0c9000b --- /dev/null +++ b/RecoTracker/TkSeedGenerator/python/seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer_cff.py @@ -0,0 +1,11 @@ +from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer_cfi import * +from Configuration.Eras.Modifier_trackingPhase1PU70_cff import trackingPhase1PU70 +from Configuration.Eras.Modifier_trackingPhase2PU140_cff import trackingPhase2PU140 +trackingPhase1PU70.toModify(seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer, + magneticField = '', + propagator = 'PropagatorWithMaterial', +) +trackingPhase2PU140.toModify(seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer, + magneticField = '', + propagator = 'PropagatorWithMaterial', +) From 4e181c346e6bde1a4b9328cb61d27a9e8f772699 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Mon, 15 Aug 2016 15:51:04 +0200 Subject: [PATCH 26/69] Migrate DetachedQuadStep --- .../python/DetachedQuadStep_cff.py | 169 ++++++++++-------- 1 file changed, 91 insertions(+), 78 deletions(-) diff --git a/RecoTracker/IterativeTracking/python/DetachedQuadStep_cff.py b/RecoTracker/IterativeTracking/python/DetachedQuadStep_cff.py index ad25b7a4bb121..6f3863d790c58 100644 --- a/RecoTracker/IterativeTracking/python/DetachedQuadStep_cff.py +++ b/RecoTracker/IterativeTracking/python/DetachedQuadStep_cff.py @@ -26,29 +26,75 @@ layerList = RecoTracker.TkSeedingLayers.PixelLayerTriplets_cfi.PixelLayerTriplets.layerList.value() ) -# SEEDS -from RecoPixelVertexing.PixelTriplets.PixelTripletLargeTipGenerator_cfi import * -PixelTripletLargeTipGenerator.extraHitRZtolerance = 0.0 -PixelTripletLargeTipGenerator.extraHitRPhitolerance = 0.0 -import RecoTracker.TkSeedGenerator.GlobalSeedsFromTriplets_cff -from RecoTracker.TkTrackingRegions.GlobalTrackingRegionFromBeamSpot_cfi import RegionPsetFomBeamSpotBlock as _RegionPsetFomBeamSpotBlock -from RecoPixelVertexing.PixelTriplets.quadrupletseedmerging_cff import * -from RecoPixelVertexing.PixelTriplets.PixelQuadrupletGenerator_cfi import PixelQuadrupletGenerator as _PixelQuadrupletGenerator -detachedQuadStepSeeds = RecoTracker.TkSeedGenerator.GlobalSeedsFromTriplets_cff.globalSeedsFromTriplets.clone( - OrderedHitsFactoryPSet = dict( - SeedingLayers = 'detachedQuadStepSeedLayers', - GeneratorPSet = cms.PSet(PixelTripletLargeTipGenerator) +# TrackingRegion +from RecoTracker.TkTrackingRegions.globalTrackingRegionFromBeamSpotFixedZ_cfi import globalTrackingRegionFromBeamSpotFixedZ as _globalTrackingRegionFromBeamSpotFixedZ +detachedQuadStepTrackingRegions = _globalTrackingRegionFromBeamSpotFixedZ.clone(RegionPSet = dict( + ptMin = 0.3, + originHalfLength = 15.0, + originRadius = 1.5 +)) +from RecoTracker.TkTrackingRegions.globalTrackingRegionFromBeamSpot_cfi import globalTrackingRegionFromBeamSpot as _globalTrackingRegionFromBeamSpot +from Configuration.Eras.Modifier_trackingPhase1PU70_cff import trackingPhase1PU70 +trackingPhase1PU70.toReplaceWith(detachedQuadStepTrackingRegions, _globalTrackingRegionFromBeamSpot.clone(RegionPSet = dict( + ptMin = 0.3, + originRadius = 0.5, + nSigmaZ = 4.0 +))) +trackingPhase2PU140.toReplaceWith(detachedQuadStepTrackingRegions, _globalTrackingRegionFromBeamSpot.clone(RegionPSet = dict( + ptMin = 0.45, + originRadius = 0.7, + nSigmaZ = 4.0 +))) + +# seeding +from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer +detachedQuadStepClusterCheck = _clusterCheckerEDProducer.clone( + PixelClusterCollectionLabel = 'siPixelClusters' +) +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +detachedQuadStepHitDoublets = _hitPairEDProducer.clone( + seedingLayers = "detachedQuadStepSeedLayers", + trackingRegions = "detachedQuadStepTrackingRegions", + clusterCheck = "detachedQuadStepClusterCheck", + produceIntermediateHitDoublets = True, +) +from RecoPixelVertexing.PixelTriplets.pixelTripletLargeTipEDProducer_cfi import pixelTripletLargeTipEDProducer as _pixelTripletLargeTipEDProducer +from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * +detachedQuadStepHitTriplets = _pixelTripletLargeTipEDProducer.clone( + doublets = "detachedQuadStepHitDoublets", + maxElement = 1000000, + produceIntermediateHitTriplets = True, +) +from RecoPixelVertexing.PixelTriplets.pixelQuadrupletEDProducer_cfi import pixelQuadrupletEDProducer as _pixelQuadrupletEDProducer +detachedQuadStepHitQuadruplets = _pixelQuadrupletEDProducer.clone( + triplets = "detachedQuadStepHitTriplets", + extraHitRZtolerance = detachedQuadStepHitTriplets.extraHitRZtolerance, + extraHitRPhitolerance = detachedQuadStepHitTriplets.extraHitRPhitolerance, + maxChi2 = dict( + pt1 = 0.8, pt2 = 2, + value1 = 500, value2 = 100, + enabled = True, ), - SeedCreatorPSet = dict(ComponentName = 'SeedFromConsecutiveHitsTripletOnlyCreator'), - RegionFactoryPSet = dict( - RegionPSet = dict( - ptMin = 0.3, - originHalfLength = 15.0, - originRadius = 1.5 - ) + extraPhiTolerance = dict( + pt1 = 0.4, pt2 = 1, + value1 = 0.2, value2 = 0.05, + enabled = True, ), - SeedComparitorPSet = cms.PSet( - ComponentName = cms.string('PixelClusterShapeSeedComparitor'), + useBendingCorrection = True, + fitFastCircle = True, + fitFastCircleChi2Cut = True, +) +from RecoPixelVertexing.PixelTriplets.pixelQuadrupletMergerEDProducer_cfi import pixelQuadrupletMergerEDProducer as _pixelQuadrupletMergerEDProducer +from RecoPixelVertexing.PixelTriplets.quadrupletseedmerging_cff import * +_detachedQuadStepHitQuadrupletsMerging = _pixelQuadrupletMergerEDProducer.clone( + triplets = "detachedQuadStepHitTriplets", + layerList = dict(refToPSet_ = cms.string("PixelSeedMergerQuadruplets")), +) +from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer_cff import seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer as _seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer +detachedQuadStepSeeds = _seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer.clone( + seedingHitSets = "detachedQuadStepHitQuadruplets", + SeedComparitorPSet = dict(# FIXME: is this defined in any cfi that could be imported instead of copy-paste? + ComponentName = 'PixelClusterShapeSeedComparitor', FilterAtHelixStage = cms.bool(False), FilterPixelHits = cms.bool(True), FilterStripHits = cms.bool(False), @@ -56,64 +102,26 @@ ClusterShapeCacheSrc = cms.InputTag('siPixelClusterShapeCache') ), ) -trackingPhase1.toModify(detachedQuadStepSeeds, - OrderedHitsFactoryPSet = cms.PSet( - ComponentName = cms.string("CombinedHitQuadrupletGenerator"), - GeneratorPSet = _PixelQuadrupletGenerator.clone( - extraHitRZtolerance = detachedQuadStepSeeds.OrderedHitsFactoryPSet.GeneratorPSet.extraHitRZtolerance, - extraHitRPhitolerance = detachedQuadStepSeeds.OrderedHitsFactoryPSet.GeneratorPSet.extraHitRPhitolerance, - maxChi2 = dict( - pt1 = 0.8, pt2 = 2, - value1 = 500, value2 = 100, - enabled = True, - ), - extraPhiTolerance = dict( - pt1 = 0.4, pt2 = 1, - value1 = 0.2, value2 = 0.05, - enabled = True, - ), - useBendingCorrection = True, - fitFastCircle = True, - fitFastCircleChi2Cut = True, - ), - TripletGeneratorPSet = detachedQuadStepSeeds.OrderedHitsFactoryPSet.GeneratorPSet, - SeedingLayers = detachedQuadStepSeeds.OrderedHitsFactoryPSet.SeedingLayers, - ), -) -from Configuration.Eras.Modifier_trackingPhase1PU70_cff import trackingPhase1PU70 -trackingPhase1PU70.toModify(detachedQuadStepSeeds, - RegionFactoryPSet = dict( - RegionPSet = _RegionPsetFomBeamSpotBlock.RegionPSet.clone( - ptMin = 0.3, - originRadius = 0.5, - nSigmaZ = 4.0 - ) - ), - SeedMergerPSet = cms.PSet( - layerList = cms.PSet(refToPSet_ = cms.string("PixelSeedMergerQuadruplets")), - addRemainingTriplets = cms.bool(False), - mergeTriplets = cms.bool(True), - ttrhBuilderLabel = cms.string('PixelTTRHBuilderWithoutAngle') - ) -) -trackingPhase2PU140.toModify(detachedQuadStepSeeds, - RegionFactoryPSet = dict( - RegionPSet = _RegionPsetFomBeamSpotBlock.RegionPSet.clone( - ptMin = 0.45, - originRadius = 0.7, - nSigmaZ = 4.0 - ) - ), - ClusterCheckPSet = dict(doClusterCheck = False), - OrderedHitsFactoryPSet = dict( GeneratorPSet = dict(maxElement = 0 ) ), - SeedCreatorPSet = dict( magneticField = '', propagator = 'PropagatorWithMaterial'), - SeedMergerPSet = cms.PSet( - layerList = cms.PSet(refToPSet_ = cms.string("PixelSeedMergerQuadruplets")), - addRemainingTriplets = cms.bool(False), - mergeTriplets = cms.bool(True), - ttrhBuilderLabel = cms.string('PixelTTRHBuilderWithoutAngle') - ) +# temporary... +_detachedQuadStepHitQuadrupletsMerging.SeedCreatorPSet = cms.PSet( + ComponentName = cms.string("SeedFromConsecutiveHitsTripletOnlyCreator"), + MinOneOverPtError = detachedQuadStepSeeds.MinOneOverPtError, + OriginTransverseErrorMultiplier = detachedQuadStepSeeds.OriginTransverseErrorMultiplier, + SeedMomentumForBOFF = detachedQuadStepSeeds.SeedMomentumForBOFF, + TTRHBuilder = detachedQuadStepSeeds.TTRHBuilder, + forceKinematicWithRegionDirection = detachedQuadStepSeeds.forceKinematicWithRegionDirection, + magneticField = detachedQuadStepSeeds.magneticField, + propagator = detachedQuadStepSeeds.propagator, ) +_detachedQuadStepHitQuadrupletsMerging.SeedComparitorPSet = detachedQuadStepSeeds.SeedComparitorPSet + +trackingPhase1PU70.toModify(detachedQuadStepHitTriplets, maxElement=0, produceIntermediateHitTriplets=False, produceSeedingHitSets=True) +trackingPhase1PU70.toReplaceWith(detachedQuadStepHitQuadruplets, _detachedQuadStepHitQuadrupletsMerging) +trackingPhase1PU70.toModify(detachedQuadStepSeeds, SeedComparitorPSet=cms.PSet(ComponentName=cms.string("none"))) +trackingPhase2PU140.toModify(detachedQuadStepHitTriplets, maxElement=0, produceIntermediateHitTriplets=False, produceSeedingHitSets=True) +trackingPhase2PU140.toReplaceWith(detachedQuadStepHitQuadruplets, _detachedQuadStepHitQuadrupletsMerging) +trackingPhase2PU140.toModify(detachedQuadStepSeeds, SeedComparitorPSet=cms.PSet(ComponentName=cms.string("none"))) + # QUALITY CUTS DURING TRACK BUILDING import TrackingTools.TrajectoryFiltering.TrajectoryFilter_cff as _TrajectoryFilter_cff @@ -432,6 +440,11 @@ DetachedQuadStep = cms.Sequence(detachedQuadStepClusters* detachedQuadStepSeedLayers* + detachedQuadStepTrackingRegions* + detachedQuadStepClusterCheck* + detachedQuadStepHitDoublets* + detachedQuadStepHitTriplets* + detachedQuadStepHitQuadruplets* detachedQuadStepSeeds* detachedQuadStepTrackCandidates* detachedQuadStepTracks* From 71dbc4147be6466c82811b0d57d6a1d1355f8621 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 16 Aug 2016 15:12:49 +0200 Subject: [PATCH 27/69] Migrate DetachedTripletStep --- .../python/DetachedTripletStep_cff.py | 5 +- .../Tracking/python/SeedingMigration.py | 1 + .../HiRegitMuonDetachedTripletStep_cff.py | 53 +++++++++++++------ .../python/DetachedTripletStep_cff.py | 52 ++++++++++++------ 4 files changed, 77 insertions(+), 34 deletions(-) diff --git a/FastSimulation/Tracking/python/DetachedTripletStep_cff.py b/FastSimulation/Tracking/python/DetachedTripletStep_cff.py index 4c0590232628e..dce6e2842d5b8 100644 --- a/FastSimulation/Tracking/python/DetachedTripletStep_cff.py +++ b/FastSimulation/Tracking/python/DetachedTripletStep_cff.py @@ -2,6 +2,7 @@ # import the full tracking equivalent of this file import RecoTracker.IterativeTracking.DetachedTripletStep_cff as _standard +from FastSimulation.Tracking.SeedingMigration import _regionProducerToFactoryPSet, _hitSetProducerToFactoryPSet # fast tracking mask producer import FastSimulation.Tracking.FastTrackerRecHitMaskProducer_cfi @@ -11,10 +12,10 @@ import FastSimulation.Tracking.TrajectorySeedProducer_cfi detachedTripletStepSeeds = FastSimulation.Tracking.TrajectorySeedProducer_cfi.trajectorySeedProducer.clone( layerList = _standard.detachedTripletStepSeedLayers.layerList.value(), - RegionFactoryPSet = _standard.detachedTripletStepSeeds.RegionFactoryPSet, + RegionFactoryPSet = _regionProducerToFactoryPSet(_standard.detachedTripletStepTrackingRegions), hitMasks = cms.InputTag("detachedTripletStepMasks") ) -detachedTripletStepSeeds.seedFinderSelector.pixelTripletGeneratorFactory = _standard.detachedTripletStepSeeds.OrderedHitsFactoryPSet.GeneratorPSet +detachedTripletStepSeeds.seedFinderSelector.pixelTripletGeneratorFactory = _hitSetProducerToFactoryPSet(_standard.detachedTripletStepHitTriplets) # track candidates import FastSimulation.Tracking.TrackCandidateProducer_cfi diff --git a/FastSimulation/Tracking/python/SeedingMigration.py b/FastSimulation/Tracking/python/SeedingMigration.py index 5b9072134d7a9..8a004ebb8c279 100644 --- a/FastSimulation/Tracking/python/SeedingMigration.py +++ b/FastSimulation/Tracking/python/SeedingMigration.py @@ -18,6 +18,7 @@ def _copy(old, new, skip=[]): def _hitSetProducerToFactoryPSet(producer): _map = { "PixelTripletHLTEDProducer": "PixelTripletHLTGenerator", + "PixelTripletLargeTipEDProducer": "PixelTripletLargeTipGenerator", } ret = cms.PSet() _copy(producer, ret) diff --git a/RecoHI/HiMuonAlgos/python/HiRegitMuonDetachedTripletStep_cff.py b/RecoHI/HiMuonAlgos/python/HiRegitMuonDetachedTripletStep_cff.py index e1902abb8f1c2..35b3c12abc6b4 100644 --- a/RecoHI/HiMuonAlgos/python/HiRegitMuonDetachedTripletStep_cff.py +++ b/RecoHI/HiMuonAlgos/python/HiRegitMuonDetachedTripletStep_cff.py @@ -5,15 +5,24 @@ ################################### 3rd step: low-pT and displaced tracks from pixel triplets from RecoHI.HiTracking.HITrackingRegionProducer_cfi import * -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.vertexCollection = cms.InputTag("hiSelectedVertex") -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonSrc= cms.InputTag("standAloneMuons","UpdatedAtVtx") - -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.UseVertex = True - -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.Phi_fixed = True -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.Eta_fixed = True -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.DeltaPhi = 0.3 -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.DeltaEta = 0.2 +# Are the following values set to the same in every iteration? If yes, +# why not making the change in HITrackingRegionProducer_cfi directly +# once for all? +hiRegitMuDetachedTripletStepTrackingRegions = HiTrackingRegionFactoryFromSTAMuonsEDProducer.clone( + MuonSrc = "standAloneMuons:UpdatedAtVtx", # this is the same as default, why repeat? + MuonTrackingRegionBuilder = dict( + vertexCollection = "hiSelectedVertex", + Phi_fixed = True, + Eta_fixed = True, + DeltaPhi = 0.3, + DeltaEta = 0.2, + # Ok, the following ones are specific to DetachedTripletStep + Pt_min = 0.9, + DeltaR = 2.0, # default = 0.2 + DeltaZ = 2.0, # this give you the length + Rescale_Dz = 4., # max(DeltaZ_Region,Rescale_Dz*vtx->zError()) + ) +) ################################### from RecoTracker.IterativeTracking.DetachedTripletStep_cff import * @@ -32,14 +41,20 @@ hiRegitMuDetachedTripletStepSeedLayers.FPix.skipClusters = cms.InputTag('hiRegitMuDetachedTripletStepClusters') # seeding -hiRegitMuDetachedTripletStepSeeds = RecoTracker.IterativeTracking.DetachedTripletStep_cff.detachedTripletStepSeeds.clone() -hiRegitMuDetachedTripletStepSeeds.RegionFactoryPSet = HiTrackingRegionFactoryFromSTAMuonsBlock.clone() -hiRegitMuDetachedTripletStepSeeds.ClusterCheckPSet.doClusterCheck = False # do not check for max number of clusters pixel or strips -hiRegitMuDetachedTripletStepSeeds.RegionFactoryPSet.MuonTrackingRegionBuilder.Pt_min = 0.9 -hiRegitMuDetachedTripletStepSeeds.RegionFactoryPSet.MuonTrackingRegionBuilder.DeltaR = 2.0 # default = 0.2 -hiRegitMuDetachedTripletStepSeeds.RegionFactoryPSet.MuonTrackingRegionBuilder.DeltaZ = 2.0 # this give you the length -hiRegitMuDetachedTripletStepSeeds.RegionFactoryPSet.MuonTrackingRegionBuilder.Rescale_Dz = 4. # max(DeltaZ_Region,Rescale_Dz*vtx->zError()) -hiRegitMuDetachedTripletStepSeeds.OrderedHitsFactoryPSet.SeedingLayers = 'hiRegitMuDetachedTripletStepSeedLayers' +hiRegitMuDetachedTripletStepClusterCheck = RecoTracker.IterativeTracking.DetachedTripletStep_cff.detachedTripletStepClusterCheck.clone( + doClusterCheck = False # do not check for max number of clusters pixel or strips +) +hiRegitMuDetachedTripletStepHitDoublets = RecoTracker.IterativeTracking.DetachedTripletStep_cff.detachedTripletStepHitDoublets.clone( + seedingLayers = "hiRegitMuDetachedTripletStepSeedLayers", + trackingRegions = "hiRegitMuDetachedTripletStepTrackingRegions", + clusterCheck = "hiRegitMuDetachedTripletStepClusterCheck", +) +hiRegitMuDetachedTripletStepHitTriplets = RecoTracker.IterativeTracking.DetachedTripletStep_cff.detachedTripletStepHitTriplets.clone( + doublets = "hiRegitMuDetachedTripletStepHitDoublets" +) +hiRegitMuDetachedTripletStepSeeds = RecoTracker.IterativeTracking.DetachedTripletStep_cff.detachedTripletStepSeeds.clone( + seedingHitSets = "hiRegitMuDetachedTripletStepHitTriplets" +) from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * @@ -102,6 +117,10 @@ hiRegitMuonDetachedTripletStep = cms.Sequence(hiRegitMuDetachedTripletStepClusters* hiRegitMuDetachedTripletStepSeedLayers* + hiRegitMuDetachedTripletStepTrackingRegions* + hiRegitMuDetachedTripletStepClusterCheck* + hiRegitMuDetachedTripletStepHitDoublets* + hiRegitMuDetachedTripletStepHitTriplets* hiRegitMuDetachedTripletStepSeeds* hiRegitMuDetachedTripletStepTrackCandidates* hiRegitMuDetachedTripletStepTracks* diff --git a/RecoTracker/IterativeTracking/python/DetachedTripletStep_cff.py b/RecoTracker/IterativeTracking/python/DetachedTripletStep_cff.py index 5ae9bc53b278f..491ea656ad6f5 100644 --- a/RecoTracker/IterativeTracking/python/DetachedTripletStep_cff.py +++ b/RecoTracker/IterativeTracking/python/DetachedTripletStep_cff.py @@ -35,27 +35,45 @@ ] ) -# SEEDS -from RecoPixelVertexing.PixelTriplets.PixelTripletLargeTipGenerator_cfi import * -PixelTripletLargeTipGenerator.extraHitRZtolerance = 0.0 -PixelTripletLargeTipGenerator.extraHitRPhitolerance = 0.0 -import RecoTracker.TkSeedGenerator.GlobalSeedsFromTriplets_cff -detachedTripletStepSeeds = RecoTracker.TkSeedGenerator.GlobalSeedsFromTriplets_cff.globalSeedsFromTriplets.clone() -detachedTripletStepSeeds.OrderedHitsFactoryPSet.SeedingLayers = 'detachedTripletStepSeedLayers' -detachedTripletStepSeeds.OrderedHitsFactoryPSet.GeneratorPSet = cms.PSet(PixelTripletLargeTipGenerator) -detachedTripletStepSeeds.SeedCreatorPSet.ComponentName = 'SeedFromConsecutiveHitsTripletOnlyCreator' -detachedTripletStepSeeds.RegionFactoryPSet.RegionPSet.ptMin = 0.3 -detachedTripletStepSeeds.RegionFactoryPSet.RegionPSet.originHalfLength = 15.0 -detachedTripletStepSeeds.RegionFactoryPSet.RegionPSet.originRadius = 1.5 +# TrackingRegion +from RecoTracker.TkTrackingRegions.globalTrackingRegionFromBeamSpotFixedZ_cfi import globalTrackingRegionFromBeamSpotFixedZ as _globalTrackingRegionFromBeamSpotFixedZ +detachedTripletStepTrackingRegions = _globalTrackingRegionFromBeamSpotFixedZ.clone(RegionPSet = dict( + ptMin = 0.3, + originHalfLength = 15.0, + originRadius = 1.5 +)) -detachedTripletStepSeeds.SeedComparitorPSet = cms.PSet( - ComponentName = cms.string('PixelClusterShapeSeedComparitor'), +# seeding +from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer +detachedTripletStepClusterCheck = _clusterCheckerEDProducer.clone( + PixelClusterCollectionLabel = 'siPixelClusters' +) +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +detachedTripletStepHitDoublets = _hitPairEDProducer.clone( + seedingLayers = "detachedTripletStepSeedLayers", + trackingRegions = "detachedTripletStepTrackingRegions", + clusterCheck = "detachedTripletStepClusterCheck", + produceIntermediateHitDoublets = True, +) +from RecoPixelVertexing.PixelTriplets.pixelTripletLargeTipEDProducer_cfi import pixelTripletLargeTipEDProducer as _pixelTripletLargeTipEDProducer +from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * +detachedTripletStepHitTriplets = _pixelTripletLargeTipEDProducer.clone( + doublets = "detachedTripletStepHitDoublets", + maxElement = 1000000, + produceSeedingHitSets = True, +) +from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer_cff import seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer as _seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer +detachedTripletStepSeeds = _seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer.clone( + seedingHitSets = "detachedTripletStepHitTriplets", + SeedComparitorPSet = dict(# FIXME: is this defined in any cfi that could be imported instead of copy-paste? + ComponentName = 'PixelClusterShapeSeedComparitor', FilterAtHelixStage = cms.bool(False), FilterPixelHits = cms.bool(True), FilterStripHits = cms.bool(False), ClusterShapeHitFilterName = cms.string('ClusterShapeHitFilter'), ClusterShapeCacheSrc = cms.InputTag('siPixelClusterShapeCache') - ) + ), +) # QUALITY CUTS DURING TRACK BUILDING import TrackingTools.TrajectoryFiltering.TrajectoryFilter_cff @@ -262,6 +280,10 @@ DetachedTripletStep = cms.Sequence(detachedTripletStepClusters* detachedTripletStepSeedLayers* + detachedTripletStepTrackingRegions* + detachedTripletStepClusterCheck* + detachedTripletStepHitDoublets* + detachedTripletStepHitTriplets* detachedTripletStepSeeds* detachedTripletStepTrackCandidates* detachedTripletStepTracks* From a08e44b63a0f297d2e2f87709cb6be5aa8cf18c4 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 16 Aug 2016 16:57:04 +0200 Subject: [PATCH 28/69] Add GlobalTrackingRegionWithVerticesEDProducer --- ...GlobalTrackingRegionWithVerticesProducer.h | 23 +++++++++++++++++++ .../TkTrackingRegions/plugins/SealModule.cc | 3 +++ .../globalTrackingRegionWithVertices_cff.py | 7 ++++++ 3 files changed, 33 insertions(+) create mode 100644 RecoTracker/TkTrackingRegions/python/globalTrackingRegionWithVertices_cff.py diff --git a/RecoTracker/TkTrackingRegions/plugins/GlobalTrackingRegionWithVerticesProducer.h b/RecoTracker/TkTrackingRegions/plugins/GlobalTrackingRegionWithVerticesProducer.h index cff32e357208a..d2e321a93a64b 100644 --- a/RecoTracker/TkTrackingRegions/plugins/GlobalTrackingRegionWithVerticesProducer.h +++ b/RecoTracker/TkTrackingRegions/plugins/GlobalTrackingRegionWithVerticesProducer.h @@ -39,6 +39,29 @@ class GlobalTrackingRegionWithVerticesProducer : public TrackingRegionProducer virtual ~GlobalTrackingRegionWithVerticesProducer(){} + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + + desc.add("precise", true); + desc.add("useMultipleScattering", false); + desc.add("beamSpot", edm::InputTag("offlineBeamSpot")); + desc.add("useFixedError", true); + desc.add("originRadius", 0.2); + desc.add("sigmaZVertex", 3.0); + desc.add("fixedError", 0.2); + desc.add("VertexCollection", edm::InputTag("firstStepPrimaryVertices")); + desc.add("ptMin", 0.9); + desc.add("useFoundVertices", true); + desc.add("useFakeVertices", false); + desc.add("nSigmaZ", 4.0); + + // Only for backwards-compatibility + edm::ParameterSetDescription descRegion; + descRegion.add("RegionPSet", desc); + + descriptions.add("globalTrackingRegionWithVertices", descRegion); + } + virtual std::vector > regions (const edm::Event& ev, const edm::EventSetup&) const override { diff --git a/RecoTracker/TkTrackingRegions/plugins/SealModule.cc b/RecoTracker/TkTrackingRegions/plugins/SealModule.cc index ed63c89552e5f..08bf475431b0f 100644 --- a/RecoTracker/TkTrackingRegions/plugins/SealModule.cc +++ b/RecoTracker/TkTrackingRegions/plugins/SealModule.cc @@ -19,3 +19,6 @@ DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, PointSeededTrackingRegionsProdu #include "RecoTracker/TkTrackingRegions/interface/TrackingRegionEDProducerT.h" using GlobalTrackinRegionFromBeamSpotEDProducer = TrackingRegionEDProducerT; DEFINE_FWK_MODULE(GlobalTrackinRegionFromBeamSpotEDProducer); + +using GlobalTrackingRegionWithVerticesEDProducer = TrackingRegionEDProducerT; +DEFINE_FWK_MODULE(GlobalTrackingRegionWithVerticesEDProducer); diff --git a/RecoTracker/TkTrackingRegions/python/globalTrackingRegionWithVertices_cff.py b/RecoTracker/TkTrackingRegions/python/globalTrackingRegionWithVertices_cff.py new file mode 100644 index 0000000000000..e75611cb93d2c --- /dev/null +++ b/RecoTracker/TkTrackingRegions/python/globalTrackingRegionWithVertices_cff.py @@ -0,0 +1,7 @@ +from RecoTracker.TkTrackingRegions.globalTrackingRegionWithVertices_cfi import * +from Configuration.Eras.Modifier_trackingLowPU_cff import trackingLowPU +from Configuration.Eras.Modifier_trackingPhase1PU70_cff import trackingPhase1PU70 +from Configuration.Eras.Modifier_trackingPhase2PU140_cff import trackingPhase2PU140 +trackingLowPU.toModify(globalTrackingRegionWithVertices, RegionPSet = dict(VertexCollection = "pixelVertices")) +trackingPhase1PU70.toModify(globalTrackingRegionWithVertices, RegionPSet = dict(VertexCollection = "pixelVertices")) +trackingPhase2PU140.toModify(globalTrackingRegionWithVertices, RegionPSet = dict(VertexCollection = "pixelVertices")) From 860d628613152331193d05a8327152505fd9b248 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 16 Aug 2016 16:57:44 +0200 Subject: [PATCH 29/69] Migrate PixelPairStep --- .../Tracking/python/PixelPairStep_cff.py | 3 +- .../Tracking/python/SeedingMigration.py | 1 + .../python/HiRegitMuonPixelPairStep_cff.py | 49 ++++++++----- .../python/PixelPairStep_cff.py | 73 +++++++++---------- 4 files changed, 70 insertions(+), 56 deletions(-) diff --git a/FastSimulation/Tracking/python/PixelPairStep_cff.py b/FastSimulation/Tracking/python/PixelPairStep_cff.py index e8befc4f59c66..05ea7d79f9f6e 100644 --- a/FastSimulation/Tracking/python/PixelPairStep_cff.py +++ b/FastSimulation/Tracking/python/PixelPairStep_cff.py @@ -2,6 +2,7 @@ # import the full tracking equivalent of this file import RecoTracker.IterativeTracking.PixelPairStep_cff as _standard +from FastSimulation.Tracking.SeedingMigration import _regionProducerToFactoryPSet # fast tracking mask producer import FastSimulation.Tracking.FastTrackerRecHitMaskProducer_cfi @@ -11,7 +12,7 @@ import FastSimulation.Tracking.TrajectorySeedProducer_cfi pixelPairStepSeeds = FastSimulation.Tracking.TrajectorySeedProducer_cfi.trajectorySeedProducer.clone( layerList = _standard.pixelPairStepSeedLayers.layerList.value(), - RegionFactoryPSet = _standard.pixelPairStepSeeds.RegionFactoryPSet, + RegionFactoryPSet = _regionProducerToFactoryPSet(_standard.pixelPairStepTrackingRegions), hitMasks = cms.InputTag("pixelPairStepMasks"), ) pixelPairStepSeeds.RegionFactoryPSet.RegionPSet.VertexCollection = cms.InputTag("firstStepPrimaryVerticesBeforeMixing") diff --git a/FastSimulation/Tracking/python/SeedingMigration.py b/FastSimulation/Tracking/python/SeedingMigration.py index 8a004ebb8c279..f78e40c70a2b4 100644 --- a/FastSimulation/Tracking/python/SeedingMigration.py +++ b/FastSimulation/Tracking/python/SeedingMigration.py @@ -3,6 +3,7 @@ def _regionProducerToFactoryPSet(producer): _map = { "GlobalTrackinRegionFromBeamSpotEDProducer": "GlobalRegionProducerFromBeamSpot", + "GlobalTrackingRegionWithVerticesEDProducer": "GlobalTrackingRegionWithVerticesProducer", } return cms.PSet( ComponentName = cms.string(_map[producer._TypedParameterizable__type]), diff --git a/RecoHI/HiMuonAlgos/python/HiRegitMuonPixelPairStep_cff.py b/RecoHI/HiMuonAlgos/python/HiRegitMuonPixelPairStep_cff.py index e247d0a391b0e..09fbf94899c2a 100644 --- a/RecoHI/HiMuonAlgos/python/HiRegitMuonPixelPairStep_cff.py +++ b/RecoHI/HiMuonAlgos/python/HiRegitMuonPixelPairStep_cff.py @@ -5,15 +5,24 @@ ################################### 2nd step: pixel pairs from RecoHI.HiTracking.HITrackingRegionProducer_cfi import * -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.vertexCollection = cms.InputTag("hiSelectedVertex") -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonSrc= cms.InputTag("standAloneMuons","UpdatedAtVtx") - -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.UseVertex = True - -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.Phi_fixed = True -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.Eta_fixed = True -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.DeltaPhi = 0.3 -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.DeltaEta = 0.2 +# Are the following values set to the same in every iteration? If yes, +# why not making the change in HITrackingRegionProducer_cfi directly +# once for all? +hiRegitMuPixelPairStepTrackingRegions = HiTrackingRegionFactoryFromSTAMuonsEDProducer.clone( + MuonSrc = "standAloneMuons:UpdatedAtVtx", # this is the same as default, why repeat? + MuonTrackingRegionBuilder = dict( + vertexCollection = "hiSelectedVertex", + Phi_fixed = True, + Eta_fixed = True, + DeltaPhi = 0.3, + DeltaEta = 0.2, + # Ok, the following ones are specific to PixelPairStep + Pt_min = 1.0, + DeltaR = 0.01, # default = 0.2 + DeltaZ = 0.09, # this give you the length + Rescale_Dz = 0. # max(DeltaZ_Region,Rescale_Dz*vtx->zError()) + ) +) ################################### from RecoTracker.IterativeTracking.PixelPairStep_cff import * @@ -36,14 +45,17 @@ # seeding -hiRegitMuPixelPairStepSeeds = RecoTracker.IterativeTracking.PixelPairStep_cff.pixelPairStepSeeds.clone() -hiRegitMuPixelPairStepSeeds.RegionFactoryPSet = HiTrackingRegionFactoryFromSTAMuonsBlock.clone() -hiRegitMuPixelPairStepSeeds.ClusterCheckPSet.doClusterCheck = False # do not check for max number of clusters pixel or strips -hiRegitMuPixelPairStepSeeds.RegionFactoryPSet.MuonTrackingRegionBuilder.Pt_min = 1.0 -hiRegitMuPixelPairStepSeeds.RegionFactoryPSet.MuonTrackingRegionBuilder.DeltaR = 0.01 # default = 0.2 -hiRegitMuPixelPairStepSeeds.RegionFactoryPSet.MuonTrackingRegionBuilder.DeltaZ = 0.09 # this give you the length -hiRegitMuPixelPairStepSeeds.RegionFactoryPSet.MuonTrackingRegionBuilder.Rescale_Dz = 0. # max(DeltaZ_Region,Rescale_Dz*vtx->zError()) -hiRegitMuPixelPairStepSeeds.OrderedHitsFactoryPSet.SeedingLayers = 'hiRegitMuPixelPairStepSeedLayers' +hiRegitMuPixelPairStepClusterCheck = RecoTracker.IterativeTracking.PixelPairStep_cff.pixelPairStepClusterCheck.clone( + doClusterCheck = False # do not check for max number of clusters pixel or strips +) +hiRegitMuPixelPairStepHitDoublets = RecoTracker.IterativeTracking.PixelPairStep_cff.pixelPairStepHitDoublets.clone( + seedingLayers = "hiRegitMuPixelPairStepSeedLayers", + trackingRegions = "hiRegitMuPixelPairStepTrackingRegions", + clusterCheck = "hiRegitMuPixelPairStepClusterCheck", +) +hiRegitMuPixelPairStepSeeds = RecoTracker.IterativeTracking.PixelPairStep_cff.pixelPairStepSeeds.clone( + seedingHitSets = "hiRegitMuPixelPairStepHitDoublets" +) # building: feed the new-named seeds @@ -113,6 +125,9 @@ hiRegitMuonPixelPairStep = cms.Sequence(hiRegitMuPixelPairStepClusters* hiRegitMuPixelPairStepSeedLayers* + hiRegitMuPixelPairStepTrackingRegions* + hiRegitMuPixelPairStepClusterCheck* + hiRegitMuPixelPairStepHitDoublets* hiRegitMuPixelPairStepSeeds* hiRegitMuPixelPairStepTrackCandidates* hiRegitMuPixelPairStepTracks* diff --git a/RecoTracker/IterativeTracking/python/PixelPairStep_cff.py b/RecoTracker/IterativeTracking/python/PixelPairStep_cff.py index 583a25d6d1904..def14c4faff9c 100644 --- a/RecoTracker/IterativeTracking/python/PixelPairStep_cff.py +++ b/RecoTracker/IterativeTracking/python/PixelPairStep_cff.py @@ -65,52 +65,46 @@ ) ) -# SEEDS -import RecoTracker.TkSeedGenerator.GlobalSeedsFromPairsWithVertices_cff -pixelPairStepSeeds = RecoTracker.TkSeedGenerator.GlobalSeedsFromPairsWithVertices_cff.globalSeedsFromPairsWithVertices.clone() -pixelPairStepSeeds.RegionFactoryPSet.RegionPSet.VertexCollection = cms.InputTag("firstStepPrimaryVertices") -pixelPairStepSeeds.RegionFactoryPSet.RegionPSet.ptMin = 0.6 -pixelPairStepSeeds.RegionFactoryPSet.RegionPSet.originRadius = 0.015 -pixelPairStepSeeds.RegionFactoryPSet.RegionPSet.fixedError = 0.03 -pixelPairStepSeeds.RegionFactoryPSet.RegionPSet.useMultipleScattering = True -pixelPairStepSeeds.OrderedHitsFactoryPSet.SeedingLayers = cms.InputTag('pixelPairStepSeedLayers') +# TrackingRegion +from RecoTracker.TkTrackingRegions.globalTrackingRegionWithVertices_cff import globalTrackingRegionWithVertices as _globalTrackingRegionWithVertices +pixelPairStepTrackingRegions = _globalTrackingRegionWithVertices.clone(RegionPSet = dict( + ptMin = 0.6, + originRadius = 0.015, + fixedError = 0.03, + useMultipleScattering = True, +)) +from Configuration.Eras.Modifier_trackingLowPU_cff import trackingLowPU +trackingLowPU.toModify(pixelPairStepTrackingRegions, RegionPSet=dict(useMultipleScattering=False)) +trackingPhase1PU70.toModify(pixelPairStepTrackingRegions, RegionPSet=dict(ptMin = 1.2, useMultipleScattering=False)) +trackingPhase2PU140.toModify(pixelPairStepTrackingRegions, RegionPSet=dict(ptMin = 1.3, useMultipleScattering=False)) -pixelPairStepSeeds.SeedComparitorPSet = cms.PSet( - ComponentName = cms.string('PixelClusterShapeSeedComparitor'), +# SEEDS +from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer +pixelPairStepClusterCheck = _clusterCheckerEDProducer.clone( + PixelClusterCollectionLabel = 'siPixelClusters' +) +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +pixelPairStepHitDoublets = _hitPairEDProducer.clone( + seedingLayers = "pixelPairStepSeedLayers", + trackingRegions = "pixelPairStepTrackingRegions", + clusterCheck = "pixelPairStepClusterCheck", + maxElement = 1000000, + produceSeedingHitSets = True, +) +from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsEDProducer_cff import seedCreatorFromRegionConsecutiveHitsEDProducer as _seedCreatorFromRegionConsecutiveHitsEDProducer +pixelPairStepSeeds = _seedCreatorFromRegionConsecutiveHitsEDProducer.clone( + seedingHitSets = "pixelPairStepHitDoublets", + SeedComparitorPSet = dict(# FIXME: is this defined in any cfi that could be imported instead of copy-paste? + ComponentName = 'PixelClusterShapeSeedComparitor', FilterAtHelixStage = cms.bool(True), FilterPixelHits = cms.bool(True), FilterStripHits = cms.bool(False), ClusterShapeHitFilterName = cms.string('ClusterShapeHitFilter'), ClusterShapeCacheSrc = cms.InputTag('siPixelClusterShapeCache'), ) -from Configuration.Eras.Modifier_trackingLowPU_cff import trackingLowPU -trackingLowPU.toModify(pixelPairStepSeeds, - RegionFactoryPSet = dict(RegionPSet = dict( - VertexCollection = 'pixelVertices', - useMultipleScattering = False - )) -) -trackingPhase1PU70.toModify(pixelPairStepSeeds, - RegionFactoryPSet = dict( - RegionPSet = dict( - ptMin = 1.2, - useMultipleScattering = False, - VertexCollection = "pixelVertices", - ) - ), -) -trackingPhase2PU140.toModify(pixelPairStepSeeds, - RegionFactoryPSet = dict( - RegionPSet = dict( - ptMin = 1.3, - useMultipleScattering = False, - VertexCollection = "pixelVertices", - ) - ), - ClusterCheckPSet = dict(doClusterCheck = False), - OrderedHitsFactoryPSet = dict( maxElement = 0 ), - SeedCreatorPSet = dict( magneticField = '', propagator = 'PropagatorWithMaterial'), ) +trackingPhase1PU70.toModify(pixelPairStepHitDoublets, maxElement=0) +trackingPhase2PU140.toModify(pixelPairStepHitDoublets, maxElement=0) # QUALITY CUTS DURING TRACK BUILDING import TrackingTools.TrajectoryFiltering.TrajectoryFilter_cff @@ -335,6 +329,9 @@ # Final sequence PixelPairStep = cms.Sequence(pixelPairStepClusters* pixelPairStepSeedLayers* + pixelPairStepTrackingRegions* + pixelPairStepClusterCheck* + pixelPairStepHitDoublets* pixelPairStepSeeds* pixelPairStepTrackCandidates* pixelPairStepTracks* From ec52d990468859451fc15dc8f1f8acea2bceaa30 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 17 Aug 2016 12:42:24 +0200 Subject: [PATCH 30/69] Migrate MixedTripletStep --- .../Tracking/python/MixedTripletStep_cff.py | 9 +- .../python/HiRegitMuonMixedTripletStep_cff.py | 77 ++++++++---- .../python/MixedTripletStep_cff.py | 119 +++++++++--------- 3 files changed, 119 insertions(+), 86 deletions(-) diff --git a/FastSimulation/Tracking/python/MixedTripletStep_cff.py b/FastSimulation/Tracking/python/MixedTripletStep_cff.py index 2aa3feb3bc3cc..d7ae02fd393cb 100644 --- a/FastSimulation/Tracking/python/MixedTripletStep_cff.py +++ b/FastSimulation/Tracking/python/MixedTripletStep_cff.py @@ -2,6 +2,7 @@ # import the full tracking equivalent of this file import RecoTracker.IterativeTracking.MixedTripletStep_cff as _standard +from FastSimulation.Tracking.SeedingMigration import _regionProducerToFactoryPSet, _hitSetProducerToFactoryPSet # fast tracking mask producer import FastSimulation.Tracking.FastTrackerRecHitMaskProducer_cfi @@ -12,20 +13,20 @@ import FastSimulation.Tracking.TrajectorySeedProducer_cfi mixedTripletStepSeedsA = FastSimulation.Tracking.TrajectorySeedProducer_cfi.trajectorySeedProducer.clone( layerList = _standard.mixedTripletStepSeedLayersA.layerList.value(), - RegionFactoryPSet = _standard.mixedTripletStepSeedsA.RegionFactoryPSet, + RegionFactoryPSet = _regionProducerToFactoryPSet(_standard.mixedTripletStepTrackingRegionsA), hitMasks = cms.InputTag("mixedTripletStepMasks") ) -mixedTripletStepSeedsA.seedFinderSelector.pixelTripletGeneratorFactory = _standard.mixedTripletStepSeedsA.OrderedHitsFactoryPSet.GeneratorPSet +mixedTripletStepSeedsA.seedFinderSelector.pixelTripletGeneratorFactory = _hitSetProducerToFactoryPSet(_standard.mixedTripletStepHitTripletsA) ### import FastSimulation.Tracking.TrajectorySeedProducer_cfi mixedTripletStepSeedsB = FastSimulation.Tracking.TrajectorySeedProducer_cfi.trajectorySeedProducer.clone( layerList = _standard.mixedTripletStepSeedLayersB.layerList.value(), - RegionFactoryPSet = _standard.mixedTripletStepSeedsB.RegionFactoryPSet, + RegionFactoryPSet = _regionProducerToFactoryPSet(_standard.mixedTripletStepTrackingRegionsB), hitMasks = cms.InputTag("mixedTripletStepMasks") ) -mixedTripletStepSeedsB.seedFinderSelector.pixelTripletGeneratorFactory = _standard.mixedTripletStepSeedsB.OrderedHitsFactoryPSet.GeneratorPSet +mixedTripletStepSeedsB.seedFinderSelector.pixelTripletGeneratorFactory = _hitSetProducerToFactoryPSet(_standard.mixedTripletStepHitTripletsB) mixedTripletStepSeeds = _standard.mixedTripletStepSeeds.clone() diff --git a/RecoHI/HiMuonAlgos/python/HiRegitMuonMixedTripletStep_cff.py b/RecoHI/HiMuonAlgos/python/HiRegitMuonMixedTripletStep_cff.py index 6f8d88e12ee1e..85588900a5342 100644 --- a/RecoHI/HiMuonAlgos/python/HiRegitMuonMixedTripletStep_cff.py +++ b/RecoHI/HiMuonAlgos/python/HiRegitMuonMixedTripletStep_cff.py @@ -5,14 +5,27 @@ ################################### 4th step: large impact parameter tracking using mixed-triplet seeding from RecoHI.HiTracking.HITrackingRegionProducer_cfi import * -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.vertexCollection = cms.InputTag("hiSelectedVertex") -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonSrc= cms.InputTag("standAloneMuons","UpdatedAtVtx") - -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.UseVertex = True -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.Phi_fixed = True -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.Eta_fixed = True -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.DeltaPhi = 0.3 -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.DeltaEta = 0.2 +# Are the following values set to the same in every iteration? If yes, +# why not making the change in HITrackingRegionProducer_cfi directly +# once for all? +hiRegitMuMixedTripletStepTrackingRegionsA = HiTrackingRegionFactoryFromSTAMuonsEDProducer.clone( + MuonSrc = "standAloneMuons:UpdatedAtVtx", # this is the same as default, why repeat? + MuonTrackingRegionBuilder = dict( + vertexCollection = "hiSelectedVertex", + Phi_fixed = True, + Eta_fixed = True, + DeltaPhi = 0.3, + DeltaEta = 0.2, + # Ok, the following ones are specific to MixedTripletStep + Pt_min = 1.3, + DeltaR = 0.5, # default = 0.2 + DeltaZ = 0.5, # this give you the length + Rescale_Dz = 4., # max(DeltaZ_Region,Rescale_Dz*vtx->zError()) + ) +) +hiRegitMuMixedTripletStepTrackingRegionsB = hiRegitMuMixedTripletStepTrackingRegionsA.clone( + MuonTrackingRegionBuilder = dict(Pt_min = 1.5) +) ################################### from RecoTracker.IterativeTracking.MixedTripletStep_cff import * @@ -34,14 +47,20 @@ hiRegitMuMixedTripletStepSeedLayersA.TEC.skipClusters = cms.InputTag('hiRegitMuMixedTripletStepClusters') # SEEDS A -hiRegitMuMixedTripletStepSeedsA = RecoTracker.IterativeTracking.MixedTripletStep_cff.mixedTripletStepSeedsA.clone() -hiRegitMuMixedTripletStepSeedsA.RegionFactoryPSet = HiTrackingRegionFactoryFromSTAMuonsBlock.clone() -hiRegitMuMixedTripletStepSeedsA.ClusterCheckPSet.doClusterCheck = False # do not check for max number of clusters pixel or strips -hiRegitMuMixedTripletStepSeedsA.RegionFactoryPSet.MuonTrackingRegionBuilder.Pt_min = 1.3 -hiRegitMuMixedTripletStepSeedsA.RegionFactoryPSet.MuonTrackingRegionBuilder.DeltaR = 0.5 # default = 0.2 -hiRegitMuMixedTripletStepSeedsA.RegionFactoryPSet.MuonTrackingRegionBuilder.DeltaZ = 0.5 # this give you the length -hiRegitMuMixedTripletStepSeedsA.RegionFactoryPSet.MuonTrackingRegionBuilder.Rescale_Dz = 4. # max(DeltaZ_Region,Rescale_Dz*vtx->zError()) -hiRegitMuMixedTripletStepSeedsA.OrderedHitsFactoryPSet.SeedingLayers = 'hiRegitMuMixedTripletStepSeedLayersA' +hiRegitMuMixedTripletStepClusterCheck = RecoTracker.IterativeTracking.MixedTripletStep_cff.mixedTripletStepClusterCheck.clone( + doClusterCheck = False # do not check for max number of clusters pixel or strips +) +hiRegitMuMixedTripletStepHitDoubletsA = RecoTracker.IterativeTracking.MixedTripletStep_cff.mixedTripletStepHitDoubletsA.clone( + seedingLayers = "hiRegitMuMixedTripletStepSeedLayersA", + trackingRegions = "hiRegitMuMixedTripletStepTrackingRegionsA", + clusterCheck = "hiRegitMuMixedTripletStepClusterCheck", +) +hiRegitMuMixedTripletStepHitTripletsA = RecoTracker.IterativeTracking.MixedTripletStep_cff.mixedTripletStepHitTripletsA.clone( + doublets = "hiRegitMuMixedTripletStepHitDoubletsA" +) +hiRegitMuMixedTripletStepSeedsA = RecoTracker.IterativeTracking.MixedTripletStep_cff.mixedTripletStepSeedsA.clone( + seedingHitSets = "hiRegitMuMixedTripletStepHitTripletsA" +) # SEEDING LAYERS B hiRegitMuMixedTripletStepSeedLayersB = RecoTracker.IterativeTracking.MixedTripletStep_cff.mixedTripletStepSeedLayersB.clone() @@ -49,14 +68,17 @@ hiRegitMuMixedTripletStepSeedLayersB.TIB.skipClusters = cms.InputTag('hiRegitMuMixedTripletStepClusters') -hiRegitMuMixedTripletStepSeedsB = RecoTracker.IterativeTracking.MixedTripletStep_cff.mixedTripletStepSeedsB.clone() -hiRegitMuMixedTripletStepSeedsB.RegionFactoryPSet = HiTrackingRegionFactoryFromSTAMuonsBlock.clone() -hiRegitMuMixedTripletStepSeedsB.ClusterCheckPSet.doClusterCheck = False # do not check for max number of clusters pixel or strips -hiRegitMuMixedTripletStepSeedsB.RegionFactoryPSet.MuonTrackingRegionBuilder.Pt_min = 1.5 -hiRegitMuMixedTripletStepSeedsB.RegionFactoryPSet.MuonTrackingRegionBuilder.DeltaR = 0.5 # default = 0.2 -hiRegitMuMixedTripletStepSeedsB.RegionFactoryPSet.MuonTrackingRegionBuilder.DeltaZ = 0.5 # this give you the length -hiRegitMuMixedTripletStepSeedsB.RegionFactoryPSet.MuonTrackingRegionBuilder.Rescale_Dz = 4. # max(DeltaZ_Region,Rescale_Dz*vtx->zError()) -hiRegitMuMixedTripletStepSeedsB.OrderedHitsFactoryPSet.SeedingLayers = 'hiRegitMuMixedTripletStepSeedLayersB' +hiRegitMuMixedTripletStepHitDoubletsB = RecoTracker.IterativeTracking.MixedTripletStep_cff.mixedTripletStepHitDoubletsB.clone( + seedingLayers = "hiRegitMuMixedTripletStepSeedLayersB", + trackingRegions = "hiRegitMuMixedTripletStepTrackingRegionsB", + clusterCheck = "hiRegitMuMixedTripletStepClusterCheck", +) +hiRegitMuMixedTripletStepHitTripletsB = RecoTracker.IterativeTracking.MixedTripletStep_cff.mixedTripletStepHitTripletsB.clone( + doublets = "hiRegitMuMixedTripletStepHitDoubletsB" +) +hiRegitMuMixedTripletStepSeedsB = RecoTracker.IterativeTracking.MixedTripletStep_cff.mixedTripletStepSeedsA.clone( + seedingHitSets = "hiRegitMuMixedTripletStepHitTripletsB" +) # combine seeds hiRegitMuMixedTripletStepSeeds = RecoTracker.IterativeTracking.MixedTripletStep_cff.mixedTripletStepSeeds.clone( @@ -132,8 +154,15 @@ hiRegitMuonMixedTripletStep = cms.Sequence(hiRegitMuMixedTripletStepClusters* hiRegitMuMixedTripletStepSeedLayersA* + hiRegitMuMixedTripletStepTrackingRegionsA* + hiRegitMuMixedTripletStepClusterCheck* + hiRegitMuMixedTripletStepHitDoubletsA* + hiRegitMuMixedTripletStepHitTripletsA* hiRegitMuMixedTripletStepSeedsA* hiRegitMuMixedTripletStepSeedLayersB* + hiRegitMuMixedTripletStepTrackingRegionsB* + hiRegitMuMixedTripletStepHitDoubletsB* + hiRegitMuMixedTripletStepHitTripletsB* hiRegitMuMixedTripletStepSeedsB* hiRegitMuMixedTripletStepSeeds* hiRegitMuMixedTripletStepTrackCandidates* diff --git a/RecoTracker/IterativeTracking/python/MixedTripletStep_cff.py b/RecoTracker/IterativeTracking/python/MixedTripletStep_cff.py index f27e6e4406787..43c18dd808741 100644 --- a/RecoTracker/IterativeTracking/python/MixedTripletStep_cff.py +++ b/RecoTracker/IterativeTracking/python/MixedTripletStep_cff.py @@ -78,41 +78,56 @@ ) ) +# TrackingRegion +from RecoTracker.TkTrackingRegions.globalTrackingRegionFromBeamSpotFixedZ_cfi import globalTrackingRegionFromBeamSpotFixedZ as _globalTrackingRegionFromBeamSpotFixedZ +mixedTripletStepTrackingRegionsA = _globalTrackingRegionFromBeamSpotFixedZ.clone(RegionPSet = dict( + ptMin = 0.4, + originHalfLength = 15.0, + originRadius = 1.5 +)) +trackingLowPU.toModify(mixedTripletStepTrackingRegionsA, RegionPSet = dict(originHalfLength = 10.0)) +trackingPhase1PU70.toModify(mixedTripletStepTrackingRegionsA, RegionPSet = dict(ptMin = 0.7)) -# SEEDS -from RecoPixelVertexing.PixelTriplets.PixelTripletLargeTipGenerator_cfi import * -PixelTripletLargeTipGenerator.extraHitRZtolerance = 0.0 -PixelTripletLargeTipGenerator.extraHitRPhitolerance = 0.0 -import RecoTracker.TkSeedGenerator.GlobalSeedsFromTriplets_cff -mixedTripletStepSeedsA = RecoTracker.TkSeedGenerator.GlobalSeedsFromTriplets_cff.globalSeedsFromTriplets.clone() -mixedTripletStepSeedsA.OrderedHitsFactoryPSet.SeedingLayers = 'mixedTripletStepSeedLayersA' -mixedTripletStepSeedsA.OrderedHitsFactoryPSet.GeneratorPSet = cms.PSet(PixelTripletLargeTipGenerator) -mixedTripletStepSeedsA.SeedCreatorPSet.ComponentName = 'SeedFromConsecutiveHitsTripletOnlyCreator' -mixedTripletStepSeedsA.RegionFactoryPSet.RegionPSet.ptMin = 0.4 -mixedTripletStepSeedsA.RegionFactoryPSet.RegionPSet.originHalfLength = 15.0 -mixedTripletStepSeedsA.RegionFactoryPSet.RegionPSet.originRadius = 1.5 - -import RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi -mixedTripletStepClusterShapeHitFilter = RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi.ClusterShapeHitFilterESProducer.clone( - ComponentName = cms.string('mixedTripletStepClusterShapeHitFilter'), - clusterChargeCut = cms.PSet(refToPSet_ = cms.string('SiStripClusterChargeCutTight')) - ) - -mixedTripletStepSeedsA.SeedComparitorPSet = cms.PSet( - ComponentName = cms.string('PixelClusterShapeSeedComparitor'), +# seeding +from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import ClusterShapeHitFilterESProducer as _ClusterShapeHitFilterESProducer +mixedTripletStepClusterShapeHitFilter = _ClusterShapeHitFilterESProducer.clone( + ComponentName = 'mixedTripletStepClusterShapeHitFilter', + clusterChargeCut = dict(refToPSet_ = 'SiStripClusterChargeCutTight') +) +from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer +mixedTripletStepClusterCheck = _clusterCheckerEDProducer.clone( + PixelClusterCollectionLabel = 'siPixelClusters' +) +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +mixedTripletStepHitDoubletsA = _hitPairEDProducer.clone( + seedingLayers = "mixedTripletStepSeedLayersA", + trackingRegions = "mixedTripletStepTrackingRegionsA", + clusterCheck = "mixedTripletStepClusterCheck", + produceIntermediateHitDoublets = True, +) +from RecoPixelVertexing.PixelTriplets.pixelTripletLargeTipEDProducer_cfi import pixelTripletLargeTipEDProducer as _pixelTripletLargeTipEDProducer +from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * +mixedTripletStepHitTripletsA = _pixelTripletLargeTipEDProducer.clone( + doublets = "mixedTripletStepHitDoubletsA", + maxElement = 1000000, + produceSeedingHitSets = True, +) +from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer_cff import seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer as _seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer +mixedTripletStepSeedsA = _seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer.clone( + seedingHitSets = "mixedTripletStepHitTripletsA", + SeedComparitorPSet = dict(# FIXME: is this defined in any cfi that could be imported instead of copy-paste? + ComponentName = 'PixelClusterShapeSeedComparitor', FilterAtHelixStage = cms.bool(False), FilterPixelHits = cms.bool(True), FilterStripHits = cms.bool(True), ClusterShapeHitFilterName = cms.string('mixedTripletStepClusterShapeHitFilter'), ClusterShapeCacheSrc = cms.InputTag('siPixelClusterShapeCache') - ) + ), +) trackingLowPU.toModify(mixedTripletStepSeedsA, - RegionFactoryPSet = dict(RegionPSet = dict(originHalfLength = 10.0)), SeedComparitorPSet = dict(ClusterShapeHitFilterName = 'ClusterShapeHitFilter') ) -trackingPhase1PU70.toModify( - mixedTripletStepSeedsA, - RegionFactoryPSet = dict(RegionPSet = dict(ptMin = 0.7)), +trackingPhase1PU70.toModify(mixedTripletStepSeedsA, SeedComparitorPSet = dict(ClusterShapeHitFilterName = 'ClusterShapeHitFilter'), ) @@ -142,40 +157,21 @@ TIB = None ) -# SEEDS -from RecoPixelVertexing.PixelTriplets.PixelTripletLargeTipGenerator_cfi import * -PixelTripletLargeTipGenerator.extraHitRZtolerance = 0.0 -PixelTripletLargeTipGenerator.extraHitRPhitolerance = 0.0 -import RecoTracker.TkSeedGenerator.GlobalSeedsFromTriplets_cff -mixedTripletStepSeedsB = RecoTracker.TkSeedGenerator.GlobalSeedsFromTriplets_cff.globalSeedsFromTriplets.clone() -mixedTripletStepSeedsB.OrderedHitsFactoryPSet.SeedingLayers = 'mixedTripletStepSeedLayersB' -mixedTripletStepSeedsB.OrderedHitsFactoryPSet.GeneratorPSet = cms.PSet(PixelTripletLargeTipGenerator) -mixedTripletStepSeedsB.SeedCreatorPSet.ComponentName = 'SeedFromConsecutiveHitsTripletOnlyCreator' -mixedTripletStepSeedsB.RegionFactoryPSet.RegionPSet.ptMin = 0.6 -mixedTripletStepSeedsB.RegionFactoryPSet.RegionPSet.originHalfLength = 10.0 -mixedTripletStepSeedsB.RegionFactoryPSet.RegionPSet.originRadius = 1.5 +# TrackingRegion +mixedTripletStepTrackingRegionsB = mixedTripletStepTrackingRegionsA.clone(RegionPSet = dict(ptMin=0.6, originHalfLength=10.0)) +trackingPhase1PU70.toModify(mixedTripletStepTrackingRegionsB, RegionPSet = dict( + ptMin = 0.5, + originHalfLength = 15.0, + originRadius = 1.0 +)) -mixedTripletStepSeedsB.SeedComparitorPSet = cms.PSet( - ComponentName = cms.string('PixelClusterShapeSeedComparitor'), - FilterAtHelixStage = cms.bool(False), - FilterPixelHits = cms.bool(True), - FilterStripHits = cms.bool(True), - ClusterShapeHitFilterName = cms.string('mixedTripletStepClusterShapeHitFilter'), - ClusterShapeCacheSrc = cms.InputTag('siPixelClusterShapeCache') - ) -trackingLowPU.toModify(mixedTripletStepSeedsB, SeedComparitorPSet = dict(ClusterShapeHitFilterName = 'ClusterShapeHitFilter')) -trackingPhase1PU70.toModify( - mixedTripletStepSeedsB, - RegionFactoryPSet = dict( - RegionPSet = dict( - ptMin = 0.5, - originHalfLength = 15.0, - originRadius = 1.0 - ) - ), - SeedComparitorPSet = dict(ClusterShapeHitFilterName = 'ClusterShapeHitFilter'), +# seeding +mixedTripletStepHitDoubletsB = mixedTripletStepHitDoubletsA.clone( + seedingLayers = "mixedTripletStepSeedLayersB", + trackingRegions = "mixedTripletStepTrackingRegionsB", ) - +mixedTripletStepHitTripletsB = mixedTripletStepHitTripletsA.clone(doublets = "mixedTripletStepHitDoubletsB") +mixedTripletStepSeedsB = mixedTripletStepSeedsA.clone(seedingHitSets = "mixedTripletStepHitTripletsB") import RecoTracker.TkSeedGenerator.GlobalCombinedSeeds_cfi mixedTripletStepSeeds = RecoTracker.TkSeedGenerator.GlobalCombinedSeeds_cfi.globalCombinedSeeds.clone() @@ -486,8 +482,15 @@ MixedTripletStep = cms.Sequence(chargeCut2069Clusters*mixedTripletStepClusters* mixedTripletStepSeedLayersA* + mixedTripletStepTrackingRegionsA* + mixedTripletStepClusterCheck* + mixedTripletStepHitDoubletsA* + mixedTripletStepHitTripletsA* mixedTripletStepSeedsA* mixedTripletStepSeedLayersB* + mixedTripletStepTrackingRegionsB* + mixedTripletStepHitDoubletsB* + mixedTripletStepHitTripletsB* mixedTripletStepSeedsB* mixedTripletStepSeeds* mixedTripletStepTrackCandidates* From 02ef592b0ab0cc5f681bdd9eba599296112c1377 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 17 Aug 2016 17:17:38 +0200 Subject: [PATCH 31/69] Add MultiHitFromChi2EDProducer --- DataFormats/TrackerRecHit2D/src/classes.h | 6 +- .../TrackerRecHit2D/src/classes_def.xml | 4 + .../MultiHitGeneratorFromPairAndLayers.h | 4 +- .../plugins/MultiHitFromChi2EDProducer.cc | 141 ++++++++++++++++++ .../plugins/MultiHitGeneratorFromChi2.cc | 67 ++++++++- .../plugins/MultiHitGeneratorFromChi2.h | 19 +++ .../src/MultiHitGeneratorFromPairAndLayers.cc | 5 + 7 files changed, 238 insertions(+), 8 deletions(-) create mode 100644 RecoTracker/TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc diff --git a/DataFormats/TrackerRecHit2D/src/classes.h b/DataFormats/TrackerRecHit2D/src/classes.h index e62dbf524dc7f..9bcb452602b3f 100644 --- a/DataFormats/TrackerRecHit2D/src/classes.h +++ b/DataFormats/TrackerRecHit2D/src/classes.h @@ -26,6 +26,7 @@ #include "DataFormats/TrackerRecHit2D/interface/FastProjectedTrackerRecHit.h" #include "DataFormats/TrackerRecHit2D/interface/FastTrackerRecHitCollection.h" #include "DataFormats/TrackerRecHit2D/interface/Phase2TrackerRecHit1D.h" +#include "DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h" #include namespace DataFormats_TrackerRecHit2D { @@ -62,7 +63,10 @@ namespace DataFormats_TrackerRecHit2D { edm::ClonePolicy > e3; edm::OwnVector >::const_iterator it10; - + + edm::OwnVector ovbtrh; + edm::Wrapper> wovbtrh; + edm::Wrapper< edm::RangeMap >, diff --git a/DataFormats/TrackerRecHit2D/src/classes_def.xml b/DataFormats/TrackerRecHit2D/src/classes_def.xml index 1d367bbac4bff..c4daab655997e 100644 --- a/DataFormats/TrackerRecHit2D/src/classes_def.xml +++ b/DataFormats/TrackerRecHit2D/src/classes_def.xml @@ -74,6 +74,10 @@ + + + + diff --git a/RecoTracker/TkSeedGenerator/interface/MultiHitGeneratorFromPairAndLayers.h b/RecoTracker/TkSeedGenerator/interface/MultiHitGeneratorFromPairAndLayers.h index ae78164e04558..90500ed94801c 100644 --- a/RecoTracker/TkSeedGenerator/interface/MultiHitGeneratorFromPairAndLayers.h +++ b/RecoTracker/TkSeedGenerator/interface/MultiHitGeneratorFromPairAndLayers.h @@ -12,7 +12,7 @@ #include "TrackingTools/TransientTrackingRecHit/interface/SeedingLayerSetsHits.h" #include "RecoTracker/TkHitPairs/interface/LayerHitMapCache.h" -namespace edm { class ParameterSet; class Event; class EventSetup; } +namespace edm { class ParameterSet; class Event; class EventSetup; class ParameterSetDescription;} class TrackingRegion; class HitPairGeneratorFromLayerPair; @@ -24,6 +24,8 @@ class MultiHitGeneratorFromPairAndLayers { explicit MultiHitGeneratorFromPairAndLayers(const edm::ParameterSet& pset); virtual ~MultiHitGeneratorFromPairAndLayers(); + static void fillDescriptions(edm::ParameterSetDescription& desc); + virtual void initES(const edm::EventSetup& es) = 0; void init(std::unique_ptr&& pairGenerator, LayerCacheType *layerCache); diff --git a/RecoTracker/TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc b/RecoTracker/TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc new file mode 100644 index 0000000000000..0eb5826c394db --- /dev/null +++ b/RecoTracker/TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc @@ -0,0 +1,141 @@ +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Utilities/interface/EDGetToken.h" +#include "FWCore/Framework/interface/Event.h" +#include "DataFormats/Common/interface/Handle.h" +#include "FWCore/Utilities/interface/RunningAverage.h" + +#include "RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h" +#include "RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h" +#include "DataFormats/Common/interface/OwnVector.h" +#include "RecoPixelVertexing/PixelTriplets/interface/LayerTriplets.h" +#include "MultiHitGeneratorFromChi2.h" + +class MultiHitFromChi2EDProducer: public edm::stream::EDProducer<> { +public: + MultiHitFromChi2EDProducer(const edm::ParameterSet& iConfig); + ~MultiHitFromChi2EDProducer() = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + virtual void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override; + +private: + edm::EDGetTokenT doubletToken_; + + edm::RunningAverage localRA_; + + MultiHitGeneratorFromChi2 generator_; +}; + +MultiHitFromChi2EDProducer::MultiHitFromChi2EDProducer(const edm::ParameterSet& iConfig): + doubletToken_(consumes(iConfig.getParameter("doublets"))), + generator_(iConfig) +{ + produces(); + produces >(); +} + +void MultiHitFromChi2EDProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + + desc.add("doublets", edm::InputTag("hitPairEDProducer")); + + MultiHitGeneratorFromChi2::fillDescriptions(desc); + + auto label = MultiHitGeneratorFromChi2::fillDescriptionsLabel() + std::string("EDProducer"); + descriptions.add(label, desc); +} + +void MultiHitFromChi2EDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + edm::Handle hdoublets; + iEvent.getByToken(doubletToken_, hdoublets); + const auto& regionDoublets = *hdoublets; + + const SeedingLayerSetsHits& seedingLayerHits = regionDoublets.seedingLayerHits(); + if(seedingLayerHits.numberOfLayersInSet() < 3) { + throw cms::Exception("Configuration") << "MultiHitFromChi2EDProducer expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= 3, got " << seedingLayerHits.numberOfLayersInSet(); + } + + auto seedingHitSets = std::make_unique(); + if(regionDoublets.empty()) { + iEvent.put(std::move(seedingHitSets)); + return; + } + seedingHitSets->reserve(regionDoublets.regionSize(), localRA_.upper()); + generator_.initES(iSetup); + + // match-making of pair and triplet layers + std::vector trilayers = LayerTriplets::layers(seedingLayerHits); + + OrderedMultiHits multihits; + multihits.reserve(localRA_.upper()); + std::vector > refittedHitStorage; + refittedHitStorage.reserve(localRA_.upper()*2); + + LogDebug("MultiHitFromChi2EDProducer") << "Creating multihits for " << regionDoublets.regionSize() << " regions, and " << trilayers.size() << " pair+3rd layers from " << regionDoublets.layerPairsSize() << " layer pairs"; + + for(const auto& regionLayerPairs: regionDoublets) { + const TrackingRegion& region = regionLayerPairs.region(); + + auto seedingHitSetsFiller = RegionsSeedingHitSets::dummyFiller(); + seedingHitSetsFiller = seedingHitSets->beginRegion(®ion); + + LogTrace("MultiHitFromChi2EDProducer") << " starting region"; + + for(const auto& layerPair: regionLayerPairs) { + LogTrace("MultiHitFromChi2EDProducer") << " starting layer pair " << layerPair.innerLayerIndex() << "," << layerPair.outerLayerIndex(); + + auto found = std::find_if(trilayers.begin(), trilayers.end(), [&](const LayerTriplets::LayerSetAndLayers& a) { + return a.first[0].index() == layerPair.innerLayerIndex() && a.first[1].index() == layerPair.outerLayerIndex(); + }); + if(found == trilayers.end()) { + auto exp = cms::Exception("LogicError") << "Did not find the layer pair from vector. This is a sign of some internal inconsistency\n"; + exp << "I was looking for layer pair " << layerPair.innerLayerIndex() << "," << layerPair.outerLayerIndex() << ". Triplets have the following pairs:\n"; + for(const auto& a: trilayers) { + exp << " " << a.first[0].index() << "," << a.first[1].index() << ": 3rd layers"; + for(const auto& b: a.second) { + exp << " " << b.index(); + } + exp << "\n"; + } + throw exp; + } + const auto& thirdLayers = found->second; + + LayerHitMapCache hitCache; + hitCache.extend(layerPair.cache()); + LayerHitMapCache *hitCachePtr = &hitCache; + + generator_.hitSets(region, multihits, iEvent, iSetup, layerPair.doublets(), thirdLayers, *hitCachePtr, refittedHitStorage); + +#ifdef EDM_ML_DEBUG + LogTrace("MultiHitFromChi2EDProducer") << " created " << multihits.size() << " multihits for layer pair " << layerPair.innerLayerIndex() << "," << layerPair.outerLayerIndex() << " and 3rd layers"; + for(const auto& l: thirdLayers) { + LogTrace("MultiHitFromChi2EDProducer") << " " << l.index(); + } +#endif + + for(const SeedingHitSet& hitSet: multihits) { + seedingHitSetsFiller.emplace_back(hitSet); + } + multihits.clear(); + } + } + localRA_.update(seedingHitSets->size()); + + auto storage = std::make_unique >(); + storage->reserve(refittedHitStorage.size()); + for(auto& ptr: refittedHitStorage) + storage->push_back(ptr.release()); + + iEvent.put(std::move(seedingHitSets)); + iEvent.put(std::move(storage)); +} + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(MultiHitFromChi2EDProducer); diff --git a/RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.cc b/RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.cc index eaa95ccbbd1f7..7a15e372310c1 100644 --- a/RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.cc +++ b/RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.cc @@ -1,4 +1,5 @@ #include "RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "RecoPixelVertexing/PixelTriplets/interface/ThirdHitPredictionFromCircle.h" #include "RecoPixelVertexing/PixelTriplets/plugins/ThirdHitRZPrediction.h" @@ -109,6 +110,39 @@ MultiHitGeneratorFromChi2::MultiHitGeneratorFromChi2(const edm::ParameterSet& cf } MultiHitGeneratorFromChi2::~MultiHitGeneratorFromChi2() {} + + +void MultiHitGeneratorFromChi2::fillDescriptions(edm::ParameterSetDescription& desc) { + MultiHitGeneratorFromPairAndLayers::fillDescriptions(desc); + + // fixed phi filtering + desc.add("useFixedPreFiltering", false); + desc.add("phiPreFiltering", 0.3); + + // box properties + desc.add("extraHitRPhitolerance", 0); + desc.add("extraHitRZtolerance", 0); + desc.add("extraZKDBox", 0.2); + desc.add("extraRKDBox", 0.2); + desc.add("extraPhiKDBox", 0.005); + desc.add("fnSigmaRZ", 2.0); + + // refit&filter hits + desc.add("refitHits", true); + desc.add("ClusterShapeHitFilterName", "ClusterShapeHitFilter"); + desc.add("TTRHBuilder", "WithTrackAngle"); + + // chi2 cuts + desc.add("maxChi2", 5.0); + desc.add("chi2VsPtCut", true); + desc.add >("pt_interv", std::vector{{0.4,0.7,1.0,2.0}}); + desc.add >("chi2_cuts", std::vector{{3.0,4.0,5.0,5.0}}); + + // debugging + desc.add >("detIdsToDebug", std::vector{{0,0,0}}); +} + + void MultiHitGeneratorFromChi2::initES(const edm::EventSetup& es) { @@ -161,17 +195,29 @@ void MultiHitGeneratorFromChi2::hitSets(const TrackingRegion& region, // LogDebug("MultiHitGeneratorFromChi2") << "empy pairs"; return; } + + assert(theLayerCache); + hitSets(region, result, ev, es, doublets, thirdLayers, *theLayerCache, cache); +} + +void MultiHitGeneratorFromChi2::hitSets(const TrackingRegion& region, OrderedMultiHits& result, + const edm::Event& ev, const edm::EventSetup& es, + const HitDoublets& doublets, + const std::vector& thirdLayers, + LayerCacheType& layerCache, + cacheHits& refittedHitStorage) { int size = thirdLayers.size(); const RecHitsSortedInPhi * thirdHitMap[size]; vector thirdLayerDetLayer(size,0); for (int il=0; il & thirdLayerDetLayer, const int nThirdLayers) { + hitSets(region, result, es, doublets, thirdHitMap, thirdLayerDetLayer, nThirdLayers, cache); +} +void MultiHitGeneratorFromChi2::hitSets(const TrackingRegion& region, OrderedMultiHits& result, + const edm::EventSetup& es, + const HitDoublets& doublets, + const RecHitsSortedInPhi **thirdHitMap, + const std::vector& thirdLayerDetLayer, + const int nThirdLayers, + cacheHits& refittedHitStorage) { unsigned int debug_Id0 = detIdsToDebug[0]; unsigned int debug_Id1 = detIdsToDebug[1]; unsigned int debug_Id2 = detIdsToDebug[2]; @@ -637,12 +692,12 @@ void MultiHitGeneratorFromChi2::hitTriplets( assert(bestH2); result.emplace_back(&*hit0,&*hit1,&*bestH2); assert(hit0.isOwn()); assert(hit1.isOwn()); - cache.emplace_back(const_cast(hit0.release())); - cache.emplace_back(const_cast(hit1.release())); - cache.emplace_back(std::move(bestH2)); + refittedHitStorage.emplace_back(const_cast(hit0.release())); + refittedHitStorage.emplace_back(const_cast(hit1.release())); + refittedHitStorage.emplace_back(std::move(bestH2)); assert(hit0.empty()); assert(hit1.empty());assert(!bestH2); } - // LogTrace("MultiHitGeneratorFromChi2") << (usePair ? "pair " : "triplet ") << minChi2 <<' ' << cache.size(); + // LogTrace("MultiHitGeneratorFromChi2") << (usePair ? "pair " : "triplet ") << minChi2 <<' ' << refittedHitStorage.size(); }//loop over pairs diff --git a/RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.h b/RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.h index 0952fcf76fa8c..10180b64f66f9 100644 --- a/RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.h +++ b/RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.h @@ -33,6 +33,10 @@ typedef CombinedMultiHitGenerator::LayerCacheType LayerCacheType; virtual ~MultiHitGeneratorFromChi2(); + static void fillDescriptions(edm::ParameterSetDescription& desc); + static const char *fillDescriptionsLabel() { return "multiHitFromChi2"; } + + void initES(const edm::EventSetup& es) override; virtual void hitSets( const TrackingRegion& region, OrderedMultiHits & trs, @@ -40,6 +44,13 @@ typedef CombinedMultiHitGenerator::LayerCacheType LayerCacheType; SeedingLayerSetsHits::SeedingLayerSet pairLayers, std::vector thirdLayers); + void hitSets(const TrackingRegion& region, OrderedMultiHits& trs, + const edm::Event& ev, const edm::EventSetup& es, + const HitDoublets& doublets, + const std::vector& thirdLayers, + LayerCacheType& layerCache, + cacheHits& refittedHitStorage); + void hitTriplets( const TrackingRegion& region, OrderedMultiHits & result, @@ -48,6 +59,14 @@ typedef CombinedMultiHitGenerator::LayerCacheType LayerCacheType; const RecHitsSortedInPhi ** thirdHitMap, const std::vector & thirdLayerDetLayer, const int nThirdLayers)override; + + void hitSets(const TrackingRegion& region, OrderedMultiHits& result, + const edm::EventSetup& es, + const HitDoublets& doublets, + const RecHitsSortedInPhi **thirdHitMap, + const std::vector& thirdLayerDetLayer, + const int nThirdLayers, + cacheHits& refittedHitStorage); private: using HitOwnPtr = mayown_ptr; diff --git a/RecoTracker/TkSeedGenerator/src/MultiHitGeneratorFromPairAndLayers.cc b/RecoTracker/TkSeedGenerator/src/MultiHitGeneratorFromPairAndLayers.cc index c30bee5bf3dd6..7ee917ae14ab6 100644 --- a/RecoTracker/TkSeedGenerator/src/MultiHitGeneratorFromPairAndLayers.cc +++ b/RecoTracker/TkSeedGenerator/src/MultiHitGeneratorFromPairAndLayers.cc @@ -1,6 +1,7 @@ #include "RecoTracker/TkSeedGenerator/interface/MultiHitGeneratorFromPairAndLayers.h" #include "RecoTracker/TkHitPairs/interface/HitPairGeneratorFromLayerPair.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" MultiHitGeneratorFromPairAndLayers::MultiHitGeneratorFromPairAndLayers(const edm::ParameterSet& pset): theLayerCache(nullptr), @@ -9,6 +10,10 @@ MultiHitGeneratorFromPairAndLayers::MultiHitGeneratorFromPairAndLayers(const edm MultiHitGeneratorFromPairAndLayers::~MultiHitGeneratorFromPairAndLayers() {} +void MultiHitGeneratorFromPairAndLayers::fillDescriptions(edm::ParameterSetDescription& desc) { + desc.add("maxElement", 100000); +} + void MultiHitGeneratorFromPairAndLayers::init(std::unique_ptr&& pairGenerator, LayerCacheType *layerCache) { thePairGenerator = std::move(pairGenerator); theLayerCache = layerCache; From 16a8111bf2fa73cf4dff1cde6ded6b900514ca55 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 18 Aug 2016 11:43:18 +0200 Subject: [PATCH 32/69] Migrate PixelLessStep --- .../Tracking/python/PixelLessStep_cff.py | 5 +- .../Tracking/python/SeedingMigration.py | 1 + .../python/HiRegitMuonPixelLessStep_cff.py | 53 ++++++---- .../python/PixelLessStep_cff.py | 96 +++++++++++-------- 4 files changed, 98 insertions(+), 57 deletions(-) diff --git a/FastSimulation/Tracking/python/PixelLessStep_cff.py b/FastSimulation/Tracking/python/PixelLessStep_cff.py index 934afb476bdfc..932737e5f18c3 100644 --- a/FastSimulation/Tracking/python/PixelLessStep_cff.py +++ b/FastSimulation/Tracking/python/PixelLessStep_cff.py @@ -2,6 +2,7 @@ # import the full tracking equivalent of this file import RecoTracker.IterativeTracking.PixelLessStep_cff as _standard +from FastSimulation.Tracking.SeedingMigration import _regionProducerToFactoryPSet, _hitSetProducerToFactoryPSet # fast tracking mask producer import FastSimulation.Tracking.FastTrackerRecHitMaskProducer_cfi @@ -11,10 +12,10 @@ import FastSimulation.Tracking.TrajectorySeedProducer_cfi pixelLessStepSeeds = FastSimulation.Tracking.TrajectorySeedProducer_cfi.trajectorySeedProducer.clone( layerList = _standard.pixelLessStepSeedLayers.layerList.value(), - RegionFactoryPSet = _standard.pixelLessStepSeeds.RegionFactoryPSet, + RegionFactoryPSet = _regionProducerToFactoryPSet(_standard.pixelLessStepTrackingRegions), hitMasks = cms.InputTag("pixelLessStepMasks"), ) -pixelLessStepSeeds.seedFinderSelector.MultiHitGeneratorFactory = _standard.pixelLessStepSeeds.OrderedHitsFactoryPSet.GeneratorPSet +pixelLessStepSeeds.seedFinderSelector.MultiHitGeneratorFactory = _hitSetProducerToFactoryPSet(_standard.pixelLessStepHitTriplets) pixelLessStepSeeds.seedFinderSelector.MultiHitGeneratorFactory.refitHits = False # track candidates diff --git a/FastSimulation/Tracking/python/SeedingMigration.py b/FastSimulation/Tracking/python/SeedingMigration.py index f78e40c70a2b4..5b3eb2f737e78 100644 --- a/FastSimulation/Tracking/python/SeedingMigration.py +++ b/FastSimulation/Tracking/python/SeedingMigration.py @@ -20,6 +20,7 @@ def _hitSetProducerToFactoryPSet(producer): _map = { "PixelTripletHLTEDProducer": "PixelTripletHLTGenerator", "PixelTripletLargeTipEDProducer": "PixelTripletLargeTipGenerator", + "MultiHitFromChi2EDProducer": "MultiHitGeneratorFromChi2", } ret = cms.PSet() _copy(producer, ret) diff --git a/RecoHI/HiMuonAlgos/python/HiRegitMuonPixelLessStep_cff.py b/RecoHI/HiMuonAlgos/python/HiRegitMuonPixelLessStep_cff.py index d9cdd2ed17d83..a31302eb7c1e7 100644 --- a/RecoHI/HiMuonAlgos/python/HiRegitMuonPixelLessStep_cff.py +++ b/RecoHI/HiMuonAlgos/python/HiRegitMuonPixelLessStep_cff.py @@ -4,15 +4,24 @@ ################################### 5th step: large impact parameter tracking using TIB/TID/TEC stereo layer seeding from RecoHI.HiTracking.HITrackingRegionProducer_cfi import * -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.vertexCollection = cms.InputTag("hiSelectedVertex") -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonSrc= cms.InputTag("standAloneMuons","UpdatedAtVtx") - -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.UseVertex = True - -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.Phi_fixed = True -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.Eta_fixed = True -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.DeltaPhi = 0.2 -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.DeltaEta = 0.1 +# Are the following values set to the same in every iteration? If yes, +# why not making the change in HITrackingRegionProducer_cfi directly +# once for all? +hiRegitMuPixelLessStepTrackingRegions = HiTrackingRegionFactoryFromSTAMuonsEDProducer.clone( + MuonSrc = "standAloneMuons:UpdatedAtVtx", # this is the same as default, why repeat? + MuonTrackingRegionBuilder = dict( + vertexCollection = "hiSelectedVertex", + Phi_fixed = True, + Eta_fixed = True, + # Ok, the following ones are specific to PixelLessStep + DeltaPhi = 0.2, + DeltaEta = 0.1, + Pt_min = 2.0, + DeltaR = 0.2, # default = 0.2 + DeltaZ = 0.2, # this give you the length + Rescale_Dz = 4., # max(DeltaZ_Region,Rescale_Dz*vtx->zError()) + ) +) ################################### from RecoTracker.IterativeTracking.PixelLessStep_cff import * @@ -37,14 +46,20 @@ # seeding -hiRegitMuPixelLessStepSeeds = RecoTracker.IterativeTracking.PixelLessStep_cff.pixelLessStepSeeds.clone() -hiRegitMuPixelLessStepSeeds.RegionFactoryPSet = HiTrackingRegionFactoryFromSTAMuonsBlock.clone() -hiRegitMuPixelLessStepSeeds.ClusterCheckPSet.doClusterCheck = False # do not check for max number of clusters pixel or strips -hiRegitMuPixelLessStepSeeds.RegionFactoryPSet.MuonTrackingRegionBuilder.Pt_min = 2.0 -hiRegitMuPixelLessStepSeeds.RegionFactoryPSet.MuonTrackingRegionBuilder.DeltaR = 0.2 # default = 0.2 -hiRegitMuPixelLessStepSeeds.RegionFactoryPSet.MuonTrackingRegionBuilder.DeltaZ = 0.2 # this give you the length -hiRegitMuPixelLessStepSeeds.RegionFactoryPSet.MuonTrackingRegionBuilder.Rescale_Dz = 4. # max(DeltaZ_Region,Rescale_Dz*vtx->zError()) -hiRegitMuPixelLessStepSeeds.OrderedHitsFactoryPSet.SeedingLayers = 'hiRegitMuPixelLessStepSeedLayers' +hiRegitMuPixelLessStepClusterCheck = RecoTracker.IterativeTracking.PixelLessStep_cff.pixelLessStepClusterCheck.clone( + doClusterCheck = False # do not check for max number of clusters pixel or strips +) +hiRegitMuPixelLessStepHitDoublets = RecoTracker.IterativeTracking.PixelLessStep_cff.pixelLessStepHitDoublets.clone( + seedingLayers = "hiRegitMuPixelLessStepSeedLayers", + trackingRegions = "hiRegitMuPixelLessStepTrackingRegions", + clusterCheck = "hiRegitMuPixelLessStepClusterCheck", +) +hiRegitMuPixelLessStepHitTriplets = RecoTracker.IterativeTracking.PixelLessStep_cff.pixelLessStepHitTriplets.clone( + doublets = "hiRegitMuPixelLessStepHitDoublets" +) +hiRegitMuPixelLessStepSeeds = RecoTracker.IterativeTracking.PixelLessStep_cff.pixelLessStepSeeds.clone( + seedingHitSets = "hiRegitMuPixelLessStepHitTriplets" +) # building: feed the new-named seeds @@ -107,6 +122,10 @@ hiRegitMuonPixelLessStep = cms.Sequence(hiRegitMuPixelLessStepClusters* hiRegitMuPixelLessStepSeedLayers* + hiRegitMuPixelLessStepTrackingRegions* + hiRegitMuPixelLessStepClusterCheck* + hiRegitMuPixelLessStepHitDoublets* + hiRegitMuPixelLessStepHitTriplets* hiRegitMuPixelLessStepSeeds* hiRegitMuPixelLessStepTrackCandidates* hiRegitMuPixelLessStepTracks* diff --git a/RecoTracker/IterativeTracking/python/PixelLessStep_cff.py b/RecoTracker/IterativeTracking/python/PixelLessStep_cff.py index 3c50e772fad66..f6f200570d5b6 100644 --- a/RecoTracker/IterativeTracking/python/PixelLessStep_cff.py +++ b/RecoTracker/IterativeTracking/python/PixelLessStep_cff.py @@ -98,33 +98,53 @@ MTEC = None, ) -# SEEDS -import RecoTracker.TkSeedGenerator.GlobalSeedsFromTriplets_cff -pixelLessStepSeeds = RecoTracker.TkSeedGenerator.GlobalSeedsFromTriplets_cff.globalSeedsFromTriplets.clone() -#OrderedHitsFactory -pixelLessStepSeeds.OrderedHitsFactoryPSet.SeedingLayers = 'pixelLessStepSeedLayers' -pixelLessStepSeeds.OrderedHitsFactoryPSet.ComponentName = 'StandardMultiHitGenerator' -import RecoTracker.TkSeedGenerator.MultiHitGeneratorFromChi2_cfi -pixelLessStepSeeds.OrderedHitsFactoryPSet.GeneratorPSet = RecoTracker.TkSeedGenerator.MultiHitGeneratorFromChi2_cfi.MultiHitGeneratorFromChi2.clone() -#SeedCreator -pixelLessStepSeeds.SeedCreatorPSet.ComponentName = 'SeedFromConsecutiveHitsTripletOnlyCreator' -#RegionFactory -pixelLessStepSeeds.RegionFactoryPSet.RegionPSet.ptMin = 0.4 -pixelLessStepSeeds.RegionFactoryPSet.RegionPSet.originHalfLength = 12.0 -pixelLessStepSeeds.RegionFactoryPSet.RegionPSet.originRadius = 1.0 -#SeedComparitor -import RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi -pixelLessStepClusterShapeHitFilter = RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi.ClusterShapeHitFilterESProducer.clone( - ComponentName = cms.string('pixelLessStepClusterShapeHitFilter'), - doStripShapeCut = cms.bool(False), - clusterChargeCut = cms.PSet(refToPSet_ = cms.string('SiStripClusterChargeCutTight')) - ) -import RecoPixelVertexing.PixelLowPtUtilities.StripSubClusterShapeSeedFilter_cfi -pixelLessStepSeeds.SeedComparitorPSet = cms.PSet( - ComponentName = cms.string('CombinedSeedComparitor'), +# TrackingRegion +from RecoTracker.TkTrackingRegions.globalTrackingRegionFromBeamSpotFixedZ_cfi import globalTrackingRegionFromBeamSpotFixedZ as _globalTrackingRegionFromBeamSpotFixedZ +pixelLessStepTrackingRegions = _globalTrackingRegionFromBeamSpotFixedZ.clone(RegionPSet = dict( + ptMin = 0.4, + originHalfLength = 12.0, + originRadius = 1.0 +)) +eras.trackingLowPU.toModify(pixelLessStepTrackingRegions, RegionPSet = dict( + ptMin = 0.7, + originHalfLength = 10.0, + originRadius = 2.0, +)) + + +# seeding +from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import ClusterShapeHitFilterESProducer as _ClusterShapeHitFilterESProducer +pixelLessStepClusterShapeHitFilter = _ClusterShapeHitFilterESProducer.clone( + ComponentName = 'pixelLessStepClusterShapeHitFilter', + doStripShapeCut = cms.bool(False), + clusterChargeCut = dict(refToPSet_ = 'SiStripClusterChargeCutTight') +) + +from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer +pixelLessStepClusterCheck = _clusterCheckerEDProducer.clone( + PixelClusterCollectionLabel = 'siPixelClusters' +) +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +pixelLessStepHitDoublets = _hitPairEDProducer.clone( + seedingLayers = "pixelLessStepSeedLayers", + trackingRegions = "pixelLessStepTrackingRegions", + clusterCheck = "pixelLessStepClusterCheck", + produceIntermediateHitDoublets = True, +) +from RecoTracker.TkSeedGenerator.multiHitFromChi2EDProducer_cfi import multiHitFromChi2EDProducer as _multiHitFromChi2EDProducer +pixelLessStepHitTriplets = _multiHitFromChi2EDProducer.clone( + doublets = "pixelLessStepHitDoublets", + maxElement = 1000000, +) +from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer_cff import seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer as _seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer +from RecoPixelVertexing.PixelLowPtUtilities.StripSubClusterShapeSeedFilter_cfi import StripSubClusterShapeSeedFilter as _StripSubClusterShapeSeedFilter +pixelLessStepSeeds = _seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer.clone( + seedingHitSets = "pixelLessStepHitTriplets", + SeedComparitorPSet = dict( + ComponentName = 'CombinedSeedComparitor', mode = cms.string("and"), comparitors = cms.VPSet( - cms.PSet( + cms.PSet(# FIXME: is this defined in any cfi that could be imported instead of copy-paste? ComponentName = cms.string('PixelClusterShapeSeedComparitor'), FilterAtHelixStage = cms.bool(True), FilterPixelHits = cms.bool(False), @@ -132,26 +152,22 @@ ClusterShapeHitFilterName = cms.string('pixelLessStepClusterShapeHitFilter'), ClusterShapeCacheSrc = cms.InputTag("siPixelClusterShapeCache") # not really needed here since FilterPixelHits=False ), - RecoPixelVertexing.PixelLowPtUtilities.StripSubClusterShapeSeedFilter_cfi.StripSubClusterShapeSeedFilter.clone() + _StripSubClusterShapeSeedFilter.clone() ) ) -import RecoTracker.TkSeedGenerator.GlobalMixedSeeds_cff -trackingLowPU.toReplaceWith(pixelLessStepSeeds, RecoTracker.TkSeedGenerator.GlobalMixedSeeds_cff.globalMixedSeeds.clone( - OrderedHitsFactoryPSet = dict(SeedingLayers = 'pixelLessStepSeedLayers'), - RegionFactoryPSet = dict(RegionPSet = dict( - ptMin = 0.7, - originHalfLength = 10.0, - originRadius = 2.0, - )), - SeedComparitorPSet = cms.PSet( - ComponentName = cms.string('PixelClusterShapeSeedComparitor'), +) +eras.trackingLowPU.toModify(pixelLessStepHitDoublets, produceSeedingHitSets=True, produceIntermediateHitDoublets=False) +eras.trackingLowPU.toModify(pixelLessStepSeeds, + seedingHitSets = "pixelLessStepHitDoublets", + SeedComparitorPSet = dict(# FIXME: is this defined in any cfi that could be imported instead of copy-paste? + ComponentName = 'PixelClusterShapeSeedComparitor', FilterAtHelixStage = cms.bool(True), FilterPixelHits = cms.bool(False), FilterStripHits = cms.bool(True), ClusterShapeHitFilterName = cms.string('ClusterShapeHitFilter'), ClusterShapeCacheSrc = cms.InputTag("siPixelClusterShapeCache") # not really needed here since FilterPixelHits=False ) -)) +) # QUALITY CUTS DURING TRACK BUILDING @@ -289,11 +305,15 @@ PixelLessStep = cms.Sequence(pixelLessStepClusters* pixelLessStepSeedLayers* + pixelLessStepTrackingRegions* + pixelLessStepClusterCheck* + pixelLessStepHitDoublets* + pixelLessStepHitTriplets* pixelLessStepSeeds* pixelLessStepTrackCandidates* pixelLessStepTracks* pixelLessStepClassifier1*pixelLessStepClassifier2* pixelLessStep) -_PixelLessStep_LowPU = PixelLessStep.copyAndExclude([pixelLessStepClassifier1, pixelLessStepClassifier2]) +_PixelLessStep_LowPU = PixelLessStep.copyAndExclude([pixelLessStepHitTriplets, pixelLessStepClassifier1, pixelLessStepClassifier2]) _PixelLessStep_LowPU.replace(pixelLessStep, pixelLessStepSelector) trackingLowPU.toReplaceWith(PixelLessStep, _PixelLessStep_LowPU) From 241846a19f6161cb1c389b4aadbe20fa6298493b Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 18 Aug 2016 17:25:59 +0200 Subject: [PATCH 33/69] Migrate TobTecStep --- .../Tracking/python/TobTecStep_cff.py | 7 +- .../python/TobTecStep_cff.py | 193 ++++++++++-------- 2 files changed, 111 insertions(+), 89 deletions(-) diff --git a/FastSimulation/Tracking/python/TobTecStep_cff.py b/FastSimulation/Tracking/python/TobTecStep_cff.py index b4ea8f4068bf5..0978c0003ea3d 100644 --- a/FastSimulation/Tracking/python/TobTecStep_cff.py +++ b/FastSimulation/Tracking/python/TobTecStep_cff.py @@ -2,6 +2,7 @@ # import the full tracking equivalent of this file import RecoTracker.IterativeTracking.TobTecStep_cff as _standard +from FastSimulation.Tracking.SeedingMigration import _regionProducerToFactoryPSet, _hitSetProducerToFactoryPSet # fast tracking mask producer import FastSimulation.Tracking.FastTrackerRecHitMaskProducer_cfi @@ -11,10 +12,10 @@ import FastSimulation.Tracking.TrajectorySeedProducer_cfi tobTecStepSeedsTripl = FastSimulation.Tracking.TrajectorySeedProducer_cfi.trajectorySeedProducer.clone( layerList = _standard.tobTecStepSeedLayersTripl.layerList.value(), - RegionFactoryPSet = _standard.tobTecStepSeedsTripl.RegionFactoryPSet, + RegionFactoryPSet = _regionProducerToFactoryPSet(_standard.tobTecStepTrackingRegionsTripl), hitMasks = cms.InputTag("tobTecStepMasks"), ) -tobTecStepSeedsTripl.seedFinderSelector.MultiHitGeneratorFactory = _standard.tobTecStepSeedsTripl.OrderedHitsFactoryPSet.GeneratorPSet +tobTecStepSeedsTripl.seedFinderSelector.MultiHitGeneratorFactory = _hitSetProducerToFactoryPSet(_standard.tobTecStepHitTripletsTripl) tobTecStepSeedsTripl.seedFinderSelector.MultiHitGeneratorFactory.SeedComparitorPSet=cms.PSet( ComponentName = cms.string( "none" ) ) tobTecStepSeedsTripl.seedFinderSelector.MultiHitGeneratorFactory.refitHits = False @@ -22,7 +23,7 @@ import FastSimulation.Tracking.TrajectorySeedProducer_cfi tobTecStepSeedsPair = FastSimulation.Tracking.TrajectorySeedProducer_cfi.trajectorySeedProducer.clone( layerList = _standard.tobTecStepSeedLayersPair.layerList.value(), - RegionFactoryPSet = _standard.tobTecStepSeedsPair.RegionFactoryPSet, + RegionFactoryPSet = _regionProducerToFactoryPSet(_standard.tobTecStepTrackingRegionsPair), hitMasks = cms.InputTag("tobTecStepMasks"), ) diff --git a/RecoTracker/IterativeTracking/python/TobTecStep_cff.py b/RecoTracker/IterativeTracking/python/TobTecStep_cff.py index aeb912483fb06..1a21341d6b731 100644 --- a/RecoTracker/IterativeTracking/python/TobTecStep_cff.py +++ b/RecoTracker/IterativeTracking/python/TobTecStep_cff.py @@ -37,41 +37,63 @@ maxRing = cms.int32(7) ) ) -# TRIPLET SEEDS -import RecoTracker.TkSeedGenerator.GlobalSeedsFromTriplets_cff -tobTecStepSeedsTripl = RecoTracker.TkSeedGenerator.GlobalSeedsFromTriplets_cff.globalSeedsFromTriplets.clone() -#OrderedHitsFactory -tobTecStepSeedsTripl.OrderedHitsFactoryPSet.SeedingLayers = 'tobTecStepSeedLayersTripl' -tobTecStepSeedsTripl.OrderedHitsFactoryPSet.ComponentName = 'StandardMultiHitGenerator' -import RecoTracker.TkSeedGenerator.MultiHitGeneratorFromChi2_cfi -tobTecStepSeedsTripl.OrderedHitsFactoryPSet.GeneratorPSet = RecoTracker.TkSeedGenerator.MultiHitGeneratorFromChi2_cfi.MultiHitGeneratorFromChi2.clone( - extraPhiKDBox = 0.01 + +# Triplet TrackingRegion +from RecoTracker.TkTrackingRegions.globalTrackingRegionFromBeamSpotFixedZ_cfi import globalTrackingRegionFromBeamSpotFixedZ as _globalTrackingRegionFromBeamSpotFixedZ +tobTecStepTrackingRegionsTripl = _globalTrackingRegionFromBeamSpotFixedZ.clone(RegionPSet = dict( + ptMin = 0.55, + originHalfLength = 20.0, + originRadius = 3.5 +)) + +# Triplet seeding +from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import ClusterShapeHitFilterESProducer as _ClusterShapeHitFilterESProducer +tobTecStepClusterShapeHitFilter = _ClusterShapeHitFilterESProducer.clone( + ComponentName = 'tobTecStepClusterShapeHitFilter', + doStripShapeCut = cms.bool(False), + clusterChargeCut = dict(refToPSet_ = 'SiStripClusterChargeCutTight') +) + +from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer +tobTecStepClusterCheckTripl = _clusterCheckerEDProducer.clone( + PixelClusterCollectionLabel = 'siPixelClusters' +) +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +tobTecStepHitDoubletsTripl = _hitPairEDProducer.clone( + seedingLayers = "tobTecStepSeedLayersTripl", + trackingRegions = "tobTecStepTrackingRegionsTripl", + clusterCheck = "tobTecStepClusterCheckTripl", + produceIntermediateHitDoublets = True, +) +from RecoTracker.TkSeedGenerator.multiHitFromChi2EDProducer_cfi import multiHitFromChi2EDProducer as _multiHitFromChi2EDProducer +tobTecStepHitTripletsTripl = _multiHitFromChi2EDProducer.clone( + doublets = "tobTecStepHitDoubletsTripl", + maxElement = 1000000, + extraPhiKDBox = 0.01, +) +from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsEDProducer_cff import seedCreatorFromRegionConsecutiveHitsEDProducer as _seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer +from RecoPixelVertexing.PixelLowPtUtilities.StripSubClusterShapeSeedFilter_cfi import StripSubClusterShapeSeedFilter as _StripSubClusterShapeSeedFilter +_tobTecStepSeedComparitorPSet = dict( + ComponentName = 'CombinedSeedComparitor', + mode = cms.string("and"), + comparitors = cms.VPSet( + cms.PSet(# FIXME: is this defined in any cfi that could be imported instead of copy-paste? + ComponentName = cms.string('PixelClusterShapeSeedComparitor'), + FilterAtHelixStage = cms.bool(True), + FilterPixelHits = cms.bool(False), + FilterStripHits = cms.bool(True), + ClusterShapeHitFilterName = cms.string('tobTecStepClusterShapeHitFilter'), + ClusterShapeCacheSrc = cms.InputTag("siPixelClusterShapeCache") # not really needed here since FilterPixelHits=False + ), + _StripSubClusterShapeSeedFilter.clone() ) -#RegionFactory -tobTecStepSeedsTripl.RegionFactoryPSet.RegionPSet.ptMin = 0.55 -tobTecStepSeedsTripl.RegionFactoryPSet.RegionPSet.originHalfLength = 20.0 -tobTecStepSeedsTripl.RegionFactoryPSet.RegionPSet.originRadius = 3.5 -#SeedCreator -tobTecStepSeedsTripl.SeedCreatorPSet.ComponentName = 'SeedFromConsecutiveHitsCreator' #empirically better than 'SeedFromConsecutiveHitsTripletOnlyCreator' -tobTecStepSeedsTripl.SeedCreatorPSet.OriginTransverseErrorMultiplier = 1.0 -#SeedComparitor -import RecoPixelVertexing.PixelLowPtUtilities.StripSubClusterShapeSeedFilter_cfi - -tobTecStepSeedsTripl.SeedComparitorPSet = cms.PSet( - ComponentName = cms.string('CombinedSeedComparitor'), - mode = cms.string("and"), - comparitors = cms.VPSet( - cms.PSet( - ComponentName = cms.string('PixelClusterShapeSeedComparitor'), - FilterAtHelixStage = cms.bool(True), - FilterPixelHits = cms.bool(False), - FilterStripHits = cms.bool(True), - ClusterShapeHitFilterName = cms.string('tobTecStepClusterShapeHitFilter'), - ClusterShapeCacheSrc = cms.InputTag("siPixelClusterShapeCache") # not really needed here since FilterPixelHits=False - ), - RecoPixelVertexing.PixelLowPtUtilities.StripSubClusterShapeSeedFilter_cfi.StripSubClusterShapeSeedFilter.clone() - ) ) +tobTecStepSeedsTripl = _seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer.clone(#empirically better than 'SeedFromConsecutiveHitsTripletOnlyCreator' + seedingHitSets = "tobTecStepHitTripletsTripl", + SeedComparitorPSet = _tobTecStepSeedComparitorPSet, +) + + # PAIR SEEDING LAYERS tobTecStepSeedLayersPair = cms.EDProducer("SeedingLayersEDProducer", layerList = cms.vstring('TOB1+TEC1_pos','TOB1+TEC1_neg', @@ -95,68 +117,54 @@ maxRing = cms.int32(5) ) ) -# PAIR SEEDS -import RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi -tobTecStepClusterShapeHitFilter = RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi.ClusterShapeHitFilterESProducer.clone( - ComponentName = cms.string('tobTecStepClusterShapeHitFilter'), - clusterChargeCut = cms.PSet(refToPSet_ = cms.string('SiStripClusterChargeCutTight')), - doStripShapeCut = cms.bool(False) - ) - -import RecoTracker.TkSeedGenerator.GlobalMixedSeeds_cff -tobTecStepSeedsPair = RecoTracker.TkSeedGenerator.GlobalMixedSeeds_cff.globalMixedSeeds.clone() -#OrderedHitsFactory -tobTecStepSeedsPair.OrderedHitsFactoryPSet.ComponentName = cms.string('StandardHitPairGenerator') -tobTecStepSeedsPair.OrderedHitsFactoryPSet.SeedingLayers = 'tobTecStepSeedLayersPair' -#RegionFactory -tobTecStepSeedsPair.RegionFactoryPSet.RegionPSet.ptMin = 0.6 -tobTecStepSeedsPair.RegionFactoryPSet.RegionPSet.originHalfLength = 30.0 -tobTecStepSeedsPair.RegionFactoryPSet.RegionPSet.originRadius = 6.0 -#SeedCreator -tobTecStepSeedsPair.SeedCreatorPSet.OriginTransverseErrorMultiplier = 1.0 -#SeedComparitor -tobTecStepSeedsPair.SeedComparitorPSet = cms.PSet( - ComponentName = cms.string('CombinedSeedComparitor'), - mode = cms.string("and"), - comparitors = cms.VPSet( - cms.PSet( - ComponentName = cms.string('PixelClusterShapeSeedComparitor'), - FilterAtHelixStage = cms.bool(True), - FilterPixelHits = cms.bool(False), - FilterStripHits = cms.bool(True), - ClusterShapeHitFilterName = cms.string('tobTecStepClusterShapeHitFilter'), - ClusterShapeCacheSrc = cms.InputTag("siPixelClusterShapeCache") # not really needed here since FilterPixelHits=False - ), - RecoPixelVertexing.PixelLowPtUtilities.StripSubClusterShapeSeedFilter_cfi.StripSubClusterShapeSeedFilter.clone() - ) +# Pair TrackingRegion +tobTecStepTrackingRegionsPair = _globalTrackingRegionFromBeamSpotFixedZ.clone(RegionPSet = dict( + ptMin = 0.6, + originHalfLength = 30.0, + originRadius = 6.0, +)) + +# Pair seeds +from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer +tobTecStepClusterCheckPair = _clusterCheckerEDProducer.clone( + PixelClusterCollectionLabel = 'siPixelClusters' +) +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +tobTecStepHitDoubletsPair = _hitPairEDProducer.clone( + seedingLayers = "tobTecStepSeedLayersPair", + trackingRegions = "tobTecStepTrackingRegionsPair", + clusterCheck = "tobTecStepClusterCheckPair", + maxElement = 1000000, + produceSeedingHitSets = True, +) +from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsEDProducer_cff import seedCreatorFromRegionConsecutiveHitsEDProducer as _seedCreatorFromRegionConsecutiveHitsEDProducer +tobTecStepSeedsPair = _seedCreatorFromRegionConsecutiveHitsEDProducer.clone( + seedingHitSets = "tobTecStepHitDoubletsPair", + SeedComparitorPSet = _tobTecStepSeedComparitorPSet, ) + +# Combined seeds import RecoTracker.TkSeedGenerator.GlobalCombinedSeeds_cfi tobTecStepSeeds = RecoTracker.TkSeedGenerator.GlobalCombinedSeeds_cfi.globalCombinedSeeds.clone() tobTecStepSeeds.seedCollections = cms.VInputTag(cms.InputTag('tobTecStepSeedsTripl'),cms.InputTag('tobTecStepSeedsPair')) + # LowPU -import RecoTracker.TkSeedGenerator.GlobalMixedSeeds_cff from Configuration.Eras.Modifier_trackingLowPU_cff import trackingLowPU -trackingLowPU.toReplaceWith(tobTecStepSeeds, RecoTracker.TkSeedGenerator.GlobalMixedSeeds_cff.globalMixedSeeds.clone( - OrderedHitsFactoryPSet = dict(SeedingLayers = 'tobTecStepSeedLayers'), - RegionFactoryPSet = dict(RegionPSet = dict( - ptMin = 0.6, - originHalfLength = 30.0, - originRadius = 6.0, - )) +trackingLowPU.toModify(tobTecStepHitDoubletsPair, seedingLayers = 'tobTecStepSeedLayers') +trackingLowPU.toReplaceWith(tobTecStepSeeds, _seedCreatorFromRegionConsecutiveHitsEDProducer.clone( + seedingHitSets = "tobTecStepHitDoubletsPair", )) # Phase1PU70 from Configuration.Eras.Modifier_trackingPhase1PU70_cff import trackingPhase1PU70 -trackingPhase1PU70.toReplaceWith(tobTecStepSeeds, RecoTracker.TkSeedGenerator.GlobalMixedSeeds_cff.globalMixedSeeds.clone( - OrderedHitsFactoryPSet = dict(SeedingLayers = 'tobTecStepSeedLayers'), - RegionFactoryPSet = dict( - RegionPSet = dict( - ptMin = 1.0, - originHalfLength = 15.0, - originRadius = 2.0 - ) - ), - SeedCreatorPSet = dict(OriginTransverseErrorMultiplier = 3.0), - SeedComparitorPSet = cms.PSet( +trackingPhase1PU70.toModify(tobTecStepTrackingRegionsPair, RegionPSet = dict( + ptMin = 1.0, + originHalfLength = 15.0, + originRadius = 2.0 +)) +trackingPhase1PU70.toModify(tobTecStepHitDoubletsPair, seedingLayers = 'tobTecStepSeedLayers') +trackingPhase1PU70.toReplaceWith(tobTecStepSeeds, tobTecStepSeedsPair.clone( + OriginTransverseErrorMultiplier = 3.0, + SeedComparitorPSet = cms.PSet(# FIXME: is this defined in any cfi that could be imported instead of copy-paste? ComponentName = cms.string('PixelClusterShapeSeedComparitor'), FilterAtHelixStage = cms.bool(True), FilterPixelHits = cms.bool(False), @@ -386,8 +394,15 @@ TobTecStep = cms.Sequence(tobTecStepClusters* tobTecStepSeedLayersTripl* + tobTecStepTrackingRegionsTripl* + tobTecStepClusterCheckTripl* + tobTecStepHitDoubletsTripl* + tobTecStepHitTripletsTripl* tobTecStepSeedsTripl* tobTecStepSeedLayersPair* + tobTecStepTrackingRegionsPair* + tobTecStepClusterCheckPair* + tobTecStepHitDoubletsPair* tobTecStepSeedsPair* tobTecStepSeeds* tobTecStepTrackCandidates* @@ -498,6 +513,9 @@ trackingLowPU.toReplaceWith(TobTecStep, cms.Sequence( tobTecStepClusters* tobTecStepSeedLayers* + tobTecStepTrackingRegionsPair* + tobTecStepClusterCheckPair* + tobTecStepHitDoubletsPair* tobTecStepSeeds* tobTecStepTrackCandidates* tobTecStepTracks* @@ -507,6 +525,9 @@ tobTecStepClusters* tobTecStepSeedClusters* tobTecStepSeedLayers* + tobTecStepTrackingRegionsPair* + tobTecStepClusterCheckPair* + tobTecStepHitDoubletsPair* tobTecStepSeeds* tobTecStepTrackCandidates* tobTecStepTracks* From 88c34bb1d1591f9a940f334763af64c2e8bcd6ce Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 23 Aug 2016 09:24:58 +0200 Subject: [PATCH 34/69] Add TauRegionalPixelSeedTrackingRegionEDProducer --- RecoTauTag/HLTProducers/src/SealModule.cc | 4 ++++ .../src/TauRegionalPixelSeedGenerator.h | 22 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/RecoTauTag/HLTProducers/src/SealModule.cc b/RecoTauTag/HLTProducers/src/SealModule.cc index 8efc7166eec9b..22830514ade9e 100644 --- a/RecoTauTag/HLTProducers/src/SealModule.cc +++ b/RecoTauTag/HLTProducers/src/SealModule.cc @@ -24,6 +24,10 @@ DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, TauRegionalPixelSeedGenerator, DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, TrackingRegionsFromBeamSpotAndL2Tau, "TrackingRegionsFromBeamSpotAndL2Tau"); DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, CandidateSeededTrackingRegionsProducer, "CandidateSeededTrackingRegionsProducer"); +#include "RecoTracker/TkTrackingRegions/interface/TrackingRegionEDProducerT.h" +using TauRegionalPixelSeedTrackingRegionEDProducer = TrackingRegionEDProducerT; +DEFINE_FWK_MODULE(TauRegionalPixelSeedTrackingRegionEDProducer); + DEFINE_FWK_MODULE(L2TauJetsMerger); DEFINE_FWK_MODULE(L1HLTJetsMatching); DEFINE_FWK_MODULE(L1HLTTauMatching); diff --git a/RecoTauTag/HLTProducers/src/TauRegionalPixelSeedGenerator.h b/RecoTauTag/HLTProducers/src/TauRegionalPixelSeedGenerator.h index 4e72adb79a1af..a5de85fd5bf43 100644 --- a/RecoTauTag/HLTProducers/src/TauRegionalPixelSeedGenerator.h +++ b/RecoTauTag/HLTProducers/src/TauRegionalPixelSeedGenerator.h @@ -60,6 +60,28 @@ class TauRegionalPixelSeedGenerator : public TrackingRegionProducer { virtual ~TauRegionalPixelSeedGenerator() {} + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + + desc.add("ptMin", 5.0); + desc.add("originHalfLength", 0.2); + desc.add("originRadius", 0.2); + desc.add("deltaEtaRegion", 0.1); + desc.add("deltaPhiRegion", 0.1); + desc.add("JetSrc", edm::InputTag("icone5Tau1")); + desc.add("vertexSrc", edm::InputTag("pixelVertices")); + desc.add("searchOpt", false); + + desc.add("howToUseMeasurementTracker", "ForSiStrips"); + desc.add("measurementTrackerName", edm::InputTag("MeasurementTrackerEvent")); + + // Only for backwards-compatibility + edm::ParameterSetDescription descRegion; + descRegion.add("RegionPSet", desc); + + descriptions.add("tauRegionalPixelSeedTrackingRegions", descRegion); + } + virtual std::vector > regions(const edm::Event& e, const edm::EventSetup& es) const override { std::vector > result; From db4ede9590f8955a42eccde785c812bdbde7c66c Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 23 Aug 2016 09:51:33 +0200 Subject: [PATCH 35/69] Migrate JetCoreRegionalStep --- .../python/JetCoreRegionalStep_cff.py | 62 +++++++++++-------- 1 file changed, 37 insertions(+), 25 deletions(-) diff --git a/RecoTracker/IterativeTracking/python/JetCoreRegionalStep_cff.py b/RecoTracker/IterativeTracking/python/JetCoreRegionalStep_cff.py index 23d6861654592..e262a0134a8ef 100644 --- a/RecoTracker/IterativeTracking/python/JetCoreRegionalStep_cff.py +++ b/RecoTracker/IterativeTracking/python/JetCoreRegionalStep_cff.py @@ -63,35 +63,44 @@ ] ) -# SEEDS -import RecoTracker.TkSeedGenerator.GlobalSeedsFromPairsWithVertices_cff -jetCoreRegionalStepSeeds = RecoTracker.TkSeedGenerator.GlobalSeedsFromPairsWithVertices_cff.globalSeedsFromPairsWithVertices.clone() -jetCoreRegionalStepSeeds.RegionFactoryPSet = cms.PSet( - ComponentName = cms.string( "TauRegionalPixelSeedGenerator" ),#not so nice to depend on RecoTau... - RegionPSet = cms.PSet( - precise = cms.bool( True ), - originRadius = cms.double( 0.2 ), - ptMin = cms.double( 10. ), - originHalfLength = cms.double( 0.2 ), - deltaPhiRegion = cms.double( 0.20 ), - deltaEtaRegion = cms.double( 0.20 ), - JetSrc = cms.InputTag( "jetsForCoreTracking" ), -# JetSrc = cms.InputTag( "ak5CaloJets" ), - vertexSrc = cms.InputTag( "firstStepGoodPrimaryVertices" ), - measurementTrackerName = cms.string( "MeasurementTrackerEvent" ), - howToUseMeasurementTracker = cms.string( "Never" ) - ) +# TrackingRegion +from RecoTauTag.HLTProducers.tauRegionalPixelSeedTrackingRegions_cfi import tauRegionalPixelSeedTrackingRegions as _tauRegionalPixelSeedTrackingRegions +jetCoreRegionalStepTrackingRegions = _tauRegionalPixelSeedTrackingRegions.clone(RegionPSet=dict( + ptMin = 10, + deltaPhiRegion = 0.20, + deltaEtaRegion = 0.20, + JetSrc = "jetsForCoreTracking", +# JetSrc = "ak5CaloJets", + vertexSrc = "firstStepGoodPrimaryVertices", + howToUseMeasurementTracker = "Never" +)) + +# Seeding +from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer +jetCoreRegionalStepClusterCheck = _clusterCheckerEDProducer.clone( + PixelClusterCollectionLabel = 'siPixelClusters' ) -jetCoreRegionalStepSeeds.OrderedHitsFactoryPSet.SeedingLayers = 'jetCoreRegionalStepSeedLayers' -jetCoreRegionalStepSeeds.SeedComparitorPSet = cms.PSet( - ComponentName = cms.string('none'), -#PixelClusterShapeSeedComparitor'), +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +jetCoreRegionalStepHitDoublets = _hitPairEDProducer.clone( + seedingLayers = "jetCoreRegionalStepSeedLayers", + trackingRegions = "jetCoreRegionalStepTrackingRegions", + clusterCheck = "jetCoreRegionalStepClusterCheck", + maxElement = 1000000, + produceSeedingHitSets = True, +) +from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsEDProducer_cff import seedCreatorFromRegionConsecutiveHitsEDProducer as _seedCreatorFromRegionConsecutiveHitsEDProducer +jetCoreRegionalStepSeeds = _seedCreatorFromRegionConsecutiveHitsEDProducer.clone( + seedingHitSets = "jetCoreRegionalStepHitDoublets", + forceKinematicWithRegionDirection = True +# SeedComparitorPSet = dict(# FIXME: is this defined in any cfi that could be imported instead of copy-paste? +# ComponentName = 'PixelClusterShapeSeedComparitor', # FilterAtHelixStage = cms.bool(True), # FilterPixelHits = cms.bool(True), # FilterStripHits = cms.bool(False), -# ClusterShapeHitFilterName = cms.string('ClusterShapeHitFilter') - ) -jetCoreRegionalStepSeeds.SeedCreatorPSet.forceKinematicWithRegionDirection = cms.bool( True ) +# ClusterShapeHitFilterName = cms.string('ClusterShapeHitFilter'), +# ClusterShapeCacheSrc = cms.InputTag('siPixelClusterShapeCache'), +# ) +) # QUALITY CUTS DURING TRACK BUILDING import TrackingTools.TrajectoryFiltering.TrajectoryFilter_cff @@ -182,6 +191,9 @@ firstStepGoodPrimaryVertices* #jetCoreRegionalStepClusters* jetCoreRegionalStepSeedLayers* + jetCoreRegionalStepTrackingRegions* + jetCoreRegionalStepClusterCheck* + jetCoreRegionalStepHitDoublets* jetCoreRegionalStepSeeds* jetCoreRegionalStepTrackCandidates* jetCoreRegionalStepTracks* From bd3ca8dfc43604b8a4f651498b77b3a27da24e6b Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 24 Aug 2016 10:17:51 +0200 Subject: [PATCH 36/69] Migrate ElectronSeeds --- .../python/ElectronSeeds_cff.py | 118 ++++++++++++++---- 1 file changed, 91 insertions(+), 27 deletions(-) diff --git a/RecoTracker/IterativeTracking/python/ElectronSeeds_cff.py b/RecoTracker/IterativeTracking/python/ElectronSeeds_cff.py index 423fce6ba0ccb..e6b1c3e6a6d4e 100644 --- a/RecoTracker/IterativeTracking/python/ElectronSeeds_cff.py +++ b/RecoTracker/IterativeTracking/python/ElectronSeeds_cff.py @@ -95,26 +95,39 @@ FPix = dict(skipClusters = 'pixelPairStepSeedClusterMask') ) -import RecoTracker.TkSeedGenerator.GlobalSeedsFromTriplets_cff -from RecoTracker.TkTrackingRegions.GlobalTrackingRegionFromBeamSpot_cfi import RegionPsetFomBeamSpotBlock -tripletElectronSeeds = RecoTracker.TkSeedGenerator.GlobalSeedsFromTriplets_cff.globalSeedsFromTriplets.clone( - RegionFactoryPSet = RegionPsetFomBeamSpotBlock.clone( - ComponentName = cms.string('GlobalRegionProducerFromBeamSpot'), - RegionPSet = RegionPsetFomBeamSpotBlock.RegionPSet.clone( +from RecoTracker.TkTrackingRegions.globalTrackingRegionFromBeamSpot_cfi import globalTrackingRegionFromBeamSpot as _globalTrackingRegionFromBeamSpot +tripletElectronTrackingRegions = _globalTrackingRegionFromBeamSpot.clone(RegionPSet = dict( ptMin = 1.0, originRadius = 0.02, nSigmaZ = 4.0 - ) - ) +)) +from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer +tripletElectronClusterCheck = _clusterCheckerEDProducer.clone( + PixelClusterCollectionLabel = 'siPixelClusters' +) +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +tripletElectronHitDoublets = _hitPairEDProducer.clone( + seedingLayers = "tripletElectronSeedLayers", + trackingRegions = "tripletElectronTrackingRegions", + clusterCheck = "tripletElectronClusterCheck", + produceIntermediateHitDoublets = True, +) +from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer +import RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi +tripletElectronHitTriplets = _pixelTripletHLTEDProducer.clone( + doublets = "tripletElectronHitDoublets", + maxElement = 1000000, + produceSeedingHitSets = True, ) -tripletElectronSeeds.OrderedHitsFactoryPSet.SeedingLayers = cms.InputTag('tripletElectronSeedLayers') -trackingPhase1PU70.toModify(tripletElectronSeeds, - OrderedHitsFactoryPSet = dict(maxElement = cms.uint32(0)), # not sure if this has any effect +from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsEDProducer_cff import seedCreatorFromRegionConsecutiveHitsEDProducer as _seedCreatorFromRegionConsecutiveHitsEDProducer +tripletElectronSeeds = _seedCreatorFromRegionConsecutiveHitsEDProducer.clone( + seedingHitSets = "tripletElectronHitTriplets", ) -trackingPhase2PU140.toModify(tripletElectronSeeds, - ClusterCheckPSet = dict( doClusterCheck = False ), - OrderedHitsFactoryPSet = dict( GeneratorPSet = dict( maxElement = 0 )), - SeedCreatorPSet = dict( magneticField = '', propagator = 'PropagatorWithMaterial') +trackingPhase1PU70.toModify(tripletElectronHitTriplets, + maxElement = 0, # not sure if this has any effect +) +trackingPhase2PU140.toModify(tripletElectronHitTriplets, + maxElement = 0, ) from RecoLocalTracker.SubCollectionProducers.SeedClusterRemover_cfi import seedClusterRemover @@ -159,12 +172,28 @@ ] ) -import RecoTracker.TkSeedGenerator.GlobalSeedsFromPairsWithVertices_cff -pixelPairElectronSeeds = RecoTracker.TkSeedGenerator.GlobalSeedsFromPairsWithVertices_cff.globalSeedsFromPairsWithVertices.clone() -pixelPairElectronSeeds.RegionFactoryPSet.RegionPSet.ptMin = 1.0 -pixelPairElectronSeeds.RegionFactoryPSet.RegionPSet.originRadius = 0.015 -pixelPairElectronSeeds.RegionFactoryPSet.RegionPSet.fixedError = 0.03 -pixelPairElectronSeeds.OrderedHitsFactoryPSet.SeedingLayers = cms.InputTag('pixelPairElectronSeedLayers') +from RecoTracker.TkTrackingRegions.globalTrackingRegionWithVertices_cff import globalTrackingRegionWithVertices as _globalTrackingRegionWithVertices +pixelPairElectronTrackingRegions = _globalTrackingRegionWithVertices.clone(RegionPSet = dict( + ptMin = 1.0, + originRadius = 0.015, + fixedError = 0.03, +)) +from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer +pixelPairElectronClusterCheck = _clusterCheckerEDProducer.clone( + PixelClusterCollectionLabel = 'siPixelClusters' +) +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +pixelPairElectronHitDoublets = _hitPairEDProducer.clone( + seedingLayers = "pixelPairElectronSeedLayers", + trackingRegions = "pixelPairElectronTrackingRegions", + clusterCheck = "pixelPairElectronClusterCheck", + maxElement = 1000000, + produceSeedingHitSets = True, +) +from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsEDProducer_cff import seedCreatorFromRegionConsecutiveHitsEDProducer as _seedCreatorFromRegionConsecutiveHitsEDProducer +pixelPairElectronSeeds = _seedCreatorFromRegionConsecutiveHitsEDProducer.clone( + seedingHitSets = "pixelPairElectronHitDoublets", +) stripPairElectronSeedLayers = cms.EDProducer("SeedingLayersEDProducer", layerList = cms.vstring('TIB1+TIB2', 'TIB1+TID1_pos', 'TIB1+TID1_neg', 'TID2_pos+TID3_pos', 'TID2_neg+TID3_neg', @@ -193,12 +222,29 @@ ) ) -import RecoTracker.TkSeedGenerator.GlobalMixedSeeds_cff -stripPairElectronSeeds = RecoTracker.TkSeedGenerator.GlobalMixedSeeds_cff.globalMixedSeeds.clone() -stripPairElectronSeeds.OrderedHitsFactoryPSet.SeedingLayers = 'stripPairElectronSeedLayers' -stripPairElectronSeeds.RegionFactoryPSet.RegionPSet.ptMin = 1.0 -stripPairElectronSeeds.RegionFactoryPSet.RegionPSet.originHalfLength = 12.0 -stripPairElectronSeeds.RegionFactoryPSet.RegionPSet.originRadius = 0.4 +from RecoTracker.TkTrackingRegions.globalTrackingRegionFromBeamSpotFixedZ_cfi import globalTrackingRegionFromBeamSpotFixedZ as _globalTrackingRegionFromBeamSpotFixedZ +stripPairElectronTrackingRegions = _globalTrackingRegionFromBeamSpotFixedZ.clone(RegionPSet = dict( + ptMin = 1.0, + originHalfLength = 12.0, + originRadius = 0.4, +)) +from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer +stripPairElectronClusterCheck = _clusterCheckerEDProducer.clone( + PixelClusterCollectionLabel = 'siPixelClusters' +) +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +stripPairElectronHitDoublets = _hitPairEDProducer.clone( + seedingLayers = "stripPairElectronSeedLayers", + trackingRegions = "stripPairElectronTrackingRegions", + clusterCheck = "stripPairElectronClusterCheck", + maxElement = 1000000, + produceSeedingHitSets = True, +) +from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsEDProducer_cff import seedCreatorFromRegionConsecutiveHitsEDProducer as _seedCreatorFromRegionConsecutiveHitsEDProducer +stripPairElectronSeeds = _seedCreatorFromRegionConsecutiveHitsEDProducer.clone( + seedingHitSets = "stripPairElectronHitDoublets", +) + ###This seed collection is produced for electron reconstruction import RecoTracker.TkSeedGenerator.GlobalCombinedSeeds_cfi @@ -240,11 +286,21 @@ mixedTripletStepSeedClusterMask* pixelLessStepSeedClusterMask* tripletElectronSeedLayers* + tripletElectronTrackingRegions* + tripletElectronClusterCheck* + tripletElectronHitDoublets* + tripletElectronHitTriplets* tripletElectronSeeds* tripletElectronClusterMask* pixelPairElectronSeedLayers* + pixelPairElectronTrackingRegions* + pixelPairElectronClusterCheck* + pixelPairElectronHitDoublets* pixelPairElectronSeeds* stripPairElectronSeedLayers* + stripPairElectronTrackingRegions* + stripPairElectronClusterCheck* + stripPairElectronHitDoublets* stripPairElectronSeeds* newCombinedSeeds) _electronSeedsSeq_Phase1 = electronSeedsSeq.copy() @@ -255,6 +311,10 @@ highPtTripletStepSeedClusterMask* pixelPairStepSeedClusterMask* tripletElectronSeedLayers* + tripletElectronTrackingRegions* + tripletElectronClusterCheck* + tripletElectronHitDoublets* + tripletElectronHitTriplets* tripletElectronSeeds* newCombinedSeeds )) @@ -263,6 +323,10 @@ highPtTripletStepSeedClusterMask* pixelPairStepSeedClusterMask* tripletElectronSeedLayers* + tripletElectronTrackingRegions* + tripletElectronClusterCheck* + tripletElectronHitDoublets* + tripletElectronHitTriplets* tripletElectronSeeds* newCombinedSeeds )) From 6ff51c091c244ea1bfd4a5313bfb1e260a1fb9e1 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 25 Aug 2016 10:39:04 +0200 Subject: [PATCH 37/69] Do cluster check only once --- .../HiRegitMuonDetachedTripletStep_cff.py | 6 +----- .../python/HiRegitMuonInitialStep_cff.py | 6 +----- .../python/HiRegitMuonMixedTripletStep_cff.py | 8 ++------ .../python/HiRegitMuonPixelLessStep_cff.py | 6 +----- .../python/HiRegitMuonPixelPairStep_cff.py | 6 +----- .../python/hiMuonIterativeTk_cff.py | 8 +++++++- .../python/DetachedQuadStep_cff.py | 6 ------ .../python/DetachedTripletStep_cff.py | 6 ------ .../python/ElectronSeeds_cff.py | 20 ------------------- .../python/HighPtTripletStep_cff.py | 6 ------ .../python/InitialStepPreSplitting_cff.py | 16 +++++++-------- .../python/InitialStep_cff.py | 7 ------- .../python/JetCoreRegionalStep_cff.py | 6 ------ .../python/LowPtQuadStep_cff.py | 6 ------ .../python/LowPtTripletStep_cff.py | 6 ------ .../python/MixedTripletStep_cff.py | 6 ------ .../python/PixelLessStep_cff.py | 6 ------ .../python/PixelPairStep_cff.py | 6 ------ .../python/TobTecStep_cff.py | 14 ------------- .../python/iterativeTk_cff.py | 2 ++ .../TkHitPairs/plugins/HitPairEDProducer.cc | 2 +- .../plugins/ClusterCheckerEDProducer.cc | 2 +- .../python/clusterCheckerEDProducer_cff.py | 5 ----- .../python/trackerClusterCheck_cff.py | 6 ++++++ 24 files changed, 31 insertions(+), 137 deletions(-) delete mode 100644 RecoTracker/TkSeedGenerator/python/clusterCheckerEDProducer_cff.py create mode 100644 RecoTracker/TkSeedGenerator/python/trackerClusterCheck_cff.py diff --git a/RecoHI/HiMuonAlgos/python/HiRegitMuonDetachedTripletStep_cff.py b/RecoHI/HiMuonAlgos/python/HiRegitMuonDetachedTripletStep_cff.py index 35b3c12abc6b4..40490b2b1279c 100644 --- a/RecoHI/HiMuonAlgos/python/HiRegitMuonDetachedTripletStep_cff.py +++ b/RecoHI/HiMuonAlgos/python/HiRegitMuonDetachedTripletStep_cff.py @@ -41,13 +41,10 @@ hiRegitMuDetachedTripletStepSeedLayers.FPix.skipClusters = cms.InputTag('hiRegitMuDetachedTripletStepClusters') # seeding -hiRegitMuDetachedTripletStepClusterCheck = RecoTracker.IterativeTracking.DetachedTripletStep_cff.detachedTripletStepClusterCheck.clone( - doClusterCheck = False # do not check for max number of clusters pixel or strips -) hiRegitMuDetachedTripletStepHitDoublets = RecoTracker.IterativeTracking.DetachedTripletStep_cff.detachedTripletStepHitDoublets.clone( seedingLayers = "hiRegitMuDetachedTripletStepSeedLayers", trackingRegions = "hiRegitMuDetachedTripletStepTrackingRegions", - clusterCheck = "hiRegitMuDetachedTripletStepClusterCheck", + clusterCheck = "hiRegitMuClusterCheck", ) hiRegitMuDetachedTripletStepHitTriplets = RecoTracker.IterativeTracking.DetachedTripletStep_cff.detachedTripletStepHitTriplets.clone( doublets = "hiRegitMuDetachedTripletStepHitDoublets" @@ -118,7 +115,6 @@ hiRegitMuonDetachedTripletStep = cms.Sequence(hiRegitMuDetachedTripletStepClusters* hiRegitMuDetachedTripletStepSeedLayers* hiRegitMuDetachedTripletStepTrackingRegions* - hiRegitMuDetachedTripletStepClusterCheck* hiRegitMuDetachedTripletStepHitDoublets* hiRegitMuDetachedTripletStepHitTriplets* hiRegitMuDetachedTripletStepSeeds* diff --git a/RecoHI/HiMuonAlgos/python/HiRegitMuonInitialStep_cff.py b/RecoHI/HiMuonAlgos/python/HiRegitMuonInitialStep_cff.py index 5451c30ff324a..4654f9b8f88fd 100644 --- a/RecoHI/HiMuonAlgos/python/HiRegitMuonInitialStep_cff.py +++ b/RecoHI/HiMuonAlgos/python/HiRegitMuonInitialStep_cff.py @@ -29,13 +29,10 @@ hiRegitMuInitialStepSeedLayers = RecoTracker.IterativeTracking.InitialStep_cff.initialStepSeedLayers.clone() # seeding -hiRegitMuInitialStepClusterCheck = RecoTracker.IterativeTracking.InitialStep_cff.initialStepClusterCheck.clone( - doClusterCheck = False # do not check for max number of clusters pixel or strips -) hiRegitMuInitialStepHitDoublets = RecoTracker.IterativeTracking.InitialStep_cff.initialStepHitDoublets.clone( seedingLayers = "hiRegitMuInitialStepSeedLayers", trackingRegions = "hiRegitMuInitialStepTrackingRegions", - clusterCheck = "hiRegitMuInitialStepClusterCheck", + clusterCheck = "hiRegitMuClusterCheck", ) hiRegitMuInitialStepHitTriplets = RecoTracker.IterativeTracking.InitialStep_cff.initialStepHitTriplets.clone( doublets = "hiRegitMuInitialStepHitDoublets" @@ -109,7 +106,6 @@ hiRegitMuonInitialStep = cms.Sequence(hiRegitMuInitialStepSeedLayers* hiRegitMuInitialStepTrackingRegions* - hiRegitMuInitialStepClusterCheck* hiRegitMuInitialStepHitDoublets* hiRegitMuInitialStepHitTriplets* hiRegitMuInitialStepSeeds* diff --git a/RecoHI/HiMuonAlgos/python/HiRegitMuonMixedTripletStep_cff.py b/RecoHI/HiMuonAlgos/python/HiRegitMuonMixedTripletStep_cff.py index 85588900a5342..99a33944ee00f 100644 --- a/RecoHI/HiMuonAlgos/python/HiRegitMuonMixedTripletStep_cff.py +++ b/RecoHI/HiMuonAlgos/python/HiRegitMuonMixedTripletStep_cff.py @@ -47,13 +47,10 @@ hiRegitMuMixedTripletStepSeedLayersA.TEC.skipClusters = cms.InputTag('hiRegitMuMixedTripletStepClusters') # SEEDS A -hiRegitMuMixedTripletStepClusterCheck = RecoTracker.IterativeTracking.MixedTripletStep_cff.mixedTripletStepClusterCheck.clone( - doClusterCheck = False # do not check for max number of clusters pixel or strips -) hiRegitMuMixedTripletStepHitDoubletsA = RecoTracker.IterativeTracking.MixedTripletStep_cff.mixedTripletStepHitDoubletsA.clone( seedingLayers = "hiRegitMuMixedTripletStepSeedLayersA", trackingRegions = "hiRegitMuMixedTripletStepTrackingRegionsA", - clusterCheck = "hiRegitMuMixedTripletStepClusterCheck", + clusterCheck = "hiRegitMuClusterCheck", ) hiRegitMuMixedTripletStepHitTripletsA = RecoTracker.IterativeTracking.MixedTripletStep_cff.mixedTripletStepHitTripletsA.clone( doublets = "hiRegitMuMixedTripletStepHitDoubletsA" @@ -71,7 +68,7 @@ hiRegitMuMixedTripletStepHitDoubletsB = RecoTracker.IterativeTracking.MixedTripletStep_cff.mixedTripletStepHitDoubletsB.clone( seedingLayers = "hiRegitMuMixedTripletStepSeedLayersB", trackingRegions = "hiRegitMuMixedTripletStepTrackingRegionsB", - clusterCheck = "hiRegitMuMixedTripletStepClusterCheck", + clusterCheck = "hiRegitMuClusterCheck", ) hiRegitMuMixedTripletStepHitTripletsB = RecoTracker.IterativeTracking.MixedTripletStep_cff.mixedTripletStepHitTripletsB.clone( doublets = "hiRegitMuMixedTripletStepHitDoubletsB" @@ -155,7 +152,6 @@ hiRegitMuonMixedTripletStep = cms.Sequence(hiRegitMuMixedTripletStepClusters* hiRegitMuMixedTripletStepSeedLayersA* hiRegitMuMixedTripletStepTrackingRegionsA* - hiRegitMuMixedTripletStepClusterCheck* hiRegitMuMixedTripletStepHitDoubletsA* hiRegitMuMixedTripletStepHitTripletsA* hiRegitMuMixedTripletStepSeedsA* diff --git a/RecoHI/HiMuonAlgos/python/HiRegitMuonPixelLessStep_cff.py b/RecoHI/HiMuonAlgos/python/HiRegitMuonPixelLessStep_cff.py index a31302eb7c1e7..52ee60c0ce4d7 100644 --- a/RecoHI/HiMuonAlgos/python/HiRegitMuonPixelLessStep_cff.py +++ b/RecoHI/HiMuonAlgos/python/HiRegitMuonPixelLessStep_cff.py @@ -46,13 +46,10 @@ # seeding -hiRegitMuPixelLessStepClusterCheck = RecoTracker.IterativeTracking.PixelLessStep_cff.pixelLessStepClusterCheck.clone( - doClusterCheck = False # do not check for max number of clusters pixel or strips -) hiRegitMuPixelLessStepHitDoublets = RecoTracker.IterativeTracking.PixelLessStep_cff.pixelLessStepHitDoublets.clone( seedingLayers = "hiRegitMuPixelLessStepSeedLayers", trackingRegions = "hiRegitMuPixelLessStepTrackingRegions", - clusterCheck = "hiRegitMuPixelLessStepClusterCheck", + clusterCheck = "hiRegitMuClusterCheck", ) hiRegitMuPixelLessStepHitTriplets = RecoTracker.IterativeTracking.PixelLessStep_cff.pixelLessStepHitTriplets.clone( doublets = "hiRegitMuPixelLessStepHitDoublets" @@ -123,7 +120,6 @@ hiRegitMuonPixelLessStep = cms.Sequence(hiRegitMuPixelLessStepClusters* hiRegitMuPixelLessStepSeedLayers* hiRegitMuPixelLessStepTrackingRegions* - hiRegitMuPixelLessStepClusterCheck* hiRegitMuPixelLessStepHitDoublets* hiRegitMuPixelLessStepHitTriplets* hiRegitMuPixelLessStepSeeds* diff --git a/RecoHI/HiMuonAlgos/python/HiRegitMuonPixelPairStep_cff.py b/RecoHI/HiMuonAlgos/python/HiRegitMuonPixelPairStep_cff.py index 09fbf94899c2a..d8ac826f4d318 100644 --- a/RecoHI/HiMuonAlgos/python/HiRegitMuonPixelPairStep_cff.py +++ b/RecoHI/HiMuonAlgos/python/HiRegitMuonPixelPairStep_cff.py @@ -45,13 +45,10 @@ # seeding -hiRegitMuPixelPairStepClusterCheck = RecoTracker.IterativeTracking.PixelPairStep_cff.pixelPairStepClusterCheck.clone( - doClusterCheck = False # do not check for max number of clusters pixel or strips -) hiRegitMuPixelPairStepHitDoublets = RecoTracker.IterativeTracking.PixelPairStep_cff.pixelPairStepHitDoublets.clone( seedingLayers = "hiRegitMuPixelPairStepSeedLayers", trackingRegions = "hiRegitMuPixelPairStepTrackingRegions", - clusterCheck = "hiRegitMuPixelPairStepClusterCheck", + clusterCheck = "hiRegitMuClusterCheck", ) hiRegitMuPixelPairStepSeeds = RecoTracker.IterativeTracking.PixelPairStep_cff.pixelPairStepSeeds.clone( seedingHitSets = "hiRegitMuPixelPairStepHitDoublets" @@ -126,7 +123,6 @@ hiRegitMuonPixelPairStep = cms.Sequence(hiRegitMuPixelPairStepClusters* hiRegitMuPixelPairStepSeedLayers* hiRegitMuPixelPairStepTrackingRegions* - hiRegitMuPixelPairStepClusterCheck* hiRegitMuPixelPairStepHitDoublets* hiRegitMuPixelPairStepSeeds* hiRegitMuPixelPairStepTrackCandidates* diff --git a/RecoHI/HiMuonAlgos/python/hiMuonIterativeTk_cff.py b/RecoHI/HiMuonAlgos/python/hiMuonIterativeTk_cff.py index b0433fef1acc3..d7af1f9eea782 100644 --- a/RecoHI/HiMuonAlgos/python/hiMuonIterativeTk_cff.py +++ b/RecoHI/HiMuonAlgos/python/hiMuonIterativeTk_cff.py @@ -1,5 +1,10 @@ import FWCore.ParameterSet.Config as cms +from RecoTracker.TkSeedGenerator.trackerClusterCheck_cff import trackerClusterCheck as _trackerClusterCheck +hiRegitMuClusterCheck = _trackerClusterCheck.clone( + doClusterCheck = False # do not check for max number of clusters pixel or strips +) + from RecoHI.HiMuonAlgos.HiRegitMuonInitialStep_cff import * from RecoHI.HiMuonAlgos.HiRegitMuonPixelPairStep_cff import * from RecoHI.HiMuonAlgos.HiRegitMuonDetachedTripletStep_cff import * @@ -31,7 +36,8 @@ makeReKeyedSeeds = cms.untracked.bool(False) ) -hiRegitMuTracking = cms.Sequence(hiRegitMuonInitialStep +hiRegitMuTracking = cms.Sequence(hiRegitMuClusterCheck + *hiRegitMuonInitialStep *hiRegitMuonPixelPairStep *hiRegitMuonMixedTripletStep *hiRegitMuonPixelLessStep diff --git a/RecoTracker/IterativeTracking/python/DetachedQuadStep_cff.py b/RecoTracker/IterativeTracking/python/DetachedQuadStep_cff.py index 6f3863d790c58..b53314ccf1929 100644 --- a/RecoTracker/IterativeTracking/python/DetachedQuadStep_cff.py +++ b/RecoTracker/IterativeTracking/python/DetachedQuadStep_cff.py @@ -47,15 +47,10 @@ ))) # seeding -from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer -detachedQuadStepClusterCheck = _clusterCheckerEDProducer.clone( - PixelClusterCollectionLabel = 'siPixelClusters' -) from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer detachedQuadStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "detachedQuadStepSeedLayers", trackingRegions = "detachedQuadStepTrackingRegions", - clusterCheck = "detachedQuadStepClusterCheck", produceIntermediateHitDoublets = True, ) from RecoPixelVertexing.PixelTriplets.pixelTripletLargeTipEDProducer_cfi import pixelTripletLargeTipEDProducer as _pixelTripletLargeTipEDProducer @@ -441,7 +436,6 @@ DetachedQuadStep = cms.Sequence(detachedQuadStepClusters* detachedQuadStepSeedLayers* detachedQuadStepTrackingRegions* - detachedQuadStepClusterCheck* detachedQuadStepHitDoublets* detachedQuadStepHitTriplets* detachedQuadStepHitQuadruplets* diff --git a/RecoTracker/IterativeTracking/python/DetachedTripletStep_cff.py b/RecoTracker/IterativeTracking/python/DetachedTripletStep_cff.py index 491ea656ad6f5..f1c0c05a00a84 100644 --- a/RecoTracker/IterativeTracking/python/DetachedTripletStep_cff.py +++ b/RecoTracker/IterativeTracking/python/DetachedTripletStep_cff.py @@ -44,15 +44,10 @@ )) # seeding -from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer -detachedTripletStepClusterCheck = _clusterCheckerEDProducer.clone( - PixelClusterCollectionLabel = 'siPixelClusters' -) from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer detachedTripletStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "detachedTripletStepSeedLayers", trackingRegions = "detachedTripletStepTrackingRegions", - clusterCheck = "detachedTripletStepClusterCheck", produceIntermediateHitDoublets = True, ) from RecoPixelVertexing.PixelTriplets.pixelTripletLargeTipEDProducer_cfi import pixelTripletLargeTipEDProducer as _pixelTripletLargeTipEDProducer @@ -281,7 +276,6 @@ DetachedTripletStep = cms.Sequence(detachedTripletStepClusters* detachedTripletStepSeedLayers* detachedTripletStepTrackingRegions* - detachedTripletStepClusterCheck* detachedTripletStepHitDoublets* detachedTripletStepHitTriplets* detachedTripletStepSeeds* diff --git a/RecoTracker/IterativeTracking/python/ElectronSeeds_cff.py b/RecoTracker/IterativeTracking/python/ElectronSeeds_cff.py index e6b1c3e6a6d4e..e9d44d1734912 100644 --- a/RecoTracker/IterativeTracking/python/ElectronSeeds_cff.py +++ b/RecoTracker/IterativeTracking/python/ElectronSeeds_cff.py @@ -101,15 +101,10 @@ originRadius = 0.02, nSigmaZ = 4.0 )) -from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer -tripletElectronClusterCheck = _clusterCheckerEDProducer.clone( - PixelClusterCollectionLabel = 'siPixelClusters' -) from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer tripletElectronHitDoublets = _hitPairEDProducer.clone( seedingLayers = "tripletElectronSeedLayers", trackingRegions = "tripletElectronTrackingRegions", - clusterCheck = "tripletElectronClusterCheck", produceIntermediateHitDoublets = True, ) from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer @@ -178,15 +173,10 @@ originRadius = 0.015, fixedError = 0.03, )) -from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer -pixelPairElectronClusterCheck = _clusterCheckerEDProducer.clone( - PixelClusterCollectionLabel = 'siPixelClusters' -) from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer pixelPairElectronHitDoublets = _hitPairEDProducer.clone( seedingLayers = "pixelPairElectronSeedLayers", trackingRegions = "pixelPairElectronTrackingRegions", - clusterCheck = "pixelPairElectronClusterCheck", maxElement = 1000000, produceSeedingHitSets = True, ) @@ -228,15 +218,10 @@ originHalfLength = 12.0, originRadius = 0.4, )) -from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer -stripPairElectronClusterCheck = _clusterCheckerEDProducer.clone( - PixelClusterCollectionLabel = 'siPixelClusters' -) from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer stripPairElectronHitDoublets = _hitPairEDProducer.clone( seedingLayers = "stripPairElectronSeedLayers", trackingRegions = "stripPairElectronTrackingRegions", - clusterCheck = "stripPairElectronClusterCheck", maxElement = 1000000, produceSeedingHitSets = True, ) @@ -287,19 +272,16 @@ pixelLessStepSeedClusterMask* tripletElectronSeedLayers* tripletElectronTrackingRegions* - tripletElectronClusterCheck* tripletElectronHitDoublets* tripletElectronHitTriplets* tripletElectronSeeds* tripletElectronClusterMask* pixelPairElectronSeedLayers* pixelPairElectronTrackingRegions* - pixelPairElectronClusterCheck* pixelPairElectronHitDoublets* pixelPairElectronSeeds* stripPairElectronSeedLayers* stripPairElectronTrackingRegions* - stripPairElectronClusterCheck* stripPairElectronHitDoublets* stripPairElectronSeeds* newCombinedSeeds) @@ -312,7 +294,6 @@ pixelPairStepSeedClusterMask* tripletElectronSeedLayers* tripletElectronTrackingRegions* - tripletElectronClusterCheck* tripletElectronHitDoublets* tripletElectronHitTriplets* tripletElectronSeeds* @@ -324,7 +305,6 @@ pixelPairStepSeedClusterMask* tripletElectronSeedLayers* tripletElectronTrackingRegions* - tripletElectronClusterCheck* tripletElectronHitDoublets* tripletElectronHitTriplets* tripletElectronSeeds* diff --git a/RecoTracker/IterativeTracking/python/HighPtTripletStep_cff.py b/RecoTracker/IterativeTracking/python/HighPtTripletStep_cff.py index 04d7d275b7dce..0f88d96ea0c6f 100644 --- a/RecoTracker/IterativeTracking/python/HighPtTripletStep_cff.py +++ b/RecoTracker/IterativeTracking/python/HighPtTripletStep_cff.py @@ -63,15 +63,10 @@ trackingPhase2PU140.toModify(highPtTripletStepTrackingRegions, RegionPSet = dict(ptMin = 0.9, originRadius = 0.03)) # seeding -from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer -highPtTripletStepClusterCheck = _clusterCheckerEDProducer.clone( - PixelClusterCollectionLabel = 'siPixelClusters' -) from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer highPtTripletStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "highPtTripletStepSeedLayers", trackingRegions = "highPtTripletStepTrackingRegions", - clusterCheck = "highPtTripletStepClusterCheck", produceIntermediateHitDoublets = True, ) from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer @@ -319,7 +314,6 @@ HighPtTripletStep = cms.Sequence(highPtTripletStepClusters* highPtTripletStepSeedLayers* highPtTripletStepTrackingRegions* - highPtTripletStepClusterCheck* highPtTripletStepHitDoublets* highPtTripletStepHitTriplets* highPtTripletStepSeeds* diff --git a/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py b/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py index e1681e1a3056f..82f19e888c7f7 100644 --- a/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py +++ b/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py @@ -7,6 +7,11 @@ from RecoLocalTracker.SiPixelRecHits.PixelCPEESProducers_cff import * from RecoTracker.TransientTrackingRecHit.TTRHBuilders_cff import * +from RecoTracker.TkSeedGenerator.trackerClusterCheck_cff import trackerClusterCheck as _trackerClusterCheck +trackerClusterCheckPreSplitting = _trackerClusterCheck.clone( + PixelClusterCollectionLabel = 'siPixelClustersPreSplitting' +) + # SEEDING LAYERS import RecoTracker.TkSeedingLayers.PixelLayerTriplets_cfi import RecoPixelVertexing.PixelTriplets.quadrupletseedmerging_cff @@ -27,16 +32,11 @@ )) # seeding -from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer -initialStepClusterCheckPreSplitting = _clusterCheckerEDProducer.clone( - PixelClusterCollectionLabel = 'siPixelClustersPreSplitting' -) - from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer initialStepHitDoubletsPreSplitting = _hitPairEDProducer.clone( seedingLayers = "initialStepSeedLayersPreSplitting", trackingRegions = "initialStepTrackingRegionsPreSplitting", - clusterCheck = "initialStepClusterCheckPreSplitting", + clusterCheck = "trackerClusterCheckPreSplitting", produceIntermediateHitDoublets = True, ) from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer @@ -180,9 +180,9 @@ from RecoLocalTracker.SiPixelRecHits.SiPixelRecHits_cfi import siPixelRecHits from RecoTracker.MeasurementDet.MeasurementTrackerEventProducer_cfi import MeasurementTrackerEvent from RecoPixelVertexing.PixelLowPtUtilities.siPixelClusterShapeCache_cfi import * -InitialStepPreSplitting = cms.Sequence(initialStepSeedLayersPreSplitting* +InitialStepPreSplitting = cms.Sequence(trackerClusterCheckPreSplitting* + initialStepSeedLayersPreSplitting* initialStepTrackingRegionsPreSplitting* - initialStepClusterCheckPreSplitting* initialStepHitDoubletsPreSplitting* initialStepHitTripletsPreSplitting* initialStepSeedsPreSplitting* diff --git a/RecoTracker/IterativeTracking/python/InitialStep_cff.py b/RecoTracker/IterativeTracking/python/InitialStep_cff.py index 18dba62a34e49..9988d4d3f37a0 100644 --- a/RecoTracker/IterativeTracking/python/InitialStep_cff.py +++ b/RecoTracker/IterativeTracking/python/InitialStep_cff.py @@ -34,16 +34,10 @@ trackingPhase2PU140.toModify(initialStepTrackingRegions, RegionPSet = dict(ptMin = 0.8)) # seeding -from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer -initialStepClusterCheck = _clusterCheckerEDProducer.clone( - PixelClusterCollectionLabel = 'siPixelClusters' -) - from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer initialStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "initialStepSeedLayers", trackingRegions = "initialStepTrackingRegions", - clusterCheck = "initialStepClusterCheck", produceIntermediateHitDoublets = True, ) from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer @@ -332,7 +326,6 @@ # Final sequence InitialStep = cms.Sequence(initialStepSeedLayers* initialStepTrackingRegions* - initialStepClusterCheck* initialStepHitDoublets* initialStepHitTriplets* initialStepSeeds* diff --git a/RecoTracker/IterativeTracking/python/JetCoreRegionalStep_cff.py b/RecoTracker/IterativeTracking/python/JetCoreRegionalStep_cff.py index e262a0134a8ef..51df9ed840728 100644 --- a/RecoTracker/IterativeTracking/python/JetCoreRegionalStep_cff.py +++ b/RecoTracker/IterativeTracking/python/JetCoreRegionalStep_cff.py @@ -76,15 +76,10 @@ )) # Seeding -from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer -jetCoreRegionalStepClusterCheck = _clusterCheckerEDProducer.clone( - PixelClusterCollectionLabel = 'siPixelClusters' -) from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer jetCoreRegionalStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "jetCoreRegionalStepSeedLayers", trackingRegions = "jetCoreRegionalStepTrackingRegions", - clusterCheck = "jetCoreRegionalStepClusterCheck", maxElement = 1000000, produceSeedingHitSets = True, ) @@ -192,7 +187,6 @@ #jetCoreRegionalStepClusters* jetCoreRegionalStepSeedLayers* jetCoreRegionalStepTrackingRegions* - jetCoreRegionalStepClusterCheck* jetCoreRegionalStepHitDoublets* jetCoreRegionalStepSeeds* jetCoreRegionalStepTrackCandidates* diff --git a/RecoTracker/IterativeTracking/python/LowPtQuadStep_cff.py b/RecoTracker/IterativeTracking/python/LowPtQuadStep_cff.py index 549a43c26f11b..f5f4b4bb3e514 100644 --- a/RecoTracker/IterativeTracking/python/LowPtQuadStep_cff.py +++ b/RecoTracker/IterativeTracking/python/LowPtQuadStep_cff.py @@ -31,15 +31,10 @@ # seeding -from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer -lowPtQuadStepClusterCheck = _clusterCheckerEDProducer.clone( - PixelClusterCollectionLabel = 'siPixelClusters' -) from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer lowPtQuadStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "lowPtQuadStepSeedLayers", trackingRegions = "lowPtQuadStepTrackingRegions", - clusterCheck = "lowPtQuadStepClusterCheck", produceIntermediateHitDoublets = True, ) from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer @@ -294,7 +289,6 @@ LowPtQuadStep = cms.Sequence(lowPtQuadStepClusters* lowPtQuadStepSeedLayers* lowPtQuadStepTrackingRegions* - lowPtQuadStepClusterCheck* lowPtQuadStepHitDoublets* lowPtQuadStepHitTriplets* lowPtQuadStepHitQuadruplets* diff --git a/RecoTracker/IterativeTracking/python/LowPtTripletStep_cff.py b/RecoTracker/IterativeTracking/python/LowPtTripletStep_cff.py index 556ff6accc3d9..5e062a7c1cbca 100644 --- a/RecoTracker/IterativeTracking/python/LowPtTripletStep_cff.py +++ b/RecoTracker/IterativeTracking/python/LowPtTripletStep_cff.py @@ -58,15 +58,10 @@ trackingPhase2PU140.toModify(lowPtTripletStepTrackingRegions, RegionPSet = dict(ptMin = 0.45)) # seeding -from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer -lowPtTripletStepClusterCheck = _clusterCheckerEDProducer.clone( - PixelClusterCollectionLabel = 'siPixelClusters' -) from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer lowPtTripletStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "lowPtTripletStepSeedLayers", trackingRegions = "lowPtTripletStepTrackingRegions", - clusterCheck = "lowPtTripletStepClusterCheck", produceIntermediateHitDoublets = True, ) from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer @@ -337,7 +332,6 @@ LowPtTripletStep = cms.Sequence(lowPtTripletStepClusters* lowPtTripletStepSeedLayers* lowPtTripletStepTrackingRegions* - lowPtTripletStepClusterCheck* lowPtTripletStepHitDoublets* lowPtTripletStepHitTriplets* lowPtTripletStepSeeds* diff --git a/RecoTracker/IterativeTracking/python/MixedTripletStep_cff.py b/RecoTracker/IterativeTracking/python/MixedTripletStep_cff.py index 43c18dd808741..05da921ff8234 100644 --- a/RecoTracker/IterativeTracking/python/MixedTripletStep_cff.py +++ b/RecoTracker/IterativeTracking/python/MixedTripletStep_cff.py @@ -94,15 +94,10 @@ ComponentName = 'mixedTripletStepClusterShapeHitFilter', clusterChargeCut = dict(refToPSet_ = 'SiStripClusterChargeCutTight') ) -from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer -mixedTripletStepClusterCheck = _clusterCheckerEDProducer.clone( - PixelClusterCollectionLabel = 'siPixelClusters' -) from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer mixedTripletStepHitDoubletsA = _hitPairEDProducer.clone( seedingLayers = "mixedTripletStepSeedLayersA", trackingRegions = "mixedTripletStepTrackingRegionsA", - clusterCheck = "mixedTripletStepClusterCheck", produceIntermediateHitDoublets = True, ) from RecoPixelVertexing.PixelTriplets.pixelTripletLargeTipEDProducer_cfi import pixelTripletLargeTipEDProducer as _pixelTripletLargeTipEDProducer @@ -483,7 +478,6 @@ MixedTripletStep = cms.Sequence(chargeCut2069Clusters*mixedTripletStepClusters* mixedTripletStepSeedLayersA* mixedTripletStepTrackingRegionsA* - mixedTripletStepClusterCheck* mixedTripletStepHitDoubletsA* mixedTripletStepHitTripletsA* mixedTripletStepSeedsA* diff --git a/RecoTracker/IterativeTracking/python/PixelLessStep_cff.py b/RecoTracker/IterativeTracking/python/PixelLessStep_cff.py index f6f200570d5b6..0538814a30762 100644 --- a/RecoTracker/IterativeTracking/python/PixelLessStep_cff.py +++ b/RecoTracker/IterativeTracking/python/PixelLessStep_cff.py @@ -120,15 +120,10 @@ clusterChargeCut = dict(refToPSet_ = 'SiStripClusterChargeCutTight') ) -from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer -pixelLessStepClusterCheck = _clusterCheckerEDProducer.clone( - PixelClusterCollectionLabel = 'siPixelClusters' -) from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer pixelLessStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "pixelLessStepSeedLayers", trackingRegions = "pixelLessStepTrackingRegions", - clusterCheck = "pixelLessStepClusterCheck", produceIntermediateHitDoublets = True, ) from RecoTracker.TkSeedGenerator.multiHitFromChi2EDProducer_cfi import multiHitFromChi2EDProducer as _multiHitFromChi2EDProducer @@ -306,7 +301,6 @@ PixelLessStep = cms.Sequence(pixelLessStepClusters* pixelLessStepSeedLayers* pixelLessStepTrackingRegions* - pixelLessStepClusterCheck* pixelLessStepHitDoublets* pixelLessStepHitTriplets* pixelLessStepSeeds* diff --git a/RecoTracker/IterativeTracking/python/PixelPairStep_cff.py b/RecoTracker/IterativeTracking/python/PixelPairStep_cff.py index def14c4faff9c..7ca7de3e5c0e8 100644 --- a/RecoTracker/IterativeTracking/python/PixelPairStep_cff.py +++ b/RecoTracker/IterativeTracking/python/PixelPairStep_cff.py @@ -79,15 +79,10 @@ trackingPhase2PU140.toModify(pixelPairStepTrackingRegions, RegionPSet=dict(ptMin = 1.3, useMultipleScattering=False)) # SEEDS -from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer -pixelPairStepClusterCheck = _clusterCheckerEDProducer.clone( - PixelClusterCollectionLabel = 'siPixelClusters' -) from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer pixelPairStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "pixelPairStepSeedLayers", trackingRegions = "pixelPairStepTrackingRegions", - clusterCheck = "pixelPairStepClusterCheck", maxElement = 1000000, produceSeedingHitSets = True, ) @@ -330,7 +325,6 @@ PixelPairStep = cms.Sequence(pixelPairStepClusters* pixelPairStepSeedLayers* pixelPairStepTrackingRegions* - pixelPairStepClusterCheck* pixelPairStepHitDoublets* pixelPairStepSeeds* pixelPairStepTrackCandidates* diff --git a/RecoTracker/IterativeTracking/python/TobTecStep_cff.py b/RecoTracker/IterativeTracking/python/TobTecStep_cff.py index 1a21341d6b731..5c546a1fb38e7 100644 --- a/RecoTracker/IterativeTracking/python/TobTecStep_cff.py +++ b/RecoTracker/IterativeTracking/python/TobTecStep_cff.py @@ -54,15 +54,10 @@ clusterChargeCut = dict(refToPSet_ = 'SiStripClusterChargeCutTight') ) -from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer -tobTecStepClusterCheckTripl = _clusterCheckerEDProducer.clone( - PixelClusterCollectionLabel = 'siPixelClusters' -) from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer tobTecStepHitDoubletsTripl = _hitPairEDProducer.clone( seedingLayers = "tobTecStepSeedLayersTripl", trackingRegions = "tobTecStepTrackingRegionsTripl", - clusterCheck = "tobTecStepClusterCheckTripl", produceIntermediateHitDoublets = True, ) from RecoTracker.TkSeedGenerator.multiHitFromChi2EDProducer_cfi import multiHitFromChi2EDProducer as _multiHitFromChi2EDProducer @@ -125,15 +120,10 @@ )) # Pair seeds -from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cff import clusterCheckerEDProducer as _clusterCheckerEDProducer -tobTecStepClusterCheckPair = _clusterCheckerEDProducer.clone( - PixelClusterCollectionLabel = 'siPixelClusters' -) from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer tobTecStepHitDoubletsPair = _hitPairEDProducer.clone( seedingLayers = "tobTecStepSeedLayersPair", trackingRegions = "tobTecStepTrackingRegionsPair", - clusterCheck = "tobTecStepClusterCheckPair", maxElement = 1000000, produceSeedingHitSets = True, ) @@ -395,13 +385,11 @@ TobTecStep = cms.Sequence(tobTecStepClusters* tobTecStepSeedLayersTripl* tobTecStepTrackingRegionsTripl* - tobTecStepClusterCheckTripl* tobTecStepHitDoubletsTripl* tobTecStepHitTripletsTripl* tobTecStepSeedsTripl* tobTecStepSeedLayersPair* tobTecStepTrackingRegionsPair* - tobTecStepClusterCheckPair* tobTecStepHitDoubletsPair* tobTecStepSeedsPair* tobTecStepSeeds* @@ -514,7 +502,6 @@ tobTecStepClusters* tobTecStepSeedLayers* tobTecStepTrackingRegionsPair* - tobTecStepClusterCheckPair* tobTecStepHitDoubletsPair* tobTecStepSeeds* tobTecStepTrackCandidates* @@ -526,7 +513,6 @@ tobTecStepSeedClusters* tobTecStepSeedLayers* tobTecStepTrackingRegionsPair* - tobTecStepClusterCheckPair* tobTecStepHitDoubletsPair* tobTecStepSeeds* tobTecStepTrackCandidates* diff --git a/RecoTracker/IterativeTracking/python/iterativeTk_cff.py b/RecoTracker/IterativeTracking/python/iterativeTk_cff.py index 96bed179754aa..eee815bed1952 100644 --- a/RecoTracker/IterativeTracking/python/iterativeTk_cff.py +++ b/RecoTracker/IterativeTracking/python/iterativeTk_cff.py @@ -1,4 +1,5 @@ import FWCore.ParameterSet.Config as cms +from RecoTracker.TkSeedGenerator.trackerClusterCheck_cff import * from RecoTracker.IterativeTracking.InitialStepPreSplitting_cff import * from RecoTracker.IterativeTracking.InitialStep_cff import * @@ -28,6 +29,7 @@ _era.toReplaceWith(iterTrackingEarly, _cfg.createEarlySequence(_eraName, _postfix, globals())) iterTracking = cms.Sequence(InitialStepPreSplitting* + trackerClusterCheck* iterTrackingEarly* earlyGeneralTracks* muonSeededStep* diff --git a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc index c67fd71010c66..61e7b47d7d47a 100644 --- a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc +++ b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc @@ -64,7 +64,7 @@ void HitPairEDProducer::fillDescriptions(edm::ConfigurationDescriptions& descrip desc.add("seedingLayers", edm::InputTag("seedingLayersEDProducer")); desc.add("trackingRegions", edm::InputTag("globalTrackingRegionFromBeamSpot")); - desc.add("clusterCheck", edm::InputTag("clusterCheckerEDProducer")); + desc.add("clusterCheck", edm::InputTag("trackerClusterCheck")); desc.add("produceSeedingHitSets", false); desc.add("produceIntermediateHitDoublets", false); desc.add("maxElement", 0); // default is really 0? Also when used from CombinedHitTripletGenerator? diff --git a/RecoTracker/TkSeedGenerator/plugins/ClusterCheckerEDProducer.cc b/RecoTracker/TkSeedGenerator/plugins/ClusterCheckerEDProducer.cc index 94e2bd4c67cdf..697a7e34037c1 100644 --- a/RecoTracker/TkSeedGenerator/plugins/ClusterCheckerEDProducer.cc +++ b/RecoTracker/TkSeedGenerator/plugins/ClusterCheckerEDProducer.cc @@ -33,7 +33,7 @@ void ClusterCheckerEDProducer::fillDescriptions(edm::ConfigurationDescriptions& ClusterChecker::fillDescriptions(desc); desc.addUntracked("silentClusterCheck", false); - descriptions.add("clusterCheckerEDProducer", desc); + descriptions.add("trackerClusterCheck", desc); } void ClusterCheckerEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { diff --git a/RecoTracker/TkSeedGenerator/python/clusterCheckerEDProducer_cff.py b/RecoTracker/TkSeedGenerator/python/clusterCheckerEDProducer_cff.py deleted file mode 100644 index b6160b0d5370d..0000000000000 --- a/RecoTracker/TkSeedGenerator/python/clusterCheckerEDProducer_cff.py +++ /dev/null @@ -1,5 +0,0 @@ -from Configuration.StandardSequences.Eras import eras -from RecoTracker.TkSeedGenerator.clusterCheckerEDProducer_cfi import * -# Disable too many clusters check until we have an updated cut string for phase1 and phase2 -eras.phase1Pixel.toModify(clusterCheckerEDProducer, doClusterCheck=False) # FIXME -eras.phase2_tracker.toModify(clusterCheckerEDProducer, doClusterCheck=False) # FIXME diff --git a/RecoTracker/TkSeedGenerator/python/trackerClusterCheck_cff.py b/RecoTracker/TkSeedGenerator/python/trackerClusterCheck_cff.py new file mode 100644 index 0000000000000..e1427264f90ba --- /dev/null +++ b/RecoTracker/TkSeedGenerator/python/trackerClusterCheck_cff.py @@ -0,0 +1,6 @@ +from RecoTracker.TkSeedGenerator.trackerClusterCheck_cfi import * +from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel +from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker +# Disable too many clusters check until we have an updated cut string for phase1 and phase2 +phase1Pixel.toModify(trackerClusterCheck, doClusterCheck=False) # FIXME +phase2_tracker.toModify(trackerClusterCheck, doClusterCheck=False) # FIXME From c116a3f387a5b82dd8f959b0c82e220f00a188bc Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 25 Aug 2016 15:05:57 +0200 Subject: [PATCH 38/69] Improve the maxElements defaults --- .../python/pixelTripletHLTEDProducer_cff.py | 7 +++++++ .../python/pixelTripletLargeTipEDProducer_cff.py | 7 +++++++ .../src/HitTripletGeneratorFromPairAndLayers.cc | 2 +- .../IterativeTracking/python/DetachedQuadStep_cff.py | 10 +++++----- .../python/DetachedTripletStep_cff.py | 6 +++--- .../IterativeTracking/python/ElectronSeeds_cff.py | 1 + .../IterativeTracking/python/HighPtTripletStep_cff.py | 8 +++----- .../python/InitialStepPreSplitting_cff.py | 6 +++--- .../IterativeTracking/python/InitialStep_cff.py | 11 ++++------- .../python/JetCoreRegionalStep_cff.py | 3 +-- .../IterativeTracking/python/LowPtQuadStep_cff.py | 11 +++++------ .../IterativeTracking/python/LowPtTripletStep_cff.py | 8 +++----- .../IterativeTracking/python/MixedTripletStep_cff.py | 6 +++--- .../IterativeTracking/python/PixelLessStep_cff.py | 4 ++-- .../IterativeTracking/python/PixelPairStep_cff.py | 5 +---- .../IterativeTracking/python/TobTecStep_cff.py | 7 +++---- RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc | 2 +- .../TkHitPairs/python/hitPairEDProducer_cff.py | 5 +++++ .../src/MultiHitGeneratorFromPairAndLayers.cc | 2 +- 19 files changed, 59 insertions(+), 52 deletions(-) create mode 100644 RecoPixelVertexing/PixelTriplets/python/pixelTripletHLTEDProducer_cff.py create mode 100644 RecoPixelVertexing/PixelTriplets/python/pixelTripletLargeTipEDProducer_cff.py create mode 100644 RecoTracker/TkHitPairs/python/hitPairEDProducer_cff.py diff --git a/RecoPixelVertexing/PixelTriplets/python/pixelTripletHLTEDProducer_cff.py b/RecoPixelVertexing/PixelTriplets/python/pixelTripletHLTEDProducer_cff.py new file mode 100644 index 0000000000000..e60c79208e111 --- /dev/null +++ b/RecoPixelVertexing/PixelTriplets/python/pixelTripletHLTEDProducer_cff.py @@ -0,0 +1,7 @@ +from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import * +from Configuration.Eras.Modifier_trackingLowPU_cff import trackingLowPU +from Configuration.Eras.Modifier_trackingPhase1PU70_cff import trackingPhase1PU70 +from Configuration.Eras.Modifier_trackingPhase2PU140_cff import trackingPhase2PU140 +trackingLowPU.toModify(pixelTripletHLTEDProducer, maxElement=100000) +trackingPhase1PU70.toModify(pixelTripletHLTEDProducer, maxElement=0) +trackingPhase2PU140.toModify(pixelTripletHLTEDProducer, maxElement=0) diff --git a/RecoPixelVertexing/PixelTriplets/python/pixelTripletLargeTipEDProducer_cff.py b/RecoPixelVertexing/PixelTriplets/python/pixelTripletLargeTipEDProducer_cff.py new file mode 100644 index 0000000000000..af912f7ec14b9 --- /dev/null +++ b/RecoPixelVertexing/PixelTriplets/python/pixelTripletLargeTipEDProducer_cff.py @@ -0,0 +1,7 @@ +from RecoPixelVertexing.PixelTriplets.pixelTripletLargeTipEDProducer_cfi import * +from Configuration.Eras.Modifier_trackingLowPU_cff import trackingLowPU +from Configuration.Eras.Modifier_trackingPhase1PU70_cff import trackingPhase1PU70 +from Configuration.Eras.Modifier_trackingPhase2PU140_cff import trackingPhase2PU140 +trackingLowPU.toModify(pixelTripletLargeTipEDProducer, maxElement=100000) +trackingPhase1PU70.toModify(pixelTripletLargeTipEDProducer, maxElement=0) +trackingPhase2PU140.toModify(pixelTripletLargeTipEDProducer, maxElement=0) diff --git a/RecoPixelVertexing/PixelTriplets/src/HitTripletGeneratorFromPairAndLayers.cc b/RecoPixelVertexing/PixelTriplets/src/HitTripletGeneratorFromPairAndLayers.cc index 2b31ace679667..364c3409e0340 100644 --- a/RecoPixelVertexing/PixelTriplets/src/HitTripletGeneratorFromPairAndLayers.cc +++ b/RecoPixelVertexing/PixelTriplets/src/HitTripletGeneratorFromPairAndLayers.cc @@ -15,7 +15,7 @@ HitTripletGeneratorFromPairAndLayers::HitTripletGeneratorFromPairAndLayers(const HitTripletGeneratorFromPairAndLayers::~HitTripletGeneratorFromPairAndLayers() {} void HitTripletGeneratorFromPairAndLayers::fillDescriptions(edm::ParameterSetDescription& desc) { - desc.add("maxElement", 100000); + desc.add("maxElement", 1000000); } void HitTripletGeneratorFromPairAndLayers::init(std::unique_ptr&& pairGenerator, LayerCacheType *layerCache) { diff --git a/RecoTracker/IterativeTracking/python/DetachedQuadStep_cff.py b/RecoTracker/IterativeTracking/python/DetachedQuadStep_cff.py index b53314ccf1929..371b30591378c 100644 --- a/RecoTracker/IterativeTracking/python/DetachedQuadStep_cff.py +++ b/RecoTracker/IterativeTracking/python/DetachedQuadStep_cff.py @@ -47,17 +47,17 @@ ))) # seeding -from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer detachedQuadStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "detachedQuadStepSeedLayers", trackingRegions = "detachedQuadStepTrackingRegions", + maxElement = 0, produceIntermediateHitDoublets = True, ) -from RecoPixelVertexing.PixelTriplets.pixelTripletLargeTipEDProducer_cfi import pixelTripletLargeTipEDProducer as _pixelTripletLargeTipEDProducer +from RecoPixelVertexing.PixelTriplets.pixelTripletLargeTipEDProducer_cff import pixelTripletLargeTipEDProducer as _pixelTripletLargeTipEDProducer from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * detachedQuadStepHitTriplets = _pixelTripletLargeTipEDProducer.clone( doublets = "detachedQuadStepHitDoublets", - maxElement = 1000000, produceIntermediateHitTriplets = True, ) from RecoPixelVertexing.PixelTriplets.pixelQuadrupletEDProducer_cfi import pixelQuadrupletEDProducer as _pixelQuadrupletEDProducer @@ -110,10 +110,10 @@ ) _detachedQuadStepHitQuadrupletsMerging.SeedComparitorPSet = detachedQuadStepSeeds.SeedComparitorPSet -trackingPhase1PU70.toModify(detachedQuadStepHitTriplets, maxElement=0, produceIntermediateHitTriplets=False, produceSeedingHitSets=True) +trackingPhase1PU70.toModify(detachedQuadStepHitTriplets, produceIntermediateHitTriplets=False, produceSeedingHitSets=True) trackingPhase1PU70.toReplaceWith(detachedQuadStepHitQuadruplets, _detachedQuadStepHitQuadrupletsMerging) trackingPhase1PU70.toModify(detachedQuadStepSeeds, SeedComparitorPSet=cms.PSet(ComponentName=cms.string("none"))) -trackingPhase2PU140.toModify(detachedQuadStepHitTriplets, maxElement=0, produceIntermediateHitTriplets=False, produceSeedingHitSets=True) +trackingPhase2PU140.toModify(detachedQuadStepHitTriplets, produceIntermediateHitTriplets=False, produceSeedingHitSets=True) trackingPhase2PU140.toReplaceWith(detachedQuadStepHitQuadruplets, _detachedQuadStepHitQuadrupletsMerging) trackingPhase2PU140.toModify(detachedQuadStepSeeds, SeedComparitorPSet=cms.PSet(ComponentName=cms.string("none"))) diff --git a/RecoTracker/IterativeTracking/python/DetachedTripletStep_cff.py b/RecoTracker/IterativeTracking/python/DetachedTripletStep_cff.py index f1c0c05a00a84..39708668d2cb9 100644 --- a/RecoTracker/IterativeTracking/python/DetachedTripletStep_cff.py +++ b/RecoTracker/IterativeTracking/python/DetachedTripletStep_cff.py @@ -44,17 +44,17 @@ )) # seeding -from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer detachedTripletStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "detachedTripletStepSeedLayers", trackingRegions = "detachedTripletStepTrackingRegions", + maxElement = 0, produceIntermediateHitDoublets = True, ) -from RecoPixelVertexing.PixelTriplets.pixelTripletLargeTipEDProducer_cfi import pixelTripletLargeTipEDProducer as _pixelTripletLargeTipEDProducer +from RecoPixelVertexing.PixelTriplets.pixelTripletLargeTipEDProducer_cff import pixelTripletLargeTipEDProducer as _pixelTripletLargeTipEDProducer from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * detachedTripletStepHitTriplets = _pixelTripletLargeTipEDProducer.clone( doublets = "detachedTripletStepHitDoublets", - maxElement = 1000000, produceSeedingHitSets = True, ) from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer_cff import seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer as _seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer diff --git a/RecoTracker/IterativeTracking/python/ElectronSeeds_cff.py b/RecoTracker/IterativeTracking/python/ElectronSeeds_cff.py index e9d44d1734912..3ca4aae0a81eb 100644 --- a/RecoTracker/IterativeTracking/python/ElectronSeeds_cff.py +++ b/RecoTracker/IterativeTracking/python/ElectronSeeds_cff.py @@ -105,6 +105,7 @@ tripletElectronHitDoublets = _hitPairEDProducer.clone( seedingLayers = "tripletElectronSeedLayers", trackingRegions = "tripletElectronTrackingRegions", + maxElement = 0, produceIntermediateHitDoublets = True, ) from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer diff --git a/RecoTracker/IterativeTracking/python/HighPtTripletStep_cff.py b/RecoTracker/IterativeTracking/python/HighPtTripletStep_cff.py index 0f88d96ea0c6f..930f0c491fb6e 100644 --- a/RecoTracker/IterativeTracking/python/HighPtTripletStep_cff.py +++ b/RecoTracker/IterativeTracking/python/HighPtTripletStep_cff.py @@ -63,18 +63,18 @@ trackingPhase2PU140.toModify(highPtTripletStepTrackingRegions, RegionPSet = dict(ptMin = 0.9, originRadius = 0.03)) # seeding -from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer highPtTripletStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "highPtTripletStepSeedLayers", trackingRegions = "highPtTripletStepTrackingRegions", + maxElement = 0, produceIntermediateHitDoublets = True, ) -from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer +from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cff import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * import RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi highPtTripletStepHitTriplets = _pixelTripletHLTEDProducer.clone( doublets = "highPtTripletStepHitDoublets", - maxElement = 1000000, produceSeedingHitSets = True, SeedComparitorPSet = RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi.LowPtClusterShapeSeedComparitor ) @@ -82,8 +82,6 @@ highPtTripletStepSeeds = _seedCreatorFromRegionConsecutiveHitsEDProducer.clone( seedingHitSets = "highPtTripletStepHitTriplets", ) -trackingPhase1PU70.toModify(highPtTripletStepHitTriplets, maxElement=0) -trackingPhase2PU140.toModify(highPtTripletStepHitTriplets, maxElement=0) # QUALITY CUTS DURING TRACK BUILDING import TrackingTools.TrajectoryFiltering.TrajectoryFilter_cff as _TrajectoryFilter_cff diff --git a/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py b/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py index 82f19e888c7f7..7dcd120fbb643 100644 --- a/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py +++ b/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py @@ -32,19 +32,19 @@ )) # seeding -from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer initialStepHitDoubletsPreSplitting = _hitPairEDProducer.clone( seedingLayers = "initialStepSeedLayersPreSplitting", trackingRegions = "initialStepTrackingRegionsPreSplitting", clusterCheck = "trackerClusterCheckPreSplitting", + maxElement = 0, produceIntermediateHitDoublets = True, ) -from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer +from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cff import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * import RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi initialStepHitTripletsPreSplitting = _pixelTripletHLTEDProducer.clone( doublets = "initialStepHitDoubletsPreSplitting", - maxElement = 1000000, produceSeedingHitSets = True, SeedComparitorPSet = RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi.LowPtClusterShapeSeedComparitor.clone( clusterShapeCacheSrc = 'siPixelClusterShapeCachePreSplitting' diff --git a/RecoTracker/IterativeTracking/python/InitialStep_cff.py b/RecoTracker/IterativeTracking/python/InitialStep_cff.py index 9988d4d3f37a0..615fa7f8e8461 100644 --- a/RecoTracker/IterativeTracking/python/InitialStep_cff.py +++ b/RecoTracker/IterativeTracking/python/InitialStep_cff.py @@ -34,18 +34,18 @@ trackingPhase2PU140.toModify(initialStepTrackingRegions, RegionPSet = dict(ptMin = 0.8)) # seeding -from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer initialStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "initialStepSeedLayers", trackingRegions = "initialStepTrackingRegions", + maxElement = 0, produceIntermediateHitDoublets = True, ) -from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer +from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cff import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * import RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi initialStepHitTriplets = _pixelTripletHLTEDProducer.clone( doublets = "initialStepHitDoublets", - maxElement = 1000000, produceSeedingHitSets = True, SeedComparitorPSet = RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi.LowPtClusterShapeSeedComparitor ) @@ -73,11 +73,7 @@ ) initialStepHitQuadruplets.SeedComparitorPSet = initialStepSeeds.SeedComparitorPSet -from Configuration.Eras.Modifier_trackingLowPU_cff import trackingLowPU -trackingLowPU.toModify(initialStepHitTriplets, maxElement=100000) -trackingPhase1PU70.toModify(initialStepHitTriplets, maxElement=0, produceSeedingHitSets=False, produceIntermediateHitTriplets=True) trackingPhase1PU70.toModify(initialStepSeeds, seedingHitSets="initialStepHitQuadruplets") -trackingPhase2PU140.toModify(initialStepHitTriplets, maxElement=0, produceSeedingHitSets=False, produceIntermediateHitTriplets=True) trackingPhase2PU140.toModify(initialStepSeeds, seedingHitSets="initialStepHitQuadruplets") @@ -99,6 +95,7 @@ strictSeedExtension = True, # don't allow inactive pixelSeedExtension = True, ) +from Configuration.Eras.Modifier_trackingLowPU_cff import trackingLowPU trackingLowPU.toReplaceWith(initialStepTrajectoryFilterBase, _initialStepTrajectoryFilterBase) trackingPhase1PU70.toReplaceWith(initialStepTrajectoryFilterBase, _initialStepTrajectoryFilterBase) diff --git a/RecoTracker/IterativeTracking/python/JetCoreRegionalStep_cff.py b/RecoTracker/IterativeTracking/python/JetCoreRegionalStep_cff.py index 51df9ed840728..55998f72ff22f 100644 --- a/RecoTracker/IterativeTracking/python/JetCoreRegionalStep_cff.py +++ b/RecoTracker/IterativeTracking/python/JetCoreRegionalStep_cff.py @@ -76,11 +76,10 @@ )) # Seeding -from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer jetCoreRegionalStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "jetCoreRegionalStepSeedLayers", trackingRegions = "jetCoreRegionalStepTrackingRegions", - maxElement = 1000000, produceSeedingHitSets = True, ) from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsEDProducer_cff import seedCreatorFromRegionConsecutiveHitsEDProducer as _seedCreatorFromRegionConsecutiveHitsEDProducer diff --git a/RecoTracker/IterativeTracking/python/LowPtQuadStep_cff.py b/RecoTracker/IterativeTracking/python/LowPtQuadStep_cff.py index f5f4b4bb3e514..ced75d2d55304 100644 --- a/RecoTracker/IterativeTracking/python/LowPtQuadStep_cff.py +++ b/RecoTracker/IterativeTracking/python/LowPtQuadStep_cff.py @@ -31,18 +31,18 @@ # seeding -from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer lowPtQuadStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "lowPtQuadStepSeedLayers", trackingRegions = "lowPtQuadStepTrackingRegions", + maxElement = 0, produceIntermediateHitDoublets = True, ) -from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer +from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cff import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * import RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi lowPtQuadStepHitTriplets = _pixelTripletHLTEDProducer.clone( doublets = "lowPtQuadStepHitDoublets", - maxElement = 1000000, produceIntermediateHitTriplets = True, SeedComparitorPSet = RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi.LowPtClusterShapeSeedComparitor ) @@ -90,10 +90,9 @@ ) _lowPtQuadStepHitQuadrupletsMerging.SeedComparitorPSet = lowPtQuadStepSeeds.SeedComparitorPSet -from Configuration.Eras.Modifier_trackingPhase1PU70_cff import trackingPhase1PU70 -trackingPhase1PU70.toModify(lowPtQuadStepHitTriplets, maxElement=0, produceIntermediateHitTriplets=False, produceSeedingHitSets=True) +trackingPhase1PU70.toModify(lowPtQuadStepHitTriplets, produceIntermediateHitTriplets=False, produceSeedingHitSets=True) trackingPhase1PU70.toReplaceWith(lowPtQuadStepHitQuadruplets, _lowPtQuadStepHitQuadrupletsMerging) -trackingPhase2PU140.toModify(lowPtQuadStepHitTriplets, maxElement=0, produceIntermediateHitTriplets=False, produceSeedingHitSets=True) +trackingPhase2PU140.toModify(lowPtQuadStepHitTriplets, produceIntermediateHitTriplets=False, produceSeedingHitSets=True) trackingPhase2PU140.toReplaceWith(lowPtQuadStepHitQuadruplets, _lowPtQuadStepHitQuadrupletsMerging) diff --git a/RecoTracker/IterativeTracking/python/LowPtTripletStep_cff.py b/RecoTracker/IterativeTracking/python/LowPtTripletStep_cff.py index 5e062a7c1cbca..9b9eb0fdd89af 100644 --- a/RecoTracker/IterativeTracking/python/LowPtTripletStep_cff.py +++ b/RecoTracker/IterativeTracking/python/LowPtTripletStep_cff.py @@ -58,18 +58,18 @@ trackingPhase2PU140.toModify(lowPtTripletStepTrackingRegions, RegionPSet = dict(ptMin = 0.45)) # seeding -from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer lowPtTripletStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "lowPtTripletStepSeedLayers", trackingRegions = "lowPtTripletStepTrackingRegions", + maxElement = 0, produceIntermediateHitDoublets = True, ) -from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer +from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cff import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * import RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi lowPtTripletStepHitTriplets = _pixelTripletHLTEDProducer.clone( doublets = "lowPtTripletStepHitDoublets", - maxElement = 1000000, produceSeedingHitSets = True, SeedComparitorPSet = RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi.LowPtClusterShapeSeedComparitor ) @@ -77,8 +77,6 @@ lowPtTripletStepSeeds = _seedCreatorFromRegionConsecutiveHitsEDProducer.clone( seedingHitSets = "lowPtTripletStepHitTriplets", ) -trackingPhase1PU70.toModify(lowPtTripletStepHitTriplets, maxElement=0) -trackingPhase2PU140.toModify(lowPtTripletStepHitTriplets, maxElement=0) # QUALITY CUTS DURING TRACK BUILDING diff --git a/RecoTracker/IterativeTracking/python/MixedTripletStep_cff.py b/RecoTracker/IterativeTracking/python/MixedTripletStep_cff.py index 05da921ff8234..97a367932e3b5 100644 --- a/RecoTracker/IterativeTracking/python/MixedTripletStep_cff.py +++ b/RecoTracker/IterativeTracking/python/MixedTripletStep_cff.py @@ -94,17 +94,17 @@ ComponentName = 'mixedTripletStepClusterShapeHitFilter', clusterChargeCut = dict(refToPSet_ = 'SiStripClusterChargeCutTight') ) -from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer mixedTripletStepHitDoubletsA = _hitPairEDProducer.clone( seedingLayers = "mixedTripletStepSeedLayersA", trackingRegions = "mixedTripletStepTrackingRegionsA", + maxElement = 0, produceIntermediateHitDoublets = True, ) -from RecoPixelVertexing.PixelTriplets.pixelTripletLargeTipEDProducer_cfi import pixelTripletLargeTipEDProducer as _pixelTripletLargeTipEDProducer +from RecoPixelVertexing.PixelTriplets.pixelTripletLargeTipEDProducer_cff import pixelTripletLargeTipEDProducer as _pixelTripletLargeTipEDProducer from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * mixedTripletStepHitTripletsA = _pixelTripletLargeTipEDProducer.clone( doublets = "mixedTripletStepHitDoubletsA", - maxElement = 1000000, produceSeedingHitSets = True, ) from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer_cff import seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer as _seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer diff --git a/RecoTracker/IterativeTracking/python/PixelLessStep_cff.py b/RecoTracker/IterativeTracking/python/PixelLessStep_cff.py index 0538814a30762..4e583baecc80c 100644 --- a/RecoTracker/IterativeTracking/python/PixelLessStep_cff.py +++ b/RecoTracker/IterativeTracking/python/PixelLessStep_cff.py @@ -120,16 +120,16 @@ clusterChargeCut = dict(refToPSet_ = 'SiStripClusterChargeCutTight') ) -from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer pixelLessStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "pixelLessStepSeedLayers", trackingRegions = "pixelLessStepTrackingRegions", + maxElement = 0, produceIntermediateHitDoublets = True, ) from RecoTracker.TkSeedGenerator.multiHitFromChi2EDProducer_cfi import multiHitFromChi2EDProducer as _multiHitFromChi2EDProducer pixelLessStepHitTriplets = _multiHitFromChi2EDProducer.clone( doublets = "pixelLessStepHitDoublets", - maxElement = 1000000, ) from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer_cff import seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer as _seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer from RecoPixelVertexing.PixelLowPtUtilities.StripSubClusterShapeSeedFilter_cfi import StripSubClusterShapeSeedFilter as _StripSubClusterShapeSeedFilter diff --git a/RecoTracker/IterativeTracking/python/PixelPairStep_cff.py b/RecoTracker/IterativeTracking/python/PixelPairStep_cff.py index 7ca7de3e5c0e8..65fd42814831e 100644 --- a/RecoTracker/IterativeTracking/python/PixelPairStep_cff.py +++ b/RecoTracker/IterativeTracking/python/PixelPairStep_cff.py @@ -79,11 +79,10 @@ trackingPhase2PU140.toModify(pixelPairStepTrackingRegions, RegionPSet=dict(ptMin = 1.3, useMultipleScattering=False)) # SEEDS -from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer pixelPairStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "pixelPairStepSeedLayers", trackingRegions = "pixelPairStepTrackingRegions", - maxElement = 1000000, produceSeedingHitSets = True, ) from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsEDProducer_cff import seedCreatorFromRegionConsecutiveHitsEDProducer as _seedCreatorFromRegionConsecutiveHitsEDProducer @@ -98,8 +97,6 @@ ClusterShapeCacheSrc = cms.InputTag('siPixelClusterShapeCache'), ) ) -trackingPhase1PU70.toModify(pixelPairStepHitDoublets, maxElement=0) -trackingPhase2PU140.toModify(pixelPairStepHitDoublets, maxElement=0) # QUALITY CUTS DURING TRACK BUILDING import TrackingTools.TrajectoryFiltering.TrajectoryFilter_cff diff --git a/RecoTracker/IterativeTracking/python/TobTecStep_cff.py b/RecoTracker/IterativeTracking/python/TobTecStep_cff.py index 5c546a1fb38e7..dbab29ad2cad0 100644 --- a/RecoTracker/IterativeTracking/python/TobTecStep_cff.py +++ b/RecoTracker/IterativeTracking/python/TobTecStep_cff.py @@ -54,16 +54,16 @@ clusterChargeCut = dict(refToPSet_ = 'SiStripClusterChargeCutTight') ) -from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer tobTecStepHitDoubletsTripl = _hitPairEDProducer.clone( seedingLayers = "tobTecStepSeedLayersTripl", trackingRegions = "tobTecStepTrackingRegionsTripl", + maxElement = 0, produceIntermediateHitDoublets = True, ) from RecoTracker.TkSeedGenerator.multiHitFromChi2EDProducer_cfi import multiHitFromChi2EDProducer as _multiHitFromChi2EDProducer tobTecStepHitTripletsTripl = _multiHitFromChi2EDProducer.clone( doublets = "tobTecStepHitDoubletsTripl", - maxElement = 1000000, extraPhiKDBox = 0.01, ) from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsEDProducer_cff import seedCreatorFromRegionConsecutiveHitsEDProducer as _seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer @@ -120,11 +120,10 @@ )) # Pair seeds -from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer tobTecStepHitDoubletsPair = _hitPairEDProducer.clone( seedingLayers = "tobTecStepSeedLayersPair", trackingRegions = "tobTecStepTrackingRegionsPair", - maxElement = 1000000, produceSeedingHitSets = True, ) from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsEDProducer_cff import seedCreatorFromRegionConsecutiveHitsEDProducer as _seedCreatorFromRegionConsecutiveHitsEDProducer diff --git a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc index 61e7b47d7d47a..7b7609c1cecf5 100644 --- a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc +++ b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc @@ -67,7 +67,7 @@ void HitPairEDProducer::fillDescriptions(edm::ConfigurationDescriptions& descrip desc.add("clusterCheck", edm::InputTag("trackerClusterCheck")); desc.add("produceSeedingHitSets", false); desc.add("produceIntermediateHitDoublets", false); - desc.add("maxElement", 0); // default is really 0? Also when used from CombinedHitTripletGenerator? + desc.add("maxElement", 1000000); descriptions.add("hitPairEDProducer", desc); } diff --git a/RecoTracker/TkHitPairs/python/hitPairEDProducer_cff.py b/RecoTracker/TkHitPairs/python/hitPairEDProducer_cff.py new file mode 100644 index 0000000000000..911a0aec2ae19 --- /dev/null +++ b/RecoTracker/TkHitPairs/python/hitPairEDProducer_cff.py @@ -0,0 +1,5 @@ +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import * +from Configuration.Eras.Modifier_trackingPhase1PU70_cff import trackingPhase1PU70 +from Configuration.Eras.Modifier_trackingPhase2PU140_cff import trackingPhase2PU140 +trackingPhase1PU70.toModify(hitPairEDProducer, maxElement=0) +trackingPhase2PU140.toModify(hitPairEDProducer, maxElement=0) diff --git a/RecoTracker/TkSeedGenerator/src/MultiHitGeneratorFromPairAndLayers.cc b/RecoTracker/TkSeedGenerator/src/MultiHitGeneratorFromPairAndLayers.cc index 7ee917ae14ab6..83d514cfe7281 100644 --- a/RecoTracker/TkSeedGenerator/src/MultiHitGeneratorFromPairAndLayers.cc +++ b/RecoTracker/TkSeedGenerator/src/MultiHitGeneratorFromPairAndLayers.cc @@ -11,7 +11,7 @@ MultiHitGeneratorFromPairAndLayers::MultiHitGeneratorFromPairAndLayers(const edm MultiHitGeneratorFromPairAndLayers::~MultiHitGeneratorFromPairAndLayers() {} void MultiHitGeneratorFromPairAndLayers::fillDescriptions(edm::ParameterSetDescription& desc) { - desc.add("maxElement", 100000); + desc.add("maxElement", 1000000); } void MultiHitGeneratorFromPairAndLayers::init(std::unique_ptr&& pairGenerator, LayerCacheType *layerCache) { From 36b8273ea0298da1d27a8ac39130e9b61f417582 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 26 Aug 2016 16:33:51 +0200 Subject: [PATCH 39/69] Use filler pattern also for IntermediateHitDoublets and IntermediateHitTriplets To enforce proper order of actions when filling them. --- .../interface/HitTripletEDProducerT.h | 7 +- .../interface/IntermediateHitTriplets.h | 99 +++++++++++-------- .../interface/IntermediateHitDoublets.h | 30 ++++-- .../TkHitPairs/plugins/HitPairEDProducer.cc | 5 +- 4 files changed, 89 insertions(+), 52 deletions(-) diff --git a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h index 22a714f7d2a90..c29d5fc211fe7 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h +++ b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h @@ -114,11 +114,12 @@ void HitTripletEDProducerT::produce(edm::Event& iEvent, c const TrackingRegion& region = regionLayerPairs.region(); auto seedingHitSetsFiller = RegionsSeedingHitSets::dummyFiller(); + auto intermediateHitTripletsFiller = IntermediateHitTriplets::dummyFiller(); if(produceSeedingHitSets_) { seedingHitSetsFiller = seedingHitSets->beginRegion(®ion); } if(produceIntermediateHitTriplets_) { - intermediateHitTriplets->beginRegion(®ion); + intermediateHitTripletsFiller = intermediateHitTriplets->beginRegion(®ion); } LogTrace("HitTripletEDProducer") << " starting region"; @@ -147,7 +148,7 @@ void HitTripletEDProducerT::produce(edm::Event& iEvent, c hitCache.extend(layerPair.cache()); LayerHitMapCache *hitCachePtr = &hitCache; if(produceIntermediateHitTriplets_) { - hitCachePtr = intermediateHitTriplets->beginPair(layerPair.layerPair(), std::move(hitCache)); + hitCachePtr = intermediateHitTripletsFiller.beginPair(layerPair.layerPair(), std::move(hitCache)); } tripletLastLayerIndex.clear(); @@ -178,7 +179,7 @@ void HitTripletEDProducerT::produce(edm::Event& iEvent, c }); // empty triplets need to propagate here - intermediateHitTriplets->addTriplets(thirdLayers, triplets, tripletLastLayerIndex, tripletPermutation); + intermediateHitTripletsFiller.addTriplets(thirdLayers, triplets, tripletLastLayerIndex, tripletPermutation); } triplets.clear(); diff --git a/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h b/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h index eae345ffa9d1d..fa1188d681f34 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h +++ b/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h @@ -207,6 +207,62 @@ class IntermediateHitTriplets { //////////////////// + // helper class to enforce correct usage + class RegionFiller { + public: + RegionFiller(): obj_(nullptr) {} + explicit RegionFiller(IntermediateHitTriplets *obj): obj_(obj) {} + + ~RegionFiller() = default; + + bool valid() const { return obj_ != nullptr; } + + LayerHitMapCache *beginPair(const LayerPair& layerPair, LayerHitMapCache&& cache) { + obj_->layerPairAndLayers_.emplace_back(layerPair, obj_->thirdLayers_.size(), std::move(cache)); + return &(obj_->layerPairAndLayers_.back().cache()); + }; + + void addTriplets(const std::vector& thirdLayers, + const OrderedHitTriplets& triplets, + const std::vector& thirdLayerIndex, + const std::vector& permutations) { + assert(triplets.size() == thirdLayerIndex.size()); + assert(triplets.size() == permutations.size()); + + if(triplets.empty()) { + // In absence of triplets for a layer pair simplest is just + // remove the pair + obj_->popPair(); + return; + } + + int prevLayer = -1; + for(size_t i=0, size=permutations.size(); ithirdLayers_.emplace_back(thirdLayers[layer], obj_->hitTriplets_.size()); + obj_->layerPairAndLayers_.back().setThirdLayersEnd(obj_->thirdLayers_.size()); + } + + obj_->hitTriplets_.emplace_back(triplets[realIndex]); + obj_->thirdLayers_.back().setHitsEnd(obj_->hitTriplets_.size()); + } + + obj_->regions_.back().setLayerSetsEnd(obj_->layerPairAndLayers_.size()); + } + private: + IntermediateHitTriplets *obj_; + }; + + static RegionFiller dummyFiller() { return RegionFiller(); } + //////////////////// + IntermediateHitTriplets(): seedingLayers_(nullptr) {} explicit IntermediateHitTriplets(const SeedingLayerSetsHits *seedingLayers): seedingLayers_(seedingLayers) {} IntermediateHitTriplets(const IntermediateHitTriplets& rh); // only to make ROOT dictionary generation happy @@ -234,48 +290,9 @@ class IntermediateHitTriplets { hitTriplets_.shrink_to_fit(); } - void beginRegion(const TrackingRegion *region) { + RegionFiller beginRegion(const TrackingRegion *region) { regions_.emplace_back(region, layerPairAndLayers_.size()); - } - - LayerHitMapCache *beginPair(const LayerPair& layerPair, LayerHitMapCache&& cache) { - layerPairAndLayers_.emplace_back(layerPair, thirdLayers_.size(), std::move(cache)); - return &(layerPairAndLayers_.back().cache()); - }; - - void addTriplets(const std::vector& thirdLayers, - const OrderedHitTriplets& triplets, - const std::vector& thirdLayerIndex, - const std::vector& permutations) { - assert(triplets.size() == thirdLayerIndex.size()); - assert(triplets.size() == permutations.size()); - - if(triplets.empty()) { - // In absence of triplets for a layer pair simplest is just - // remove the pair - popPair(); - return; - } - - int prevLayer = -1; - for(size_t i=0, size=permutations.size(); ilayerPairs_.emplace_back(layerSet, std::move(doublets), std::move(cache)); + obj_->regions_.back().setLayerSetsEnd(obj_->layerPairs_.size()); + } + private: + IntermediateHitDoublets *obj_; + }; + + static RegionFiller dummyFiller() { return RegionFiller(); } + + //////////////////// + IntermediateHitDoublets(): seedingLayers_(nullptr) {} explicit IntermediateHitDoublets(const SeedingLayerSetsHits *seedingLayers): seedingLayers_(seedingLayers) {} IntermediateHitDoublets(const IntermediateHitDoublets& rh); // only to make ROOT dictionary generation happy @@ -141,13 +163,9 @@ class IntermediateHitDoublets { layerPairs_.shrink_to_fit(); } - void beginRegion(const TrackingRegion *region) { + RegionFiller beginRegion(const TrackingRegion *region) { regions_.emplace_back(region, layerPairs_.size()); - } - - void addDoublets(const SeedingLayerSetsHits::SeedingLayerSet& layerSet, HitDoublets&& doublets, LayerHitMapCache&& cache) { - layerPairs_.emplace_back(layerSet, std::move(doublets), std::move(cache)); - regions_.back().setLayerSetsEnd(layerPairs_.size()); + return RegionFiller(this); } const SeedingLayerSetsHits& seedingLayerHits() const { return *seedingLayers_; } diff --git a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc index 7b7609c1cecf5..10c6e1186969b 100644 --- a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc +++ b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc @@ -130,11 +130,12 @@ void HitPairEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetu for(const TrackingRegion& region: regions) { auto seedingHitSetsFiller = RegionsSeedingHitSets::dummyFiller(); + auto intermediateHitDoubletsFiller = IntermediateHitDoublets::dummyFiller(); if(produceSeedingHitSets_) { seedingHitSetsFiller = seedingHitSets->beginRegion(®ion); } if(produceIntermediateHitDoublets_) { - intermediateHitDoublets->beginRegion(®ion); + intermediateHitDoubletsFiller = intermediateHitDoublets->beginRegion(®ion); } for(SeedingLayerSetsHits::SeedingLayerSet layerSet: layerPairs) { @@ -149,7 +150,7 @@ void HitPairEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetu } } if(produceIntermediateHitDoublets_) { - intermediateHitDoublets->addDoublets(layerSet, std::move(doublets), std::move(hitCache)); + intermediateHitDoubletsFiller.addDoublets(layerSet, std::move(doublets), std::move(hitCache)); } } } From 15caa084654784006b4cb85c01c839b1cc06b313 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 1 Sep 2016 09:35:11 +0200 Subject: [PATCH 40/69] Fix (optimize) the use of LayerHitMapCache Use only one cache per region. Actually this was the original behaviour. --- .../interface/HitTripletEDProducerT.h | 13 +++++++--- .../interface/IntermediateHitTriplets.h | 26 +++++++++---------- .../plugins/PixelQuadrupletEDProducer.cc | 6 ++--- .../interface/IntermediateHitDoublets.h | 25 +++++++++++------- .../TkHitPairs/plugins/HitPairEDProducer.cc | 12 ++++++--- .../plugins/MultiHitFromChi2EDProducer.cc | 10 +++---- 6 files changed, 55 insertions(+), 37 deletions(-) diff --git a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h index c29d5fc211fe7..69a382ec87175 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h +++ b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h @@ -110,17 +110,25 @@ void HitTripletEDProducerT::produce(edm::Event& iEvent, c LogDebug("HitTripletEDProducer") << "Creating triplets for " << regionDoublets.regionSize() << " regions, and " << trilayers.size() << " pair+3rd layers from " << regionDoublets.layerPairsSize() << " layer pairs"; + LayerHitMapCache hitCacheTmp; // used if !produceIntermediateHitTriplets_ for(const auto& regionLayerPairs: regionDoublets) { const TrackingRegion& region = regionLayerPairs.region(); auto seedingHitSetsFiller = RegionsSeedingHitSets::dummyFiller(); auto intermediateHitTripletsFiller = IntermediateHitTriplets::dummyFiller(); + auto hitCachePtr = &hitCacheTmp; if(produceSeedingHitSets_) { seedingHitSetsFiller = seedingHitSets->beginRegion(®ion); } if(produceIntermediateHitTriplets_) { intermediateHitTripletsFiller = intermediateHitTriplets->beginRegion(®ion); + hitCachePtr = &(intermediateHitTripletsFiller.layerHitMapCache()); } + else { + hitCacheTmp.clear(); + } + LayerHitMapCache& hitCache = *hitCachePtr; + hitCache.extend(regionLayerPairs.layerHitMapCache()); LogTrace("HitTripletEDProducer") << " starting region"; @@ -144,11 +152,8 @@ void HitTripletEDProducerT::produce(edm::Event& iEvent, c } const auto& thirdLayers = found->second; - LayerHitMapCache hitCache; - hitCache.extend(layerPair.cache()); - LayerHitMapCache *hitCachePtr = &hitCache; if(produceIntermediateHitTriplets_) { - hitCachePtr = intermediateHitTripletsFiller.beginPair(layerPair.layerPair(), std::move(hitCache)); + intermediateHitTripletsFiller.beginPair(layerPair.layerPair()); } tripletLastLayerIndex.clear(); diff --git a/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h b/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h index fa1188d681f34..9868466af6e26 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h +++ b/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h @@ -44,12 +44,10 @@ class IntermediateHitTriplets { class LayerPairAndLayers { public: - LayerPairAndLayers(const LayerPair& layerPair, - unsigned int thirdLayersBegin, LayerHitMapCache&& cache): + LayerPairAndLayers(const LayerPair& layerPair, unsigned int thirdLayersBegin): layerPair_(layerPair), thirdLayersBegin_(thirdLayersBegin), - thirdLayersEnd_(thirdLayersBegin), - cache_(std::move(cache)) + thirdLayersEnd_(thirdLayersBegin) {} void setThirdLayersEnd(unsigned int end) { thirdLayersEnd_ = end; } @@ -58,9 +56,6 @@ class IntermediateHitTriplets { unsigned int thirdLayersBegin() const { return thirdLayersBegin_; } unsigned int thirdLayersEnd() const { return thirdLayersEnd_; } - LayerHitMapCache& cache() { return cache_; } - const LayerHitMapCache& cache() const { return cache_; } - private: LayerPair layerPair_; unsigned int thirdLayersBegin_; @@ -68,7 +63,8 @@ class IntermediateHitTriplets { // The reason for not storing layer triplets + hit triplets // directly is in this cache, and in my desire to try to keep // results unchanged during this refactoring - LayerHitMapCache cache_; + // + // TODO: Now that the cache is gone, maybe I can simplify? }; //////////////////// @@ -93,7 +89,6 @@ class IntermediateHitTriplets { std::vector::const_iterator tripletsBegin() const { return hitSets_->tripletsBegin() + thirdLayer_->tripletsBegin(); } std::vector::const_iterator tripletsEnd() const { return hitSets_->tripletsBegin() + thirdLayer_->tripletsEnd(); } - const LayerHitMapCache& cache() const { return layerPairAndLayers_->cache(); } private: const IntermediateHitTriplets *hitSets_; const LayerPairAndLayers *layerPairAndLayers_; @@ -169,15 +164,18 @@ class IntermediateHitTriplets { }; RegionLayerHits(const TrackingRegion* region, + const LayerHitMapCache *cache, const IntermediateHitTriplets *hitSets, LayerPairAndLayersConstIterator pairBegin, LayerPairAndLayersConstIterator pairEnd): region_(region), + cache_(cache), hitSets_(hitSets), layerSetsBegin_(pairBegin), layerSetsEnd_(pairEnd) {} const TrackingRegion& region() const { return *region_; } + const LayerHitMapCache& layerHitMapCache() const { return *cache_; } size_t layerPairAndLayersSize() const { return std::distance(layerSetsBegin_, layerSetsEnd_); } const_iterator begin() const { @@ -196,6 +194,7 @@ class IntermediateHitTriplets { private: const TrackingRegion *region_ = nullptr; + const LayerHitMapCache *cache_ = nullptr; const IntermediateHitTriplets *hitSets_ = nullptr; const LayerPairAndLayersConstIterator layerSetsBegin_; const LayerPairAndLayersConstIterator layerSetsEnd_; @@ -217,10 +216,11 @@ class IntermediateHitTriplets { bool valid() const { return obj_ != nullptr; } - LayerHitMapCache *beginPair(const LayerPair& layerPair, LayerHitMapCache&& cache) { - obj_->layerPairAndLayers_.emplace_back(layerPair, obj_->thirdLayers_.size(), std::move(cache)); - return &(obj_->layerPairAndLayers_.back().cache()); - }; + LayerHitMapCache& layerHitMapCache() { return obj_->regions_.back().layerHitMapCache(); } + + void beginPair(const LayerPair& layerPair) { + obj_->layerPairAndLayers_.emplace_back(layerPair, obj_->thirdLayers_.size()); + } void addTriplets(const std::vector& thirdLayers, const OrderedHitTriplets& triplets, diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc index c68205e2719da..b6af9b241c405 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc @@ -77,6 +77,9 @@ void PixelQuadrupletEDProducer::produce(edm::Event& iEvent, const edm::EventSetu const TrackingRegion& region = regionLayerPairAndLayers.region(); auto seedingHitSetsFiller = seedingHitSets->beginRegion(®ion); + LayerHitMapCache hitCache; + hitCache.extend(regionLayerPairAndLayers.layerHitMapCache()); + LogTrace("PixelQuadrupletEDProducer") << " starting region, number of layerPair+3rd layers " << regionLayerPairAndLayers.layerPairAndLayersSize(); for(const auto& layerTriplet: regionLayerPairAndLayers) { @@ -101,9 +104,6 @@ void PixelQuadrupletEDProducer::produce(edm::Event& iEvent, const edm::EventSetu } const auto& fourthLayers = found->second; - LayerHitMapCache hitCache; - hitCache.extend(layerTriplet.cache()); - generator_.hitQuadruplets(region, quadruplets, iEvent, iSetup, layerTriplet.tripletsBegin(), layerTriplet.tripletsEnd(), fourthLayers, hitCache); #ifdef EDM_ML_DEBUG diff --git a/RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h b/RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h index c8bc3867f64bb..a3f47447ffe15 100644 --- a/RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h +++ b/RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h @@ -16,11 +16,16 @@ namespace ihd { void setLayerSetsEnd(unsigned int end) { layerSetEndIndex_ = end; } const TrackingRegion& region() const { return *region_; } + + LayerHitMapCache& layerHitMapCache() { return cache_; } + const LayerHitMapCache& layerHitMapCache() const { return cache_; } + unsigned int layerSetBeginIndex() const { return layerSetBeginIndex_; } unsigned int layerSetEndIndex() const { return layerSetEndIndex_; } private: const TrackingRegion *region_; + LayerHitMapCache cache_; unsigned int layerSetBeginIndex_; /// index to doublets_, pointing to the beginning of the layer pairs of this region unsigned int layerSetEndIndex_; /// index to doublets_, pointing to the end of the layer pairs of this region }; @@ -32,10 +37,11 @@ namespace ihd { // Taking T* to have compatible interface with IntermediateHitTriplets::RegionLayerHits template - RegionLayerHits(const TrackingRegion* region, const TMP*, const_iterator begin, const_iterator end): - region_(region), layerSetsBegin_(begin), layerSetsEnd_(end) {} + RegionLayerHits(const TrackingRegion* region, const LayerHitMapCache *cache, const TMP*, const_iterator begin, const_iterator end): + region_(region), cache_(cache), layerSetsBegin_(begin), layerSetsEnd_(end) {} const TrackingRegion& region() const { return *region_; } + const LayerHitMapCache& layerHitMapCache() const { return *cache_; } const_iterator begin() const { return layerSetsBegin_; } const_iterator cbegin() const { return begin(); } @@ -44,6 +50,7 @@ namespace ihd { private: const TrackingRegion *region_; + const LayerHitMapCache *cache_; const const_iterator layerSetsBegin_; const const_iterator layerSetsEnd_; }; @@ -59,6 +66,7 @@ namespace ihd { value_type operator*() const { return value_type(&(iter_->region()), + &(iter_->layerHitMapCache()), hitSets_, hitSets_->layerSetsBegin() + iter_->layerSetBeginIndex(), hitSets_->layerSetsBegin() + iter_->layerSetEndIndex()); @@ -91,10 +99,9 @@ class IntermediateHitDoublets { class LayerPairHitDoublets { public: - LayerPairHitDoublets(const SeedingLayerSetsHits::SeedingLayerSet& layerSet, HitDoublets&& doublets, LayerHitMapCache&& cache): + LayerPairHitDoublets(const SeedingLayerSetsHits::SeedingLayerSet& layerSet, HitDoublets&& doublets): layerPair_(layerSet[0].index(), layerSet[1].index()), - doublets_(std::move(doublets)), - cache_(std::move(cache)) + doublets_(std::move(doublets)) {} const LayerPair& layerPair() const { return layerPair_; } @@ -102,12 +109,10 @@ class IntermediateHitDoublets { SeedingLayerSetsHits::LayerIndex outerLayerIndex() const { return std::get<1>(layerPair_); } const HitDoublets& doublets() const { return doublets_; } - const LayerHitMapCache& cache() const { return cache_; } private: LayerPair layerPair_; HitDoublets doublets_; - LayerHitMapCache cache_; }; //////////////////// @@ -130,8 +135,10 @@ class IntermediateHitDoublets { bool valid() const { return obj_ != nullptr; } - void addDoublets(const SeedingLayerSetsHits::SeedingLayerSet& layerSet, HitDoublets&& doublets, LayerHitMapCache&& cache) { - obj_->layerPairs_.emplace_back(layerSet, std::move(doublets), std::move(cache)); + LayerHitMapCache& layerHitMapCache() { return obj_->regions_.back().layerHitMapCache(); } + + void addDoublets(const SeedingLayerSetsHits::SeedingLayerSet& layerSet, HitDoublets&& doublets) { + obj_->layerPairs_.emplace_back(layerSet, std::move(doublets)); obj_->regions_.back().setLayerSetsEnd(obj_->layerPairs_.size()); } private: diff --git a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc index 10c6e1186969b..134c5f4bed19e 100644 --- a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc +++ b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc @@ -128,19 +128,25 @@ void HitPairEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetu layerPairs.push_back(set); } + LayerHitMapCache hitCacheTmp; // used if !produceIntermediateHitDoublets_ for(const TrackingRegion& region: regions) { auto seedingHitSetsFiller = RegionsSeedingHitSets::dummyFiller(); auto intermediateHitDoubletsFiller = IntermediateHitDoublets::dummyFiller(); + auto hitCachePtr = &hitCacheTmp; if(produceSeedingHitSets_) { seedingHitSetsFiller = seedingHitSets->beginRegion(®ion); } if(produceIntermediateHitDoublets_) { intermediateHitDoubletsFiller = intermediateHitDoublets->beginRegion(®ion); + hitCachePtr = &(intermediateHitDoubletsFiller.layerHitMapCache()); } + else { + hitCacheTmp.clear(); + } + for(SeedingLayerSetsHits::SeedingLayerSet layerSet: layerPairs) { - LayerHitMapCache hitCache; - auto doublets = generator_.doublets(region, iEvent, iSetup, layerSet, hitCache); + auto doublets = generator_.doublets(region, iEvent, iSetup, layerSet, *hitCachePtr); LogTrace("HitPairEDProducer") << " created " << doublets.size() << " doublets for layers " << layerSet[0].index() << "," << layerSet[1].index(); if(doublets.empty()) continue; // don't bother if no pairs from these layers if(produceSeedingHitSets_) { @@ -150,7 +156,7 @@ void HitPairEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetu } } if(produceIntermediateHitDoublets_) { - intermediateHitDoubletsFiller.addDoublets(layerSet, std::move(doublets), std::move(hitCache)); + intermediateHitDoubletsFiller.addDoublets(layerSet, std::move(doublets)); } } } diff --git a/RecoTracker/TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc b/RecoTracker/TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc index 0eb5826c394db..3ece596222887 100644 --- a/RecoTracker/TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc +++ b/RecoTracker/TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc @@ -78,12 +78,16 @@ void MultiHitFromChi2EDProducer::produce(edm::Event& iEvent, const edm::EventSet LogDebug("MultiHitFromChi2EDProducer") << "Creating multihits for " << regionDoublets.regionSize() << " regions, and " << trilayers.size() << " pair+3rd layers from " << regionDoublets.layerPairsSize() << " layer pairs"; + LayerHitMapCache hitCache; for(const auto& regionLayerPairs: regionDoublets) { const TrackingRegion& region = regionLayerPairs.region(); auto seedingHitSetsFiller = RegionsSeedingHitSets::dummyFiller(); seedingHitSetsFiller = seedingHitSets->beginRegion(®ion); + hitCache.clear(); + hitCache.extend(regionLayerPairs.layerHitMapCache()); + LogTrace("MultiHitFromChi2EDProducer") << " starting region"; for(const auto& layerPair: regionLayerPairs) { @@ -106,11 +110,7 @@ void MultiHitFromChi2EDProducer::produce(edm::Event& iEvent, const edm::EventSet } const auto& thirdLayers = found->second; - LayerHitMapCache hitCache; - hitCache.extend(layerPair.cache()); - LayerHitMapCache *hitCachePtr = &hitCache; - - generator_.hitSets(region, multihits, iEvent, iSetup, layerPair.doublets(), thirdLayers, *hitCachePtr, refittedHitStorage); + generator_.hitSets(region, multihits, iEvent, iSetup, layerPair.doublets(), thirdLayers, hitCache, refittedHitStorage); #ifdef EDM_ML_DEBUG LogTrace("MultiHitFromChi2EDProducer") << " created " << multihits.size() << " multihits for layer pair " << layerPair.innerLayerIndex() << "," << layerPair.outerLayerIndex() << " and 3rd layers"; From cd22efa9cf1b9c4678f21266b70a3c48e8620b26 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 15 Sep 2016 18:37:54 +0200 Subject: [PATCH 41/69] Simplify IntermediateHitTriplets --- .../interface/HitTripletEDProducerT.h | 6 +- .../interface/IntermediateHitTriplets.h | 164 ++++++------------ .../plugins/PixelQuadrupletEDProducer.cc | 10 +- 3 files changed, 56 insertions(+), 124 deletions(-) diff --git a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h index 69a382ec87175..afd6a7621c6c5 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h +++ b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h @@ -152,10 +152,6 @@ void HitTripletEDProducerT::produce(edm::Event& iEvent, c } const auto& thirdLayers = found->second; - if(produceIntermediateHitTriplets_) { - intermediateHitTripletsFiller.beginPair(layerPair.layerPair()); - } - tripletLastLayerIndex.clear(); generator_.hitTriplets(region, triplets, iEvent, iSetup, layerPair.doublets(), thirdLayers, &tripletLastLayerIndex, *hitCachePtr); @@ -184,7 +180,7 @@ void HitTripletEDProducerT::produce(edm::Event& iEvent, c }); // empty triplets need to propagate here - intermediateHitTripletsFiller.addTriplets(thirdLayers, triplets, tripletLastLayerIndex, tripletPermutation); + intermediateHitTripletsFiller.addTriplets(layerPair.layerPair(), thirdLayers, triplets, tripletLastLayerIndex, tripletPermutation); } triplets.clear(); diff --git a/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h b/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h index 9868466af6e26..e8be1d294148d 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h +++ b/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h @@ -21,92 +21,62 @@ class IntermediateHitTriplets { //////////////////// - class ThirdLayer { + class PLayerHitTriplets { public: - ThirdLayer(const SeedingLayerSetsHits::SeedingLayer& thirdLayer, unsigned int hitsBegin): - thirdLayer_(thirdLayer.index()), hitsBegin_(hitsBegin), hitsEnd_(hitsBegin) + PLayerHitTriplets(const LayerTriplet& layerTriplet, unsigned int tripletsBegin): + layerTriplet_(layerTriplet), + tripletsBegin_(tripletsBegin), tripletsEnd_(tripletsBegin) {} - void setHitsEnd(unsigned int end) { hitsEnd_ = end; } + void setTripletsEnd(unsigned int end) { tripletsEnd_ = end; } - SeedingLayerSetsHits::LayerIndex layerIndex() const { return thirdLayer_; } + const LayerTriplet& layerTriplet() const { return layerTriplet_; } - unsigned int tripletsBegin() const { return hitsBegin_; } - unsigned int tripletsEnd() const { return hitsEnd_; } + unsigned int tripletsBegin() const { return tripletsBegin_; } + unsigned int tripletsEnd() const { return tripletsEnd_; } private: - SeedingLayerSetsHits::LayerIndex thirdLayer_; - unsigned int hitsBegin_; - unsigned int hitsEnd_; + LayerTriplet layerTriplet_; + unsigned int tripletsBegin_; + unsigned int tripletsEnd_; }; //////////////////// - class LayerPairAndLayers { + class LayerHitTriplets { public: - LayerPairAndLayers(const LayerPair& layerPair, unsigned int thirdLayersBegin): - layerPair_(layerPair), - thirdLayersBegin_(thirdLayersBegin), - thirdLayersEnd_(thirdLayersBegin) - {} - - void setThirdLayersEnd(unsigned int end) { thirdLayersEnd_ = end; } - - const LayerPair& layerPair() const { return layerPair_; } - unsigned int thirdLayersBegin() const { return thirdLayersBegin_; } - unsigned int thirdLayersEnd() const { return thirdLayersEnd_; } - - private: - LayerPair layerPair_; - unsigned int thirdLayersBegin_; - unsigned int thirdLayersEnd_; - // The reason for not storing layer triplets + hit triplets - // directly is in this cache, and in my desire to try to keep - // results unchanged during this refactoring - // - // TODO: Now that the cache is gone, maybe I can simplify? - }; - - //////////////////// - - class LayerTripletHits { - public: - LayerTripletHits(const IntermediateHitTriplets *hitSets, - const LayerPairAndLayers *layerPairAndLayers, - const ThirdLayer *thirdLayer): + LayerHitTriplets(const IntermediateHitTriplets *hitSets, + const PLayerHitTriplets *layerTriplet): hitSets_(hitSets), - layerPairAndLayers_(layerPairAndLayers), - thirdLayer_(thirdLayer) + layerTriplet_(layerTriplet) {} using TripletRange = std::pair::const_iterator, std::vector::const_iterator>; - SeedingLayerSetsHits::LayerIndex innerLayerIndex() const { return std::get<0>(layerPairAndLayers_->layerPair()); } - SeedingLayerSetsHits::LayerIndex middleLayerIndex() const { return std::get<1>(layerPairAndLayers_->layerPair()); } - SeedingLayerSetsHits::LayerIndex outerLayerIndex() const { return thirdLayer_->layerIndex(); } + SeedingLayerSetsHits::LayerIndex innerLayerIndex() const { return std::get<0>(layerTriplet_->layerTriplet()); } + SeedingLayerSetsHits::LayerIndex middleLayerIndex() const { return std::get<1>(layerTriplet_->layerTriplet()); } + SeedingLayerSetsHits::LayerIndex outerLayerIndex() const { return std::get<2>(layerTriplet_->layerTriplet()); } - std::vector::const_iterator tripletsBegin() const { return hitSets_->tripletsBegin() + thirdLayer_->tripletsBegin(); } - std::vector::const_iterator tripletsEnd() const { return hitSets_->tripletsBegin() + thirdLayer_->tripletsEnd(); } + std::vector::const_iterator tripletsBegin() const { return hitSets_->tripletsBegin() + layerTriplet_->tripletsBegin(); } + std::vector::const_iterator tripletsEnd() const { return hitSets_->tripletsBegin() + layerTriplet_->tripletsEnd(); } private: const IntermediateHitTriplets *hitSets_; - const LayerPairAndLayers *layerPairAndLayers_; - const ThirdLayer *thirdLayer_; + const PLayerHitTriplets *layerTriplet_; }; //////////////////// class RegionLayerHits { public: - using LayerPairAndLayersConstIterator = std::vector::const_iterator; - using ThirdLayerConstIterator = std::vector::const_iterator; + using PLayerHitTripletsConstIterator = std::vector::const_iterator; using TripletConstIterator = std::vector::const_iterator; class const_iterator { public: - using internal_iterator_type = LayerPairAndLayersConstIterator; - using value_type = LayerTripletHits; + using internal_iterator_type = PLayerHitTripletsConstIterator; + using value_type = LayerHitTriplets; using difference_type = internal_iterator_type::difference_type; struct end_tag {}; @@ -114,36 +84,21 @@ class IntermediateHitTriplets { const_iterator(const IntermediateHitTriplets *hitSets, const RegionLayerHits *regionLayerHits): hitSets_(hitSets), regionLayerHits_(regionLayerHits), - iterPair_(regionLayerHits->layerSetsBegin()), - indThird_(iterPair_->thirdLayersBegin()) + iter_(regionLayerHits->layerSetsBegin()) { assert(regionLayerHits->layerSetsBegin() != regionLayerHits->layerSetsEnd()); } const_iterator(const IntermediateHitTriplets *hitSets, const RegionLayerHits *regionLayerHits, end_tag): - iterPair_(regionLayerHits->layerSetsEnd()), - indThird_(std::numeric_limits::max()) + iter_(regionLayerHits->layerSetsEnd()) {} value_type operator*() const { - assert(static_cast(indThird_) < std::distance(hitSets_->thirdLayersBegin(), hitSets_->thirdLayersEnd())); - return value_type(hitSets_, &(*iterPair_), &(*(hitSets_->thirdLayersBegin() + indThird_))); + return value_type(hitSets_, &(*iter_)); } const_iterator& operator++() { - auto nextThird = indThird_+1; - if(nextThird == iterPair_->thirdLayersEnd()) { - ++iterPair_; - if(iterPair_ != regionLayerHits_->layerSetsEnd()) { - indThird_ = iterPair_->thirdLayersBegin(); - } - else { - indThird_ = std::numeric_limits::max(); - } - } - else { - indThird_ = nextThird; - } + ++iter_; return *this; } @@ -153,30 +108,29 @@ class IntermediateHitTriplets { return clone; } - bool operator==(const const_iterator& other) const { return iterPair_ == other.iterPair_ && indThird_ == other.indThird_; } + bool operator==(const const_iterator& other) const { return iter_ == other.iter_; } bool operator!=(const const_iterator& other) const { return !operator==(other); } private: const IntermediateHitTriplets *hitSets_; const RegionLayerHits *regionLayerHits_; - internal_iterator_type iterPair_; - unsigned int indThird_; + internal_iterator_type iter_; }; RegionLayerHits(const TrackingRegion* region, const LayerHitMapCache *cache, const IntermediateHitTriplets *hitSets, - LayerPairAndLayersConstIterator pairBegin, - LayerPairAndLayersConstIterator pairEnd): + PLayerHitTripletsConstIterator tripletBegin, + PLayerHitTripletsConstIterator tripletEnd): region_(region), cache_(cache), hitSets_(hitSets), - layerSetsBegin_(pairBegin), layerSetsEnd_(pairEnd) + layerSetsBegin_(tripletBegin), layerSetsEnd_(tripletEnd) {} const TrackingRegion& region() const { return *region_; } const LayerHitMapCache& layerHitMapCache() const { return *cache_; } - size_t layerPairAndLayersSize() const { return std::distance(layerSetsBegin_, layerSetsEnd_); } + size_t layerTripletsSize() const { return std::distance(layerSetsBegin_, layerSetsEnd_); } const_iterator begin() const { if(layerSetsBegin_ != layerSetsEnd_) @@ -189,15 +143,15 @@ class IntermediateHitTriplets { const_iterator cend() const { return end(); } // used internally - LayerPairAndLayersConstIterator layerSetsBegin() const { return layerSetsBegin_; } - LayerPairAndLayersConstIterator layerSetsEnd() const { return layerSetsEnd_; } + PLayerHitTripletsConstIterator layerSetsBegin() const { return layerSetsBegin_; } + PLayerHitTripletsConstIterator layerSetsEnd() const { return layerSetsEnd_; } private: const TrackingRegion *region_ = nullptr; const LayerHitMapCache *cache_ = nullptr; const IntermediateHitTriplets *hitSets_ = nullptr; - const LayerPairAndLayersConstIterator layerSetsBegin_; - const LayerPairAndLayersConstIterator layerSetsEnd_; + const PLayerHitTripletsConstIterator layerSetsBegin_; + const PLayerHitTripletsConstIterator layerSetsEnd_; }; //////////////////// @@ -218,11 +172,8 @@ class IntermediateHitTriplets { LayerHitMapCache& layerHitMapCache() { return obj_->regions_.back().layerHitMapCache(); } - void beginPair(const LayerPair& layerPair) { - obj_->layerPairAndLayers_.emplace_back(layerPair, obj_->thirdLayers_.size()); - } - - void addTriplets(const std::vector& thirdLayers, + void addTriplets(const LayerPair& layerPair, + const std::vector& thirdLayers, const OrderedHitTriplets& triplets, const std::vector& thirdLayerIndex, const std::vector& permutations) { @@ -230,9 +181,6 @@ class IntermediateHitTriplets { assert(triplets.size() == permutations.size()); if(triplets.empty()) { - // In absence of triplets for a layer pair simplest is just - // remove the pair - obj_->popPair(); return; } @@ -246,15 +194,14 @@ class IntermediateHitTriplets { const int layer = thirdLayerIndex[realIndex]; if(layer != prevLayer) { prevLayer = layer; - obj_->thirdLayers_.emplace_back(thirdLayers[layer], obj_->hitTriplets_.size()); - obj_->layerPairAndLayers_.back().setThirdLayersEnd(obj_->thirdLayers_.size()); + obj_->layerTriplets_.emplace_back(LayerTriplet(std::get<0>(layerPair), std::get<1>(layerPair), thirdLayers[layer].index()), obj_->hitTriplets_.size()); } obj_->hitTriplets_.emplace_back(triplets[realIndex]); - obj_->thirdLayers_.back().setHitsEnd(obj_->hitTriplets_.size()); + obj_->layerTriplets_.back().setTripletsEnd(obj_->hitTriplets_.size()); } - obj_->regions_.back().setLayerSetsEnd(obj_->layerPairAndLayers_.size()); + obj_->regions_.back().setLayerSetsEnd(obj_->layerTriplets_.size()); } private: IntermediateHitTriplets *obj_; @@ -271,27 +218,24 @@ class IntermediateHitTriplets { void swap(IntermediateHitTriplets& rh) { std::swap(seedingLayers_, rh.seedingLayers_); std::swap(regions_, rh.regions_); - std::swap(layerPairAndLayers_, rh.layerPairAndLayers_); - std::swap(thirdLayers_, rh.thirdLayers_); + std::swap(layerTriplets_, rh.layerTriplets_); std::swap(hitTriplets_, rh.hitTriplets_); } void reserve(size_t nregions, size_t nlayersets, size_t ntriplets) { regions_.reserve(nregions); - layerPairAndLayers_.reserve(nregions*nlayersets); - thirdLayers_.reserve(nregions*nlayersets); + layerTriplets_.reserve(nregions*nlayersets); hitTriplets_.reserve(ntriplets); } void shrink_to_fit() { regions_.shrink_to_fit(); - layerPairAndLayers_.shrink_to_fit(); - thirdLayers_.shrink_to_fit(); + layerTriplets_.shrink_to_fit(); hitTriplets_.shrink_to_fit(); } RegionFiller beginRegion(const TrackingRegion *region) { - regions_.emplace_back(region, layerPairAndLayers_.size()); + regions_.emplace_back(region, layerTriplets_.size()); return RegionFiller(this); } @@ -308,24 +252,16 @@ class IntermediateHitTriplets { // used internally std::vector::const_iterator regionsBegin() const { return regions_.begin(); } std::vector::const_iterator regionsEnd() const { return regions_.end(); } - std::vector::const_iterator layerSetsBegin() const { return layerPairAndLayers_.begin(); } - std::vector::const_iterator layerSetsEnd() const { return layerPairAndLayers_.end(); } - std::vector::const_iterator thirdLayersBegin() const { return thirdLayers_.begin(); } - std::vector::const_iterator thirdLayersEnd() const { return thirdLayers_.end(); } + std::vector::const_iterator layerSetsBegin() const { return layerTriplets_.begin(); } + std::vector::const_iterator layerSetsEnd() const { return layerTriplets_.end(); } std::vector::const_iterator tripletsBegin() const { return hitTriplets_.begin(); } std::vector::const_iterator tripletsEnd() const { return hitTriplets_.end(); } private: - // to be called if no triplets are added - void popPair() { - layerPairAndLayers_.pop_back(); - } - const SeedingLayerSetsHits *seedingLayers_; std::vector regions_; - std::vector layerPairAndLayers_; - std::vector thirdLayers_; + std::vector layerTriplets_; std::vector hitTriplets_; }; diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc index b6af9b241c405..1122a9a7306b8 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc @@ -73,16 +73,16 @@ void PixelQuadrupletEDProducer::produce(edm::Event& iEvent, const edm::EventSetu OrderedHitSeeds quadruplets; quadruplets.reserve(localRA_.upper()); - for(const auto& regionLayerPairAndLayers: regionTriplets) { - const TrackingRegion& region = regionLayerPairAndLayers.region(); + for(const auto& regionLayerTriplets: regionTriplets) { + const TrackingRegion& region = regionLayerTriplets.region(); auto seedingHitSetsFiller = seedingHitSets->beginRegion(®ion); LayerHitMapCache hitCache; - hitCache.extend(regionLayerPairAndLayers.layerHitMapCache()); + hitCache.extend(regionLayerTriplets.layerHitMapCache()); - LogTrace("PixelQuadrupletEDProducer") << " starting region, number of layerPair+3rd layers " << regionLayerPairAndLayers.layerPairAndLayersSize(); + LogTrace("PixelQuadrupletEDProducer") << " starting region, number of layer triplets " << regionLayerTriplets.layerTripletsSize(); - for(const auto& layerTriplet: regionLayerPairAndLayers) { + for(const auto& layerTriplet: regionLayerTriplets) { LogTrace("PixelQuadrupletEDProducer") << " starting layer triplet " << layerTriplet.innerLayerIndex() << "," << layerTriplet.middleLayerIndex() << "," << layerTriplet.outerLayerIndex(); auto found = std::find_if(quadlayers.begin(), quadlayers.end(), [&](const LayerQuadruplets::LayerSetAndLayers& a) { return a.first[0].index() == layerTriplet.innerLayerIndex() && From 1ad84a8afe54c2a601dcb3e415d387c31444c447 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 16 Sep 2016 15:35:22 +0200 Subject: [PATCH 42/69] Improve documentation and interfaces (for self-documentation) --- .../interface/IntermediateHitTriplets.h | 86 ++++++++++++++----- .../plugins/PixelQuadrupletEDProducer.cc | 2 +- .../interface/IntermediateHitDoublets.h | 74 ++++++++++++---- .../interface/RegionsSeedingHitSets.h | 22 +++-- 4 files changed, 140 insertions(+), 44 deletions(-) diff --git a/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h b/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h index e8be1d294148d..b6b309c539ff2 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h +++ b/RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h @@ -7,8 +7,17 @@ #include "RecoPixelVertexing/PixelTriplets/interface/OrderedHitTriplets.h" /** - * Simple container of temporary information delivered from hit triplet + * Container of temporary information delivered from hit triplet * generator to hit quadruplet generator via edm::Event. + * + * The iterator loops over regions, the value_type of that has an + * iterator looping over the layer triplets of the region, and the + * value_type of that has an iterator looping over the hit triplets of + * the layer triplet. + * + * Pointers to SeedingLayerSetsHits and TrackingRegion are stored, so + * the lifetime of those objects should be at least as long as the + * lifetime of this object. */ class IntermediateHitTriplets { public: @@ -21,6 +30,14 @@ class IntermediateHitTriplets { //////////////////// + /** + * Helper class holding the layer triplet indices (to + * SeedingLayerSetsHits), and indices of the hit triplets from this + * layer triplet (to the hit triplet vector) + * + * As only the indices of hit triplets are stored, a separate class + * (LayerHitTriplets) is provided with nicer interface. + */ class PLayerHitTriplets { public: PLayerHitTriplets(const LayerTriplet& layerTriplet, unsigned int tripletsBegin): @@ -43,8 +60,14 @@ class IntermediateHitTriplets { //////////////////// + /** + * Helper class providing a nice interface for the hit triplets of a + * layer triplet. + */ class LayerHitTriplets { public: + using const_iterator = std::vector::const_iterator; + LayerHitTriplets(const IntermediateHitTriplets *hitSets, const PLayerHitTriplets *layerTriplet): hitSets_(hitSets), @@ -58,8 +81,10 @@ class IntermediateHitTriplets { SeedingLayerSetsHits::LayerIndex middleLayerIndex() const { return std::get<1>(layerTriplet_->layerTriplet()); } SeedingLayerSetsHits::LayerIndex outerLayerIndex() const { return std::get<2>(layerTriplet_->layerTriplet()); } - std::vector::const_iterator tripletsBegin() const { return hitSets_->tripletsBegin() + layerTriplet_->tripletsBegin(); } - std::vector::const_iterator tripletsEnd() const { return hitSets_->tripletsBegin() + layerTriplet_->tripletsEnd(); } + const_iterator begin() const { return hitSets_->tripletsBegin() + layerTriplet_->tripletsBegin(); } + const_iterator cbegin() const { return begin(); } + const_iterator end() const { return hitSets_->tripletsBegin() + layerTriplet_->tripletsEnd(); } + const_iterator cend() const { return end(); } private: const IntermediateHitTriplets *hitSets_; @@ -68,7 +93,17 @@ class IntermediateHitTriplets { //////////////////// - class RegionLayerHits { + /** + * Helper class to provide nice interface to loop over the layer sets of a region + * + * The value_type of the iterator is LayerHitTriplets, which has an + * iterator for the hit triplets. + * + * Can not use ihd::RegionLayerSets here because of having + * separate classes for storage (PLayerHitTriplets) and use + * (LayerHitTriplets). + */ + class RegionLayerSets { public: using PLayerHitTripletsConstIterator = std::vector::const_iterator; using TripletConstIterator = std::vector::const_iterator; @@ -81,16 +116,24 @@ class IntermediateHitTriplets { struct end_tag {}; - const_iterator(const IntermediateHitTriplets *hitSets, const RegionLayerHits *regionLayerHits): + /** + * Constructor for an iterator pointing to a valid element + */ + const_iterator(const IntermediateHitTriplets *hitSets, const RegionLayerSets *regionLayerSets): hitSets_(hitSets), - regionLayerHits_(regionLayerHits), - iter_(regionLayerHits->layerSetsBegin()) + regionLayerSets_(regionLayerSets), + iter_(regionLayerSets->layerSetsBegin()) { - assert(regionLayerHits->layerSetsBegin() != regionLayerHits->layerSetsEnd()); + assert(regionLayerSets->layerSetsBegin() != regionLayerSets->layerSetsEnd()); } - const_iterator(const IntermediateHitTriplets *hitSets, const RegionLayerHits *regionLayerHits, end_tag): - iter_(regionLayerHits->layerSetsEnd()) + /** + * Constructor for an iterator pointing to an invalid element (i.e. end) + * + * The end_tag parameter is used to differentiate this constructor from the other one. + */ + const_iterator(const IntermediateHitTriplets *hitSets, const RegionLayerSets *regionLayerSets, end_tag): + iter_(regionLayerSets->layerSetsEnd()) {} value_type operator*() const { @@ -113,11 +156,11 @@ class IntermediateHitTriplets { private: const IntermediateHitTriplets *hitSets_; - const RegionLayerHits *regionLayerHits_; + const RegionLayerSets *regionLayerSets_; internal_iterator_type iter_; }; - RegionLayerHits(const TrackingRegion* region, + RegionLayerSets(const TrackingRegion* region, const LayerHitMapCache *cache, const IntermediateHitTriplets *hitSets, PLayerHitTripletsConstIterator tripletBegin, @@ -142,7 +185,7 @@ class IntermediateHitTriplets { const_iterator end() const { return const_iterator(hitSets_, this, const_iterator::end_tag()); } const_iterator cend() const { return end(); } - // used internally + // used internally by the LayerHitTriplets helper class PLayerHitTripletsConstIterator layerSetsBegin() const { return layerSetsBegin_; } PLayerHitTripletsConstIterator layerSetsEnd() const { return layerSetsEnd_; } @@ -156,11 +199,12 @@ class IntermediateHitTriplets { //////////////////// - using const_iterator = ihd::const_iterator; + /// Iterator over regions + using const_iterator = ihd::const_iterator; //////////////////// - // helper class to enforce correct usage + /// Helper class enforcing correct way of filling the doublets of a region class RegionFiller { public: RegionFiller(): obj_(nullptr) {} @@ -207,7 +251,9 @@ class IntermediateHitTriplets { IntermediateHitTriplets *obj_; }; + // allows declaring local variables with auto static RegionFiller dummyFiller() { return RegionFiller(); } + //////////////////// IntermediateHitTriplets(): seedingLayers_(nullptr) {} @@ -249,7 +295,7 @@ class IntermediateHitTriplets { const_iterator end() const { return const_iterator(this, regions_.end()); } const_iterator cend() const { return end(); } - // used internally + // used internally by all the helper classes std::vector::const_iterator regionsBegin() const { return regions_.begin(); } std::vector::const_iterator regionsEnd() const { return regions_.end(); } std::vector::const_iterator layerSetsBegin() const { return layerTriplets_.begin(); } @@ -258,11 +304,11 @@ class IntermediateHitTriplets { std::vector::const_iterator tripletsEnd() const { return hitTriplets_.end(); } private: - const SeedingLayerSetsHits *seedingLayers_; + const SeedingLayerSetsHits *seedingLayers_; /// Pointer to SeedingLayerSetsHits (owned elsewhere) - std::vector regions_; - std::vector layerTriplets_; - std::vector hitTriplets_; + std::vector regions_; /// Container of regions, each element has indices pointing to layerTriplets_ + std::vector layerTriplets_; /// Container of layer triplets, each element has indices pointing to hitTriplets_ + std::vector hitTriplets_; /// Container of hit triplets for all layer triplets and regions }; #endif diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc index 1122a9a7306b8..f42f0e418ca23 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc @@ -104,7 +104,7 @@ void PixelQuadrupletEDProducer::produce(edm::Event& iEvent, const edm::EventSetu } const auto& fourthLayers = found->second; - generator_.hitQuadruplets(region, quadruplets, iEvent, iSetup, layerTriplet.tripletsBegin(), layerTriplet.tripletsEnd(), fourthLayers, hitCache); + generator_.hitQuadruplets(region, quadruplets, iEvent, iSetup, layerTriplet.begin(), layerTriplet.end(), fourthLayers, hitCache); #ifdef EDM_ML_DEBUG LogTrace("PixelQuadrupletEDProducer") << " created " << quadruplets.size() << " quadruplets for layer triplet " << layerTriplet.innerLayerIndex() << "," << layerTriplet.middleLayerIndex() << "," << layerTriplet.outerLayerIndex() << " and 4th layers"; diff --git a/RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h b/RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h index a3f47447ffe15..834ac284c43a9 100644 --- a/RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h +++ b/RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h @@ -5,6 +5,14 @@ #include "TrackingTools/TransientTrackingRecHit/interface/SeedingLayerSetsHits.h" namespace ihd { + /** + * Class to hold TrackingRegion and begin+end indices to a vector of + * seeding layer sets. + * + * The LayerHitMapCache is also hold here as it is a per-region object. + * + * In practice the vector being indexed can be anything. + */ class RegionIndex { public: RegionIndex(const TrackingRegion *reg, unsigned int ind): @@ -24,20 +32,27 @@ namespace ihd { unsigned int layerSetEndIndex() const { return layerSetEndIndex_; } private: - const TrackingRegion *region_; + const TrackingRegion *region_; /// pointer to TrackingRegion (owned elsewhere) LayerHitMapCache cache_; - unsigned int layerSetBeginIndex_; /// index to doublets_, pointing to the beginning of the layer pairs of this region - unsigned int layerSetEndIndex_; /// index to doublets_, pointing to the end of the layer pairs of this region + unsigned int layerSetBeginIndex_; /// index of the beginning of layer sets of this region + unsigned int layerSetEndIndex_; /// index of the end (one-past-last) of layer sets of this region }; + /** + * Helper class to provide nice interface to loop over the layer sets of a region + * + * \tparam T Concrete type in a vector actually holding the layer sets + * + * Templatized because used here and in RegionSeedingHitSets + */ template - class RegionLayerHits { + class RegionLayerSets { public: using const_iterator = typename std::vector::const_iterator; - // Taking T* to have compatible interface with IntermediateHitTriplets::RegionLayerHits + // Taking T* to have compatible interface with IntermediateHitTriplets::RegionLayerSets template - RegionLayerHits(const TrackingRegion* region, const LayerHitMapCache *cache, const TMP*, const_iterator begin, const_iterator end): + RegionLayerSets(const TrackingRegion* region, const LayerHitMapCache *cache, const TMP*, const_iterator begin, const_iterator end): region_(region), cache_(cache), layerSetsBegin_(begin), layerSetsEnd_(end) {} const TrackingRegion& region() const { return *region_; } @@ -55,6 +70,14 @@ namespace ihd { const const_iterator layerSetsEnd_; }; + /** + * Helper class providing a generic iterator to loop over + * TrackingRegions of IntermediateHitDoublets, + * IntermediateHitTriplets, or RegionsSeedingHitSets + * + * \tparam ValueType Type to be returned by operator*() (should be something inexpensive) + * \tparam HitSetType Type of the holder of data (currently IntermediateHitDoublets, IntermediateHitTriplets, or RegionsSeedingHitSets) + */ template class const_iterator { public: @@ -89,14 +112,30 @@ namespace ihd { } /** - * Simple container of temporary information delivered from hit pair + * Container of temporary information delivered from hit pair * generator to hit triplet generator via edm::Event. + * + * The iterator loops over regions, and the value_type of that has an + * iterator looping over the layer pairs of the region. + * + * Pointers to SeedingLayerSetsHits and TrackingRegion are stored, so + * the lifetime of those objects should be at least as long as the + * lifetime of this object. */ class IntermediateHitDoublets { public: using LayerPair = std::tuple; using RegionIndex = ihd::RegionIndex; + /** + * This class stores the indices of a layer pair, and the doublets + * generated from there. + * + * The layer indices are those from SeedingLayerSetsHits. + * + * Since the doublets are stored directly here, the same class works + * nicely for both storage and use. + */ class LayerPairHitDoublets { public: LayerPairHitDoublets(const SeedingLayerSetsHits::SeedingLayerSet& layerSet, HitDoublets&& doublets): @@ -111,21 +150,23 @@ class IntermediateHitDoublets { const HitDoublets& doublets() const { return doublets_; } private: - LayerPair layerPair_; - HitDoublets doublets_; + LayerPair layerPair_; /// pair of indices to the layer + HitDoublets doublets_; /// container of the doublets }; //////////////////// - using RegionLayerHits = ihd::RegionLayerHits; + /// Helper class providing nice interface to loop over layer sets of a region + using RegionLayerSets = ihd::RegionLayerSets; //////////////////// - using const_iterator = ihd::const_iterator; + /// Iterator over regions + using const_iterator = ihd::const_iterator; //////////////////// - // helper class to enforce correct usage + /// Helper class enforcing correct way of filling the doublets of a region class RegionFiller { public: RegionFiller(): obj_(nullptr) {} @@ -145,6 +186,7 @@ class IntermediateHitDoublets { IntermediateHitDoublets *obj_; }; + // allows declaring local variables with auto static RegionFiller dummyFiller() { return RegionFiller(); } //////////////////// @@ -185,17 +227,17 @@ class IntermediateHitDoublets { const_iterator end() const { return const_iterator(this, regions_.end()); } const_iterator cend() const { return end(); } - // used internally + // used internally by all the helper classes std::vector::const_iterator regionsBegin() const { return regions_.begin(); } std::vector::const_iterator regionsEnd() const { return regions_.end(); } std::vector::const_iterator layerSetsBegin() const { return layerPairs_.begin(); } std::vector::const_iterator layerSetsEnd() const { return layerPairs_.end(); } private: - const SeedingLayerSetsHits *seedingLayers_; + const SeedingLayerSetsHits *seedingLayers_; /// Pointer to SeedingLayerSetsHits (owned elsewhere) - std::vector regions_; - std::vector layerPairs_; + std::vector regions_; /// Container of regions, each element has indices pointing to layerPairs_ + std::vector layerPairs_; /// Container of layer pairs and doublets for all regions }; #endif diff --git a/RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h b/RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h index 20682decbc3c0..4ddc111c7cffe 100644 --- a/RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h +++ b/RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h @@ -4,16 +4,23 @@ #include "RecoTracker/TkSeedingLayers/interface/SeedingHitSet.h" #include "RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h" -// defined in this package instead of RecoTracker/TkSeedingLayers to avoid circular dependencies - +/** + * Class to store SeedingHitSets (doublet/triplet/quadruplet) per TrackingRegion + * + * Defined in this package instead of RecoTracker/TkSeedingLayers to avoid circular dependencies + */ class RegionsSeedingHitSets { public: + /// Helper class containing a region and indices to hitSets_ using RegionIndex = ihd::RegionIndex; - using RegionSeedingHitSets = ihd::RegionLayerHits; + /// Helper class providing nice interface to loop over hit sets of a region + using RegionSeedingHitSets = ihd::RegionLayerSets; + + /// Iterator over regions using const_iterator = ihd::const_iterator; - // helper class to enforce correct usage + /// Helper class enforcing correct way of filling the doublets of a region class RegionFiller { public: RegionFiller(): obj_(nullptr) {} @@ -33,6 +40,7 @@ class RegionsSeedingHitSets { RegionsSeedingHitSets *obj_; }; + // allows declaring local variables with auto static RegionFiller dummyFiller() { return RegionFiller(); } // constructors @@ -68,13 +76,13 @@ class RegionsSeedingHitSets { const_iterator end() const { return const_iterator(this, regions_.end()); } const_iterator cend() const { return end(); } - // Used internally + // used internally by the helper classes std::vector::const_iterator layerSetsBegin() const { return hitSets_.begin(); } std::vector::const_iterator layerSetsEnd() const { return hitSets_.end(); } private: - std::vector regions_; - std::vector hitSets_; + std::vector regions_; /// Container of regions, each element has indices pointing to hitSets_ + std::vector hitSets_; /// Container of hit sets for all regions }; #endif From 0a76318402b805ad766942a4e73699ac2cef8a27 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Mon, 26 Sep 2016 13:11:41 +0200 Subject: [PATCH 43/69] Migrate CAHitQuadrupletGenerator --- .../plugins/CAHitQuadrupletEDProducer.cc | 93 +++++++++++ .../plugins/CAHitQuadrupletGenerator.cc | 145 ++++++++++++++---- .../plugins/CAHitQuadrupletGenerator.h | 24 ++- .../plugins/CellularAutomaton.cc | 4 +- .../PixelTriplets/plugins/CellularAutomaton.h | 2 +- .../python/CAHitQuadrupletGenerator_cfi.py | 1 + ...tomiseForQuadrupletsByCellularAutomaton.py | 118 ++++++++++---- .../TkHitPairs/plugins/HitPairEDProducer.cc | 44 ++++-- .../interface/SeedingLayerSetsHits.h | 19 +++ 9 files changed, 370 insertions(+), 80 deletions(-) create mode 100644 RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletEDProducer.cc diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletEDProducer.cc b/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletEDProducer.cc new file mode 100644 index 0000000000000..370211ffa9c38 --- /dev/null +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletEDProducer.cc @@ -0,0 +1,93 @@ +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Utilities/interface/EDGetToken.h" +#include "FWCore/Framework/interface/Event.h" +#include "DataFormats/Common/interface/Handle.h" +#include "FWCore/Utilities/interface/RunningAverage.h" + +#include "RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h" +#include "RecoPixelVertexing/PixelTriplets/interface/OrderedHitSeeds.h" +#include "RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h" + +#include "CAHitQuadrupletGenerator.h" + +class CAHitQuadrupletEDProducer: public edm::stream::EDProducer<> { +public: + CAHitQuadrupletEDProducer(const edm::ParameterSet& iConfig); + ~CAHitQuadrupletEDProducer() = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + virtual void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override; + +private: + edm::EDGetTokenT doubletToken_; + + edm::RunningAverage localRA_; + + CAHitQuadrupletGenerator generator_; +}; + +CAHitQuadrupletEDProducer::CAHitQuadrupletEDProducer(const edm::ParameterSet& iConfig): + doubletToken_(consumes(iConfig.getParameter("doublets"))), + generator_(iConfig, consumesCollector(), false) +{ + produces(); +} + +void CAHitQuadrupletEDProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + + desc.add("doublets", edm::InputTag("hitPairEDProducer")); + CAHitQuadrupletGenerator::fillDescriptions(desc); + + descriptions.add("caHitQuadrupletEDProducer", desc); +} + +void CAHitQuadrupletEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + edm::Handle hdoublets; + iEvent.getByToken(doubletToken_, hdoublets); + const auto& regionDoublets = *hdoublets; + + const SeedingLayerSetsHits& seedingLayerHits = regionDoublets.seedingLayerHits(); + if(seedingLayerHits.numberOfLayersInSet() < 4) { + throw cms::Exception("Configuration") << "CAHitQuadrupletEDProducer expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= 4, got " << seedingLayerHits.numberOfLayersInSet(); + } + + auto seedingHitSets = std::make_unique(); + if(regionDoublets.empty()) { + iEvent.put(std::move(seedingHitSets)); + return; + } + seedingHitSets->reserve(regionDoublets.regionSize(), localRA_.upper()); + generator_.initEvent(iEvent, iSetup); + + LogDebug("CAHitQuadrupletEDProducer") << "Creating quadruplets for " << regionDoublets.regionSize() << " regions, and " << regionDoublets.layerPairsSize() << " layer pairs"; + + OrderedHitSeeds quadruplets; + quadruplets.reserve(localRA_.upper()); + + for(const auto& regionLayerPairs: regionDoublets) { + const TrackingRegion& region = regionLayerPairs.region(); + auto seedingHitSetsFiller = seedingHitSets->beginRegion(®ion); + + LogTrace("CAHitQuadrupletEDProducer") << " starting region"; + + generator_.hitQuadruplets(regionLayerPairs, quadruplets, iSetup, seedingLayerHits); + LogTrace("CAHitQuadrupletEDProducer") << " created " << quadruplets.size() << " quadruplets"; + + for(const auto& quad: quadruplets) { + seedingHitSetsFiller.emplace_back(quad[0], quad[1], quad[2], quad[3]); + } + quadruplets.clear(); + } + localRA_.update(seedingHitSets->size()); + + iEvent.put(std::move(seedingHitSets)); +} + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(CAHitQuadrupletEDProducer); diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletGenerator.cc b/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletGenerator.cc index 931f51c08ab5d..b951014c44a65 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletGenerator.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletGenerator.cc @@ -4,6 +4,7 @@ #include "RecoPixelVertexing/PixelTriplets/interface/HitQuadrupletGenerator.h" #include "LayerQuadruplets.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/Event.h" #include "DataFormats/Common/interface/Handle.h" @@ -19,6 +20,8 @@ #include "FWCore/Utilities/interface/isFinite.h" +#include + namespace { @@ -34,8 +37,7 @@ namespace using namespace std; using namespace ctfseeding; -CAHitQuadrupletGenerator::CAHitQuadrupletGenerator(const edm::ParameterSet& cfg, edm::ConsumesCollector& iC) : -theSeedingLayerToken(iC.consumes(cfg.getParameter("SeedingLayers"))), +CAHitQuadrupletGenerator::CAHitQuadrupletGenerator(const edm::ParameterSet& cfg, edm::ConsumesCollector& iC, bool needSeedingLayerSetsHits) : extraHitRPhitolerance(cfg.getParameter("extraHitRPhitolerance")), //extra window in ThirdHitPredictionFromCircle range (divide by R to get phi) maxChi2(cfg.getParameter("maxChi2")), fitFastCircle(cfg.getParameter("fitFastCircle")), @@ -45,6 +47,9 @@ caThetaCut(cfg.getParameter("CAThetaCut")), caPhiCut(cfg.getParameter("CAPhiCut")), caHardPtCut(cfg.getParameter("CAHardPtCut")) { + if(needSeedingLayerSetsHits) + theSeedingLayerToken = iC.consumes(cfg.getParameter("SeedingLayers")); + if (cfg.exists("SeedComparitorPSet")) { edm::ParameterSet comparitorPSet = @@ -61,25 +66,37 @@ CAHitQuadrupletGenerator::~CAHitQuadrupletGenerator() { } -void CAHitQuadrupletGenerator::hitQuadruplets(const TrackingRegion& region, - OrderedHitSeeds & result, const edm::Event& ev, - const edm::EventSetup& es) -{ - edm::Handle hlayers; - ev.getByToken(theSeedingLayerToken, hlayers); - const SeedingLayerSetsHits& layers = *hlayers; - if (layers.numberOfLayersInSet() != 4) - throw cms::Exception("Configuration") - << "CAHitQuadrupletsGenerator expects SeedingLayerSetsHits::numberOfLayersInSet() to be 4, got " - << layers.numberOfLayersInSet(); - - CAGraph g; - - - std::vector hitDoublets; +void CAHitQuadrupletGenerator::fillDescriptions(edm::ParameterSetDescription& desc) { + desc.add("extraHitRPhitolerance", 0.1); + desc.add("fitFastCircle", false); + desc.add("fitFastCircleChi2Cut", false); + desc.add("useBendingCorrection", false); + desc.add("CAThetaCut", 0.00125); + desc.add("CAPhiCut", 10); + desc.add("CAHardPtCut", 0); + + edm::ParameterSetDescription descMaxChi2; + descMaxChi2.add("pt1", 0.2); + descMaxChi2.add("pt2", 1.5); + descMaxChi2.add("value1", 500); + descMaxChi2.add("value2", 50); + descMaxChi2.add("enabled", true); + desc.add("maxChi2", descMaxChi2); + + edm::ParameterSetDescription descComparitor; + descComparitor.add("ComponentName", "none"); + descComparitor.setAllowAnything(); // until we have moved SeedComparitor too to EDProducers + desc.add("SeedComparitorPSet", descComparitor); +} +void CAHitQuadrupletGenerator::initEvent(const edm::Event& ev, const edm::EventSetup& es) { + if (theComparitor) theComparitor->init(ev, es); +} - HitPairGeneratorFromLayerPair thePairGenerator(0, 1, &theLayerCache); +namespace { + template + void fillGraph(const SeedingLayerSetsHits& layers, CAGraph& g, T_HitDoublets& hitDoublets, + T_GeneratorOrPairsFunction generatorOrPairsFunction) { for (unsigned int i = 0; i < layers.size(); i++) { for (unsigned int j = 0; j < 4; ++j) @@ -119,28 +136,93 @@ void CAHitQuadrupletGenerator::hitQuadruplets(const TrackingRegion& region, if (std::find(g.theLayerPairs.begin(), g.theLayerPairs.end(), tmpInnerLayerPair) == g.theLayerPairs.end()) { - hitDoublets.emplace_back(thePairGenerator.doublets(region, ev, es, - layers[i][j-1], layers[i][j])); - - g.theLayerPairs.push_back(tmpInnerLayerPair); - g.theLayers[vertexIndex].theInnerLayers.push_back( + const bool nonEmpty = generatorOrPairsFunction(layers[i][j-1], layers[i][j], hitDoublets); + if(nonEmpty) { + g.theLayerPairs.push_back(tmpInnerLayerPair); + g.theLayers[vertexIndex].theInnerLayers.push_back( innerVertex - g.theLayers.begin()); - innerVertex->theOuterLayers.push_back(vertexIndex); - g.theLayers[vertexIndex].theInnerLayerPairs.push_back( + innerVertex->theOuterLayers.push_back(vertexIndex); + g.theLayers[vertexIndex].theInnerLayerPairs.push_back( g.theLayerPairs.size() - 1); - innerVertex->theOuterLayerPairs.push_back( + innerVertex->theOuterLayerPairs.push_back( g.theLayerPairs.size() - 1); - + } } } } } + } +} +void CAHitQuadrupletGenerator::hitQuadruplets(const TrackingRegion& region, + OrderedHitSeeds & result, const edm::Event& ev, + const edm::EventSetup& es) +{ + edm::Handle hlayers; + ev.getByToken(theSeedingLayerToken, hlayers); + const SeedingLayerSetsHits& layers = *hlayers; + if (layers.numberOfLayersInSet() != 4) + throw cms::Exception("Configuration") + << "CAHitQuadrupletsGenerator expects SeedingLayerSetsHits::numberOfLayersInSet() to be 4, got " + << layers.numberOfLayersInSet(); + + CAGraph g; + + + std::vector hitDoublets; + + + HitPairGeneratorFromLayerPair thePairGenerator(0, 1, &theLayerCache); + fillGraph(layers, g, hitDoublets, [&](const SeedingLayerSetsHits::SeedingLayer& inner, const SeedingLayerSetsHits::SeedingLayer& outer, std::vector& hitDoublets) { + hitDoublets.emplace_back(thePairGenerator.doublets(region, ev, es, inner, outer)); + return true; + }); + if (theComparitor) theComparitor->init(ev, es); + + std::vector hitDoubletsPtr; + hitDoubletsPtr.reserve(hitDoublets.size()); + for(const auto& e: hitDoublets) + hitDoubletsPtr.emplace_back(&e); + + hitQuadruplets(region, result, hitDoubletsPtr, g, es); + theLayerCache.clear(); +} + +void CAHitQuadrupletGenerator::hitQuadruplets(const IntermediateHitDoublets::RegionLayerSets& regionLayerPairs, + OrderedHitSeeds& result, + const edm::EventSetup& es, + const SeedingLayerSetsHits& layers) { + CAGraph g; + + std::vector hitDoublets; + + auto layerPairEqual = [](const IntermediateHitDoublets::LayerPairHitDoublets& pair, + SeedingLayerSetsHits::LayerIndex inner, + SeedingLayerSetsHits::LayerIndex outer) { + return pair.innerLayerIndex() == inner && pair.outerLayerIndex() == outer; + }; + fillGraph(layers, g, hitDoublets, [&](const SeedingLayerSetsHits::SeedingLayer& inner, const SeedingLayerSetsHits::SeedingLayer& outer, std::vector& hitDoublets) { + using namespace std::placeholders; + auto found = std::find_if(regionLayerPairs.begin(), regionLayerPairs.end(), std::bind(layerPairEqual, _1, inner.index(), outer.index())); + if(found != regionLayerPairs.end()) { + hitDoublets.emplace_back(&(found->doublets())); + return true; + } + return false; + }); + + hitQuadruplets(regionLayerPairs.region(), result, hitDoublets, g, es); +} + +void CAHitQuadrupletGenerator::hitQuadruplets(const TrackingRegion& region, + OrderedHitSeeds & result, + std::vector& hitDoublets, const CAGraph& g, + const edm::EventSetup& es) { const int numberOfHitsInNtuplet = 4; std::vector foundQuadruplets; @@ -187,6 +269,11 @@ void CAHitQuadrupletGenerator::hitQuadruplets(const TrackingRegion& region, ges[3] = ahit->globalPositionError(); barrels[3] = isBarrel(ahit->geographicalId().subdetId()); + // TODO: + // - 'line' is not used for anything + // - if we decide to always do the circle fit for 4 hits, we don't + // need ThirdHitPredictionFromCircle for the curvature; then we + // could remove extraHitRPhitolerance configuration parameter PixelRecoLineRZ line(gps[0], gps[2]); ThirdHitPredictionFromCircle predictionRPhi(gps[0], gps[2], extraHitRPhitolerance); const float curvature = predictionRPhi.curvature(ThirdHitPredictionFromCircle::Vector2D(gps[1].x(), gps[1].y())); @@ -246,8 +333,6 @@ void CAHitQuadrupletGenerator::hitQuadruplets(const TrackingRegion& region, result.emplace_back(foundQuadruplets[quadId][0]->getInnerHit(), foundQuadruplets[quadId][1]->getInnerHit(), foundQuadruplets[quadId][2]->getInnerHit(), foundQuadruplets[quadId][2]->getOuterHit()); } - - theLayerCache.clear(); } diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletGenerator.h b/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletGenerator.h index 4defa0177cd37..2ff6d5b46e6b8 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletGenerator.h +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletGenerator.h @@ -17,15 +17,16 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/EDGetToken.h" +#include "RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h" + class TrackingRegion; class HitQuadrupletGeneratorFromTripletAndLayers; class SeedingLayerSetsHits; namespace edm { class Event; -} -namespace edm { class EventSetup; + class ParameterSetDescription; } class CAHitQuadrupletGenerator : public HitQuadrupletGenerator { @@ -34,16 +35,33 @@ class CAHitQuadrupletGenerator : public HitQuadrupletGenerator { public: - CAHitQuadrupletGenerator(const edm::ParameterSet& cfg, edm::ConsumesCollector& iC); + CAHitQuadrupletGenerator(const edm::ParameterSet& cfg, edm::ConsumesCollector&& iC, bool needSeedingLayerSetsHits=true): CAHitQuadrupletGenerator(cfg, iC, needSeedingLayerSetsHits) {} + CAHitQuadrupletGenerator(const edm::ParameterSet& cfg, edm::ConsumesCollector& iC, bool needSeedingLayerSetsHits=true); virtual ~CAHitQuadrupletGenerator(); + static void fillDescriptions(edm::ParameterSetDescription& desc); + + void initEvent(const edm::Event& ev, const edm::EventSetup& es); + + /// from base class virtual void hitQuadruplets(const TrackingRegion& reg, OrderedHitSeeds & quadruplets, const edm::Event & ev, const edm::EventSetup& es); + // new-style + void hitQuadruplets(const IntermediateHitDoublets::RegionLayerSets& regionLayerPairs, + OrderedHitSeeds& result, + const edm::EventSetup& es, + const SeedingLayerSetsHits& layers); private: + // actual work + void hitQuadruplets(const TrackingRegion& reg, OrderedHitSeeds& result, + std::vector& hitDoublets, + const CAGraph& g, + const edm::EventSetup& es); + edm::EDGetTokenT theSeedingLayerToken; LayerCacheType theLayerCache; diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CellularAutomaton.cc b/RecoPixelVertexing/PixelTriplets/plugins/CellularAutomaton.cc index 78d5e34a39d12..169b171d81e7e 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CellularAutomaton.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/CellularAutomaton.cc @@ -1,6 +1,6 @@ #include "CellularAutomaton.h" -void CellularAutomaton::createAndConnectCells(const std::vector& hitDoublets, const TrackingRegion& region, +void CellularAutomaton::createAndConnectCells(const std::vector& hitDoublets, const TrackingRegion& region, const float thetaCut, const float phiCut, const float hardPtCut) { unsigned int cellId = 0; @@ -48,7 +48,7 @@ void CellularAutomaton::createAndConnectCells(const std::vector& hi { const HitDoublets* doubletLayerPairId = - &(hitDoublets[currentLayerPair]); + hitDoublets[currentLayerPair]; auto numberOfDoublets = doubletLayerPairId->size(); currentLayerPairRef.theFoundCells.reserve(numberOfDoublets); for (unsigned int i = 0; i < numberOfDoublets; ++i) diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CellularAutomaton.h b/RecoPixelVertexing/PixelTriplets/plugins/CellularAutomaton.h index dca4de1e197f0..d5db16f9a34c9 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CellularAutomaton.h +++ b/RecoPixelVertexing/PixelTriplets/plugins/CellularAutomaton.h @@ -14,7 +14,7 @@ class CellularAutomaton } - void createAndConnectCells(const std::vector&, + void createAndConnectCells(const std::vector&, const TrackingRegion&, const float, const float, const float); void evolve(const unsigned int); diff --git a/RecoPixelVertexing/PixelTriplets/python/CAHitQuadrupletGenerator_cfi.py b/RecoPixelVertexing/PixelTriplets/python/CAHitQuadrupletGenerator_cfi.py index c25177f3c8de8..ef48a99f2181f 100644 --- a/RecoPixelVertexing/PixelTriplets/python/CAHitQuadrupletGenerator_cfi.py +++ b/RecoPixelVertexing/PixelTriplets/python/CAHitQuadrupletGenerator_cfi.py @@ -2,6 +2,7 @@ CAHitQuadrupletGenerator = cms.PSet( ComponentName = cms.string("CAHitQuadrupletGenerator"), + SeedingLayers = cms.InputTag("seedingLayersEDProducer"), extraHitRPhitolerance = cms.double(0.1), maxChi2 = cms.PSet( pt1 = cms.double(0.2), pt2 = cms.double(1.5), diff --git a/RecoTracker/Configuration/python/customiseForQuadrupletsByCellularAutomaton.py b/RecoTracker/Configuration/python/customiseForQuadrupletsByCellularAutomaton.py index 7f66a385a9230..daac43c60e44c 100644 --- a/RecoTracker/Configuration/python/customiseForQuadrupletsByCellularAutomaton.py +++ b/RecoTracker/Configuration/python/customiseForQuadrupletsByCellularAutomaton.py @@ -1,40 +1,90 @@ import FWCore.ParameterSet.Config as cms -def customiseForQuadrupletsByCellularAutomaton(process): - for module in process._Process__producers.values(): - if not hasattr(module, "OrderedHitsFactoryPSet"): - continue - pset = getattr(module, "OrderedHitsFactoryPSet") - if not hasattr(pset, "ComponentName"): - continue - if not (pset.ComponentName == "CombinedHitQuadrupletGenerator"): - continue - # Adjust seeding layers - seedingLayersName = module.OrderedHitsFactoryPSet.SeedingLayers.getModuleLabel() +_CAParameters = dict( + maxChi2 = dict( + pt1 = 0.8, pt2 = 2, + value1 = 200, value2 = 100, + enabled = True, + ), + useBendingCorrection = True, + fitFastCircle = True, + fitFastCircleChi2Cut = True, + CAThetaCut = 0.00125, + CAPhiCut = 0.1, + CAHardPtCut = 0, +) + +def customiseLegacySeeding(module): + pset = getattr(module, "OrderedHitsFactoryPSet") + if not hasattr(pset, "ComponentName"): + return + if pset.ComponentName != "CombinedHitQuadrupletGenerator": + return + # Adjust seeding layers + seedingLayersName = module.OrderedHitsFactoryPSet.SeedingLayers.getModuleLabel() + # Configure seed generator / pixel track producer + quadruplets = module.OrderedHitsFactoryPSet.clone() + from RecoPixelVertexing.PixelTriplets.CAHitQuadrupletGenerator_cfi import CAHitQuadrupletGenerator as _CAHitQuadrupletGenerator + + module.OrderedHitsFactoryPSet = _CAHitQuadrupletGenerator.clone( + ComponentName = "CAHitQuadrupletGenerator", + extraHitRPhitolerance = quadruplets.GeneratorPSet.extraHitRPhitolerance, + SeedingLayers = seedingLayersName, + **_CAParameters + ) + + if hasattr(quadruplets.GeneratorPSet, "SeedComparitorPSet"): + module.OrderedHitsFactoryPSet.SeedComparitorPSet = quadruplets.GeneratorPSet.SeedComparitorPSet + +def customiseNewSeeding(process, module): + tripletModuleName = module.triplets.getModuleLabel() + tripletModule = getattr(process, tripletModuleName) + doubletModuleName = tripletModule.doublets.getModuleLabel() + doubletModule = getattr(process, doubletModuleName) + + # Generate doublets for all adjacent layer pairs + doubletModule.layerPairs = [ + 0, # layer pair (0,1) + 1, # layer pair (1,2) + 2 # layer pair (2,3) + ] + # Bit of a hack to replace a module with another, but works + # + # In principle setattr(process) could work too, but it expands the + # sequences and I don't want that + modifier = cms.Modifier() + modifier._setChosen() + + # Replace quadruplet generator with the CA version + from RecoPixelVertexing.PixelTriplets.caHitQuadrupletEDProducer_cfi import caHitQuadrupletEDProducer as _caHitQuadrupletEDProducer + modifier.toReplaceWith(module, _caHitQuadrupletEDProducer.clone( + doublets = doubletModuleName, + SeedComparitorPSet = module.SeedComparitorPSet.clone(), + extraHitRPhitolerance = module.extraHitRPhitolerance, + **_CAParameters + )) + + # Remove triplet generator from all sequence and paths + for seqs in [process.sequences_(), process.paths_()]: + for seqName, seq in seqs.iteritems(): + # cms.Sequence.remove() would look simpler, but it expands + # the contained sequences if a replacement occurs there. + try: + index = seq.index(tripletModule) + except: + continue + + seq.remove(tripletModule) + + delattr(process, tripletModuleName) + +def customiseForQuadrupletsByCellularAutomaton(process): + for module in process._Process__producers.values(): + if hasattr(module, "OrderedHitsFactoryPSet"): + customiseLegacySeeding(module) + elif module._TypedParameterizable__type == "PixelQuadrupletEDProducer": + customiseNewSeeding(process, module) - # Configure seed generator / pixel track producer - quadruplets = module.OrderedHitsFactoryPSet.clone() - from RecoPixelVertexing.PixelTriplets.CAHitQuadrupletGenerator_cfi import CAHitQuadrupletGenerator as _CAHitQuadrupletGenerator - - module.OrderedHitsFactoryPSet = _CAHitQuadrupletGenerator.clone( - ComponentName = cms.string("CAHitQuadrupletGenerator"), - extraHitRPhitolerance = quadruplets.GeneratorPSet.extraHitRPhitolerance, - maxChi2 = dict( - pt1 = 0.8, pt2 = 2, - value1 = 200, value2 = 100, - enabled = True, - ), - useBendingCorrection = True, - fitFastCircle = True, - fitFastCircleChi2Cut = True, - SeedingLayers = cms.InputTag(seedingLayersName), - CAThetaCut = cms.double(0.00125), - CAPhiCut = cms.double(0.1), - CAHardPtCut = cms.double(0), - ) - - if hasattr(quadruplets.GeneratorPSet, "SeedComparitorPSet"): - module.OrderedHitsFactoryPSet.SeedComparitorPSet = quadruplets.GeneratorPSet.SeedComparitorPSet return process diff --git a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc index 134c5f4bed19e..42f4b6f0f060f 100644 --- a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc +++ b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc @@ -14,7 +14,6 @@ #include "RecoTracker/TkHitPairs/interface/HitPairGeneratorFromLayerPair.h" #include "RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h" #include "RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h" -#include "RecoPixelVertexing/PixelTriplets/interface/LayerTriplets.h" class HitPairEDProducer: public edm::stream::EDProducer<> { public: @@ -35,6 +34,7 @@ class HitPairEDProducer: public edm::stream::EDProducer<> { const unsigned int maxElement_; HitPairGeneratorFromLayerPair generator_; + std::vector layerPairBegins_; const bool produceSeedingHitSets_; const bool produceIntermediateHitDoublets_; @@ -46,13 +46,17 @@ HitPairEDProducer::HitPairEDProducer(const edm::ParameterSet& iConfig): regionToken_(consumes >(iConfig.getParameter("trackingRegions"))), clusterCheckToken_(consumes(iConfig.getParameter("clusterCheck"))), maxElement_(iConfig.getParameter("maxElement")), - generator_(0, 1, nullptr, maxElement_), // TODO: make layer indices configurable? + generator_(0, 1, nullptr, maxElement_), // these indices are dummy, TODO: cleanup HitPairGeneratorFromLayerPair + layerPairBegins_(iConfig.getParameter >("layerPairs")), produceSeedingHitSets_(iConfig.getParameter("produceSeedingHitSets")), produceIntermediateHitDoublets_(iConfig.getParameter("produceIntermediateHitDoublets")) { if(!produceIntermediateHitDoublets_ && !produceSeedingHitSets_) throw cms::Exception("Configuration") << "HitPairEDProducer requires either produceIntermediateHitDoublets or produceSeedingHitSets to be True. If neither are needed, just remove this module from your sequence/path as it doesn't do anything useful"; + if(layerPairBegins_.empty()) + throw cms::Exception("Configuration") << "HitPairEDProducer requires at least index for layer pairs (layerPairs parameter), none was given"; + if(produceSeedingHitSets_) produces(); if(produceIntermediateHitDoublets_) @@ -68,6 +72,7 @@ void HitPairEDProducer::fillDescriptions(edm::ConfigurationDescriptions& descrip desc.add("produceSeedingHitSets", false); desc.add("produceIntermediateHitDoublets", false); desc.add("maxElement", 1000000); + desc.add >("layerPairs", std::vector{{0}})->setComment("Indices to the pairs of consecutive layers, i.e. 0 means (0,1), 1 (1,2) etc."); descriptions.add("hitPairEDProducer", desc); } @@ -110,19 +115,38 @@ void HitPairEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetu LogDebug("HitPairEDProducer") << "Creating doublets for " << regions.size() << " and " << layers.size() << " layer sets"; - // This is the easiest way to extract the layer pairs from the full - // set of seeding layers. It feels a bit stupid to do it for each - // event given the input is defined in configuration. Maybe do it - // once-per-job in SeedingLayerSetsEDProducer? std::vector layerPairs; if(layers.numberOfLayersInSet() > 2) { - std::vector trilayers = LayerTriplets::layers(layers); - layerPairs.reserve(trilayers.size()); - for(const auto& setAndLayers: trilayers) { - layerPairs.push_back(setAndLayers.first); + for(const auto& layerSet: layers) { + for(const auto pairBeginIndex: layerPairBegins_) { + if(pairBeginIndex+1 >= layers.numberOfLayersInSet()) { + throw cms::Exception("Configuration") << "Layer pair index " << pairBeginIndex << " is out of bounds, input SeedingLayerSetsHits has only " << layers.numberOfLayersInSet() << " layers per set, and the index+1 must be < than the number of layers in set"; + } + + // Take only the requested pair of the set + SeedingLayerSetsHits::SeedingLayerSet pairCandidate = layerSet.slice(pairBeginIndex, pairBeginIndex+1); + + // it would be trivial to use 128-bit bitfield for O(1) check + // if a layer pair has been inserted, but let's test first how + // a "straightforward" solution works + auto found = std::find_if(layerPairs.begin(), layerPairs.end(), [&](const SeedingLayerSetsHits::SeedingLayerSet& pair) { + return pair[0].index() == pairCandidate[0].index() && pair[1].index() == pairCandidate[1].index(); + }); + if(found != layerPairs.end()) + continue; + + layerPairs.push_back(pairCandidate); + } } } else { + if(layerPairBegins_.size() != 1) { + throw cms::Exception("Configuration") << "With pairs of input layers, it doesn't make sense to specify more than one input layer pair, got " << layerPairBegins_.size(); + } + if(layerPairBegins_[0] != 0) { + throw cms::Exception("Configuration") << "With pairs of input layers, it doesn't make sense to specify other input layer pair than 0; got " << layerPairBegins_[0]; + } + layerPairs.reserve(layers.size()); for(const auto& set: layers) layerPairs.push_back(set); diff --git a/TrackingTools/TransientTrackingRecHit/interface/SeedingLayerSetsHits.h b/TrackingTools/TransientTrackingRecHit/interface/SeedingLayerSetsHits.h index 70840a54f5f11..c4fbacadca81b 100644 --- a/TrackingTools/TransientTrackingRecHit/interface/SeedingLayerSetsHits.h +++ b/TrackingTools/TransientTrackingRecHit/interface/SeedingLayerSetsHits.h @@ -107,6 +107,25 @@ class SeedingLayerSetsHits { /// Number of layers in this set LayerSetIndex size() const { return end_-begin_; } + /** + * Slices the layer set + * + * E.g. slicing BPix1+BPix2+BPix3+BPix4 with (0,2) will give + * BPix1+BPix2. + * + * \param begin Index for the first layer of the slice + * \param end Index for the one-beyond-last layer of the slice + * + * It is caller's responsibility to guarantee that "begin < + * size()" and "0 < end <= size()" and "begin < end". + */ + SeedingLayerSet slice(size_t begin, size_t end) const { + assert(begin < size()); + assert(0 < end && end <= size()); + assert(begin < end); + return SeedingLayerSet(seedingLayerSets_, begin_+begin, begin_+end); + } + /// Get a given SeedingLayer (index is between 0 and size()-1) SeedingLayer operator[](LayerSetIndex index) const { return SeedingLayer(seedingLayerSets_, *(begin_+index)); From d3e4cd4d19552ad66adb7d15821d6c485cb0105b Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 29 Sep 2016 16:26:09 +0200 Subject: [PATCH 44/69] Migrate CAHiTripletGenerator and generalize --- .../plugins/CAHitNtupletEDProducerT.cc | 118 +++++++++++++++ .../plugins/CAHitQuadrupletEDProducer.cc | 93 ------------ .../plugins/CAHitQuadrupletGenerator.cc | 2 +- .../plugins/CAHitQuadrupletGenerator.h | 12 +- .../plugins/CAHitTripletGenerator.cc | 135 ++++++++++++++---- .../plugins/CAHitTripletGenerator.h | 28 +++- .../plugins/CellularAutomaton.cc | 4 +- .../PixelTriplets/plugins/CellularAutomaton.h | 2 +- .../python/CAHitTripletGenerator_cfi.py | 1 + ...customiseForTripletsByCellularAutomaton.py | 106 +++++++++----- 10 files changed, 338 insertions(+), 163 deletions(-) create mode 100644 RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletEDProducerT.cc delete mode 100644 RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletEDProducer.cc diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletEDProducerT.cc b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletEDProducerT.cc new file mode 100644 index 0000000000000..46d98c0094332 --- /dev/null +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletEDProducerT.cc @@ -0,0 +1,118 @@ +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Utilities/interface/EDGetToken.h" +#include "FWCore/Framework/interface/Event.h" +#include "DataFormats/Common/interface/Handle.h" +#include "FWCore/Utilities/interface/RunningAverage.h" + +#include "RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h" +#include "RecoPixelVertexing/PixelTriplets/interface/OrderedHitTriplets.h" +#include "RecoPixelVertexing/PixelTriplets/interface/OrderedHitSeeds.h" +#include "RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h" + +namespace { + void fillNtuplets(RegionsSeedingHitSets::RegionFiller& seedingHitSetsFiller, + const OrderedHitTriplets& triplets) { + for(const auto& triplet: triplets) { + seedingHitSetsFiller.emplace_back(triplet[0], triplet[1], triplet[2]); + } + } + + void fillNtuplets(RegionsSeedingHitSets::RegionFiller& seedingHitSetsFiller, + const OrderedHitSeeds& quadruplets) { + for(const auto& quad: quadruplets) { + seedingHitSetsFiller.emplace_back(quad[0], quad[1], quad[2], quad[3]); + } + } +} + +template +class CAHitNtupletEDProducerT: public edm::stream::EDProducer<> { +public: + CAHitNtupletEDProducerT(const edm::ParameterSet& iConfig); + ~CAHitNtupletEDProducerT() = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + virtual void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override; + +private: + edm::EDGetTokenT doubletToken_; + + edm::RunningAverage localRA_; + + T_Generator generator_; +}; + +template +CAHitNtupletEDProducerT::CAHitNtupletEDProducerT(const edm::ParameterSet& iConfig): + doubletToken_(consumes(iConfig.getParameter("doublets"))), + generator_(iConfig, consumesCollector(), false) +{ + produces(); +} + +template +void CAHitNtupletEDProducerT::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + + desc.add("doublets", edm::InputTag("hitPairEDProducer")); + T_Generator::fillDescriptions(desc); + + auto label = T_Generator::fillDescriptionsLabel() + std::string("EDProducer"); + descriptions.add(label, desc); +} + +template +void CAHitNtupletEDProducerT::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + edm::Handle hdoublets; + iEvent.getByToken(doubletToken_, hdoublets); + const auto& regionDoublets = *hdoublets; + + const SeedingLayerSetsHits& seedingLayerHits = regionDoublets.seedingLayerHits(); + if(seedingLayerHits.numberOfLayersInSet() < T_Generator::minLayers) { + throw cms::Exception("Configuration") << "CAHitNtupletEDProducer expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= " << T_Generator::minLayers << ", got " << seedingLayerHits.numberOfLayersInSet(); + } + + auto seedingHitSets = std::make_unique(); + if(regionDoublets.empty()) { + iEvent.put(std::move(seedingHitSets)); + return; + } + seedingHitSets->reserve(regionDoublets.regionSize(), localRA_.upper()); + generator_.initEvent(iEvent, iSetup); + + LogDebug("CAHitNtupletEDProducer") << "Creating ntuplets for " << regionDoublets.regionSize() << " regions, and " << regionDoublets.layerPairsSize() << " layer pairs"; + + typename T_Generator::ResultType ntuplets; + ntuplets.reserve(localRA_.upper()); + + for(const auto& regionLayerPairs: regionDoublets) { + const TrackingRegion& region = regionLayerPairs.region(); + auto seedingHitSetsFiller = seedingHitSets->beginRegion(®ion); + + LogTrace("CAHitNtupletEDProducer") << " starting region"; + + generator_.hitNtuplets(regionLayerPairs, ntuplets, iSetup, seedingLayerHits); + LogTrace("CAHitNtupletEDProducer") << " created " << ntuplets.size() << " ntuplets"; + fillNtuplets(seedingHitSetsFiller, ntuplets); + + ntuplets.clear(); + } + localRA_.update(seedingHitSets->size()); + + iEvent.put(std::move(seedingHitSets)); +} + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "CAHitQuadrupletGenerator.h" +using CAHitQuadrupletEDProducer = CAHitNtupletEDProducerT; +DEFINE_FWK_MODULE(CAHitQuadrupletEDProducer); + +#include "CAHitTripletGenerator.h" +using CAHitTripletEDProducer = CAHitNtupletEDProducerT; +DEFINE_FWK_MODULE(CAHitTripletEDProducer); diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletEDProducer.cc b/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletEDProducer.cc deleted file mode 100644 index 370211ffa9c38..0000000000000 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletEDProducer.cc +++ /dev/null @@ -1,93 +0,0 @@ -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" -#include "FWCore/Utilities/interface/EDGetToken.h" -#include "FWCore/Framework/interface/Event.h" -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Utilities/interface/RunningAverage.h" - -#include "RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h" -#include "RecoPixelVertexing/PixelTriplets/interface/OrderedHitSeeds.h" -#include "RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h" - -#include "CAHitQuadrupletGenerator.h" - -class CAHitQuadrupletEDProducer: public edm::stream::EDProducer<> { -public: - CAHitQuadrupletEDProducer(const edm::ParameterSet& iConfig); - ~CAHitQuadrupletEDProducer() = default; - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - - virtual void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override; - -private: - edm::EDGetTokenT doubletToken_; - - edm::RunningAverage localRA_; - - CAHitQuadrupletGenerator generator_; -}; - -CAHitQuadrupletEDProducer::CAHitQuadrupletEDProducer(const edm::ParameterSet& iConfig): - doubletToken_(consumes(iConfig.getParameter("doublets"))), - generator_(iConfig, consumesCollector(), false) -{ - produces(); -} - -void CAHitQuadrupletEDProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - edm::ParameterSetDescription desc; - - desc.add("doublets", edm::InputTag("hitPairEDProducer")); - CAHitQuadrupletGenerator::fillDescriptions(desc); - - descriptions.add("caHitQuadrupletEDProducer", desc); -} - -void CAHitQuadrupletEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { - edm::Handle hdoublets; - iEvent.getByToken(doubletToken_, hdoublets); - const auto& regionDoublets = *hdoublets; - - const SeedingLayerSetsHits& seedingLayerHits = regionDoublets.seedingLayerHits(); - if(seedingLayerHits.numberOfLayersInSet() < 4) { - throw cms::Exception("Configuration") << "CAHitQuadrupletEDProducer expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= 4, got " << seedingLayerHits.numberOfLayersInSet(); - } - - auto seedingHitSets = std::make_unique(); - if(regionDoublets.empty()) { - iEvent.put(std::move(seedingHitSets)); - return; - } - seedingHitSets->reserve(regionDoublets.regionSize(), localRA_.upper()); - generator_.initEvent(iEvent, iSetup); - - LogDebug("CAHitQuadrupletEDProducer") << "Creating quadruplets for " << regionDoublets.regionSize() << " regions, and " << regionDoublets.layerPairsSize() << " layer pairs"; - - OrderedHitSeeds quadruplets; - quadruplets.reserve(localRA_.upper()); - - for(const auto& regionLayerPairs: regionDoublets) { - const TrackingRegion& region = regionLayerPairs.region(); - auto seedingHitSetsFiller = seedingHitSets->beginRegion(®ion); - - LogTrace("CAHitQuadrupletEDProducer") << " starting region"; - - generator_.hitQuadruplets(regionLayerPairs, quadruplets, iSetup, seedingLayerHits); - LogTrace("CAHitQuadrupletEDProducer") << " created " << quadruplets.size() << " quadruplets"; - - for(const auto& quad: quadruplets) { - seedingHitSetsFiller.emplace_back(quad[0], quad[1], quad[2], quad[3]); - } - quadruplets.clear(); - } - localRA_.update(seedingHitSets->size()); - - iEvent.put(std::move(seedingHitSets)); -} - -#include "FWCore/Framework/interface/MakerMacros.h" -DEFINE_FWK_MODULE(CAHitQuadrupletEDProducer); diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletGenerator.cc b/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletGenerator.cc index b951014c44a65..96888394fa6e7 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletGenerator.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletGenerator.cc @@ -193,7 +193,7 @@ void CAHitQuadrupletGenerator::hitQuadruplets(const TrackingRegion& region, theLayerCache.clear(); } -void CAHitQuadrupletGenerator::hitQuadruplets(const IntermediateHitDoublets::RegionLayerSets& regionLayerPairs, +void CAHitQuadrupletGenerator::hitNtuplets(const IntermediateHitDoublets::RegionLayerSets& regionLayerPairs, OrderedHitSeeds& result, const edm::EventSetup& es, const SeedingLayerSetsHits& layers) { diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletGenerator.h b/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletGenerator.h index 2ff6d5b46e6b8..34e2635fbcce2 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletGenerator.h +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletGenerator.h @@ -33,6 +33,9 @@ class CAHitQuadrupletGenerator : public HitQuadrupletGenerator { public: typedef LayerHitMapCache LayerCacheType; + static constexpr unsigned int minLayers = 4; + typedef OrderedHitSeeds ResultType; + public: CAHitQuadrupletGenerator(const edm::ParameterSet& cfg, edm::ConsumesCollector&& iC, bool needSeedingLayerSetsHits=true): CAHitQuadrupletGenerator(cfg, iC, needSeedingLayerSetsHits) {} @@ -41,6 +44,7 @@ class CAHitQuadrupletGenerator : public HitQuadrupletGenerator { virtual ~CAHitQuadrupletGenerator(); static void fillDescriptions(edm::ParameterSetDescription& desc); + static const char *fillDescriptionsLabel() { return "caHitQuadruplet"; } void initEvent(const edm::Event& ev, const edm::EventSetup& es); @@ -50,10 +54,10 @@ class CAHitQuadrupletGenerator : public HitQuadrupletGenerator { const edm::Event & ev, const edm::EventSetup& es); // new-style - void hitQuadruplets(const IntermediateHitDoublets::RegionLayerSets& regionLayerPairs, - OrderedHitSeeds& result, - const edm::EventSetup& es, - const SeedingLayerSetsHits& layers); + void hitNtuplets(const IntermediateHitDoublets::RegionLayerSets& regionLayerPairs, + OrderedHitSeeds& result, + const edm::EventSetup& es, + const SeedingLayerSetsHits& layers); private: // actual work diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitTripletGenerator.cc b/RecoPixelVertexing/PixelTriplets/plugins/CAHitTripletGenerator.cc index 952441ff1854a..c38eef6699921 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAHitTripletGenerator.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAHitTripletGenerator.cc @@ -5,6 +5,7 @@ #include "RecoPixelVertexing/PixelTriplets/interface/ThirdHitPredictionFromCircle.h" #include "RecoPixelVertexing/PixelTriplets/interface/HitTripletGenerator.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/Event.h" #include "DataFormats/Common/interface/Handle.h" @@ -31,8 +32,8 @@ using namespace std; using namespace ctfseeding; CAHitTripletGenerator::CAHitTripletGenerator(const edm::ParameterSet& cfg, - edm::ConsumesCollector& iC) : - theSeedingLayerToken(iC.consumes < SeedingLayerSetsHits > (cfg.getParameter < edm::InputTag > ("SeedingLayers"))), + edm::ConsumesCollector& iC, + bool needSeedingLayerSetsHits) : extraHitRPhitolerance(cfg.getParameter("extraHitRPhitolerance")), //extra window in ThirdHitPredictionFromCircle range (divide by R to get phi) maxChi2(cfg.getParameter < edm::ParameterSet > ("maxChi2")), useBendingCorrection(cfg.getParameter("useBendingCorrection")), @@ -40,6 +41,10 @@ CAHitTripletGenerator::CAHitTripletGenerator(const edm::ParameterSet& cfg, caPhiCut(cfg.getParameter("CAPhiCut")), caHardPtCut(cfg.getParameter("CAHardPtCut")) { + + if(needSeedingLayerSetsHits) + theSeedingLayerToken = iC.consumes(cfg.getParameter("SeedingLayers")); + if (cfg.exists("SeedComparitorPSet")) { edm::ParameterSet comparitorPSet = cfg.getParameter < edm::ParameterSet @@ -59,23 +64,36 @@ CAHitTripletGenerator::~CAHitTripletGenerator() { } -void CAHitTripletGenerator::hitTriplets(const TrackingRegion& region, - OrderedHitTriplets & result, const edm::Event& ev, - const edm::EventSetup& es) -{ - edm::Handle hlayers; - ev.getByToken(theSeedingLayerToken, hlayers); - const SeedingLayerSetsHits& layers = *hlayers; - if (layers.numberOfLayersInSet() != 3) - throw cms::Exception("Configuration") - << "CAHitTripletGenerator expects SeedingLayerSetsHits::numberOfLayersInSet() to be 3, got " - << layers.numberOfLayersInSet(); +void CAHitTripletGenerator::fillDescriptions(edm::ParameterSetDescription& desc) { + desc.add("extraHitRPhitolerance", 0.06); + desc.add("useBendingCorrection", false); + desc.add("CAThetaCut", 0.00125); + desc.add("CAPhiCut", 0.1); + desc.add("CAHardPtCut", 0); + + edm::ParameterSetDescription descMaxChi2; + descMaxChi2.add("pt1", 0.8); + descMaxChi2.add("pt2", 2); + descMaxChi2.add("value1", 50); + descMaxChi2.add("value2", 8); + descMaxChi2.add("enabled", true); + desc.add("maxChi2", descMaxChi2); + + edm::ParameterSetDescription descComparitor; + descComparitor.add("ComponentName", "none"); + descComparitor.setAllowAnything(); // until we have moved SeedComparitor too to EDProducers + desc.add("SeedComparitorPSet", descComparitor); +} - CAGraph g; +void CAHitTripletGenerator::initEvent(const edm::Event& ev, const edm::EventSetup& es) { + if (theComparitor) theComparitor->init(ev, es); +} - std::vector hitDoublets; +namespace { + template + void fillGraph(const SeedingLayerSetsHits& layers, CAGraph& g, T_HitDoublets& hitDoublets, + T_GeneratorOrPairsFunction generatorOrPairsFunction) { - HitPairGeneratorFromLayerPair thePairGenerator(0, 1, &theLayerCache); for (unsigned int i = 0; i < layers.size(); i++) { for (unsigned int j = 0; j < 3; ++j) @@ -116,29 +134,94 @@ void CAHitTripletGenerator::hitTriplets(const TrackingRegion& region, if (std::find(g.theLayerPairs.begin(), g.theLayerPairs.end(), tmpInnerLayerPair) == g.theLayerPairs.end()) { - hitDoublets.emplace_back( - thePairGenerator.doublets(region, ev, es, - layers[i][j - 1], layers[i][j])); - - g.theLayerPairs.push_back(tmpInnerLayerPair); - g.theLayers[vertexIndex].theInnerLayers.push_back( + const bool nonEmpty = generatorOrPairsFunction(layers[i][j - 1], layers[i][j], hitDoublets); + if(nonEmpty) { + g.theLayerPairs.push_back(tmpInnerLayerPair); + g.theLayers[vertexIndex].theInnerLayers.push_back( innerVertex - g.theLayers.begin()); - innerVertex->theOuterLayers.push_back(vertexIndex); - g.theLayers[vertexIndex].theInnerLayerPairs.push_back( + innerVertex->theOuterLayers.push_back(vertexIndex); + g.theLayers[vertexIndex].theInnerLayerPairs.push_back( g.theLayerPairs.size() - 1); - innerVertex->theOuterLayerPairs.push_back( + innerVertex->theOuterLayerPairs.push_back( g.theLayerPairs.size() - 1); - + } } } } } + } +} + +void CAHitTripletGenerator::hitTriplets(const TrackingRegion& region, + OrderedHitTriplets & result, const edm::Event& ev, + const edm::EventSetup& es) +{ + edm::Handle hlayers; + ev.getByToken(theSeedingLayerToken, hlayers); + const SeedingLayerSetsHits& layers = *hlayers; + if (layers.numberOfLayersInSet() != 3) + throw cms::Exception("Configuration") + << "CAHitTripletGenerator expects SeedingLayerSetsHits::numberOfLayersInSet() to be 3, got " + << layers.numberOfLayersInSet(); + + CAGraph g; + + std::vector hitDoublets; + + + + HitPairGeneratorFromLayerPair thePairGenerator(0, 1, &theLayerCache); + fillGraph(layers, g, hitDoublets, [&](const SeedingLayerSetsHits::SeedingLayer& inner, const SeedingLayerSetsHits::SeedingLayer& outer, std::vector& hitDoublets) { + hitDoublets.emplace_back(thePairGenerator.doublets(region, ev, es, inner, outer)); + return true; + }); + if (theComparitor) theComparitor->init(ev, es); + std::vector hitDoubletsPtr; + hitDoubletsPtr.reserve(hitDoublets.size()); + for(const auto& e: hitDoublets) + hitDoubletsPtr.emplace_back(&e); + + hitTriplets(region, result, hitDoubletsPtr, g, es); + theLayerCache.clear(); +} + +void CAHitTripletGenerator::hitNtuplets(const IntermediateHitDoublets::RegionLayerSets& regionLayerPairs, + OrderedHitTriplets& result, + const edm::EventSetup& es, + const SeedingLayerSetsHits& layers) { + CAGraph g; + + std::vector hitDoublets; + + auto layerPairEqual = [](const IntermediateHitDoublets::LayerPairHitDoublets& pair, + SeedingLayerSetsHits::LayerIndex inner, + SeedingLayerSetsHits::LayerIndex outer) { + return pair.innerLayerIndex() == inner && pair.outerLayerIndex() == outer; + }; + fillGraph(layers, g, hitDoublets, [&](const SeedingLayerSetsHits::SeedingLayer& inner, const SeedingLayerSetsHits::SeedingLayer& outer, std::vector& hitDoublets) { + using namespace std::placeholders; + auto found = std::find_if(regionLayerPairs.begin(), regionLayerPairs.end(), std::bind(layerPairEqual, _1, inner.index(), outer.index())); + if(found != regionLayerPairs.end()) { + hitDoublets.emplace_back(&(found->doublets())); + return true; + } + return false; + }); + + hitTriplets(regionLayerPairs.region(), result, hitDoublets, g, es); +} + + +void CAHitTripletGenerator::hitTriplets(const TrackingRegion& region, + OrderedHitTriplets & result, + std::vector& hitDoublets, const CAGraph& g, + const edm::EventSetup& es) { std::vector foundTriplets; CellularAutomaton ca(g); diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitTripletGenerator.h b/RecoPixelVertexing/PixelTriplets/plugins/CAHitTripletGenerator.h index 5e84c76074b0c..a7eff0cfc44f1 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAHitTripletGenerator.h +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAHitTripletGenerator.h @@ -9,6 +9,7 @@ #include "RecoTracker/TkMSParametrization/interface/PixelRecoUtilities.h" #include "RecoTracker/TkMSParametrization/interface/LongitudinalBendingCorrection.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" +#include "CAGraph.h" #include "RecoTracker/TkHitPairs/interface/HitPairGeneratorFromLayerPair.h" @@ -16,32 +17,53 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/EDGetToken.h" +#include "RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h" + class TrackingRegion; class SeedingLayerSetsHits; namespace edm { class Event; -} -namespace edm { class EventSetup; + class ParameterSetDescription; } class CAHitTripletGenerator : public HitTripletGenerator { public: typedef LayerHitMapCache LayerCacheType; + static constexpr unsigned int minLayers = 3; + typedef OrderedHitTriplets ResultType; + public: - CAHitTripletGenerator(const edm::ParameterSet& cfg, edm::ConsumesCollector& iC); + CAHitTripletGenerator(const edm::ParameterSet& cfg, edm::ConsumesCollector&& iC, bool needSeedingLayerSetsHits=true): CAHitTripletGenerator(cfg, iC, needSeedingLayerSetsHits) {} + CAHitTripletGenerator(const edm::ParameterSet& cfg, edm::ConsumesCollector& iC, bool needSeedingLayerSetsHits=true); virtual ~CAHitTripletGenerator(); + static void fillDescriptions(edm::ParameterSetDescription& desc); + static const char *fillDescriptionsLabel() { return "caHitTriplet"; } + + void initEvent(const edm::Event& ev, const edm::EventSetup& es); + /// from base class virtual void hitTriplets(const TrackingRegion& reg, OrderedHitTriplets & triplets, const edm::Event & ev, const edm::EventSetup& es); + // new-style + void hitNtuplets(const IntermediateHitDoublets::RegionLayerSets& regionLayerPairs, + OrderedHitTriplets& result, + const edm::EventSetup& es, + const SeedingLayerSetsHits& layers); private: + // actual work + void hitTriplets(const TrackingRegion& reg, OrderedHitTriplets& result, + std::vector& hitDoublets, + const CAGraph& g, + const edm::EventSetup& es); + edm::EDGetTokenT theSeedingLayerToken; LayerCacheType theLayerCache; diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CellularAutomaton.cc b/RecoPixelVertexing/PixelTriplets/plugins/CellularAutomaton.cc index 169b171d81e7e..7a3f7aef73cb1 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CellularAutomaton.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/CellularAutomaton.cc @@ -154,7 +154,7 @@ void CellularAutomaton::findNtuplets( } -void CellularAutomaton::findTriplets(const std::vector& hitDoublets,std::vector& foundTriplets, const TrackingRegion& region, +void CellularAutomaton::findTriplets(const std::vector& hitDoublets,std::vector& foundTriplets, const TrackingRegion& region, const float thetaCut, const float phiCut, const float hardPtCut) { unsigned int cellId = 0; @@ -202,7 +202,7 @@ void CellularAutomaton::findTriplets(const std::vector& hitDoublets { const HitDoublets* doubletLayerPairId = - &(hitDoublets[currentLayerPair]); + hitDoublets[currentLayerPair]; auto numberOfDoublets = doubletLayerPairId->size(); currentLayerPairRef.theFoundCells.reserve(numberOfDoublets); for (unsigned int i = 0; i < numberOfDoublets; ++i) diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CellularAutomaton.h b/RecoPixelVertexing/PixelTriplets/plugins/CellularAutomaton.h index d5db16f9a34c9..ec144f00985a9 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CellularAutomaton.h +++ b/RecoPixelVertexing/PixelTriplets/plugins/CellularAutomaton.h @@ -19,7 +19,7 @@ class CellularAutomaton void evolve(const unsigned int); void findNtuplets(std::vector&, const unsigned int); - void findTriplets(const std::vector& hitDoublets,std::vector& foundTriplets, const TrackingRegion& region, + void findTriplets(const std::vector& hitDoublets,std::vector& foundTriplets, const TrackingRegion& region, const float thetaCut, const float phiCut, const float hardPtCut); private: diff --git a/RecoPixelVertexing/PixelTriplets/python/CAHitTripletGenerator_cfi.py b/RecoPixelVertexing/PixelTriplets/python/CAHitTripletGenerator_cfi.py index d1ac85388022b..907fd7bde55cf 100755 --- a/RecoPixelVertexing/PixelTriplets/python/CAHitTripletGenerator_cfi.py +++ b/RecoPixelVertexing/PixelTriplets/python/CAHitTripletGenerator_cfi.py @@ -2,6 +2,7 @@ CAHitTripletGenerator = cms.PSet( ComponentName = cms.string("CAHitTripletGenerator"), + SeedingLayers = cms.InputTag("seedingLayersEDProducer"), extraHitRPhitolerance = cms.double(0.06), maxChi2 = cms.PSet( pt1 = cms.double(0.8), pt2 = cms.double(2), diff --git a/RecoTracker/Configuration/python/customiseForTripletsByCellularAutomaton.py b/RecoTracker/Configuration/python/customiseForTripletsByCellularAutomaton.py index bffd0ddc0bb96..2a15ace2997ee 100644 --- a/RecoTracker/Configuration/python/customiseForTripletsByCellularAutomaton.py +++ b/RecoTracker/Configuration/python/customiseForTripletsByCellularAutomaton.py @@ -1,38 +1,78 @@ import FWCore.ParameterSet.Config as cms +_CAParameters = dict( + maxChi2 = dict( + pt1 = 0.8, pt2 = 2, + value1 = 20, value2 = 10, + enabled = True, + ), + useBendingCorrection = True, + CAThetaCut = 0.0015, + CAPhiCut = 0.01, + CAHardPtCut = 0, +) + +def customiseLegacySeeding(module): + pset = getattr(module, "OrderedHitsFactoryPSet") + if not hasattr(pset, "ComponentName"): + return + if pset.ComponentName != "StandardHitTripletGenerator": + return + # Adjust seeding layers + seedingLayersName = module.OrderedHitsFactoryPSet.SeedingLayers.getModuleLabel() + + + # Configure seed generator / pixel track producer + Triplets = module.OrderedHitsFactoryPSet.clone() + from RecoPixelVertexing.PixelTriplets.CAHitTripletGenerator_cfi import CAHitTripletGenerator as _CAHitTripletGenerator + + module.OrderedHitsFactoryPSet = _CAHitTripletGenerator.clone( + ComponentName = "CAHitTripletGenerator", + extraHitRPhitolerance = Triplets.GeneratorPSet.extraHitRPhitolerance, + SeedingLayers = seedingLayersName, + **_CAParameters + ) + + if hasattr(Triplets.GeneratorPSet, "SeedComparitorPSet"): + module.OrderedHitsFactoryPSet.SeedComparitorPSet = Triplets.GeneratorPSet.SeedComparitorPSet + +def customiseNewSeeding(process, module): + doubletModuleName = module.doublets.getModuleLabel() + doubletModule = getattr(process, doubletModuleName) + + # Generate doublets for all adjacent layer pairs + doubletModule.layerPairs = [ + 0, # layer pair (0,1) + 1, # layer pair (1,2) + ] + + # Bit of a hack to replace a module with another, but works + # + # In principle setattr(process) could work too, but it expands the + # sequences and I don't want that + modifier = cms.Modifier() + modifier._setChosen() + + comparitor = None + if hasattr(module, "SeedComparitorPSet"): + comparitor = module.SeedComparitorPSet.clone() + + # Replace triplet generator with the CA version + from RecoPixelVertexing.PixelTriplets.caHitTripletEDProducer_cfi import caHitTripletEDProducer as _caHitTripletEDProducer + modifier.toReplaceWith(module, _caHitTripletEDProducer.clone( + doublets = doubletModuleName, + extraHitRPhitolerance = module.extraHitRPhitolerance, + **_CAParameters + )) + + if comparitor: + module.SeedComparitorPSet = comparitor + + def customiseForTripletsByCellularAutomaton(process): for module in process._Process__producers.values(): - if not hasattr(module, "OrderedHitsFactoryPSet"): - continue - pset = getattr(module, "OrderedHitsFactoryPSet") - if not hasattr(pset, "ComponentName"): - continue - if not (pset.ComponentName == "StandardHitTripletGenerator"): - continue - # Adjust seeding layers - seedingLayersName = module.OrderedHitsFactoryPSet.SeedingLayers.getModuleLabel() - - - - # Configure seed generator / pixel track producer - Triplets = module.OrderedHitsFactoryPSet.clone() - from RecoPixelVertexing.PixelTriplets.CAHitTripletGenerator_cfi import CAHitTripletGenerator as _CAHitTripletGenerator - - module.OrderedHitsFactoryPSet = _CAHitTripletGenerator.clone( - ComponentName = cms.string("CAHitTripletGenerator"), - extraHitRPhitolerance = Triplets.GeneratorPSet.extraHitRPhitolerance, - maxChi2 = dict( - pt1 = 0.8, pt2 = 2, - value1 = 20, value2 = 10, - enabled = True, - ), - useBendingCorrection = True, - SeedingLayers = cms.InputTag(seedingLayersName), - CAThetaCut = cms.double(0.0015), - CAPhiCut = cms.double(0.01), - CAHardPtCut = cms.double(0), - ) - - if hasattr(Triplets.GeneratorPSet, "SeedComparitorPSet"): - module.OrderedHitsFactoryPSet.SeedComparitorPSet = Triplets.GeneratorPSet.SeedComparitorPSet + if hasattr(module, "OrderedHitsFactoryPSet"): + customiseLegacySeeding(module) + elif module._TypedParameterizable__type in ["PixelTripletHLTEDProducer", "PixelTripletLargeTipEDProducer"]: + customiseNewSeeding(process, module) return process From 560791dcf6fbc6ea065e923ce96055392e7fbd65 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 30 Sep 2016 17:04:08 +0200 Subject: [PATCH 45/69] TauRegionalPixelSeedGenerator accepts measurementTrackerName as either string or InputTag --- .../src/TauRegionalPixelSeedGenerator.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/RecoTauTag/HLTProducers/src/TauRegionalPixelSeedGenerator.h b/RecoTauTag/HLTProducers/src/TauRegionalPixelSeedGenerator.h index a5de85fd5bf43..b5953b439c09c 100644 --- a/RecoTauTag/HLTProducers/src/TauRegionalPixelSeedGenerator.h +++ b/RecoTauTag/HLTProducers/src/TauRegionalPixelSeedGenerator.h @@ -54,7 +54,16 @@ class TauRegionalPixelSeedGenerator : public TrackingRegionProducer { } m_howToUseMeasurementTracker = RectangularEtaPhiTrackingRegion::stringToUseMeasurementTracker(regionPSet.getParameter("howToUseMeasurementTracker")); if(m_howToUseMeasurementTracker != RectangularEtaPhiTrackingRegion::UseMeasurementTracker::kNever) { - token_measurementTracker = iC.consumes(regionPSet.getParameter("measurementTrackerName")); + // temporary until everything migrated to InputTag + edm::InputTag tag; + if(regionPSet.existsAs("measurementTrackerName")) { + tag = regionPSet.getParameter("measurementTrackerName"); + } + else { + tag = edm::InputTag(regionPSet.getParameter("measurementTrackerName")); + } + + token_measurementTracker = iC.consumes(tag); } } @@ -73,7 +82,10 @@ class TauRegionalPixelSeedGenerator : public TrackingRegionProducer { desc.add("searchOpt", false); desc.add("howToUseMeasurementTracker", "ForSiStrips"); - desc.add("measurementTrackerName", edm::InputTag("MeasurementTrackerEvent")); + + // allow both InputTag and string for the moment, use InputTag as the default + desc.addNode(edm::ParameterDescription("measurementTrackerName", edm::InputTag("MeasurementTrackerEvent"), true) xor + edm::ParameterDescription("measurementTrackerName", "MeasurementTrackerEvent", true)); // Only for backwards-compatibility edm::ParameterSetDescription descRegion; From d2e35ac1285e6a5cc690073dda09d92ef4b00681 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 6 Oct 2016 17:02:04 +0200 Subject: [PATCH 46/69] Add support for new modules to tracking validation timing plots --- .../python/plotting/trackingPlots.py | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Validation/RecoTrack/python/plotting/trackingPlots.py b/Validation/RecoTrack/python/plotting/trackingPlots.py index 51718ee4b58cf..4a5fafcaf06e0 100644 --- a/Validation/RecoTrack/python/plotting/trackingPlots.py +++ b/Validation/RecoTrack/python/plotting/trackingPlots.py @@ -1077,7 +1077,9 @@ def _set(param, name, modules): setattr(self, name, modules) _set(clusterMasking, "_clusterMasking", [self._name+"Clusters"]) - _set(seeding, "_seeding", [self._name+"SeedingLayers", self._name+"Seeds"]) + # it's fine to include e.g. quadruplets here also for pair + # steps, as non-existing modules are just ignored + _set(seeding, "_seeding", [self._name+"SeedingLayers", self._name+"TrackingRegions", self._name+"HitDoublets", self._name+"HitTriplets", self._name+"HitQuadruplets", self._name+"Seeds"]) _set(building, "_building", [self._name+"TrackCandidates"]) _set(fit, "_fit", [self._name+"Tracks"]) _set(selection, "_selection", [self._name]) @@ -1119,6 +1121,10 @@ def modules(self): _iterations = [ Iteration("initialStepPreSplitting", clusterMasking=[], seeding=["initialStepSeedLayersPreSplitting", + "initialStepTrackingRegionsPreSplitting", + "initialStepHitDoubletsPreSplitting", + "initialStepHitTripletsPreSplitting", + "initialStepHitQuadrupletsPreSplitting", "initialStepSeedsPreSplitting"], building=["initialStepTrackCandidatesPreSplitting"], fit=["initialStepTracksPreSplitting"], @@ -1156,6 +1162,12 @@ def modules(self): Iteration("mixedTripletStep", seeding=["mixedTripletStepSeedLayersA", "mixedTripletStepSeedLayersB", + "mixedTripletStepTrackingRegionsA", + "mixedTripletStepTrackingRegionsB", + "mixedTripletStepHitDoubletsA", + "mixedTripletStepHitDoubletsB", + "mixedTripletStepHitTripletsA", + "mixedTripletStepHitTripletsB", "mixedTripletStepSeedsA", "mixedTripletStepSeedsB", "mixedTripletStepSeeds"], @@ -1169,6 +1181,11 @@ def modules(self): Iteration("tobTecStep", seeding=["tobTecStepSeedLayersTripl", "tobTecStepSeedLayersPair", + "tobTecStepTrackingRegionsTripl", + "tobTecStepTrackingRegionsPair", + "tobTecStepHitDoubletsTripl", + "tobTecStepHitDoubletsPair", + "tobTecStepHitTripletsTripl", "tobTecStepSeedsTripl", "tobTecStepSeedsPair", "tobTecStepSeeds"], @@ -1210,6 +1227,9 @@ def modules(self): building=["convTrackCandidates"], fit=["convStepTracks"], selection=["convStepSelector"]), + Iteration("Other", clusterMasking=[], seeding=[], building=[], fit=[], selection=[], + other=["trackerClusterCheckPreSplitting", + "trackerClusterCheck"]), ] def _iterModuleMap(includeConvStep=True, onlyConvStep=False): From 53df150f178a6567e8b0869d758fd06356728f32 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 14 Oct 2016 09:24:28 +0200 Subject: [PATCH 47/69] Fix era customizations in PixelLessStep --- RecoTracker/IterativeTracking/python/PixelLessStep_cff.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RecoTracker/IterativeTracking/python/PixelLessStep_cff.py b/RecoTracker/IterativeTracking/python/PixelLessStep_cff.py index 4e583baecc80c..e1cab74db4f3c 100644 --- a/RecoTracker/IterativeTracking/python/PixelLessStep_cff.py +++ b/RecoTracker/IterativeTracking/python/PixelLessStep_cff.py @@ -105,7 +105,7 @@ originHalfLength = 12.0, originRadius = 1.0 )) -eras.trackingLowPU.toModify(pixelLessStepTrackingRegions, RegionPSet = dict( +trackingLowPU.toModify(pixelLessStepTrackingRegions, RegionPSet = dict( ptMin = 0.7, originHalfLength = 10.0, originRadius = 2.0, @@ -151,8 +151,8 @@ ) ) ) -eras.trackingLowPU.toModify(pixelLessStepHitDoublets, produceSeedingHitSets=True, produceIntermediateHitDoublets=False) -eras.trackingLowPU.toModify(pixelLessStepSeeds, +trackingLowPU.toModify(pixelLessStepHitDoublets, produceSeedingHitSets=True, produceIntermediateHitDoublets=False) +trackingLowPU.toModify(pixelLessStepSeeds, seedingHitSets = "pixelLessStepHitDoublets", SeedComparitorPSet = dict(# FIXME: is this defined in any cfi that could be imported instead of copy-paste? ComponentName = 'PixelClusterShapeSeedComparitor', From 13358303bd07d6e6c75076bb786a28f7c137f7dc Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Mon, 7 Nov 2016 14:58:07 +0100 Subject: [PATCH 48/69] Put temporary TrajectorySeedCollection to event in PixelQuadrupletMergerEDProducer --- .../plugins/PixelQuadrupletMergerEDProducer.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletMergerEDProducer.cc b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletMergerEDProducer.cc index 21d74f6b02ff4..bdc765b8bc327 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletMergerEDProducer.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletMergerEDProducer.cc @@ -37,7 +37,6 @@ class PixelQuadrupletMergerEDProducer: public edm::stream::EDProducer<> { // to keep old results std::unique_ptr comparitor_; std::unique_ptr seedCreator_; - TrajectorySeedCollection tmpSeedCollection_; // need to keep these in memory because TrajectorySeed owns its RecHits }; PixelQuadrupletMergerEDProducer::PixelQuadrupletMergerEDProducer(const edm::ParameterSet& iConfig): @@ -60,6 +59,7 @@ PixelQuadrupletMergerEDProducer::PixelQuadrupletMergerEDProducer(const edm::Para seedCreator_.reset(SeedCreatorFactory::get()->create( creatorName, creatorPSet)); produces(); + produces(); // need to keep these in memory because TrajectorySeed owns its RecHits } void PixelQuadrupletMergerEDProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -69,7 +69,6 @@ void PixelQuadrupletMergerEDProducer::fillDescriptions(edm::ConfigurationDescrip desc.add("ttrhBuilderLabel", "PixelTTRHBuilderWithoutAngle"); desc.add("mergeTriplets", true); desc.add("addRemainingTriplets", false); - // This would be really on the responsibility of // QuadrupletSeedMerger and SeedingLayerSetsBuilder. The former is // almost obsolete by now (so I don't want to put effort there), and @@ -91,9 +90,6 @@ void PixelQuadrupletMergerEDProducer::fillDescriptions(edm::ConfigurationDescrip } void PixelQuadrupletMergerEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { - // to keep old results - tmpSeedCollection_.clear(); // safe to clear now - edm::Handle htriplets; iEvent.getByToken(tripletToken_, htriplets); const auto& regionTriplets = *htriplets; @@ -105,6 +101,9 @@ void PixelQuadrupletMergerEDProducer::produce(edm::Event& iEvent, const edm::Eve } seedingHitSets->reserve(regionTriplets.regionSize(), localRA_.upper()); + // to keep old results + auto tmpSeedCollection = std::make_unique(); + OrderedHitSeeds quadruplets; quadruplets.reserve(localRA_.upper()); @@ -127,14 +126,14 @@ void PixelQuadrupletMergerEDProducer::produce(edm::Event& iEvent, const edm::Eve seedCreator_->init(region, iSetup, comparitor_.get()); for(const auto& hits: regionSeedingHitSets) { if(!comparitor_ || comparitor_->compatible(hits)) { - seedCreator_->makeSeed(tmpSeedCollection_, hits); + seedCreator_->makeSeed(*tmpSeedCollection, hits); } } // then convert seeds back to hits // awful, but hopefully only temporary to preserve old results - for(const auto& seed: tmpSeedCollection_) { + for(const auto& seed: *tmpSeedCollection) { auto hitRange = seed.recHits(); assert(std::distance(hitRange.first, hitRange.second) == 3); tripletsPerRegion.emplace_back(static_cast(&*(hitRange.first)), @@ -158,6 +157,7 @@ void PixelQuadrupletMergerEDProducer::produce(edm::Event& iEvent, const edm::Eve localRA_.update(seedingHitSets->size()); iEvent.put(std::move(seedingHitSets)); + iEvent.put(std::move(tmpSeedCollection)); } #include "FWCore/Framework/interface/MakerMacros.h" From 6d9695d227fbb5f5035578b5f0c8057367269e02 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 9 Nov 2016 11:53:23 +0100 Subject: [PATCH 49/69] Add explicit UseVertex=True --- RecoHI/HiMuonAlgos/python/HiRegitMuonDetachedTripletStep_cff.py | 1 + RecoHI/HiMuonAlgos/python/HiRegitMuonInitialStep_cff.py | 1 + RecoHI/HiMuonAlgos/python/HiRegitMuonMixedTripletStep_cff.py | 1 + RecoHI/HiMuonAlgos/python/HiRegitMuonPixelLessStep_cff.py | 1 + RecoHI/HiMuonAlgos/python/HiRegitMuonPixelPairStep_cff.py | 1 + 5 files changed, 5 insertions(+) diff --git a/RecoHI/HiMuonAlgos/python/HiRegitMuonDetachedTripletStep_cff.py b/RecoHI/HiMuonAlgos/python/HiRegitMuonDetachedTripletStep_cff.py index 40490b2b1279c..7d37f0ecbc87b 100644 --- a/RecoHI/HiMuonAlgos/python/HiRegitMuonDetachedTripletStep_cff.py +++ b/RecoHI/HiMuonAlgos/python/HiRegitMuonDetachedTripletStep_cff.py @@ -12,6 +12,7 @@ MuonSrc = "standAloneMuons:UpdatedAtVtx", # this is the same as default, why repeat? MuonTrackingRegionBuilder = dict( vertexCollection = "hiSelectedVertex", + UseVertex = True, Phi_fixed = True, Eta_fixed = True, DeltaPhi = 0.3, diff --git a/RecoHI/HiMuonAlgos/python/HiRegitMuonInitialStep_cff.py b/RecoHI/HiMuonAlgos/python/HiRegitMuonInitialStep_cff.py index 4654f9b8f88fd..1a4d8e8d3a24e 100644 --- a/RecoHI/HiMuonAlgos/python/HiRegitMuonInitialStep_cff.py +++ b/RecoHI/HiMuonAlgos/python/HiRegitMuonInitialStep_cff.py @@ -10,6 +10,7 @@ MuonSrc = "standAloneMuons:UpdatedAtVtx", # this is the same as default, why repeat? MuonTrackingRegionBuilder = dict( vertexCollection = "hiSelectedVertex", + UseVertex = True, Phi_fixed = True, Eta_fixed = True, DeltaPhi = 0.3, diff --git a/RecoHI/HiMuonAlgos/python/HiRegitMuonMixedTripletStep_cff.py b/RecoHI/HiMuonAlgos/python/HiRegitMuonMixedTripletStep_cff.py index 99a33944ee00f..23109439cd5ea 100644 --- a/RecoHI/HiMuonAlgos/python/HiRegitMuonMixedTripletStep_cff.py +++ b/RecoHI/HiMuonAlgos/python/HiRegitMuonMixedTripletStep_cff.py @@ -12,6 +12,7 @@ MuonSrc = "standAloneMuons:UpdatedAtVtx", # this is the same as default, why repeat? MuonTrackingRegionBuilder = dict( vertexCollection = "hiSelectedVertex", + UseVertex = True, Phi_fixed = True, Eta_fixed = True, DeltaPhi = 0.3, diff --git a/RecoHI/HiMuonAlgos/python/HiRegitMuonPixelLessStep_cff.py b/RecoHI/HiMuonAlgos/python/HiRegitMuonPixelLessStep_cff.py index 52ee60c0ce4d7..70a3721581a63 100644 --- a/RecoHI/HiMuonAlgos/python/HiRegitMuonPixelLessStep_cff.py +++ b/RecoHI/HiMuonAlgos/python/HiRegitMuonPixelLessStep_cff.py @@ -11,6 +11,7 @@ MuonSrc = "standAloneMuons:UpdatedAtVtx", # this is the same as default, why repeat? MuonTrackingRegionBuilder = dict( vertexCollection = "hiSelectedVertex", + UseVertex = True, Phi_fixed = True, Eta_fixed = True, # Ok, the following ones are specific to PixelLessStep diff --git a/RecoHI/HiMuonAlgos/python/HiRegitMuonPixelPairStep_cff.py b/RecoHI/HiMuonAlgos/python/HiRegitMuonPixelPairStep_cff.py index d8ac826f4d318..6e36b580d5430 100644 --- a/RecoHI/HiMuonAlgos/python/HiRegitMuonPixelPairStep_cff.py +++ b/RecoHI/HiMuonAlgos/python/HiRegitMuonPixelPairStep_cff.py @@ -12,6 +12,7 @@ MuonSrc = "standAloneMuons:UpdatedAtVtx", # this is the same as default, why repeat? MuonTrackingRegionBuilder = dict( vertexCollection = "hiSelectedVertex", + UseVertex = True, Phi_fixed = True, Eta_fixed = True, DeltaPhi = 0.3, From 886beb8aaab5494faf1bda74e39dc882aa2d96c4 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 9 Nov 2016 16:00:08 +0100 Subject: [PATCH 50/69] Rename MuonTrackingRegionBuilder::fillDescriptions2() to fillDescriptionsOffline() --- .../plugins/HIMuonTrackingRegionProducer.h | 2 +- .../interface/MuonTrackingRegionBuilder.h | 15 ++++----------- .../src/MuonTrackingRegionBuilder.cc | 4 ++-- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/RecoHI/HiMuonAlgos/plugins/HIMuonTrackingRegionProducer.h b/RecoHI/HiMuonAlgos/plugins/HIMuonTrackingRegionProducer.h index 4ae1929abffa6..828cdff36455d 100644 --- a/RecoHI/HiMuonAlgos/plugins/HIMuonTrackingRegionProducer.h +++ b/RecoHI/HiMuonAlgos/plugins/HIMuonTrackingRegionProducer.h @@ -45,7 +45,7 @@ class HIMuonTrackingRegionProducer : public TrackingRegionProducer { desc.add("MuonSrc", edm::InputTag("")); edm::ParameterSetDescription descRegion; - MuonTrackingRegionBuilder::fillDescriptions2(descRegion); + MuonTrackingRegionBuilder::fillDescriptionsOffline(descRegion); desc.add("MuonTrackingRegionBuilder", descRegion); edm::ParameterSetDescription descService; diff --git a/RecoMuon/GlobalTrackingTools/interface/MuonTrackingRegionBuilder.h b/RecoMuon/GlobalTrackingTools/interface/MuonTrackingRegionBuilder.h index 78d75fb334d74..4bab866f87eb0 100644 --- a/RecoMuon/GlobalTrackingTools/interface/MuonTrackingRegionBuilder.h +++ b/RecoMuon/GlobalTrackingTools/interface/MuonTrackingRegionBuilder.h @@ -62,17 +62,10 @@ class MuonTrackingRegionBuilder : public TrackingRegionProducer { /// Add Fill Descriptions static void fillDescriptions(edm::ParameterSetDescription& descriptions); - // 2016-08-10 MK: I'm pretty sure the fillDescriptions() above is - // not used in practice by any EDModule (it's called by - // L3MuonTrajectoryBuilder::fillDescriptions(), which itself is - // not called by anybody). I'm mainly confused that the - // fillDescriptions() above adds two PSets - // ("MuonTrackingRegionBuilder" and - // "hltMuonTrackingRegionBuilder") to the argument PSet, while to - // me it would make most sense to just fill the PSet (although I - // could be missing something). This is the behaviour of this - // fillDescriptions2() below. - static void fillDescriptions2(edm::ParameterSetDescription& descriptions); + // Separating the offline part of the fillDescriptions() above + // TODO: make similar fillDescriptionsHLT, and switch the + // fillDescriptions() above take edm::ConfigurationDescriptions& + static void fillDescriptionsOffline(edm::ParameterSetDescription& descriptions); private: diff --git a/RecoMuon/GlobalTrackingTools/src/MuonTrackingRegionBuilder.cc b/RecoMuon/GlobalTrackingTools/src/MuonTrackingRegionBuilder.cc index 05ef873bf0eaf..d902b3217f664 100644 --- a/RecoMuon/GlobalTrackingTools/src/MuonTrackingRegionBuilder.cc +++ b/RecoMuon/GlobalTrackingTools/src/MuonTrackingRegionBuilder.cc @@ -255,7 +255,7 @@ std::unique_ptr MuonTrackingRegionBuilder::regi void MuonTrackingRegionBuilder::fillDescriptions(edm::ParameterSetDescription& descriptions) { { edm::ParameterSetDescription desc; - fillDescriptions2(desc); + fillDescriptionsOffline(desc); descriptions.add("MuonTrackingRegionBuilder",desc); } { @@ -291,7 +291,7 @@ void MuonTrackingRegionBuilder::fillDescriptions(edm::ParameterSetDescription& d descriptions.setComment("Build a TrackingRegion around a standalone muon. Options to define region around beamspot or primary vertex and dynamic regions are included."); } -void MuonTrackingRegionBuilder::fillDescriptions2(edm::ParameterSetDescription& desc) { +void MuonTrackingRegionBuilder::fillDescriptionsOffline(edm::ParameterSetDescription& desc) { desc.add("EtaR_UpperLimit_Par1",0.25); desc.add("DeltaR",0.2); desc.add("beamSpot",edm::InputTag("")); From 99e7a4c1366f0b03c11778b4f8f9f23615032c98 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 9 Nov 2016 16:06:23 +0100 Subject: [PATCH 51/69] Change exception categories to LogicError --- .../PixelTriplets/interface/HitTripletEDProducerT.h | 2 +- .../PixelTriplets/plugins/CAHitNtupletEDProducerT.cc | 2 +- .../PixelTriplets/plugins/PixelQuadrupletEDProducer.cc | 2 +- RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc | 8 ++++---- .../TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h index afd6a7621c6c5..85ad49c133818 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h +++ b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h @@ -75,7 +75,7 @@ void HitTripletEDProducerT::produce(edm::Event& iEvent, c const SeedingLayerSetsHits& seedingLayerHits = regionDoublets.seedingLayerHits(); if(seedingLayerHits.numberOfLayersInSet() < 3) { - throw cms::Exception("Configuration") << "HitTripletEDProducerT expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= 3, got " << seedingLayerHits.numberOfLayersInSet(); + throw cms::Exception("LogicError") << "HitTripletEDProducerT expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= 3, got " << seedingLayerHits.numberOfLayersInSet() << ". This is likely caused by a configuration error of this module, HitPairEDProducer, or SeedingLayersEDProducer."; } std::unique_ptr seedingHitSets; diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletEDProducerT.cc b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletEDProducerT.cc index 46d98c0094332..cbe05d19363d1 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletEDProducerT.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletEDProducerT.cc @@ -74,7 +74,7 @@ void CAHitNtupletEDProducerT::produce(edm::Event& iEvent, const edm const SeedingLayerSetsHits& seedingLayerHits = regionDoublets.seedingLayerHits(); if(seedingLayerHits.numberOfLayersInSet() < T_Generator::minLayers) { - throw cms::Exception("Configuration") << "CAHitNtupletEDProducer expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= " << T_Generator::minLayers << ", got " << seedingLayerHits.numberOfLayersInSet(); + throw cms::Exception("LogicError") << "CAHitNtupletEDProducer expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= " << T_Generator::minLayers << ", got " << seedingLayerHits.numberOfLayersInSet() << ". This is likely caused by a configuration error of this module, HitPairEDProducer, or SeedingLayersEDProducer."; } auto seedingHitSets = std::make_unique(); diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc index f42f0e418ca23..26fee69c319ad 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc @@ -55,7 +55,7 @@ void PixelQuadrupletEDProducer::produce(edm::Event& iEvent, const edm::EventSetu const SeedingLayerSetsHits& seedingLayerHits = regionTriplets.seedingLayerHits(); if(seedingLayerHits.numberOfLayersInSet() < 4) { - throw cms::Exception("Configuration") << "PixelQuadrupletEDProducer expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= 4, got " << seedingLayerHits.numberOfLayersInSet(); + throw cms::Exception("LogicError") << "PixelQuadrupletEDProducer expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= 4, got " << seedingLayerHits.numberOfLayersInSet() << ". This is likely caused by a configuration error of this module, HitPairEDProducer, or SeedingLayersEDProducer."; } auto seedingHitSets = std::make_unique(); diff --git a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc index 42f4b6f0f060f..78945d38dbdca 100644 --- a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc +++ b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc @@ -86,7 +86,7 @@ void HitPairEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetu iEvent.getByToken(seedingLayerToken_, hlayers); const auto& layers = *hlayers; if(layers.numberOfLayersInSet() < 2) - throw cms::Exception("Configuration") << "HitPairEDProducer expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= 2, got " << layers.numberOfLayersInSet(); + throw cms::Exception("LogicError") << "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); @@ -120,7 +120,7 @@ void HitPairEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetu for(const auto& layerSet: layers) { for(const auto pairBeginIndex: layerPairBegins_) { if(pairBeginIndex+1 >= layers.numberOfLayersInSet()) { - throw cms::Exception("Configuration") << "Layer pair index " << pairBeginIndex << " is out of bounds, input SeedingLayerSetsHits has only " << layers.numberOfLayersInSet() << " layers per set, and the index+1 must be < than the number of layers in set"; + throw cms::Exception("LogicError") << "Layer pair index " << pairBeginIndex << " is out of bounds, input SeedingLayerSetsHits has only " << layers.numberOfLayersInSet() << " layers per set, and the index+1 must be < than the number of layers in set"; } // Take only the requested pair of the set @@ -141,10 +141,10 @@ void HitPairEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetu } else { if(layerPairBegins_.size() != 1) { - throw cms::Exception("Configuration") << "With pairs of input layers, it doesn't make sense to specify more than one input layer pair, got " << layerPairBegins_.size(); + throw cms::Exception("LogicError") << "With pairs of input layers, it doesn't make sense to specify more than one input layer pair, got " << layerPairBegins_.size(); } if(layerPairBegins_[0] != 0) { - throw cms::Exception("Configuration") << "With pairs of input layers, it doesn't make sense to specify other input layer pair than 0; got " << layerPairBegins_[0]; + throw cms::Exception("LogicError") << "With pairs of input layers, it doesn't make sense to specify other input layer pair than 0; got " << layerPairBegins_[0]; } layerPairs.reserve(layers.size()); diff --git a/RecoTracker/TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc b/RecoTracker/TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc index 3ece596222887..c299b7faab124 100644 --- a/RecoTracker/TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc +++ b/RecoTracker/TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc @@ -57,7 +57,7 @@ void MultiHitFromChi2EDProducer::produce(edm::Event& iEvent, const edm::EventSet const SeedingLayerSetsHits& seedingLayerHits = regionDoublets.seedingLayerHits(); if(seedingLayerHits.numberOfLayersInSet() < 3) { - throw cms::Exception("Configuration") << "MultiHitFromChi2EDProducer expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= 3, got " << seedingLayerHits.numberOfLayersInSet(); + throw cms::Exception("LogicError") << "MultiHitFromChi2EDProducer expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= 3, got " << seedingLayerHits.numberOfLayersInSet() << ". This is likely caused by a configuration error of this module, HitPairEDProducer, or SeedingLayersEDProducer."; } auto seedingHitSets = std::make_unique(); From 87f8a59ee4d8c2ca367fc155098b9d531b901d4f Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 9 Nov 2016 16:10:27 +0100 Subject: [PATCH 52/69] Add line breaks --- .../plugins/CAHitQuadrupletGenerator.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletGenerator.cc b/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletGenerator.cc index 96888394fa6e7..31c3588afe94d 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletGenerator.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAHitQuadrupletGenerator.cc @@ -176,7 +176,10 @@ void CAHitQuadrupletGenerator::hitQuadruplets(const TrackingRegion& region, HitPairGeneratorFromLayerPair thePairGenerator(0, 1, &theLayerCache); - fillGraph(layers, g, hitDoublets, [&](const SeedingLayerSetsHits::SeedingLayer& inner, const SeedingLayerSetsHits::SeedingLayer& outer, std::vector& hitDoublets) { + fillGraph(layers, g, hitDoublets, + [&](const SeedingLayerSetsHits::SeedingLayer& inner, + const SeedingLayerSetsHits::SeedingLayer& outer, + std::vector& hitDoublets) { hitDoublets.emplace_back(thePairGenerator.doublets(region, ev, es, inner, outer)); return true; }); @@ -206,9 +209,13 @@ void CAHitQuadrupletGenerator::hitNtuplets(const IntermediateHitDoublets::Region SeedingLayerSetsHits::LayerIndex outer) { return pair.innerLayerIndex() == inner && pair.outerLayerIndex() == outer; }; - fillGraph(layers, g, hitDoublets, [&](const SeedingLayerSetsHits::SeedingLayer& inner, const SeedingLayerSetsHits::SeedingLayer& outer, std::vector& hitDoublets) { + fillGraph(layers, g, hitDoublets, + [&](const SeedingLayerSetsHits::SeedingLayer& inner, + const SeedingLayerSetsHits::SeedingLayer& outer, + std::vector& hitDoublets) { using namespace std::placeholders; - auto found = std::find_if(regionLayerPairs.begin(), regionLayerPairs.end(), std::bind(layerPairEqual, _1, inner.index(), outer.index())); + auto found = std::find_if(regionLayerPairs.begin(), regionLayerPairs.end(), + std::bind(layerPairEqual, _1, inner.index(), outer.index())); if(found != regionLayerPairs.end()) { hitDoublets.emplace_back(&(found->doublets())); return true; From 9b594c8b99c24e85306ca895dfcec8bd67db321a Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 9 Nov 2016 16:55:31 +0100 Subject: [PATCH 53/69] Move era customizations to _cfi's --- RecoHI/HiMuonAlgos/python/hiMuonIterativeTk_cff.py | 2 +- .../PixelTriplets/interface/HitTripletEDProducerT.h | 2 +- ...LTEDProducer_cff.py => pixelTripletHLTEDProducer_cfi.py} | 4 +++- ...roducer_cff.py => pixelTripletLargeTipEDProducer_cfi.py} | 4 +++- .../IterativeTracking/python/DetachedQuadStep_cff.py | 4 ++-- .../IterativeTracking/python/DetachedTripletStep_cff.py | 4 ++-- .../IterativeTracking/python/HighPtTripletStep_cff.py | 4 ++-- .../IterativeTracking/python/InitialStepPreSplitting_cff.py | 6 +++--- RecoTracker/IterativeTracking/python/InitialStep_cff.py | 2 +- .../IterativeTracking/python/JetCoreRegionalStep_cff.py | 2 +- RecoTracker/IterativeTracking/python/LowPtQuadStep_cff.py | 4 ++-- .../IterativeTracking/python/LowPtTripletStep_cff.py | 4 ++-- .../IterativeTracking/python/MixedTripletStep_cff.py | 4 ++-- RecoTracker/IterativeTracking/python/PixelLessStep_cff.py | 2 +- RecoTracker/IterativeTracking/python/PixelPairStep_cff.py | 2 +- RecoTracker/IterativeTracking/python/TobTecStep_cff.py | 3 +-- RecoTracker/IterativeTracking/python/iterativeTk_cff.py | 2 +- RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc | 2 +- .../{hitPairEDProducer_cff.py => hitPairEDProducer_cfi.py} | 4 +++- .../TkSeedGenerator/plugins/ClusterCheckerEDProducer.cc | 2 +- ...rackerClusterCheck_cff.py => trackerClusterCheck_cfi.py} | 4 +++- 21 files changed, 37 insertions(+), 30 deletions(-) rename RecoPixelVertexing/PixelTriplets/python/{pixelTripletHLTEDProducer_cff.py => pixelTripletHLTEDProducer_cfi.py} (66%) rename RecoPixelVertexing/PixelTriplets/python/{pixelTripletLargeTipEDProducer_cff.py => pixelTripletLargeTipEDProducer_cfi.py} (74%) rename RecoTracker/TkHitPairs/python/{hitPairEDProducer_cff.py => hitPairEDProducer_cfi.py} (62%) rename RecoTracker/TkSeedGenerator/python/{trackerClusterCheck_cff.py => trackerClusterCheck_cfi.py} (66%) diff --git a/RecoHI/HiMuonAlgos/python/hiMuonIterativeTk_cff.py b/RecoHI/HiMuonAlgos/python/hiMuonIterativeTk_cff.py index d7af1f9eea782..7c94095d342a6 100644 --- a/RecoHI/HiMuonAlgos/python/hiMuonIterativeTk_cff.py +++ b/RecoHI/HiMuonAlgos/python/hiMuonIterativeTk_cff.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms -from RecoTracker.TkSeedGenerator.trackerClusterCheck_cff import trackerClusterCheck as _trackerClusterCheck +from RecoTracker.TkSeedGenerator.trackerClusterCheck_cfi import trackerClusterCheck as _trackerClusterCheck hiRegitMuClusterCheck = _trackerClusterCheck.clone( doClusterCheck = False # do not check for max number of clusters pixel or strips ) diff --git a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h index 85ad49c133818..1a73d074f498b 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h +++ b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h @@ -63,7 +63,7 @@ void HitTripletEDProducerT::fillDescriptions(edm::Configu T_HitTripletGenerator::fillDescriptions(desc); - auto label = T_HitTripletGenerator::fillDescriptionsLabel() + std::string("EDProducer"); + auto label = T_HitTripletGenerator::fillDescriptionsLabel() + std::string("EDProducerDefault"); descriptions.add(label, desc); } diff --git a/RecoPixelVertexing/PixelTriplets/python/pixelTripletHLTEDProducer_cff.py b/RecoPixelVertexing/PixelTriplets/python/pixelTripletHLTEDProducer_cfi.py similarity index 66% rename from RecoPixelVertexing/PixelTriplets/python/pixelTripletHLTEDProducer_cff.py rename to RecoPixelVertexing/PixelTriplets/python/pixelTripletHLTEDProducer_cfi.py index e60c79208e111..91eebb01b9ab5 100644 --- a/RecoPixelVertexing/PixelTriplets/python/pixelTripletHLTEDProducer_cff.py +++ b/RecoPixelVertexing/PixelTriplets/python/pixelTripletHLTEDProducer_cfi.py @@ -1,4 +1,6 @@ -from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import * +from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducerDefault_cfi import pixelTripletHLTEDProducerDefault as _pixelTripletHLTEDProducerDefault + +pixelTripletHLTEDProducer = _pixelTripletHLTEDProducerDefault.clone() from Configuration.Eras.Modifier_trackingLowPU_cff import trackingLowPU from Configuration.Eras.Modifier_trackingPhase1PU70_cff import trackingPhase1PU70 from Configuration.Eras.Modifier_trackingPhase2PU140_cff import trackingPhase2PU140 diff --git a/RecoPixelVertexing/PixelTriplets/python/pixelTripletLargeTipEDProducer_cff.py b/RecoPixelVertexing/PixelTriplets/python/pixelTripletLargeTipEDProducer_cfi.py similarity index 74% rename from RecoPixelVertexing/PixelTriplets/python/pixelTripletLargeTipEDProducer_cff.py rename to RecoPixelVertexing/PixelTriplets/python/pixelTripletLargeTipEDProducer_cfi.py index af912f7ec14b9..02347ee106f86 100644 --- a/RecoPixelVertexing/PixelTriplets/python/pixelTripletLargeTipEDProducer_cff.py +++ b/RecoPixelVertexing/PixelTriplets/python/pixelTripletLargeTipEDProducer_cfi.py @@ -1,4 +1,6 @@ -from RecoPixelVertexing.PixelTriplets.pixelTripletLargeTipEDProducer_cfi import * +from RecoPixelVertexing.PixelTriplets.pixelTripletLargeTipEDProducerDefault_cfi import pixelTripletLargeTipEDProducerDefault as _pixelTripletLargeTipEDProducerDefault + +pixelTripletLargeTipEDProducer = _pixelTripletLargeTipEDProducerDefault.clone() from Configuration.Eras.Modifier_trackingLowPU_cff import trackingLowPU from Configuration.Eras.Modifier_trackingPhase1PU70_cff import trackingPhase1PU70 from Configuration.Eras.Modifier_trackingPhase2PU140_cff import trackingPhase2PU140 diff --git a/RecoTracker/IterativeTracking/python/DetachedQuadStep_cff.py b/RecoTracker/IterativeTracking/python/DetachedQuadStep_cff.py index 371b30591378c..4ed3f71991f31 100644 --- a/RecoTracker/IterativeTracking/python/DetachedQuadStep_cff.py +++ b/RecoTracker/IterativeTracking/python/DetachedQuadStep_cff.py @@ -47,14 +47,14 @@ ))) # seeding -from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer detachedQuadStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "detachedQuadStepSeedLayers", trackingRegions = "detachedQuadStepTrackingRegions", maxElement = 0, produceIntermediateHitDoublets = True, ) -from RecoPixelVertexing.PixelTriplets.pixelTripletLargeTipEDProducer_cff import pixelTripletLargeTipEDProducer as _pixelTripletLargeTipEDProducer +from RecoPixelVertexing.PixelTriplets.pixelTripletLargeTipEDProducer_cfi import pixelTripletLargeTipEDProducer as _pixelTripletLargeTipEDProducer from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * detachedQuadStepHitTriplets = _pixelTripletLargeTipEDProducer.clone( doublets = "detachedQuadStepHitDoublets", diff --git a/RecoTracker/IterativeTracking/python/DetachedTripletStep_cff.py b/RecoTracker/IterativeTracking/python/DetachedTripletStep_cff.py index 39708668d2cb9..88404c6225a5b 100644 --- a/RecoTracker/IterativeTracking/python/DetachedTripletStep_cff.py +++ b/RecoTracker/IterativeTracking/python/DetachedTripletStep_cff.py @@ -44,14 +44,14 @@ )) # seeding -from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer detachedTripletStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "detachedTripletStepSeedLayers", trackingRegions = "detachedTripletStepTrackingRegions", maxElement = 0, produceIntermediateHitDoublets = True, ) -from RecoPixelVertexing.PixelTriplets.pixelTripletLargeTipEDProducer_cff import pixelTripletLargeTipEDProducer as _pixelTripletLargeTipEDProducer +from RecoPixelVertexing.PixelTriplets.pixelTripletLargeTipEDProducer_cfi import pixelTripletLargeTipEDProducer as _pixelTripletLargeTipEDProducer from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * detachedTripletStepHitTriplets = _pixelTripletLargeTipEDProducer.clone( doublets = "detachedTripletStepHitDoublets", diff --git a/RecoTracker/IterativeTracking/python/HighPtTripletStep_cff.py b/RecoTracker/IterativeTracking/python/HighPtTripletStep_cff.py index 930f0c491fb6e..955393b74b64e 100644 --- a/RecoTracker/IterativeTracking/python/HighPtTripletStep_cff.py +++ b/RecoTracker/IterativeTracking/python/HighPtTripletStep_cff.py @@ -63,14 +63,14 @@ trackingPhase2PU140.toModify(highPtTripletStepTrackingRegions, RegionPSet = dict(ptMin = 0.9, originRadius = 0.03)) # seeding -from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer highPtTripletStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "highPtTripletStepSeedLayers", trackingRegions = "highPtTripletStepTrackingRegions", maxElement = 0, produceIntermediateHitDoublets = True, ) -from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cff import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer +from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * import RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi highPtTripletStepHitTriplets = _pixelTripletHLTEDProducer.clone( diff --git a/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py b/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py index 7dcd120fbb643..8a2aa9f110933 100644 --- a/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py +++ b/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py @@ -7,7 +7,7 @@ from RecoLocalTracker.SiPixelRecHits.PixelCPEESProducers_cff import * from RecoTracker.TransientTrackingRecHit.TTRHBuilders_cff import * -from RecoTracker.TkSeedGenerator.trackerClusterCheck_cff import trackerClusterCheck as _trackerClusterCheck +from RecoTracker.TkSeedGenerator.trackerClusterCheck_cfi import trackerClusterCheck as _trackerClusterCheck trackerClusterCheckPreSplitting = _trackerClusterCheck.clone( PixelClusterCollectionLabel = 'siPixelClustersPreSplitting' ) @@ -32,7 +32,7 @@ )) # seeding -from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer initialStepHitDoubletsPreSplitting = _hitPairEDProducer.clone( seedingLayers = "initialStepSeedLayersPreSplitting", trackingRegions = "initialStepTrackingRegionsPreSplitting", @@ -40,7 +40,7 @@ maxElement = 0, produceIntermediateHitDoublets = True, ) -from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cff import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer +from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * import RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi initialStepHitTripletsPreSplitting = _pixelTripletHLTEDProducer.clone( diff --git a/RecoTracker/IterativeTracking/python/InitialStep_cff.py b/RecoTracker/IterativeTracking/python/InitialStep_cff.py index 615fa7f8e8461..d3b82c23dccb8 100644 --- a/RecoTracker/IterativeTracking/python/InitialStep_cff.py +++ b/RecoTracker/IterativeTracking/python/InitialStep_cff.py @@ -34,7 +34,7 @@ trackingPhase2PU140.toModify(initialStepTrackingRegions, RegionPSet = dict(ptMin = 0.8)) # seeding -from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer initialStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "initialStepSeedLayers", trackingRegions = "initialStepTrackingRegions", diff --git a/RecoTracker/IterativeTracking/python/JetCoreRegionalStep_cff.py b/RecoTracker/IterativeTracking/python/JetCoreRegionalStep_cff.py index 55998f72ff22f..04f4421426348 100644 --- a/RecoTracker/IterativeTracking/python/JetCoreRegionalStep_cff.py +++ b/RecoTracker/IterativeTracking/python/JetCoreRegionalStep_cff.py @@ -76,7 +76,7 @@ )) # Seeding -from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer jetCoreRegionalStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "jetCoreRegionalStepSeedLayers", trackingRegions = "jetCoreRegionalStepTrackingRegions", diff --git a/RecoTracker/IterativeTracking/python/LowPtQuadStep_cff.py b/RecoTracker/IterativeTracking/python/LowPtQuadStep_cff.py index ced75d2d55304..b57a35f089b6f 100644 --- a/RecoTracker/IterativeTracking/python/LowPtQuadStep_cff.py +++ b/RecoTracker/IterativeTracking/python/LowPtQuadStep_cff.py @@ -31,14 +31,14 @@ # seeding -from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer lowPtQuadStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "lowPtQuadStepSeedLayers", trackingRegions = "lowPtQuadStepTrackingRegions", maxElement = 0, produceIntermediateHitDoublets = True, ) -from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cff import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer +from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * import RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi lowPtQuadStepHitTriplets = _pixelTripletHLTEDProducer.clone( diff --git a/RecoTracker/IterativeTracking/python/LowPtTripletStep_cff.py b/RecoTracker/IterativeTracking/python/LowPtTripletStep_cff.py index 9b9eb0fdd89af..593931479894c 100644 --- a/RecoTracker/IterativeTracking/python/LowPtTripletStep_cff.py +++ b/RecoTracker/IterativeTracking/python/LowPtTripletStep_cff.py @@ -58,14 +58,14 @@ trackingPhase2PU140.toModify(lowPtTripletStepTrackingRegions, RegionPSet = dict(ptMin = 0.45)) # seeding -from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer lowPtTripletStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "lowPtTripletStepSeedLayers", trackingRegions = "lowPtTripletStepTrackingRegions", maxElement = 0, produceIntermediateHitDoublets = True, ) -from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cff import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer +from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * import RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi lowPtTripletStepHitTriplets = _pixelTripletHLTEDProducer.clone( diff --git a/RecoTracker/IterativeTracking/python/MixedTripletStep_cff.py b/RecoTracker/IterativeTracking/python/MixedTripletStep_cff.py index 97a367932e3b5..fdfaff8a3e3d5 100644 --- a/RecoTracker/IterativeTracking/python/MixedTripletStep_cff.py +++ b/RecoTracker/IterativeTracking/python/MixedTripletStep_cff.py @@ -94,14 +94,14 @@ ComponentName = 'mixedTripletStepClusterShapeHitFilter', clusterChargeCut = dict(refToPSet_ = 'SiStripClusterChargeCutTight') ) -from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer mixedTripletStepHitDoubletsA = _hitPairEDProducer.clone( seedingLayers = "mixedTripletStepSeedLayersA", trackingRegions = "mixedTripletStepTrackingRegionsA", maxElement = 0, produceIntermediateHitDoublets = True, ) -from RecoPixelVertexing.PixelTriplets.pixelTripletLargeTipEDProducer_cff import pixelTripletLargeTipEDProducer as _pixelTripletLargeTipEDProducer +from RecoPixelVertexing.PixelTriplets.pixelTripletLargeTipEDProducer_cfi import pixelTripletLargeTipEDProducer as _pixelTripletLargeTipEDProducer from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * mixedTripletStepHitTripletsA = _pixelTripletLargeTipEDProducer.clone( doublets = "mixedTripletStepHitDoubletsA", diff --git a/RecoTracker/IterativeTracking/python/PixelLessStep_cff.py b/RecoTracker/IterativeTracking/python/PixelLessStep_cff.py index e1cab74db4f3c..69bb2a7398b4e 100644 --- a/RecoTracker/IterativeTracking/python/PixelLessStep_cff.py +++ b/RecoTracker/IterativeTracking/python/PixelLessStep_cff.py @@ -120,7 +120,7 @@ clusterChargeCut = dict(refToPSet_ = 'SiStripClusterChargeCutTight') ) -from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer pixelLessStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "pixelLessStepSeedLayers", trackingRegions = "pixelLessStepTrackingRegions", diff --git a/RecoTracker/IterativeTracking/python/PixelPairStep_cff.py b/RecoTracker/IterativeTracking/python/PixelPairStep_cff.py index 65fd42814831e..575429dd78529 100644 --- a/RecoTracker/IterativeTracking/python/PixelPairStep_cff.py +++ b/RecoTracker/IterativeTracking/python/PixelPairStep_cff.py @@ -79,7 +79,7 @@ trackingPhase2PU140.toModify(pixelPairStepTrackingRegions, RegionPSet=dict(ptMin = 1.3, useMultipleScattering=False)) # SEEDS -from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer pixelPairStepHitDoublets = _hitPairEDProducer.clone( seedingLayers = "pixelPairStepSeedLayers", trackingRegions = "pixelPairStepTrackingRegions", diff --git a/RecoTracker/IterativeTracking/python/TobTecStep_cff.py b/RecoTracker/IterativeTracking/python/TobTecStep_cff.py index dbab29ad2cad0..b3b9ddb072761 100644 --- a/RecoTracker/IterativeTracking/python/TobTecStep_cff.py +++ b/RecoTracker/IterativeTracking/python/TobTecStep_cff.py @@ -54,7 +54,7 @@ clusterChargeCut = dict(refToPSet_ = 'SiStripClusterChargeCutTight') ) -from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer +from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer tobTecStepHitDoubletsTripl = _hitPairEDProducer.clone( seedingLayers = "tobTecStepSeedLayersTripl", trackingRegions = "tobTecStepTrackingRegionsTripl", @@ -120,7 +120,6 @@ )) # Pair seeds -from RecoTracker.TkHitPairs.hitPairEDProducer_cff import hitPairEDProducer as _hitPairEDProducer tobTecStepHitDoubletsPair = _hitPairEDProducer.clone( seedingLayers = "tobTecStepSeedLayersPair", trackingRegions = "tobTecStepTrackingRegionsPair", diff --git a/RecoTracker/IterativeTracking/python/iterativeTk_cff.py b/RecoTracker/IterativeTracking/python/iterativeTk_cff.py index eee815bed1952..c0cb95230708a 100644 --- a/RecoTracker/IterativeTracking/python/iterativeTk_cff.py +++ b/RecoTracker/IterativeTracking/python/iterativeTk_cff.py @@ -1,5 +1,5 @@ import FWCore.ParameterSet.Config as cms -from RecoTracker.TkSeedGenerator.trackerClusterCheck_cff import * +from RecoTracker.TkSeedGenerator.trackerClusterCheck_cfi import * from RecoTracker.IterativeTracking.InitialStepPreSplitting_cff import * from RecoTracker.IterativeTracking.InitialStep_cff import * diff --git a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc index 78945d38dbdca..04bf731fde37e 100644 --- a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc +++ b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc @@ -74,7 +74,7 @@ void HitPairEDProducer::fillDescriptions(edm::ConfigurationDescriptions& descrip desc.add("maxElement", 1000000); desc.add >("layerPairs", std::vector{{0}})->setComment("Indices to the pairs of consecutive layers, i.e. 0 means (0,1), 1 (1,2) etc."); - descriptions.add("hitPairEDProducer", desc); + descriptions.add("hitPairEDProducerDefault", desc); } void HitPairEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { diff --git a/RecoTracker/TkHitPairs/python/hitPairEDProducer_cff.py b/RecoTracker/TkHitPairs/python/hitPairEDProducer_cfi.py similarity index 62% rename from RecoTracker/TkHitPairs/python/hitPairEDProducer_cff.py rename to RecoTracker/TkHitPairs/python/hitPairEDProducer_cfi.py index 911a0aec2ae19..181d7e19b4b7a 100644 --- a/RecoTracker/TkHitPairs/python/hitPairEDProducer_cff.py +++ b/RecoTracker/TkHitPairs/python/hitPairEDProducer_cfi.py @@ -1,4 +1,6 @@ -from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import * +from RecoTracker.TkHitPairs.hitPairEDProducerDefault_cfi import hitPairEDProducerDefault as _hitPairEDProducerDefault + +hitPairEDProducer = _hitPairEDProducerDefault.clone() from Configuration.Eras.Modifier_trackingPhase1PU70_cff import trackingPhase1PU70 from Configuration.Eras.Modifier_trackingPhase2PU140_cff import trackingPhase2PU140 trackingPhase1PU70.toModify(hitPairEDProducer, maxElement=0) diff --git a/RecoTracker/TkSeedGenerator/plugins/ClusterCheckerEDProducer.cc b/RecoTracker/TkSeedGenerator/plugins/ClusterCheckerEDProducer.cc index 697a7e34037c1..7161f75da377f 100644 --- a/RecoTracker/TkSeedGenerator/plugins/ClusterCheckerEDProducer.cc +++ b/RecoTracker/TkSeedGenerator/plugins/ClusterCheckerEDProducer.cc @@ -33,7 +33,7 @@ void ClusterCheckerEDProducer::fillDescriptions(edm::ConfigurationDescriptions& ClusterChecker::fillDescriptions(desc); desc.addUntracked("silentClusterCheck", false); - descriptions.add("trackerClusterCheck", desc); + descriptions.add("trackerClusterCheckDefault", desc); } void ClusterCheckerEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { diff --git a/RecoTracker/TkSeedGenerator/python/trackerClusterCheck_cff.py b/RecoTracker/TkSeedGenerator/python/trackerClusterCheck_cfi.py similarity index 66% rename from RecoTracker/TkSeedGenerator/python/trackerClusterCheck_cff.py rename to RecoTracker/TkSeedGenerator/python/trackerClusterCheck_cfi.py index e1427264f90ba..8711f40fe8219 100644 --- a/RecoTracker/TkSeedGenerator/python/trackerClusterCheck_cff.py +++ b/RecoTracker/TkSeedGenerator/python/trackerClusterCheck_cfi.py @@ -1,4 +1,6 @@ -from RecoTracker.TkSeedGenerator.trackerClusterCheck_cfi import * +from RecoTracker.TkSeedGenerator.trackerClusterCheckDefault_cfi import trackerClusterCheckDefault as _trackerClusterCheckDefault +trackerClusterCheck = _trackerClusterCheckDefault.clone() + from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker # Disable too many clusters check until we have an updated cut string for phase1 and phase2 From 871c3e5689c52f8138555b4bf651523ad5c4e7c5 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 11 Nov 2016 14:21:13 +0100 Subject: [PATCH 54/69] Migrate FastSim to read TrackingRegions from Event --- .../plugins/TrajectorySeedProducer.cc | 24 +++++++++---------- .../python/DetachedTripletStep_cff.py | 8 +++++-- .../Tracking/python/InitialStep_cff.py | 10 +++++--- .../Tracking/python/LowPtTripletStep_cff.py | 8 +++++-- .../Tracking/python/MixedTripletStep_cff.py | 13 +++++++--- .../Tracking/python/PixelLessStep_cff.py | 8 +++++-- .../Tracking/python/PixelPairStep_cff.py | 10 +++++--- .../Tracking/python/SeedingMigration.py | 10 -------- .../Tracking/python/TobTecStep_cff.py | 14 ++++++++--- .../python/TrajectorySeedProducer_cfi.py | 1 + .../Tracking/python/hltSeeds_cff.py | 9 ++++--- 11 files changed, 71 insertions(+), 44 deletions(-) diff --git a/FastSimulation/Tracking/plugins/TrajectorySeedProducer.cc b/FastSimulation/Tracking/plugins/TrajectorySeedProducer.cc index 45c563cb86b68..b83c5a7da05dc 100644 --- a/FastSimulation/Tracking/plugins/TrajectorySeedProducer.cc +++ b/FastSimulation/Tracking/plugins/TrajectorySeedProducer.cc @@ -39,9 +39,7 @@ #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h" // reco track classes -#include "RecoTracker/TkTrackingRegions/interface/GlobalTrackingRegion.h" -#include "RecoTracker/TkTrackingRegions/interface/TrackingRegionProducer.h" -#include "RecoTracker/TkTrackingRegions/interface/TrackingRegionProducerFactory.h" +#include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h" #include "RecoTracker/TkSeedingLayers/interface/SeedingHitSet.h" #include "RecoTracker/TkSeedGenerator/interface/SeedCreator.h" #include "RecoTracker/TkSeedGenerator/interface/SeedCreatorFactory.h" @@ -67,6 +65,7 @@ class TrajectorySeedProducer: edm::EDGetTokenT recHitCombinationsToken; edm::EDGetTokenT > hitMasksToken; + edm::EDGetTokenT > trackingRegionToken; // other data members unsigned int nHitsPerSeed_; @@ -75,7 +74,6 @@ class TrajectorySeedProducer: SeedingTree _seedingTree; std::unique_ptr seedCreator; - std::unique_ptr theRegionProducer; std::string measurementTrackerLabel; std::unique_ptr seedFinderSelector; @@ -139,10 +137,8 @@ TrajectorySeedProducer::TrajectorySeedProducer(const edm::ParameterSet& conf) seedFinderSelector.reset(new SeedFinderSelector(conf.getParameter("seedFinderSelector"),consumesCollector())); } - /// region producer - edm::ParameterSet regfactoryPSet = conf.getParameter("RegionFactoryPSet"); - std::string regfactoryName = regfactoryPSet.getParameter("ComponentName"); - theRegionProducer.reset(TrackingRegionProducerFactory::get()->create(regfactoryName,regfactoryPSet,consumesCollector())); + /// regions + trackingRegionToken = consumes >(conf.getParameter("trackingRegions")); // seed creator const edm::ParameterSet & seedCreatorPSet = conf.getParameter("SeedCreatorPSet"); @@ -174,8 +170,10 @@ void TrajectorySeedProducer::produce(edm::Event& e, const edm::EventSetup& es) // output data std::unique_ptr output(new TrajectorySeedCollection()); - // produce the regions; - const auto regions = theRegionProducer->regions(e,es); + // read the regions; + edm::Handle > hregions; + e.getByToken(trackingRegionToken, hregions); + const auto& regions = *hregions; // and make sure there is at least one region if(regions.size() == 0) { @@ -208,12 +206,12 @@ void TrajectorySeedProducer::produce(edm::Event& e, const edm::EventSetup& es) } // loop over the regions - for(auto region = regions.begin();region != regions.end(); ++region) + for(const auto& region: regions) { // set the region used in the selector if(seedFinderSelector) { - seedFinderSelector->setTrackingRegion(region->get()); + seedFinderSelector->setTrackingRegion(®ion); } // find hits compatible with the seed requirements @@ -233,7 +231,7 @@ void TrajectorySeedProducer::produce(edm::Event& e, const edm::EventSetup& es) fastTrackingUtilities::setRecHitCombinationIndex(seedHits,icomb); // create the seed - seedCreator->init(**region,es,0); + seedCreator->init(region,es,0); seedCreator->makeSeed( *output, SeedingHitSet( diff --git a/FastSimulation/Tracking/python/DetachedTripletStep_cff.py b/FastSimulation/Tracking/python/DetachedTripletStep_cff.py index dce6e2842d5b8..0c39cd0bb2d37 100644 --- a/FastSimulation/Tracking/python/DetachedTripletStep_cff.py +++ b/FastSimulation/Tracking/python/DetachedTripletStep_cff.py @@ -2,17 +2,20 @@ # import the full tracking equivalent of this file import RecoTracker.IterativeTracking.DetachedTripletStep_cff as _standard -from FastSimulation.Tracking.SeedingMigration import _regionProducerToFactoryPSet, _hitSetProducerToFactoryPSet +from FastSimulation.Tracking.SeedingMigration import _hitSetProducerToFactoryPSet # fast tracking mask producer import FastSimulation.Tracking.FastTrackerRecHitMaskProducer_cfi detachedTripletStepMasks = FastSimulation.Tracking.FastTrackerRecHitMaskProducer_cfi.maskProducerFromClusterRemover(_standard.detachedTripletStepClusters) +# tracking regions +detachedTripletStepTrackingRegions = _standard.detachedTripletStepTrackingRegions.clone() + # trajectory seeds import FastSimulation.Tracking.TrajectorySeedProducer_cfi detachedTripletStepSeeds = FastSimulation.Tracking.TrajectorySeedProducer_cfi.trajectorySeedProducer.clone( layerList = _standard.detachedTripletStepSeedLayers.layerList.value(), - RegionFactoryPSet = _regionProducerToFactoryPSet(_standard.detachedTripletStepTrackingRegions), + trackingRegions = "detachedTripletStepTrackingRegions", hitMasks = cms.InputTag("detachedTripletStepMasks") ) detachedTripletStepSeeds.seedFinderSelector.pixelTripletGeneratorFactory = _hitSetProducerToFactoryPSet(_standard.detachedTripletStepHitTriplets) @@ -37,6 +40,7 @@ # Final sequence DetachedTripletStep = cms.Sequence(detachedTripletStepMasks + +detachedTripletStepTrackingRegions +detachedTripletStepSeeds +detachedTripletStepTrackCandidates +detachedTripletStepTracks diff --git a/FastSimulation/Tracking/python/InitialStep_cff.py b/FastSimulation/Tracking/python/InitialStep_cff.py index 4c56158de9be7..603334bbd9462 100644 --- a/FastSimulation/Tracking/python/InitialStep_cff.py +++ b/FastSimulation/Tracking/python/InitialStep_cff.py @@ -2,13 +2,16 @@ # import the full tracking equivalent of this file import RecoTracker.IterativeTracking.InitialStep_cff as _standard -from FastSimulation.Tracking.SeedingMigration import _regionProducerToFactoryPSet, _hitSetProducerToFactoryPSet +from FastSimulation.Tracking.SeedingMigration import _hitSetProducerToFactoryPSet + +# tracking regions +initialStepTrackingRegions = _standard.initialStepTrackingRegions.clone() # trajectory seeds import FastSimulation.Tracking.TrajectorySeedProducer_cfi initialStepSeeds = FastSimulation.Tracking.TrajectorySeedProducer_cfi.trajectorySeedProducer.clone( layerList = _standard.initialStepSeedLayers.layerList.value(), - RegionFactoryPSet = _regionProducerToFactoryPSet(_standard.initialStepTrackingRegions) + trackingRegions = "initialStepTrackingRegions" ) initialStepSeeds.seedFinderSelector.pixelTripletGeneratorFactory = _hitSetProducerToFactoryPSet(_standard.initialStepHitTriplets) initialStepSeeds.seedFinderSelector.pixelTripletGeneratorFactory.SeedComparitorPSet.ComponentName = "none" @@ -37,7 +40,8 @@ initialStep = _standard.initialStep.clone() # Final sequence -InitialStep = cms.Sequence(initialStepSeeds +InitialStep = cms.Sequence(initialStepTrackingRegions + +initialStepSeeds +initialStepTrackCandidates +initialStepTracks +firstStepPrimaryVerticesBeforeMixing diff --git a/FastSimulation/Tracking/python/LowPtTripletStep_cff.py b/FastSimulation/Tracking/python/LowPtTripletStep_cff.py index 65df2c7cf3168..875c32903ff09 100644 --- a/FastSimulation/Tracking/python/LowPtTripletStep_cff.py +++ b/FastSimulation/Tracking/python/LowPtTripletStep_cff.py @@ -2,17 +2,20 @@ # import the full tracking equivalent of this file import RecoTracker.IterativeTracking.LowPtTripletStep_cff as _standard -from FastSimulation.Tracking.SeedingMigration import _regionProducerToFactoryPSet, _hitSetProducerToFactoryPSet +from FastSimulation.Tracking.SeedingMigration import _hitSetProducerToFactoryPSet # fast tracking mask producer import FastSimulation.Tracking.FastTrackerRecHitMaskProducer_cfi lowPtTripletStepMasks = FastSimulation.Tracking.FastTrackerRecHitMaskProducer_cfi.maskProducerFromClusterRemover(_standard.lowPtTripletStepClusters) +# tracking regions +lowPtTripletStepTrackingRegions = _standard.lowPtTripletStepTrackingRegions.clone() + # trajectory seeds import FastSimulation.Tracking.TrajectorySeedProducer_cfi lowPtTripletStepSeeds = FastSimulation.Tracking.TrajectorySeedProducer_cfi.trajectorySeedProducer.clone( layerList = _standard.lowPtTripletStepSeedLayers.layerList.value(), - RegionFactoryPSet = _regionProducerToFactoryPSet(_standard.lowPtTripletStepTrackingRegions), + trackingRegions = "lowPtTripletStepTrackingRegions", hitMasks = cms.InputTag("lowPtTripletStepMasks"), ) lowPtTripletStepSeeds.seedFinderSelector.pixelTripletGeneratorFactory = _hitSetProducerToFactoryPSet(_standard.lowPtTripletStepHitTriplets) @@ -35,6 +38,7 @@ # Final swquence LowPtTripletStep = cms.Sequence(lowPtTripletStepMasks + +lowPtTripletStepTrackingRegions +lowPtTripletStepSeeds +lowPtTripletStepTrackCandidates +lowPtTripletStepTracks diff --git a/FastSimulation/Tracking/python/MixedTripletStep_cff.py b/FastSimulation/Tracking/python/MixedTripletStep_cff.py index d7ae02fd393cb..bc2b213e09f77 100644 --- a/FastSimulation/Tracking/python/MixedTripletStep_cff.py +++ b/FastSimulation/Tracking/python/MixedTripletStep_cff.py @@ -2,28 +2,33 @@ # import the full tracking equivalent of this file import RecoTracker.IterativeTracking.MixedTripletStep_cff as _standard -from FastSimulation.Tracking.SeedingMigration import _regionProducerToFactoryPSet, _hitSetProducerToFactoryPSet +from FastSimulation.Tracking.SeedingMigration import _hitSetProducerToFactoryPSet # fast tracking mask producer import FastSimulation.Tracking.FastTrackerRecHitMaskProducer_cfi mixedTripletStepMasks = FastSimulation.Tracking.FastTrackerRecHitMaskProducer_cfi.maskProducerFromClusterRemover(_standard.mixedTripletStepClusters) mixedTripletStepMasks.oldHitRemovalInfo = cms.InputTag("pixelPairStepMasks") +# tracking regions +mixedTripletStepTrackingRegionsA = _standard.mixedTripletStepTrackingRegionsA.clone() + # trajectory seeds import FastSimulation.Tracking.TrajectorySeedProducer_cfi mixedTripletStepSeedsA = FastSimulation.Tracking.TrajectorySeedProducer_cfi.trajectorySeedProducer.clone( layerList = _standard.mixedTripletStepSeedLayersA.layerList.value(), - RegionFactoryPSet = _regionProducerToFactoryPSet(_standard.mixedTripletStepTrackingRegionsA), + trackingRegions = "mixedTripletStepTrackingRegionsA", hitMasks = cms.InputTag("mixedTripletStepMasks") ) mixedTripletStepSeedsA.seedFinderSelector.pixelTripletGeneratorFactory = _hitSetProducerToFactoryPSet(_standard.mixedTripletStepHitTripletsA) ### +mixedTripletStepTrackingRegionsB = _standard.mixedTripletStepTrackingRegionsB.clone() + import FastSimulation.Tracking.TrajectorySeedProducer_cfi mixedTripletStepSeedsB = FastSimulation.Tracking.TrajectorySeedProducer_cfi.trajectorySeedProducer.clone( layerList = _standard.mixedTripletStepSeedLayersB.layerList.value(), - RegionFactoryPSet = _regionProducerToFactoryPSet(_standard.mixedTripletStepTrackingRegionsB), + trackingRegions = "mixedTripletStepTrackingRegionsB", hitMasks = cms.InputTag("mixedTripletStepMasks") ) mixedTripletStepSeedsB.seedFinderSelector.pixelTripletGeneratorFactory = _hitSetProducerToFactoryPSet(_standard.mixedTripletStepHitTripletsB) @@ -51,7 +56,9 @@ # Final sequence MixedTripletStep = cms.Sequence(mixedTripletStepMasks + +mixedTripletStepTrackingRegionsA +mixedTripletStepSeedsA + +mixedTripletStepTrackingRegionsB +mixedTripletStepSeedsB +mixedTripletStepSeeds +mixedTripletStepTrackCandidates diff --git a/FastSimulation/Tracking/python/PixelLessStep_cff.py b/FastSimulation/Tracking/python/PixelLessStep_cff.py index 932737e5f18c3..1543d9c286edd 100644 --- a/FastSimulation/Tracking/python/PixelLessStep_cff.py +++ b/FastSimulation/Tracking/python/PixelLessStep_cff.py @@ -2,17 +2,20 @@ # import the full tracking equivalent of this file import RecoTracker.IterativeTracking.PixelLessStep_cff as _standard -from FastSimulation.Tracking.SeedingMigration import _regionProducerToFactoryPSet, _hitSetProducerToFactoryPSet +from FastSimulation.Tracking.SeedingMigration import _hitSetProducerToFactoryPSet # fast tracking mask producer import FastSimulation.Tracking.FastTrackerRecHitMaskProducer_cfi pixelLessStepMasks = FastSimulation.Tracking.FastTrackerRecHitMaskProducer_cfi.maskProducerFromClusterRemover(_standard.pixelLessStepClusters) +# tracking regions +pixelLessStepTrackingRegions = _standard.pixelLessStepTrackingRegions.clone() + # trajectory seeds import FastSimulation.Tracking.TrajectorySeedProducer_cfi pixelLessStepSeeds = FastSimulation.Tracking.TrajectorySeedProducer_cfi.trajectorySeedProducer.clone( layerList = _standard.pixelLessStepSeedLayers.layerList.value(), - RegionFactoryPSet = _regionProducerToFactoryPSet(_standard.pixelLessStepTrackingRegions), + trackingRegions = "pixelLessStepTrackingRegions", hitMasks = cms.InputTag("pixelLessStepMasks"), ) pixelLessStepSeeds.seedFinderSelector.MultiHitGeneratorFactory = _hitSetProducerToFactoryPSet(_standard.pixelLessStepHitTriplets) @@ -38,6 +41,7 @@ # Final sequence PixelLessStep = cms.Sequence(pixelLessStepMasks + +pixelLessStepTrackingRegions +pixelLessStepSeeds +pixelLessStepTrackCandidates +pixelLessStepTracks diff --git a/FastSimulation/Tracking/python/PixelPairStep_cff.py b/FastSimulation/Tracking/python/PixelPairStep_cff.py index 05ea7d79f9f6e..e5f2a860f45da 100644 --- a/FastSimulation/Tracking/python/PixelPairStep_cff.py +++ b/FastSimulation/Tracking/python/PixelPairStep_cff.py @@ -2,20 +2,23 @@ # import the full tracking equivalent of this file import RecoTracker.IterativeTracking.PixelPairStep_cff as _standard -from FastSimulation.Tracking.SeedingMigration import _regionProducerToFactoryPSet # fast tracking mask producer import FastSimulation.Tracking.FastTrackerRecHitMaskProducer_cfi pixelPairStepMasks = FastSimulation.Tracking.FastTrackerRecHitMaskProducer_cfi.maskProducerFromClusterRemover(_standard.pixelPairStepClusters) +# tracking regions +pixelPairStepTrackingRegions = _standard.pixelPairStepTrackingRegions.clone( + RegionPSet=dict(VertexCollection = "firstStepPrimaryVerticesBeforeMixing") +) + # trajectory seeds import FastSimulation.Tracking.TrajectorySeedProducer_cfi pixelPairStepSeeds = FastSimulation.Tracking.TrajectorySeedProducer_cfi.trajectorySeedProducer.clone( layerList = _standard.pixelPairStepSeedLayers.layerList.value(), - RegionFactoryPSet = _regionProducerToFactoryPSet(_standard.pixelPairStepTrackingRegions), + trackingRegions = "pixelPairStepTrackingRegions", hitMasks = cms.InputTag("pixelPairStepMasks"), ) -pixelPairStepSeeds.RegionFactoryPSet.RegionPSet.VertexCollection = cms.InputTag("firstStepPrimaryVerticesBeforeMixing") # track candidate import FastSimulation.Tracking.TrackCandidateProducer_cfi @@ -34,6 +37,7 @@ # Final sequence PixelPairStep = cms.Sequence(pixelPairStepMasks + +pixelPairStepTrackingRegions +pixelPairStepSeeds +pixelPairStepTrackCandidates +pixelPairStepTracks diff --git a/FastSimulation/Tracking/python/SeedingMigration.py b/FastSimulation/Tracking/python/SeedingMigration.py index 5b3eb2f737e78..be2bfe77bf35f 100644 --- a/FastSimulation/Tracking/python/SeedingMigration.py +++ b/FastSimulation/Tracking/python/SeedingMigration.py @@ -1,15 +1,5 @@ import FWCore.ParameterSet.Config as cms -def _regionProducerToFactoryPSet(producer): - _map = { - "GlobalTrackinRegionFromBeamSpotEDProducer": "GlobalRegionProducerFromBeamSpot", - "GlobalTrackingRegionWithVerticesEDProducer": "GlobalTrackingRegionWithVerticesProducer", - } - return cms.PSet( - ComponentName = cms.string(_map[producer._TypedParameterizable__type]), - RegionPSet = producer.RegionPSet.clone(), - ) - def _copy(old, new, skip=[]): skipSet = set(skip) for key in old.parameterNames_(): diff --git a/FastSimulation/Tracking/python/TobTecStep_cff.py b/FastSimulation/Tracking/python/TobTecStep_cff.py index 0978c0003ea3d..87595f87a4749 100644 --- a/FastSimulation/Tracking/python/TobTecStep_cff.py +++ b/FastSimulation/Tracking/python/TobTecStep_cff.py @@ -2,28 +2,34 @@ # import the full tracking equivalent of this file import RecoTracker.IterativeTracking.TobTecStep_cff as _standard -from FastSimulation.Tracking.SeedingMigration import _regionProducerToFactoryPSet, _hitSetProducerToFactoryPSet +from FastSimulation.Tracking.SeedingMigration import _hitSetProducerToFactoryPSet # fast tracking mask producer import FastSimulation.Tracking.FastTrackerRecHitMaskProducer_cfi tobTecStepMasks = FastSimulation.Tracking.FastTrackerRecHitMaskProducer_cfi.maskProducerFromClusterRemover(_standard.tobTecStepClusters) +# tracking regions +tobTecStepTrackingRegionsTripl = _standard.tobTecStepTrackingRegionsTripl.clone() + # trajectory seeds import FastSimulation.Tracking.TrajectorySeedProducer_cfi tobTecStepSeedsTripl = FastSimulation.Tracking.TrajectorySeedProducer_cfi.trajectorySeedProducer.clone( layerList = _standard.tobTecStepSeedLayersTripl.layerList.value(), - RegionFactoryPSet = _regionProducerToFactoryPSet(_standard.tobTecStepTrackingRegionsTripl), + trackingRegions = "tobTecStepTrackingRegionsTripl", hitMasks = cms.InputTag("tobTecStepMasks"), ) tobTecStepSeedsTripl.seedFinderSelector.MultiHitGeneratorFactory = _hitSetProducerToFactoryPSet(_standard.tobTecStepHitTripletsTripl) tobTecStepSeedsTripl.seedFinderSelector.MultiHitGeneratorFactory.SeedComparitorPSet=cms.PSet( ComponentName = cms.string( "none" ) ) tobTecStepSeedsTripl.seedFinderSelector.MultiHitGeneratorFactory.refitHits = False +# pair tracking regions +tobTecStepTrackingRegionsPair = _standard.tobTecStepTrackingRegionsPair.clone() + #pair seeds import FastSimulation.Tracking.TrajectorySeedProducer_cfi tobTecStepSeedsPair = FastSimulation.Tracking.TrajectorySeedProducer_cfi.trajectorySeedProducer.clone( layerList = _standard.tobTecStepSeedLayersPair.layerList.value(), - RegionFactoryPSet = _regionProducerToFactoryPSet(_standard.tobTecStepTrackingRegionsPair), + trackingRegions = "tobTecStepTrackingRegionsPair", hitMasks = cms.InputTag("tobTecStepMasks"), ) @@ -56,7 +62,9 @@ # Final sequence TobTecStep = cms.Sequence(tobTecStepMasks + +tobTecStepTrackingRegionsTripl +tobTecStepSeedsTripl + +tobTecStepTrackingRegionsPair +tobTecStepSeedsPair +tobTecStepSeeds +tobTecStepTrackCandidates diff --git a/FastSimulation/Tracking/python/TrajectorySeedProducer_cfi.py b/FastSimulation/Tracking/python/TrajectorySeedProducer_cfi.py index 51edf2940a862..c8bb81ca286b8 100644 --- a/FastSimulation/Tracking/python/TrajectorySeedProducer_cfi.py +++ b/FastSimulation/Tracking/python/TrajectorySeedProducer_cfi.py @@ -4,6 +4,7 @@ trajectorySeedProducer = cms.EDProducer( "TrajectorySeedProducer", + trackingRegions = cms.InputTag(""), SeedCreatorPSet = RecoTracker.TkSeedGenerator.SeedFromConsecutiveHitsCreator_cfi.SeedFromConsecutiveHitsCreator.clone( TTRHBuilder = cms.string("WithoutRefit")), recHitCombinations = cms.InputTag("fastMatchedTrackerRecHitCombinations"), diff --git a/FastSimulation/Tracking/python/hltSeeds_cff.py b/FastSimulation/Tracking/python/hltSeeds_cff.py index 74f264fe8f86a..56f21a37d9b80 100644 --- a/FastSimulation/Tracking/python/hltSeeds_cff.py +++ b/FastSimulation/Tracking/python/hltSeeds_cff.py @@ -2,12 +2,15 @@ import FastSimulation.Tracking.TrajectorySeedProducer_cfi import FastSimulation.Tracking.InitialStep_cff +# tracking regions +hltPixelTripletTrackingRegions = FastSimulation.Tracking.InitialStep_cff.initialStepTrackingRegions.clone() + # pixel triplet seeds import RecoTracker.TkSeedingLayers.PixelLayerTriplets_cfi hltPixelTripletSeeds = FastSimulation.Tracking.TrajectorySeedProducer_cfi.trajectorySeedProducer.clone( layerList = RecoTracker.TkSeedingLayers.PixelLayerTriplets_cfi.PixelLayerTriplets.layerList, skipSeedFinderSelector = cms.untracked.bool(True), - RegionFactoryPSet = FastSimulation.Tracking.InitialStep_cff.initialStepSeeds.RegionFactoryPSet.clone() + trackingRegions = "hltPixelTripletTrackingRegions" ) # pixel pair seeds @@ -17,9 +20,9 @@ hltPixelPairSeeds = FastSimulation.Tracking.TrajectorySeedProducer_cfi.trajectorySeedProducer.clone( layerList = RecoTracker.TkSeedingLayers.MixedLayerPairs_cfi.MixedLayerPairs.layerList, skipSeedFinderSelector = cms.untracked.bool(True), - RegionFactoryPSet = FastSimulation.Tracking.InitialStep_cff.initialStepSeeds.RegionFactoryPSet.clone() + trackingRegions = "hltPixelTripletTrackingRegions" ) # todo: add mixed pair seeds? -hltSeedSequence =cms.Sequence(hltPixelTripletSeeds+hltPixelPairSeeds) +hltSeedSequence =cms.Sequence(hltPixelTripletTrackingRegions+hltPixelTripletSeeds+hltPixelPairSeeds) From 216de845d7739cd4a9f15ed2a41b4de1a50db74c Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 15 Nov 2016 11:06:56 +0100 Subject: [PATCH 55/69] Migrate customiseClusterCheckForHighPileup.py --- .../customiseClusterCheckForHighPileup.py | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/RecoTracker/Configuration/python/customiseClusterCheckForHighPileup.py b/RecoTracker/Configuration/python/customiseClusterCheckForHighPileup.py index 9f158c3f22a1f..fbbaacc9c91c2 100644 --- a/RecoTracker/Configuration/python/customiseClusterCheckForHighPileup.py +++ b/RecoTracker/Configuration/python/customiseClusterCheckForHighPileup.py @@ -1,12 +1,27 @@ def customiseClusterCheckForHighPileup(process): + _maxPixel = 80000 + _cut = "strip < 800000 && pixel < 80000 && (strip < 50000 + 10*pixel) && (pixel < 5000 + strip/7.)" + + _maxElement = 1000000 + for module in process._Process__producers.values(): + cppType = module._TypedParameterizable__type + + # cluster multiplicity check + if cppType == "ClusterCheckerEDProducer": + module.MaxNumberOfPixelClusters = _maxPixel + module.cut = _cut if hasattr(module, "ClusterCheckPSet"): - module.ClusterCheckPSet.MaxNumberOfPixelClusters = 80000 + module.ClusterCheckPSet.MaxNumberOfPixelClusters = _maxPixel # PhotonConversionTrajectorySeedProducerFromQuadruplets does not have "cut"... if hasattr(module.ClusterCheckPSet, "cut"): - module.ClusterCheckPSet.cut = "strip < 800000 && pixel < 80000 && (strip < 50000 + 10*pixel) && (pixel < 5000 + strip/7.)" + module.ClusterCheckPSet.cut = _cut + + # maxElement + if cppType in ["PixelTripletLargeTipEDProducer", "MultiHitFromChi2EDProducer"]: + module.maxElement = _maxElement if hasattr(module, "OrderedHitsFactoryPSet") and hasattr(module.OrderedHitsFactoryPSet, "GeneratorPSet"): if module.OrderedHitsFactoryPSet.GeneratorPSet.ComponentName.value() in ["PixelTripletLargeTipGenerator", "MultiHitGeneratorFromChi2"]: - module.OrderedHitsFactoryPSet.GeneratorPSet.maxElement = 1000000 + module.OrderedHitsFactoryPSet.GeneratorPSet.maxElement = _maxElement return process From bb4f845e2b142c3e776ea91c7a9c85d8d45f886e Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 15 Nov 2016 15:05:34 +0100 Subject: [PATCH 56/69] Migrate peripheralPbPb era customizations --- .../python/pixelTripletLargeTipEDProducer_cfi.py | 3 +++ .../TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc | 2 +- .../TkSeedGenerator/python/multiHitFromChi2EDProducer_cfi.py | 5 +++++ .../TkSeedGenerator/python/trackerClusterCheck_cfi.py | 5 +++++ 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 RecoTracker/TkSeedGenerator/python/multiHitFromChi2EDProducer_cfi.py diff --git a/RecoPixelVertexing/PixelTriplets/python/pixelTripletLargeTipEDProducer_cfi.py b/RecoPixelVertexing/PixelTriplets/python/pixelTripletLargeTipEDProducer_cfi.py index 02347ee106f86..5b9aa1819d9ff 100644 --- a/RecoPixelVertexing/PixelTriplets/python/pixelTripletLargeTipEDProducer_cfi.py +++ b/RecoPixelVertexing/PixelTriplets/python/pixelTripletLargeTipEDProducer_cfi.py @@ -7,3 +7,6 @@ trackingLowPU.toModify(pixelTripletLargeTipEDProducer, maxElement=100000) trackingPhase1PU70.toModify(pixelTripletLargeTipEDProducer, maxElement=0) trackingPhase2PU140.toModify(pixelTripletLargeTipEDProducer, maxElement=0) + +from Configuration.Eras.Modifier_peripheralPbPb_cff import peripheralPbPb +peripheralPbPb.toModify(pixelTripletLargeTipEDProducer, maxElement=1000000) diff --git a/RecoTracker/TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc b/RecoTracker/TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc index c299b7faab124..8667c61359519 100644 --- a/RecoTracker/TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc +++ b/RecoTracker/TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc @@ -46,7 +46,7 @@ void MultiHitFromChi2EDProducer::fillDescriptions(edm::ConfigurationDescriptions MultiHitGeneratorFromChi2::fillDescriptions(desc); - auto label = MultiHitGeneratorFromChi2::fillDescriptionsLabel() + std::string("EDProducer"); + auto label = MultiHitGeneratorFromChi2::fillDescriptionsLabel() + std::string("EDProducerDefault"); descriptions.add(label, desc); } diff --git a/RecoTracker/TkSeedGenerator/python/multiHitFromChi2EDProducer_cfi.py b/RecoTracker/TkSeedGenerator/python/multiHitFromChi2EDProducer_cfi.py new file mode 100644 index 0000000000000..3fd06df88d67f --- /dev/null +++ b/RecoTracker/TkSeedGenerator/python/multiHitFromChi2EDProducer_cfi.py @@ -0,0 +1,5 @@ +from RecoTracker.TkSeedGenerator.multiHitFromChi2EDProducerDefault_cfi import multiHitFromChi2EDProducerDefault as _multiHitFromChi2EDProducerDefault +multiHitFromChi2EDProducer = _multiHitFromChi2EDProducerDefault.clone() + +from Configuration.Eras.Modifier_peripheralPbPb_cff import peripheralPbPb +peripheralPbPb.toModify(multiHitFromChi2EDProducer, maxElement = 1000000) diff --git a/RecoTracker/TkSeedGenerator/python/trackerClusterCheck_cfi.py b/RecoTracker/TkSeedGenerator/python/trackerClusterCheck_cfi.py index 8711f40fe8219..0c808ebd13594 100644 --- a/RecoTracker/TkSeedGenerator/python/trackerClusterCheck_cfi.py +++ b/RecoTracker/TkSeedGenerator/python/trackerClusterCheck_cfi.py @@ -6,3 +6,8 @@ # Disable too many clusters check until we have an updated cut string for phase1 and phase2 phase1Pixel.toModify(trackerClusterCheck, doClusterCheck=False) # FIXME phase2_tracker.toModify(trackerClusterCheck, doClusterCheck=False) # FIXME + +from Configuration.Eras.Modifier_peripheralPbPb_cff import peripheralPbPb +peripheralPbPb.toModify(trackerClusterCheck, + cut = "strip < 400000 && pixel < 40000 && (strip < 60000 + 7.0*pixel) && (pixel < 8000 + 0.14*strip)" +) From 57fd3240da8323a5a70c25d97ee74876f6057f0a Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 15 Nov 2016 15:23:10 +0100 Subject: [PATCH 57/69] Remove commented unnecessary config --- .../IterativeTracking/python/JetCoreRegionalStep_cff.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/RecoTracker/IterativeTracking/python/JetCoreRegionalStep_cff.py b/RecoTracker/IterativeTracking/python/JetCoreRegionalStep_cff.py index 04f4421426348..6a50a04c74ae3 100644 --- a/RecoTracker/IterativeTracking/python/JetCoreRegionalStep_cff.py +++ b/RecoTracker/IterativeTracking/python/JetCoreRegionalStep_cff.py @@ -86,14 +86,6 @@ jetCoreRegionalStepSeeds = _seedCreatorFromRegionConsecutiveHitsEDProducer.clone( seedingHitSets = "jetCoreRegionalStepHitDoublets", forceKinematicWithRegionDirection = True -# SeedComparitorPSet = dict(# FIXME: is this defined in any cfi that could be imported instead of copy-paste? -# ComponentName = 'PixelClusterShapeSeedComparitor', -# FilterAtHelixStage = cms.bool(True), -# FilterPixelHits = cms.bool(True), -# FilterStripHits = cms.bool(False), -# ClusterShapeHitFilterName = cms.string('ClusterShapeHitFilter'), -# ClusterShapeCacheSrc = cms.InputTag('siPixelClusterShapeCache'), -# ) ) # QUALITY CUTS DURING TRACK BUILDING From 7cf68d1ae513b45f9c21eb1fdd77e3a9fa6c0d76 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 15 Nov 2016 15:23:38 +0100 Subject: [PATCH 58/69] Remove newline --- RecoTracker/TkSeedGenerator/plugins/ClusterCheckerEDProducer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoTracker/TkSeedGenerator/plugins/ClusterCheckerEDProducer.cc b/RecoTracker/TkSeedGenerator/plugins/ClusterCheckerEDProducer.cc index 7161f75da377f..6367924c51ae5 100644 --- a/RecoTracker/TkSeedGenerator/plugins/ClusterCheckerEDProducer.cc +++ b/RecoTracker/TkSeedGenerator/plugins/ClusterCheckerEDProducer.cc @@ -43,7 +43,7 @@ void ClusterCheckerEDProducer::produce(edm::Event& iEvent, const edm::EventSetup size_t clustsOrZero = theClusterCheck.tooManyClusters(iEvent); if (clustsOrZero){ if (!theSilentOnClusterCheck) - edm::LogError("TooManyClusters") << "Found too many clusters (" << clustsOrZero << "), bailing out.\n"; + edm::LogError("TooManyClusters") << "Found too many clusters (" << clustsOrZero << "), bailing out."; *ret = false; } From a55b93af6d2769f936ce03fdb938792c3cf7de64 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 15 Nov 2016 15:38:30 +0100 Subject: [PATCH 59/69] Remove HiRegitMuonLowPtTripletStep_cff, HiRegitMuonTobTecStep_cff and testRegionalMuonTracking_cfg.py as obsolete --- .../python/HiRegitMuonLowPtTripletStep_cff.py | 122 --------------- .../python/HiRegitMuonTobTecStep_cff.py | 141 ------------------ .../test/testRegionalMuonTracking_cfg.py | 141 ------------------ 3 files changed, 404 deletions(-) delete mode 100644 RecoHI/HiMuonAlgos/python/HiRegitMuonLowPtTripletStep_cff.py delete mode 100644 RecoHI/HiMuonAlgos/python/HiRegitMuonTobTecStep_cff.py delete mode 100644 RecoHI/HiMuonAlgos/test/testRegionalMuonTracking_cfg.py diff --git a/RecoHI/HiMuonAlgos/python/HiRegitMuonLowPtTripletStep_cff.py b/RecoHI/HiMuonAlgos/python/HiRegitMuonLowPtTripletStep_cff.py deleted file mode 100644 index 4128eb676c05a..0000000000000 --- a/RecoHI/HiMuonAlgos/python/HiRegitMuonLowPtTripletStep_cff.py +++ /dev/null @@ -1,122 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -# pp iterative tracking modified for hiOffline reco (the vertex is the one reconstructed in HI) -################################### 1st step:pixel-triplet seeding, lower-pT; - -from RecoHI.HiTracking.HITrackingRegionProducer_cfi import * -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.vertexCollection = cms.InputTag("hiSelectedVertex") -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonSrc= cms.InputTag("standAloneMuons","UpdatedAtVtx") - -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.UseVertex = True -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.Phi_fixed = True -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.Eta_fixed = True -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.DeltaPhi = 0.3 -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.DeltaEta = 0.2 - -################################### -from RecoTracker.IterativeTracking.LowPtTripletStep_cff import * - -# remove previously used clusters -hiRegitMuLowPtTripletStepClusters = RecoTracker.IterativeTracking.LowPtTripletStep_cff.lowPtTripletStepClusters.clone( - trajectories = cms.InputTag("hiRegitMuDetachedTripletStepTracks"), - overrideTrkQuals = cms.InputTag('hiRegitMuDetachedTripletStepSelector','hiRegitMuDetachedTripletStep'), - trackClassifier = cms.InputTag(''), - oldClusterRemovalInfo = cms.InputTag("hiRegitMuDetachedTripletStepClusters"), - TrackQuality = cms.string('tight') -) - -# SEEDING LAYERS -hiRegitMuLowPtTripletStepSeedLayers = RecoTracker.IterativeTracking.LowPtTripletStep_cff.lowPtTripletStepSeedLayers.clone() -hiRegitMuLowPtTripletStepSeedLayers.BPix.skipClusters = cms.InputTag('hiRegitMuLowPtTripletStepClusters') -hiRegitMuLowPtTripletStepSeedLayers.FPix.skipClusters = cms.InputTag('hiRegitMuLowPtTripletStepClusters') - -# seeds -hiRegitMuLowPtTripletStepSeeds = RecoTracker.IterativeTracking.LowPtTripletStep_cff.lowPtTripletStepSeeds.clone() -hiRegitMuLowPtTripletStepSeeds.RegionFactoryPSet = HiTrackingRegionFactoryFromSTAMuonsBlock.clone() -hiRegitMuLowPtTripletStepSeeds.ClusterCheckPSet.doClusterCheck = False # do not check for max number of clusters pixel or strips -hiRegitMuLowPtTripletStepSeeds.RegionFactoryPSet.MuonTrackingRegionBuilder.Pt_min = 0.9 -hiRegitMuLowPtTripletStepSeeds.RegionFactoryPSet.MuonTrackingRegionBuilder.DeltaR = 1. # default = 0.2 -hiRegitMuLowPtTripletStepSeeds.RegionFactoryPSet.MuonTrackingRegionBuilder.DeltaZ = 1. # this give you the length -hiRegitMuLowPtTripletStepSeeds.RegionFactoryPSet.MuonTrackingRegionBuilder.Rescale_Dz = 4. # max(DeltaZ_Region,Rescale_Dz*vtx->zError()) -hiRegitMuLowPtTripletStepSeeds.OrderedHitsFactoryPSet.SeedingLayers = 'hiRegitMuLowPtTripletStepSeedLayers' - - - -# building: feed the new-named seeds -hiRegitMuLowPtTripletStepStandardTrajectoryFilter = TrackingTools.TrajectoryFiltering.TrajectoryFilter_cff.CkfBaseTrajectoryFilter_block.clone( - minPt = 0.8 - ) - -hiRegitMuLowPtTripletStepTrajectoryFilter = cms.PSet( - ComponentType = cms.string('CompositeTrajectoryFilter'), - filters = cms.VPSet(cms.PSet( - refToPSet_ = cms.string('hiRegitMuLowPtTripletStepStandardTrajectoryFilter') - ), - cms.PSet( - refToPSet_ = cms.string('ClusterShapeTrajectoryFilter') - )) - ) - - -hiRegitMuLowPtTripletStepTrajectoryBuilder = RecoTracker.IterativeTracking.LowPtTripletStep_cff.lowPtTripletStepTrajectoryBuilder.clone( - trajectoryFilter = cms.PSet( - refToPSet_ = cms.string('hiRegitMuLowPtTripletStepTrajectoryFilter',) - ), -) - -# track candidates -hiRegitMuLowPtTripletStepTrackCandidates = RecoTracker.IterativeTracking.LowPtTripletStep_cff.lowPtTripletStepTrackCandidates.clone( - src = cms.InputTag('hiRegitMuLowPtTripletStepSeeds'), - TrajectoryBuilderPSet = cms.PSet( - refToPSet_ = cms.string('hiRegitMuLowPtTripletStepTrajectoryBuilder') - ), - clustersToSkip = cms.InputTag('hiRegitMuLowPtTripletStepClusters'), - maxNSeeds = cms.uint32(1000000) - ) - -# fitting: feed new-names -hiRegitMuLowPtTripletStepTracks = RecoTracker.IterativeTracking.LowPtTripletStep_cff.lowPtTripletStepTracks.clone( - AlgorithmName = cms.string('hiRegitMuLowPtTripletStep'), - src = 'hiRegitMuLowPtTripletStepTrackCandidates' -) - - -import RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi -import RecoHI.HiTracking.hiMultiTrackSelector_cfi -hiRegitMuLowPtTripletStepSelector = RecoHI.HiTracking.hiMultiTrackSelector_cfi.hiMultiTrackSelector.clone( - src ='hiRegitMuLowPtTripletStepTracks', - vertices = cms.InputTag("hiSelectedVertex"), - useAnyMVA = cms.bool(True), - GBRForestLabel = cms.string('HIMVASelectorIter5'), - GBRForestVars = cms.vstring(['chi2perdofperlayer', 'dxyperdxyerror', 'dzperdzerror', 'relpterr', 'nhits', 'nlayers', 'eta']), - trackSelectors= cms.VPSet( - RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.looseMTS.clone( - name = 'hiRegitMuLowPtTripletStepLoose', - min_nhits = cms.uint32(8) - ), #end of pset - RecoHI.HiTracking.hiMultiTrackSelector_cfi.hiLooseMTS.clone( - name = 'hiRegitMuLowPtTripletStepTight', - preFilterName = 'hiRegitMuLowPtTripletStepLoose', - min_nhits = cms.uint32(8), - useMVA = cms.bool(True), - minMVA = cms.double(-0.58) - ), - RecoHI.HiTracking.hiMultiTrackSelector_cfi.hiTightMTS.clone( - name = 'hiRegitMuLowPtTripletStep', - preFilterName = 'hiRegitMuLowPtTripletStepTight', - min_nhits = cms.uint32(8), - useMVA = cms.bool(True), - minMVA = cms.double(0.35) - ), - ) #end of vpset -) - -hiRegitMuonLowPtTripletStep = cms.Sequence(hiRegitMuLowPtTripletStepClusters* - hiRegitMuLowPtTripletStepSeedLayers* - hiRegitMuLowPtTripletStepSeeds* - hiRegitMuLowPtTripletStepTrackCandidates* - hiRegitMuLowPtTripletStepTracks* - hiRegitMuLowPtTripletStepSelector) - - - diff --git a/RecoHI/HiMuonAlgos/python/HiRegitMuonTobTecStep_cff.py b/RecoHI/HiMuonAlgos/python/HiRegitMuonTobTecStep_cff.py deleted file mode 100644 index ea8e8a2d40e80..0000000000000 --- a/RecoHI/HiMuonAlgos/python/HiRegitMuonTobTecStep_cff.py +++ /dev/null @@ -1,141 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -# pp iterative tracking modified for hiOffline reco (the vertex is the one reconstructed in HI) -################################### 6th step: very large impact parameter trackng using TOB+TEC ring 5 seeding --pair - -from RecoHI.HiTracking.HITrackingRegionProducer_cfi import * -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.vertexCollection = cms.InputTag("hiSelectedVertex") -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonSrc= cms.InputTag("standAloneMuons","UpdatedAtVtx") - -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.UseVertex = True - -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.Phi_fixed = True -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.Eta_fixed = True -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.DeltaPhi = 0.2 -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.DeltaEta = 0.1 - -################################### -from RecoTracker.IterativeTracking.TobTecStep_cff import * - -# remove previously used clusters -hiRegitMuTobTecStepClusters = RecoTracker.IterativeTracking.TobTecStep_cff.tobTecStepClusters.clone( - oldClusterRemovalInfo = cms.InputTag("hiRegitMuPixelLessStepClusters"), - trajectories = cms.InputTag("hiRegitMuPixelLessStepTracks"), - overrideTrkQuals = cms.InputTag('hiRegitMuPixelLessStepSelector','hiRegitMuPixelLessStep'), - trackClassifier = cms.InputTag(''), - TrackQuality = cms.string('tight') -) - -# SEEDING LAYERS -hiRegitMuTobTecStepSeedLayersPair = RecoTracker.IterativeTracking.TobTecStep_cff.tobTecStepSeedLayersPair.clone() -hiRegitMuTobTecStepSeedLayersPair.TOB.skipClusters = cms.InputTag('hiRegitMuTobTecStepClusters') -hiRegitMuTobTecStepSeedLayersPair.TEC.skipClusters = cms.InputTag('hiRegitMuTobTecStepClusters') - -hiRegitMuTobTecStepSeedLayersTripl = RecoTracker.IterativeTracking.TobTecStep_cff.tobTecStepSeedLayersTripl.clone() -hiRegitMuTobTecStepSeedLayersTripl.TOB.skipClusters = cms.InputTag('hiRegitMuTobTecStepClusters') -hiRegitMuTobTecStepSeedLayersTripl.MTOB.skipClusters = cms.InputTag('hiRegitMuTobTecStepClusters') -hiRegitMuTobTecStepSeedLayersTripl.MTEC.skipClusters = cms.InputTag('hiRegitMuTobTecStepClusters') - -# seeding -hiRegitMuTobTecStepSeeds = RecoTracker.IterativeTracking.TobTecStep_cff.tobTecStepSeeds.clone( - seedCollections = cms.VInputTag(cms.InputTag("hiRegitMuTobTecStepSeedsTripl"), cms.InputTag("hiRegitMuTobTecStepSeedsPair")) - ) - -# For now, keep the same parameters for triplets and pairs -hiRegitMuTobTecStepSeedsTripl = RecoTracker.IterativeTracking.TobTecStep_cff.tobTecStepSeedsTripl.clone() -hiRegitMuTobTecStepSeedsTripl.RegionFactoryPSet = HiTrackingRegionFactoryFromSTAMuonsBlock.clone() -hiRegitMuTobTecStepSeedsTripl.ClusterCheckPSet.doClusterCheck = False # do not check for max number of clusters pixel or strips -hiRegitMuTobTecStepSeedsTripl.RegionFactoryPSet.MuonTrackingRegionBuilder.Pt_min = 2.0 -hiRegitMuTobTecStepSeedsTripl.RegionFactoryPSet.MuonTrackingRegionBuilder.DeltaR = 0.2 # default = 0.2 -hiRegitMuTobTecStepSeedsTripl.RegionFactoryPSet.MuonTrackingRegionBuilder.DeltaZ = 0.2 # this give you the length -hiRegitMuTobTecStepSeedsTripl.RegionFactoryPSet.MuonTrackingRegionBuilder.Rescale_Dz = 4. # max(DeltaZ_Region,Rescale_Dz*vtx->zError()) -hiRegitMuTobTecStepSeedsTripl.OrderedHitsFactoryPSet.SeedingLayers = 'hiRegitMuTobTecStepSeedLayersTripl' - -hiRegitMuTobTecStepSeedsPair = RecoTracker.IterativeTracking.TobTecStep_cff.tobTecStepSeedsPair.clone() -hiRegitMuTobTecStepSeedsPair.RegionFactoryPSet = HiTrackingRegionFactoryFromSTAMuonsBlock.clone() -hiRegitMuTobTecStepSeedsPair.ClusterCheckPSet.doClusterCheck = False # do not check for max number of clusters pixel or strips -hiRegitMuTobTecStepSeedsPair.RegionFactoryPSet.MuonTrackingRegionBuilder.Pt_min = 2.0 -hiRegitMuTobTecStepSeedsPair.RegionFactoryPSet.MuonTrackingRegionBuilder.DeltaR = 0.2 # default = 0.2 -hiRegitMuTobTecStepSeedsPair.RegionFactoryPSet.MuonTrackingRegionBuilder.DeltaZ = 0.2 # this give you the length -hiRegitMuTobTecStepSeedsPair.RegionFactoryPSet.MuonTrackingRegionBuilder.Rescale_Dz = 4. # max(DeltaZ_Region,Rescale_Dz*vtx->zError()) -hiRegitMuTobTecStepSeedsPair.OrderedHitsFactoryPSet.SeedingLayers = 'hiRegitMuTobTecStepSeedLayersPair' - -# building: feed the new-named seeds -hiRegitMuTobTecStepInOutTrajectoryFilter = RecoTracker.IterativeTracking.TobTecStep_cff.tobTecStepInOutTrajectoryFilter.clone() -hiRegitMuTobTecStepInOutTrajectoryFilter.minPt = 1.7 -hiRegitMuTobTecStepInOutTrajectoryFilter.minimumNumberOfHits = 6 -hiRegitMuTobTecStepInOutTrajectoryFilter.minHitsMinPt = 4 - - -hiRegitMuTobTecStepTrajectoryFilter = RecoTracker.IterativeTracking.TobTecStep_cff.tobTecStepTrajectoryFilter.clone() -hiRegitMuTobTecStepTrajectoryFilter.minPt = 1.7 -hiRegitMuTobTecStepTrajectoryFilter.minimumNumberOfHits = 6 -hiRegitMuTobTecStepTrajectoryFilter.minHitsMinPt = 4 - -hiRegitMuTobTecStepTrajectoryBuilder = RecoTracker.IterativeTracking.TobTecStep_cff.tobTecStepTrajectoryBuilder.clone( - trajectoryFilter = cms.PSet( - refToPSet_ = cms.string('hiRegitMuTobTecStepTrajectoryFilter') - ), - inOutTrajectoryFilter = cms.PSet( - refToPSet_ = cms.string('hiRegitMuTobTecStepInOutTrajectoryFilter') - ), -) - -hiRegitMuTobTecStepTrackCandidates = RecoTracker.IterativeTracking.TobTecStep_cff.tobTecStepTrackCandidates.clone( - src = cms.InputTag('hiRegitMuTobTecStepSeeds'), - TrajectoryBuilderPSet = cms.PSet( - refToPSet_ = cms.string('hiRegitMuTobTecStepTrajectoryBuilder') - ), - clustersToSkip = cms.InputTag('hiRegitMuTobTecStepClusters'), - maxNSeeds = cms.uint32(1000000) - ) - -# fitting: feed new-names -hiRegitMuTobTecStepTracks = RecoTracker.IterativeTracking.TobTecStep_cff.tobTecStepTracks.clone( - AlgorithmName = cms.string('hiRegitMuTobTecStep'), - src = 'hiRegitMuTobTecStepTrackCandidates' -) - -import RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi -import RecoHI.HiTracking.hiMultiTrackSelector_cfi -hiRegitMuTobTecStepSelector = RecoHI.HiTracking.hiMultiTrackSelector_cfi.hiMultiTrackSelector.clone( - src ='hiRegitMuTobTecStepTracks', - vertices = cms.InputTag("hiSelectedVertex"), - useAnyMVA = cms.bool(True), - GBRForestLabel = cms.string('HIMVASelectorIter7'), - GBRForestVars = cms.vstring(['chi2perdofperlayer', 'nhits', 'nlayers', 'eta']), - trackSelectors= cms.VPSet( - RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.looseMTS.clone( - name = 'hiRegitMuTobTecStepLoose', - min_nhits = cms.uint32(8) - ), - RecoHI.HiTracking.hiMultiTrackSelector_cfi.hiTightMTS.clone( - name = 'hiRegitMuTobTecStepTight', - preFilterName = 'hiRegitMuTobTecStepLoose', - min_nhits = cms.uint32(8), - useMVA = cms.bool(True), - minMVA = cms.double(-0.2) - ), - RecoHI.HiTracking.hiMultiTrackSelector_cfi.hiHighpurityMTS.clone( - name = 'hiRegitMuTobTecStep', - preFilterName = 'hiRegitMuTobTecStepTight', - min_nhits = cms.uint32(8), - useMVA = cms.bool(True), - minMVA = cms.double(-0.09) - ), - ) #end of vpset - -) - -hiRegitMuonTobTecStep = cms.Sequence(hiRegitMuTobTecStepClusters* - hiRegitMuTobTecStepSeedLayersTripl* - hiRegitMuTobTecStepSeedsTripl* - hiRegitMuTobTecStepSeedLayersPair* - hiRegitMuTobTecStepSeedsPair* - hiRegitMuTobTecStepSeeds* - hiRegitMuTobTecStepTrackCandidates* - hiRegitMuTobTecStepTracks* - hiRegitMuTobTecStepSelector) - - - diff --git a/RecoHI/HiMuonAlgos/test/testRegionalMuonTracking_cfg.py b/RecoHI/HiMuonAlgos/test/testRegionalMuonTracking_cfg.py deleted file mode 100644 index 5b08d883b8c1c..0000000000000 --- a/RecoHI/HiMuonAlgos/test/testRegionalMuonTracking_cfg.py +++ /dev/null @@ -1,141 +0,0 @@ -import FWCore.ParameterSet.Config as cms -import FWCore.ParameterSet.VarParsing as VarParsing -import os - -process = cms.Process("TEST") - -process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") -process.load("Configuration.StandardSequences.Services_cff") -process.load("Configuration.StandardSequences.MagneticField_cff") -process.load("Configuration.StandardSequences.Geometry_cff") - -#global tags for conditions data: https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideFrontierConditions -process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") -process.GlobalTag.globaltag = 'MC_38Y_V8::All' - -################################################################################## - -# setup 'standard' options -options = VarParsing.VarParsing ('standard') - -# setup any defaults you want -options.output = 'test_out.root' -options.files = [ - '/store/relval/CMSSW_3_8_1/RelValPyquen_ZeemumuJets_pt10_2760GeV/GEN-SIM-RECO/MC_38Y_V8-v1/0013/42AFD8A5-C9A3-DF11-9F6B-001A92811706.root', - '/store/relval/CMSSW_3_8_1/RelValPyquen_ZeemumuJets_pt10_2760GeV/GEN-SIM-RECO/MC_38Y_V8-v1/0013/2225585D-BFA3-DF11-8771-003048678FD6.root' ] -options.maxEvents = 1 - -# get and parse the command line arguments -options.parseArguments() - - -################################################################################## -# Some Services - -process.load("FWCore.MessageService.MessageLogger_cfi") -process.MessageLogger.debugModules = ['*'] -process.MessageLogger.categories = ['HeavyIonVertexing','heavyIonHLTVertexing','MuonTrackingRegionBuilder','MinBiasTracking'] -process.MessageLogger.cerr = cms.untracked.PSet( - threshold = cms.untracked.string('DEBUG'), - DEBUG = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - HeavyIonVertexing = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - heavyIonHLTVertexing = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - MuonTrackingRegionBuilder = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ) -) - -process.SimpleMemoryCheck = cms.Service('SimpleMemoryCheck', - ignoreTotal=cms.untracked.int32(0), - oncePerEventMode = cms.untracked.bool(False) - ) - -process.Timing = cms.Service("Timing") - -process.options = cms.untracked.PSet(wantSummary = cms.untracked.bool(True)) - -################################################################################## -# Input Source -process.source = cms.Source('PoolSource',fileNames = cms.untracked.vstring(options.files)) -process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(options.maxEvents)) - -# GenFilter for opposite-sign status=1 muons from the embedded signal within the acceptance -process.mumugenfilter = cms.EDFilter("MCParticlePairFilter", - moduleLabel = cms.untracked.string("hiSignal"), - Status = cms.untracked.vint32(1, 1), - MinPt = cms.untracked.vdouble(2.5, 2.5), - MaxEta = cms.untracked.vdouble(2.5, 2.5), - MinEta = cms.untracked.vdouble(-2.5, -2.5), - ParticleCharge = cms.untracked.int32(-1), - ParticleID1 = cms.untracked.vint32(13), - ParticleID2 = cms.untracked.vint32(13) -) - -# Reconstruction -process.load("Configuration.StandardSequences.RawToDigi_cff") # RawToDigi -process.load("Configuration.StandardSequences.ReconstructionHeavyIons_cff") # full heavy ion reconstruction -process.load("RecoHI.HiTracking.secondStep_cff") # pair-seeding extension - -### re-run tracking only seeded by stand-alone muons -process.goodStaMuons = cms.EDFilter("TrackSelector", - src = cms.InputTag("standAloneMuons","UpdatedAtVtx"), - cut = cms.string("pt > 5.0"), - filter = cms.bool(True) - ) - -process.HiTrackingRegionFactoryFromSTAMuonsBlock.MuonSrc="goodStaMuons" -#using modified MuonTrackingRegionBuilder.cc to pass (x,y) vertex info -process.HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.UseFixedRegion=True -process.HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.DeltaR=0.1 -process.HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.Dz_min=0.2 -process.HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.PtMin_max=5.0 -process.hiPixel3PrimTracks.RegionFactoryPSet = process.HiTrackingRegionFactoryFromSTAMuonsBlock -process.hiNewSeedFromPairs.RegionFactoryPSet = process.HiTrackingRegionFactoryFromSTAMuonsBlock - -process.hiTracksWithLooseQuality.keepAllTracks=True - -process.hiNewTrackCandidates.TrajectoryCleaner = 'TrajectoryCleanerBySharedHits' -process.ckfBaseTrajectoryFilter.filterPset.minimumNumberOfHits=10 # was 6 - -### open up trajectory builder parameters -process.MaterialPropagator.Mass = 0.105 #muon (HI default is pion) -process.OppositeMaterialPropagator.Mass = 0.105 -process.ckfBaseTrajectoryFilter.filterPset.maxLostHits=1 # was 1 -process.ckfBaseTrajectoryFilter.filterPset.maxConsecLostHits=1 # was 1 -process.CkfTrajectoryBuilder.maxCand = 5 # was 5 - -# Output EDM File -process.load("Configuration.EventContent.EventContentHeavyIons_cff") #load keep/drop output commands -process.output = cms.OutputModule("PoolOutputModule", - process.FEVTDEBUGEventContent, - fileName = cms.untracked.string(options.output), - SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring('filter_step')) - ) -process.output.outputCommands.extend(["keep *_*_*_TEST"]) - -################################################################################## -# Sequences -process.rechits = cms.Sequence(process.siPixelRecHits*process.siStripMatchedRecHits) -process.rerecomuons = cms.Sequence(process.goodStaMuons * process.rechits * process.heavyIonTracking) - -# Paths -process.filter_step = cms.Path(process.mumugenfilter) - -process.path = cms.Path(process.mumugenfilter - * process.rerecomuons # triplet-seeded regional step - * process.secondStep # pair-seeded regional step - ) - -process.save = cms.EndPath(process.output) - -# Schedule -process.schedule = cms.Schedule(process.filter_step, process.path, process.save) From 5548d68e0cc4aea9639063118284c817fc07a476 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 15 Nov 2016 15:54:47 +0100 Subject: [PATCH 60/69] Remove HiTrackingRegionFactoryFromSTAMuonsBlock as obsolete --- .../python/HITrackingRegionProducer_cfi.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/RecoHI/HiTracking/python/HITrackingRegionProducer_cfi.py b/RecoHI/HiTracking/python/HITrackingRegionProducer_cfi.py index 07bfb7375464e..08bb7c30ae1cc 100644 --- a/RecoHI/HiTracking/python/HITrackingRegionProducer_cfi.py +++ b/RecoHI/HiTracking/python/HITrackingRegionProducer_cfi.py @@ -78,18 +78,6 @@ # limited stand-alone muon-seeded tracking region from RecoMuon.TrackingTools.MuonServiceProxy_cff import MuonServiceProxy -from RecoMuon.GlobalTrackingTools.MuonTrackingRegionCommon_cff import MuonTrackingRegionCommon -HiTrackingRegionFactoryFromSTAMuonsBlock = cms.PSet( - MuonServiceProxy, - MuonTrackingRegionCommon, - ComponentName = cms.string('HIMuonTrackingRegionProducer'), - MuonSrc = cms.InputTag("standAloneMuons","UpdatedAtVtx") - ) -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.vertexCollection = cms.InputTag("hiSelectedVertex") -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.UseVertex = cms.bool(True) -HiTrackingRegionFactoryFromSTAMuonsBlock.MuonTrackingRegionBuilder.Rescale_Dz = cms.double(5.0) - -# for new-style seeding from RecoHI.HiMuonAlgos.HiTrackingRegionEDProducer_cfi import HiTrackingRegionEDProducer as _HiTrackingRegionEDProducer HiTrackingRegionFactoryFromSTAMuonsEDProducer = _HiTrackingRegionEDProducer.clone( MuonSrc = "standAloneMuons:UpdatedAtVtx", From 1714b155d4f86535186cef2ddd6ad6f1924ec693 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 16 Nov 2016 16:25:47 +0100 Subject: [PATCH 61/69] Add customize function to early-delete new temporary data products --- .../python/customiseEarlyDeleteForSeeding.py | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 RecoTracker/Configuration/python/customiseEarlyDeleteForSeeding.py diff --git a/RecoTracker/Configuration/python/customiseEarlyDeleteForSeeding.py b/RecoTracker/Configuration/python/customiseEarlyDeleteForSeeding.py new file mode 100644 index 0000000000000..40cf9a502df5a --- /dev/null +++ b/RecoTracker/Configuration/python/customiseEarlyDeleteForSeeding.py @@ -0,0 +1,100 @@ +import FWCore.ParameterSet.Config as cms + +import collections + +def _hasInputTagModuleLabel(pset, moduleLabel): + for name in pset.parameterNames_(): + value = getattr(pset,name) + if isinstance(value, cms.PSet): + if _hasInputTagModuleLabel(value, moduleLabel): + return True + elif isinstance(value, cms.VPSet): + for ps in value: + if _hasInputTagModuleLabel(ps, moduleLabel): + return True + elif isinstance(value, cms.VInputTag): + for t in value: + t2 = t + if not isinstance(t, cms.InputTag): + t2 = cms.InputTag(t2) + if t2.getModuleLabel() == moduleLabel: + return True + elif isinstance(value, cms.InputTag): + if value.getModuleLabel() == moduleLabel: + return True + return False + + +def customiseEarlyDeleteForSeeding(process): + # Find the producers + products = collections.defaultdict(list) + depends = collections.defaultdict(list) + + def _branchName(productType, moduleLabel, instanceLabel=""): + return "%s_%s_%s_%s" % (productType, moduleLabel, instanceLabel, process.name_()) + + for name, module in process.producers_().iteritems(): + cppType = module._TypedParameterizable__type + if cppType == "HitPairEDProducer": + if module.produceSeedingHitSets: + products[name].append(_branchName("RegionsSeedingHitSets", name)) + if module.produceIntermediateHitDoublets: + products[name].append(_branchName("IntermediateHitDoublets", name)) + elif cppType in ["PixelTripletHLTEDProducer", "PixelTripletLargeTipEDProducer"]: + if module.produceSeedingHitSets: + products[name].append(_branchName("RegionsSeedingHitSets", name)) + if module.produceIntermediateHitTriplets: + products[name].append(_branchName("IntermediateHitTriplets", name)) + depends[name].append(module.doublets.getModuleLabel()) + elif cppType in ["MultiHitFromChi2EDProducer"]: + products[name].extend([ + _branchName("RegionsSeedingHitSets", name), + _branchName("BaseTrackerRecHitsOwned", name) + ]) + elif cppType == "PixelQuadrupletEDProducer": + products[name].append(_branchName("RegionsSeedingHitSets", name)) + elif cppType == "PixelQuadrupletMergerEDProducer": + products[name].extend([ + _branchName("RegionsSeedingHitSets", name), + _branchName("TrajectorySeeds", name) + ]) + + if len(products) == 0: + return process + + # Set process.options + if not hasattr(process, "options"): + process.options = cms.untracked.PSet() + if not hasattr(process.options, "canDeleteEarly"): + process.options.canDeleteEarly = cms.untracked.vstring() + for branches in products.itervalues(): + process.options.canDeleteEarly.extend(branches) + + # Resolve data dependencies + # + # If a productB depends on productA (e.g. by ref or pointer), then + # everybody that mightGet's producB, must also mightGet productA + def _resolve(keys, name): + for dependsOn in depends[name]: + if dependsOn in keys: + _resolve(keys, dependsOn) + keys.remove(dependsOn) + products[name].extend(products[dependsOn]) + + keys = set(depends.keys()) + while len(keys) > 0: + name = keys.pop() + _resolve(keys, name) + + # Find the consumers + for moduleType in [process.producers_(), process.filters_(), process.analyzers_()]: + for name, module in moduleType.iteritems(): + for producer, branches in products.iteritems(): + if _hasInputTagModuleLabel(module, producer): + #print "Module %s mightGet %s" % (name, str(branches)) + if hasattr(module, "mightGet"): + module.mightGet.extend(branches) + else: + module.mightGet = cms.untracked.vstring(branches) + + return process From 3e0925ed7a5e6f084c509c33a5a2b9d0e07f5810 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 17 Nov 2016 20:47:24 +0100 Subject: [PATCH 62/69] Fix one forgotten cff->cfi import --- RecoTracker/IterativeTracking/python/InitialStep_cff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoTracker/IterativeTracking/python/InitialStep_cff.py b/RecoTracker/IterativeTracking/python/InitialStep_cff.py index d3b82c23dccb8..2ab21aa5a2088 100644 --- a/RecoTracker/IterativeTracking/python/InitialStep_cff.py +++ b/RecoTracker/IterativeTracking/python/InitialStep_cff.py @@ -41,7 +41,7 @@ maxElement = 0, produceIntermediateHitDoublets = True, ) -from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cff import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer +from RecoPixelVertexing.PixelTriplets.pixelTripletHLTEDProducer_cfi import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * import RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi initialStepHitTriplets = _pixelTripletHLTEDProducer.clone( From dae140829d4d1ae48643b2c4605cbece3ebd225d Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 18 Nov 2016 09:52:18 +0100 Subject: [PATCH 63/69] Add back missing MuonTrackingRegionCommon --- RecoHI/HiTracking/python/HITrackingRegionProducer_cfi.py | 1 + 1 file changed, 1 insertion(+) diff --git a/RecoHI/HiTracking/python/HITrackingRegionProducer_cfi.py b/RecoHI/HiTracking/python/HITrackingRegionProducer_cfi.py index 08bb7c30ae1cc..6a9e500055dae 100644 --- a/RecoHI/HiTracking/python/HITrackingRegionProducer_cfi.py +++ b/RecoHI/HiTracking/python/HITrackingRegionProducer_cfi.py @@ -78,6 +78,7 @@ # limited stand-alone muon-seeded tracking region from RecoMuon.TrackingTools.MuonServiceProxy_cff import MuonServiceProxy +from RecoMuon.GlobalTrackingTools.MuonTrackingRegionCommon_cff import MuonTrackingRegionCommon from RecoHI.HiMuonAlgos.HiTrackingRegionEDProducer_cfi import HiTrackingRegionEDProducer as _HiTrackingRegionEDProducer HiTrackingRegionFactoryFromSTAMuonsEDProducer = _HiTrackingRegionEDProducer.clone( MuonSrc = "standAloneMuons:UpdatedAtVtx", From fc8e50ef1208144905ecedb7d8175b0f8d552f1e Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 18 Nov 2016 12:58:50 +0100 Subject: [PATCH 64/69] Add calls to shrink_to_fit() --- .../PixelTriplets/interface/HitTripletEDProducerT.h | 8 ++++++-- .../PixelTriplets/plugins/PixelQuadrupletEDProducer.cc | 1 + .../plugins/PixelQuadrupletMergerEDProducer.cc | 2 ++ .../TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc | 2 ++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h index 1a73d074f498b..f9e83a211d4e7 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h +++ b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h @@ -188,10 +188,14 @@ void HitTripletEDProducerT::produce(edm::Event& iEvent, c } localRA_.update(triplets_total); - if(produceSeedingHitSets_) + if(produceSeedingHitSets_) { + seedingHitSets->shrink_to_fit(); iEvent.put(std::move(seedingHitSets)); - if(produceIntermediateHitTriplets_) + } + if(produceIntermediateHitTriplets_) { + intermediateHitTriplets->shrink_to_fit(); iEvent.put(std::move(intermediateHitTriplets)); + } } diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc index 26fee69c319ad..1e34c196c65a3 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletEDProducer.cc @@ -121,6 +121,7 @@ void PixelQuadrupletEDProducer::produce(edm::Event& iEvent, const edm::EventSetu } localRA_.update(seedingHitSets->size()); + seedingHitSets->shrink_to_fit(); iEvent.put(std::move(seedingHitSets)); } diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletMergerEDProducer.cc b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletMergerEDProducer.cc index bdc765b8bc327..ded62ac0c7ca9 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletMergerEDProducer.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelQuadrupletMergerEDProducer.cc @@ -156,6 +156,8 @@ void PixelQuadrupletMergerEDProducer::produce(edm::Event& iEvent, const edm::Eve } localRA_.update(seedingHitSets->size()); + seedingHitSets->shrink_to_fit(); + tmpSeedCollection->shrink_to_fit(); iEvent.put(std::move(seedingHitSets)); iEvent.put(std::move(tmpSeedCollection)); } diff --git a/RecoTracker/TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc b/RecoTracker/TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc index 8667c61359519..cc4a62f509556 100644 --- a/RecoTracker/TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc +++ b/RecoTracker/TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc @@ -132,6 +132,8 @@ void MultiHitFromChi2EDProducer::produce(edm::Event& iEvent, const edm::EventSet for(auto& ptr: refittedHitStorage) storage->push_back(ptr.release()); + seedingHitSets->shrink_to_fit(); + storage->shrink_to_fit(); iEvent.put(std::move(seedingHitSets)); iEvent.put(std::move(storage)); } From 607ad0de160de94d2da87dce600477ed13f3d4f2 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Sat, 19 Nov 2016 15:55:18 +0100 Subject: [PATCH 65/69] Replace repeated if's with template-based abstractions --- .../interface/HitTripletEDProducerT.h | 404 ++++++++++++------ .../TkHitPairs/plugins/HitPairEDProducer.cc | 361 ++++++++++------ 2 files changed, 507 insertions(+), 258 deletions(-) diff --git a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h index f9e83a211d4e7..6eb80a9856ac3 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h +++ b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h @@ -17,6 +17,8 @@ #include "RecoPixelVertexing/PixelTriplets/interface/IntermediateHitTriplets.h" #include "RecoPixelVertexing/PixelTriplets/interface/LayerTriplets.h" +namespace hitTripletEDProducerT { class ImplBase; } + template class HitTripletEDProducerT: public edm::stream::EDProducer<> { public: @@ -30,27 +32,282 @@ class HitTripletEDProducerT: public edm::stream::EDProducer<> { private: edm::EDGetTokenT doubletToken_; - edm::RunningAverage localRA_; + std::unique_ptr impl_; +}; + +namespace hitTripletEDProducerT { + class ImplBase { + public: + ImplBase() = default; + virtual ~ImplBase() = default; + + virtual void produces(edm::ProducerBase& producer) const = 0; + virtual void produce(const IntermediateHitDoublets& regionDoublets, + edm::Event& iEvent, const edm::EventSetup& iSetup) = 0; + + protected: + edm::RunningAverage localRA_; + }; + + ///// + template + class ImplGeneratorBase: public ImplBase { + public: + ImplGeneratorBase(const edm::ParameterSet& iConfig, edm::ConsumesCollector& iC): + generator_(iConfig, iC) + {} + ~ImplGeneratorBase() = default; + + protected: + T_HitTripletGenerator generator_; + }; + + ///// + template + class Impl: public ImplGeneratorBase { + public: + Impl(const edm::ParameterSet& iConfig, edm::ConsumesCollector& iC): + ImplGeneratorBase(iConfig, iC) {} + ~Impl() = default; + + void produces(edm::ProducerBase& producer) const override { + T_SeedingHitSets::produces(producer); + T_IntermediateHitTriplets::produces(producer); + }; + + void produce(const IntermediateHitDoublets& regionDoublets, + edm::Event& iEvent, const edm::EventSetup& iSetup) override { + const SeedingLayerSetsHits& seedingLayerHits = regionDoublets.seedingLayerHits(); + + auto seedingHitSetsProducer = T_SeedingHitSets(); + auto intermediateHitTripletsProducer = T_IntermediateHitTriplets(&seedingLayerHits); + + if(regionDoublets.empty()) { + seedingHitSetsProducer.putEmpty(iEvent); + intermediateHitTripletsProducer.putEmpty(iEvent); + } + + seedingHitSetsProducer.reserve(regionDoublets.regionSize(), this->localRA_.upper()); + intermediateHitTripletsProducer.reserve(regionDoublets.regionSize(), this->localRA_.upper()); + + // match-making of pair and triplet layers + std::vector trilayers = LayerTriplets::layers(seedingLayerHits); + + OrderedHitTriplets triplets; + triplets.reserve(this->localRA_.upper()); + size_t triplets_total = 0; + + LogDebug("HitTripletEDProducer") << "Creating triplets for " << regionDoublets.regionSize() << " regions, and " << trilayers.size() << " pair+3rd layers from " << regionDoublets.layerPairsSize() << " layer pairs"; + + for(const auto& regionLayerPairs: regionDoublets) { + const TrackingRegion& region = regionLayerPairs.region(); + + auto hitCachePtr_filler_shs = seedingHitSetsProducer.beginRegion(®ion, nullptr); + auto hitCachePtr_filler_iht = intermediateHitTripletsProducer.beginRegion(®ion, std::get<0>(hitCachePtr_filler_shs)); + auto hitCachePtr = std::get<0>(hitCachePtr_filler_iht); + + LayerHitMapCache& hitCache = *hitCachePtr; + hitCache.extend(regionLayerPairs.layerHitMapCache()); + + LogTrace("HitTripletEDProducer") << " starting region"; + + for(const auto& layerPair: regionLayerPairs) { + LogTrace("HitTripletEDProducer") << " starting layer pair " << layerPair.innerLayerIndex() << "," << layerPair.outerLayerIndex(); + + auto found = std::find_if(trilayers.begin(), trilayers.end(), [&](const LayerTriplets::LayerSetAndLayers& a) { + return a.first[0].index() == layerPair.innerLayerIndex() && a.first[1].index() == layerPair.outerLayerIndex(); + }); + if(found == trilayers.end()) { + auto exp = cms::Exception("LogicError") << "Did not find the layer pair from vector. This is a sign of some internal inconsistency\n"; + exp << "I was looking for layer pair " << layerPair.innerLayerIndex() << "," << layerPair.outerLayerIndex() << ". Triplets have the following pairs:\n"; + for(const auto& a: trilayers) { + exp << " " << a.first[0].index() << "," << a.first[1].index() << ": 3rd layers"; + for(const auto& b: a.second) { + exp << " " << b.index(); + } + exp << "\n"; + } + throw exp; + } + const auto& thirdLayers = found->second; + + this->generator_.hitTriplets(region, triplets, iEvent, iSetup, layerPair.doublets(), thirdLayers, + intermediateHitTripletsProducer.tripletLastLayerIndexVector(), hitCache); + +#ifdef EDM_ML_DEBUG + LogTrace("HitTripletEDProducer") << " created " << triplets.size() << " triplets for layer pair " << layerPair.innerLayerIndex() << "," << layerPair.outerLayerIndex() << " and 3rd layers"; + for(const auto& l: thirdLayers) { + LogTrace("HitTripletEDProducer") << " " << l.index(); + } +#endif + + triplets_total += triplets.size(); + seedingHitSetsProducer.fill(std::get<1>(hitCachePtr_filler_shs), triplets); + intermediateHitTripletsProducer.fill(std::get<1>(hitCachePtr_filler_iht), layerPair.layerPair(), thirdLayers, triplets); + + triplets.clear(); + } + } + this->localRA_.update(triplets_total); + + seedingHitSetsProducer.put(iEvent); + intermediateHitTripletsProducer.put(iEvent); + } + }; + + + ///// + class DoNothing { + public: + DoNothing() {} + explicit DoNothing(const SeedingLayerSetsHits *layers) {} + + static void produces(edm::ProducerBase&) {} + + void reserve(size_t, size_t) {} + + auto beginRegion(const TrackingRegion *, LayerHitMapCache *ptr) { + return std::make_tuple(ptr, 0); + } + + std::vector *tripletLastLayerIndexVector() { + return nullptr; + } + + void fill(int, const OrderedHitTriplets&) {} + void fill(int, const IntermediateHitTriplets::LayerPair&, + const std::vector&, + const OrderedHitTriplets&) {} + + + void put(edm::Event& iEvent) {} + void putEmpty(edm::Event& iEvent) {} + }; + + ///// + class ImplSeedingHitSets { + public: + ImplSeedingHitSets(): + seedingHitSets_(std::make_unique()) + {} + + static void produces(edm::ProducerBase& producer) { + producer.produces(); + } + + void reserve(size_t regionsSize, size_t localRAupper) { + seedingHitSets_->reserve(regionsSize, localRAupper); + } + + auto beginRegion(const TrackingRegion *region, LayerHitMapCache *ptr) { + hitCacheTmp_.clear(); + return std::make_tuple(&hitCacheTmp_, seedingHitSets_->beginRegion(region)); + } + + void fill(RegionsSeedingHitSets::RegionFiller& filler, const OrderedHitTriplets& triplets) { + for(const auto& trpl: triplets) { + filler.emplace_back(trpl.inner(), trpl.middle(), trpl.outer()); + } + } + + void put(edm::Event& iEvent) { + seedingHitSets_->shrink_to_fit(); + putEmpty(iEvent); + } + void putEmpty(edm::Event& iEvent) { + iEvent.put(std::move(seedingHitSets_)); + } + + private: + std::unique_ptr seedingHitSets_; + LayerHitMapCache hitCacheTmp_; // used if !produceIntermediateHitDoublets + }; + + ///// + class ImplIntermediateHitTriplets { + public: + explicit ImplIntermediateHitTriplets(const SeedingLayerSetsHits *layers): + intermediateHitTriplets_(std::make_unique(layers)), + layers_(layers) + {} + + static void produces(edm::ProducerBase& producer) { + producer.produces(); + } + + void reserve(size_t regionsSize, size_t localRAupper) { + intermediateHitTriplets_->reserve(regionsSize, layers_->size(), localRAupper); + tripletLastLayerIndex_.reserve(localRAupper); + } + + auto beginRegion(const TrackingRegion *region, LayerHitMapCache *) { + auto filler = intermediateHitTriplets_->beginRegion(region); + return std::make_tuple(&(filler.layerHitMapCache()), std::move(filler)); + } + + std::vector *tripletLastLayerIndexVector() { + return &tripletLastLayerIndex_; + } + + void fill(IntermediateHitTriplets::RegionFiller& filler, + const IntermediateHitTriplets::LayerPair& layerPair, + const std::vector& thirdLayers, + const OrderedHitTriplets& triplets) { + if(tripletLastLayerIndex_.size() != triplets.size()) { + throw cms::Exception("LogicError") << "tripletLastLayerIndex_.size() " << tripletLastLayerIndex_.size() + << " triplets.size() " << triplets.size(); + } + tripletPermutation_.resize(tripletLastLayerIndex_.size()); + std::iota(tripletPermutation_.begin(), tripletPermutation_.end(), 0); // assign 0,1,2,...,N + std::stable_sort(tripletPermutation_.begin(), tripletPermutation_.end(), [&](size_t i, size_t j) { + return tripletLastLayerIndex_[i] < tripletLastLayerIndex_[j]; + }); + + // empty triplets need to propagate here + filler.addTriplets(layerPair, thirdLayers, triplets, tripletLastLayerIndex_, tripletPermutation_); + tripletLastLayerIndex_.clear(); + } + + void put(edm::Event& iEvent) { + intermediateHitTriplets_->shrink_to_fit(); + putEmpty(iEvent); + } + void putEmpty(edm::Event& iEvent) { + iEvent.put(std::move(intermediateHitTriplets_)); + } + + private: + std::unique_ptr intermediateHitTriplets_; + const SeedingLayerSetsHits *layers_; + std::vector tripletPermutation_; + std::vector tripletLastLayerIndex_; + }; +} - T_HitTripletGenerator generator_; - const bool produceSeedingHitSets_; - const bool produceIntermediateHitTriplets_; -}; template HitTripletEDProducerT::HitTripletEDProducerT(const edm::ParameterSet& iConfig): - doubletToken_(consumes(iConfig.getParameter("doublets"))), - generator_(iConfig, consumesCollector()), - produceSeedingHitSets_(iConfig.getParameter("produceSeedingHitSets")), - produceIntermediateHitTriplets_(iConfig.getParameter("produceIntermediateHitTriplets")) + doubletToken_(consumes(iConfig.getParameter("doublets"))) { - if(!produceIntermediateHitTriplets_ && !produceSeedingHitSets_) + const bool produceSeedingHitSets = iConfig.getParameter("produceSeedingHitSets"); + const bool produceIntermediateHitTriplets = iConfig.getParameter("produceIntermediateHitTriplets"); + + auto iC = consumesCollector(); + + using namespace hitTripletEDProducerT; + + if(produceSeedingHitSets && produceIntermediateHitTriplets) + impl_ = std::make_unique>(iConfig, iC); + else if(produceSeedingHitSets) + impl_ = std::make_unique>(iConfig, iC); + else if(produceIntermediateHitTriplets) + impl_ = std::make_unique>(iConfig, iC); + else throw cms::Exception("Configuration") << "HitTripletEDProducerT requires either produceIntermediateHitTriplets or produceSeedingHitSets to be True. If neither are needed, just remove this module from your sequence/path as it doesn't do anything useful"; - if(produceSeedingHitSets_) - produces(); - if(produceIntermediateHitTriplets_) - produces(); + + impl_->produces(*this); } template @@ -78,124 +335,7 @@ void HitTripletEDProducerT::produce(edm::Event& iEvent, c throw cms::Exception("LogicError") << "HitTripletEDProducerT expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= 3, got " << seedingLayerHits.numberOfLayersInSet() << ". This is likely caused by a configuration error of this module, HitPairEDProducer, or SeedingLayersEDProducer."; } - std::unique_ptr seedingHitSets; - std::unique_ptr intermediateHitTriplets; - if(produceSeedingHitSets_) - seedingHitSets = std::make_unique(); - if(produceIntermediateHitTriplets_) - intermediateHitTriplets = std::make_unique(&seedingLayerHits); - - if(regionDoublets.empty()) { - if(produceSeedingHitSets_) - iEvent.put(std::move(seedingHitSets)); - if(produceIntermediateHitTriplets_) - iEvent.put(std::move(intermediateHitTriplets)); - return; - } - - if(produceSeedingHitSets_) - seedingHitSets->reserve(regionDoublets.regionSize(), localRA_.upper()); - if(produceIntermediateHitTriplets_) - intermediateHitTriplets->reserve(regionDoublets.regionSize(), seedingLayerHits.size(), localRA_.upper()); - - // match-making of pair and triplet layers - std::vector trilayers = LayerTriplets::layers(seedingLayerHits); - std::vector tripletLastLayerIndex; - tripletLastLayerIndex.reserve(localRA_.upper()); - std::vector tripletPermutation; // used to sort the triplets according to their last-hit layer - - OrderedHitTriplets triplets; - triplets.reserve(localRA_.upper()); - size_t triplets_total = 0; - - LogDebug("HitTripletEDProducer") << "Creating triplets for " << regionDoublets.regionSize() << " regions, and " << trilayers.size() << " pair+3rd layers from " << regionDoublets.layerPairsSize() << " layer pairs"; - - LayerHitMapCache hitCacheTmp; // used if !produceIntermediateHitTriplets_ - for(const auto& regionLayerPairs: regionDoublets) { - const TrackingRegion& region = regionLayerPairs.region(); - - auto seedingHitSetsFiller = RegionsSeedingHitSets::dummyFiller(); - auto intermediateHitTripletsFiller = IntermediateHitTriplets::dummyFiller(); - auto hitCachePtr = &hitCacheTmp; - if(produceSeedingHitSets_) { - seedingHitSetsFiller = seedingHitSets->beginRegion(®ion); - } - if(produceIntermediateHitTriplets_) { - intermediateHitTripletsFiller = intermediateHitTriplets->beginRegion(®ion); - hitCachePtr = &(intermediateHitTripletsFiller.layerHitMapCache()); - } - else { - hitCacheTmp.clear(); - } - LayerHitMapCache& hitCache = *hitCachePtr; - hitCache.extend(regionLayerPairs.layerHitMapCache()); - - LogTrace("HitTripletEDProducer") << " starting region"; - - for(const auto& layerPair: regionLayerPairs) { - LogTrace("HitTripletEDProducer") << " starting layer pair " << layerPair.innerLayerIndex() << "," << layerPair.outerLayerIndex(); - - auto found = std::find_if(trilayers.begin(), trilayers.end(), [&](const LayerTriplets::LayerSetAndLayers& a) { - return a.first[0].index() == layerPair.innerLayerIndex() && a.first[1].index() == layerPair.outerLayerIndex(); - }); - if(found == trilayers.end()) { - auto exp = cms::Exception("LogicError") << "Did not find the layer pair from vector. This is a sign of some internal inconsistency\n"; - exp << "I was looking for layer pair " << layerPair.innerLayerIndex() << "," << layerPair.outerLayerIndex() << ". Triplets have the following pairs:\n"; - for(const auto& a: trilayers) { - exp << " " << a.first[0].index() << "," << a.first[1].index() << ": 3rd layers"; - for(const auto& b: a.second) { - exp << " " << b.index(); - } - exp << "\n"; - } - throw exp; - } - const auto& thirdLayers = found->second; - - tripletLastLayerIndex.clear(); - generator_.hitTriplets(region, triplets, iEvent, iSetup, layerPair.doublets(), thirdLayers, &tripletLastLayerIndex, *hitCachePtr); - -#ifdef EDM_ML_DEBUG - LogTrace("HitTripletEDProducer") << " created " << triplets.size() << " triplets for layer pair " << layerPair.innerLayerIndex() << "," << layerPair.outerLayerIndex() << " and 3rd layers"; - for(const auto& l: thirdLayers) { - LogTrace("HitTripletEDProducer") << " " << l.index(); - } -#endif - - triplets_total += triplets.size(); - if(produceSeedingHitSets_) { - for(const auto& trpl: triplets) { - seedingHitSetsFiller.emplace_back(trpl.inner(), trpl.middle(), trpl.outer()); - } - } - if(produceIntermediateHitTriplets_) { - if(tripletLastLayerIndex.size() != triplets.size()) { - throw cms::Exception("LogicError") << "tripletLastLayerIndex.size() " << tripletLastLayerIndex.size() - << " triplets.size() " << triplets.size(); - } - tripletPermutation.resize(tripletLastLayerIndex.size()); - std::iota(tripletPermutation.begin(), tripletPermutation.end(), 0); // assign 0,1,2,...,N - std::stable_sort(tripletPermutation.begin(), tripletPermutation.end(), [&](size_t i, size_t j) { - return tripletLastLayerIndex[i] < tripletLastLayerIndex[j]; - }); - - // empty triplets need to propagate here - intermediateHitTripletsFiller.addTriplets(layerPair.layerPair(), thirdLayers, triplets, tripletLastLayerIndex, tripletPermutation); - } - - triplets.clear(); - } - } - localRA_.update(triplets_total); - - if(produceSeedingHitSets_) { - seedingHitSets->shrink_to_fit(); - iEvent.put(std::move(seedingHitSets)); - } - if(produceIntermediateHitTriplets_) { - intermediateHitTriplets->shrink_to_fit(); - iEvent.put(std::move(intermediateHitTriplets)); - } + impl_->produce(regionDoublets, iEvent, iSetup); } diff --git a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc index 04bf731fde37e..69346b4e2c786 100644 --- a/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc +++ b/RecoTracker/TkHitPairs/plugins/HitPairEDProducer.cc @@ -15,6 +15,8 @@ #include "RecoTracker/TkHitPairs/interface/IntermediateHitDoublets.h" #include "RecoTracker/TkHitPairs/interface/RegionsSeedingHitSets.h" +namespace { class ImplBase; } + class HitPairEDProducer: public edm::stream::EDProducer<> { public: HitPairEDProducer(const edm::ParameterSet& iConfig); @@ -29,38 +31,248 @@ class HitPairEDProducer: public edm::stream::EDProducer<> { edm::EDGetTokenT > regionToken_; edm::EDGetTokenT clusterCheckToken_; - edm::RunningAverage localRA_; - LayerHitMapCache layerCache_; - const unsigned int maxElement_; + std::unique_ptr<::ImplBase> impl_; +}; - HitPairGeneratorFromLayerPair generator_; - std::vector layerPairBegins_; +namespace { + class ImplBase { + public: + ImplBase(const edm::ParameterSet& iConfig); + virtual ~ImplBase() = default; + + virtual void produces(edm::ProducerBase& producer) const = 0; + + virtual void produce(const SeedingLayerSetsHits& layers, const edm::OwnVector& regions, const bool clusterCheckOk, + edm::Event& iEvent, const edm::EventSetup& iSetup) = 0; + + protected: + void makeLayerPairs(const SeedingLayerSetsHits& layers, std::vector& layerPairs); + + edm::RunningAverage localRA_; + const unsigned int maxElement_; + + HitPairGeneratorFromLayerPair generator_; + std::vector layerPairBegins_; + }; + ImplBase::ImplBase(const edm::ParameterSet& iConfig): + maxElement_(iConfig.getParameter("maxElement")), + generator_(0, 1, nullptr, maxElement_), // these indices are dummy, TODO: cleanup HitPairGeneratorFromLayerPair + layerPairBegins_(iConfig.getParameter >("layerPairs")) + { + if(layerPairBegins_.empty()) + throw cms::Exception("Configuration") << "HitPairEDProducer requires at least index for layer pairs (layerPairs parameter), none was given"; + } + void ImplBase::makeLayerPairs(const SeedingLayerSetsHits& layers, std::vector& layerPairs) { + if(layers.numberOfLayersInSet() > 2) { + for(const auto& layerSet: layers) { + for(const auto pairBeginIndex: layerPairBegins_) { + if(pairBeginIndex+1 >= layers.numberOfLayersInSet()) { + throw cms::Exception("LogicError") << "Layer pair index " << pairBeginIndex << " is out of bounds, input SeedingLayerSetsHits has only " << layers.numberOfLayersInSet() << " layers per set, and the index+1 must be < than the number of layers in set"; + } + + // Take only the requested pair of the set + SeedingLayerSetsHits::SeedingLayerSet pairCandidate = layerSet.slice(pairBeginIndex, pairBeginIndex+1); + + // it would be trivial to use 128-bit bitfield for O(1) check + // if a layer pair has been inserted, but let's test first how + // a "straightforward" solution works + auto found = std::find_if(layerPairs.begin(), layerPairs.end(), [&](const SeedingLayerSetsHits::SeedingLayerSet& pair) { + return pair[0].index() == pairCandidate[0].index() && pair[1].index() == pairCandidate[1].index(); + }); + if(found != layerPairs.end()) + continue; + + layerPairs.push_back(pairCandidate); + } + } + } + else { + if(layerPairBegins_.size() != 1) { + throw cms::Exception("LogicError") << "With pairs of input layers, it doesn't make sense to specify more than one input layer pair, got " << layerPairBegins_.size(); + } + if(layerPairBegins_[0] != 0) { + throw cms::Exception("LogicError") << "With pairs of input layers, it doesn't make sense to specify other input layer pair than 0; got " << layerPairBegins_[0]; + } + + layerPairs.reserve(layers.size()); + for(const auto& set: layers) + layerPairs.push_back(set); + } + } + + + ///// + template + struct Impl: public ImplBase { + Impl(const edm::ParameterSet& iConfig): ImplBase(iConfig) {} + ~Impl() = default; + + void produces(edm::ProducerBase& producer) const override { + T_SeedingHitSets::produces(producer); + T_IntermediateHitDoublets::produces(producer); + } + + void produce(const SeedingLayerSetsHits& layers, const edm::OwnVector& regions, const bool clusterCheckOk, + edm::Event& iEvent, const edm::EventSetup& iSetup) override { + auto seedingHitSetsProducer = T_SeedingHitSets(&localRA_); + auto intermediateHitDoubletsProducer = T_IntermediateHitDoublets(&layers); + + if(!clusterCheckOk) { + seedingHitSetsProducer.putEmpty(iEvent); + intermediateHitDoubletsProducer.putEmpty(iEvent); + return; + } + + seedingHitSetsProducer.reserve(regions.size()); + intermediateHitDoubletsProducer.reserve(regions.size()); + + std::vector layerPairs; + makeLayerPairs(layers, layerPairs); + + for(const TrackingRegion& region: regions) { + auto hitCachePtr_filler_shs = seedingHitSetsProducer.beginRegion(®ion, nullptr); + auto hitCachePtr_filler_ihd = intermediateHitDoubletsProducer.beginRegion(®ion, std::get<0>(hitCachePtr_filler_shs)); + auto hitCachePtr = std::get<0>(hitCachePtr_filler_ihd); + + for(SeedingLayerSetsHits::SeedingLayerSet layerSet: layerPairs) { + auto doublets = generator_.doublets(region, iEvent, iSetup, layerSet, *hitCachePtr); + LogTrace("HitPairEDProducer") << " created " << doublets.size() << " doublets for layers " << layerSet[0].index() << "," << layerSet[1].index(); + if(doublets.empty()) continue; // don't bother if no pairs from these layers + seedingHitSetsProducer.fill(std::get<1>(hitCachePtr_filler_shs), doublets); + intermediateHitDoubletsProducer.fill(std::get<1>(hitCachePtr_filler_ihd), layerSet, std::move(doublets)); + } + } + + seedingHitSetsProducer.put(iEvent); + intermediateHitDoubletsProducer.put(iEvent); + } + }; + + ///// + class DoNothing { + public: + DoNothing(const SeedingLayerSetsHits *) {} + DoNothing(edm::RunningAverage *) {} + + static void produces(edm::ProducerBase&) {}; + + void reserve(size_t) {} + + auto beginRegion(const TrackingRegion *, LayerHitMapCache *ptr) { + return std::make_tuple(ptr, 0); + } + + void fill(int, const HitDoublets&) {} + void fill(int, const SeedingLayerSetsHits::SeedingLayerSet&, HitDoublets&&) {} + + void put(edm::Event&) {} + void putEmpty(edm::Event&) {} + }; + + ///// + class ImplSeedingHitSets { + public: + ImplSeedingHitSets(edm::RunningAverage *localRA): + seedingHitSets_(std::make_unique()), + localRA_(localRA) + {} + + static void produces(edm::ProducerBase& producer) { + producer.produces(); + } + + void reserve(size_t regionsSize) { + seedingHitSets_->reserve(regionsSize, localRA_->upper()); + } + + auto beginRegion(const TrackingRegion *region, LayerHitMapCache *) { + hitCacheTmp_.clear(); + return std::make_tuple(&hitCacheTmp_, seedingHitSets_->beginRegion(region)); + } + + void fill(RegionsSeedingHitSets::RegionFiller& filler, const HitDoublets& doublets) { + for(size_t i=0, size=doublets.size(); ishrink_to_fit(); + localRA_->update(seedingHitSets_->size()); + putEmpty(iEvent); + } + + void putEmpty(edm::Event& iEvent) { + iEvent.put(std::move(seedingHitSets_)); + } + + private: + std::unique_ptr seedingHitSets_; + edm::RunningAverage *localRA_; + LayerHitMapCache hitCacheTmp_; // used if !produceIntermediateHitDoublets + }; + + ///// + class ImplIntermediateHitDoublets { + public: + ImplIntermediateHitDoublets(const SeedingLayerSetsHits *layers): + intermediateHitDoublets_(std::make_unique(layers)), + layers_(layers) + {} + + static void produces(edm::ProducerBase& producer) { + producer.produces(); + } + + void reserve(size_t regionsSize) { + intermediateHitDoublets_->reserve(regionsSize, layers_->size()); + } + + auto beginRegion(const TrackingRegion *region, LayerHitMapCache *) { + auto filler = intermediateHitDoublets_->beginRegion(region); + return std::make_tuple(&(filler.layerHitMapCache()), std::move(filler)); + } + + void fill(IntermediateHitDoublets::RegionFiller& filler, const SeedingLayerSetsHits::SeedingLayerSet& layerSet, HitDoublets&& doublets) { + filler.addDoublets(layerSet, std::move(doublets)); + } + + void put(edm::Event& iEvent) { + intermediateHitDoublets_->shrink_to_fit(); + putEmpty(iEvent); + } + + void putEmpty(edm::Event& iEvent) { + iEvent.put(std::move(intermediateHitDoublets_)); + } + + private: + std::unique_ptr intermediateHitDoublets_; + const SeedingLayerSetsHits *layers_; + }; +} - const bool produceSeedingHitSets_; - const bool produceIntermediateHitDoublets_; -}; HitPairEDProducer::HitPairEDProducer(const edm::ParameterSet& iConfig): seedingLayerToken_(consumes(iConfig.getParameter("seedingLayers"))), regionToken_(consumes >(iConfig.getParameter("trackingRegions"))), - clusterCheckToken_(consumes(iConfig.getParameter("clusterCheck"))), - maxElement_(iConfig.getParameter("maxElement")), - generator_(0, 1, nullptr, maxElement_), // these indices are dummy, TODO: cleanup HitPairGeneratorFromLayerPair - layerPairBegins_(iConfig.getParameter >("layerPairs")), - produceSeedingHitSets_(iConfig.getParameter("produceSeedingHitSets")), - produceIntermediateHitDoublets_(iConfig.getParameter("produceIntermediateHitDoublets")) + clusterCheckToken_(consumes(iConfig.getParameter("clusterCheck"))) { - if(!produceIntermediateHitDoublets_ && !produceSeedingHitSets_) + const bool produceSeedingHitSets = iConfig.getParameter("produceSeedingHitSets"); + const bool produceIntermediateHitDoublets = iConfig.getParameter("produceIntermediateHitDoublets"); + + if(produceSeedingHitSets && produceIntermediateHitDoublets) + impl_ = std::make_unique<::Impl<::ImplSeedingHitSets, ::ImplIntermediateHitDoublets>>(iConfig); + else if(produceSeedingHitSets) + impl_ = std::make_unique<::Impl<::ImplSeedingHitSets, ::DoNothing>>(iConfig); + else if(produceIntermediateHitDoublets) + impl_ = std::make_unique<::Impl<::DoNothing, ::ImplIntermediateHitDoublets>>(iConfig); + else throw cms::Exception("Configuration") << "HitPairEDProducer requires either produceIntermediateHitDoublets or produceSeedingHitSets to be True. If neither are needed, just remove this module from your sequence/path as it doesn't do anything useful"; - if(layerPairBegins_.empty()) - throw cms::Exception("Configuration") << "HitPairEDProducer requires at least index for layer pairs (layerPairs parameter), none was given"; - - if(produceSeedingHitSets_) - produces(); - if(produceIntermediateHitDoublets_) - produces(); + impl_->produces(*this); } void HitPairEDProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -80,7 +292,6 @@ void HitPairEDProducer::fillDescriptions(edm::ConfigurationDescriptions& descrip void HitPairEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { edm::Handle hclusterCheck; iEvent.getByToken(clusterCheckToken_, hclusterCheck); - const bool clusterCheckOk = *hclusterCheck; edm::Handle hlayers; iEvent.getByToken(seedingLayerToken_, hlayers); @@ -90,110 +301,8 @@ void HitPairEDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetu edm::Handle > hregions; iEvent.getByToken(regionToken_, hregions); - const auto& regions = *hregions; - - std::unique_ptr seedingHitSets; - std::unique_ptr intermediateHitDoublets; - if(produceSeedingHitSets_) - seedingHitSets = std::make_unique(); - if(produceIntermediateHitDoublets_) - intermediateHitDoublets = std::make_unique(&layers); - - if(!clusterCheckOk) { - if(produceSeedingHitSets_) - iEvent.put(std::move(seedingHitSets)); - if(produceIntermediateHitDoublets_) - iEvent.put(std::move(intermediateHitDoublets)); - return; - } - - if(produceSeedingHitSets_) - seedingHitSets->reserve(regions.size(), localRA_.upper()); - if(produceIntermediateHitDoublets_) - intermediateHitDoublets->reserve(regions.size(), layers.size()); - - - LogDebug("HitPairEDProducer") << "Creating doublets for " << regions.size() << " and " << layers.size() << " layer sets"; - - std::vector layerPairs; - if(layers.numberOfLayersInSet() > 2) { - for(const auto& layerSet: layers) { - for(const auto pairBeginIndex: layerPairBegins_) { - if(pairBeginIndex+1 >= layers.numberOfLayersInSet()) { - throw cms::Exception("LogicError") << "Layer pair index " << pairBeginIndex << " is out of bounds, input SeedingLayerSetsHits has only " << layers.numberOfLayersInSet() << " layers per set, and the index+1 must be < than the number of layers in set"; - } - - // Take only the requested pair of the set - SeedingLayerSetsHits::SeedingLayerSet pairCandidate = layerSet.slice(pairBeginIndex, pairBeginIndex+1); - // it would be trivial to use 128-bit bitfield for O(1) check - // if a layer pair has been inserted, but let's test first how - // a "straightforward" solution works - auto found = std::find_if(layerPairs.begin(), layerPairs.end(), [&](const SeedingLayerSetsHits::SeedingLayerSet& pair) { - return pair[0].index() == pairCandidate[0].index() && pair[1].index() == pairCandidate[1].index(); - }); - if(found != layerPairs.end()) - continue; - - layerPairs.push_back(pairCandidate); - } - } - } - else { - if(layerPairBegins_.size() != 1) { - throw cms::Exception("LogicError") << "With pairs of input layers, it doesn't make sense to specify more than one input layer pair, got " << layerPairBegins_.size(); - } - if(layerPairBegins_[0] != 0) { - throw cms::Exception("LogicError") << "With pairs of input layers, it doesn't make sense to specify other input layer pair than 0; got " << layerPairBegins_[0]; - } - - layerPairs.reserve(layers.size()); - for(const auto& set: layers) - layerPairs.push_back(set); - } - - LayerHitMapCache hitCacheTmp; // used if !produceIntermediateHitDoublets_ - for(const TrackingRegion& region: regions) { - auto seedingHitSetsFiller = RegionsSeedingHitSets::dummyFiller(); - auto intermediateHitDoubletsFiller = IntermediateHitDoublets::dummyFiller(); - auto hitCachePtr = &hitCacheTmp; - if(produceSeedingHitSets_) { - seedingHitSetsFiller = seedingHitSets->beginRegion(®ion); - } - if(produceIntermediateHitDoublets_) { - intermediateHitDoubletsFiller = intermediateHitDoublets->beginRegion(®ion); - hitCachePtr = &(intermediateHitDoubletsFiller.layerHitMapCache()); - } - else { - hitCacheTmp.clear(); - } - - - for(SeedingLayerSetsHits::SeedingLayerSet layerSet: layerPairs) { - auto doublets = generator_.doublets(region, iEvent, iSetup, layerSet, *hitCachePtr); - LogTrace("HitPairEDProducer") << " created " << doublets.size() << " doublets for layers " << layerSet[0].index() << "," << layerSet[1].index(); - if(doublets.empty()) continue; // don't bother if no pairs from these layers - if(produceSeedingHitSets_) { - for(size_t i=0, size=doublets.size(); ishrink_to_fit(); - localRA_.update(seedingHitSets->size()); - iEvent.put(std::move(seedingHitSets)); - } - if(produceIntermediateHitDoublets_) { - intermediateHitDoublets->shrink_to_fit(); - iEvent.put(std::move(intermediateHitDoublets)); - } + impl_->produce(layers, *hregions, *hclusterCheck, iEvent, iSetup); } #include "FWCore/PluginManager/interface/ModuleDef.h" From 356f681cd1088d6d34d32a4cc9d9263a21208184 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Sun, 20 Nov 2016 22:01:58 +0100 Subject: [PATCH 66/69] Fix HitTripletEDProducerT for empty input --- .../PixelTriplets/interface/HitTripletEDProducerT.h | 1 + 1 file changed, 1 insertion(+) diff --git a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h index 6eb80a9856ac3..61261b6f6dc81 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h +++ b/RecoPixelVertexing/PixelTriplets/interface/HitTripletEDProducerT.h @@ -86,6 +86,7 @@ namespace hitTripletEDProducerT { if(regionDoublets.empty()) { seedingHitSetsProducer.putEmpty(iEvent); intermediateHitTripletsProducer.putEmpty(iEvent); + return; } seedingHitSetsProducer.reserve(regionDoublets.regionSize(), this->localRA_.upper()); From 4a87e64a5d178d841504c66b279b2dbe6decb878 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 23 Nov 2016 10:01:55 +0100 Subject: [PATCH 67/69] Fix reconstruction_fromRECO --- Configuration/StandardSequences/python/Reconstruction_cff.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Configuration/StandardSequences/python/Reconstruction_cff.py b/Configuration/StandardSequences/python/Reconstruction_cff.py index 452710bdb7d9c..a135b74c2f198 100644 --- a/Configuration/StandardSequences/python/Reconstruction_cff.py +++ b/Configuration/StandardSequences/python/Reconstruction_cff.py @@ -135,6 +135,10 @@ noTrackingAndDependent.append(siStripZeroSuppression) noTrackingAndDependent.append(siStripClusters) noTrackingAndDependent.append(initialStepSeedLayersPreSplitting) +noTrackingAndDependent.append(trackerClusterCheckPreSplitting) +noTrackingAndDependent.append(initialStepTrackingRegionsPreSplitting) +noTrackingAndDependent.append(initialStepHitDoubletsPreSplitting) +noTrackingAndDependent.append(initialStepHitTripletsPreSplitting) noTrackingAndDependent.append(initialStepSeedsPreSplitting) noTrackingAndDependent.append(initialStepTrackCandidatesPreSplitting) noTrackingAndDependent.append(initialStepTracksPreSplitting) From 0fd102725be48eeba32ecd347b820f583f197469 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 23 Nov 2016 10:10:55 +0100 Subject: [PATCH 68/69] Add early deletion customise after everything else Needs to be the very last customise, hence plugged in ConfigBuilder. --- Configuration/Applications/python/ConfigBuilder.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Configuration/Applications/python/ConfigBuilder.py b/Configuration/Applications/python/ConfigBuilder.py index ef03741a26178..7ca9cc8f9ad49 100644 --- a/Configuration/Applications/python/ConfigBuilder.py +++ b/Configuration/Applications/python/ConfigBuilder.py @@ -2217,6 +2217,16 @@ def prepare(self, doChecking = False): self.pythonCfgCode += self.addCustomiseCmdLine() + # Temporary hack to put the early delete customization after + # everything else + # + # FIXME: remove when no longer needed + if "RECO" in self.stepMap or "RAW2RECO" in self.stepMap: + self.pythonCfgCode += "\n# Add early deletion of temporary data products to reduce peak memory need\n" + self.pythonCfgCode += "from RecoTracker.Configuration.customiseEarlyDeleteForSeeding import customiseEarlyDeleteForSeeding\n" + self.pythonCfgCode += "process = customiseEarlyDeleteForSeeding(process)\n" + self.pythonCfgCode += "# End adding early deletion\n" + # make the .io file From 71a871a05886f9ee289a824b9706294905306e31 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 23 Nov 2016 16:46:21 +0100 Subject: [PATCH 69/69] Abstract early deletion settings to a separate file --- Configuration/Applications/python/ConfigBuilder.py | 4 ++-- .../StandardSequences/python/earlyDeleteSettings_cff.py | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 Configuration/StandardSequences/python/earlyDeleteSettings_cff.py diff --git a/Configuration/Applications/python/ConfigBuilder.py b/Configuration/Applications/python/ConfigBuilder.py index 7ca9cc8f9ad49..4afa68680bc44 100644 --- a/Configuration/Applications/python/ConfigBuilder.py +++ b/Configuration/Applications/python/ConfigBuilder.py @@ -2223,8 +2223,8 @@ def prepare(self, doChecking = False): # FIXME: remove when no longer needed if "RECO" in self.stepMap or "RAW2RECO" in self.stepMap: self.pythonCfgCode += "\n# Add early deletion of temporary data products to reduce peak memory need\n" - self.pythonCfgCode += "from RecoTracker.Configuration.customiseEarlyDeleteForSeeding import customiseEarlyDeleteForSeeding\n" - self.pythonCfgCode += "process = customiseEarlyDeleteForSeeding(process)\n" + self.pythonCfgCode += "from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDeleteForRECO\n" + self.pythonCfgCode += "process = customiseEarlyDeleteForRECO(process)\n" self.pythonCfgCode += "# End adding early deletion\n" diff --git a/Configuration/StandardSequences/python/earlyDeleteSettings_cff.py b/Configuration/StandardSequences/python/earlyDeleteSettings_cff.py new file mode 100644 index 0000000000000..1c6ff931d9f40 --- /dev/null +++ b/Configuration/StandardSequences/python/earlyDeleteSettings_cff.py @@ -0,0 +1,7 @@ +# Abstract all early deletion settings here + +from RecoTracker.Configuration.customiseEarlyDeleteForSeeding import customiseEarlyDeleteForSeeding + +def customiseEarlyDeleteForRECO(process): + process = customiseEarlyDeleteForSeeding(process) + return process