CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
pat::PATUserDataMerger< ObjectType, Operation > Class Template Reference

Assimilates pat::UserData into pat objects. More...

#include "PhysicsTools/PatAlgos/interface/PATUserDataMerger.h"

Public Member Functions

void add (ObjectType &patObject, edm::Event const &iEvent, edm::EventSetup const &iSetup)
 
 PATUserDataMerger ()
 
 PATUserDataMerger (const edm::ParameterSet &iConfig)
 
 ~PATUserDataMerger ()
 

Static Public Member Functions

static void fillDescription (edm::ParameterSetDescription &iDesc)
 

Private Attributes

Operation loader_
 
std::vector< edm::InputTaguserDataSrc_
 

Detailed Description

template<typename ObjectType, typename Operation>
class pat::PATUserDataMerger< ObjectType, Operation >

Assimilates pat::UserData into pat objects.

      This expects one input:
src:               The data to add to the objects that get passed to this
                   object, which are ValueMaps to some type (like UserData or double).

This will be called from PATUserDataHelper to handle the templated cases
like UserData or double. PATUserDataHelper will then add all the instantiated
cases.
Author
Salvatore Rappoccio
Version
Id:
PATUserDataMerger.h,v 1.11 2013/02/27 23:26:56 wmtan Exp

Definition at line 73 of file PATUserDataMerger.h.

Constructor & Destructor Documentation

template<typename ObjectType, typename Operation>
pat::PATUserDataMerger< ObjectType, Operation >::PATUserDataMerger ( )
inline

Definition at line 77 of file PATUserDataMerger.h.

77 {}
template<typename ObjectType , typename Operation >
pat::PATUserDataMerger< ObjectType, Operation >::PATUserDataMerger ( const edm::ParameterSet iConfig)

Definition at line 99 of file PATUserDataMerger.h.

99  :
100  userDataSrc_(iConfig.getParameter<std::vector<edm::InputTag> >("src") )
101 {
102 }
T getParameter(std::string const &) const
std::vector< edm::InputTag > userDataSrc_
template<typename ObjectType, typename Operation>
pat::PATUserDataMerger< ObjectType, Operation >::~PATUserDataMerger ( )
inline

Definition at line 79 of file PATUserDataMerger.h.

79 {}

Member Function Documentation

template<class ObjectType, typename Operation >
void pat::PATUserDataMerger< ObjectType, Operation >::add ( ObjectType &  patObject,
edm::Event const &  iEvent,
edm::EventSetup const &  iSetup 
)

Definition at line 123 of file PATUserDataMerger.h.

References edm::Event::getByLabel(), and edm::Ptr< T >::id().

126 {
127 
128  std::vector<edm::InputTag>::const_iterator input_it = userDataSrc_.begin(),
129 // input_begin = userDataSrc_.begin(), // warning from gcc461: variable 'input_begin' set but not used [-Wunused-but-set-variable]
130  input_end = userDataSrc_.end();
131 
132  for ( ; input_it != input_end; ++input_it ) {
133 
134  // Declare the object handles:
135  // ValueMap containing the values, or edm::Ptr's to the UserData that
136  // is associated to those PAT Objects
138 
139  // Get the objects by label
140  if ( input_it->encode().size() == 0 ) continue;
141  iEvent.getByLabel( *input_it, userData );
142 
143  edm::Ptr<reco::Candidate> recoObject = patObject.originalObjectRef();
144  if ( userData->contains( recoObject.id() ) ) {
145  loader_.addData( patObject, input_it->encode(), (*userData)[recoObject]);
146  }
147 
148  }
149 
150 }
int iEvent
Definition: GenABIO.cc:243
ProductID id() const
Accessor for product ID.
Definition: Ptr.h:164
std::vector< edm::InputTag > userDataSrc_
template<class ObjectType , typename Operation >
void pat::PATUserDataMerger< ObjectType, Operation >::fillDescription ( edm::ParameterSetDescription iDesc)
static

Definition at line 154 of file PATUserDataMerger.h.

References edm::ParameterSetDescription::add().

Referenced by pat::PATUserDataHelper< ObjectType >::fillDescription().

155 {
156  iDesc.add<std::vector<edm::InputTag> >("src");
157 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)

Member Data Documentation

template<typename ObjectType, typename Operation>
Operation pat::PATUserDataMerger< ObjectType, Operation >::loader_
private

Definition at line 91 of file PATUserDataMerger.h.

template<typename ObjectType, typename Operation>
std::vector<edm::InputTag> pat::PATUserDataMerger< ObjectType, Operation >::userDataSrc_
private

Definition at line 90 of file PATUserDataMerger.h.