1 #ifndef _StringCutEventSelector 2 #define _StringCutEventSelector 11 template<
typename Object,
bool any=false>
22 nFirst_(pset.getParameter<unsigned
int>(
"nFirst")),
26 ss<<
"string cut based selection on collection: "<<
src_;
37 std::vector<const Object*> copyToSort(oH->size());
38 for (
uint i=0;
i!=oH->size();++
i) copyToSort[
i]= &(*oH)[
i];
45 for (;i!=oH->size();i++)
47 const Object &
o = *(copyToSort[
i]);
56 if (!
f_(o))
return false;
71 template<
typename Object,
bool existenceMatter=true>
84 ss<<
"string cut based selection on collection: "<<
src_;
87 for (
unsigned int i=0;
i!=selection.size();
i++)
88 if (selection[
i]!=
"-"){
90 ss<<
"["<<i<<
"]: "<<selection[
i];
95 f_.push_back(
nullptr);
96 ss<<
"["<<
i<<
"]: no selection";
104 for (;i!=
f_.size();i++)
106 delete f_[
i];
f_[
i]=
nullptr;
114 std::vector<const Object*> copyToSort(oH->size());
115 for (
uint i=0;
i!=oH->size();++
i) copyToSort[
i]= &(*oH)[
i];
119 if (existenceMatter && oH->size()<
f_.size())
return false;
120 for (;i!=
f_.size();i++)
122 if (!existenceMatter && i==oH->size())
break;
123 if (!
f_[i])
continue;
124 const Object &
o = *(copyToSort[
i]);
125 if (!(*
f_[i])(
o))
return false;
133 std::vector<StringCutObjectSelector<Object> *>
f_;
bool select(const edm::Event &e) const override
decision of the selector module
T getParameter(std::string const &) const
~StringCutsEventSelector() override
bool select(const edm::Event &e) const override
decision of the selector module
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool any(const std::vector< T > &v, const T &what)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
StringCutsEventSelector(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
StringCutEventSelector(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
std::vector< StringCutObjectSelector< Object > * > f_
StringObjectFunction< Object > * order_
edm::EDGetTokenT< edm::View< Object > > srcToken_
edm::EDGetTokenT< edm::View< Object > > srcToken_
StringObjectFunction< Object > * order_
StringCutObjectSelector< Object > f_
std::vector< std::string > description_
StringCutsEventSelector(const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
StringCutEventSelector(const edm::ParameterSet &pset, edm::ConsumesCollector &iC)