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 hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () 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 60 of file PATObjectUserDataEmbedder.cc.

Constructor & Destructor Documentation

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

Definition at line 62 of file PATObjectUserDataEmbedder.cc.

63  : src_(consumes<edm::View<T>>(iConfig.getParameter<edm::InputTag>("src"))),
64  userFloats_(iConfig, "userFloats", consumesCollector()),
65  userInts_(iConfig, "userInts", consumesCollector()),
66  userIntFromBools_(iConfig, "userIntFromBools", consumesCollector()),
67  userCands_(iConfig, "userCands", consumesCollector()) {
68  produces<std::vector<T>>();
69  }
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 71 of file PATObjectUserDataEmbedder.cc.

References iEvent.

71 {}

Member Function Documentation

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

Definition at line 75 of file PATObjectUserDataEmbedder.cc.

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

75  {
77  desc.add<edm::InputTag>("src");
78  for (const std::string &what : {"userFloats", "userInts", "userIntFromBools", "userCands"}) {
80  descNested.addWildcard<edm::InputTag>("*");
81  desc.add<edm::ParameterSetDescription>(what, descNested);
82  }
83  if (typeid(T) == typeid(pat::Muon))
84  descriptions.add("muonsWithUserData", desc);
85  else if (typeid(T) == typeid(pat::Electron))
86  descriptions.add("electronsWithUserData", desc);
87  else if (typeid(T) == typeid(pat::Photon))
88  descriptions.add("photonsWithUserData", desc);
89  else if (typeid(T) == typeid(pat::Tau))
90  descriptions.add("tausWithUserData", desc);
91  else if (typeid(T) == typeid(pat::Jet))
92  descriptions.add("jetsWithUserData", desc);
93  }
Analysis-level Photon class.
Definition: Photon.h:46
ParameterWildcardBase * addWildcard(U const &pattern)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Analysis-level tau class.
Definition: Tau.h:53
Analysis-level electron class.
Definition: Electron.h:51
Analysis-level calorimeter jet class.
Definition: Jet.h:77
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 107 of file PATObjectUserDataEmbedder.cc.

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

107  {
109  iEvent.getByToken(src_, src);
110 
111  std::unique_ptr<std::vector<T>> out(new std::vector<T>());
112  out->reserve(src->size());
113 
114  std::vector<edm::Ptr<T>> ptrs;
115  ptrs.reserve(src->size());
116  for (unsigned int i = 0, n = src->size(); i < n; ++i) {
117  // copy by value, save the ptr
118  out->push_back((*src)[i]);
119  ptrs.push_back(src->ptrAt(i));
120  }
121  userFloats_.addData(iEvent, ptrs, *out);
122  userInts_.addData(iEvent, ptrs, *out);
123  userIntFromBools_.addData(iEvent, ptrs, *out);
124  userCands_.addData(iEvent, ptrs, *out);
125 
126  iEvent.put(std::move(out));
127 }
helper::NamedUserDataLoader< pat::helper::AddUserInt > userInts_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
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 97 of file PATObjectUserDataEmbedder.cc.

Definition at line 101 of file PATObjectUserDataEmbedder.cc.

Definition at line 98 of file PATObjectUserDataEmbedder.cc.

Definition at line 100 of file PATObjectUserDataEmbedder.cc.

Definition at line 99 of file PATObjectUserDataEmbedder.cc.