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 #include "RecoTracker/TkSeedGenerator/interface/SeedFromConsecutiveHitsCreator.h"
00012 #include "RecoTracker/TkSeedGenerator/interface/SeedFromConsecutiveHits.h"
00013
00014
00015 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00016
00017 #include <vector>
00018
00019 #include "MagneticField/Engine/interface/MagneticField.h"
00020 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00021
00022 template <class T> T sqr( T t) {return t*t;}
00023
00024 SeedGeneratorFromRegionHits::SeedGeneratorFromRegionHits(
00025 OrderedHitsGenerator *ohg, SeedComparitor* asc, SeedCreator* asp)
00026 : theHitsGenerator(ohg), theComparitor(asc), theSeedCreator(asp)
00027 { }
00028
00029 SeedGeneratorFromRegionHits::SeedGeneratorFromRegionHits(
00030 OrderedHitsGenerator * aGenerator,
00031 const edm::ParameterSet & cfg,
00032 SeedComparitor * aComparitor)
00033 : theHitsGenerator(aGenerator), theComparitor(aComparitor)
00034 {
00035 theSeedCreator = new SeedFromConsecutiveHitsCreator();
00036 }
00037
00038
00039 SeedGeneratorFromRegionHits::~SeedGeneratorFromRegionHits()
00040 {
00041 delete theHitsGenerator;
00042 delete theComparitor;
00043 delete theSeedCreator;
00044 }
00045
00046 void SeedGeneratorFromRegionHits::run(TrajectorySeedCollection & seedCollection,
00047 const TrackingRegion & region, const edm::Event& ev, const edm::EventSetup& es)
00048 {
00049 const OrderedSeedingHits & hitss = theHitsGenerator->run(region, ev, es);
00050
00051 unsigned int nHitss = hitss.size();
00052 if (seedCollection.empty()) seedCollection.reserve(nHitss);
00053
00054 for (unsigned int iHits = 0; iHits < nHitss; ++iHits) {
00055 const SeedingHitSet & hits = hitss[iHits];
00056 if (!theComparitor || theComparitor->compatible( hits, es) ) {
00057 theSeedCreator->trajectorySeed(seedCollection, hits, region, es);
00058 }
00059 }
00060 theHitsGenerator->clear();
00061 }