CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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

Public Member Functions

 PATVertexAssociationProducer (const edm::ParameterSet &iConfig)
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
 ~PATVertexAssociationProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Types

typedef edm::ValueMap
< pat::VertexAssociation
VertexAssociationMap
 
typedef std::vector
< edm::InputTag
VInputTag
 

Private Attributes

std::vector< edm::InputTagparticles_
 
pat::helper::VertexingHelper vertexing_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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.

52  :
53  particles_( iConfig.existsAs<VInputTag>("candidates") ? // if it's a VInputTag
54  iConfig.getParameter<VInputTag>("candidates") :
55  VInputTag(1, iConfig.getParameter<edm::InputTag>("candidates")) ),
56  vertexing_(iConfig)
57 {
58  produces<VertexAssociationMap>();
59 }
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:187
pat::helper::VertexingHelper vertexing_
std::vector< edm::InputTag > VInputTag
std::vector< edm::InputTag > particles_
PATVertexAssociationProducer::~PATVertexAssociationProducer ( )

Definition at line 62 of file VertexAssociationProducer.cc.

62  {
63 }

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_.

66  {
67  using namespace edm; using namespace std;
68  // read in vertices and EventSetup
69  vertexing_.newEvent(iEvent, iSetup);
70 
71  // prepare room and tools for output
72  auto_ptr<VertexAssociationMap> result(new VertexAssociationMap());
74  vector<pat::VertexAssociation> assos;
75 
76  // loop on input tags
77  for (VInputTag::const_iterator it = particles_.begin(), end = particles_.end(); it != end; ++it) {
78  // read candidates
80  iEvent.getByLabel(*it, cands);
81  assos.clear(); assos.reserve(cands->size());
82  // loop on candidates
83  for (size_t i = 0, n = cands->size(); i < n; ++i) {
84  assos.push_back( vertexing_(cands->refAt(i)) );
85  }
86  // insert into ValueMap
87  filler.insert(cands, assos.begin(), assos.end());
88  }
89 
90  // do the real filling
91  filler.fill();
92 
93  // put our produced stuff in the event
94  iEvent.put(result);
95 }
int i
Definition: DBlmapReader.cc:9
pat::helper::VertexingHelper vertexing_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
tuple result
Definition: query.py:137
#define end
Definition: vmac.h:38
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
edm::ValueMap< pat::VertexAssociation > VertexAssociationMap
helper::Filler< ValueMap< T > > Filler
Definition: ValueMap.h:157
void newEvent(const edm::Event &event)
To be called for each new event, reads in the vertex collection.
std::vector< edm::InputTag > particles_

Member Data Documentation

std::vector<edm::InputTag> pat::PATVertexAssociationProducer::particles_
private

Definition at line 43 of file VertexAssociationProducer.cc.

Referenced by produce().

pat::helper::VertexingHelper pat::PATVertexAssociationProducer::vertexing_
private

Definition at line 44 of file VertexAssociationProducer.cc.

Referenced by produce().