CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L6SLBCorrector.cc
Go to the documentation of this file.
1 //
3 // L6SLBCorrector
4 // --------------
5 //
6 // 25/10/2009 Hauke Held <hauke.held@cern.ch>
7 // Philipp Schieferdecker <philipp.schieferdecker@cern.ch
9 
11 
16 
18 
19 
20 #include <string>
21 
22 
23 using namespace std;
24 
25 
27 // construction / destruction
29 
30 //______________________________________________________________________________
32  : addMuonToJet_(fConfig.getParameter<bool>("addMuonToJet"))
33  , srcBTagInfoElec_(fConfig.getParameter<edm::InputTag>("srcBTagInfoElectron"))
34  , srcBTagInfoMuon_(fConfig.getParameter<edm::InputTag>("srcBTagInfoMuon"))
35  , corrector_(0)
36 {
37  vector<JetCorrectorParameters> vParam;
38  vParam.push_back(fParam);
40 }
41 
42 //______________________________________________________________________________
44 {
45  delete corrector_;
46 }
47 
48 
50 // implementation of member functions
52 
53 //______________________________________________________________________________
54 double L6SLBCorrector::correction(const LorentzVector& fJet) const
55 {
56  throw cms::Exception("EventRequired")
57  <<"Wrong interface correction(LorentzVector), event required!";
58  return 1.0;
59 }
60 
61 
62 //______________________________________________________________________________
63 double L6SLBCorrector::correction(const reco::Jet& fJet) const
64 {
65  throw cms::Exception("EventRequired")
66  <<"Wrong interface correction(reco::Jet), event required!";
67  return 1.0;
68 }
69 
70 
71 //______________________________________________________________________________
73  const edm::RefToBase<reco::Jet>& refToRawJet,
74  const edm::Event& fEvent,
75  const edm::EventSetup& fSetup) const
76 {
78  values.setJetPt(fJet.pt());
79  values.setJetEta(fJet.eta());
80  values.setJetPhi(fJet.phi());
81  values.setJetE(fJet.energy());
82 
84  fEvent.getByLabel(srcBTagInfoMuon_,muoninfos);
85 
86  const reco::SoftLeptonTagInfo& sltMuon =
87  (*muoninfos)[getBTagInfoIndex(refToRawJet,*muoninfos)];
88  if (sltMuon.leptons()>0) {
89  edm::RefToBase<reco::Track> trackRef = sltMuon.lepton(0);
90  values.setLepPx(trackRef->px());
91  values.setLepPy(trackRef->py());
92  values.setLepPz(trackRef->pz());
94  return corrector_->getCorrection(values);
95  }
96  else {
98  fEvent.getByLabel(srcBTagInfoElec_,elecinfos);
99  const reco::SoftLeptonTagInfo& sltElec =
100  (*elecinfos)[getBTagInfoIndex(refToRawJet,*elecinfos)];
101  if (sltElec.leptons()>0) {
102  edm::RefToBase<reco::Track> trackRef = sltElec.lepton(0);
103  values.setLepPx(trackRef->px());
104  values.setLepPy(trackRef->py());
105  values.setLepPz(trackRef->pz());
106  values.setAddLepToJet(false);
107  return corrector_->getCorrection(values);
108  }
109  }
110  return 1.0;
111 }
112 
113 
115 // implementation of private member functions
117 
118 //______________________________________________________________________________
120  const vector<reco::SoftLeptonTagInfo>& tags)
121  const
122 {
123  for (unsigned int i=0;i<tags.size();i++)
124  if (tags[i].jet().get()==refToRawJet.get()) return i;
125  return -1;
126 }
value_type const * get() const
Definition: RefToBase.h:225
int i
Definition: DBlmapReader.cc:9
virtual double correction(const LorentzVector &fJet) const
apply correction using Jet information only
Base class for all types of Jets.
Definition: Jet.h:20
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:614
virtual double eta() const
momentum pseudorapidity
virtual double pt() const
transverse momentum
FactorizedJetCorrectorCalculator * corrector_
virtual double energy() const
energy
L6SLBCorrector(const JetCorrectorParameters &fParam, const edm::ParameterSet &fConfig)
virtual ~L6SLBCorrector()
edm::InputTag srcBTagInfoMuon_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:420
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:626
tuple tags
Definition: o2o.py:248
int getBTagInfoIndex(const edm::RefToBase< reco::Jet > &refToRawJet, const std::vector< reco::SoftLeptonTagInfo > &tags) const
edm::InputTag srcBTagInfoElec_
virtual double phi() const
momentum azimuthal angle
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:620
reco::Particle::LorentzVector LorentzVector
Definition: JetCorrector.h:23