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

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
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::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
 

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  :
61  src_(consumes<edm::View<T>>(iConfig.getParameter<edm::InputTag>("src"))),
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_
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:56
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:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
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:511

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.