File indexing completed on 2024-04-06 12:24:10
0001 #include "PhysicsTools/SelectorUtils/interface/CutApplicatorBase.h"
0002
0003 EDM_REGISTER_PLUGINFACTORY(CutApplicatorFactory, "CutApplicatorFactory");
0004
0005 CutApplicatorBase::result_type CutApplicatorBase::operator()(const CutApplicatorBase::argument_type& arg) const {
0006 if (arg.isNull()) {
0007 throw cms::Exception("BadProductPtr") << _name << "received a bad product ref to process!" << std::endl;
0008 }
0009
0010 switch (candidateType()) {
0011 case ELECTRON: {
0012 const reco::GsfElectronPtr ele(arg);
0013 return this->operator()(ele);
0014 } break;
0015 case MUON: {
0016 const reco::MuonPtr mu(arg);
0017 return this->operator()(mu);
0018 } break;
0019 case PHOTON: {
0020 const reco::PhotonPtr pho(arg);
0021 return this->operator()(pho);
0022 } break;
0023 case TAU: {
0024 const reco::PFTauPtr tau(arg);
0025 return this->operator()(tau);
0026 } break;
0027 case PATELECTRON: {
0028 const pat::ElectronPtr ele(arg);
0029 return this->operator()(ele);
0030 } break;
0031 case PATMUON: {
0032 const pat::MuonPtr mu(arg);
0033 return this->operator()(mu);
0034 } break;
0035 case PATPHOTON: {
0036 const pat::PhotonPtr pho(arg);
0037 return this->operator()(pho);
0038 } break;
0039 case PATTAU: {
0040 const pat::TauPtr tau(arg);
0041 return this->operator()(tau);
0042 } break;
0043 case NONE: {
0044 return asCandidate(arg);
0045 break;
0046 }
0047 default:
0048 throw cms::Exception("BadCandidateType") << "Unknown candidate type";
0049 }
0050 }