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, edm::ConsumesCollector &iC)
 
 ~PATUserDataMerger ()
 

Static Public Member Functions

static void fillDescription (edm::ParameterSetDescription &iDesc)
 

Private Attributes

Operation loader_
 
std::vector< edm::InputTaguserDataSrc_
 
std::vector< edm::EDGetTokenT
< typename
Operation::product_type > > 
userDataSrcTokens_
 

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.10 2011/10/26 17:01:25 vadler Exp

Definition at line 74 of file PATUserDataMerger.h.

Constructor & Destructor Documentation

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

Definition at line 78 of file PATUserDataMerger.h.

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

Definition at line 101 of file PATUserDataMerger.h.

References edm::ConsumesCollector::consumes(), pat::PATUserDataMerger< ObjectType, Operation >::userDataSrc_, and pat::PATUserDataMerger< ObjectType, Operation >::userDataSrcTokens_.

101  :
102  userDataSrc_(iConfig.getParameter<std::vector<edm::InputTag> >("src"))
103 {
104  for ( std::vector<edm::InputTag>::const_iterator input_it = userDataSrc_.begin(); input_it != userDataSrc_.end(); ++input_it ) {
105  userDataSrcTokens_.push_back( iC.consumes< typename Operation::product_type >( *input_it ) );
106  }
107 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
std::vector< edm::EDGetTokenT< typename Operation::product_type > > userDataSrcTokens_
std::vector< edm::InputTag > userDataSrc_
template<typename ObjectType, typename Operation>
pat::PATUserDataMerger< ObjectType, Operation >::~PATUserDataMerger ( )
inline

Definition at line 80 of file PATUserDataMerger.h.

80 {}

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 128 of file PATUserDataMerger.h.

References edm::Event::getByToken(), and AlCaHLTBitMon_QueryRunRegistry::string.

131 {
132 
133  typename std::vector<edm::EDGetTokenT<typename Operation::product_type> >::const_iterator token_begin = userDataSrcTokens_.begin(), token_it = userDataSrcTokens_.begin(), token_end = userDataSrcTokens_.end();
134 
135  for ( ; token_it != token_end; ++token_it ) {
136  const std::string encoded( userDataSrc_.at(token_it - token_begin).encode() );
137 
138  // Declare the object handles:
139  // ValueMap containing the values, or edm::Ptr's to the UserData that
140  // is associated to those PAT Objects
142 
143  // Get the objects by label
144  if ( encoded.size() == 0 ) continue;
145  iEvent.getByToken( *token_it, userData );
146 
147  edm::Ptr<reco::Candidate> recoObject = patObject.originalObjectRef();
148  loader_.addData( patObject, encoded, (*userData)[recoObject]);
149 
150  }
151 
152 }
std::vector< edm::EDGetTokenT< typename Operation::product_type > > userDataSrcTokens_
int iEvent
Definition: GenABIO.cc:243
std::vector< edm::InputTag > userDataSrc_
template<class ObjectType , typename Operation >
void pat::PATUserDataMerger< ObjectType, Operation >::fillDescription ( edm::ParameterSetDescription iDesc)
static

Definition at line 156 of file PATUserDataMerger.h.

References edm::ParameterSetDescription::add().

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

157 {
158  iDesc.add<std::vector<edm::InputTag> >("src");
159 }
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 93 of file PATUserDataMerger.h.

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