Produces VertexAssociation and a ValueMap to the originating reco jets. More...
Public Member Functions | |
PATVertexAssociationProducer (const edm::ParameterSet &iConfig) | |
virtual void | produce (edm::Event &iEvent, const edm::EventSetup &iSetup) |
~PATVertexAssociationProducer () | |
Private Types | |
typedef edm::ValueMap < pat::VertexAssociation > | VertexAssociationMap |
typedef std::vector < edm::InputTag > | VInputTag |
Private Attributes | |
std::vector< edm::InputTag > | particles_ |
pat::helper::VertexingHelper | vertexing_ |
Produces VertexAssociation and a ValueMap to the originating reco jets.
The PATVertexAssociationProducer produces a set of vertex associations for one or more collection of Candidates, and saves them in a ValueMap in the event.
These can be retrieved in PAT Layer 1 to be embedded in PAT Objects
Definition at line 29 of file VertexAssociationProducer.cc.
typedef edm::ValueMap<pat::VertexAssociation> pat::PATVertexAssociationProducer::VertexAssociationMap [private] |
Definition at line 31 of file VertexAssociationProducer.cc.
typedef std::vector<edm::InputTag> pat::PATVertexAssociationProducer::VInputTag [private] |
Definition at line 41 of file VertexAssociationProducer.cc.
PATVertexAssociationProducer::PATVertexAssociationProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 52 of file VertexAssociationProducer.cc.
: particles_( iConfig.existsAs<VInputTag>("candidates") ? // if it's a VInputTag iConfig.getParameter<VInputTag>("candidates") : VInputTag(1, iConfig.getParameter<edm::InputTag>("candidates")) ), vertexing_(iConfig) { produces<VertexAssociationMap>(); }
PATVertexAssociationProducer::~PATVertexAssociationProducer | ( | ) |
Definition at line 62 of file VertexAssociationProducer.cc.
{ }
void PATVertexAssociationProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 66 of file VertexAssociationProducer.cc.
References end, edm::helper::Filler< Map >::fill(), edm::Event::getByLabel(), i, edm::helper::Filler< Map >::insert(), n, pat::helper::VertexingHelper::newEvent(), particles_, edm::Event::put(), query::result, and vertexing_.
{ using namespace edm; using namespace std; // read in vertices and EventSetup vertexing_.newEvent(iEvent, iSetup); // prepare room and tools for output auto_ptr<VertexAssociationMap> result(new VertexAssociationMap()); VertexAssociationMap::Filler filler(*result); vector<pat::VertexAssociation> assos; // loop on input tags for (VInputTag::const_iterator it = particles_.begin(), end = particles_.end(); it != end; ++it) { // read candidates Handle<View<reco::Candidate> > cands; iEvent.getByLabel(*it, cands); assos.clear(); assos.reserve(cands->size()); // loop on candidates for (size_t i = 0, n = cands->size(); i < n; ++i) { assos.push_back( vertexing_(cands->refAt(i)) ); } // insert into ValueMap filler.insert(cands, assos.begin(), assos.end()); } // do the real filling filler.fill(); // put our produced stuff in the event iEvent.put(result); }
std::vector<edm::InputTag> pat::PATVertexAssociationProducer::particles_ [private] |
Definition at line 43 of file VertexAssociationProducer.cc.
Referenced by produce().
Definition at line 44 of file VertexAssociationProducer.cc.
Referenced by produce().