CMS 3D CMS Logo

SeedProducer.cc

Go to the documentation of this file.
00001 #include "RecoPixelVertexing/PixelLowPtUtilities/interface/SeedProducer.h"
00002 #include "RecoPixelVertexing/PixelLowPtUtilities/interface/SeedGenerator.h"
00003 
00004 #include "FWCore/Framework/interface/MakerMacros.h"
00005 #include "FWCore/Framework/interface/ESHandle.h"
00006 #include "FWCore/Framework/interface/Frameworkfwd.h"
00007 #include "FWCore/ServiceRegistry/interface/Service.h"
00008 
00009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00010 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00011 
00012 using namespace std;
00013 
00014 /*****************************************************************************/
00015 SeedProducer::SeedProducer(const edm::ParameterSet& ps_) :
00016 ps(ps_)
00017 {
00018   tripletList = ps.getParameter<vector<string> >("tripletList");
00019 
00020   edm::LogInfo("SeedProducer") << " constructor";
00021   produces<TrajectorySeedCollection>();
00022 }
00023 
00024 /*****************************************************************************/
00025 SeedProducer::~SeedProducer()
00026 {
00027   edm::LogInfo("SeedProducer") << " destructor";
00028 }
00029 
00030 /*****************************************************************************/
00031 void SeedProducer::produce
00032   (edm::Event& ev, const edm::EventSetup& es)
00033 {
00034   SeedGenerator theSeedGenerator(es);
00035 
00036   std::auto_ptr<TrajectorySeedCollection> result(new TrajectorySeedCollection);
00037 
00038   for(vector<string>::const_iterator label = tripletList.begin();
00039                                      label!= tripletList.end(); label++)
00040   {
00041     LogTrace("MinBiasTracking")
00042       << " [PixelSeeder] " << *label;
00043 
00044     edm::Handle<reco::TrackCollection> recCollection;
00045     ev.getByLabel(*label,recCollection);
00046     const reco::TrackCollection* recTracks = recCollection.product();
00047   
00048     for(reco::TrackCollection::const_iterator track = recTracks->begin();
00049                                               track!= recTracks->end();
00050                                               track++)
00051     {
00052       LogTrace("MinBiasTracking")
00053         << "  [PixelSeeder] track #" << track - recTracks->begin();
00054 
00055       TrajectorySeed theSeed = theSeedGenerator.seed(*track,es,ps);
00056   
00057       if(theSeed.nHits() >= 2)
00058         result->push_back(theSeed);
00059     } 
00060   }
00061 
00062   LogTrace("MinBiasTracking")
00063     << " [PixelSeeder] number of seeds : " << result->size();
00064 
00065   // Put result back to the event
00066   ev.put(result);
00067 }
00068 

Generated on Tue Jun 9 17:44:51 2009 for CMSSW by  doxygen 1.5.4