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

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>
class pat::PATObjectUserDataEmbedder< T >

Definition at line 60 of file PATObjectUserDataEmbedder.cc.

Constructor & Destructor Documentation

◆ PATObjectUserDataEmbedder()

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
Definition: ParameterSet.h:303
helper::NamedUserDataLoader< pat::helper::AddUserFloat > userFloats_
helper::NamedUserDataLoader< pat::helper::AddUserCand > userCands_
edm::EDGetTokenT< edm::View< T > > src_
helper::NamedUserDataLoader< pat::helper::AddUserIntFromBool > userIntFromBools_

◆ ~PATObjectUserDataEmbedder()

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

Definition at line 71 of file PATObjectUserDataEmbedder.cc.

71 {}

Member Function Documentation

◆ fillDescriptions()

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::addWildcard(), and submitPVResolutionJobs::desc.

75  {
77  desc.add<edm::InputTag>("src");
78  for (auto &&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)
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 >
void pat::PATObjectUserDataEmbedder< T >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 107 of file PATObjectUserDataEmbedder.cc.

References mps_fire::i, iEvent, eostools::move(), dqmiodumpmetadata::n, MillePedeFileConverter_cfg::out, 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);
124  userCands_.addData(iEvent, ptrs, *out);
125 
126  iEvent.put(std::move(out));
127 }
helper::NamedUserDataLoader< pat::helper::AddUserInt > userInts_
helper::NamedUserDataLoader< pat::helper::AddUserFloat > userFloats_
helper::NamedUserDataLoader< pat::helper::AddUserCand > userCands_
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< edm::View< T > > src_
void addData(const edm::Event &iEvent, const std::vector< edm::Ptr< T >> &ptrs, std::vector< T > &out) const
helper::NamedUserDataLoader< pat::helper::AddUserIntFromBool > userIntFromBools_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ src_

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

Definition at line 97 of file PATObjectUserDataEmbedder.cc.

◆ userCands_

Definition at line 101 of file PATObjectUserDataEmbedder.cc.

◆ userFloats_

Definition at line 98 of file PATObjectUserDataEmbedder.cc.

◆ userIntFromBools_

Definition at line 100 of file PATObjectUserDataEmbedder.cc.

◆ userInts_

Definition at line 99 of file PATObjectUserDataEmbedder.cc.