4 #ifndef PhysicsTools_PatAlgos_PATUserDataMerger_h 5 #define PhysicsTools_PatAlgos_PATUserDataMerger_h 45 template <
typename ObjectType>
53 template <
typename ObjectType>
61 template <
typename ObjectType>
69 template <
typename ObjectType>
77 template <
typename ObjectType,
typename Operation>
100 template <
typename ObjectType,
typename Operation>
104 labelPostfixesToStrip_(iConfig.existsAs<
std::
vector<
std::
string>>(
"labelPostfixesToStrip")
107 for (std::vector<edm::InputTag>::const_iterator input_it = userDataSrc_.begin(); input_it != userDataSrc_.end();
109 userDataSrcTokens_.push_back(iC.
consumes<
typename Operation::product_type>(*input_it));
112 for (
const std::string &stripme : labelPostfixesToStrip_) {
113 auto match =
tag.label().rfind(stripme);
114 if (
match == (
tag.label().length() - stripme.length())) {
118 labels_.push_back(
tag.encode());
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.
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
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_