4 #ifndef PhysicsTools_PatAlgos_PATUserDataMerger_h 5 #define PhysicsTools_PatAlgos_PATUserDataMerger_h 47 template<
typename ObjectType>
53 template<
typename ObjectType>
59 template<
typename ObjectType>
61 obj.addUserDataFromPtr(key, val);
67 template<
typename ObjectType>
73 template<
typename ObjectType,
typename Operation>
93 std::vector<std::string> labelPostfixesToStrip_,
labels_;
101 template<
typename ObjectType,
typename Operation>
103 userDataSrc_(iConfig.getParameter<
std::vector<
edm::InputTag> >(
"src")),
104 labelPostfixesToStrip_(iConfig.existsAs<
std::vector<
std::
string>>(
"labelPostfixesToStrip") ? iConfig.getParameter<
std::vector<
std::
string>>(
"labelPostfixesToStrip") :
std::vector<
std::
string>())
106 for ( std::vector<edm::InputTag>::const_iterator input_it =
userDataSrc_.begin(); input_it !=
userDataSrc_.end(); ++input_it ) {
111 auto match =
tag.label().rfind(stripme);
112 if (
match == (
tag.label().length() - stripme.length())) {
137 template<
class ObjectType,
typename Operation>
146 for ( ; token_it != token_end; ++token_it ) {
155 if ( encoded.size() == 0 )
continue;
159 loader_.addData( patObject, encoded, (*userData)[recoObject]);
165 template<
class ObjectType,
typename Operation>
169 iDesc.
add<std::vector<edm::InputTag> >(
"src");
170 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
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
edm::ValueMap< value_type > product_type
void addData(ObjectType &obj, const std::string &key, const value_type &val)
edm::ValueMap< value_type > product_type
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_