Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-10-01 22:41:01

0001 #include "RecoTracker/SpecialSeedGenerators/interface/GenericPairGenerator.h"
0002 //#include "RecoTracker/TkSeedingLayers/interface/SeedingLayerSetsBuilder.h"
0003 typedef SeedingHitSet::ConstRecHitPointer SeedingHit;
0004 
0005 #include "FWCore/Framework/interface/ConsumesCollector.h"
0006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0007 #include "TrackingTools/TransientTrackingRecHit/interface/SeedingLayerSetsHits.h"
0008 
0009 GenericPairGenerator::GenericPairGenerator(const edm::ParameterSet& conf, edm::ConsumesCollector& iC)
0010     : theSeedingLayerToken(iC.consumes<SeedingLayerSetsHits>(conf.getParameter<edm::InputTag>("LayerSrc"))) {
0011   edm::LogInfo("CtfSpecialSeedGenerator|GenericPairGenerator") << "Constructing GenericPairGenerator";
0012 }
0013 
0014 const OrderedSeedingHits& GenericPairGenerator::run(const TrackingRegion& region,
0015                                                     const edm::Event& e,
0016                                                     const edm::EventSetup& es) {
0017   hitPairs.clear();
0018   hitPairs.reserve(0);
0019   edm::Handle<SeedingLayerSetsHits> hlayers;
0020   e.getByToken(theSeedingLayerToken, hlayers);
0021   const SeedingLayerSetsHits& layers = *hlayers;
0022   if (layers.numberOfLayersInSet() != 2)
0023     throw cms::Exception("CtfSpecialSeedGenerator")
0024         << "You are using " << layers.numberOfLayersInSet() << " layers in set instead of 2 ";
0025 
0026   for (SeedingLayerSetsHits::SeedingLayerSet ls : layers) {
0027     auto innerHits = region.hits(ls[0]);
0028     auto outerHits = region.hits(ls[1]);
0029     for (auto iOuterHit = outerHits.begin(); iOuterHit != outerHits.end(); iOuterHit++) {
0030       for (auto iInnerHit = innerHits.begin(); iInnerHit != innerHits.end(); iInnerHit++) {
0031         hitPairs.push_back(OrderedHitPair(&(**iInnerHit), &(**iOuterHit)));
0032       }
0033     }
0034   }
0035   return hitPairs;
0036 }