Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:28:50

0001 #include "RecoTracker/TkHitPairs/interface/CombinedHitPairGenerator.h"
0002 #include "RecoTracker/TkHitPairs/interface/HitPairGeneratorFromLayerPair.h"
0003 #include "FWCore/Framework/interface/ConsumesCollector.h"
0004 #include "FWCore/Framework/interface/Event.h"
0005 #include "DataFormats/Common/interface/Handle.h"
0006 
0007 CombinedHitPairGenerator::CombinedHitPairGenerator(const edm::ParameterSet& cfg, edm::ConsumesCollector& iC)
0008     : theSeedingLayerToken(iC.consumes<SeedingLayerSetsHits>(cfg.getParameter<edm::InputTag>("SeedingLayers"))) {
0009   theMaxElement = cfg.getParameter<unsigned int>("maxElement");
0010   theGenerator = std::make_unique<HitPairGeneratorFromLayerPair>(iC, 0, 1, &theLayerCache, theMaxElement);
0011 }
0012 
0013 CombinedHitPairGenerator::~CombinedHitPairGenerator() {}
0014 
0015 void CombinedHitPairGenerator::hitPairs(const TrackingRegion& region,
0016                                         OrderedHitPairs& result,
0017                                         const edm::Event& ev,
0018                                         const edm::EventSetup& es) {
0019   edm::Handle<SeedingLayerSetsHits> hlayers;
0020   ev.getByToken(theSeedingLayerToken, hlayers);
0021   const SeedingLayerSetsHits& layers = *hlayers;
0022   if (layers.numberOfLayersInSet() != 2)
0023     throw cms::Exception("Configuration")
0024         << "CombinedHitPairGenerator expects SeedingLayerSetsHits::numberOfLayersInSet() to be 2, got "
0025         << layers.numberOfLayersInSet();
0026 
0027   for (SeedingLayerSetsHits::SeedingLayerSet layerSet : layers) {
0028     theGenerator->hitPairs(region, result, ev, es, layerSet);
0029   }
0030 
0031   theLayerCache.clear();
0032 
0033   LogDebug("CombinedHitPairGenerator") << " total number of pairs provided back CHPG : " << result.size();
0034 }