File indexing completed on 2024-09-07 04:37:23
0001 #ifndef PhysicsTools_SelectorUtils_CutApplicatorBase_h
0002 #define PhysicsTools_SelectorUtils_CutApplicatorBase_h
0003
0004
0005
0006
0007
0008 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0009
0010 #include "FWCore/Common/interface/EventBase.h"
0011
0012 #include "DataFormats/TrackReco/interface/Track.h"
0013 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0014
0015 #include "DataFormats/RecoCandidate/interface/IsoDeposit.h"
0016
0017 #include "PhysicsTools/SelectorUtils/interface/CandidateCut.h"
0018
0019 namespace candf = candidate_functions;
0020
0021 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
0022 #include "DataFormats/EgammaCandidates/interface/Photon.h"
0023 #include "DataFormats/MuonReco/interface/Muon.h"
0024 #include "DataFormats/TauReco/interface/PFTau.h"
0025
0026 #include "DataFormats/PatCandidates/interface/Electron.h"
0027 #include "DataFormats/PatCandidates/interface/Photon.h"
0028 #include "DataFormats/PatCandidates/interface/Muon.h"
0029 #include "DataFormats/PatCandidates/interface/Tau.h"
0030
0031 namespace reco {
0032 typedef edm::Ptr<reco::GsfElectron> GsfElectronPtr;
0033 typedef edm::Ptr<reco::Photon> PhotonPtr;
0034 typedef edm::Ptr<reco::Muon> MuonPtr;
0035 typedef edm::Ptr<reco::PFTau> PFTauPtr;
0036 }
0037
0038 namespace pat {
0039 typedef edm::Ptr<pat::Electron> ElectronPtr;
0040 typedef edm::Ptr<pat::Photon> PhotonPtr;
0041 typedef edm::Ptr<pat::Muon> MuonPtr;
0042 typedef edm::Ptr<pat::Tau> TauPtr;
0043 }
0044
0045 class CutApplicatorBase : public candf::CandidateCut {
0046 public:
0047 enum CandidateType { NONE, ELECTRON, MUON, PHOTON, TAU, PATELECTRON, PATMUON, PATPHOTON, PATTAU };
0048
0049 CutApplicatorBase() : CandidateCut() {}
0050
0051 CutApplicatorBase(const edm::ParameterSet& c) : _name(c.getParameter<std::string>("cutName")) {}
0052 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
0053 CutApplicatorBase(const CutApplicatorBase&) = delete;
0054 CutApplicatorBase& operator=(const CutApplicatorBase&) = delete;
0055 #endif
0056
0057 result_type operator()(const argument_type&) const final;
0058
0059
0060 virtual result_type operator()(const reco::GsfElectronPtr&) const { return false; }
0061 virtual result_type operator()(const pat::ElectronPtr&) const { return false; }
0062
0063
0064 virtual result_type operator()(const reco::PhotonPtr&) const { return false; }
0065 virtual result_type operator()(const pat::PhotonPtr&) const { return false; }
0066
0067
0068 virtual result_type operator()(const reco::MuonPtr&) const { return false; }
0069 virtual result_type operator()(const pat::MuonPtr&) const { return false; }
0070
0071
0072 virtual result_type operator()(const reco::PFTauPtr&) const { return false; }
0073 virtual result_type operator()(const pat::TauPtr&) const { return false; }
0074
0075
0076 virtual result_type asCandidate(const argument_type&) const { return false; }
0077
0078 virtual CandidateType candidateType() const { return NONE; }
0079
0080 const std::string& name() const override { return _name; }
0081
0082
0083 ~CutApplicatorBase() override {}
0084
0085 private:
0086 const std::string _name;
0087 };
0088
0089 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
0090 #include "FWCore/PluginManager/interface/PluginFactory.h"
0091 typedef edmplugin::PluginFactory<CutApplicatorBase*(const edm::ParameterSet&)> CutApplicatorFactory;
0092 #endif
0093
0094 #endif