CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
pat::PATObjectUserDataEmbedder< T, ParentType > Class Template Reference
Inheritance diagram for pat::PATObjectUserDataEmbedder< T, ParentType >:
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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

std::vector< edm::EDGetTokenT< edm::View< ParentType > > > parentSrcs_
 
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<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

template<typename T, typename ParentType = T>
class pat::PATObjectUserDataEmbedder< T, ParentType >

Definition at line 107 of file PATObjectUserDataEmbedder.cc.

Constructor & Destructor Documentation

◆ PATObjectUserDataEmbedder()

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

Definition at line 109 of file PATObjectUserDataEmbedder.cc.

References edm::ParameterSet::getParameter(), and pat::PATObjectUserDataEmbedder< T, ParentType >::parentSrcs_.

110  : src_(consumes<edm::View<T>>(iConfig.getParameter<edm::InputTag>("src"))),
111  userFloats_(iConfig, "userFloats", consumesCollector()),
112  userInts_(iConfig, "userInts", consumesCollector()),
113  userIntFromBools_(iConfig, "userIntFromBools", consumesCollector()),
114  userCands_(iConfig, "userCands", consumesCollector()) {
115  for (const auto &parentSrc : iConfig.getParameter<std::vector<edm::InputTag>>("parentSrcs")) {
116  parentSrcs_.push_back(consumes<edm::View<ParentType>>(parentSrc));
117  }
118  produces<std::vector<T>>();
119  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
helper::NamedUserDataLoader< pat::helper::AddUserCand > userCands_
edm::EDGetTokenT< edm::View< T > > src_
helper::NamedUserDataLoader< pat::helper::AddUserFloat > userFloats_
std::vector< edm::EDGetTokenT< edm::View< ParentType > > > parentSrcs_
helper::NamedUserDataLoader< pat::helper::AddUserIntFromBool > userIntFromBools_
helper::NamedUserDataLoader< pat::helper::AddUserInt > userInts_

◆ ~PATObjectUserDataEmbedder()

template<typename T , typename ParentType = T>
pat::PATObjectUserDataEmbedder< T, ParentType >::~PATObjectUserDataEmbedder ( )
inlineoverride

Definition at line 121 of file PATObjectUserDataEmbedder.cc.

121 {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 125 of file PATObjectUserDataEmbedder.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addWildcard(), and submitPVResolutionJobs::desc.

125  {
127  desc.add<edm::InputTag>("src");
128  desc.add<std::vector<edm::InputTag>>("parentSrcs", std::vector<edm::InputTag>());
129  for (auto &&what : {"userFloats", "userInts", "userIntFromBools", "userCands"}) {
130  edm::ParameterSetDescription descNested;
131  descNested.addWildcard<edm::InputTag>("*");
132  desc.add<edm::ParameterSetDescription>(what, descNested);
133  }
134  if (typeid(T) == typeid(pat::Muon))
135  descriptions.add("muonsWithUserData", desc);
136  else if (typeid(T) == typeid(pat::Electron))
137  descriptions.add("electronsWithUserData", desc);
138  else if (typeid(T) == typeid(pat::Photon))
139  descriptions.add("photonsWithUserData", desc);
140  else if (typeid(T) == typeid(pat::Tau))
141  descriptions.add("tausWithUserData", desc);
142  else if (typeid(T) == typeid(pat::Jet))
143  descriptions.add("jetsWithUserData", desc);
144  }
Analysis-level Photon class.
Definition: Photon.h:46
ParameterWildcardBase * addWildcard(U const &pattern)
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
Analysis-level muon class.
Definition: Muon.h:51

◆ produce()

template<typename T , typename ParentType >
void pat::PATObjectUserDataEmbedder< T, ParentType >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 165 of file PATObjectUserDataEmbedder.cc.

References mps_fire::i, iEvent, eostools::move(), dqmiodumpmetadata::n, MillePedeFileConverter_cfg::out, electrons_cff::parentSrcs, and TrackRefitter_38T_cff::src.

165  {
167  iEvent.getByToken(src_, src);
168 
169  std::vector<edm::Handle<edm::View<ParentType>>> parentSrcs;
170  parentSrcs.reserve(parentSrcs_.size());
171  for (const auto &src : parentSrcs_) {
172  parentSrcs.push_back(iEvent.getHandle(src));
173  }
174 
175  std::unique_ptr<std::vector<T>> out(new std::vector<T>());
176  out->reserve(src->size());
177 
178  std::vector<edm::Ptr<T>> ptrs;
179  ptrs.reserve(src->size());
180  for (unsigned int i = 0, n = src->size(); i < n; ++i) {
181  // copy by value, save the ptr
182  out->push_back((*src)[i]);
183  ptrs.push_back(src->ptrAt(i));
184  }
185 
190 
191  iEvent.put(std::move(out));
192 }
void addData(const edm::Event &iEvent, const std::vector< edm::Ptr< T >> &ptrs, std::vector< edm::Handle< edm::View< TParent >>> parents, std::vector< T > &out) const
int iEvent
Definition: GenABIO.cc:224
helper::NamedUserDataLoader< pat::helper::AddUserCand > userCands_
edm::EDGetTokenT< edm::View< T > > src_
helper::NamedUserDataLoader< pat::helper::AddUserFloat > userFloats_
std::vector< edm::EDGetTokenT< edm::View< ParentType > > > parentSrcs_
helper::NamedUserDataLoader< pat::helper::AddUserIntFromBool > userIntFromBools_
def move(src, dest)
Definition: eostools.py:511
helper::NamedUserDataLoader< pat::helper::AddUserInt > userInts_

Member Data Documentation

◆ parentSrcs_

template<typename T , typename ParentType = T>
std::vector<edm::EDGetTokenT<edm::View<ParentType> > > pat::PATObjectUserDataEmbedder< T, ParentType >::parentSrcs_
private

◆ src_

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

Definition at line 148 of file PATObjectUserDataEmbedder.cc.

◆ userCands_

template<typename T , typename ParentType = T>
helper::NamedUserDataLoader<pat::helper::AddUserCand> pat::PATObjectUserDataEmbedder< T, ParentType >::userCands_
private

Definition at line 159 of file PATObjectUserDataEmbedder.cc.

◆ userFloats_

template<typename T , typename ParentType = T>
helper::NamedUserDataLoader<pat::helper::AddUserFloat> pat::PATObjectUserDataEmbedder< T, ParentType >::userFloats_
private

Definition at line 156 of file PATObjectUserDataEmbedder.cc.

◆ userIntFromBools_

template<typename T , typename ParentType = T>
helper::NamedUserDataLoader<pat::helper::AddUserIntFromBool> pat::PATObjectUserDataEmbedder< T, ParentType >::userIntFromBools_
private

Definition at line 158 of file PATObjectUserDataEmbedder.cc.

◆ userInts_

template<typename T , typename ParentType = T>
helper::NamedUserDataLoader<pat::helper::AddUserInt> pat::PATObjectUserDataEmbedder< T, ParentType >::userInts_
private

Definition at line 157 of file PATObjectUserDataEmbedder.cc.