CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/RecoMuon/TrackerSeedGenerator/plugins/TSGFromOrderedHits.cc

Go to the documentation of this file.
00001 #include "TSGFromOrderedHits.h"
00002 
00003 #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h"
00004 #include "RecoTracker/TkTrackingRegions/interface/OrderedHitsGeneratorFactory.h"
00005 #include "RecoTracker/TkTrackingRegions/interface/OrderedHitsGenerator.h"
00006 #include "RecoTracker/TkSeedGenerator/interface/SeedGeneratorFromRegionHits.h"
00007 #include "RecoTracker/TkSeedGenerator/interface/SeedCreatorFactory.h"
00008 
00009 #include "FWCore/Framework/interface/Event.h"
00010 #include "DataFormats/Provenance/interface/RunID.h"
00011 
00012 
00013 TSGFromOrderedHits::TSGFromOrderedHits(const edm::ParameterSet &pset)
00014   : theLastRun(0), theConfig(pset), theGenerator(0)
00015 {
00016         init();
00017 }
00018 void TSGFromOrderedHits::init()
00019 {
00020   edm::ParameterSet hitsfactoryPSet =
00021       theConfig.getParameter<edm::ParameterSet>("OrderedHitsFactoryPSet");
00022   std::string hitsfactoryName = hitsfactoryPSet.getParameter<std::string>("ComponentName");
00023   OrderedHitsGenerator*  hitsGenerator =
00024         OrderedHitsGeneratorFactory::get()->create( hitsfactoryName, hitsfactoryPSet);
00025 
00026   if (theGenerator) delete theGenerator;
00027   edm::ParameterSet creatorPSet;
00028   creatorPSet.addParameter<std::string>("propagator","PropagatorWithMaterial");
00029   theGenerator = new SeedGeneratorFromRegionHits(hitsGenerator, 0, 
00030                                                  SeedCreatorFactory::get()->create("SeedFromConsecutiveHitsCreator", creatorPSet)
00031                                                  );
00032 
00033 }
00034 
00035 TSGFromOrderedHits::~TSGFromOrderedHits()
00036 {
00037   delete theGenerator; 
00038 }
00039 
00040 void TSGFromOrderedHits::run(TrajectorySeedCollection &seeds, 
00041       const edm::Event &ev, const edm::EventSetup &es, const TrackingRegion& region)
00042 {
00043   edm::RunNumber_t thisRun = ev.run();
00044   if (thisRun != theLastRun) { theLastRun = thisRun; init(); }
00045   theGenerator->run( seeds, region, ev, es);
00046 }