CMS 3D CMS Logo

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>

List of all members.

Public Member Functions

void add (ObjectType &patObject, edm::Event const &iEvent, edm::EventSetup const &iSetup)
 PATUserDataMerger (const edm::ParameterSet &iConfig)
 PATUserDataMerger ()
 ~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.10 2011/10/26 17:01:25 vadler 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.

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

Definition at line 99 of file PATUserDataMerger.h.

                                                                                              :
  userDataSrc_(iConfig.getParameter<std::vector<edm::InputTag> >("src") )
{
}
template<typename ObjectType, typename Operation>
pat::PATUserDataMerger< ObjectType, Operation >::~PATUserDataMerger ( ) [inline]

Definition at line 79 of file PATUserDataMerger.h.

{}

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().

{

  std::vector<edm::InputTag>::const_iterator input_it = userDataSrc_.begin(),
//     input_begin = userDataSrc_.begin(), // warning from gcc461: variable 'input_begin' set but not used [-Wunused-but-set-variable]
    input_end = userDataSrc_.end();

  for ( ; input_it != input_end; ++input_it ) {

    // Declare the object handles:
    // ValueMap containing the values, or edm::Ptr's to the UserData that
    //   is associated to those PAT Objects
    edm::Handle<typename Operation::product_type> userData;

    // Get the objects by label
    if ( input_it->encode().size() == 0 ) continue;
    iEvent.getByLabel( *input_it, userData );

    edm::Ptr<reco::Candidate> recoObject = patObject.originalObjectRef();
    if ( userData->contains( recoObject.id() ) ) {
      loader_.addData( patObject, input_it->encode(), (*userData)[recoObject]);
    }

  }

}
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().

{
  iDesc.add<std::vector<edm::InputTag> >("src");
}

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.