18 bool equal(
const T &lhs,
const T &rhs) {
20 <<
" equal in PATObjectUserDataEmbedder is not implimented for objects of type " <<
typeid(lhs).
name()
21 <<
" and thus their src coll must be the same collection the valuemaps are keyed off";
41 template <
typename ObjectType>
47 template <
typename T,
typename TParent,
typename TProd>
51 if (
prod.contains(ptr.
id())) {
54 for (
const auto &parentColl : parentColls) {
55 if (parentColl.isValid() &&
prod.contains(parentColl.id())) {
56 for (
size_t indx = 0; indx < parentColl->size(); indx++) {
57 if (equal<TParent>(*ptr, (*parentColl)[indx])) {
68 <<
"When accessing value maps in PATObjectUserDataEmbedder, the collection the valuemap was keyed off is not " 69 "either the input src or listed in one of the parentSrcs";
84 template <
typename T,
typename TParent = T>
88 std::vector<T> &
out)
const {
90 unsigned int n = ptrs.size();
94 for (
unsigned int i = 0;
i <
n; ++
i) {
96 adder.addData(
out[
i], pair.first, (*
handle)[ptr]);
102 std::vector<std::pair<std::string, edm::EDGetTokenT<typename A::product_type>>>
labelsAndTokens_;
106 template <
typename T,
typename ParentType = T>
111 userFloats_(iConfig,
"userFloats", consumesCollector()),
112 userInts_(iConfig,
"userInts", consumesCollector()),
114 userCands_(iConfig,
"userCands", consumesCollector()) {
115 for (
const auto &parentSrc : iConfig.
getParameter<std::vector<edm::InputTag>>(
"parentSrcs")) {
118 produces<std::vector<T>>();
128 desc.add<std::vector<edm::InputTag>>(
"parentSrcs", std::vector<edm::InputTag>());
129 for (
auto &&what : {
"userFloats",
"userInts",
"userIntFromBools",
"userCands"}) {
135 descriptions.
add(
"muonsWithUserData",
desc);
137 descriptions.
add(
"electronsWithUserData",
desc);
139 descriptions.
add(
"photonsWithUserData",
desc);
141 descriptions.
add(
"tausWithUserData",
desc);
143 descriptions.
add(
"jetsWithUserData",
desc);
164 template <
typename T,
typename ParentType>
169 std::vector<edm::Handle<edm::View<ParentType>>>
parentSrcs;
171 for (
const auto &
src : parentSrcs_) {
175 std::unique_ptr<std::vector<T>>
out(
new std::vector<T>());
176 out->reserve(
src->size());
178 std::vector<edm::Ptr<T>> ptrs;
179 ptrs.reserve(
src->size());
180 for (
unsigned int i = 0,
n =
src->size();
i <
n; ++
i) {
183 ptrs.push_back(
src->ptrAt(
i));
PATObjectUserDataEmbedder(const edm::ParameterSet &iConfig)
Analysis-level Photon class.
T getParameter(std::string const &) const
pat::PATObjectUserDataEmbedder< pat::Tau > PATTauUserDataEmbedder
ProductID id() const
Accessor for product ID.
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
ParameterWildcardBase * addWildcard(U const &pattern)
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
uint32_t cc[maxCellsPerHit]
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
pat::PATObjectUserDataEmbedder< pat::Photon, reco::Photon > PATPhotonUserDataEmbedder
bool equal(const T &first, const T &second)
pat::PATObjectUserDataEmbedder< pat::Jet > PATJetUserDataEmbedder
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
NamedUserDataLoader(const edm::ParameterSet &iConfig, const std::string &main, edm::ConsumesCollector &&cc)
helper::NamedUserDataLoader< pat::helper::AddUserCand > userCands_
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
edm::EDGetTokenT< edm::View< T > > src_
helper::NamedUserDataLoader< pat::helper::AddUserFloat > userFloats_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
key
prepare the HTCondor submission files and eventually submit them
edm::ValueMap< value_type > product_type
#define DEFINE_FWK_MODULE(type)
std::vector< std::pair< std::string, edm::EDGetTokenT< typename A::product_type > > > labelsAndTokens_
Analysis-level tau class.
std::vector< edm::EDGetTokenT< edm::View< ParentType > > > parentSrcs_
edm::Ptr< TParent > getPtrForProd(edm::Ptr< T > ptr, const std::vector< edm::Handle< edm::View< TParent >>> &parentColls, const TProd &prod)
pat::PATObjectUserDataEmbedder< pat::Muon > PATMuonUserDataEmbedder
helper::NamedUserDataLoader< pat::helper::AddUserIntFromBool > userIntFromBools_
Analysis-level electron class.
Analysis-level calorimeter jet class.
void add(std::string const &label, ParameterSetDescription const &psetDescription)
~PATObjectUserDataEmbedder() override
Analysis-level muon class.
SuperClusterRef superCluster() const override
reference to a SuperCluster
void addData(ObjectType &obj, const std::string &key, const value_type &val)
pat::PATObjectUserDataEmbedder< pat::Electron, reco::GsfElectron > PATElectronUserDataEmbedder
helper::NamedUserDataLoader< pat::helper::AddUserInt > userInts_