5 #include "FWCore/Framework/interface/Event.h"
6 #include "FWCore/Framework/interface/EventSetup.h"
7 #include "FWCore/Framework/interface/MakerMacros.h"
8 #include "FWCore/ParameterSet/interface/ParameterSet.h"
9 #include "FWCore/Utilities/interface/InputTag.h"
10 #include "DataFormats/Common/interface/Handle.h"
11 #include "DataFormats/Common/interface/View.h"
12 #include "DataFormats/VertexReco/interface/Vertex.h"
13 #include "DataFormats/VertexReco/interface/VertexFwd.h"
14 #include "DataFormats/BTauReco/interface/SecondaryVertexTagInfo.h"
22 const edm::ParameterSet& config)
23 : input_(config.getParameter<
edm::InputTag>(
"input")),
24 branch_(config.getParameter<
std::string>(
"branch")),
25 track_pt_threshold_(config.getParameter<double>(
"trackPtThreshold")),
26 request_trks_(config.getParameter<bool>(
"requestTracks")) {
27 consumes<edm::View<reco::SecondaryVertexTagInfo>>(input_);
28 vertices_ =
new std::vector<ic::SecondaryVertex>();
30 produces<reco::TrackRefVector>(
"requestedTracks");
38 void ICSecondaryVertexProducer::produce(edm::Event& event,
39 const edm::EventSetup& setup) {
40 edm::Handle<edm::View<reco::SecondaryVertexTagInfo> > vtxs_handle;
41 event.getByLabel(input_, vtxs_handle);
43 std::auto_ptr<reco::TrackRefVector> trk_requests(
new reco::TrackRefVector());
47 for (
unsigned i = 0; i < vtxs_handle->size(); ++i) {
48 reco::SecondaryVertexTagInfo
const& sv_src = vtxs_handle->at(i);
49 for (
unsigned j = 0; j < sv_src.nVertices(); ++j) {
50 reco::Vertex
const& src = sv_src.secondaryVertex(j);
53 dest.
set_id(vertex_hasher_(&src));
61 for (reco::Vertex::trackRef_iterator trk_iter = src.tracks_begin();
62 trk_iter != src.tracks_end(); ++trk_iter) {
63 float weight = src.trackWeight(*trk_iter);
64 reco::TrackRef trk_ref = trk_iter->castTo<reco::TrackRef>();
65 if (trk_ref->pt() < track_pt_threshold_)
continue;
66 dest.
AddTrack(track_hasher_(&(*trk_ref)), weight);
67 trk_requests->push_back(trk_ref);
71 event.put(trk_requests,
"requestedTracks");
74 void ICSecondaryVertexProducer::beginJob() {
78 void ICSecondaryVertexProducer::endJob() {}
void set_vz(float const &z)
Vertex z-coordinate.
void set_vx(float const &x)
Vertex x-coordinate.
void set_ndof(float const &ndof)
The number-of-degrees-of-freedom in the vertex fit.
A class deriving from ic::Vertex and adding information on the 3D flight distance.
void set_id(std::size_t const &id)
Unique identifier.
void set_chi2(float const &chi2)
The of the vertex fit.
DEFINE_FWK_MODULE(ICSecondaryVertexProducer)
void AddTrack(std::size_t id, float weight)
Add an ic::Track::id with a vertex fit weight.
ICSecondaryVertexProducer(const edm::ParameterSet &)
void set_distance_err_3d(double const &distance_err_3d)
3D flight-distance uncertainty, in centimetres
~ICSecondaryVertexProducer()
void set_vy(float const &y)
Vertex y-coordinate.
void set_distance_3d(double const &distance_3d)
3D flight-distance, in centimetres, from the primary to the secondary vertex