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

◆ StringCutsEventSelector() [1/2]

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.

◆ StringCutsEventSelector() [2/2]

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.

78  : EventSelector(pset, iC),
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] != "-") {
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"))
101  order_ = new StringObjectFunction<Object>(pset.getParameter<std::string>("order"));
102  }

References EventSelector::description_, StringCutsEventSelector< Object, existenceMatter >::f_, mps_fire::i, StringCutsEventSelector< Object, existenceMatter >::order_, muonDTDigis_cfi::pset, corrVsCorr::selection, StringCutsEventSelector< Object, existenceMatter >::src_, contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~StringCutsEventSelector()

template<typename Object , bool existenceMatter = true>
StringCutsEventSelector< Object, existenceMatter >::~StringCutsEventSelector ( )
inlineoverride

Definition at line 103 of file StringCutEventSelector.h.

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  }

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

Member Function Documentation

◆ select()

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.

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  }

References MillePedeFileConverter_cfg::e, StringCutsEventSelector< Object, existenceMatter >::f_, mps_fire::i, EcalTangentSkim_cfg::o, StringCutsEventSelector< Object, existenceMatter >::order_, jetUpdater_cfi::sort, StringCutsEventSelector< Object, existenceMatter >::srcToken_, and parallelization::uint.

Member Data Documentation

◆ f_

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

◆ order_

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

◆ src_

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

◆ srcToken_

template<typename Object , bool existenceMatter = true>
edm::EDGetTokenT<edm::View<Object> > StringCutsEventSelector< Object, existenceMatter >::srcToken_
private
mps_fire.i
i
Definition: mps_fire.py:428
StringObjectFunction< Object >
StringCutsEventSelector::StringCutsEventSelector
StringCutsEventSelector(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
Definition: StringCutEventSelector.h:75
edm::Handle
Definition: AssociativeIterator.h:50
parallelization.uint
uint
Definition: parallelization.py:124
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:42
EventSelector::description_
std::vector< std::string > description_
Definition: EventSelector.h:33
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
corrVsCorr.selection
selection
main part
Definition: corrVsCorr.py:100
sortByStringFunction
Definition: StringObjectFunction.h:34
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
StringCutsEventSelector::srcToken_
edm::EDGetTokenT< edm::View< Object > > srcToken_
Definition: StringCutEventSelector.h:140
edm::View
Definition: CaloClusterFwd.h:14
EventSelector::EventSelector
EventSelector()
Definition: EventSelector.h:18
StringCutsEventSelector::order_
StringObjectFunction< Object > * order_
Definition: StringCutEventSelector.h:142
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
edm::Service
Definition: Service.h:30
StringCutsEventSelector::f_
std::vector< StringCutObjectSelector< Object > * > f_
Definition: StringCutEventSelector.h:141
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
StringCutObjectSelector< Object >
StringCutsEventSelector::src_
edm::InputTag src_
Definition: StringCutEventSelector.h:139
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37