CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/RecoMuon/MuonIsolation/interface/MuIsoBaseIsolator.h

Go to the documentation of this file.
00001 #ifndef MuonIsolation_MuIsoBaseIsolator_H
00002 #define MuonIsolation_MuIsoBaseIsolator_H
00003 
00004 #include <vector>
00005 #include "DataFormats/RecoCandidate/interface/IsoDeposit.h"
00006 #include "DataFormats/TrackReco/interface/Track.h"
00007 #include "DataFormats/Candidate/interface/Candidate.h"
00008 
00009 namespace muonisolation {
00010   class MuIsoBaseIsolator {
00011 
00012   public:
00013     typedef reco::IsoDeposit::Veto Veto;
00014     typedef reco::IsoDeposit::Vetos Vetos;
00015 
00016     struct DepositAndVetos {
00017       DepositAndVetos(): dep(0), vetos(0) {}
00018       DepositAndVetos(const reco::IsoDeposit* depA, const Vetos* vetosA = 0):
00019         dep(depA), vetos(vetosA) {}
00020       const reco::IsoDeposit* dep;
00021       const Vetos* vetos;
00022     };
00023     typedef std::vector<DepositAndVetos> DepositContainer;
00024   
00025     enum ResultType {
00026       ISOL_INT_TYPE = 0,
00027       ISOL_FLOAT_TYPE,
00028       ISOL_BOOL_TYPE,
00029       ISOL_INVALID_TYPE
00030     };
00031 
00032     class Result {
00033     public:
00034       Result() : valInt(-999), valFloat(-999), valBool(false), typeF_(ISOL_INVALID_TYPE) {}
00035         Result(ResultType typ) : valInt(-999), valFloat(-999.), valBool(false), typeF_(typ) {}
00036           
00037           template <typename T> T val() const;
00038           
00039           int valInt;
00040           float valFloat;
00041           bool valBool;
00042           ResultType typeF() const {return typeF_;}
00043 
00044     protected:
00045           ResultType typeF_;
00046     };
00047     
00048 
00049     virtual ~MuIsoBaseIsolator(){}
00050 
00052     virtual Result result(DepositContainer deposits) const = 0;
00054     virtual Result result(DepositContainer deposits, const reco::Candidate& muon) const {
00055       return result(deposits);
00056     }
00058     virtual Result result(DepositContainer deposits, const reco::Track& muon) const {
00059       return result(deposits);
00060     }
00061 
00062     virtual ResultType resultType() const = 0;
00063 
00064   };
00065 
00066   template<> inline int MuIsoBaseIsolator::Result::val<int>() const { return valInt;}
00067   template<> inline float MuIsoBaseIsolator::Result::val<float>() const { return valFloat;}
00068   template<> inline bool MuIsoBaseIsolator::Result::val<bool>() const { return valBool;}
00069   
00070 }
00071 #endif
00072