CMS 3D CMS Logo

Public Member Functions | Private Types | Private Attributes

pat::PATVertexAssociationProducer Class Reference

Produces VertexAssociation and a ValueMap to the originating reco jets. More...

Inheritance diagram for pat::PATVertexAssociationProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

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::InputTagparticles_
pat::helper::VertexingHelper vertexing_

Detailed Description

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

Author:
Giovanni Petrucciani
Version:
Id:
VertexAssociationProducer.cc,v 1.2 2010/02/20 21:00:29 wmtan Exp

Definition at line 29 of file VertexAssociationProducer.cc.


Member Typedef Documentation

Definition at line 31 of file VertexAssociationProducer.cc.

Definition at line 41 of file VertexAssociationProducer.cc.


Constructor & Destructor Documentation

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.

                                                            {
}

Member Function Documentation

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);
}

Member Data Documentation

Definition at line 43 of file VertexAssociationProducer.cc.

Referenced by produce().

Definition at line 44 of file VertexAssociationProducer.cc.

Referenced by produce().