00001 00009 #include "Alignment/LaserAlignment/plugins/LaserSeedGenerator.h" 00010 #include "FWCore/Framework/interface/Event.h" 00011 #include "DataFormats/Common/interface/Handle.h" 00012 00013 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2DCollection.h" 00014 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h" 00015 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00016 #include "FWCore/ParameterSet/interface/InputTag.h" 00017 00018 // 00019 // constructors and destructor 00020 // 00021 LaserSeedGenerator::LaserSeedGenerator(const edm::ParameterSet& iConfig) 00022 : conf_(iConfig), laser_seed(iConfig) 00023 { 00024 edm::LogInfo("LaserSeedGenerator") << " Entering the LaserSeedGenerator "; 00025 00026 std::string alias ( iConfig.getParameter<std::string>("@module_label") ); 00027 00028 //register your products 00029 produces<TrajectorySeedCollection>().setBranchAlias( alias + "Seeds" ); 00030 00031 //now do what ever other initialization is needed 00032 00033 } 00034 00035 00036 LaserSeedGenerator::~LaserSeedGenerator() 00037 { 00038 00039 // do anything here that needs to be done at desctruction time 00040 // (e.g. close files, deallocate resources etc.) 00041 00042 } 00043 00044 00045 // ------------ method called to produce the data ------------ 00046 void 00047 LaserSeedGenerator::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) 00048 { 00049 // get the input 00050 edm::InputTag matchedRecHitsTag = conf_.getParameter<edm::InputTag>("matchedRecHits"); 00051 edm::InputTag rphiRecHitsTag = conf_.getParameter<edm::InputTag>("rphiRecHits"); 00052 edm::InputTag stereoRecHitsTag = conf_.getParameter<edm::InputTag>("stereoRecHits"); 00053 00054 edm::Handle<SiStripRecHit2DCollection> rphiRecHits; 00055 iEvent.getByLabel(rphiRecHitsTag, rphiRecHits); 00056 edm::Handle<SiStripRecHit2DCollection> stereoRecHits; 00057 iEvent.getByLabel(stereoRecHitsTag, stereoRecHits); 00058 edm::Handle<SiStripMatchedRecHit2DCollection> matchedRecHits; 00059 iEvent.getByLabel(matchedRecHitsTag, matchedRecHits); 00060 00061 // create empty output collection 00062 std::auto_ptr<TrajectorySeedCollection> output(new TrajectorySeedCollection); 00063 00064 // initialize the seed generator 00065 laser_seed.init(*stereoRecHits, *rphiRecHits, *matchedRecHits, iSetup); 00066 00067 // invoke the seed finding algorithm 00068 laser_seed.run(*output,iSetup); 00069 00070 // put the TrajectorySeedCollection in the event 00071 LogDebug("Algorithm Performance") << " number of seeds = " << output->size(); 00072 iEvent.put(output); 00073 } 00074 00075 // ------------ method called once each job just before starting event loop ------------ 00076 void 00077 LaserSeedGenerator::beginJob(const edm::EventSetup&) 00078 { 00079 } 00080 00081 // ------------ method called once each job just after ending the event loop ------------ 00082 void 00083 LaserSeedGenerator::endJob() 00084 { 00085 } 00086 // define the SEAL module 00087 #include "FWCore/Framework/interface/MakerMacros.h" 00088 00089 DEFINE_FWK_MODULE(LaserSeedGenerator);