CMS 3D CMS Logo

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