ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/DGele/PhysicsTools/PatAlgos/interface/BaseIsolator.h
Revision: 1.1.1.1 (vendor branch)
Committed: Tue Oct 20 17:15:14 2009 UTC (15 years, 6 months ago) by dgele
Content type: text/plain
Branch: ANA
CVS Tags: start
Changes since 1.1: +0 -0 lines
Log Message:
version CMSSW_2_2_10

File Contents

# User Rev Content
1 dgele 1.1 #ifndef PhysicsTools_PatAlgos_interface_BaseIsolator_h
2     #define PhysicsTools_PatAlgos_interface_BaseIsolator_h
3    
4     #include "DataFormats/Common/interface/ValueMap.h"
5     #include "FWCore/ParameterSet/interface/ParameterSet.h"
6     #include "FWCore/Framework/interface/Event.h"
7    
8     namespace pat { namespace helper {
9     class BaseIsolator {
10     public:
11     typedef edm::ValueMap<float> Isolation;
12     BaseIsolator() {}
13     BaseIsolator(const edm::ParameterSet &conf, bool withCut) ;
14     virtual ~BaseIsolator() {}
15     virtual void beginEvent(const edm::Event &event, const edm::EventSetup &eventSetup) = 0;
16     virtual void endEvent() = 0;
17    
18     /// Tests if the value associated to this item is strictly below the cut.
19     template<typename AnyRef> bool test(const AnyRef &ref) const {
20     bool ok = (getValue(ref.id(), ref.key()) < cut_);
21     try_++; if (!ok) fail_++;
22     return ok;
23     }
24     /// Returns the associated isolation value given any sort of ref
25     template<typename AnyRef> float getValue(const AnyRef &ref) const {
26     return getValue(ref.id(), ref.key());
27     }
28    
29     virtual std::string description() const = 0;
30     void print(std::ostream &out) const ;
31     protected:
32     virtual float getValue(const edm::ProductID &id, size_t index) const = 0;
33     edm::InputTag input_;
34     float cut_;
35     mutable uint64_t try_, fail_;
36     }; // class BaseIsolator
37     } } // namespaces
38    
39     inline std::ostream & operator<<(std::ostream &stream, const pat::helper::BaseIsolator &iso) {
40     iso.print(stream);
41     return stream;
42     }
43     #endif