290 if (
arg.iConfig.exists(
"expr") &&
arg.iConfig.exists(
"index")) {
292 index_ =
arg.iConfig.getParameter<
unsigned int>(
"index");
295 std::stringstream
ss;
296 ss <<
"on object at index: " << index_ <<
" of: " <<
srcTag_;
298 if (
arg.iConfig.exists(
"order")) {
301 ss <<
" after sorting according to: " <<
order;
305 if (
arg.iConfig.exists(
"selection")) {
308 ss <<
" and selecting only: " <<
selection;
317 std::map<std::string, edm::Entry> indexEntry;
318 if (
arg.n.find(
"_N") != std::string::npos) {
320 std::vector<unsigned int> indexes =
arg.iConfig.getParameter<std::vector<unsigned int> >(
"indexes");
321 for (
unsigned int iI = 0; iI != indexes.size(); ++iI) {
324 std::stringstream
ss;
326 ss << indexes[iI] + 1;
327 indexEntry.insert(std::make_pair(ss.str(),
e));
331 std::map<std::string, edm::Entry> varEntry;
332 if (
arg.n.find(
"_V") != std::string::npos) {
334 std::vector<std::string>
vars =
arg.iConfig.getParameter<std::vector<std::string> >(
"vars");
335 for (
unsigned int v = 0;
v != vars.size(); ++
v) {
336 unsigned int sep = vars[
v].find(
":");
341 varEntry.insert(std::make_pair(name,
e));
347 if (!varEntry.empty())
348 radical = radical.substr(0, radical.size() - 2);
350 if (!indexEntry.empty())
351 radical = radical.substr(0, radical.size() - 2);
353 if (varEntry.empty()) {
355 for (std::map<std::string, edm::Entry>::iterator iIt = indexEntry.begin(); iIt != indexEntry.end(); ++iIt) {
357 toUse.
insert(
true,
"index", iIt->second);
364 for (std::map<std::string, edm::Entry>::iterator vIt = varEntry.begin(); vIt != varEntry.end(); ++vIt) {
365 if (indexEntry.empty()) {
367 toUse.
insert(
true,
"expr", vIt->second);
373 for (std::map<std::string, edm::Entry>::iterator iIt = indexEntry.begin(); iIt != indexEntry.end(); ++iIt) {
375 toUse.
insert(
true,
"expr", vIt->second);
376 toUse.
insert(
true,
"index", iIt->second);
377 std::string newVname = radical + iIt->first + vIt->first;
CachingVariable(std::string m, std::string n, const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
StringCutObjectSelector< Object > * selector_
void insert(bool ok_to_replace, char const *, Entry const &)
StringObjectFunction< Object > * f_
void addDescriptionLine(const std::string &s)
edm::EDGetTokenT< edm::View< Object > > src_
StringObjectFunction< Object > * forder_
ExpressionVariable(const CachingVariableFactoryArg &arg, edm::ConsumesCollector &iC)
const std::string & name() const