CMS 3D CMS Logo

StringCutEventSelector< Object > Class Template Reference

#include <PhysicsTools/UtilAlgos/interface/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_
uint 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(), StringCutEventSelector< Object >::src_, and ss.

00012                                                       :
00013     EventSelector(pset),
00014     src_(edm::Service<InputTagDistributorService>()->retrieve("src",pset)),
00015     f_(pset.getParameter<std::string>("cut")),
00016     //put this guy to 0 to do the check on "all" object in the collection
00017     nFirst_(pset.getParameter<uint>("nFirst"))
00018       {
00019           std::stringstream ss;
00020           ss<<"string cut based selection on collection: "<<src_;
00021           description_.push_back(ss.str());
00022           ss.str("");
00023           description_.push_back(std::string("selection cut is: ")+pset.getParameter<std::string>("cut"));
00024       }
    


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_, and StringCutEventSelector< Object >::src_.

00026                                          {
00027       edm::Handle<edm::View<Object> > oH;
00028       e.getByLabel(src_, oH);
00029       //reject events if not enough object in collection
00030       //      if ((nFirst_!=0) && (oH->size()<nFirst_)) return false;
00031       uint i=0;
00032       for (;i!=oH->size();i++)
00033         {
00034           //stop doing the check if reaching too far in the collection
00035           if ((nFirst_!=0) && (i>=nFirst_)) break;
00036           const Object & o = (*oH)[i];
00037           if (!f_(o)) return false;
00038         }
00039       return true;
00040     }


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>
uint 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]

Definition at line 43 of file StringCutEventSelector.h.

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


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:32:55 2009 for CMSSW by  doxygen 1.5.4