CMS 3D CMS Logo

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 override
 decision of the selector module More...
 
 StringCutsEventSelector (const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
 
 StringCutsEventSelector (const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
 
 ~StringCutsEventSelector () override
 
- 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 72 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 74 of file StringCutEventSelector.h.

74  :
75  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 76 of file StringCutEventSelector.h.

References EventSelector::description_, edm::ParameterSet::exists(), StringCutEventSelector< Object, any >::f_, edm::ParameterSet::getParameter(), mps_fire::i, StringCutEventSelector< Object, any >::order_, corrVsCorr::selection, StringCutEventSelector< Object, any >::src_, and AlCaHLTBitMon_QueryRunRegistry::string.

76  :
77  EventSelector(pset, iC),
78  src_(edm::Service<InputTagDistributorService>()->retrieve("src",pset)),
80  order_(nullptr)
81  {
82  std::vector<std::string> selection=pset.getParameter<std::vector<std::string > >("cut");
83  std::stringstream ss;
84  ss<<"string cut based selection on collection: "<<src_;
85  description_.push_back(ss.str()); ss.str("");
86  description_.push_back("selection cuts are:");
87  for (unsigned int i=0;i!=selection.size();i++)
88  if (selection[i]!="-"){
89  f_.push_back( new StringCutObjectSelector<Object>(selection[i]));
90  ss<<"["<<i<<"]: "<<selection[i];
91  description_.push_back(ss.str()); ss.str("");
92  }
93  else
94  {
95  f_.push_back(nullptr);
96  ss<<"["<<i<<"]: no selection";
97  description_.push_back(ss.str()); ss.str("");
98  }
99  if (pset.exists("order"))
101  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
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 ( )
inlineoverride

Definition at line 102 of file StringCutEventSelector.h.

References StringCutEventSelector< Object, any >::f_, mps_fire::i, and StringCutEventSelector< Object, any >::order_.

102  {
103  unsigned int i=0;
104  for (;i!=f_.size();i++)
105  if (f_[i]){
106  delete f_[i];f_[i]=nullptr;
107  }
108  if (order_) delete order_;
109  }
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
inlineoverridevirtual

decision of the selector module

Implements EventSelector.

Definition at line 111 of file StringCutEventSelector.h.

References StringCutEventSelector< Object, any >::f_, edm::Event::getByToken(), mps_fire::i, connectstrParser::o, StringCutEventSelector< Object, any >::order_, StringCutEventSelector< Object, any >::srcToken_, and parallelization::uint().

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().

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

Member Data Documentation

template<typename Object , bool existenceMatter = true>
std::vector<StringCutObjectSelector<Object> *> StringCutsEventSelector< Object, existenceMatter >::f_
private

Definition at line 133 of file StringCutEventSelector.h.

template<typename Object , bool existenceMatter = true>
StringObjectFunction<Object>* StringCutsEventSelector< Object, existenceMatter >::order_
private

Definition at line 134 of file StringCutEventSelector.h.

template<typename Object , bool existenceMatter = true>
edm::InputTag StringCutsEventSelector< Object, existenceMatter >::src_
private

Definition at line 131 of file StringCutEventSelector.h.

template<typename Object , bool existenceMatter = true>
edm::EDGetTokenT<edm::View<Object> > StringCutsEventSelector< Object, existenceMatter >::srcToken_
private

Definition at line 132 of file StringCutEventSelector.h.