Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "CombinedHitQuadrupletGeneratorForPhotonConversion.h"
0002 #include "HitQuadrupletGeneratorFromLayerPairForPhotonConversion.h"
0003 #include "FWCore/Framework/interface/ConsumesCollector.h"
0004 #include "FWCore/Framework/interface/Event.h"
0005 #include "DataFormats/Common/interface/Handle.h"
0006 
0007 CombinedHitQuadrupletGeneratorForPhotonConversion::CombinedHitQuadrupletGeneratorForPhotonConversion(
0008     const edm::ParameterSet& cfg, edm::ConsumesCollector& iC)
0009     : theSeedingLayerToken(iC.consumes<SeedingLayerSetsHits>(cfg.getParameter<edm::InputTag>("SeedingLayers"))),
0010       theMaxElement(cfg.getParameter<unsigned int>("maxElement")) {
0011   theGenerator =
0012       std::make_unique<HitQuadrupletGeneratorFromLayerPairForPhotonConversion>(0, 1, &theLayerCache, theMaxElement);
0013 }
0014 
0015 CombinedHitQuadrupletGeneratorForPhotonConversion::~CombinedHitQuadrupletGeneratorForPhotonConversion() {}
0016 
0017 const OrderedHitPairs& CombinedHitQuadrupletGeneratorForPhotonConversion::run(const TrackingRegion& region,
0018                                                                               const edm::Event& ev,
0019                                                                               const edm::EventSetup& es) {
0020   thePairs.clear();
0021   hitPairs(region, thePairs, ev, es);
0022   return thePairs;
0023 }
0024 
0025 void CombinedHitQuadrupletGeneratorForPhotonConversion::hitPairs(const TrackingRegion& region,
0026                                                                  OrderedHitPairs& result,
0027                                                                  const edm::Event& ev,
0028                                                                  const edm::EventSetup& es) {
0029   size_t maxHitQuadruplets = 1000000;
0030   edm::Handle<SeedingLayerSetsHits> hlayers;
0031   ev.getByToken(theSeedingLayerToken, hlayers);
0032   const SeedingLayerSetsHits& layers = *hlayers;
0033   assert(layers.numberOfLayersInSet() == 2);
0034 
0035   for (SeedingLayerSetsHits::LayerSetIndex i = 0; i < hlayers->size() && result.size() < maxHitQuadruplets; ++i) {
0036     theGenerator->hitPairs(region, result, layers[i]);
0037   }
0038   theLayerCache.clear();
0039 }