CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BaseIsolator.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_PatAlgos_interface_BaseIsolator_h
2 #define PhysicsTools_PatAlgos_interface_BaseIsolator_h
3 
8 
9 namespace pat { namespace helper {
10 class BaseIsolator {
11  public:
14  BaseIsolator(const edm::ParameterSet &conf, edm::ConsumesCollector & iC, bool withCut) ;
15  virtual ~BaseIsolator() {}
16  virtual void beginEvent(const edm::Event &event, const edm::EventSetup &eventSetup) = 0;
17  virtual void endEvent() = 0;
18 
20  template<typename AnyRef> bool test(const AnyRef &ref) const {
21  bool ok = (getValue(ref.id(), ref.key()) < cut_);
22  try_++; if (!ok) fail_++;
23  return ok;
24  }
26  template<typename AnyRef> float getValue(const AnyRef &ref) const {
27  return getValue(ref.id(), ref.key());
28  }
29 
30  virtual std::string description() const = 0;
31  void print(std::ostream &out) const ;
32  protected:
33  virtual float getValue(const edm::ProductID &id, size_t index) const = 0;
36  float cut_;
37  mutable uint64_t try_, fail_;
38 }; // class BaseIsolator
39 } } // namespaces
40 
41 inline std::ostream & operator<<(std::ostream &stream, const pat::helper::BaseIsolator &iso) {
42  iso.print(stream);
43  return stream;
44 }
45 #endif
void print(std::ostream &out) const
Definition: BaseIsolator.cc:16
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
virtual void beginEvent(const edm::Event &event, const edm::EventSetup &eventSetup)=0
edm::EDGetTokenT< Isolation > inputToken_
Definition: BaseIsolator.h:35
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
virtual std::string description() const =0
edm::ValueMap< float > Isolation
Definition: BaseIsolator.h:12
tuple out
Definition: dbtoconf.py:99
unsigned long long uint64_t
Definition: Time.h:15
bool test(const AnyRef &ref) const
Tests if the value associated to this item is strictly below the cut.
Definition: BaseIsolator.h:20
virtual void endEvent()=0
float getValue(const AnyRef &ref) const
Returns the associated isolation value given any sort of ref.
Definition: BaseIsolator.h:26