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

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(), StringCutEventSelector< Object, any >::f_, edm::ParameterSet::getParameter(), mps_fire::i, StringCutEventSelector< Object, any >::order_, corrVsCorr::selection, StringCutEventSelector< Object, any >::src_, contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

78  : EventSelector(pset, iC),
79  src_(edm::Service<InputTagDistributorService>()->retrieve("src", pset)),
81  order_(nullptr) {
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());
86  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());
93  ss.str("");
94  } else {
95  f_.push_back(nullptr);
96  ss << "[" << i << "]: no selection";
97  description_.push_back(ss.str());
98  ss.str("");
99  }
100  if (pset.exists("order"))
102  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
selection
main part
Definition: corrVsCorr.py:100
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:33
template<typename Object , bool existenceMatter = true>
StringCutsEventSelector< Object, existenceMatter >::~StringCutsEventSelector ( )
inlineoverride

Definition at line 103 of file StringCutEventSelector.h.

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

103  {
104  unsigned int i = 0;
105  for (; i != f_.size(); i++)
106  if (f_[i]) {
107  delete f_[i];
108  f_[i] = nullptr;
109  }
110  if (order_)
111  delete order_;
112  }
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 114 of file StringCutEventSelector.h.

References StringCutEventSelector< Object, any >::f_, edm::Event::getByToken(), mps_fire::i, EcalTangentSkim_cfg::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().

114  {
116  e.getByToken(srcToken_, oH);
117  std::vector<const Object*> copyToSort(oH->size());
118  for (uint i = 0; i != oH->size(); ++i)
119  copyToSort[i] = &(*oH)[i];
120  if (order_)
121  std::sort(copyToSort.begin(), copyToSort.end(), sortByStringFunction<Object>(order_));
122 
123  unsigned int i = 0;
124  if (existenceMatter && oH->size() < f_.size())
125  return false;
126  for (; i != f_.size(); i++) {
127  if (!existenceMatter && i == oH->size())
128  break;
129  if (!f_[i])
130  continue;
131  const Object& o = *(copyToSort[i]);
132  if (!(*f_[i])(o))
133  return false;
134  }
135  return true;
136  }
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

Definition at line 141 of file StringCutEventSelector.h.

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

Definition at line 142 of file StringCutEventSelector.h.

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

Definition at line 139 of file StringCutEventSelector.h.

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

Definition at line 140 of file StringCutEventSelector.h.