23 template <
typename ObjectType>
25 obj.addUserInt(key, val);
36 labelsAndTokens_.emplace_back(
44 unsigned int n = ptrs.size();
46 for (
const auto &pair : labelsAndTokens_) {
48 for (
unsigned int i = 0;
i <
n; ++
i) {
49 adder.addData(out[
i], pair.first, (*handle)[ptrs[i]]);
55 std::vector<std::pair<std::string, edm::EDGetTokenT<typename A::product_type>>>
labelsAndTokens_;
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>>();
78 for (
const std::string &what : {
"userFloats",
"userInts",
"userIntFromBools",
"userCands"}) {
84 descriptions.
add(
"muonsWithUserData", desc);
86 descriptions.
add(
"electronsWithUserData", desc);
88 descriptions.
add(
"photonsWithUserData", desc);
90 descriptions.
add(
"tausWithUserData", desc);
92 descriptions.
add(
"jetsWithUserData", desc);
106 template <
typename T>
111 std::unique_ptr<std::vector<T>>
out(
new std::vector<T>());
112 out->reserve(src->size());
114 std::vector<edm::Ptr<T>> ptrs;
115 ptrs.reserve(src->size());
116 for (
unsigned int i = 0,
n = src->size();
i <
n; ++
i) {
118 out->push_back((*src)[
i]);
119 ptrs.push_back(src->ptrAt(i));
121 userFloats_.addData(iEvent, ptrs, *out);
122 userInts_.addData(iEvent, ptrs, *out);
123 userIntFromBools_.addData(iEvent, ptrs, *out);
124 userCands_.addData(iEvent, ptrs, *out);
helper::NamedUserDataLoader< pat::helper::AddUserInt > userInts_
T getParameter(std::string const &) const
Analysis-level Photon class.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
pat::PATObjectUserDataEmbedder< pat::Electron > PATElectronUserDataEmbedder
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
pat::PATObjectUserDataEmbedder< pat::Tau > PATTauUserDataEmbedder
ParameterWildcardBase * addWildcard(U const &pattern)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
pat::PATObjectUserDataEmbedder< pat::Photon > PATPhotonUserDataEmbedder
helper::NamedUserDataLoader< pat::helper::AddUserFloat > userFloats_
helper::NamedUserDataLoader< pat::helper::AddUserCand > userCands_
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
pat::PATObjectUserDataEmbedder< pat::Jet > PATJetUserDataEmbedder
#define DEFINE_FWK_MODULE(type)
NamedUserDataLoader(const edm::ParameterSet &iConfig, const std::string &main, edm::ConsumesCollector &&cc)
edm::ValueMap< value_type > product_type
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< std::pair< std::string, edm::EDGetTokenT< typename A::product_type > > > labelsAndTokens_
Analysis-level tau class.
edm::EDGetTokenT< edm::View< T > > src_
PATObjectUserDataEmbedder(const edm::ParameterSet &iConfig)
pat::PATObjectUserDataEmbedder< pat::Muon > PATMuonUserDataEmbedder
Analysis-level electron class.
Analysis-level calorimeter jet class.
void add(std::string const &label, ParameterSetDescription const &psetDescription)
helper::NamedUserDataLoader< pat::helper::AddUserIntFromBool > userIntFromBools_
void addData(const edm::Event &iEvent, const std::vector< edm::Ptr< T >> &ptrs, std::vector< T > &out) const
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
~PATObjectUserDataEmbedder() override
void addData(ObjectType &obj, const std::string &key, const value_type &val)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)