File indexing completed on 2023-03-17 11:16:34
0001 #include "JetMETCorrections/Type1MET/interface/CaloJetMETcorrInputProducerT.h"
0002
0003 #include "FWCore/Utilities/interface/Exception.h"
0004
0005 #include "DataFormats/PatCandidates/interface/Jet.h"
0006
0007 #include "PhysicsTools/PatUtils/interface/PATJetCorrExtractor.h"
0008
0009 namespace CaloJetMETcorrInputProducer_namespace {
0010 template <>
0011 class InputTypeCheckerT<pat::Jet> {
0012 public:
0013 void operator()(const pat::Jet& jet) const {
0014
0015 if (!jet.isCaloJet())
0016 throw cms::Exception("InvalidInput") << "Input pat::Jet is not of Calo-type !!\n";
0017 }
0018 bool isPatJet(const pat::Jet& jet) const { return true; }
0019 };
0020
0021 template <>
0022 class RawJetExtractorT<pat::Jet> {
0023 public:
0024 RawJetExtractorT() {}
0025
0026 reco::Candidate::LorentzVector operator()(const pat::Jet& jet) const {
0027 if (jet.jecSetsAvailable())
0028 return jet.correctedP4("Uncorrected");
0029 else
0030 return jet.p4();
0031 }
0032 };
0033 }
0034
0035 typedef CaloJetMETcorrInputProducerT<pat::Jet, PATJetCorrExtractor> PATCaloJetMETcorrInputProducer;
0036
0037 #include "FWCore/Framework/interface/MakerMacros.h"
0038
0039 DEFINE_FWK_MODULE(PATCaloJetMETcorrInputProducer);