CMS 3D CMS Logo

Public Member Functions | Private Attributes

StringCutsEventSelector< Object, existenceMatter > Class Template Reference

#include <StringCutEventSelector.h>

Inheritance diagram for StringCutsEventSelector< Object, existenceMatter >:
EventSelector

List of all members.

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_

Detailed Description

template<typename Object, bool existenceMatter = true>
class StringCutsEventSelector< Object, existenceMatter >

Definition at line 50 of file StringCutEventSelector.h.


Constructor & Destructor Documentation

template<typename Object , bool existenceMatter = true>
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, corrVsCorr::selection, and StringCutsEventSelector< Object, existenceMatter >::src_.

                                                       :
    EventSelector(pset),
    src_(edm::Service<InputTagDistributorService>()->retrieve("src",pset))
      {
        std::vector<std::string> selection=pset.getParameter<std::vector<std::string > >("cut");
        std::stringstream ss;
        ss<<"string cut based selection on collection: "<<src_;
        description_.push_back(ss.str());           ss.str("");
        description_.push_back("selection cuts are:");
        for (unsigned int i=0;i!=selection.size();i++)
          if (selection[i]!="-"){
            f_.push_back( new StringCutObjectSelector<Object>(selection[i]));
            ss<<"["<<i<<"]: "<<selection[i];
            description_.push_back(ss.str());           ss.str("");
          }
          else
            {
              f_.push_back(0);
              ss<<"["<<i<<"]: no selection";
              description_.push_back(ss.str());           ss.str("");
            }
      }
template<typename Object , bool existenceMatter = true>
StringCutsEventSelector< Object, existenceMatter >::~StringCutsEventSelector ( ) [inline]

Definition at line 74 of file StringCutEventSelector.h.

References StringCutsEventSelector< Object, existenceMatter >::f_, and i.

{unsigned int i=0; for (;i!=f_.size();i++) if (f_[i]){ delete f_[i];f_[i]=0;}}

Member Function Documentation

template<typename Object , bool existenceMatter = true>
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, python::connectstrParser::o, and StringCutsEventSelector< Object, existenceMatter >::src_.

                                         {
      edm::Handle<edm::View<Object> > oH;
      e.getByLabel(src_, oH);
      unsigned int i=0;
      if (existenceMatter && oH->size()<f_.size()) return false;
      for (;i!=f_.size();i++)
        {  
          if (!existenceMatter && i==oH->size()) break;
          if (!f_[i]) continue;
          const Object & o = (*oH)[i];
          if (!(*f_[i])(o)) return false;
        }
      return true;
    }

Member Data Documentation

template<typename Object , bool existenceMatter = true>
std::vector<StringCutObjectSelector<Object> *> StringCutsEventSelector< Object, existenceMatter >::f_ [private]
template<typename Object , bool existenceMatter = true>
edm::InputTag StringCutsEventSelector< Object, existenceMatter >::src_ [private]