CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
StringCutsEventSelector< Object, existenceMatter > Class Template Reference

#include <StringCutEventSelector.h>

Inheritance diagram for StringCutsEventSelector< Object, existenceMatter >:
EventSelector

Public Member Functions

bool select (const edm::Event &e) const
 decision of the selector module More...
 
 StringCutsEventSelector (const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
 
 StringCutsEventSelector (const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
 
 ~StringCutsEventSelector ()
 
- Public Member Functions inherited from EventSelector
const std::vector< std::string > & description ()
 
 EventSelector ()
 
 EventSelector (const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
 
 EventSelector (const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
 
const std::string & name () const
 name of the module (from configuration) More...
 
virtual ~EventSelector ()
 

Private Attributes

std::vector
< StringCutObjectSelector
< Object > * > 
f_
 
StringObjectFunction< Object > * order_
 
edm::InputTag src_
 
edm::EDGetTokenT< edm::View
< Object > > 
srcToken_
 

Additional Inherited Members

- Protected Attributes inherited from EventSelector
std::vector< std::string > description_
 
std::string name_
 

Detailed Description

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

Definition at line 73 of file StringCutEventSelector.h.

Constructor & Destructor Documentation

template<typename Object , bool existenceMatter = true>
StringCutsEventSelector< Object, existenceMatter >::StringCutsEventSelector ( const edm::ParameterSet pset,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 75 of file StringCutEventSelector.h.

75  :
76  StringCutsEventSelector(pset, iC) {}
StringCutsEventSelector(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
template<typename Object , bool existenceMatter = true>
StringCutsEventSelector< Object, existenceMatter >::StringCutsEventSelector ( const edm::ParameterSet pset,
edm::ConsumesCollector iC 
)
inline

Definition at line 77 of file StringCutEventSelector.h.

References EventSelector::description_, edm::ParameterSet::exists(), StringCutsEventSelector< Object, existenceMatter >::f_, edm::ParameterSet::getParameter(), i, StringCutsEventSelector< Object, existenceMatter >::order_, corrVsCorr::selection, StringCutsEventSelector< Object, existenceMatter >::src_, contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

77  :
78  EventSelector(pset, iC),
79  src_(edm::Service<InputTagDistributorService>()->retrieve("src",pset)),
81  order_(0)
82  {
83  std::vector<std::string> selection=pset.getParameter<std::vector<std::string > >("cut");
84  std::stringstream ss;
85  ss<<"string cut based selection on collection: "<<src_;
86  description_.push_back(ss.str()); ss.str("");
87  description_.push_back("selection cuts are:");
88  for (unsigned int i=0;i!=selection.size();i++)
89  if (selection[i]!="-"){
90  f_.push_back( new StringCutObjectSelector<Object>(selection[i]));
91  ss<<"["<<i<<"]: "<<selection[i];
92  description_.push_back(ss.str()); ss.str("");
93  }
94  else
95  {
96  f_.push_back(0);
97  ss<<"["<<i<<"]: no selection";
98  description_.push_back(ss.str()); ss.str("");
99  }
100  if (pset.exists("order"))
102  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
selection
main part
Definition: corrVsCorr.py:98
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::vector< StringCutObjectSelector< Object > * > f_
StringObjectFunction< Object > * order_
edm::EDGetTokenT< edm::View< Object > > srcToken_
std::vector< std::string > description_
Definition: EventSelector.h:34
template<typename Object , bool existenceMatter = true>
StringCutsEventSelector< Object, existenceMatter >::~StringCutsEventSelector ( )
inline

Definition at line 103 of file StringCutEventSelector.h.

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

103  {
104  unsigned int i=0;
105  for (;i!=f_.size();i++)
106  if (f_[i]){
107  delete f_[i];f_[i]=0;
108  }
109  if (order_) delete order_;
110  }
int i
Definition: DBlmapReader.cc:9
std::vector< StringCutObjectSelector< Object > * > f_
StringObjectFunction< Object > * order_

Member Function Documentation

template<typename Object , bool existenceMatter = true>
bool StringCutsEventSelector< Object, existenceMatter >::select ( const edm::Event ) const
inlinevirtual

decision of the selector module

Implements EventSelector.

Definition at line 112 of file StringCutEventSelector.h.

References StringCutsEventSelector< Object, existenceMatter >::f_, edm::Event::getByToken(), i, python.connectstrParser::o, StringCutsEventSelector< Object, existenceMatter >::order_, python.multivaluedict::sort(), and StringCutsEventSelector< Object, existenceMatter >::srcToken_.

Referenced by Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Views.LineDecayView.LineDecayContainer::mousePressEvent(), Vispa.Gui.PortConnection.PointToPointConnection::mousePressEvent(), Vispa.Gui.VispaWidget.VispaWidget::mousePressEvent(), and Vispa.Views.AbstractView.AbstractView::restoreSelection().

112  {
114  e.getByToken(srcToken_, oH);
115  std::vector<const Object*> copyToSort(oH->size());
116  for (uint i=0;i!=oH->size();++i) copyToSort[i]= &(*oH)[i];
117  if (order_)std::sort(copyToSort.begin(), copyToSort.end(), sortByStringFunction<Object>(order_));
118 
119  unsigned int i=0;
120  if (existenceMatter && oH->size()<f_.size()) return false;
121  for (;i!=f_.size();i++)
122  {
123  if (!existenceMatter && i==oH->size()) break;
124  if (!f_[i]) continue;
125  const Object & o = *(copyToSort[i]);
126  if (!(*f_[i])(o)) return false;
127  }
128  return true;
129  }
int i
Definition: DBlmapReader.cc:9
std::vector< StringCutObjectSelector< Object > * > f_
StringObjectFunction< Object > * order_
edm::EDGetTokenT< edm::View< Object > > srcToken_

Member Data Documentation

template<typename Object , bool existenceMatter = true>
std::vector<StringCutObjectSelector<Object> *> StringCutsEventSelector< Object, existenceMatter >::f_
private
template<typename Object , bool existenceMatter = true>
StringObjectFunction<Object>* StringCutsEventSelector< Object, existenceMatter >::order_
private
template<typename Object , bool existenceMatter = true>
edm::InputTag StringCutsEventSelector< Object, existenceMatter >::src_
private
template<typename Object , bool existenceMatter = true>
edm::EDGetTokenT<edm::View<Object> > StringCutsEventSelector< Object, existenceMatter >::srcToken_
private