Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "RecoTracker/TkSeedGenerator/interface/SeedGeneratorFromRegionHits.h"
0002 
0003 #include "RecoTracker/TkTrackingRegions/interface/OrderedHitsGenerator.h"
0004 #include "RecoTracker/TkSeedingLayers/interface/SeedComparitor.h"
0005 #include "RecoTracker/TkSeedGenerator/interface/SeedCreator.h"
0006 
0007 SeedGeneratorFromRegionHits::SeedGeneratorFromRegionHits(std::unique_ptr<OrderedHitsGenerator> ohg,
0008                                                          std::unique_ptr<SeedComparitor> asc,
0009                                                          std::unique_ptr<SeedCreator> asp)
0010     : theHitsGenerator{std::move(ohg)}, theComparitor{std::move(asc)}, theSeedCreator{std::move(asp)} {}
0011 
0012 void SeedGeneratorFromRegionHits::run(TrajectorySeedCollection& seedCollection,
0013                                       const TrackingRegion& region,
0014                                       const edm::Event& ev,
0015                                       const edm::EventSetup& es) {
0016   if (theComparitor)
0017     theComparitor->init(ev, es);
0018   theSeedCreator->init(region, es, theComparitor.get());
0019   const OrderedSeedingHits& hitss = theHitsGenerator->run(region, ev, es);
0020 
0021   unsigned int nHitss = hitss.size();
0022   // Modified 10/Jun/2014 Mark Grimes - At 140 pileup this reserve massively overestimates
0023   // the amount of memory required. Removing it doesn't appear to slow down the algorithm
0024   // noticeably.
0025   //if (seedCollection.empty()) seedCollection.reserve(nHitss); // don't do multiple reserves in the case of multiple regions: it would make things even worse
0026   //                                                            // as it will cause N re-allocations instead of the normal log(N)/log(2)
0027   for (unsigned int iHits = 0; iHits < nHitss; ++iHits) {
0028     const SeedingHitSet& hits = hitss[iHits];
0029     if (!theComparitor || theComparitor->compatible(hits)) {
0030       theSeedCreator->makeSeed(seedCollection, hits);
0031     }
0032   }
0033   theHitsGenerator->clear();
0034 }