CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1FastjetCorrectorImpl.cc
Go to the documentation of this file.
1 //
3 // L1FastjetCorrector
4 // ------------------
5 //
6 // 08/09/2009 Philipp Schieferdecker <philipp.schieferdecker@cern.ch>
8 
12 
19 
24 
25 using namespace std;
26 
28  edm::ConsumesCollector fCollector):
30  rhoToken_(fCollector.consumes<double>(fConfig.getParameter<edm::InputTag>("srcRho")))
31 {
32 }
33 
34 std::unique_ptr<reco::JetCorrectorImpl>
36  auto corrector = getCalculator(fSetup, [](const std::string& level) {
37  if(level != "L1FastJet") {
38  throw cms::Exception("L1FastjetCorrector")<<" correction level: "<<level<<" is not L1FastJet";
39  }
40  });
41 
43  fEvent.getByToken(rhoToken_,hRho);
44  return std::unique_ptr<L1FastjetCorrectorImpl>(new L1FastjetCorrectorImpl(corrector, *hRho) );
45 }
46 
47 void
49 {
51  addToDescription(desc);
52  desc.add<edm::InputTag>("srcRho");
53  iDescriptions.addDefault(desc);
54 }
55 
56 
57 //______________________________________________________________________________
59 // implementation of member functions
61 
62 //______________________________________________________________________________
64 {
65  throw cms::Exception("EventRequired")
66  <<"Wrong interface correction(LorentzVector), event required!";
67  return 1.0;
68 }
69 
70 
71 //______________________________________________________________________________
73 {
75  values.setJetEta(fJet.eta());
76  values.setJetPt(fJet.pt());
77  values.setJetE(fJet.energy());
78  values.setJetA(fJet.jetArea());
79  values.setRho(rho_);
80  return corrector_->getCorrection(values);
81 }
82 
83 
84 
85 
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
edm::EDGetTokenT< double > rhoToken_
Base class for all types of Jets.
Definition: Jet.h:20
virtual double correction(const LorentzVector &fJet) const
apply correction using Jet information only
reco::Particle::LorentzVector LorentzVector
virtual double eta() const
momentum pseudorapidity
virtual double pt() const
transverse momentum
virtual double energy() const
energy
std::unique_ptr< reco::JetCorrectorImpl > make(edm::Event const &, edm::EventSetup const &)
void addDefault(ParameterSetDescription const &psetDescription)
tuple corrector
Definition: mvaPFMET_cff.py:86
static void fillDescriptions(edm::ConfigurationDescriptions &iDescriptions)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
L1FastjetCorrectorImplMaker(edm::ParameterSet const &, edm::ConsumesCollector)
std::shared_ptr< FactorizedJetCorrectorCalculator const > corrector_
virtual float jetArea() const
get jet area
Definition: Jet.h:105
static void addToDescription(edm::ParameterSetDescription &iDescription)
tuple level
Definition: testEve_cfg.py:34
std::shared_ptr< FactorizedJetCorrectorCalculator const > getCalculator(edm::EventSetup const &, std::function< void(std::string const &)> levelCheck)