Go to the documentation of this file.00001 #include "RecoTracker/TkSeedGenerator/interface/SeedGeneratorFromRegionHits.h"
00002
00003 #include "FWCore/Framework/interface/Event.h"
00004 #include "FWCore/Framework/interface/EventSetup.h"
00005 #include "FWCore/Framework/interface/ESHandle.h"
00006
00007 #include "RecoTracker/TkTrackingRegions/interface/OrderedHitsGenerator.h"
00008 #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h"
00009 #include "RecoTracker/TkSeedingLayers/interface/SeedComparitor.h"
00010 #include "RecoTracker/TkSeedGenerator/interface/SeedCreator.h"
00011
00012
00013 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00014
00015 #include <vector>
00016
00017 #include "MagneticField/Engine/interface/MagneticField.h"
00018 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00019
00020 namespace {
00021 template <class T> T sqr( T t) {return t*t;}
00022 }
00023
00024 SeedGeneratorFromRegionHits::SeedGeneratorFromRegionHits(
00025 OrderedHitsGenerator *ohg, SeedComparitor* asc, SeedCreator* asp)
00026 : theHitsGenerator(ohg), theComparitor(asc), theSeedCreator(asp)
00027 { }
00028
00029
00030 SeedGeneratorFromRegionHits::~SeedGeneratorFromRegionHits()
00031 {
00032 delete theHitsGenerator;
00033 delete theComparitor;
00034 delete theSeedCreator;
00035 }
00036
00037 void SeedGeneratorFromRegionHits::run(TrajectorySeedCollection & seedCollection,
00038 const TrackingRegion & region, const edm::Event& ev, const edm::EventSetup& es)
00039 {
00040 if (theComparitor) theComparitor->init(es);
00041 const OrderedSeedingHits & hitss = theHitsGenerator->run(region, ev, es);
00042
00043 unsigned int nHitss = hitss.size();
00044 if (seedCollection.empty()) seedCollection.reserve(nHitss);
00045
00046 for (unsigned int iHits = 0; iHits < nHitss; ++iHits) {
00047 const SeedingHitSet & hits = hitss[iHits];
00048 if (!theComparitor || theComparitor->compatible(hits, region) ) {
00049 theSeedCreator->trajectorySeed(seedCollection, hits, region, es, theComparitor);
00050 }
00051 }
00052 theHitsGenerator->clear();
00053 }