CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CategoryCriteria.h
Go to the documentation of this file.
1 #ifndef CategoryCriteria_h
2 #define CategoryCriteria_h
3 
6 
8 
9 
11 template <typename Collection, typename Classifier>
13 {
14 
15 public:
16 
17  // Input collection type
18  typedef Collection collection;
19 
20  // Type of the collection elements
21  typedef typename Collection::value_type type;
22 
23  // Oumemberut collection type
24  typedef std::vector<const type *> container;
25 
26  // Iterator over result collection type.
27  typedef typename container::const_iterator const_iterator;
28 
29  // Constructor from parameter set configurability
31  classifier_(config,std::move(iC)),
32  evaluate_( config.getParameter<std::string>("cut") ) {}
33 
34  // Select object from a collection and possibly event content
35  void select(const edm::Handle<collection> & collectionHandler, const edm::Event & event, const edm::EventSetup & setup)
36  {
37 
38  selected_.clear();
39 
40  // const collection & collectionPointer = *(collectionHandler.product());
41 
42  classifier_.newEvent(event, setup);
43 
44  for (typename collection::size_type i = 0; i < collectionHandler->size(); ++i)
45  {
46  edm::Ref<Collection> member(collectionHandler, i);
47 
48  classifier_.evaluate(member);
49 
50  // Classifier is evaluated using StringCutObjectSelector
51  if ( evaluate_(classifier_) )
52  selected_.push_back( &(*member) );
53  }
54  }
55 
56  // Iterators over selected objects: collection begin
58  {
59  return selected_.begin();
60  }
61 
62  // Iterators over selected objects: collection end
64  {
65  return selected_.end();
66  }
67 
68  // True if no object has been selected
69  std::size_t size() const
70  {
71  return selected_.size();
72  }
73 
74 private:
75 
77 
78  Classifier classifier_;
79 
81 
82 };
83 
84 
85 #endif
int i
Definition: DBlmapReader.cc:9
Classifier classifier_
Collection collection
std::size_t size() const
const_iterator begin() const
CategoryCriteria(const edm::ParameterSet &config, edm::ConsumesCollector &&iC)
uint16_t size_type
std::vector< const type * > container
void select(const edm::Handle< collection > &collectionHandler, const edm::Event &event, const edm::EventSetup &setup)
Collection::value_type type
def move
Definition: eostools.py:510
Implement a selector given a track or vertex collection and track or vertex classifier.
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
Container::value_type value_type
StringCutObjectSelector< typename Classifier::Categories > evaluate_
container::const_iterator const_iterator
const_iterator end() const
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")