Go to the documentation of this file.00001 #include <memory>
00002 #include <set>
00003
00004
00005 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
00006 #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
00007 #include "TrackingTools/Records/interface/TransientTrackRecord.h"
00008 #include "TrackingTools/IPTools/interface/IPTools.h"
00009
00010
00011 #include "FWCore/Framework/interface/EDProducer.h"
00012 #include "FWCore/Framework/interface/Event.h"
00013 #include "FWCore/Framework/interface/MakerMacros.h"
00014 #include "FWCore/Utilities/interface/InputTag.h"
00015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00016
00017 #include "DataFormats/Common/interface/Handle.h"
00018 #include "DataFormats/TrackReco/interface/Track.h"
00019 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00020 #include "DataFormats/VertexReco/interface/Vertex.h"
00021 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00022 #include "RecoVertex/VertexTools/interface/VertexDistance3D.h"
00023
00024
00025 #include "DataFormats/TrackReco/interface/Track.h"
00026 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00027 #include "DataFormats/VertexReco/interface/Vertex.h"
00028 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00029 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00030
00031 #include "RecoVertex/AdaptiveVertexFit/interface/AdaptiveVertexFitter.h"
00032 #include "RecoVertex/KalmanVertexFit/interface/KalmanVertexUpdator.h"
00033 #include "RecoVertex/KalmanVertexFit/interface/KalmanVertexTrackCompatibilityEstimator.h"
00034 #include "RecoVertex/KalmanVertexFit/interface/KalmanVertexSmoother.h"
00035 #include "DataFormats/Math/interface/deltaR.h"
00036
00037
00038 #include "RecoVertex/ConfigurableVertexReco/interface/ConfigurableVertexReconstructor.h"
00039 #include "RecoVertex/AdaptiveVertexFinder/interface/TrackVertexArbitratration.h"
00040
00041
00042
00043
00044
00045 class TrackVertexArbitrator : public edm::EDProducer {
00046 public:
00047 TrackVertexArbitrator(const edm::ParameterSet ¶ms);
00048
00049
00050 virtual void produce(edm::Event &event, const edm::EventSetup &es);
00051
00052 private:
00053 bool trackFilter(const reco::TrackRef &track) const;
00054
00055 edm::InputTag primaryVertexCollection;
00056 edm::InputTag secondaryVertexCollection;
00057 edm::InputTag trackCollection;
00058 edm::InputTag beamSpotCollection;
00059 TrackVertexArbitration * theArbitrator;
00060 };
00061
00062 TrackVertexArbitrator::TrackVertexArbitrator(const edm::ParameterSet ¶ms) :
00063 primaryVertexCollection (params.getParameter<edm::InputTag>("primaryVertices")),
00064 secondaryVertexCollection (params.getParameter<edm::InputTag>("secondaryVertices")),
00065 trackCollection (params.getParameter<edm::InputTag>("tracks")),
00066 beamSpotCollection (params.getParameter<edm::InputTag>("beamSpot"))
00067 {
00068 produces<reco::VertexCollection>();
00069 theArbitrator = new TrackVertexArbitration(params);
00070 }
00071
00072
00073 void TrackVertexArbitrator::produce(edm::Event &event, const edm::EventSetup &es)
00074 {
00075 using namespace reco;
00076
00077 edm::Handle<VertexCollection> secondaryVertices;
00078 event.getByLabel(secondaryVertexCollection, secondaryVertices);
00079 VertexCollection theSecVertexColl = *(secondaryVertices.product());
00080
00081 edm::Handle<VertexCollection> primaryVertices;
00082 event.getByLabel(primaryVertexCollection, primaryVertices);
00083 const reco::Vertex &pv = (*primaryVertices)[0];
00084
00085 edm::Handle<TrackCollection> tracks;
00086 event.getByLabel(trackCollection, tracks);
00087
00088 edm::ESHandle<TransientTrackBuilder> trackBuilder;
00089 es.get<TransientTrackRecord>().get("TransientTrackBuilder",
00090 trackBuilder);
00091
00092 edm::Handle<BeamSpot> beamSpot;
00093 event.getByLabel(beamSpotCollection, beamSpot);
00094
00095
00096 edm::RefVector< TrackCollection > selectedTracks;
00097 for(TrackCollection::const_iterator track = tracks->begin();
00098 track != tracks->end(); ++track) {
00099 TrackRef ref(tracks, track - tracks->begin());
00100 selectedTracks.push_back(ref);
00101
00102 }
00103
00104
00105 const edm::RefVector< TrackCollection > tracksForArbitration= selectedTracks;
00106 reco::VertexCollection theRecoVertices = theArbitrator->trackVertexArbitrator(beamSpot, pv, trackBuilder, tracksForArbitration,
00107 theSecVertexColl);
00108
00109 std::auto_ptr<VertexCollection> recoVertices(new VertexCollection);
00110 for(unsigned int ivtx=0; ivtx < theRecoVertices.size(); ivtx++){
00111 recoVertices->push_back(theRecoVertices[ivtx]);
00112 }
00113
00114
00115 event.put(recoVertices);
00116
00117
00118
00119 }
00120
00121 DEFINE_FWK_MODULE(TrackVertexArbitrator);