CMS 3D CMS Logo

Public Member Functions | Private Attributes

StringCutEventSelector< Object > Class Template Reference

#include <StringCutEventSelector.h>

Inheritance diagram for StringCutEventSelector< Object >:
EventSelector

List of all members.

Public Member Functions

bool select (const edm::Event &e) const
 decision of the selector module
 StringCutEventSelector (const edm::ParameterSet &pset)

Private Attributes

StringCutObjectSelector< Object > f_
unsigned int nFirst_
edm::InputTag src_

Detailed Description

template<typename Object>
class StringCutEventSelector< Object >

Definition at line 10 of file StringCutEventSelector.h.


Constructor & Destructor Documentation

template<typename Object >
StringCutEventSelector< Object >::StringCutEventSelector ( const edm::ParameterSet pset) [inline]

Definition at line 12 of file StringCutEventSelector.h.

References EventSelector::description_, edm::ParameterSet::getParameter(), and StringCutEventSelector< Object >::src_.

                                                      :
    EventSelector(pset),
    src_(edm::Service<InputTagDistributorService>()->retrieve("src",pset)),
    f_(pset.getParameter<std::string>("cut")),
    //put this guy to 0 to do the check on "all" object in the collection
    nFirst_(pset.getParameter<unsigned int>("nFirst"))
      {
          std::stringstream ss;
          ss<<"string cut based selection on collection: "<<src_;
          description_.push_back(ss.str());
          ss.str("");
          description_.push_back(std::string("selection cut is: ")+pset.getParameter<std::string>("cut"));
      }

Member Function Documentation

template<typename Object >
bool StringCutEventSelector< Object >::select ( const edm::Event ) const [inline, virtual]

decision of the selector module

Implements EventSelector.

Definition at line 26 of file StringCutEventSelector.h.

References StringCutEventSelector< Object >::f_, edm::Event::getByLabel(), i, StringCutEventSelector< Object >::nFirst_, connectstrParser::o, and StringCutEventSelector< Object >::src_.

                                         {
      edm::Handle<edm::View<Object> > oH;
      e.getByLabel(src_, oH);
      //reject events if not enough object in collection
      //      if ((nFirst_!=0) && (oH->size()<nFirst_)) return false;
      unsigned int i=0;
      for (;i!=oH->size();i++)
        {
          //stop doing the check if reaching too far in the collection
          if ((nFirst_!=0) && (i>=nFirst_)) break;
          const Object & o = (*oH)[i];
          if (!f_(o)) return false;
        }
      return true;
    }

Member Data Documentation

template<typename Object >
StringCutObjectSelector<Object> StringCutEventSelector< Object >::f_ [private]

Definition at line 44 of file StringCutEventSelector.h.

Referenced by StringCutEventSelector< Object >::select().

template<typename Object >
unsigned int StringCutEventSelector< Object >::nFirst_ [private]

Definition at line 45 of file StringCutEventSelector.h.

Referenced by StringCutEventSelector< Object >::select().

template<typename Object >
edm::InputTag StringCutEventSelector< Object >::src_ [private]