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 hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () 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

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

◆ ~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.

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  }

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

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

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 }

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

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.

mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
pat::Tau
Analysis-level tau class.
Definition: Tau.h:53
pat::Photon
Analysis-level Photon class.
Definition: Photon.h:46
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::Handle
Definition: AssociativeIterator.h:50
edm::ParameterSetDescription::addWildcard
ParameterWildcardBase * addWildcard(U const &pattern)
Definition: ParameterSetDescription.h:199
pat::PATObjectUserDataEmbedder::src_
edm::EDGetTokenT< edm::View< T > > src_
Definition: PATObjectUserDataEmbedder.cc:97
pat::Jet
Analysis-level calorimeter jet class.
Definition: Jet.h:77
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
pat::PATObjectUserDataEmbedder::userInts_
helper::NamedUserDataLoader< pat::helper::AddUserInt > userInts_
Definition: PATObjectUserDataEmbedder.cc:99
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
pat::helper::NamedUserDataLoader::addData
void addData(const edm::Event &iEvent, const std::vector< edm::Ptr< T >> &ptrs, std::vector< T > &out) const
Definition: PATObjectUserDataEmbedder.cc:42
edm::View
Definition: CaloClusterFwd.h:14
TrackRefitter_38T_cff.src
src
Definition: TrackRefitter_38T_cff.py:24
pat::PATObjectUserDataEmbedder::userCands_
helper::NamedUserDataLoader< pat::helper::AddUserCand > userCands_
Definition: PATObjectUserDataEmbedder.cc:101
iEvent
int iEvent
Definition: GenABIO.cc:224
dumpRecoGeometry_cfg.Muon
Muon
Definition: dumpRecoGeometry_cfg.py:190
pat::PATObjectUserDataEmbedder::userIntFromBools_
helper::NamedUserDataLoader< pat::helper::AddUserIntFromBool > userIntFromBools_
Definition: PATObjectUserDataEmbedder.cc:100
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
T
long double T
Definition: Basic3DVectorLD.h:48
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
pat::Electron
Analysis-level electron class.
Definition: Electron.h:51
pat::PATObjectUserDataEmbedder::userFloats_
helper::NamedUserDataLoader< pat::helper::AddUserFloat > userFloats_
Definition: PATObjectUserDataEmbedder.cc:98
edm::InputTag
Definition: InputTag.h:15