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 const OrderedSeedingHits & hitss = theHitsGenerator->run(region, ev, es);
00041
00042 unsigned int nHitss = hitss.size();
00043 if (seedCollection.empty()) seedCollection.reserve(nHitss);
00044
00045 for (unsigned int iHits = 0; iHits < nHitss; ++iHits) {
00046 const SeedingHitSet & hits = hitss[iHits];
00047 if (!theComparitor || theComparitor->compatible( hits, es) ) {
00048 theSeedCreator->trajectorySeed(seedCollection, hits, region, es);
00049 }
00050 }
00051 theHitsGenerator->clear();
00052 }