CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
pat::PATObjectUserDataEmbedder< T > Class Template Reference
Inheritance diagram for pat::PATObjectUserDataEmbedder< T >:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PATObjectUserDataEmbedder (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~PATObjectUserDataEmbedder () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::EDGetTokenT< edm::View< T > > src_
 
helper::NamedUserDataLoader< pat::helper::AddUserCanduserCands_
 
helper::NamedUserDataLoader< pat::helper::AddUserFloatuserFloats_
 
helper::NamedUserDataLoader< pat::helper::AddUserIntFromBooluserIntFromBools_
 
helper::NamedUserDataLoader< pat::helper::AddUserIntuserInts_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

template<typename T>
class pat::PATObjectUserDataEmbedder< T >

Definition at line 56 of file PATObjectUserDataEmbedder.cc.

Constructor & Destructor Documentation

template<typename T >
pat::PATObjectUserDataEmbedder< T >::PATObjectUserDataEmbedder ( const edm::ParameterSet iConfig)
inlineexplicit

Definition at line 60 of file PATObjectUserDataEmbedder.cc.

60  :
62  userFloats_(iConfig, "userFloats", consumesCollector()),
63  userInts_(iConfig, "userInts", consumesCollector()),
64  userIntFromBools_(iConfig, "userIntFromBools", consumesCollector()),
65  userCands_(iConfig, "userCands", consumesCollector())
66  {
67  produces<std::vector<T>>();
68  }
helper::NamedUserDataLoader< pat::helper::AddUserInt > userInts_
T getParameter(std::string const &) const
helper::NamedUserDataLoader< pat::helper::AddUserFloat > userFloats_
helper::NamedUserDataLoader< pat::helper::AddUserCand > userCands_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< edm::View< T > > src_
helper::NamedUserDataLoader< pat::helper::AddUserIntFromBool > userIntFromBools_
template<typename T >
pat::PATObjectUserDataEmbedder< T >::~PATObjectUserDataEmbedder ( )
inlineoverride

Definition at line 70 of file PATObjectUserDataEmbedder.cc.

References iEvent.

70 {}

Member Function Documentation

template<typename T >
static void pat::PATObjectUserDataEmbedder< T >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
inlinestatic

Definition at line 74 of file PATObjectUserDataEmbedder.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addWildcard(), nanoDQM_cfi::Muon, and AlCaHLTBitMon_QueryRunRegistry::string.

74  {
76  desc.add<edm::InputTag>("src");
77  for (const std::string & what : { "userFloats", "userInts", "userIntFromBools", "userCands" }) {
79  descNested.addWildcard<edm::InputTag>("*");
80  desc.add<edm::ParameterSetDescription>(what, descNested);
81  }
82  if (typeid(T) == typeid(pat::Muon)) descriptions.add("muonsWithUserData", desc);
83  else if (typeid(T) == typeid(pat::Electron)) descriptions.add("electronsWithUserData", desc);
84  else if (typeid(T) == typeid(pat::Photon)) descriptions.add("photonsWithUserData", desc);
85  else if (typeid(T) == typeid(pat::Tau)) descriptions.add("tausWithUserData", desc);
86  else if (typeid(T) == typeid(pat::Jet)) descriptions.add("jetsWithUserData", desc);
87  }
Analysis-level Photon class.
Definition: Photon.h:47
ParameterWildcardBase * addWildcard(U const &pattern)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Analysis-level tau class.
Definition: Tau.h:55
Analysis-level electron class.
Definition: Electron.h:52
Analysis-level calorimeter jet class.
Definition: Jet.h:80
void add(std::string const &label, ParameterSetDescription const &psetDescription)
long double T
template<typename T >
void pat::PATObjectUserDataEmbedder< T >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 101 of file PATObjectUserDataEmbedder.cc.

References edm::Event::getByToken(), mps_fire::i, eostools::move(), gen::n, MillePedeFileConverter_cfg::out, edm::Event::put(), and TrackRefitter_38T_cff::src.

101  {
103  iEvent.getByToken(src_, src);
104 
105  std::unique_ptr<std::vector<T>> out(new std::vector<T>());
106  out->reserve(src->size());
107 
108  std::vector<edm::Ptr<T>> ptrs;
109  ptrs.reserve(src->size());
110  for (unsigned int i = 0, n = src->size(); i < n; ++i) {
111  // copy by value, save the ptr
112  out->push_back((*src)[i]);
113  ptrs.push_back(src->ptrAt(i));
114  }
115  userFloats_.addData(iEvent, ptrs, *out);
116  userInts_.addData(iEvent, ptrs, *out);
117  userIntFromBools_.addData(iEvent, ptrs, *out);
118  userCands_.addData(iEvent, ptrs, *out);
119 
120  iEvent.put(std::move(out));
121 }
helper::NamedUserDataLoader< pat::helper::AddUserInt > userInts_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
helper::NamedUserDataLoader< pat::helper::AddUserFloat > userFloats_
helper::NamedUserDataLoader< pat::helper::AddUserCand > userCands_
edm::EDGetTokenT< edm::View< T > > src_
helper::NamedUserDataLoader< pat::helper::AddUserIntFromBool > userIntFromBools_
void addData(const edm::Event &iEvent, const std::vector< edm::Ptr< T >> &ptrs, std::vector< T > &out) const
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

template<typename T >
edm::EDGetTokenT<edm::View<T> > pat::PATObjectUserDataEmbedder< T >::src_
private

Definition at line 91 of file PATObjectUserDataEmbedder.cc.

Definition at line 95 of file PATObjectUserDataEmbedder.cc.

Definition at line 92 of file PATObjectUserDataEmbedder.cc.

Definition at line 94 of file PATObjectUserDataEmbedder.cc.

Definition at line 93 of file PATObjectUserDataEmbedder.cc.