CMS 3D CMS Logo

SeedGeneratorFromProtoTracksEDProducer.cc

Go to the documentation of this file.
00001 #include "SeedGeneratorFromProtoTracksEDProducer.h"
00002 
00003 #include "FWCore/Framework/interface/Event.h"
00004 #include "DataFormats/Common/interface/Handle.h"
00005 
00006 #include "DataFormats/TrackReco/interface/Track.h"
00007 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
00008 
00009 #include "RecoTracker/TkSeedGenerator/interface/SeedFromProtoTrack.h"
00010 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00011 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00012 #include <vector>
00013 
00014 using namespace edm;
00015 using namespace reco;
00016 
00017 template <class T> T sqr( T t) {return t*t;}
00018 
00019 SeedGeneratorFromProtoTracksEDProducer::SeedGeneratorFromProtoTracksEDProducer(const ParameterSet& cfg)
00020   : theConfig(cfg), theInputCollectionTag(cfg.getParameter<InputTag>("InputCollection"))
00021 {
00022   produces<TrajectorySeedCollection>();
00023 }
00024 
00025 void SeedGeneratorFromProtoTracksEDProducer::produce(edm::Event& ev, const edm::EventSetup& es)
00026 {
00027   std::auto_ptr<TrajectorySeedCollection> result(new TrajectorySeedCollection());
00028   Handle<reco::TrackCollection> trks;
00029   ev.getByLabel(theInputCollectionTag, trks);
00030 
00031   const TrackCollection &protos = *(trks.product());
00032   
00033   for (TrackCollection::const_iterator it=protos.begin(); it!= protos.end(); ++it) {
00034     const Track & proto = (*it);
00035 
00036     SeedFromProtoTrack seedFromProtoTrack( proto, es);
00037     if (seedFromProtoTrack.isValid()) (*result).push_back( seedFromProtoTrack.trajectorySeed() );
00038   }
00039   ev.put(result);
00040 }
00041 
00042 
00043 
00044 

Generated on Tue Jun 9 17:45:57 2009 for CMSSW by  doxygen 1.5.4