#include <PhysicsTools/UtilAlgos/interface/StringCutEventSelector.h>
Public Member Functions | |
bool | select (const edm::Event &e) const |
decision of the selector module | |
StringCutsEventSelector (const edm::ParameterSet &pset) | |
~StringCutsEventSelector () | |
Private Attributes | |
std::vector < StringCutObjectSelector < Object > * > | f_ |
edm::InputTag | src_ |
Definition at line 50 of file StringCutEventSelector.h.
StringCutsEventSelector< Object, existenceMatter >::StringCutsEventSelector | ( | const edm::ParameterSet & | pset | ) | [inline] |
Definition at line 52 of file StringCutEventSelector.h.
References EventSelector::description_, StringCutsEventSelector< Object, existenceMatter >::f_, edm::ParameterSet::getParameter(), i, StringCutsEventSelector< Object, existenceMatter >::src_, and ss.
00052 : 00053 EventSelector(pset), 00054 src_(edm::Service<InputTagDistributorService>()->retrieve("src",pset)) 00055 { 00056 std::vector<std::string> selection=pset.getParameter<std::vector<std::string > >("cut"); 00057 std::stringstream ss; 00058 ss<<"string cut based selection on collection: "<<src_; 00059 description_.push_back(ss.str()); ss.str(""); 00060 description_.push_back("selection cuts are:"); 00061 for (uint i=0;i!=selection.size();i++) 00062 if (selection[i]!="-"){ 00063 f_.push_back( new StringCutObjectSelector<Object>(selection[i])); 00064 ss<<"["<<i<<"]: "<<selection[i]; 00065 description_.push_back(ss.str()); ss.str(""); 00066 } 00067 else 00068 { 00069 f_.push_back(0); 00070 ss<<"["<<i<<"]: no selection"; 00071 description_.push_back(ss.str()); ss.str(""); 00072 } 00073 } ~StringCutsEventSelector(){uint i=0; for (;i!=f_.size();i++) if (f_[i]){ delete f_[i];f_[i]=0;}}
StringCutsEventSelector< Object, existenceMatter >::~StringCutsEventSelector | ( | ) | [inline] |
Definition at line 74 of file StringCutEventSelector.h.
References StringCutsEventSelector< Object, existenceMatter >::f_, and i.
bool StringCutsEventSelector< Object, existenceMatter >::select | ( | const edm::Event & | ) | const [inline, virtual] |
decision of the selector module
Implements EventSelector.
Definition at line 76 of file StringCutEventSelector.h.
References StringCutsEventSelector< Object, existenceMatter >::f_, edm::Event::getByLabel(), i, and StringCutsEventSelector< Object, existenceMatter >::src_.
00076 { 00077 edm::Handle<edm::View<Object> > oH; 00078 e.getByLabel(src_, oH); 00079 uint i=0; 00080 if (existenceMatter && oH->size()<f_.size()) return false; 00081 for (;i!=f_.size();i++) 00082 { 00083 if (!existenceMatter && i==oH->size()) break; 00084 if (!f_[i]) continue; 00085 const Object & o = (*oH)[i]; 00086 if (!(*f_[i])(o)) return false; 00087 } 00088 return true; 00089 }
std::vector<StringCutObjectSelector<Object> *> StringCutsEventSelector< Object, existenceMatter >::f_ [private] |
edm::InputTag StringCutsEventSelector< Object, existenceMatter >::src_ [private] |
Definition at line 92 of file StringCutEventSelector.h.
Referenced by StringCutsEventSelector< Object, existenceMatter >::select(), and StringCutsEventSelector< Object, existenceMatter >::StringCutsEventSelector().