test
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
StringCutEventSelector< Object, any > Class Template Reference

#include <StringCutEventSelector.h>

Inheritance diagram for StringCutEventSelector< Object, any >:
EventSelector

Public Member Functions

bool select (const edm::Event &e) const
 decision of the selector module More...
 
 StringCutEventSelector (const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
 
 StringCutEventSelector (const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
 
- 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

StringCutObjectSelector< Object > f_
 
unsigned int nFirst_
 
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 any = false>
class StringCutEventSelector< Object, any >

Definition at line 13 of file StringCutEventSelector.h.

Constructor & Destructor Documentation

template<typename Object , bool any = false>
StringCutEventSelector< Object, any >::StringCutEventSelector ( const edm::ParameterSet pset,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 15 of file StringCutEventSelector.h.

15  :
16  StringCutEventSelector(pset, iC) {}
StringCutEventSelector(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
template<typename Object , bool any = false>
StringCutEventSelector< Object, any >::StringCutEventSelector ( const edm::ParameterSet pset,
edm::ConsumesCollector iC 
)
inline

Definition at line 17 of file StringCutEventSelector.h.

References EventSelector::description_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), StringCutEventSelector< Object, any >::order_, StringCutEventSelector< Object, any >::src_, contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

17  :
18  EventSelector(pset, iC),
19  src_(edm::Service<InputTagDistributorService>()->retrieve("src",pset)),
21  f_(pset.getParameter<std::string>("cut")),
22  //put this guy to 0 to do the check on "all" object in the collection
23  nFirst_(pset.getParameter<unsigned int>("nFirst")),
24  order_(0)
25  {
26  std::stringstream ss;
27  ss<<"string cut based selection on collection: "<<src_;
28  description_.push_back(ss.str());
29  ss.str("");
30  description_.push_back(std::string("selection cut is: ")+pset.getParameter<std::string>("cut"));
31  if (pset.exists("order"))
33  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< edm::View< Object > > srcToken_
StringObjectFunction< Object > * order_
StringCutObjectSelector< Object > f_
std::vector< std::string > description_
Definition: EventSelector.h:34

Member Function Documentation

template<typename Object , bool any = false>
bool StringCutEventSelector< Object, any >::select ( const edm::Event ) const
inlinevirtual

decision of the selector module

Implements EventSelector.

Definition at line 35 of file StringCutEventSelector.h.

References any(), StringCutEventSelector< Object, any >::f_, newFWLiteAna::found, edm::Event::getByToken(), i, StringCutEventSelector< Object, any >::nFirst_, connectstrParser::o, StringCutEventSelector< Object, any >::order_, and StringCutEventSelector< Object, any >::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().

35  {
37  e.getByToken(srcToken_, oH);
38  std::vector<const Object*> copyToSort(oH->size());
39  for (uint i=0;i!=oH->size();++i) copyToSort[i]= &(*oH)[i];
40  if (order_)std::sort(copyToSort.begin(), copyToSort.end(), sortByStringFunction<Object>(order_));
41 
42  //reject events if not enough object in collection
43  // if ((nFirst_!=0) && (oH->size()<nFirst_)) return false;
44  unsigned int i=0;
45  unsigned int found=0;
46  for (;i!=oH->size();i++)
47  {
48  const Object & o = *(copyToSort[i]);
49  if (any){
50  if (f_(o)) ++found;
51  if (found>=nFirst_)
52  return true;
53  }
54  else{
55  //stop doing the check if reaching too far in the collection
56  if ((nFirst_!=0) && (i>=nFirst_)) break;
57  if (!f_(o)) return false;
58  }
59  }
60  return !any;
61  }
int i
Definition: DBlmapReader.cc:9
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:34
edm::EDGetTokenT< edm::View< Object > > srcToken_
StringObjectFunction< Object > * order_
StringCutObjectSelector< Object > f_

Member Data Documentation

template<typename Object , bool any = false>
StringCutObjectSelector<Object> StringCutEventSelector< Object, any >::f_
private
template<typename Object , bool any = false>
unsigned int StringCutEventSelector< Object, any >::nFirst_
private
template<typename Object , bool any = false>
StringObjectFunction<Object>* StringCutEventSelector< Object, any >::order_
private
template<typename Object , bool any = false>
edm::InputTag StringCutEventSelector< Object, any >::src_
private
template<typename Object , bool any = false>
edm::EDGetTokenT<edm::View<Object> > StringCutEventSelector< Object, any >::srcToken_
private