4 #ifndef PhysicsTools_PatAlgos_PATUserDataMerger_h
5 #define PhysicsTools_PatAlgos_PATUserDataMerger_h
45 template <
typename ObjectType>
47 obj.addUserInt(key, val);
53 template <
typename ObjectType>
55 obj.addUserFloat(key, val);
61 template <
typename ObjectType>
63 obj.addUserDataFromPtr(key, val);
69 template <
typename ObjectType>
71 obj.addUserCand(key, val);
77 template <
typename ObjectType,
typename Operation>
100 template <
typename ObjectType,
typename Operation>
103 : userDataSrc_(iConfig.getParameter<std::
vector<edm::
InputTag>>(
"src")),
104 labelPostfixesToStrip_(iConfig.existsAs<std::
vector<std::
string>>(
"labelPostfixesToStrip")
105 ? iConfig.getParameter<std::
vector<std::
string>>(
"labelPostfixesToStrip")
113 auto match =
tag.label().rfind(stripme);
114 if (
match == (
tag.label().length() - stripme.length())) {
138 template <
class ObjectType,
typename Operation>
142 typename std::vector<edm::EDGetTokenT<typename Operation::product_type>>::const_iterator
143 token_begin = userDataSrcTokens_.begin(),
144 token_it = userDataSrcTokens_.begin(), token_end = userDataSrcTokens_.end();
146 for (; token_it != token_end; ++token_it) {
147 const std::string &encoded = (labels_.at(token_it - token_begin));
160 loader_.addData(patObject, encoded, (*userData)[recoObject]);
164 template <
class ObjectType,
typename Operation>
166 iDesc.
add<std::vector<edm::InputTag>>(
"src");
167 iDesc.
addOptional<std::vector<std::string>>(
"labelPostfixesToStrip", std::vector<std::string>());
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
edm::ValueMap< value_type > product_type
std::vector< edm::EDGetTokenT< typename Operation::product_type > > userDataSrcTokens_
Assimilates pat::UserData into pat objects.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
reco::CandidatePtr value_type
void addData(ObjectType &obj, const std::string &key, const value_type &val)
edm::ValueMap< value_type > product_type
edm::ValueMap< value_type > product_type
void addData(ObjectType &obj, const std::string &key, const value_type &val)
edm::ValueMap< value_type > product_type
tuple key
prepare the HTCondor submission files and eventually submit them
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void addData(ObjectType &obj, const std::string &key, const value_type &val)
std::vector< edm::InputTag > userDataSrc_
static void fillDescription(edm::ParameterSetDescription &iDesc)
std::vector< std::string > labels_
void addData(ObjectType &obj, const std::string &key, const value_type &val)
void add(ObjectType &patObject, edm::Event const &iEvent, edm::EventSetup const &iSetup)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
edm::Ptr< UserData > value_type
std::vector< std::string > labelPostfixesToStrip_