CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MultiIsolator.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_PatAlgos_interface_MultiIsolator_h
2 #define PhysicsTools_PatAlgos_interface_MultiIsolator_h
3 
7 
9 #include "boost/ptr_container/ptr_vector.hpp"
10 
12 
13 namespace pat { namespace helper {
15  public:
16  typedef std::vector<std::pair<pat::IsolationKeys,float> > IsolationValuePairs;
20 
21  // adds an isolator (and takes onwership of the pointer)
22  void addIsolator(BaseIsolator *iso, uint32_t mask, pat::IsolationKeys key) ;
23 
24  // parses an isolator and adds it to the list
25  void addIsolator(const edm::ParameterSet &conf, edm::ConsumesCollector & iC, bool withCut, uint32_t mask, pat::IsolationKeys key) ;
26 
27  // Parses out an isolator, and returns a pointer to it.
28  // For an empty PSet, it returns a null pointer.
29  // You own the returned pointer!
30  static BaseIsolator * make(const edm::ParameterSet &conf, edm::ConsumesCollector & iC, bool withCut) ;
31 
32  void beginEvent(const edm::Event &event, const edm::EventSetup &eventSetup);
33  void endEvent() ;
34 
35  template<typename T>
36  uint32_t test(const edm::View<T> &coll, int idx) const;
37 
38  template<typename T>
39  void fill(const edm::View<T> &coll, int idx, IsolationValuePairs& isolations) const ;
40 
42  template<typename RefType>
43  void fill(const RefType &ref, IsolationValuePairs& isolations) const ;
44 
45  void print(std::ostream &out) const ;
46 
47  std::string printSummary() const ;
48 
50  bool enabled() const { return !isolators_.empty(); }
51  private:
52  boost::ptr_vector<BaseIsolator> isolators_;
53  std::vector<uint32_t> masks_;
54  std::vector<pat::IsolationKeys> keys_;
55 };
56 
57  template<typename T>
58  uint32_t
59  MultiIsolator::test(const edm::View<T> &coll, int idx) const {
60  uint32_t retval = 0;
61  edm::RefToBase<T> rb = coll.refAt(idx); // edm::Ptr<T> in a shiny new future to come one remote day ;-)
62  for (size_t i = 0, n = isolators_.size(); i < n; ++i) {
63  if (!isolators_[i].test(rb)) retval |= masks_[i];
64  }
65  return retval;
66  }
67 
68  template<typename RefType>
69  void
70  MultiIsolator::fill(const RefType &rb, IsolationValuePairs & isolations) const
71  {
72  isolations.resize(isolators_.size());
73  for (size_t i = 0, n = isolators_.size(); i < n; ++i) {
74  isolations[i].first = keys_[i];
75  isolations[i].second = isolators_[i].getValue(rb);
76  }
77  }
78 
79 
80  template<typename T>
81  void
82  MultiIsolator::fill(const edm::View<T> &coll, int idx, IsolationValuePairs & isolations) const
83  {
84  edm::RefToBase<T> rb = coll.refAt(idx);
85  fill(rb, isolations);
86  }
87 
88 }} // namespace
89 
90 #endif
91 
int i
Definition: DBlmapReader.cc:9
std::vector< uint32_t > masks_
Definition: MultiIsolator.h:53
boost::ptr_vector< BaseIsolator > isolators_
Definition: MultiIsolator.h:52
void print(std::ostream &out) const
IsolationKeys
Enum defining isolation keys.
Definition: Isolation.h:9
bool enabled() const
True if it has a non null configuration.
Definition: MultiIsolator.h:50
void beginEvent(const edm::Event &event, const edm::EventSetup &eventSetup)
std::string printSummary() const
static BaseIsolator * make(const edm::ParameterSet &conf, edm::ConsumesCollector &iC, bool withCut)
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
tuple conf
Definition: dbtoconf.py:185
tuple out
Definition: dbtoconf.py:99
uint32_t test(const edm::View< T > &coll, int idx) const
Definition: MultiIsolator.h:59
std::vector< pat::IsolationKeys > keys_
Definition: MultiIsolator.h:54
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
std::vector< std::pair< pat::IsolationKeys, float > > IsolationValuePairs
Definition: MultiIsolator.h:16
list key
Definition: combine.py:13
void addIsolator(BaseIsolator *iso, uint32_t mask, pat::IsolationKeys key)
void fill(const edm::View< T > &coll, int idx, IsolationValuePairs &isolations) const
Definition: MultiIsolator.h:82