00001 #include "RecoTrackAccumulator.h" 00002 #include "FWCore/Framework/interface/EDProducer.h" 00003 00004 RecoTrackAccumulator::RecoTrackAccumulator(const edm::ParameterSet& conf, edm::EDProducer& mixMod) { 00005 00006 GeneralTrackInput_ = conf.getParameter<edm::InputTag>("GeneralTrackInput"); 00007 GeneralTrackOutput_ = conf.getParameter<std::string>("GeneralTrackOutput"); 00008 00009 mixMod.produces<reco::TrackCollection>(GeneralTrackOutput_); 00010 } 00011 00012 RecoTrackAccumulator::~RecoTrackAccumulator() { 00013 00014 } 00015 00016 void RecoTrackAccumulator::initializeEvent(edm::Event const& e, edm::EventSetup const& iSetup) { 00017 00018 NewTrackList_ = std::auto_ptr<reco::TrackCollection>(new reco::TrackCollection()); 00019 00020 } 00021 00022 void RecoTrackAccumulator::accumulate(edm::Event const& e, edm::EventSetup const& iSetup) { 00023 00024 00025 edm::Handle<reco::TrackCollection> tracks; 00026 e.getByLabel(GeneralTrackInput_, tracks); 00027 00028 if (tracks.isValid()) { 00029 for (reco::TrackCollection::const_iterator track = tracks->begin(); track != tracks->end(); ++track) { 00030 NewTrackList_->push_back(*track); 00031 } 00032 } 00033 00034 } 00035 00036 void RecoTrackAccumulator::accumulate(PileUpEventPrincipal const& e, edm::EventSetup const& iSetup) { 00037 00038 00039 edm::Handle<reco::TrackCollection> tracks; 00040 e.getByLabel(GeneralTrackInput_, tracks); 00041 00042 if (tracks.isValid()) { 00043 for (reco::TrackCollection::const_iterator track = tracks->begin(); track != tracks->end(); ++track) { 00044 NewTrackList_->push_back(*track); 00045 } 00046 } 00047 00048 } 00049 00050 void RecoTrackAccumulator::finalizeEvent(edm::Event& e, const edm::EventSetup& iSetup) { 00051 00052 e.put( NewTrackList_, GeneralTrackOutput_ ); 00053 00054 } 00055 00056