23 template<
typename ObjectType>
41 unsigned int n = ptrs.size();
43 for (
const auto & pair : labelsAndTokens_) {
45 for (
unsigned int i = 0;
i <
n; ++
i) {
46 adder.addData(out[
i], pair.first, (*handle)[ptrs[i]]);
51 std::vector<std::pair<std::string,edm::EDGetTokenT<typename A::product_type>>>
labelsAndTokens_;
61 src_(consumes<
edm::
View<
T>>(iConfig.getParameter<
edm::InputTag>(
"src"))),
62 userFloats_(iConfig,
"userFloats", consumesCollector()),
63 userInts_(iConfig,
"userInts", consumesCollector()),
64 userIntFromBools_(iConfig,
"userIntFromBools", consumesCollector()),
65 userCands_(iConfig,
"userCands", consumesCollector())
67 produces<std::vector<T>>();
77 for (
const std::string & what : {
"userFloats",
"userInts",
"userIntFromBools",
"userCands" }) {
82 if (
typeid(
T) ==
typeid(
pat::Muon)) descriptions.
add(
"muonsWithUserData", desc);
83 else if (
typeid(
T) ==
typeid(
pat::Electron)) descriptions.
add(
"electronsWithUserData", desc);
84 else if (
typeid(
T) ==
typeid(
pat::Photon)) descriptions.
add(
"photonsWithUserData", desc);
85 else if (
typeid(
T) ==
typeid(
pat::Tau)) descriptions.
add(
"tausWithUserData", desc);
86 else if (
typeid(
T) ==
typeid(
pat::Jet)) descriptions.
add(
"jetsWithUserData", desc);
105 std::unique_ptr<std::vector<T>>
out(
new std::vector<T>());
106 out->reserve(src->size());
108 std::vector<edm::Ptr<T>> ptrs;
109 ptrs.reserve(src->size());
110 for (
unsigned int i = 0,
n = src->size();
i <
n; ++
i) {
112 out->push_back((*src)[
i]);
113 ptrs.push_back(src->ptrAt(i));
115 userFloats_.addData(iEvent, ptrs, *out);
116 userInts_.addData(iEvent, ptrs, *out);
117 userIntFromBools_.addData(iEvent, ptrs, *out);
118 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
#define DEFINE_FWK_MODULE(type)
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
NamedUserDataLoader(const edm::ParameterSet &iConfig, const std::string &main, edm::ConsumesCollector &&cc)
edm::ValueMap< value_type > product_type
std::vector< std::pair< std::string, edm::EDGetTokenT< typename A::product_type > > > labelsAndTokens_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
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)